From af6cf002290fb4ab7d16618fcbba16ebc94e78db Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 5 Nov 2025 13:53:47 +0700 Subject: include ppn all --- src/lib/product/components/ProductCard.jsx | 58 ++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index b86200ae..89d060d3 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -219,7 +219,6 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { > {product?.name} - {/* ---------- HARGA ---------- */} {product?.flashSale?.id > 0 && product?.lowestPrice.discountPercentage > 0 ? ( @@ -243,21 +242,36 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { {currencyFormat(product.lowestPrice.price)} + + {/* [ADD] Tampilkan Include PPN pada branch flash sale */} + {product?.lowestPrice.priceDiscount > 0 && ( +
+ Include PPN:{' '} + {currencyFormat( + Math.round( + Number(product.lowestPrice.priceDiscount) * + process.env.NEXT_PUBLIC_PPN + ) + )} +
+ )} ) : ( // ===== BUKAN FLASH SALE ===== (() => { - const basePrice = product?.lowestPrice?.priceDiscount || 0; - const voucherCut = discount || 0; + const basePrice = Number( + product?.lowestPrice?.priceDiscount || 0 + ); + const voucherCut = Number(discount || 0); const finalAfterVoucher = Math.max(basePrice - voucherCut, 0); // CASE 1: ada harga (>0) - if (product?.lowestPrice?.price > 0) { + if (Number(product?.lowestPrice?.price) > 0) { if (voucherCut > 0) { return (
@@ -269,20 +283,22 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { {currencyFormat(finalAfterVoucher)} - {/* harga sebelum voucher, dicoret, truncate kalau kepanjangan */} + {/* [OPTIONAL] harga sebelum voucher (coret) kalau mau muncul */} {/* - {currencyFormat(basePrice)} - */} + className='text-gray_r-11 line-through text-[11px] leading-snug + whitespace-nowrap overflow-hidden text-ellipsis max-w-[40%]' + > + {currencyFormat(basePrice)} + */}
{/* PPN pakai harga finalAfterVoucher */}
Include PPN:{' '} {currencyFormat( - finalAfterVoucher * process.env.NEXT_PUBLIC_PPN + Math.round( + finalAfterVoucher * process.env.NEXT_PUBLIC_PPN + ) )}
@@ -296,8 +312,10 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
Include PPN:{' '} {currencyFormat( - product.lowestPrice.price * - process.env.NEXT_PUBLIC_PPN + Math.round( + Number(product.lowestPrice.price) * + process.env.NEXT_PUBLIC_PPN + ) )}
@@ -492,6 +510,18 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { {currencyFormat(product.lowestPrice.price)} + {/* [ADD] Tampilkan Include PPN pada branch flash sale */} + {product?.lowestPrice.priceDiscount > 0 && ( +
+ Include PPN:{' '} + {currencyFormat( + Math.round( + Number(product.lowestPrice.priceDiscount) * + process.env.NEXT_PUBLIC_PPN + ) + )} +
+ )} ) : ( // ===== BUKAN FLASH SALE ===== -- cgit v1.2.3