Fix: Kots with product quantity = 0 were allowed. So blank kots could be added.

This commit is contained in:
2021-07-04 08:32:55 +05:30
parent 38ccaa167c
commit 8c5d941850
2 changed files with 6 additions and 2 deletions

View File

@ -237,7 +237,7 @@ export class BillService {
printKot(guestBookId: string | null): Observable<boolean> {
const item = JSON.parse(JSON.stringify(this.bill));
const newKot = this.bill.kots.find((k) => k.id === undefined) as Kot;
if (newKot.inventories.length === 0) {
if (newKot.inventories.filter((x) => x.quantity !== 0).length === 0) {
return throwError('Cannot print a blank KOT\nPlease add some products!');
}
if (!this.happyHourItemsBalanced() || this.happyHourItemsMoreThanRegular()) {