From 591dc095a0e5f655e419ec4d1ae11d8f54bed196 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 9 Oct 2023 10:51:46 +0700 Subject: update fitur variant page --- .../components/Product/ProductDesktopVariant.jsx | 18 +++++++++--------- .../components/Product/ProductMobileVariant.jsx | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index 51739bc9..ef61bafd 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -140,7 +140,7 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant })
{product.name} @@ -270,32 +270,32 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant })
*/}
- {product?.flashSale?.remainingTime > 0 ? ( + {product?.isFlashsale > 0 && product?.price?.discountPercentage > 0? ( <>
- {lowestPrice?.discountPercentage}% + {product?.price?.discountPercentage}%
- {currencyFormat(lowestPrice?.price)} + {currencyFormat(product?.price?.price)}
- {currencyFormat(lowestPrice?.priceDiscount)} + {currencyFormat(product?.price?.priceDiscount)}
Termasuk PPN:{' '} - {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)} + {currencyFormat(product?.price?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
) : (

- {lowestPrice?.price > 0 ? ( + {product?.price?.price > 0 ? ( <> - {currencyFormat(lowestPrice?.price)} + {currencyFormat(product?.price?.price)}
Termasuk PPN:{' '} - {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)} + {currencyFormat(product?.price?.price * process.env.NEXT_PUBLIC_PPN)}
) : ( diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx index 8cdb631f..9888e482 100644 --- a/src/lib/product/components/Product/ProductMobileVariant.jsx +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -29,7 +29,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { const [isLoadingSLA, setIsLoadingSLA] = useState(true) const getLowestPrice = () => { - const lowest = product.price + const lowest = product.lowestPrice return lowest } @@ -40,7 +40,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { price: getLowestPrice(), stock: product.stockTotal, weight: product.weight, - isFlashSale: product.isFlashsale + isFlashSale: product.isFlashSale }) useEffect(() => { @@ -50,9 +50,9 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { code: product.code, name: product.name, price: product.price, - stock: product.stock, + stock: product.stockTotal, weight: product.weight, - isFlashSale: product.isFlashsale + isFlashSale: product.isFlashSale }) } }, [selectedVariant, product]) @@ -115,7 +115,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { return ( {product.name} @@ -141,7 +141,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {

{activeVariant?.name}

- {activeVariant.isFlashsale ? ( + {activeVariant.isFlashSale && activeVariant?.price?.discountPercentage > 0 ? ( <>
{activeVariant?.price?.discountPercentage}%
@@ -159,12 +159,12 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { ) : (

- {activeVariant?.price?.priceDiscount > 0 ? ( + {activeVariant?.price?.price > 0 ? ( <> - {currencyFormat(activeVariant?.price?.priceDiscount)} + {currencyFormat(activeVariant?.price?.price)}
Termasuk PPN:{' '} - {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} + {currencyFormat(activeVariant?.price.price * process.env.NEXT_PUBLIC_PPN)}
) : ( -- cgit v1.2.3