Feature: Recipe module mostly working. What needs to be done is duplicating recipes and export for checking.

Feature: Non Contract Purchases Report
This commit is contained in:
2021-11-10 10:57:18 +05:30
parent 3b8c972c48
commit ffd46bf717
59 changed files with 2139 additions and 251 deletions
@@ -0,0 +1,206 @@
<mat-card>
<mat-card-title-group>
<mat-card-title>Recipe Detail</mat-card-title>
</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="50">
<input
matInput
[matDatepicker]="validFrom"
placeholder="Valid From"
formControlName="validFrom"
autocomplete="off"
/>
<mat-datepicker-toggle matSuffix [for]="validFrom"></mat-datepicker-toggle>
<mat-datepicker #validFrom></mat-datepicker>
</mat-form-field>
<mat-form-field fxFlex="50">
<input
matInput
[matDatepicker]="validTill"
placeholder="Valid Till"
formControlName="validTill"
autocomplete="off"
/>
<mat-datepicker-toggle matSuffix [for]="validTill"></mat-datepicker-toggle>
<mat-datepicker #validTill></mat-datepicker>
</mat-form-field>
</div>
<div fxLayout="row" fxLayout.lt-md="column" fxLayoutGap="20px" fxLayoutGap.lt-md="0px">
<mat-form-field fxFlex="60">
<input
type="text"
matInput
placeholder="Product"
#productElement
[matAutocomplete]="autoP"
formControlName="product"
autocomplete="off"
/>
<mat-autocomplete
#autoP="matAutocomplete"
autoActiveFirstOption
[displayWith]="displayProduct"
(optionSelected)="productSelected($event)"
>
<mat-option *ngFor="let product of products | async" [value]="product">{{
product.name
}}</mat-option>
</mat-autocomplete>
</mat-form-field>
<mat-form-field fxFlex="10">
<mat-label>Yield</mat-label>
<input
type="text"
matInput
placeholder="Yield"
formControlName="recipeYield"
autocomplete="off"
/>
</mat-form-field>
<mat-form-field fxFlex="10">
<mat-label>Sale Price</mat-label>
<span matPrefix></span>
<input
type="text"
matInput
placeholder="Sale Price"
formControlName="salePrice"
autocomplete="off"
/>
</mat-form-field>
<mat-form-field fxFlex="10">
<mat-label>Cost Price</mat-label>
<span matPrefix></span>
<input
type="text"
matInput
placeholder="Cost Price"
formControlName="costPrice"
autocomplete="off"
/>
</mat-form-field>
<mat-form-field fxFlex="10">
<mat-label>Cost Percentage</mat-label>
<input
type="text"
matInput
placeholder="Cost Percentage"
formControlName="costPercentage"
autocomplete="off"
/>
<span matSuffix>%</span>
</mat-form-field>
</div>
<div
formGroupName="addRow"
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex="50">
<input
type="text"
matInput
placeholder="Ingredient"
#ingredientElement
[matAutocomplete]="autoI"
formControlName="ingredient"
autocomplete="off"
/>
<mat-autocomplete
#autoI="matAutocomplete"
autoActiveFirstOption
[displayWith]="displayIngredient"
(optionSelected)="ingredientSelected($event)"
>
<mat-option *ngFor="let product of ingredients | async" [value]="product"
>{{ product.name }} ({{ product.fractionUnits }})</mat-option
>
</mat-autocomplete>
</mat-form-field>
<mat-form-field fxFlex="20">
<mat-label>Quantity</mat-label>
<input
type="text"
matInput
placeholder="Quantity"
formControlName="quantity"
autocomplete="off"
/>
</mat-form-field>
<mat-form-field fxFlex="20">
<mat-label>Rate</mat-label>
<span matPrefix></span>
<input
type="text"
matInput
placeholder="Rate"
formControlName="rate"
autocomplete="off"
/>
</mat-form-field>
<button mat-raised-button color="primary" (click)="addRow()" fxFlex="15">Add</button>
</div>
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
<!-- Ingredient Column -->
<ng-container matColumnDef="product">
<mat-header-cell *matHeaderCellDef>Product</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.product.name }}</mat-cell>
</ng-container>
<!-- Quantity 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' }} {{ row.product.fractionUnits }}</mat-cell
>
</ng-container>
<!-- Rate Column -->
<ng-container matColumnDef="rate">
<mat-header-cell *matHeaderCellDef class="right">Rate</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.price | currency: 'INR' }}</mat-cell>
</ng-container>
<!-- Amount Column -->
<ng-container matColumnDef="amount">
<mat-header-cell *matHeaderCellDef class="right">Amount</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.quantity * row.price | currency: 'INR'
}}</mat-cell>
</ng-container>
<!-- Action Column -->
<ng-container matColumnDef="action">
<mat-header-cell *matHeaderCellDef class="center">Action</mat-header-cell>
<mat-cell *matCellDef="let row" class="center">
<button mat-icon-button tabindex="-1" color="warn" (click)="deleteRow(row)">
<mat-icon>delete</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
</mat-table>
</form>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button (click)="save()" color="primary">
{{ item.id ? 'Update' : 'Save' }}
</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="item.id">Delete</button>
</mat-card-actions>
</mat-card>