Modifier Category Working
This commit is contained in:
@@ -7,9 +7,9 @@ import { tap } from 'rxjs/operators';
|
||||
|
||||
import { BillViewItem } from '../core/bill-view-item';
|
||||
import { ModifierCategory } from '../core/modifier-category';
|
||||
import { StockKeepingUnit } from '../core/stock-keeping-unit';
|
||||
import { ReceivePaymentItem } from '../core/receive-payment-item';
|
||||
import { SaleCategory } from '../core/sale-category';
|
||||
import { StockKeepingUnit } from '../core/stock-keeping-unit';
|
||||
import { Table } from '../core/table';
|
||||
import { ModifierCategoryService } from '../modifier-categories/modifier-category.service';
|
||||
import { MathService } from '../shared/math.service';
|
||||
@@ -104,10 +104,7 @@ export class BillService {
|
||||
minimum(skuId: string, happyHour: boolean): number {
|
||||
return this.bill.kots.reduce(
|
||||
(t, k) =>
|
||||
k.inventories.reduce(
|
||||
(a, c) => (c.sku.id === skuId && c.isHappyHour === happyHour ? a + c.quantity : a),
|
||||
0,
|
||||
) + t,
|
||||
k.inventories.reduce((a, c) => (c.sku.id === skuId && c.isHappyHour === happyHour ? a + c.quantity : a), 0) + t,
|
||||
0,
|
||||
);
|
||||
}
|
||||
@@ -264,10 +261,7 @@ export class BillService {
|
||||
|
||||
printBill(guestBookId: string | null, voucherType: VoucherType): Observable<boolean> {
|
||||
const item = JSON.parse(JSON.stringify(this.bill));
|
||||
const skus = item.kots.reduce(
|
||||
(p: number, k: Kot) => p + k.inventories.filter((i) => i.quantity !== 0).length,
|
||||
0,
|
||||
);
|
||||
const skus = item.kots.reduce((p: number, k: Kot) => p + k.inventories.filter((i) => i.quantity !== 0).length, 0);
|
||||
if (skus === 0) {
|
||||
return throwError(() => Error('Cannot print a blank Bill\nPlease add some products!'));
|
||||
}
|
||||
@@ -380,9 +374,7 @@ export class BillService {
|
||||
.filter((x) => x.isHappyHour)
|
||||
.map((x) => ({ id: x.sku.id as string, quantity: x.quantity }));
|
||||
for (const item of happyHourItems) {
|
||||
const q = kot.inventories.find(
|
||||
(x) => !x.isHappyHour && x.sku.id === item.id && x.quantity === item.quantity,
|
||||
);
|
||||
const q = kot.inventories.find((x) => !x.isHappyHour && x.sku.id === item.id && x.quantity === item.quantity);
|
||||
if (q === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MenuCategory } from './menu-category';
|
||||
import { SaleCategory } from './sale-category';
|
||||
import { Tax } from './tax';
|
||||
import { MenuCategory } from '../core/menu-category';
|
||||
import { SaleCategory } from '../core/sale-category';
|
||||
import { Tax } from '../core/tax';
|
||||
|
||||
export class Product {
|
||||
id: string | undefined;
|
||||
|
||||
@@ -4,8 +4,8 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatRippleModule } from '@angular/material/core';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
|
||||
import { StockKeepingUnit as Product } from '../../core/stock-keeping-unit';
|
||||
import { BillService } from '../bill.service';
|
||||
import { Product } from '../product';
|
||||
|
||||
@Component({
|
||||
selector: 'app-products',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
|
||||
import { StockKeepingUnit as Product } from '../../core/stock-keeping-unit';
|
||||
import { Product } from '../../core/product';
|
||||
import { ProductService } from '../../product/product.service';
|
||||
|
||||
export const productsResolver: ResolveFn<Product[]> = (route) => {
|
||||
|
||||
Reference in New Issue
Block a user