From ed0d0293f88adf3c5312cb556bc464e330b3672a Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Fri, 26 Apr 2024 09:44:31 +0700
Subject: hide button checkout if is step approval is true

---
 src-migrate/pages/shop/cart/index.tsx | 39 ++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 17 deletions(-)

(limited to 'src-migrate/pages/shop/cart/index.tsx')

diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index 4b4de92b..9866be46 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -16,13 +16,17 @@ import Image from '~/components/ui/image';
 
 const CartPage = () => {
   const auth = getAuth();
+  const [isStepApproval, setIsStepApproval] = React.useState(false);
 
   const { loadCart, cart, summary } = useCartStore();
 
   const useDivvice = useDevice();
 
   useEffect(() => {
-    if (typeof auth === 'object' && !cart) loadCart(auth.id);
+    if (typeof auth === 'object' && !cart) {
+      loadCart(auth.id);
+      setIsStepApproval(auth?.feature?.soApproval);
+    }
   }, [auth, loadCart, cart]);
 
   const hasSelectedPromo = useMemo(() => {
@@ -123,23 +127,24 @@ const CartPage = () => {
                   Quotation
                 </Button>
               </Tooltip>
-
-              <Tooltip
-                label={clsxm({
-                  'Tidak ada item yang dipilih': !hasSelected,
-                  'Terdapat item yang tidak ada harga': hasSelectNoPrice,
-                })}
-              >
-                <Button
-                  colorScheme='red'
-                  w='full'
-                  isDisabled={!hasSelected || hasSelectNoPrice}
-                  as={Link}
-                  href='/shop/checkout'
+              {!isStepApproval && (
+                <Tooltip
+                  label={clsxm({
+                    'Tidak ada item yang dipilih': !hasSelected,
+                    'Terdapat item yang tidak ada harga': hasSelectNoPrice,
+                  })}
                 >
-                  Checkout
-                </Button>
-              </Tooltip>
+                  <Button
+                    colorScheme='red'
+                    w='full'
+                    isDisabled={!hasSelected || hasSelectNoPrice}
+                    as={Link}
+                    href='/shop/checkout'
+                  >
+                    Checkout
+                  </Button>
+                </Tooltip>
+              )}
             </div>
           </div>
         </div>
-- 
cgit v1.2.3


From 145f9edfd32b385771483b9b95a9fa0fa24c2dec Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Fri, 26 Apr 2024 13:57:55 +0700
Subject: css

---
 src-migrate/pages/shop/cart/index.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src-migrate/pages/shop/cart/index.tsx')

diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index 9866be46..e101b5ad 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -110,7 +110,7 @@ const CartPage = () => {
               <CartSummary {...summary} isLoaded={!!cart} />
             )}
 
-            <div className={style['summary-buttons']}>
+            <div className={style['summary-buttons'] + isStepApproval ? '!grid-cols-1 mt-4' : ''}>
               <Tooltip
                 label={
                   hasSelectedPromo &&
-- 
cgit v1.2.3


From 556cbc1e5ea1c1ef0170c9a1b8f470a3d92d888e Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 2 Jul 2024 10:40:06 +0700
Subject: IS SO APPROVAL

---
 src-migrate/pages/shop/cart/index.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src-migrate/pages/shop/cart/index.tsx')

diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index e101b5ad..d89707d2 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -110,7 +110,7 @@ const CartPage = () => {
               <CartSummary {...summary} isLoaded={!!cart} />
             )}
 
-            <div className={style['summary-buttons'] + isStepApproval ? '!grid-cols-1 mt-4' : ''}>
+            <div className={isStepApproval ? style['summary-buttons-step-approval'] : style['summary-buttons']  }>
               <Tooltip
                 label={
                   hasSelectedPromo &&
-- 
cgit v1.2.3

