diff --git a/modules/ticket/front/sale/editDiscount.js b/modules/ticket/front/sale/editDiscount.js index 825f71777..573880306 100644 --- a/modules/ticket/front/sale/editDiscount.js +++ b/modules/ticket/front/sale/editDiscount.js @@ -43,6 +43,9 @@ class Controller extends Component { updateDiscount() { let salesIds = []; let modified = false; + + if (!this.newDiscount) return; + for (let i = 0; i < this.edit.length; i++) { if (this.newDiscount != this.edit[0].discount || this.bulk || !this.newDiscount) { salesIds.push(this.edit[i].id); @@ -57,7 +60,6 @@ class Controller extends Component { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.clearDiscount(); modified = false; - // this.vnTicketSale.$scope.model.refresh(); }).catch(e => { this.vnApp.showError(e.message); }); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 29294fd97..555e51251 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -225,8 +225,7 @@ diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index f422fefa1..65eaf8352 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -287,7 +287,7 @@ class Controller extends Section { showEditPricePopover(event, sale) { if (!this.isEditable) return; this.sale = sale; - this.editedPrice = this.sale.price; + this.newPrice = this.sale.price; this.edit = { ticketFk: this.ticket.id, id: sale.id, @@ -298,8 +298,9 @@ class Controller extends Section { } updatePrice() { - if (this.editedPrice != this.sale.price) { - this.$http.post(`Sales/${this.edit.id}/updatePrice`, {newPrice: this.editedPrice}).then(res => { + if (this.newPrice && this.newPrice != this.sale.price) { + const query = `Sales/${this.edit.id}/updatePrice`; + this.$http.post(query, {newPrice: this.newPrice}).then(res => { this.sale.price = res.data.price; this.vnApp.showSuccess(this.$translate.instant('Data saved!')); @@ -313,7 +314,7 @@ class Controller extends Section { } updateNewPrice() { - this.newPrice = this.sale.quantity * this.editedPrice - ((this.sale.discount * (this.sale.quantity * this.editedPrice)) / 100); + this.newPrice = this.sale.quantity * this.newPrice - ((this.sale.discount * (this.sale.quantity * this.newPrice)) / 100); } showEditDiscountPopover(event, sale) {