Warn users when a transaction has no source or no destination
This commit is contained in:
parent
58fe8914cf
commit
0e3c4fcaf6
4 changed files with 31 additions and 12 deletions
|
|
@ -154,6 +154,22 @@ function reset() {
|
|||
* Apply all transactions: all notes in `notes` buy each item in `buttons`
|
||||
*/
|
||||
function consumeAll() {
|
||||
let error = false;
|
||||
|
||||
if (notes_display.length === 0) {
|
||||
$("#note").addClass('is-invalid');
|
||||
$("#note_list").html(li("", "<strong>Ajoutez des émetteurs.</strong>", "text-danger"));
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (buttons.length === 0) {
|
||||
$("#consos_list").html(li("", "<strong>Ajoutez des consommations.</strong>", "text-danger"));
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (error)
|
||||
return;
|
||||
|
||||
notes_display.forEach(function(note_display) {
|
||||
buttons.forEach(function(button) {
|
||||
consume(note_display.note, note_display.name, button.dest, button.quantity * note_display.quantity, button.amount,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue