66 lines
2.8 KiB
HTML
66 lines
2.8 KiB
HTML
<div fxLayout="row" fxFlex="50%" fxLayoutAlign="space-around center" class="example-card">
|
|
<mat-card fxFlex>
|
|
<mat-card-title-group>
|
|
<mat-card-title>Printers for Section</mat-card-title>
|
|
</mat-card-title-group>
|
|
<mat-card-content>
|
|
<form [formGroup]="form" fxLayout="column">
|
|
<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>
|
|
<mat-select placeholder="Section" formControlName="section" (selectionChange)="show($event)">
|
|
<mat-option *ngFor="let s of sections" [value]="s.id">
|
|
{{ s.name }}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
</div>
|
|
<mat-divider></mat-divider>
|
|
<mat-table #table [dataSource]="dataSource" formArrayName="menuCategories">
|
|
|
|
<!-- Menu Category Column -->
|
|
<ng-container matColumnDef="menuCategory">
|
|
<mat-header-cell *matHeaderCellDef>Menu Category</mat-header-cell>
|
|
<mat-cell *matCellDef="let row">{{row.menuCategory.name}}</mat-cell>
|
|
</ng-container>
|
|
|
|
<!-- Printer Column -->
|
|
<ng-container matColumnDef="printer">
|
|
<mat-header-cell *matHeaderCellDef>Printer</mat-header-cell>
|
|
<mat-cell *matCellDef="let row; let i = index" [formGroupName]="i" fxFlex>
|
|
<mat-form-field>
|
|
<mat-label>Printer</mat-label>
|
|
<mat-select formControlName="printer" name="printer">
|
|
<mat-option>-- Default --</mat-option>
|
|
<mat-option *ngFor="let p of printers" [value]="p.id">
|
|
{{ p.name }}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
</mat-cell>
|
|
</ng-container>
|
|
|
|
<!-- Copies Column -->
|
|
<ng-container matColumnDef="copies">
|
|
<mat-header-cell *matHeaderCellDef>Copies</mat-header-cell>
|
|
<mat-cell *matCellDef="let row; let i = index" [formGroupName]="i" fxFlex>
|
|
<mat-form-field *ngIf="!!form.get('menuCategories').at(i).value.printer">
|
|
<mat-label>Copies</mat-label>
|
|
<input matInput type="number" placeholder="Copies" formControlName="copies">
|
|
</mat-form-field>
|
|
</mat-cell>
|
|
</ng-container>
|
|
|
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
|
<mat-row *matRowDef="let row; let i = index; columns: displayedColumns;"></mat-row>
|
|
</mat-table>
|
|
</form>
|
|
</mat-card-content>
|
|
<mat-card-actions>
|
|
<button mat-raised-button color="primary" (click)="save()">Save</button>
|
|
<button mat-raised-button color="warn" *ngIf="id" (click)="confirmDelete()">Delete</button>
|
|
</mat-card-actions>
|
|
</mat-card>
|
|
</div>
|