brewman/overlord/src/app/product/product-list/product-list.component.html

87 lines
3.4 KiB
HTML

<mat-card>
<mat-card-title-group>
<mat-card-title>Products</mat-card-title>
<button mat-button mat-icon-button *ngIf="dataSource.data.length" (click)="exportCsv()">
<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" fxLayout.lt-md="column" fxLayoutGap="20px" fxLayoutGap.lt-md="0px"
fxLayoutAlign="space-around start">
<mat-form-field fxFlex>
<input type="text" matInput #filterElement placeholder="Filter" formControlName="filter" autocomplete="off">
</mat-form-field>
</div>
</form>
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/products', row.id]">{{row.name}} ({{showExtended ?
row.fraction + ' ' + row.fractionUnits + ' = 1 ':''}}{{row.units}})</a></mat-cell>
</ng-container>
<!-- Cost Price Column -->
<ng-container matColumnDef="costPrice">
<mat-header-cell *matHeaderCellDef mat-sort-header>Cost Price</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.costPrice | currency:'INR'}}</mat-cell>
</ng-container>
<!-- Yield Column -->
<ng-container matColumnDef="productYield">
<mat-header-cell *matHeaderCellDef mat-sort-header>Yield</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.productYield | percent:'1.2-2'}}</mat-cell>
</ng-container>
<!-- Product Group Column -->
<ng-container matColumnDef="productGroup">
<mat-header-cell *matHeaderCellDef mat-sort-header>Product Group</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.productGroup}}</mat-cell>
</ng-container>
<!-- Info Column -->
<ng-container matColumnDef="info">
<mat-header-cell *matHeaderCellDef mat-sort-header>Details</mat-header-cell>
<mat-cell *matCellDef="let row">
<div layout="row">
<div flex>
<mat-icon>
{{ row.isPurchased ? "shopping_cart" : "remove_shopping_cart" }}
</mat-icon>
<b> {{ row.isPurchased ? "Purchased" : "Made" }}</b>
</div>
<div flex>
<mat-icon>
{{ row.isSold ? "restaurant_menu" : "import_contacts" }}
</mat-icon>
<b> {{ row.isSold ? "Sold" : "Used" }}</b>
</div>
<div flex>
<mat-icon>
{{ row.isActive ? "visibility" : "visibility_off" }}
</mat-icon>
<b> {{ row.isActive ? "Active" : "Deactivated" }}</b>
</div>
</div>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
<mat-paginator #paginator
[length]="dataSource.data.length"
[pageIndex]="0"
[pageSize]="50"
[pageSizeOptions]="[25, 50, 100, 250, 5000]">
</mat-paginator>
</mat-card-content>
</mat-card>