From 787d3aaa3187d3432c8e6b743b555ea3e4a4980c Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 3 Oct 2023 15:25:14 +0700 Subject: new pricelist di page product cart, product detail & product variant --- .../product/components/Product/ProductDesktop.jsx | 74 +++++++++++++++------- 1 file changed, 50 insertions(+), 24 deletions(-) (limited to 'src/lib/product/components/Product/ProductDesktop.jsx') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 5cc35df7..0df60673 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -413,13 +413,13 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
Harga mulai dari:
)} - {lowestPrice?.discountPercentage > 0 && ( + {/* {lowestPrice?.discountPercentage > 0 && (
{lowestPrice?.discountPercentage}%
-
- {currencyFormat(lowestPrice?.price)} +
+ Include PPN {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
{product.flashSale.remainingTime > 0 && (
@@ -436,28 +436,54 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
)}
+ )} */} + + {product?.flashSale?.remainingTime > 0 ? ( + <> +
+
+ {lowestPrice?.discountPercentage}% +
+
+ {currencyFormat(lowestPrice?.price)} +
+
+ {currencyFormat(lowestPrice?.priceDiscount)} +
+
+
+ Termasuk PPN: {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( +

+ {lowestPrice?.price > 0 ? ( + <> + {currencyFormat(lowestPrice?.price)} +
+ Termasuk PPN: {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} +

)} -

- {lowestPrice?.priceDiscount > 0 ? ( - currencyFormat(lowestPrice?.priceDiscount) - ) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - - )} -

+ {product.variants.length > 1 ? (
- Termasuk PPN: {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)} + Termasuk PPN:{' '} + {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
) : ( @@ -461,7 +462,8 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { <> {currencyFormat(lowestPrice?.price)}
- Termasuk PPN: {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)} + Termasuk PPN:{' '} + {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
) : ( @@ -575,32 +577,50 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { - {variant.price.discountPercentage > 0 && + {variant.isFlashsale ? ( + <> +
+
+ {lowestPrice?.discountPercentage}% +
+
+ {currencyFormat(variant.price.price)} +
{' '} +
+ {currencyFormat(variant.price.priceDiscount)} +
{' '} +
+ {currencyFormat(variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} + + ) : ( +
+ {variant.price.price > 0 ? ( + currencyFormat(variant.price.price * process.env.NEXT_PUBLIC_PPN) + ) : ( + + Call for price + + )} +
+ )} + {/* {variant.price.discountPercentage > 0 && variant.price.priceDiscount > 0 && ( <>
{currencyFormat(variant.price.price)}
{' '} - )} -
- {variant.price.priceDiscount > 0 ? ( - currencyFormat(variant.price.priceDiscount) - ) : ( - - Call for price - - )} -
+ )} */} + {/* */} -- cgit v1.2.3 From 5624207e88c272a8edde9c334393bca5ac20d3fc Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 4 Oct 2023 11:35:03 +0700 Subject: ketingaalan --- .../product/components/Product/ProductDesktop.jsx | 50 +++++++++++++++------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'src/lib/product/components/Product/ProductDesktop.jsx') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 30424943..16ff31aa 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -44,8 +44,13 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { const { setRefreshCart, refreshCart } = useProductCartContext() const getLowestPrice = useCallback(() => { - const prices = product.variants.map((variant) => variant.price) + const prices = product.variants.map((variant) => ({ + price: variant.price, + isFlashsale: variant.isFlashsale + })) const lowest = prices.reduce((lowest, price) => { + console.log('ini reduce lowest', lowest) + console.log('ini reduce price', price) return price.priceDiscount < lowest.priceDiscount ? price : lowest }, prices[0]) return lowest @@ -438,32 +443,32 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { )} */} - {product?.flashSale?.remainingTime > 0 ? ( + {lowestPrice?.isFlashsale ? ( <>
- {lowestPrice?.discountPercentage}% + {lowestPrice?.price?.discountPercentage}%
- {currencyFormat(lowestPrice?.price)} + {currencyFormat(lowestPrice?.price?.price)}
- {currencyFormat(lowestPrice?.priceDiscount)} + {currencyFormat(lowestPrice?.price?.priceDiscount)}
Termasuk PPN:{' '} - {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)} + {currencyFormat(lowestPrice?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
) : (

- {lowestPrice?.price > 0 ? ( + {lowestPrice?.price.price > 0 ? ( <> - {currencyFormat(lowestPrice?.price)} + {currencyFormat(lowestPrice?.price.price)}
Termasuk PPN:{' '} - {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)} + {currencyFormat(lowestPrice?.price.price * process.env.NEXT_PUBLIC_PPN)}
) : ( @@ -581,21 +586,36 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { <>
- {lowestPrice?.discountPercentage}% + {variant?.price?.discountPercentage}%
- {currencyFormat(variant.price.price)} + {currencyFormat(variant?.price?.price)}
{' '}
- {currencyFormat(variant.price.priceDiscount)} + {currencyFormat(variant?.price?.priceDiscount)}
{' '}
- {currencyFormat(variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} +
+ + PPN:{' '} + {currencyFormat( + variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN + )} +
) : (
- {variant.price.price > 0 ? ( - currencyFormat(variant.price.price * process.env.NEXT_PUBLIC_PPN) + {variant?.price?.price > 0 ? ( + <> +
+ {currencyFormat(variant?.price?.price)} +
{' '} +
+ + PPN:{' '} + {currencyFormat( + variant?.price?.priceDiscount * process.env.NEXT_PUBLIC_PPN + )} +
+ ) : ( Date: Wed, 4 Oct 2023 15:34:39 +0700 Subject: set tier auth --- src/lib/product/components/Product/ProductDesktop.jsx | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/lib/product/components/Product/ProductDesktop.jsx') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 16ff31aa..5e827089 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -49,8 +49,6 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { isFlashsale: variant.isFlashsale })) const lowest = prices.reduce((lowest, price) => { - console.log('ini reduce lowest', lowest) - console.log('ini reduce price', price) return price.priceDiscount < lowest.priceDiscount ? price : lowest }, prices[0]) return lowest -- cgit v1.2.3 From e72c16eb549488e1ed847b022880f542d2a9c525 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 5 Oct 2023 09:32:12 +0700 Subject: add component list product for cart, quotation, and checkout --- src/lib/product/components/Product/ProductDesktop.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/product/components/Product/ProductDesktop.jsx') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 5e827089..4c8c3ae9 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -594,7 +594,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
{' '}
- + PPN:{' '} + Inc. PPN:{' '} {currencyFormat( variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN )} @@ -608,7 +608,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { {currencyFormat(variant?.price?.price)}
{' '}
- + PPN:{' '} + Inc. PPN:{' '} {currencyFormat( variant?.price?.priceDiscount * process.env.NEXT_PUBLIC_PPN )} -- cgit v1.2.3