In case of a table with no guest, it will ask for pax

This commit is contained in:
Amritanshu
2019-08-26 15:11:28 +05:30
parent a12f093828
commit 0c0a2990a8
8 changed files with 102 additions and 10 deletions

View File

@ -37,6 +37,8 @@ export class Kot {
export class Bill {
id: string;
date: string;
pax: number;
customer?: {id: string, name: string};
user: User;
creationDate: string;
lastEditDate: string;

View File

@ -13,7 +13,7 @@ import { TablesDialogComponent } from '../tables-dialog/tables-dialog.component'
import { TableService } from '../../tables/table.service';
import { ToasterService } from '../../core/toaster.service';
import { AuthService } from '../../auth/auth.service';
import { SelectionModel } from '@angular/cdk/collections';
import { PaxComponent } from "../pax/pax.component";
@Component({
selector: 'app-bills',
@ -22,7 +22,6 @@ import { SelectionModel } from '@angular/cdk/collections';
})
export class BillsComponent implements OnInit {
dataSource: BillsDataSource;
item: Bill;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns: string[] = ['select', 'info', 'quantity'];
@ -40,12 +39,28 @@ export class BillsComponent implements OnInit {
ngOnInit() {
this.route.data
.subscribe((data: { item: Bill }) => {
this.item = data.item;
this.bs.loadData(data.item);
});
this.getPax();
this.dataSource = new BillsDataSource(this.bs.dataObs);
}
getPax(): void {
if (this.bs.bill.id || this.bs.bill.customer.id) {
return
}
const dialogRef = this.dialog.open(PaxComponent, {
// width: '750px',
data: this.bs.bill.pax
});
dialogRef.afterClosed().subscribe((result: boolean | number) => {
if (!result) {
return;
}
this.bs.bill.pax = result as number;
});
}
isAllSelected(kot: Kot) {
return this.bs.data.filter(
x => x.kotId === kot.id