mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-25 11:37:22 +02:00
Give a reason when a transaction is invalidated
This commit is contained in:
@ -260,8 +260,29 @@ function autoCompleteNote(field_id, alias_matched_id, note_list_id, notes, notes
|
||||
});
|
||||
}
|
||||
|
||||
function hover_validation_btn(id, show) {
|
||||
let reason_obj = $("#invalidity_reason_" + id);
|
||||
console.log(reason_obj.val());
|
||||
|
||||
if (show) {
|
||||
reason_obj.show();
|
||||
reason_obj.focus();
|
||||
}
|
||||
else
|
||||
reason_obj.hide();
|
||||
}
|
||||
|
||||
// When a validate button is clicked, we switch the validation status
|
||||
function de_validate(id, validated) {
|
||||
function in_validate(id, validated) {
|
||||
|
||||
let invalidity_reason;
|
||||
let reason_obj = $("#invalidity_reason_" + id);
|
||||
|
||||
if (validated)
|
||||
invalidity_reason = reason_obj.val();
|
||||
else
|
||||
invalidity_reason = null;
|
||||
|
||||
$("#validate_" + id).html("<strong style=\"font-size: 16pt;\">⟳ ...</strong>");
|
||||
|
||||
// Perform a PATCH request to the API in order to update the transaction
|
||||
@ -274,12 +295,13 @@ function de_validate(id, validated) {
|
||||
"X-CSRFTOKEN": CSRF_TOKEN
|
||||
},
|
||||
data: {
|
||||
"resourcetype": "RecurrentTransaction",
|
||||
valid: !validated
|
||||
resourcetype: "RecurrentTransaction",
|
||||
valid: !validated,
|
||||
invalidity_reason: invalidity_reason,
|
||||
},
|
||||
success: function () {
|
||||
// Refresh jQuery objects
|
||||
$(".validate").click(de_validate);
|
||||
$(".validate").click(in_validate);
|
||||
|
||||
refreshBalance();
|
||||
// error if this method doesn't exist. Please define it.
|
||||
|
Reference in New Issue
Block a user