adjust mat selection

This commit is contained in:
pakintada@gmail.com 2023-12-29 16:10:57 +07:00
parent 17030c72ce
commit bf693aab2a
15 changed files with 548 additions and 186 deletions

View file

@ -10,10 +10,12 @@ import { RecipeListComponent } from './recipe-list/recipe-list.component';
import {
RecipeDetail,
RecipeDetailMat,
Topping,
} from 'src/app/core/models/recipe.model';
import { ActionRecord } from 'src/app/shared/actionRecord/actionRecord';
import { UserService } from 'src/app/core/services/user.service';
import { UserPermissions } from 'src/app/core/auth/userPermissions';
import { ToppingService } from 'src/app/core/services/topping.service';
@Component({
selector: 'app-recipe-details',
@ -59,6 +61,7 @@ export class RecipeDetailsComponent implements OnInit {
private _route: ActivatedRoute,
private _router: Router,
private _recipeService: RecipeService,
private _toppingService: ToppingService,
private _userService: UserService
) {}
@ -68,7 +71,7 @@ export class RecipeDetailsComponent implements OnInit {
productCode: '',
name: '',
otherName: '',
Description: '',
description: '',
otherDescription: '',
lastModified: new Date(),
price: 0,
@ -79,6 +82,8 @@ export class RecipeDetailsComponent implements OnInit {
repl = []
topping: Topping | null = null;
ngOnInit() {
this.productCode = this._route.snapshot.params['productCode'];
@ -96,6 +101,11 @@ export class RecipeDetailsComponent implements OnInit {
this.recipeDetailForm.valueChanges.subscribe(this.onRecipeDetailFormChange);
this._toppingService.getToppings(this.department, this._recipeService.getCurrentFile()).subscribe((data) => {
this.topping = data;
})
// snap recipe detail form value
this.actionRecord.registerOnAddAction((currAction, allAction) => {
@ -132,7 +142,7 @@ export class RecipeDetailsComponent implements OnInit {
productCode: this.productCode,
name: this.recipeDetailForm.getRawValue().name != this.recipeOriginalDetail.name ? this.recipeDetailForm.getRawValue().name : this.recipeOriginalDetail.name,
otherName: this.recipeDetailForm.getRawValue().otherName != this.recipeOriginalDetail.otherName ? this.recipeDetailForm.getRawValue().otherName : this.recipeOriginalDetail.otherName,
Description: this.recipeDetailForm.getRawValue().Description != this.recipeOriginalDetail.Description ? this.recipeDetailForm.getRawValue().Description : this.recipeOriginalDetail.Description,
description: this.recipeDetailForm.getRawValue().description != this.recipeOriginalDetail.description ? this.recipeDetailForm.getRawValue().description : this.recipeOriginalDetail.description,
otherDescription: this.recipeDetailForm.getRawValue().otherDescription != this.recipeOriginalDetail.otherDescription ? this.recipeDetailForm.getRawValue().otherDescription : this.recipeOriginalDetail.otherDescription,
LastChange: this.recipeDetailForm.getRawValue().lastModified != this.recipeOriginalDetail.lastModified ? this.recipeDetailForm.getRawValue().lastModified : this.recipeOriginalDetail.lastModified,
price: this.recipeDetailForm.getRawValue().price != this.recipeOriginalDetail.price ? this.recipeDetailForm.getRawValue().price : this.recipeOriginalDetail.price,