diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-06-16 14:01:58 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-06-16 14:01:58 +0700 |
| commit | dea8af5e7293d5e656a8a70b45b47a458420ed41 (patch) | |
| tree | b0ec82792685c87ae13ca778f8163b32514bbf6b /src/lib/cart/components | |
| parent | a235f77530f0f51b3637b4b1096552fe3058ed69 (diff) | |
Update cart detail
Diffstat (limited to 'src/lib/cart/components')
| -rw-r--r-- | src/lib/cart/components/Cart.jsx | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 8c4e7d42..c02f976f 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -140,6 +140,10 @@ const Cart = () => { router.push('/shop/checkout') } + const totalOrder = totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount + const tax = totalOrder * 0.11 + const totalPrice = totalOrder + tax + return ( <> <BottomPopup @@ -272,15 +276,19 @@ const Cart = () => { ))} <div className='sticky bottom-0 left-0 w-full p-4 mt-auto border-t border-gray_r-6 bg-white'> - <div className='flex justify-between mb-4'> - <div className='text-gray_r-11'> - Total: - <span className='text-danger-500 font-semibold'> - - {selectedProduct().length > 0 - ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) - : '-'} - </span> + <div className='flex flex-col gap-y-3 mb-4'> + <div className='text-gray_r-11 flex justify-between'> + <span>Total Pesanan</span> + <span className='text-gray_r-12'>{currencyFormat(totalOrder)}</span> + </div> + <div className='text-gray_r-11 flex justify-between'> + PPN 11% + <span className='text-gray_r-12'>{currencyFormat(tax)}</span> + </div> + <hr /> + <div className='text-gray_r-12 flex font-semibold justify-between'> + Total Harga: + <span className='text-danger-500'>{currencyFormat(totalPrice)}</span> </div> </div> <div className='flex gap-x-3'> @@ -447,15 +455,19 @@ const Cart = () => { <div className='col-span-3 pl-4'> <div className='sticky top-48 w-full p-4 rounded border border-gray_r-6 bg-white'> <h1 className='text-title-sm font-semibold mb-6'>Ringkasan Belanja</h1> - <div className='flex justify-between mb-4'> - <div className='text-gray_r-11'> - Total: - <span className='text-danger-500 font-semibold'> - - {selectedProduct().length > 0 - ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) - : '-'} - </span> + <div className='flex flex-col gap-y-3 mb-4'> + <div className='text-gray_r-11 flex justify-between'> + <span>Total Pesanan</span> + <span className='text-gray_r-12'>{currencyFormat(totalOrder)}</span> + </div> + <div className='text-gray_r-11 flex justify-between'> + PPN 11% + <span className='text-gray_r-12'>{currencyFormat(tax)}</span> + </div> + <hr /> + <div className='text-gray_r-12 flex font-semibold justify-between'> + Total Harga: + <span className='text-danger-500'>{currencyFormat(totalPrice)}</span> </div> </div> <div className='flex gap-x-3'> |
