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