diff --git a/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html index 6eb5a93..0bbb0d1 100644 --- a/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html +++ b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html @@ -11,7 +11,12 @@ formArrayName="recipeListData" *ngFor="let mat of recipeListData.controls; let i = index" > - + @@ -33,77 +38,90 @@ -
-

Volume= 

+
+

Volume

-

 gram

+

gram

-
-

Volume= 

+
+

Volume

-

 gram

+

gram

-
+
-

 

-

tail= 

+ +

tail

-

 mA

+

+ mA +

-

Hot= 

- -

 ml 

-
-
-

Cold= 

- -

 ml 

-
-
+

Hot

+ +

ml

+
+
+

Cold

+ +

ml

+
+

- Grinder=  + Grinder

- Mix=  + Mix

- Clean=  + Clean

-

 sec 

+

sec

- @@ -265,10 +263,10 @@

 gram

-
+
 gram

-
+
Water

Hot (waterYield)

- + +

ml

Cold (waterCold)

- + +

ml

+ + +
+

Parameters

+ +
diff --git a/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.ts b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.ts index 4c64750..1690427 100644 --- a/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.ts +++ b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.ts @@ -29,6 +29,7 @@ import { StringParam, stringParamsDefinition, conditionTests, + inRange } from 'src/app/shared/helpers/recipe'; @Component({ @@ -389,6 +390,8 @@ export class RecipeListComponent implements OnInit { isNotExistbyCatagories = (materialId: number) => getMaterialType(materialId) == 'others'; + isTopping = (materialId: number) => { return inRange(8111, 8130, materialId); }; + isStringParamExist = (i: number) => { let rawStringParam = this.recipeListData.at(i).get('StringParam')?.value; if (rawStringParam) { @@ -454,12 +457,47 @@ export class RecipeListComponent implements OnInit { return stringParamsDefinition[name] || name; }; - displayByCond = (index: number, key: string, condition: string) =>{ + displayByCond = (index: number, key: string, condition: string, compare?: any) =>{ + return conditionTests[condition](this.recipeListData.value[index][key])}; + // timeout + timeoutHandler: any; + timeout: number = 0; + initHoldEvent() { + // if(this.timeoutHandler){ + // clearInterval(this.timeoutHandler); + // this.timeoutHandler = undefined; + // } + // let timeout = 0; + this.timeoutHandler = setInterval(() => { + this.timeout += 1; + }, 100); + } + openRecipeListEditor(i: number) { - this.showDetailRecipeList = true; - this.currentSelectRecipeList = i; + + if(this.timeoutHandler){ + console.log("timeout get", this.timeout); + if(this.timeout >= 5){ + this.showDetailRecipeList = true; + } + + clearInterval(this.timeoutHandler); + this.timeoutHandler = undefined; + this.currentSelectRecipeList = i; + this.timeout = 0; + } + + } + + // this does update, not save + updateRecipeListControl(i: any, key: string) { + // this.recipeListData.at(i).get(key)?.setValue(this.recipeListData.value[i][key]); + + (this.recipeListData.controls[i] as any).controls[key].setValue( + this.recipeListData.value[i][key] + ); } } diff --git a/client/src/app/shared/helpers/recipe.ts b/client/src/app/shared/helpers/recipe.ts index 64c8a21..c42d251 100644 --- a/client/src/app/shared/helpers/recipe.ts +++ b/client/src/app/shared/helpers/recipe.ts @@ -91,5 +91,6 @@ export var stringParamsDefinition: { [key: string]: string } = { } export var conditionTests: { [key: string]: (arg: any) => boolean } = { - 'not-zero': (arg: any) => arg != 0 + 'not-zero': (arg: any) => arg != 0, + 'false-if-another-exist': (arg: any) => arg[1] != undefined }