diff --git a/client/ticket/src/sale/editDiscount.html b/client/ticket/src/sale/editDiscount.html index 45dce2f8f..e193444be 100644 --- a/client/ticket/src/sale/editDiscount.html +++ b/client/ticket/src/sale/editDiscount.html @@ -6,7 +6,7 @@ label="Discount" model="$ctrl.newDiscount" type="text" - accept="$ctrl.updateDiscount()"> + on-change="$ctrl.updateDiscount()"> % diff --git a/client/ticket/src/sale/editDiscount.js b/client/ticket/src/sale/editDiscount.js index bdb4f76d6..9f41230e9 100644 --- a/client/ticket/src/sale/editDiscount.js +++ b/client/ticket/src/sale/editDiscount.js @@ -6,7 +6,7 @@ class Controller { this.$http = $http; this.$state = $state; this.vnApp = vnApp; - this.translate = $translate; + this.$translate = $translate; } set edit(value) { @@ -37,7 +37,7 @@ class Controller { let editLines = []; let modified = false; for (let i = 0; i < this.edit.length; i++) { - if (this.newDiscount != this.edit[0].discount || this.bulk) { + if (this.newDiscount != this.edit[0].discount || this.bulk || !this.newDiscount) { editLines.push({id: this.edit[i].id, discount: this.newDiscount, ticketFk: this.$state.params.id}); modified = true; } @@ -45,14 +45,14 @@ class Controller { if (modified) { this.$http.post(`/ticket/api/Sales/updateDiscount`, {editLines}).then(() => { this.hide(); - this.vnApp.showSuccess(this.translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.clear(); modified = false; }).catch(e => { - this.vnApp.showError(this.translate.instant(e.data.error.message)); + this.vnApp.showError(e.data.error.message); }); } else { - this.vnApp.showError(this.translate.instant('There is no changes to save')); + this.vnApp.showError(this.$translate.instant('There is no changes to save')); } }