From dea8af5e7293d5e656a8a70b45b47a458420ed41 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 16 Jun 2023 14:01:58 +0700
Subject: Update cart detail

---
 src/lib/cart/components/Cart.jsx | 48 +++++++++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 18 deletions(-)

(limited to 'src/lib/cart/components/Cart.jsx')

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'>
-                    &nbsp;
-                    {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'>
-                    &nbsp;
-                    {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'>
-- 
cgit v1.2.3

