In case of a table with no guest, it will ask for pax
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user