Bill change should be working
Reduce quantity should be working.
This commit is contained in:
@ -94,7 +94,7 @@
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="quantity(row)"
|
||||
[disabled]="row.isPrinted"
|
||||
[disabled]="rowQuantityDisabled(row)"
|
||||
*ngIf="!row.isKot"
|
||||
>
|
||||
{{ row.quantity }}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user