In case of a table with no guest, it will ask for pax
This commit is contained in:
parent
a12f093828
commit
0c0a2990a8
@ -36,12 +36,6 @@ def save(request):
|
||||
voucher_type = VoucherType[request.GET["p"]]
|
||||
guest_book = get_guest_book(request.GET.get("g", None), request.dbsession)
|
||||
|
||||
table = (
|
||||
request.dbsession.query(FoodTable)
|
||||
.filter(FoodTable.id == uuid.UUID(json["table"]["id"]))
|
||||
.first()
|
||||
)
|
||||
|
||||
check_permissions(None, voucher_type, request.effective_principals)
|
||||
|
||||
bill_id = get_bill_id(voucher_type, request.dbsession)
|
||||
@ -51,7 +45,7 @@ def save(request):
|
||||
|
||||
item = Voucher(
|
||||
now,
|
||||
guest_book.pax if guest_book is not None else table.seats,
|
||||
guest_book.pax if guest_book is not None else json["pax"],
|
||||
bill_id,
|
||||
kot_id,
|
||||
json["table"]["id"],
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
0
bookie/src/app/sales/pax/pax.component.css
Normal file
0
bookie/src/app/sales/pax/pax.component.css
Normal file
16
bookie/src/app/sales/pax/pax.component.html
Normal file
16
bookie/src/app/sales/pax/pax.component.html
Normal file
@ -0,0 +1,16 @@
|
||||
<mat-dialog-content>
|
||||
<form [formGroup]="form">
|
||||
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px">
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Pax</mat-label>
|
||||
<input type="text" matInput #quantity placeholder="Pax" formControlName="pax" autocomplete="off"
|
||||
(focus)="quantity.select()" cdkFocusInitial>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</form>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="false">Cancel</button>
|
||||
<button mat-button (click)="accept()" color="primary">Ok</button>
|
||||
</mat-dialog-actions>
|
25
bookie/src/app/sales/pax/pax.component.spec.ts
Normal file
25
bookie/src/app/sales/pax/pax.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PaxComponent } from './pax.component';
|
||||
|
||||
describe('PaxComponent', () => {
|
||||
let component: PaxComponent;
|
||||
let fixture: ComponentFixture<PaxComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PaxComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PaxComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
37
bookie/src/app/sales/pax/pax.component.ts
Normal file
37
bookie/src/app/sales/pax/pax.component.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pax',
|
||||
templateUrl: './pax.component.html',
|
||||
styleUrls: ['./pax.component.css']
|
||||
})
|
||||
export class PaxComponent implements OnInit {
|
||||
form: FormGroup;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<PaxComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: number,
|
||||
private fb: FormBuilder,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.form.setValue({
|
||||
pax: this.data
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
pax: ''
|
||||
});
|
||||
}
|
||||
|
||||
accept(): void {
|
||||
const pax = this.form.value.pax;
|
||||
this.dialogRef.close(pax);
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ import { BillTypeComponent } from './bill-type/bill-type.component';
|
||||
import { ReceivePaymentComponent } from './receive-payment/receive-payment.component';
|
||||
import { TablesDialogComponent } from './tables-dialog/tables-dialog.component';
|
||||
import { ReasonComponent } from './reason/reason.component';
|
||||
import { PaxComponent } from "./pax/pax.component";
|
||||
|
||||
@NgModule({
|
||||
providers: [
|
||||
@ -42,6 +43,7 @@ import { ReasonComponent } from './reason/reason.component';
|
||||
DiscountComponent,
|
||||
MenuCategoriesComponent,
|
||||
ModifiersComponent,
|
||||
PaxComponent,
|
||||
ProductsComponent,
|
||||
QuantityComponent,
|
||||
ReceivePaymentComponent,
|
||||
@ -75,6 +77,7 @@ import { ReasonComponent } from './reason/reason.component';
|
||||
BillTypeComponent,
|
||||
DiscountComponent,
|
||||
ModifiersComponent,
|
||||
PaxComponent,
|
||||
QuantityComponent,
|
||||
ReceivePaymentComponent,
|
||||
TablesDialogComponent,
|
||||
|
Loading…
x
Reference in New Issue
Block a user