From 5c36cea8bccd9a9c06f61d82314af398afe0875f Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Tue, 3 Sep 2024 11:01:30 +0700
Subject: fixing feedback pak iwan (point 5)

---
 src/lib/checkout/components/Checkout.jsx | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 54acdf7c..22265734 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -174,7 +174,6 @@ const Checkout = () => {
           }
           return; // Hentikan eksekusi lebih lanjut pada iterasi ini
         }
-
         // Memeriksa apakah subtotal memenuhi syarat minimal pembelian
         if (cartCheckout?.subtotal < addNewLine.minPurchaseAmount) {
           SetSelisihHargaCode(
@@ -191,7 +190,9 @@ const Checkout = () => {
 
         // Tambahkan voucher ke list dan set voucher aktif
         SetListVoucher((prevList) => [addNewLine, ...prevList]);
-        SetActiveVoucher(addNewLine.code);
+        if (addNewLine.canApply) {
+          SetActiveVoucher(addNewLine.code);
+        }
       } else {
         // Mencari voucher dalam listVoucherShippings
         let checkList = listVoucherShippings?.findIndex(
@@ -227,7 +228,9 @@ const Checkout = () => {
 
         // Tambahkan voucher ke list pengiriman dan set voucher aktif pengiriman
         SetListVoucherShipping((prevList) => [addNewLine, ...prevList]);
-        setActiveVoucherShipping(addNewLine.code);
+        if (addNewLine.canApply) {
+          setActiveVoucherShipping(addNewLine.code);
+        }
       }
     });
 
@@ -701,7 +704,9 @@ const Checkout = () => {
 
           {listVoucherShippings && listVoucherShippings?.length > 0 && (
             <div>
-              <h3 className='font-semibold mb-4'>Promo Extra Potongan Ongkir</h3>
+              <h3 className='font-semibold mb-4'>
+                Promo Extra Potongan Ongkir
+              </h3>
               {listVoucherShippings?.map((item) => (
                 <div key={item.id} className='relative'>
                   <div
-- 
cgit v1.2.3


From ab0402c015fc5346eed00267d4e9b10dd77dc823 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Tue, 3 Sep 2024 14:03:05 +0700
Subject: bug fix checout mobile

---
 src/lib/checkout/components/Checkout.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 22265734..f5975a99 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -1241,10 +1241,10 @@ const Checkout = () => {
                     className='object-contain object-center h-6 rounded-md'
                   />
                 </span>
-                {activeVoucher ? (
+                {activeVoucher || activeVoucherShipping ? (
                   <div className=''>
                     <div className='text-left text-sm text-black font-semibold'>
-                      Potongan Senilai {currencyFormat(discountVoucher)}
+                      Potongan Senilai {currencyFormat(totalDiscountVoucher)}
                     </div>
                     <div className='text-left mt-1 text-green-600 text-xs'>
                       Voucher berhasil digunakan
-- 
cgit v1.2.3


From 35850040a2e49d140d5ecf406dc1769e81badbf6 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Tue, 3 Sep 2024 15:02:19 +0700
Subject: add link wa

---
 src/lib/checkout/components/Checkout.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index f5975a99..913bd273 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -1033,7 +1033,7 @@ const Checkout = () => {
             </div>
             <span className='leading-5'>
               Jika mengalami kesulitan dalam melakukan pembelian di website
-              Indoteknik. Hubungi kami disini
+              Indoteknik. <a href={whatsappUrl()}>Hubungi kami disini</a>
             </span>
           </Alert>
         </div>
-- 
cgit v1.2.3


From e07b4470ba487c01e2420a115a285e7fd4a305ce Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Wed, 4 Sep 2024 17:12:44 +0700
Subject: fixing voucher shipping

---
 src/lib/checkout/components/Checkout.jsx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 913bd273..f63ef457 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -410,7 +410,7 @@ const Checkout = () => {
       Math.round(parseInt(finalShippingAmt * 1.1) / 1000) * 1000;
     const finalGT = GT < 0 ? 0 : GT;
     setGrandTotal(finalGT);
-  }, [biayaKirim, cartCheckout?.grandTotal, activeVoucher]);
+  }, [biayaKirim, cartCheckout?.grandTotal, activeVoucher, activeVoucherShipping]);
 
   const checkout = async () => {
     const file = poFile.current.files[0];
@@ -497,7 +497,7 @@ const Checkout = () => {
       }
     }
 
-    const midtrans = async () => {
+   /* const midtrans = async () => {
       for (const product of products) deleteItemCart({ productId: product.id });
       if (grandTotal > 0) {
         const payment = await axios.post(
@@ -513,7 +513,7 @@ const Checkout = () => {
           '-'
         )}`;
       }
-    };
+    };*/
   };
 
   const handlingActivateCode = async () => {
@@ -1189,7 +1189,7 @@ const Checkout = () => {
                 <div className='text-gray_r-11'>
                   Biaya Kirim <p className='text-xs mt-1'>{etdFix}</p>
                 </div>
-                <div>{currencyFormat(biayaKirim)}</div>
+                <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000)}</div>
               </div>
               {activeVoucherShipping && voucherShippingAmt && (
                 <div className='flex gap-x-2 justify-between'>
@@ -1490,7 +1490,7 @@ const Checkout = () => {
                         Biaya Kirim
                         <p className='text-xs mt-1'>{etdFix}</p>
                       </div>
-                      <div>{currencyFormat(biayaKirim)}</div>
+                      <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000) }</div>
                     </div>
                     {activeVoucherShipping && voucherShippingAmt && (
                       <div className='flex gap-x-2 justify-between'>
-- 
cgit v1.2.3

