From f4b1db4867ecfb9626ab6cd7cadaafad99c0902a Mon Sep 17 00:00:00 2001 From: "pakintada@gmail.com" Date: Mon, 12 Feb 2024 08:50:02 +0700 Subject: [PATCH] add mixOrder condition --- client/src/app/app-routing.module.ts | 8 +- .../recipe-list/recipe-list.component.html | 132 ++++++++++-------- .../recipe-list/recipe-list.component.ts | 24 +++- client/src/environments/environment.ts | 2 +- 4 files changed, 98 insertions(+), 68 deletions(-) diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index d0df2ea..8a37a05 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts @@ -171,10 +171,10 @@ const routes: Routes = [ // loadComponent: () => // import('./core/notfound.component').then((m) => m.NotfoundComponent), // }, - // { - // path: '**', - // redirectTo: 'departments', - // }, + { + path: '**', + redirectTo: 'departments', + }, ]; @NgModule({ 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 b7c54dd..8f3e046 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 @@ -28,7 +28,7 @@ > -

{{i}}

+

{{ i }}

- +

Volume

- +

gram

- -

Volume

- +

gram

-
+
- - -
-

tail

- -

mA

+

tail

+ +

mA

- - - -
@@ -110,7 +111,9 @@ class="tooltip flex items-center justify-evenly space-x-2 rounded-md bg-red-200 p-2" data-tip="Hot" *ngIf=" - displayByCond(i, 'waterYield', 'not-zero', { compare: undefined }) + displayByCond(i, 'waterYield', 'not-zero', { + compare: undefined + }) && !isMixOrder(i) " >

Hot

@@ -126,7 +129,9 @@ class="tooltip flex items-center justify-center space-x-2 rounded-md bg-blue-200 p-2" data-tip="Cold" *ngIf=" - displayByCond(i, 'waterCold', 'not-zero', { compare: undefined }) + displayByCond(i, 'waterCold', 'not-zero', { + compare: undefined + }) && !isMixOrder(i) " >

Cold

@@ -147,10 +152,11 @@ compare: undefined }) && getTypeForRecipeListAtIndex(i)['category'] != 'cup' && - !isTopping(getTypeForRecipeListAtIndex(i)['id']) + !isTopping(getTypeForRecipeListAtIndex(i)['id']) && + !isMixOrder(i) " > -

{{getTooltipForStirTime(getTypeForRecipeListAtIndex(i))}}

+

{{ getTooltipForStirTime(getTypeForRecipeListAtIndex(i)) }}

sec

- -
-
- - - - - -

Style

- -

Level

- - - - - -
- -

Encoder

-

{{getStringParam(i, "encoder_cnt")?.pvalue}}

+
+

Style

+ +

Level

+ +
+

Encoder

+

{{ getStringParam(i, "encoder_cnt")?.pvalue }}

-
-
+
@@ -199,7 +210,6 @@ -

Level

- +
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 9d97978..cfb76e7 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 @@ -117,7 +117,7 @@ export class RecipeListComponent implements OnInit { (await this._materialService.getFullMaterialDetail()).subscribe((materials) => { this.fullMaterialList = materials; - this.categoriedMaterial = this.ListCategory(); + this.categoriedMaterial = this.listCategory(); console.log(this.categoriedMaterial); @@ -578,7 +578,7 @@ export class RecipeListComponent implements OnInit { } // Filter from full detail by type - ListCategory = () => { + listCategory = () => { let catMap: { [key: string]: any[] } = { others: [], }; @@ -629,6 +629,16 @@ export class RecipeListComponent implements OnInit { getToppingSlotNumber = (mat: number) => convertFromInterProductCode(mat) - 8110 - 1 ; + // get value at index, if 'MixOrder' exist and is 1, return true + isMixOrder = (index: number) => { + let mixOrder = this.recipeListData.at(index).get('mixOrder')?.value; + // console.log("get::MixOrder", mixOrder, "test get::mixOrder", this.recipeListData.at(index).get('mixOrder')); + return mixOrder.toString() == "1" ? true : false; + } + + + // ------------------ String Param ------------------ + isStringParamExist = (i: number) => { let rawStringParam = this.recipeListData.at(i).get('StringParam')?.value; if (rawStringParam) { @@ -694,9 +704,15 @@ export class RecipeListComponent implements OnInit { return stringParamsDefinition[name] || name; }; - displayByCond = (index: number, key: string, condition: string, compare?: any) =>{ - return conditionTests[condition](this.recipeListData.value[index][key])}; + // ------------------ Filter ------------------ + + displayByCond = (index: number, key: string, condition: any, compare?: any) =>{ + if(typeof condition == 'function'){ + return condition(this.recipeListData.value[index][key], compare); + } + return conditionTests[condition](this.recipeListData.value[index][key]) + }; // timeout diff --git a/client/src/environments/environment.ts b/client/src/environments/environment.ts index baf010b..16ac628 100644 --- a/client/src/environments/environment.ts +++ b/client/src/environments/environment.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - api: 'http://10.11.77.50:5555', + api: 'https://recipe.taobin.io:8090/api', };