1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-29 20:51:11 +02:00

Add transaction type field

This commit is contained in:
Yohann D'ANELLO
2020-03-16 12:11:16 +01:00
committed by Bombar Maxime
parent a1f37f0eea
commit 7b98244360
8 changed files with 245 additions and 195 deletions

View File

@ -128,6 +128,22 @@ function addConso(dest, amount, type, category_id, category_name, template_id, t
consumeAll();
}
/**
* Reset the page as its initial state.
*/
function reset() {
notes_display.length = 0;
notes.length = 0;
buttons.length = 0;
$("#note_list").html("");
$("#alias_matched").html("");
$("#consos_list").html("");
displayNote(null, "");
refreshHistory();
refreshBalance();
}
/**
* Apply all transactions: all notes in `notes` buy each item in `buttons`
*/
@ -161,19 +177,14 @@ function consume(source, dest, quantity, amount, reason, type, category, templat
"valid": true,
"polymorphic_ctype": type,
"resourcetype": "TemplateTransaction",
"type": "template",
"source": source,
"destination": dest,
"category": category,
"template": template
}, function() {
notes_display.length = 0;
notes.length = 0;
buttons.length = 0;
$("#note_list").html("");
$("#alias_matched").html("");
$("#consos_list").html("");
displayNote(null, "");
refreshHistory();
refreshBalance();
});
}, reset).fail(function (e) {
reset();
addMsg("Une erreur est survenue lors de la transaction : " + e.responseText, "danger");
});
}