From 0a548e87febeab3d25ba7d5270b73b757f130b26 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 26 Apr 2023 11:39:23 +0700 Subject: fix bug on update qty cart and create quotation page --- src/lib/cart/components/Cart.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/cart') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index d0685fe3..b0de5168 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -72,7 +72,7 @@ const Cart = () => { }, [products]) useEffect(() => { - const LoadProductSImilar = async () => { + const LoadProductSimilar = async () => { const randProductIndex = Math.floor(Math.random() * products.length) const productLoad = await productSearchApi({ query: `q=${products?.[randProductIndex].parent.name}&limit=10` @@ -80,8 +80,8 @@ const Cart = () => { setProductRecomendation(productLoad) } - if (products?.length > 0) LoadProductSImilar() - }, [products]) + if (products?.length > 0 && !productRecomendation) LoadProductSimilar() + }, [products, productRecomendation]) const updateQuantity = (value, productId, operation = '') => { let productIndex = products.findIndex((product) => product.id == productId) -- cgit v1.2.3 From b4abdb00ef83aa824e8a05d5b75df48adb7b9629 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 3 May 2023 10:38:52 +0700 Subject: semi dynamic page --- src/lib/cart/components/Cart.jsx | 147 ++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 73 deletions(-) (limited to 'src/lib/cart') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index b0de5168..3a61e9be 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -329,91 +329,92 @@ const Cart = () => { Keranjang belanja anda masih kosong )} - {products && products?.map((product) => ( - - - toggleSelected(product.id)} - checked={product?.selected} - className='accent-danger-500 w-4' - /> - - - - {product?.name} ( + + + toggleSelected(product.id)} + checked={product?.selected} + className='accent-danger-500 w-4' /> - -
+ + - {product?.parent?.name} + {product?.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?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} +
+ + {product?.parent?.name} + +
+ {product?.code}{' '} + {product?.attributes.length > 0 + ? `| ${product?.attributes.join(', ')}` + : ''}
-
- {product?.price?.discountPercentage}% +
+ + + updateQuantity(e.target.value, product?.id)} + onBlur={(e) => updateQuantity(e.target.value, product?.id, 'BLUR')} + /> + + + {product?.price?.discountPercentage > 0 && ( +
+
+ {currencyFormat(product?.price?.price)} +
+
+ {product?.price?.discountPercentage}% +
+ )} +
+ {currencyFormat(product?.price?.priceDiscount)}
- )} -
- {currencyFormat(product?.price?.priceDiscount)} -
- - -
- {currencyFormat(product?.price?.priceDiscount * product?.quantity)} -
- - -
- -
- - - ))} + + +
+ {currencyFormat(product?.price?.priceDiscount * product?.quantity)} +
+ + +
+ +
+ + + ))} -- cgit v1.2.3 From 93832023b7c2f560bd90a02e9768d0fccec79078 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 3 May 2023 16:03:45 +0700 Subject: whatsapp url --- src/lib/cart/components/Cart.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib/cart') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 3a61e9be..1008bffc 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -16,6 +16,7 @@ import MobileView from '@/core/components/views/MobileView' import DesktopView from '@/core/components/views/DesktopView' import ProductCard from '@/lib/product/components/ProductCard' import productSearchApi from '@/lib/product/api/productSearchApi' +import whatsappUrl from '@/core/utils/whatsappUrl' const Cart = () => { const router = useRouter() @@ -429,7 +430,7 @@ const Cart = () => { Tanya stock untuk pembelian anda sebelum melanjutkan pembayaran! {' '} - + Hubungi Kami -- cgit v1.2.3