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 --- .../product-detail/components/Information.tsx | 42 ++++---- .../product-detail/styles/information.module.css | 2 +- .../components/Product/ProductDesktopVariant.jsx | 50 ++++----- .../components/Product/ProductMobileVariant.jsx | 44 ++++---- src/lib/product/components/ProductCard.jsx | 119 +++++++++++++-------- 5 files changed, 145 insertions(+), 112 deletions(-) diff --git a/src-migrate/modules/product-detail/components/Information.tsx b/src-migrate/modules/product-detail/components/Information.tsx index fd73d8b6..d6959aa8 100644 --- a/src-migrate/modules/product-detail/components/Information.tsx +++ b/src-migrate/modules/product-detail/components/Information.tsx @@ -186,6 +186,27 @@ const Information = ({ product }: Props) => {
Item Code
{selectedVariant?.code}
+
+
Berat Barang
+
+ {selectedVariant?.weight > 0 ? `${selectedVariant?.weight} Kg` : '-'} +
+
+
+
Terjual
+
+ {product.qty_sold > 0 ? formatToShortText(product.qty_sold) : '-'} +
+
+
+
Persiapan Barang
+ {isLoading && ( +
+ +
+ )} + {!isLoading &&
{sla?.sla_date}
} +
Manufacture
@@ -216,27 +237,6 @@ const Information = ({ product }: Props) => { )}
-
-
Berat Barang
-
- {selectedVariant?.weight > 0 ? `${selectedVariant?.weight} Kg` : '-'} -
-
-
-
Terjual
-
- {product.qty_sold > 0 ? formatToShortText(product.qty_sold) : '-'} -
-
-
-
Persiapan Barang
- {isLoading && ( -
- -
- )} - {!isLoading &&
{sla?.sla_date}
} -
); }; diff --git a/src-migrate/modules/product-detail/styles/information.module.css b/src-migrate/modules/product-detail/styles/information.module.css index 5aa64fe5..b1a8b256 100644 --- a/src-migrate/modules/product-detail/styles/information.module.css +++ b/src-migrate/modules/product-detail/styles/information.module.css @@ -6,7 +6,7 @@ @apply flex p-4 rounded-sm bg-gray-100; } -.row:nth-child(odd) { +.row:nth-child(even) { @apply bg-white; } 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