93 lines
3.5 KiB
HTML
93 lines
3.5 KiB
HTML
@if (infoResource.isLoading()) {
|
|
<app-skeleton-loader type="card" [count]="1" />
|
|
} @else if (infoResource.error()) {
|
|
<app-error-state (retryAction)="infoResource.reload()" />
|
|
} @else {
|
|
<h2 class="row-container space-between">
|
|
<span>Beer Sale Report</span>
|
|
<button type="button" mat-icon-button (click)="exportCsv()">
|
|
<mat-icon>save_alt</mat-icon>
|
|
</button>
|
|
</h2>
|
|
|
|
@if (!infoResource.value() || !saleCategoriesResource.value()) {
|
|
<p>Loading...</p>
|
|
} @else {
|
|
<form class="flex-col">
|
|
<div class="row-container sm:max-lg:flex-col">
|
|
<mat-form-field class="flex-auto basis-2-5">
|
|
<mat-label>Start Date</mat-label>
|
|
<input
|
|
matInput
|
|
[matDatepicker]="startDate"
|
|
(focus)="startDate.open()"
|
|
[formField]="form.startDate"
|
|
autocomplete="off"
|
|
/>
|
|
<mat-datepicker-toggle matSuffix [for]="startDate"></mat-datepicker-toggle>
|
|
<mat-datepicker #startDate></mat-datepicker>
|
|
</mat-form-field>
|
|
<mat-form-field class="flex-auto basis-2-5">
|
|
<mat-label>Finish Date</mat-label>
|
|
<input
|
|
matInput
|
|
[matDatepicker]="finishDate"
|
|
(focus)="finishDate.open()"
|
|
[formField]="form.finishDate"
|
|
autocomplete="off"
|
|
/>
|
|
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
|
|
<mat-datepicker #finishDate></mat-datepicker>
|
|
</mat-form-field>
|
|
<mat-form-field class="flex-auto">
|
|
<mat-label>Sale Category</mat-label>
|
|
<mat-select [formField]="form.saleCategory">
|
|
@for (sc of saleCategories(); track sc.id) {
|
|
<mat-option [value]="sc.id">
|
|
{{ sc.name }}
|
|
</mat-option>
|
|
}
|
|
</mat-select>
|
|
@for (error of form.saleCategory().errors(); track $index) {
|
|
<mat-error>{{ error.message }}</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
<button
|
|
type="button"
|
|
mat-raised-button
|
|
class="flex-auto basis-1-5"
|
|
color="primary"
|
|
[disabled]="form().invalid()"
|
|
(click)="show()"
|
|
>
|
|
Show
|
|
</button>
|
|
</div>
|
|
<div class="row-container sm:max-lg:flex-col">
|
|
<mat-checkbox class="flex-auto" [formField]="form.regular">Regular</mat-checkbox>
|
|
<mat-checkbox class="flex-auto" [formField]="form.happy">Happy Hour</mat-checkbox>
|
|
<mat-checkbox class="flex-auto" [formField]="form.staff">Staff Consumption</mat-checkbox>
|
|
<mat-checkbox class="flex-auto" [formField]="form.nc">No Charge</mat-checkbox>
|
|
</div>
|
|
</form>
|
|
<mat-table #table [dataSource]="dataSource()" aria-label="Elements">
|
|
<!-- Date Column -->
|
|
<ng-container matColumnDef="date">
|
|
<mat-header-cell *matHeaderCellDef>Time</mat-header-cell>
|
|
<mat-cell *matCellDef="let row">{{ row.date }}</mat-cell>
|
|
</ng-container>
|
|
|
|
<!-- Name Column -->
|
|
@for (col of info()?.headers ?? []; track col) {
|
|
<ng-container matColumnDef="{{ col }}">
|
|
<mat-header-cell *matHeaderCellDef class="right">{{ col }}</mat-header-cell>
|
|
<mat-cell *matCellDef="let row" class="right">{{ row[col] | number: '1.2-2' }}</mat-cell>
|
|
</ng-container>
|
|
}
|
|
|
|
<mat-header-row *matHeaderRowDef="displayedColumns()"></mat-header-row>
|
|
<mat-row *matRowDef="let row; columns: displayedColumns()"></mat-row>
|
|
</mat-table>
|
|
}
|
|
}
|