1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-27 02:43:01 +00:00

Fix devalidation, clear class on note description

This commit is contained in:
Yohann D'ANELLO 2020-04-10 02:42:21 +02:00
parent 6477590cd4
commit 31205b9b5d

View File

@ -123,6 +123,7 @@ function displayNote(note, alias, user_note_field=null, profile_pic_field=null)
alias += " (aka. " + note.name + ")"; alias += " (aka. " + note.name + ")";
if (user_note_field !== null) if (user_note_field !== null)
$("#" + user_note_field).removeAttr('class');
$("#" + user_note_field).addClass(displayStyle(note.balance)); $("#" + user_note_field).addClass(displayStyle(note.balance));
$("#" + user_note_field).text(alias + (note.balance == null ? "" : (":\n" + pretty_money(note.balance)))); $("#" + user_note_field).text(alias + (note.balance == null ? "" : (":\n" + pretty_money(note.balance))));
if (profile_pic_field != null){ if (profile_pic_field != null){
@ -321,10 +322,11 @@ function autoCompleteNote(field_id, alias_matched_id, note_list_id, notes, notes
// When a validate button is clicked, we switch the validation status // When a validate button is clicked, we switch the validation status
function de_validate(id, validated) { function de_validate(id, validated) {
let invalidity_reason = $("#invalidity_reason_" + id).val();
$("#validate_" + id).html("<strong style=\"font-size: 16pt;\">⟳ ...</strong>"); $("#validate_" + id).html("<strong style=\"font-size: 16pt;\">⟳ ...</strong>");
// Perform a PATCH request to the API in order to update the transaction // Perform a PATCH request to the API in order to update the transaction
// If the user has insuffisent rights, an error message will appear // If the user has insufficient rights, an error message will appear
$.ajax({ $.ajax({
"url": "/api/note/transaction/transaction/" + id + "/", "url": "/api/note/transaction/transaction/" + id + "/",
type: "PATCH", type: "PATCH",
@ -333,9 +335,9 @@ function de_validate(id, validated) {
"X-CSRFTOKEN": CSRF_TOKEN "X-CSRFTOKEN": CSRF_TOKEN
}, },
data: { data: {
resourcetype: "RecurrentTransaction", "resourcetype": "RecurrentTransaction",
valid: !validated, "valid": !validated,
invalidity_reason: invalidity_reason, "invalidity_reason": invalidity_reason,
}, },
success: function () { success: function () {
// Refresh jQuery objects // Refresh jQuery objects