diff --git a/client/src/app/core/models/recipe.model.ts b/client/src/app/core/models/recipe.model.ts
index 5fba4f8..417b89d 100644
--- a/client/src/app/core/models/recipe.model.ts
+++ b/client/src/app/core/models/recipe.model.ts
@@ -95,18 +95,18 @@ export interface ToppingList {
}
export interface MatRecipe {
- MixOrder: string;
- FeedParameter: string;
- FeedPattern: string;
+ MixOrder: number;
+ FeedParameter: number;
+ FeedPattern: number;
isUse: boolean;
materialPathId: number;
- powderGram: string;
- powderTime: string;
- stirTime: string;
- syrupGram: string;
- syrupTime: string;
- waterCold: string;
- waterYield: string;
+ powderGram: number;
+ powderTime: number;
+ stirTime: number;
+ syrupGram: number;
+ syrupTime: number;
+ waterCold: number;
+ waterYield: number;
}
export interface ToppingSet {
diff --git a/client/src/app/core/services/recipe.service.ts b/client/src/app/core/services/recipe.service.ts
index 0ee2994..46fe787 100644
--- a/client/src/app/core/services/recipe.service.ts
+++ b/client/src/app/core/services/recipe.service.ts
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { Observable, tap } from 'rxjs';
import { Recipe, Recipe01 } from '../models/recipe.model';
import { environment } from 'src/environments/environment';
+import { RecipeMetaData } from 'src/app/shared/types/recipe';
interface RecipeParams {
version: string;
@@ -62,25 +63,11 @@ export class RecipeService {
getRecipesById(id: string): Observable<{
recipe: Recipe01;
- recipeMetaData: {
- productCode: string;
- name: string;
- otherName: string;
- description: string;
- otherDescription: string;
- picture: string;
- };
+ recipeMetaData: RecipeMetaData;
}> {
return this._httpClient.get<{
recipe: Recipe01;
- recipeMetaData: {
- productCode: string;
- name: string;
- otherName: string;
- description: string;
- otherDescription: string;
- picture: string;
- };
+ recipeMetaData: RecipeMetaData;
}>(environment.api + '/recipes/' + id, {
withCredentials: true,
responseType: 'json',
diff --git a/client/src/app/features/recipes/recipe-details/recipe-details.component.html b/client/src/app/features/recipes/recipe-details/recipe-details.component.html
index 4f3ebba..1b463a0 100644
--- a/client/src/app/features/recipes/recipe-details/recipe-details.component.html
+++ b/client/src/app/features/recipes/recipe-details/recipe-details.component.html
@@ -6,11 +6,11 @@
- {{ originalRecipeDetail.name }}
+ {{ originalRecipeDetail.recipe.name }}
|
- {{ originalRecipeDetail.productCode }}
+ {{ originalRecipeDetail.recipe.productCode }}
@@ -18,7 +18,8 @@
Last Modify
{{
- originalRecipeDetail.lastModified | date : "dd/MM/yyyy HH:mm:ss"
+ originalRecipeDetail.recipe.lastModified
+ | date : "dd/MM/yyyy HH:mm:ss"
}}
@@ -30,11 +31,6 @@
/>
-
-
-
-
-
-
-
+
+
+
+
+
+
recipe.materialPathId
);
this._materialService.getMaterialCodes(ids).subscribe((data) => {
- this.originalRecipeDetail.matData = data
+ this.originalRecipeDetail.recipe.recipes = recipe.recipes
.map((item) => {
+ for (let i = 0; i < data.length; i++) {
+ if (item.materialPathId === 0) {
+ return {
+ id: 0,
+ name: '',
+ enable: item.isUse,
+ mixOrder: item.MixOrder,
+ stirTime: item.stirTime,
+ powderGram: item.powderGram,
+ powderTime: item.powderTime,
+ syrupGram: item.syrupGram,
+ syrupTime: item.syrupTime,
+ waterCold: item.waterCold,
+ waterHot: item.waterYield,
+ };
+ }
+
+ if (item.materialPathId === data[i].materialID) {
+ return {
+ id: data[i].materialID,
+ name: data[i].PackageDescription,
+ enable: item.isUse,
+ mixOrder: item.MixOrder,
+ stirTime: item.stirTime,
+ powderGram: item.powderGram,
+ powderTime: item.powderTime,
+ syrupGram: item.syrupGram,
+ syrupTime: item.syrupTime,
+ waterCold: item.waterCold,
+ waterHot: item.waterYield,
+ };
+ }
+ }
+
return {
- id: item.materialID,
- name: item.PackageDescription,
- enable: false,
+ id: item.materialPathId,
+ name: '',
+ enable: item.isUse,
+ mixOrder: item.MixOrder,
+ stirTime: item.stirTime,
+ powderGram: item.powderGram,
+ powderTime: item.powderTime,
+ syrupGram: item.syrupGram,
+ syrupTime: item.syrupTime,
+ waterCold: item.waterCold,
+ waterHot: item.waterYield,
};
})
- .sort((a, b) => (a.id > b.id ? -1 : -1));
+ .sort((a, b) => {
+ return a.id === 0 ? 1 : a.id > b.id ? 1 : -1;
+ });
this.isMatLoaded = true;
});
});
@@ -180,6 +197,6 @@ export class RecipeDetailsComponent implements OnInit {
}
get isValueChanged() {
- return !isEqual(this.recipeDetail.value, this.originalRecipeDetail);
+ return !isEqual(this.recipeDetail.value, this.originalRecipeDetail?.recipe);
}
}
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
new file mode 100644
index 0000000..846d667
--- /dev/null
+++ b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+
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
new file mode 100644
index 0000000..63bb346
--- /dev/null
+++ b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.ts
@@ -0,0 +1,18 @@
+import { NgFor, NgIf } from '@angular/common';
+import { Component, Input, OnInit } from '@angular/core';
+import { BehaviorSubject, Observable, map } from 'rxjs';
+import { MaterialData } from 'src/app/shared/types/recipe';
+
+@Component({
+ selector: 'app-recipe-list',
+ templateUrl: './recipe-list.component.html',
+ standalone: true,
+ imports: [NgIf, NgFor],
+})
+export class RecipeListComponent implements OnInit {
+ @Input({ required: true }) recipeListData: MaterialData[] | undefined;
+
+ $isLoaded: Observable = new BehaviorSubject(false);
+
+ ngOnInit(): void {}
+}
diff --git a/client/src/app/shared/types/recipe.d.ts b/client/src/app/shared/types/recipe.d.ts
new file mode 100644
index 0000000..469e9e7
--- /dev/null
+++ b/client/src/app/shared/types/recipe.d.ts
@@ -0,0 +1,53 @@
+import { MatRecipe } from 'src/app/core/models/recipe.model';
+
+export interface RecipeMetaData {
+ productCode: string;
+ name: string;
+ otherName: string;
+ description: string;
+ otherDescription: string;
+ picture: string;
+ lastModified: Date;
+}
+
+export interface MaterialData {
+ id: number;
+ name: string;
+ enable: boolean;
+ mixOrder: number;
+ stirTime: number;
+ powderGram: number;
+ powderTime: number;
+ syrupGram: number;
+ syrupTime: number;
+ waterCold: number;
+ waterHot: number;
+}
+
+export interface RecipeDetail {
+ recipe: {
+ lastModified: Date;
+ productCode: string;
+ name: string;
+ otherName: string;
+ description: string;
+ otherDescription: string;
+ price: number;
+ isUse: boolean;
+ isShow: boolean;
+ disable: boolean;
+ recipes?: MaterialData[];
+ };
+ recipes?: MatRecipe[];
+}
+
+export interface RecipeDetailEditable {
+ name: string;
+ otherName: string;
+ description: string;
+ otherDescription: string;
+ price: number;
+ isUse: boolean;
+ isShow: boolean;
+ disable: boolean;
+}