1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-29 12:50:55 +02:00

Last and first name didn't auto-complete because of a bug

This commit is contained in:
Yohann D'ANELLO
2020-03-24 01:34:47 +01:00
parent a52741b87f
commit 1b03eac95b
2 changed files with 22 additions and 7 deletions

View File

@ -39,10 +39,21 @@ $(document).ready(function() {
last.quantity = 1;
$.getJSON("/api/user/" + last.note.user + "/", function(user) {
$("#last_name").val(user.last_name);
$("#first_name").val(user.first_name);
});
if (!last.note.user) {
$.getJSON("/api/note/note/" + last.note.id + "/?format=json", function(note) {
last.note.user = note.user;
$.getJSON("/api/user/" + last.note.user + "/", function(user) {
$("#last_name").val(user.last_name);
$("#first_name").val(user.first_name);
});
});
}
else {
$.getJSON("/api/user/" + last.note.user + "/", function(user) {
$("#last_name").val(user.last_name);
$("#first_name").val(user.first_name);
});
}
}
return true;