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

@ -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>

View 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();
});
});

View 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);
}
}