From 4a0f435693ded891842cd2a2209a51dc10803ea5 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 15 Oct 2025 23:34:14 +0700 Subject: desktop price and discount --- src/lib/product/components/ProductCard.jsx | 77 ++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 34137482..34fdf8dd 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -206,7 +206,62 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { > {product?.name} + + {/* New Price Section */} {product?.flashSale?.id > 0 && + product?.lowestPrice.discountPercentage > 0 ? ( +
+
+ {/* harga sekarang (merah) */} + + {product?.lowestPrice.priceDiscount > 0 ? ( + currencyFormat(product?.lowestPrice.price) + ) : ( + + Call for Inquiry + + )} + + + {/* harga lama (abu, dicoret) */} + + {currencyFormat(product.lowestPrice.price)} + +
+
+ ) : ( +
+ {product?.lowestPrice.price > 0 ? ( + <> + {currencyFormat(product?.lowestPrice.priceDiscount)} +
+ Include PPN:{' '} + {currencyFormat( + product.lowestPrice.price * + process.env.NEXT_PUBLIC_PPN + )} +
+ + ) : ( + + Call for Inquiry + + )} +
+ )} + + {/* Old Price section */} + {/* {product?.flashSale?.id > 0 && product?.lowestPrice.discountPercentage > 0 ? ( <>
@@ -256,14 +311,29 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )}
+ )} */} + {/* New voucher section */} + {discount > 0 && (product?.flashSale?.id ?? 0) < 1 && ( +
+
+ Voucher + + + + {currencyFormat(discount)} + + +
+
)} - {discount > 0 && product?.flashSale?.id < 1 && ( + {/* Old */} + {/* {discount > 0 && product?.flashSale?.id < 1 && (
Voucher : {currencyFormat(discount)}
- )} + )} */}
{product?.stockTotal > 0 && ( @@ -434,7 +504,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { product?.lowestPrice.discountPercentage > 0 ? (
- {/* harga sekarang (merah) – dibiarkan pakai variabelmu */} + {/* harga sekarang (merah) */} {product?.lowestPrice.priceDiscount > 0 ? ( currencyFormat(product?.lowestPrice.price) @@ -457,7 +527,6 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
) : ( - // === BLOK ELSE PUNYA KAMU, TIDAK DIUBAH ===
{product?.lowestPrice.price > 0 ? ( <> -- cgit v1.2.3