Bug #576 Cambiar los bindings del textfield

This commit is contained in:
gerard 2018-08-02 15:34:48 +02:00
parent 16dfaf8943
commit 17b70192af
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@
label="Discount"
model="$ctrl.newDiscount"
type="text"
accept="$ctrl.updateDiscount()">
on-change="$ctrl.updateDiscount()">
<t-right-icons>
<span class="filter">%</span>
</t-right-icons>

View File

@ -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'));
}
}