summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-11-05 13:53:47 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-11-05 13:53:47 +0700
commitaf6cf002290fb4ab7d16618fcbba16ebc94e78db (patch)
tree6d35d298c5b597d90feadb1fa7d47449e778f763
parentaa1e0a34f5f332026d386b197d62c2cc3d9f43ad (diff)
<Miqdad> include ppn all
-rw-r--r--src/lib/product/components/ProductCard.jsx58
1 files 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}
</Link>
-
{/* ---------- HARGA ---------- */}
{product?.flashSale?.id > 0 &&
product?.lowestPrice.discountPercentage > 0 ? (
@@ -243,21 +242,36 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
<span
className='text-gray_r-11 line-through text-xs sm:text-caption-2
- whitespace-nowrap overflow-hidden text-ellipsis max-w-[40%]'
+ whitespace-nowrap overflow-hidden text-ellipsis max-w-[40%]'
>
{currencyFormat(product.lowestPrice.price)}
</span>
</div>
+
+ {/* [ADD] Tampilkan Include PPN pada branch flash sale */}
+ {product?.lowestPrice.priceDiscount > 0 && (
+ <div className='text-gray_r-9 text-[10px] font-normal'>
+ Include PPN:{' '}
+ {currencyFormat(
+ Math.round(
+ Number(product.lowestPrice.priceDiscount) *
+ process.env.NEXT_PUBLIC_PPN
+ )
+ )}
+ </div>
+ )}
</div>
) : (
// ===== 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 (
<div className='mb-2'>
@@ -269,20 +283,22 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
{currencyFormat(finalAfterVoucher)}
</span>
- {/* harga sebelum voucher, dicoret, truncate kalau kepanjangan */}
+ {/* [OPTIONAL] harga sebelum voucher (coret) kalau mau muncul */}
{/* <span
- className='text-gray_r-11 line-through text-[11px] leading-snug
- whitespace-nowrap overflow-hidden text-ellipsis max-w-[40%]'
- >
- {currencyFormat(basePrice)}
- </span> */}
+ className='text-gray_r-11 line-through text-[11px] leading-snug
+ whitespace-nowrap overflow-hidden text-ellipsis max-w-[40%]'
+ >
+ {currencyFormat(basePrice)}
+ </span> */}
</div>
{/* PPN pakai harga finalAfterVoucher */}
<div className='text-gray_r-9 text-[10px] font-normal'>
Include PPN:{' '}
{currencyFormat(
- finalAfterVoucher * process.env.NEXT_PUBLIC_PPN
+ Math.round(
+ finalAfterVoucher * process.env.NEXT_PUBLIC_PPN
+ )
)}
</div>
</div>
@@ -296,8 +312,10 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
<div className='text-gray_r-9 text-[10px] font-normal'>
Include PPN:{' '}
{currencyFormat(
- product.lowestPrice.price *
- process.env.NEXT_PUBLIC_PPN
+ Math.round(
+ Number(product.lowestPrice.price) *
+ process.env.NEXT_PUBLIC_PPN
+ )
)}
</div>
</div>
@@ -492,6 +510,18 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
{currencyFormat(product.lowestPrice.price)}
</span>
</div>
+ {/* [ADD] Tampilkan Include PPN pada branch flash sale */}
+ {product?.lowestPrice.priceDiscount > 0 && (
+ <div className='text-gray_r-9 text-[10px] font-normal'>
+ Include PPN:{' '}
+ {currencyFormat(
+ Math.round(
+ Number(product.lowestPrice.priceDiscount) *
+ process.env.NEXT_PUBLIC_PPN
+ )
+ )}
+ </div>
+ )}
</div>
) : (
// ===== BUKAN FLASH SALE =====