1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-29 12:50:55 +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

@ -15,6 +15,18 @@ function pretty_money(value) {
+ (Math.abs(value) % 100 < 10 ? "0" : "") + (Math.abs(value) % 100) + " €";
}
/**
* Add a message on the top of the page.
* @param msg The message to display
* @param alert_type The type of the alert. Choices: info, success, warning, danger
*/
function addMsg(msg, alert_type) {
let msgDiv = $("#messages");
let html = msgDiv.html();
html += "<div class=\"alert alert-" + alert_type + "\">" + msg + "</div>\n";
msgDiv.html(html);
}
/**
* Reload the balance of the user on the right top corner
*/
@ -256,11 +268,8 @@ function de_validate(id, validated) {
refreshHistory();
},
error: function(err) {
let msgDiv = $("#messages");
let html = msgDiv.html();
html += "<div class='alert alert-danger'>Une erreur est survenue lors de la validation/dévalidation " +
"de cette transaction : " + err.responseText + "</div>";
msgDiv.html(html);
addMsg("Une erreur est survenue lors de la validation/dévalidation " +
"de cette transaction : " + err.responseText, "danger");
refreshBalance();
// error if this method doesn't exist. Please define it.