Bill change should be working

Reduce quantity should be working.
This commit is contained in:
2020-10-11 20:53:43 +05:30
parent 73f83f1aa7
commit b7f382cac8
52 changed files with 283 additions and 641 deletions

View File

@ -94,7 +94,7 @@
<button
mat-icon-button
(click)="quantity(row)"
[disabled]="row.isPrinted"
[disabled]="rowQuantityDisabled(row)"
*ngIf="!row.isKot"
>
{{ row.quantity }}

View File

@ -106,12 +106,24 @@ export class BillsComponent implements OnInit {
if (!result) {
return;
}
this.bs.quantity(item, result as number);
if (!item.isPrinted) {
this.bs.quantity(item, result as number);
} else {
const quantity = result as number;
const product = {
...item.product,
hasHappyHour: item.isHappyHour,
tax: item.tax,
price: item.price,
};
this.bs.addProduct(product, quantity, item.discount);
}
});
}
subtractOne(item: any): void {
this.bs.subtractOne(item);
const canEdit = this.auth.user.perms.indexOf('edit-printed-product') !== -1;
this.bs.subtractOne(item, canEdit);
}
removeItem(item: any): void {
@ -171,4 +183,17 @@ export class BillsComponent implements OnInit {
},
);
}
rowQuantityDisabled(row: any) {
if (!row.isPrinted) {
return false;
}
if (this.bs.bill.isVoid) {
return true;
}
if (this.auth.user.perms.indexOf('edit-printed-product') === -1) {
return true;
}
return false;
}
}