From 0024a3687e75f6b746aebcbfaf2d7953fce3b05b Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 5 Nov 2025 11:02:08 +0700 Subject: cr renca manufacture logo --- .../components/Product/ProductDesktopVariant.jsx | 50 ++++----- .../components/Product/ProductMobileVariant.jsx | 44 ++++---- src/lib/product/components/ProductCard.jsx | 119 +++++++++++++-------- 3 files changed, 123 insertions(+), 90 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index bc07507b..24a8498a 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -401,34 +401,10 @@ const ProductDesktopVariant = ({ {product?.name}
-
+
Item Code
{product.code}
-
-
Manufacture
-
- - {product?.manufacture.logo ? ( - {product.manufacture.name} - ) : ( -

- {product.manufacture.name} -

- )} - -
-
Berat Barang
@@ -479,6 +455,30 @@ const ProductDesktopVariant = ({ )}
+
+
Manufacture
+
+ + {product?.manufacture.logo ? ( + {product.manufacture.name} + ) : ( +

+ {product.manufacture.name} +

+ )} + +
+
diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx index c44de561..acacb535 100644 --- a/src/lib/product/components/Product/ProductMobileVariant.jsx +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -405,28 +405,6 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { {activeVariant?.code || '-'} - - - {product?.manufacture.logo ? ( - {product.manufacture.name} - ) : ( -

- {product.manufacture.name} -

- )} - -
{' '} {product.qtySold || '-'} {' '} @@ -495,6 +473,28 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { )} + + + {product?.manufacture.logo ? ( + {product.manufacture.name} + ) : ( +

+ {product.manufacture.name} +

+ )} + +
{' '} { {product?.name} + {/* ---------- HARGA ---------- */} {product?.flashSale?.id > 0 && product?.lowestPrice.discountPercentage > 0 ? ( + // ===== CASE FLASH SALE =====
-
- {/* harga sekarang (merah) */} - +
+ {product?.lowestPrice.priceDiscount > 0 ? ( - currencyFormat(product?.lowestPrice.priceDiscount) // ← perbaikan di sini + currencyFormat(product?.lowestPrice.priceDiscount) ) : ( { )} - {/* harga lama (abu, dicoret) */} - + {currencyFormat(product.lowestPrice.price)}
) : ( - // === BLOK ELSE PUNYA KAMU, TIDAK DIUBAH === -
- {product?.lowestPrice.price > 0 ? ( - <> - {currencyFormat(product?.lowestPrice.priceDiscount)} -
- Include PPN:{' '} - {currencyFormat( - product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN - )} -
- - ) : ( -
- Call for Inquiry - - )} -
- )} + // ===== BUKAN FLASH SALE ===== + (() => { + const basePrice = product?.lowestPrice?.priceDiscount || 0; + const voucherCut = discount || 0; + const finalAfterVoucher = Math.max(basePrice - voucherCut, 0); + + // CASE 1: ada harga (>0) + if (product?.lowestPrice?.price > 0) { + if (voucherCut > 0) { + return ( +
+ {/* baris harga sekarang + harga coret */} +
+ {/* harga setelah voucher */} + + + {currencyFormat(finalAfterVoucher)} + - {discount > 0 && (product?.flashSale?.id ?? 0) < 1 && ( -
- {/* ⬇️ gunakan flex-wrap & min-w-0 */} -
- Voucher - - - - {currencyFormat(discount)} - - -
-
+ {/* harga sebelum voucher, dicoret, truncate kalau kepanjangan */} + {/* + {currencyFormat(basePrice)} + */} +
+ + {/* PPN pakai harga finalAfterVoucher */} +
+ Include PPN:{' '} + {currencyFormat( + finalAfterVoucher * process.env.NEXT_PUBLIC_PPN + )} +
+
+ ); + } + + // CASE 1b: ga ada voucher + return ( +
+ {currencyFormat(basePrice)} +
+ Include PPN:{' '} + {currencyFormat( + product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN + )} +
+
+ ); + } + + // CASE 2: harga 0 → call for inquiry + return ( +
+ + Call for Inquiry + +
+ ); + })() )} + {/* ---------- /HARGA ---------- */}
{product?.stockTotal > 0 && ( -- cgit v1.2.3