From bdfaa0b8564e89d72ffd2de93eb088e8cf0db31e Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 2 Oct 2023 17:07:20 +0700 Subject: mapping new pricelist --- src/lib/product/components/ProductCard.jsx | 43 +++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 10ffdaec..83b26449 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -89,23 +89,40 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { > {product?.name} - {product?.lowestPrice.discountPercentage > 0 && ( -
-
- {currencyFormat(product.lowestPrice.price)} + {product?.flashSale?.id > 0 ? ( + <> + {product?.lowestPrice.discountPercentage > 0 && ( +
+
+ {currencyFormat(product.lowestPrice.price)} +
+
{product?.lowestPrice.discountPercentage}%
+
+ )} + +
+ {product?.lowestPrice.priceDiscount > 0 ? ( + currencyFormat(product?.lowestPrice.priceDiscount) + ) : ( + Call for price + )}
-
{product?.lowestPrice.discountPercentage}%
+ + ) : ( +
+ {product?.lowestPrice.price > 0 ? ( + <> + {currencyFormat(product?.lowestPrice.price)} +
+ Incl {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN )} +
+ + ) : ( + Call for price + )}
)} -
- {product?.lowestPrice.priceDiscount > 0 ? ( - currencyFormat(product?.lowestPrice.priceDiscount) - ) : ( - Call for price - )} -
- {product?.stockTotal > 0 && (
Ready Stock
-- cgit v1.2.3 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 +++++++++++++++------- .../components/Product/ProductDesktopVariant.jsx | 71 ++++++++++++--------- .../product/components/Product/ProductMobile.jsx | 69 ++++++++++++-------- .../components/Product/ProductMobileVariant.jsx | 73 +++++++++++---------- src/lib/product/components/ProductCard.jsx | 50 ++++++++++----- 5 files changed, 205 insertions(+), 132 deletions(-) (limited to 'src/lib') 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 ? (
*/}
- {lowestPrice?.priceDiscount > 0 ? ( + {product?.flashSale?.remainingTime > 0 ? ( <> -
-
- Harga Sebelum PPN : -
-
- - {currencyFormat(lowestPrice?.priceDiscount)} - -
-
- Termasuk PPN : -
+
{lowestPrice?.discountPercentage}%
-
- {currencyFormat(lowestPrice?.price * 1.11)} +
+ {currencyFormat(lowestPrice?.price)}
-

- {currencyFormat(lowestPrice?.priceDiscount * 1.11)} -

+
+ {currencyFormat(lowestPrice?.priceDiscount)} +
+
+
+ Termasuk PPN:{' '} + {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - +

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

)}
{ price: variant.price, stock: variant.stock, weight: variant.weight, - hasProgram: variant.hasProgram + hasProgram: variant.hasProgram, + isFlashsale: variant.isFlashsale } setActiveVariant(newActiveVariant) @@ -151,6 +152,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { router.push(`/shop/checkout?source=buy`) } + console.log('ini log', activeVariant) + const productSimilarQuery = [ product?.name, `fq=-product_id_i:${product.id}`, @@ -231,32 +234,48 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
Harga mulai dari:
)} - {activeVariant?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(activeVariant?.price?.price)} + {activeVariant.isFlashsale ? ( + <> +
+
{activeVariant?.price?.discountPercentage}%
+
+ {currencyFormat(activeVariant?.price?.price)} +
+
+ {currencyFormat(activeVariant?.price?.priceDiscount)} +
-
{activeVariant?.price?.discountPercentage}%
-
+
+ Termasuk PPN:{' '} + {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( +

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

)} -

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

diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx index d0c209cc..a7b1a543 100644 --- a/src/lib/product/components/Product/ProductMobileVariant.jsx +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -39,7 +39,8 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { name: product.name, price: getLowestPrice(), stock: product.stockTotal, - weight: product.weight + weight: product.weight, + isFlashSale: product.isFlashsale }) useEffect(() => { @@ -50,7 +51,8 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { name: product.name, price: product.price, stock: product.stock, - weight: product.weight + weight: product.weight, + isFlashSale: product.isFlashsale }) } }, [selectedVariant, product]) @@ -80,6 +82,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { }) setAddCartAlert(true) } + console.log('ini log', activeVariant) const handleClickBuy = () => { if (!validAction()) return @@ -139,47 +142,47 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {

{activeVariant?.name}

- {activeVariant?.price?.priceDiscount > 0 ? ( + {activeVariant.isFlashsale ? ( <>
-
Harga Sebelum PPN :
-
- {' '} +
{activeVariant?.price?.discountPercentage}%
+
+ {currencyFormat(activeVariant?.price?.price)} +
+
{currencyFormat(activeVariant?.price?.priceDiscount)}
-
- Termasuk PPN : -
- {activeVariant?.price?.discountPercentage > 0 && ( - <> -
- {activeVariant?.price?.discountPercentage}% -
-
- {currencyFormat(activeVariant?.price?.price * 1.11)} -
- - )} -

- {currencyFormat(activeVariant?.price?.priceDiscount * 1.11)} -

-
+
+ Termasuk PPN:{' '} + {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - +

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

)}
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 83b26449..16c63c00 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -82,7 +82,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} { {product?.lowestPrice.price > 0 ? ( <> {currencyFormat(product?.lowestPrice.price)} -
- Incl {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN )} +
+ + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)}
) : ( @@ -186,30 +186,46 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} {product?.name} + {product?.flashSale?.id > 0 ? ( + <> + {product?.lowestPrice.discountPercentage > 0 && ( +
+
{product?.lowestPrice?.discountPercentage}%
+
+ {currencyFormat(product?.lowestPrice?.price)} +
+
+ )} - {product?.lowestPrice?.discountPercentage > 0 && ( -
-
{product?.lowestPrice?.discountPercentage}%
-
- {currencyFormat(product?.lowestPrice?.price)} +
+ {product?.lowestPrice?.priceDiscount > 0 ? ( + currencyFormat(product?.lowestPrice?.priceDiscount) + ) : ( + Call for price + )}
+ + ) : ( +
+ {product?.lowestPrice.price > 0 ? ( + <> + {currencyFormat(product?.lowestPrice.price)} +
+ + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( + Call for price + )}
)} -
- {product?.lowestPrice?.priceDiscount > 0 ? ( - currencyFormat(product?.lowestPrice?.priceDiscount) - ) : ( - Call for price - )} -
- {product?.stockTotal > 0 && (
Ready Stock
-- cgit v1.2.3 From dde4c79768532247abae4a1d188c82f2d601fbe0 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 3 Oct 2023 17:11:13 +0700 Subject: check if flashsale in cart --- src/lib/cart/components/Cart.jsx | 2 +- src/lib/cart/components/Cartheader.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index b5976a1b..acd23af6 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -685,7 +685,7 @@ const Cart = () => { - {product?.price?.discountPercentage > 0 && ( + {product?.hasFlashsale && (
{currencyFormat(product?.price?.price)} diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx index cbe7c7e1..901b1501 100644 --- a/src/lib/cart/components/Cartheader.jsx +++ b/src/lib/cart/components/Cartheader.jsx @@ -204,7 +204,7 @@ const Cardheader = (cartCount) => {

- {product?.price?.discountPercentage > 0 && ( + {product?.hasFlashsale && (
{product?.price?.discountPercentage}% -- cgit v1.2.3 From eb7bea2f262ffa4faa39d4f163950892c5640c0f Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 4 Oct 2023 10:09:43 +0700 Subject: pricelist di cart dan list variant --- .../product/components/Product/ProductDesktop.jsx | 64 ++++++++++++++-------- .../product/components/Product/ProductMobile.jsx | 2 - .../components/Product/ProductMobileVariant.jsx | 1 - src/lib/variant/components/VariantGroupCard.jsx | 1 - 4 files changed, 42 insertions(+), 26 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 0df60673..30424943 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -452,7 +452,8 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
- 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 - - )} -
+ )} */} + {/* */} diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index a9d34683..94312d31 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -152,8 +152,6 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { router.push(`/shop/checkout?source=buy`) } - console.log('ini log', activeVariant) - const productSimilarQuery = [ product?.name, `fq=-product_id_i:${product.id}`, diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx index a7b1a543..8cdb631f 100644 --- a/src/lib/product/components/Product/ProductMobileVariant.jsx +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -82,7 +82,6 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { }) setAddCartAlert(true) } - console.log('ini log', activeVariant) const handleClickBuy = () => { if (!validAction()) return diff --git a/src/lib/variant/components/VariantGroupCard.jsx b/src/lib/variant/components/VariantGroupCard.jsx index dd5983a9..1e921546 100644 --- a/src/lib/variant/components/VariantGroupCard.jsx +++ b/src/lib/variant/components/VariantGroupCard.jsx @@ -4,7 +4,6 @@ import Image from '@/core/components/elements/Image/Image' import currencyFormat from '@/core/utils/currencyFormat' const VariantGroupCard = ({ variants, ...props }) => { - console.log('variant', variants) const [showAll, setShowAll] = useState(false) const variantsToShow = showAll ? variants : variants.slice(0, 2) -- 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') 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 12:05:14 +0700 Subject: mobile version --- src/lib/cart/components/Cart.jsx | 30 +++++++++++++++---------- src/lib/checkout/components/Checkout.jsx | 35 +++++++++++++++++++----------- src/lib/variant/components/VariantCard.jsx | 2 +- 3 files changed, 41 insertions(+), 26 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index acd23af6..5716d01b 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -32,7 +32,7 @@ const Cart = () => { const [cart, setCart] = useState(null) - const {setRefreshCart} = useProductCartContext() + const { setRefreshCart } = useProductCartContext() useEffect(() => { if (!auth) return @@ -115,7 +115,7 @@ const Cart = () => { selected: true }).then(() => { getCart().then(() => { - if(promotionActiveId){ + if (promotionActiveId) { setPromotionType(false) } }) @@ -438,7 +438,7 @@ const Cart = () => { product.program.items && product.program.items.map((item) => (
- + { - {product?.hasFlashsale && ( -
-
- {currencyFormat(product?.price?.price)} + {product?.hasFlashsale ? ( + <> +
+
+ {currencyFormat(product?.price?.price)} +
+
+ {product?.price?.discountPercentage}% +
-
- {product?.price?.discountPercentage}% +
+ {currencyFormat(product?.price?.priceDiscount)}
+ + ) : ( +
+ {currencyFormat(product?.price?.price)}
)} -
- {currencyFormat(product?.price?.priceDiscount)} -
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 6d2f62e0..4739cd18 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -633,8 +633,11 @@ const Checkout = () => { Berakhir dalam{' '} {item.remainingTime} lagi,{' '}
-
handlingTnC(item)} > - Baca S&K +
handlingTnC(item)} + > + Baca S&K
@@ -1045,21 +1048,27 @@ const Checkout = () => { /> - {product?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} + {product?.hasFlashsale ? ( + <> +
+
+ {currencyFormat(product?.price?.price)} +
+
+ {product?.price?.discountPercentage}% +
-
- {product?.price?.discountPercentage}% +
+ {currencyFormat(product?.price?.priceDiscount)}
+ + ) : ( +
+ {product.price.priceDiscount > 0 + ? currencyFormat(product?.price?.priceDiscount) + : 'Call For Price'}
)} -
- {product.price.priceDiscount > 0 - ? currencyFormat(product?.price?.priceDiscount) - : 'Call For Price'} -
diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx index 0f9f02f6..64b6d146 100644 --- a/src/lib/variant/components/VariantCard.jsx +++ b/src/lib/variant/components/VariantCard.jsx @@ -43,7 +43,7 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { Berat Item : {product?.weight} Kg

- {product.price.discountPercentage > 0 && ( + {product.hasFlashsale && ( <>

{currencyFormat(product.price.price)} -- cgit v1.2.3 From 427feacedcdc511fcead8d2289264aa58bafd038 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" 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') 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/cart/components/Cart.jsx | 257 +-------------------- src/lib/checkout/components/Checkout.jsx | 8 +- .../product/components/Product/ProductDesktop.jsx | 4 +- src/lib/product/components/ProductCard.jsx | 6 +- src/lib/quotation/components/Quotation.jsx | 66 +----- 5 files changed, 16 insertions(+), 325 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 5716d01b..c6aaa596 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -23,6 +23,8 @@ import { getPromotionProgram } from '@/lib/promotinProgram/api/homepageApi' import PromotionType from '@/lib/promotinProgram/components/PromotionType' import { gtagBeginCheckout } from '@/core/utils/googleTag' import { useProductCartContext } from '@/contexts/ProductCartContext' +import CardProdcuctsList from '@/core/components/elements/Product/cartProductsList' +// import cardProdcuctsList from '@/core/components/elements/Product/cartProductsList' const Cart = () => { const router = useRouter() @@ -530,260 +532,7 @@ const Cart = () => {

Keranjang

- - - - - - - - - - - - {isLoading && ( - - - - )} - {!isLoading && (!products || products?.length == 0) && ( - - - - )} - {products && - products?.map((product) => ( - <> - {product.hasProgram && ( - - - - )} - - - - - - - - - {product?.program?.items && ( - - {product.program.items.map((item) => ( - <> - - - - - - - - ))} - - )} - - ))} - -
Nama ProdukJumlahHargaSubtotalAction
-
- -
-
Keranjang belanja anda masih kosong
-
- {product.program ? ( - <> -
- - {product.program.type.label} - -
-
- {product.program.type.value == 'merchandise' ? ( - <>Selamat anda mendapatkan merchandise indoteknik.com - ) : ( - <> - Selamat! Pembelian anda lebih hemat - - {' '} - {currencyFormat(product.program?.totalSavings)} - - - )} -
- - ) : ( - <> -
- Promo -
-
- Pilih Promo Yang Tersedia Bisa lebih Hemat -
- - )} -
- handlePopUpPromo( - product.id, - product.quantity, - product.program?.id - ) - } - className='ml-auto text-red-500 flex gap-x-1 cursor-pointer' - > -
Cek Promo
-
- -
-
-
-
- - toggleSelected(product.id)} - checked={product?.selected} - className='accent-danger-500 w-4' - /> - - - - {product?.name} - -
- - {product?.parent?.name} - -
- {product?.code}{' '} - {product?.attributes.length > 0 - ? `| ${product?.attributes.join(', ')}` - : ''} -
-
-
- - updateQuantity(e.target.value, product?.id)} - onBlur={(e) => updateQuantity(e.target.value, product?.id, 'BLUR')} - /> - - - {product?.hasFlashsale ? ( - <> -
-
- {currencyFormat(product?.price?.price)} -
-
- {product?.price?.discountPercentage}% -
-
-
- {currencyFormat(product?.price?.priceDiscount)} -
- - ) : ( -
- {currencyFormat(product?.price?.price)} -
- )} -
- -
- {currencyFormat(product?.price?.priceDiscount * product?.quantity)} -
-
-
- -
-
- - - -
- {item.name} -
-
-
- - {product.program.type.label} - -
-
{item.name}
-
-
- - - - - {item?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} -
-
- )} -
- {item?.price.priceDiscount > 0 ? 'Gratis' : ''} -
-
- -
- {item.price.priceDiscount > 0 ? 'Gratis' : ''} -
-
+
{
Detail Pesanan
- + + + + {/*
@@ -1148,7 +1152,7 @@ const Checkout = () => { )) )} -
Nama Produk
+ */}
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 )} diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 16c63c00..6a5e29ab 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -113,8 +113,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { {product?.lowestPrice.price > 0 ? ( <> {currencyFormat(product?.lowestPrice.price)} -
- + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)} +
+ Inc. PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN )}
) : ( @@ -217,7 +217,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { <> {currencyFormat(product?.lowestPrice.price)}
- + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)} + Inc. PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)}
) : ( diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx index cee35457..8c379ead 100644 --- a/src/lib/quotation/components/Quotation.jsx +++ b/src/lib/quotation/components/Quotation.jsx @@ -16,6 +16,7 @@ import MobileView from '@/core/components/views/MobileView' import DesktopView from '@/core/components/views/DesktopView' import Image from '@/core/components/elements/Image/Image' import { useQuery } from 'react-query' +import CardProdcuctsList from '@/core/components/elements/Product/cartProductsList' const { checkoutApi } = require('@/lib/checkout/api/checkoutApi') const { getProductsCheckout } = require('@/lib/checkout/api/checkoutApi') @@ -174,70 +175,7 @@ const Quotation = () => {
Detail Barang
- - - - - - - - - - - {products?.map((product) => ( - - - - - - - ))} - -
Nama ProdukJumlahHargaSubtotal
-
- {product?.name} -
-
-
- {product?.parent?.name} -
-
- {product?.code}{' '} - {product?.attributes.length > 0 - ? `| ${product?.attributes.join(', ')}` - : ''} -
-
-
- - - {product?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} -
-
- {product?.price?.discountPercentage}% -
-
- )} -
- {currencyFormat(product?.price?.priceDiscount)} -
-
-
- {currencyFormat(product?.price?.priceDiscount * product?.quantity)} -
-
+
-- cgit v1.2.3 From 760a7199aafb1d7f995611f9b6bca1379dfc4b65 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 5 Oct 2023 09:54:22 +0700 Subject: hide checkbox if source != cart --- src/lib/checkout/components/Checkout.jsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 6b7852f2..e2c1a85b 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -989,7 +989,6 @@ const Checkout = () => {
Detail Pesanan
- {/* -- cgit v1.2.3 From 5d4cf836d098e9c351bce4d25f0e88e341646ccc Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 6 Oct 2023 13:49:16 +0700 Subject: feedback pricelist product mobile --- src/lib/product/components/Product/ProductMobile.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 94312d31..20a1d3f4 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -250,12 +250,12 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { ) : (

- {activeVariant?.price?.priceDiscount > 0 ? ( + {activeVariant?.price?.price > 0 ? ( <> - {currencyFormat(activeVariant?.price?.priceDiscount)} + {currencyFormat(activeVariant?.price?.price)}
Termasuk PPN:{' '} - {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} + {currencyFormat(activeVariant?.price.price * process.env.NEXT_PUBLIC_PPN)}
) : ( -- cgit v1.2.3