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/cart') 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 f0df1a21f6a53baa12a7e44300ac2035adeb7f53 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 4 Oct 2023 12:05:14 +0700 Subject: mobile version --- src/lib/cart/components/Cart.jsx | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/lib/cart') 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)} -
-- 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 +-------------------------------------- 1 file changed, 3 insertions(+), 254 deletions(-) (limited to 'src/lib/cart') 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' : ''} -
-
+