No automatic signout
Voucher basic working running tables shifted to cards from buttons, this gives us immense styling oportunities
This commit is contained in:
@ -1,37 +1,54 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import { Product } from '../core/product';
|
||||
import { ModifiersComponent } from './modifiers/modifiers.component';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { ModifierCategoryService } from '../modifier-categories/modifier-category.service';
|
||||
import {Subject} from "rxjs";
|
||||
import {Modifier} from "../core/modifier";
|
||||
import {ModifierCategory} from "../core/modifier-category";
|
||||
import {isNotNullOrUndefined} from "codelyzer/util/isNotNullOrUndefined";
|
||||
import { ModifierCategory } from "../core/modifier-category";
|
||||
|
||||
@Injectable()
|
||||
export class BillService {
|
||||
public dataObs = new Subject<any[]>();
|
||||
public data = [];
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private modifierCategoryService: ModifierCategoryService
|
||||
) { }
|
||||
public dataObs;
|
||||
public data;
|
||||
|
||||
addProduct(product: Product) {
|
||||
let item = {
|
||||
isKot: false,
|
||||
product: product,
|
||||
productId: product.id,
|
||||
info: `${product.name} (${product.units}) @ ${product.price}`,
|
||||
quantity: 1,
|
||||
modifiers: []
|
||||
};
|
||||
this.data.push(item);
|
||||
this.modifierCategoryService.listIsActiveOfProduct(product.id).subscribe(result => {
|
||||
if (result.reduce((a: any, c: ModifierCategory) => {return a + c.minimum}, 0)) {
|
||||
this.showModifier(item);
|
||||
}
|
||||
});
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private modifierCategoryService: ModifierCategoryService
|
||||
) {
|
||||
this.data = [];
|
||||
this.dataObs = new BehaviorSubject<any[]>(this.data);
|
||||
}
|
||||
|
||||
loadData(d: any): void {
|
||||
console.log("data loaded");
|
||||
this.data = d;
|
||||
this.data.push({isKot: true, newKot: true, info: "== New Kot =="})
|
||||
this.dataObs.next(this.data);
|
||||
|
||||
}
|
||||
addProduct(product: Product): void {
|
||||
let old = this.data.find(x=> !x.isKot && x.productId == product.id && x.isHappyHour == product.hasHappyHour);
|
||||
if (old !== undefined) {
|
||||
old.quantity += 1;
|
||||
} else {
|
||||
let item = {
|
||||
isKot: false,
|
||||
product: product,
|
||||
productId: product.id,
|
||||
isHappyHour: product.hasHappyHour,
|
||||
info: `${product.name} (${product.units}) @ ${product.price}`,
|
||||
quantity: 1,
|
||||
modifiers: []
|
||||
};
|
||||
this.data.push(item);
|
||||
this.modifierCategoryService.listIsActiveOfProduct(product.id).subscribe(result => {
|
||||
if (result.reduce((a: any, c: ModifierCategory) => {
|
||||
return a + c.minimum
|
||||
}, 0)) {
|
||||
this.showModifier(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.dataObs.next(this.data);
|
||||
}
|
||||
|
||||
@ -48,7 +65,7 @@ export class BillService {
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (isNotNullOrUndefined(result)) {
|
||||
if (result !== undefined) {
|
||||
item.modifiers = result;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user