barker/bookie/src/app/product/product-list/product-list.component.html

125 lines
4.1 KiB
HTML

<mat-card>
<mat-card-title-group>
<mat-card-title>Products</mat-card-title>
<button
mat-button
(click)="updateSortOrder()"
[disabled]="(menuCategoryFilter | async) === '' || (searchFilter | async) !== ''"
>
Update Order
</button>
<!-- This should check filtered data and not data-->
<button mat-button mat-icon-button (click)="exportCsv()" [disabled]="!(data | async)?.length">
<mat-icon>save_alt</mat-icon>
</button>
<a mat-button [routerLink]="['/products', 'new']">
<mat-icon>add_box</mat-icon>
Add
</a>
</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>
<input
type="text"
matInput
placeholder="Filter"
formControlName="filter"
autocomplete="off"
/>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label>Product Type</mat-label>
<mat-select
placeholder="Menu Category"
formControlName="menuCategory"
(selectionChange)="filterOn($event.value)"
>
<mat-option>-- All Products --</mat-option>
<mat-option *ngFor="let mc of menuCategories" [value]="mc.id">
{{ mc.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</form>
<mat-table
#table
cdkDropList
[dataSource]="dataSource"
[cdkDropListData]="dataSource"
aria-label="Elements"
(cdkDropListDropped)="dropTable($event)"
>
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
<mat-cell *matCellDef="let row"
><a [routerLink]="['/products', row.id]">{{ row.name }} ({{ row.units }})</a></mat-cell
>
</ng-container>
<!-- Price Column -->
<ng-container matColumnDef="price">
<mat-header-cell *matHeaderCellDef class="right">Price</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.price | currency: 'INR' }}</mat-cell>
</ng-container>
<!-- 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>
<!-- Sale Category Column -->
<ng-container matColumnDef="saleCategory">
<mat-header-cell *matHeaderCellDef>Sale Category</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.saleCategory.name }}</mat-cell>
</ng-container>
<!-- Info Column -->
<ng-container matColumnDef="info">
<mat-header-cell *matHeaderCellDef>Details</mat-header-cell>
<mat-cell *matCellDef="let row">
<div layout="row">
<div flex>
<mat-icon>
{{ row.hasHappyHour ? 'sentiment_satisfied_alt' : 'sentiment_dissatisfied' }}
</mat-icon>
<b> {{ row.hasHappyHour ? 'Happy Hour' : 'Regular' }}</b>
</div>
<div flex>
<mat-icon>
{{ row.isNotAvailable ? 'pause' : 'play_arrow' }}
</mat-icon>
<b> {{ row.isNotAvailable ? 'Not Available' : 'Available' }}</b>
</div>
</div>
</mat-cell>
</ng-container>
<!-- Yield Column -->
<ng-container matColumnDef="quantity">
<mat-header-cell *matHeaderCellDef class="right">Quantity</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.quantity | number: '1.2-2'
}}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row
*matRowDef="let row; columns: displayedColumns"
cdkDrag
[cdkDragData]="row"
></mat-row>
</mat-table>
</mat-card-content>
</mat-card>