barker/bookie/src/app/section-printers/section-printer.component.html

76 lines
3.0 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="saleCategories">
<!-- Sale Category Column -->
<ng-container matColumnDef="saleCategory">
<mat-header-cell *matHeaderCellDef>Sale Category</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.saleCategory?.name || 'Default' }}</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="!!$any(form.get('saleCategories')).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="sectionId" (click)="confirmDelete()">
Delete
</button>
</mat-card-actions>
</mat-card>
</div>