diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-07-17 16:58:42 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-07-17 16:58:42 +0700 |
| commit | e76d537689d08fb4c15d482ffa996b8012dbc941 (patch) | |
| tree | 17267b16ba50c89d55c29ea8c962312c05bdcb70 /src/lib/cart/components/Cart.jsx | |
| parent | 581334e8d077916c3a9ab87fd5b6e6b5126aba12 (diff) | |
| parent | e39d3b0082e83ad08044918f0b6d8e977223100d (diff) | |
Merge branch 'Feature/voucher' into Feature/promotion_programvaoucher
# Conflicts:
# src/lib/cart/components/Cart.jsx
# src/lib/checkout/components/Checkout.jsx
# src/lib/product/components/Product/Product.jsx
# src/lib/product/components/Product/ProductDesktop.jsx
# src/lib/product/components/Product/ProductMobile.jsx
Diffstat (limited to 'src/lib/cart/components/Cart.jsx')
| -rw-r--r-- | src/lib/cart/components/Cart.jsx | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 41efffe9..efbcf76b 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -21,6 +21,7 @@ import useAuth from '@/core/hooks/useAuth' import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' import { getPromotionProgram } from '@/lib/promotinProgram/api/homepageApi' import PromotionType from '@/lib/promotinProgram/components/PromotionType' +import { gtagBeginCheckout } from '@/core/utils/googleTag' const Cart = () => { const router = useRouter() @@ -205,6 +206,15 @@ const Cart = () => { setPromotionActiveId(promoId) } + const handleCheckout = () => { + gtagBeginCheckout(products) + router.push('/shop/checkout') + } + + const totalOrder = totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount + const tax = totalOrder * 0.11 + const totalPrice = totalOrder + tax + return ( <> <BottomPopup @@ -473,15 +483,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'> @@ -783,15 +797,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'> @@ -807,7 +825,7 @@ const Cart = () => { type='button' className='btn-solid-red flex-1' disabled={selectedProduct().length == 0} - onClick={() => router.push('/shop/checkout')} + onClick={handleCheckout} > Checkout </button> |
