Fix: Recipe add was not working and removed unused rate input in the recipe detail component
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="flex flex-row justify-around content-start items-start sm:max-lg:flex-col">
|
||||
<mat-form-field class="flex-auto basis-3/5 mr-5">
|
||||
<mat-form-field class="flex-auto basis-4/5 mr-5">
|
||||
<mat-label>Product</mat-label>
|
||||
<input
|
||||
type="text"
|
||||
@ -43,7 +43,7 @@
|
||||
<mat-option *ngFor="let product of products | async" [value]="product">{{ product.name }}</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto basis-1/10 mr-5">
|
||||
<mat-form-field class="flex-auto basis-1/5">
|
||||
<mat-label>Yield</mat-label>
|
||||
<input type="text" matInput formControlName="recipeYield" autocomplete="off" />
|
||||
</mat-form-field>
|
||||
@ -74,17 +74,12 @@
|
||||
<mat-label>Quantity</mat-label>
|
||||
<input type="text" matInput formControlName="quantity" autocomplete="off" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto basis-1/5 mr-5">
|
||||
<mat-form-field class="flex-auto basis-[30%] mr-5">
|
||||
<mat-label>Description</mat-label>
|
||||
<input type="text" matInput formControlName="description" autocomplete="off" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto basis-1/10 mr-5">
|
||||
<mat-label>Rate</mat-label>
|
||||
<input type="text" matInput formControlName="rate" autocomplete="off" />
|
||||
<span matTextPrefix>₹ </span>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-raised-button color="primary" (click)="addRow()" class="flex-auto basis-1/10">Add</button>
|
||||
<button mat-raised-button color="primary" (click)="addRow()" class="flex-auto basis-[10%]">Add</button>
|
||||
</div>
|
||||
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
|
||||
<!-- Ingredient Column -->
|
||||
|
||||
@ -39,7 +39,6 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
ingredient: FormControl<string | null>;
|
||||
quantity: FormControl<string>;
|
||||
description: FormControl<string>;
|
||||
rate: FormControl<string>;
|
||||
}>;
|
||||
instructions: FormControl<string>;
|
||||
garnishing: FormControl<string>;
|
||||
@ -75,7 +74,6 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
ingredient: new FormControl(''),
|
||||
quantity: new FormControl('', { nonNullable: true }),
|
||||
description: new FormControl('', { nonNullable: true }),
|
||||
rate: new FormControl('', { nonNullable: true }),
|
||||
}),
|
||||
instructions: new FormControl('', { nonNullable: true }),
|
||||
garnishing: new FormControl('', { nonNullable: true }),
|
||||
@ -118,7 +116,6 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
ingredient: null,
|
||||
quantity: '',
|
||||
description: '',
|
||||
rate: '',
|
||||
},
|
||||
instructions: item.instructions,
|
||||
garnishing: item.garnishing,
|
||||
@ -160,8 +157,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
return;
|
||||
}
|
||||
const quantity = this.math.parseAmount(formValue.quantity, 2);
|
||||
const rate = this.math.parseAmount(formValue.rate, 2);
|
||||
if (this.ingredient === null || quantity <= 0 || rate <= 0) {
|
||||
if (this.ingredient === null || quantity <= 0) {
|
||||
return;
|
||||
}
|
||||
const oldFiltered = this.item.items.filter((x) => x.product.id === (this.ingredient as ProductSku).id);
|
||||
|
||||
Reference in New Issue
Block a user