From d178a520534af7d1cbcc03134034ad8a2327b461 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 20 Mar 2023 17:14:16 +0700 Subject: product detail and cart header --- src/lib/cart/components/Cart.jsx | 316 ++++++++++++++++++++------------------- 1 file changed, 164 insertions(+), 152 deletions(-) (limited to 'src/lib/cart/components') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 962ef860..b48b41fc 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -11,6 +11,8 @@ import BottomPopup from '@/core/components/elements/Popup/BottomPopup' import { toast } from 'react-hot-toast' import Spinner from '@/core/components/elements/Spinner/Spinner' import Alert from '@/core/components/elements/Alert/Alert' +import MobileView from '@/core/components/views/MobileView' +import DesktopView from '@/core/components/views/DesktopView' const Cart = () => { const router = useRouter() @@ -115,174 +117,184 @@ const Cart = () => { } return ( -
-
-

Daftar Produk Belanja

- Cari Produk Lain -
- -
- {cart.isLoading && ( -
- + <> + +
+
+

Daftar Produk Belanja

+ Cari Produk Lain
- )} - {!cart.isLoading && (!products || products?.length == 0) && ( -
- - Keranjang belanja anda masih kosong - -
- )} +
+ {cart.isLoading && ( +
+ +
+ )} - {products?.map((product) => ( -
- - - {product?.name} - -
- - {product?.parent?.name} - -
- {product?.code}{' '} - {product?.attributes.length > 0 ? `| ${product?.attributes.join(', ')}` : ''} + {!cart.isLoading && (!products || products?.length == 0) && ( +
+ + Keranjang belanja anda masih kosong +
- {product?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} + )} + + {products?.map((product) => ( +
+ + + {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)} +
+
+ + updateQuantity(e.target.value, product?.id)} + onBlur={(e) => updateQuantity(e.target.value, product?.id, 'BLUR')} + /> + + +
-
{product?.price?.discountPercentage}%
- )} -
- {currencyFormat(product?.price?.priceDiscount)}
-
-
- {currencyFormat(product?.price?.priceDiscount * product?.quantity)} -
-
- - updateQuantity(e.target.value, product?.id)} - onBlur={(e) => updateQuantity(e.target.value, product?.id, 'BLUR')} - /> - - + ))} + +
+
+
+ Total: + +   + {selectedProduct().length > 0 + ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) + : '-'} +
+
+ + +
- ))} -
-
-
- Total: - -   - {selectedProduct().length > 0 - ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) - : '-'} - + setDeleteConfirmation(null)} + title='Hapus dari Keranjang' + > +
+ Apakah anda yakin menghapus barang{' '} + {deleteConfirmation?.name} dari keranjang?
-
-
- - -
+
+ + +
+
-
+ - setDeleteConfirmation(null)} - title='Hapus dari Keranjang' - > -
- Apakah anda yakin menghapus barang{' '} - {deleteConfirmation?.name} dari keranjang? -
-
- - + +
+
+
+

Daftar Produk Belanja

+
+
- -
+ + ) } -- cgit v1.2.3