diff --git a/src/views/apps/ecommerce/products/detail/AddRecipeDrawer.tsx b/src/views/apps/ecommerce/products/detail/AddRecipeDrawer.tsx index bf78063..e0b2372 100644 --- a/src/views/apps/ecommerce/products/detail/AddRecipeDrawer.tsx +++ b/src/views/apps/ecommerce/products/detail/AddRecipeDrawer.tsx @@ -49,8 +49,6 @@ const AddRecipeDrawer = (props: Props) => { const { currentProductRecipe } = useSelector((state: RootState) => state.productRecipeReducer) - console.log('currentProductRecipe', currentProductRecipe) - const [outletInput, setOutletInput] = useState('') const [outletDebouncedInput] = useDebounce(outletInput, 500) const [ingredientInput, setIngredientInput] = useState('') diff --git a/src/views/apps/ecommerce/products/detail/ProductDetail.tsx b/src/views/apps/ecommerce/products/detail/ProductDetail.tsx index d327c59..69273ac 100644 --- a/src/views/apps/ecommerce/products/detail/ProductDetail.tsx +++ b/src/views/apps/ecommerce/products/detail/ProductDetail.tsx @@ -93,6 +93,142 @@ const ProductDetail = () => { + + + + + + Original Variant + + + + + + + + } + /> + + + + + + + + + Ingredient + + + + + + Quantity + + + + + + Unit Cost + + + + + + Stock Available + + + + + + Total Cost + + + + + + {productRecipe?.length && + productRecipe + .filter((item: any) => item.variant_id === null) + .map((item: any, index: number) => ( + + + + + + + {item.ingredient.name} + + + {item.ingredient.is_semi_finished ? 'Semi-finished' : 'Raw ingredient'} + + + + + + + + {formatCurrency(item.ingredient.cost)} + + 5 ? 'success' : 'warning'} + variant='outlined' + /> + + + {formatCurrency(item.ingredient.cost * item.quantity)} + + + ))} + + + + + {/* Variant Summary */} + {productRecipe?.length && ( + + + + + + Total Ingredients: + {productRecipe.filter((item: any) => item.variant_id === null).length} + + + + + + Total Recipe Cost: + {formatCurrency( + productRecipe + .filter((item: any) => item.variant_id === null) + .reduce((sum: any, item: any) => sum + item.ingredient.cost * item.quantity, 0) + )} + + + + + )} + + } + onClick={() => handleOpenProductRecipe({ variant: undefined })} + > + Add Ingredient + + + + {product?.variants?.length && product.variants.map((variantData: ProductVariant, index: number) => (