From 0b112b3d59e007a9d180f3ade040a0587ebc4854 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 23 Oct 2018 14:33:07 +0200 Subject: [PATCH] #744 fix edit sale bug --- client/ticket/src/sale/index.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/client/ticket/src/sale/index.js b/client/ticket/src/sale/index.js index 70f44bf5b..fd0d0b05c 100644 --- a/client/ticket/src/sale/index.js +++ b/client/ticket/src/sale/index.js @@ -25,14 +25,18 @@ class Controller { set sales(value) { this._sales = value; - this.loadSubTotal(); - this.loadVAT(); + this.refreshTotal(); } get sales() { return this._sales; } + refreshTotal() { + this.loadSubTotal(); + this.loadVAT(); + } + loadSubTotal() { this.subTotal = 0.0; if (!this.sales) return; @@ -151,9 +155,9 @@ class Controller { } removeInstances(instances) { - for (let i = instances.length - 1; i >= 0; i--) { - this.sales.splice(instances[i].instance, 1); - } + for (let i of instances) + this.sales.splice(i.instance, 1); + this.refreshTotal(); } showRemoveLinesDialog() { @@ -327,16 +331,16 @@ class Controller { }); } -/** - * Unmark sale as reserved - */ + /** + * Unmark sale as reserved + */ unmarkAsReserved() { this.setReserved(false); } -/** - * Mark sale as reserved - */ + /** + * Mark sale as reserved + */ markAsReserved() { this.setReserved(true); }