From 31205b9b5d3519de1666bcbe5ff2635dffa3e4a0 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 10 Apr 2020 02:42:21 +0200 Subject: [PATCH] Fix devalidation, clear class on note description --- static/js/base.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/static/js/base.js b/static/js/base.js index fc933794..43aa5ce3 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -123,6 +123,7 @@ function displayNote(note, alias, user_note_field=null, profile_pic_field=null) alias += " (aka. " + note.name + ")"; if (user_note_field !== null) + $("#" + user_note_field).removeAttr('class'); $("#" + user_note_field).addClass(displayStyle(note.balance)); $("#" + user_note_field).text(alias + (note.balance == null ? "" : (":\n" + pretty_money(note.balance)))); 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 function de_validate(id, validated) { + let invalidity_reason = $("#invalidity_reason_" + id).val(); $("#validate_" + id).html("⟳ ..."); // 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({ "url": "/api/note/transaction/transaction/" + id + "/", type: "PATCH", @@ -333,9 +335,9 @@ function de_validate(id, validated) { "X-CSRFTOKEN": CSRF_TOKEN }, data: { - resourcetype: "RecurrentTransaction", - valid: !validated, - invalidity_reason: invalidity_reason, + "resourcetype": "RecurrentTransaction", + "valid": !validated, + "invalidity_reason": invalidity_reason, }, success: function () { // Refresh jQuery objects