From bd4cdf2125f717875ba90e03893b319dd962f753 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Sat, 18 Jan 2025 10:37:49 +0700
Subject: bittesip

---
 src/lib/checkout/components/Checkout.jsx | 48 ++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 12 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 99c7b40a..6479881d 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -44,11 +44,11 @@ const { getProductsCheckout } = require('../api/checkoutApi');
 
 function convertToInternational(number) {
   if (typeof number !== 'string') {
-      throw new Error("Input harus berupa string");
+    throw new Error('Input harus berupa string');
   }
 
   if (number.startsWith('08')) {
-      return '+62' + number.slice(2);
+    return '+62' + number.slice(2);
   }
 
   return number;
@@ -151,7 +151,23 @@ const Checkout = () => {
   const [loadingRajaOngkir, setLoadingRajaOngkir] = useState(false);
   const [grandTotal, setGrandTotal] = useState(0);
 
-  const {checkWeigth, setCheckWeight, hasFlashSale, setHasFlashSale, checkoutValidation, setCheckoutValidation, biayaKirim, products, setProducts, etd, unit, selectedCourier, selectedService, listExpedisi, setExpedisi} = useCheckout();
+  const {
+    checkWeigth,
+    setCheckWeight,
+    hasFlashSale,
+    setHasFlashSale,
+    checkoutValidation,
+    setCheckoutValidation,
+    biayaKirim,
+    products,
+    setProducts,
+    etd,
+    unit,
+    selectedCourier,
+    selectedService,
+    listExpedisi,
+    setExpedisi,
+  } = useCheckout();
 
   const expedisiValidation = useRef(null);
 
@@ -279,7 +295,7 @@ const Checkout = () => {
         value: expedisi.id,
         label: expedisi.name,
         carrierId: expedisi.deliveryCarrierId,
-        logo : expedisi.image,
+        logo: expedisi.image,
       }));
       setExpedisi(dataExpedisi);
     };
@@ -291,7 +307,6 @@ const Checkout = () => {
 
     window.onpopstate = handlePopState;
 
-
     return () => {
       window.onpopstate = null;
     };
@@ -416,7 +431,7 @@ const Checkout = () => {
       }
       return;
     }
-    if(!selectedService){
+    if (!selectedService) {
       toast.error('Harap pilih tipe layanan pengiriman');
       return;
     }
@@ -471,10 +486,12 @@ const Checkout = () => {
 
       gtag('set', 'user_data', {
         email: auth.email,
-        phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone),
+        phone_number:
+          convertToInternational(auth.mobile) ??
+          convertToInternational(auth.phone),
       });
 
-      gtag('config', 'AW-954540379', { ' allow_enhanced_conversions':true } ) ;
+      gtag('config', 'AW-954540379', { ' allow_enhanced_conversions': true });
 
       for (const product of products) deleteItemCart({ productId: product.id });
       if (grandTotal > 0) {
@@ -1152,7 +1169,10 @@ const Checkout = () => {
               </div>
               <div className='flex gap-x-2 justify-between'>
                 <div className='text-gray_r-11'>
-                  Biaya Kirim <p className='text-xs mt-1'>{formatShipmentRange(etd, unit)}</p>
+                  Biaya Kirim{' '}
+                  <p className='text-xs mt-1'>
+                    {formatShipmentRange(etd, unit)}
+                  </p>
                 </div>
                 <div>
                   {currencyFormat(
@@ -1458,7 +1478,9 @@ const Checkout = () => {
                     <div className='flex gap-x-2 justify-between'>
                       <div className='text-gray_r-11'>
                         Biaya Kirim
-                        <p className='text-xs mt-1'>{formatShipmentRange(etd, unit)}</p>
+                        <p className='text-xs mt-1'>
+                          {formatShipmentRange(etd, unit)}
+                        </p>
                       </div>
                       <div>
                         {currencyFormat(
@@ -1629,7 +1651,7 @@ const SectionAddress = ({ address, label, url }) => (
         <p className='mt-1 text-gray_r-11'>
           {address.street}, {address?.city?.name}
         </p>
-        <div className='flex gap-x-2 items-center mt-4'>
+        <div className='flex gap-x-2 items-center mt-4 cursor-pointer'>
           <MapPinIcon
             className={
               address.addressMap
@@ -1640,7 +1662,9 @@ const SectionAddress = ({ address, label, url }) => (
           {address.addressMap ? (
             <label>Sudah Pinpoint</label>
           ) : (
-            <label className='text-red-500 '>Belum Pinpoint</label>
+            <Link href={'/my/address/' + address.id + '/edit'} target='_blank' className='cursor-pointer'>
+              <label className='text-red-500 cursor-pointer '>Belum Pinpoint</label>
+            </Link>
           )}
         </div>
       </div>
-- 
cgit v1.2.3

