Commit 06ceb0a4 authored by Floréal Cabanettes's avatar Floréal Cabanettes

Add description to transactions

parent 295f1b39
......@@ -43,7 +43,9 @@
<div id="transactions">
<div class="transaction">
<hr width="50%">
<label class="first">Montant</label>
<label class="first">Description</label>
<input class="description" type="text" maxlength="255"/>
<label>Montant</label>
<input class="money amount" type="number" step="0.01"/>
<label>Catégorie</label>
<select class="category select2">
......
......@@ -81,14 +81,16 @@ trackmybank.send = function() {
let valid = true;
$.each($("#transactions").find(".transaction"), function(t, transaction) {
let tr = $(transaction);
let description = tr.find(".description").val();
let montant = tr.find(".amount").val();
let category = tr.find(".category").val();
if (montant === "" || category === "") {
if (montant === "" || category === "" || description === "") {
trackmybank.notify("error", "Erreur : tous les champs sont requis !");
valid = false;
return false;
}
transactions.push({
"description": description,
"amount": parseFloat(montant),
"category": parseInt(category)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment