47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
import { Modifier } from './modifier';
|
|
import { Product } from './product';
|
|
import { Tax } from './tax';
|
|
|
|
export class BillViewItem {
|
|
id: string | undefined;
|
|
isKot: boolean;
|
|
info: string;
|
|
|
|
kotId: string;
|
|
product: Product;
|
|
productId: string | undefined;
|
|
isHappyHour: boolean;
|
|
isPrinted: boolean;
|
|
price: number;
|
|
quantity: number;
|
|
discount: number;
|
|
taxRate: number;
|
|
tax: Tax;
|
|
modifiers: Modifier[];
|
|
|
|
public get isOldKot(): boolean {
|
|
return this.isKot && this.id !== undefined;
|
|
}
|
|
|
|
public get isNewKot(): boolean {
|
|
return this.isKot && this.id === undefined;
|
|
}
|
|
|
|
public constructor(init?: Partial<BillViewItem>) {
|
|
this.isKot = true;
|
|
this.info = '';
|
|
this.kotId = '';
|
|
this.product = new Product();
|
|
this.productId = this.product.id;
|
|
this.isHappyHour = false;
|
|
this.isPrinted = false;
|
|
this.price = 0;
|
|
this.quantity = 0;
|
|
this.discount = 0;
|
|
this.taxRate = 0;
|
|
this.tax = new Tax();
|
|
this.modifiers = [];
|
|
Object.assign(this, init);
|
|
}
|
|
}
|