Still in progress
This commit is contained in:
@ -15,8 +15,15 @@
|
||||
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px">
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Location</mat-label>
|
||||
<input matInput placeholder="Location" formControlName="location">
|
||||
<mat-label>Seats</mat-label>
|
||||
<input matInput type="number" placeholder="Seats" formControlName="seats">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px">
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Section</mat-label>
|
||||
<input matInput placeholder="Section" formControlName="section">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
|
||||
|
||||
@ -32,7 +32,8 @@ export class TableDetailComponent implements OnInit, AfterViewInit {
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
name: '',
|
||||
location: '',
|
||||
seats: '',
|
||||
section: '',
|
||||
isActive: ''
|
||||
});
|
||||
}
|
||||
@ -48,7 +49,8 @@ export class TableDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
name: this.item.name,
|
||||
location: this.item.location,
|
||||
seats: this.item.seats,
|
||||
section: this.item.section,
|
||||
isActive: this.item.isActive
|
||||
});
|
||||
}
|
||||
@ -101,7 +103,8 @@ export class TableDetailComponent implements OnInit, AfterViewInit {
|
||||
getItem(): Table {
|
||||
const formModel = this.form.value;
|
||||
this.item.name = formModel.name;
|
||||
this.item.location = formModel.location;
|
||||
this.item.seats = +formModel.seats;
|
||||
this.item.section = formModel.section;
|
||||
this.item.isActive = formModel.isActive;
|
||||
return this.item;
|
||||
}
|
||||
|
||||
@ -18,10 +18,16 @@
|
||||
<mat-cell *matCellDef="let row"><a [routerLink]="['/tables', row.id]">{{row.name}}</a></mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Location Column -->
|
||||
<ng-container matColumnDef="location">
|
||||
<mat-header-cell *matHeaderCellDef>Location</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.location}}</mat-cell>
|
||||
<!-- Seats Column -->
|
||||
<ng-container matColumnDef="seats">
|
||||
<mat-header-cell *matHeaderCellDef>Seats</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.seats}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Section Column -->
|
||||
<ng-container matColumnDef="section">
|
||||
<mat-header-cell *matHeaderCellDef>Section</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.section}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Is Active Column -->
|
||||
|
||||
@ -20,7 +20,7 @@ export class TableListComponent implements OnInit {
|
||||
list: Table[];
|
||||
data: BehaviorSubject<Table[]>;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'location', 'isActive'];
|
||||
displayedColumns = ['name', 'seats', 'section', 'isActive'];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
||||
Reference in New Issue
Block a user