From a49f5a3f968dcc8c84759a382a0762abf0bc758b Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 23 Mar 2023 17:01:03 +0700 Subject: cart, checkout, quotation --- src/lib/cart/components/Cart.jsx | 218 +++++++++++++++++++++++++++++++++------ 1 file changed, 187 insertions(+), 31 deletions(-) (limited to 'src/lib/cart/components') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index b48b41fc..8bd9e362 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -1,6 +1,7 @@ import Link from '@/core/components/elements/Link/Link' import useCart from '../hooks/useCart' import Image from '@/core/components/elements/Image/Image' +import NextImage from 'next/image' import currencyFormat from '@/core/utils/currencyFormat' import { useEffect, useState } from 'react' import { deleteItemCart, getItemCart, updateItemCart } from '@/core/utils/cart' @@ -118,6 +119,33 @@ const Cart = () => { return ( <> + setDeleteConfirmation(null)} + title='Hapus dari Keranjang' + > +
+ Apakah anda yakin menghapus barang{' '} + {deleteConfirmation?.name} dari keranjang? +
+
+ + +
+
+
@@ -255,41 +283,169 @@ const Cart = () => {
- - setDeleteConfirmation(null)} - title='Hapus dari Keranjang' - > -
- Apakah anda yakin menghapus barang{' '} - {deleteConfirmation?.name} dari keranjang? -
-
- - -
-
-
-
-
-

Daftar Produk Belanja

+
+
+

Daftar Produk Belanja

+ + + + + + + + + + + + + {!cart.isLoading && (!products || products?.length == 0) && ( + + + + )} + {products?.map((product) => ( + + + + + + + + + ))} + +
Nama ProdukJumlahHargaSubtotalAction
Keranjang belanja anda masih kosong
+ + + + {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?.price?.discountPercentage > 0 && ( +
+
+ {currencyFormat(product?.price?.price)} +
+
+ {product?.price?.discountPercentage}% +
+
+ )} +
+ {currencyFormat(product?.price?.priceDiscount)} +
+
+
+ {currencyFormat(product?.price?.priceDiscount * product?.quantity)} +
+
+
+ +
+
+ +
+ +
+ Tanya stock untuk pembelian anda sebelum melanjutkan pembayaran! +
+
+
+ +
+
+

Ringkasan Belanja

+
+
+ Total: + +   + {selectedProduct().length > 0 + ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) + : '-'} + +
+
+
+ + +
-- cgit v1.2.3