1490 - Don't update with empty value
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
f4984c142f
commit
d60f8721f1
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -225,8 +225,7 @@
|
|||
<vn-input-number
|
||||
vn-focus
|
||||
label="Price"
|
||||
ng-model="$ctrl.editedPrice"
|
||||
type="text"
|
||||
ng-model="$ctrl.newPrice"
|
||||
step="0.01"
|
||||
on-change="$ctrl.updatePrice()"
|
||||
suffix="€">
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue