Reset watcher changes if there's no new data to save
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
2c23f3417a
commit
c9d94ca814
|
@ -68,6 +68,7 @@ export default class MultiCheck extends FormInput {
|
|||
this.checkAll = value;
|
||||
|
||||
this.toggle();
|
||||
this.emit('change', value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th shrink>
|
||||
<vn-multi-check
|
||||
model="model">
|
||||
<vn-multi-check model="model"
|
||||
on-change="$ctrl.resetChanges()">
|
||||
</vn-multi-check>
|
||||
</vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<vn-tbody>
|
||||
<vn-tr ng-repeat="sale in $ctrl.sales">
|
||||
<vn-td shrink>
|
||||
<vn-check
|
||||
<vn-check tabindex="-1"
|
||||
ng-model="sale.checked">
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
|
|
|
@ -142,15 +142,17 @@ class Controller extends Section {
|
|||
return indexList;
|
||||
}
|
||||
|
||||
changeState(value) {
|
||||
let params = {ticketFk: this.$params.id, code: value};
|
||||
this.$http.post('TicketTrackings/changeState', params).then(() => {
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
this.card.reload();
|
||||
}).finally(() => {
|
||||
resetChanges() {
|
||||
if (this.newInstances().length === 0)
|
||||
this.$.watcher.updateOriginalData();
|
||||
});
|
||||
}
|
||||
|
||||
changeState(value) {
|
||||
const params = {ticketFk: this.$params.id, code: value};
|
||||
return this.$http.post('TicketTrackings/changeState', params).then(() => {
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
this.card.reload();
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
removeSales() {
|
||||
|
@ -159,7 +161,7 @@ class Controller extends Section {
|
|||
this.$http.post(`Sales/removes`, params).then(() => {
|
||||
this.removeSelectedSales();
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
});
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
removeSelectedSales() {
|
||||
|
@ -169,9 +171,6 @@ class Controller extends Section {
|
|||
this.sales.splice(index, 1);
|
||||
});
|
||||
|
||||
if (this.newInstances().length === 0)
|
||||
this.$.watcher.updateOriginalData();
|
||||
|
||||
this.refreshTotal();
|
||||
}
|
||||
|
||||
|
@ -251,10 +250,7 @@ class Controller extends Section {
|
|||
sale.price = res.data.price;
|
||||
this.edit = null;
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
}).finally(() => {
|
||||
if (this.newInstances().length === 0)
|
||||
this.$.watcher.updateOriginalData();
|
||||
});
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
this.$.editPricePopover.hide();
|
||||
|
@ -318,9 +314,7 @@ class Controller extends Section {
|
|||
sale.discount = this.edit.discount;
|
||||
|
||||
this.edit = null;
|
||||
}).catch(e => {
|
||||
this.vnApp.showError(e.message);
|
||||
});
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
getNewPrice() {
|
||||
|
@ -381,10 +375,7 @@ class Controller extends Section {
|
|||
if (reservedSale)
|
||||
sale.reserved = reservedSale.reserved;
|
||||
});
|
||||
}).finally(() => {
|
||||
if (this.newInstances().length === 0)
|
||||
this.$.watcher.updateOriginalData();
|
||||
});
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
newOrderFromTicket() {
|
||||
|
@ -444,16 +435,12 @@ class Controller extends Section {
|
|||
*/
|
||||
updateQuantity(sale) {
|
||||
const data = {quantity: sale.quantity};
|
||||
const query = `Sales/${sale.id}/updateQuantity`;
|
||||
this.$http.post(query, data).then(() => {
|
||||
this.$http.post(`Sales/${sale.id}/updateQuantity`, data).then(() => {
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
}).catch(e => {
|
||||
this.$.model.refresh();
|
||||
throw e;
|
||||
}).finally(() => {
|
||||
if (this.newInstances().length === 0)
|
||||
this.$.watcher.updateOriginalData();
|
||||
});
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -461,16 +448,12 @@ class Controller extends Section {
|
|||
*/
|
||||
changeConcept(sale) {
|
||||
const data = {newConcept: sale.concept};
|
||||
const query = `Sales/${sale.id}/updateConcept`;
|
||||
this.$http.post(query, data).then(() => {
|
||||
this.$http.post(`Sales/${sale.id}/updateConcept`, data).then(() => {
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
}).catch(e => {
|
||||
this.$.model.refresh();
|
||||
throw e;
|
||||
}).finally(() => {
|
||||
if (this.newInstances().length === 0)
|
||||
this.$.watcher.updateOriginalData();
|
||||
});
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -496,10 +479,7 @@ class Controller extends Section {
|
|||
sale.item = newSale.item;
|
||||
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
}).finally(() => {
|
||||
if (this.newInstances().length === 0)
|
||||
this.$.watcher.updateOriginalData();
|
||||
});
|
||||
}).finally(() => this.resetChanges());
|
||||
}
|
||||
|
||||
isTicketEditable() {
|
||||
|
|
Loading…
Reference in New Issue