From 94a96e371f554c7d87e2a6edbc6bdb7fe9228fd6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 16 Oct 2024 13:19:45 +0700
Subject: <iman> add CR tambahin info jumlah barang ready stock yang bisa di
 pick up

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

(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 4c7e852f..e872b7f6 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -442,6 +442,7 @@ const Checkout = () => {
     const productOrder = products.map((product) => ({
       product_id: product.id,
       quantity: product.quantity,
+      available_quantity: product?.availableQuantity,
     }));
     let data = {
       // partner_shipping_id: auth.partnerId,
-- 
cgit v1.2.3


From 6e7aa296bae3e290785da7ad941c521a685be1e9 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Thu, 14 Nov 2024 10:58:15 +0700
Subject: add google tag ads

---
 src/lib/checkout/components/Checkout.jsx | 26 ++++++++++++++++++++++----
 1 file changed, 22 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 e83e719c..afbf1e6c 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -413,7 +413,12 @@ const Checkout = () => {
       Math.round(parseInt(finalShippingAmt * 1.1) / 1000) * 1000;
     const finalGT = GT < 0 ? 0 : GT;
     setGrandTotal(finalGT);
-  }, [biayaKirim, cartCheckout?.grandTotal, activeVoucher, activeVoucherShipping]);
+  }, [
+    biayaKirim,
+    cartCheckout?.grandTotal,
+    activeVoucher,
+    activeVoucherShipping,
+  ]);
 
   const checkout = async () => {
     const file = poFile.current.files[0];
@@ -484,6 +489,11 @@ const Checkout = () => {
         transaction_id: isCheckouted.id,
       });
 
+      gtag('set', 'user_data', {
+        email: auth.email,
+        phone_number: auth.mobile ?? auth.phone,
+      });
+
       for (const product of products) deleteItemCart({ productId: product.id });
       if (grandTotal > 0) {
         const payment = await axios.post(
@@ -501,7 +511,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(
@@ -1193,7 +1203,11 @@ const Checkout = () => {
                 <div className='text-gray_r-11'>
                   Biaya Kirim <p className='text-xs mt-1'>{etdFix}</p>
                 </div>
-                <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000)}</div>
+                <div>
+                  {currencyFormat(
+                    Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000
+                  )}
+                </div>
               </div>
               {activeVoucherShipping && voucherShippingAmt && (
                 <div className='flex gap-x-2 justify-between'>
@@ -1494,7 +1508,11 @@ const Checkout = () => {
                         Biaya Kirim
                         <p className='text-xs mt-1'>{etdFix}</p>
                       </div>
-                      <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000) }</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


From ab35d72d65501251f579adf210051e2847cad41b Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Mon, 18 Nov 2024 10:59:40 +0700
Subject: CR gtag user_data on page checkout

---
 src/lib/checkout/components/Checkout.jsx | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 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 afbf1e6c..4c5cca62 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -37,6 +37,18 @@ const SELF_PICKUP_ID = 32;
 const { checkoutApi } = require('../api/checkoutApi');
 const { getProductsCheckout } = require('../api/checkoutApi');
 
+function convertToInternational(number) {
+  if (typeof number !== 'string') {
+      throw new Error("Input harus berupa string");
+  }
+
+  if (number.startsWith('08')) {
+      return '+62' + number.slice(2);
+  }
+
+  return number;
+}
+
 const Checkout = () => {
   const router = useRouter();
   const query = router.query.source ?? null;
@@ -491,7 +503,7 @@ const Checkout = () => {
 
       gtag('set', 'user_data', {
         email: auth.email,
-        phone_number: auth.mobile ?? auth.phone,
+        phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone),
       });
 
       for (const product of products) deleteItemCart({ productId: product.id });
-- 
cgit v1.2.3


From bde516b6b39cccfe8ac3248cd7f85592e6298d7a Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Mon, 18 Nov 2024 11:24:56 +0700
Subject: add google tag allow_enhanced_conversions

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

(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 4c5cca62..6fb5cdb4 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -506,6 +506,8 @@ const Checkout = () => {
         phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone),
       });
 
+      gtag('config', 'AW-954540379', { ' allow_enhanced_conversions':true } ) ;
+
       for (const product of products) deleteItemCart({ productId: product.id });
       if (grandTotal > 0) {
         const payment = await axios.post(
-- 
cgit v1.2.3

