From 8f9be149cd5134a9e03d761f3e0e06361375bac4 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 1 Oct 2024 14:29:20 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 96 ++++++++++++++++++++-----------
 1 file changed, 61 insertions(+), 35 deletions(-)

(limited to 'src/lib/auth/components/SwitchAccount.jsx')

diff --git a/src/lib/auth/components/SwitchAccount.jsx b/src/lib/auth/components/SwitchAccount.jsx
index 9adcc726..640d29cc 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -131,12 +131,10 @@ const SwitchAccount = ({ company_type }) => {
     }
   };
   const onSubmitHandler = async (values) => {
-    console.log('error', errors);
-    console.log('form', form);
+    updateForm('parent_id', `${auth.parentId}`);
     setChangeConfirmation(false);
     // let data = { ...form, id: `${auth.partnerId}` };
     const data = form;
-    console.log('data', data);
     if (!isFormValid) {
       setNotValid(true);
       setButtonSubmitClick(!buttonSubmitClick);
@@ -192,7 +190,7 @@ const SwitchAccount = ({ company_type }) => {
           </button>
         </div>
       </BottomPopup>
-      <div type='button' className='p-4 flex items-center text-left w-full'>
+      {/* <div type='button' className='ml-4 flex items-center text-left w-full'>
         <div
           className={`flex ${
             isDesktop ? 'flex-row' : 'flex-col gap-y-2'
@@ -203,40 +201,68 @@ const SwitchAccount = ({ company_type }) => {
             *Perubahan akun tidak dapat diubah kembali
           </div>
         </div>
+      </div> */}
+      <div className='px-4 '>
+        <div
+          class='flex items-center p-4 mb-4 text-sm border border-yellow-500 text-yellow-800 rounded-lg bg-yellow-50'
+          role='alert'
+        >
+          <svg
+            class='flex-shrink-0 inline w-4 h-4 mr-3'
+            aria-hidden='true'
+            fill='currentColor'
+            viewBox='0 0 20 20'
+          >
+            <path d='M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z' />
+          </svg>
+          <span class='sr-only'>Info</span>
+          <div className='text-justify'>
+            Mohon diperhatikan bahwa perubahan data akun bisnis akan
+            mengakibatkan perubahan pada informasi yang tertera di faktur pajak
+            dan invoice.
+          </div>
+        </div>
       </div>
 
-      <div className='p-4 '>
-        <div>
-          <p className='text-black font-bold mb-2'>
-            Bisnis Terdaftar di Indoteknik?
-          </p>
-          <RadioGroup onChange={handleChangeBisnis} value={selectedValueBisnis}>
-            <Stack direction='row'>
-              <Radio colorScheme='red' value='true'>
-                Sudah Terdaftar
-              </Radio>
-              <Radio colorScheme='red' value='false' className='ml-2'>
-                Belum Terdaftar
-              </Radio>
-            </Stack>
-          </RadioGroup>
-        </div>
-        {!isTerdaftar && (
-          <div className='mt-4'>
-            <p className='text-black font-bold mb-2'>Tipe Bisnis</p>
-            <RadioGroup onChange={handleChange} value={selectedValue}>
-              <Stack direction='row' className='font-bold'>
-                <Radio colorScheme='red' value='PKP'>
-                  PKP
-                </Radio>
-                {!(company_type === 'nonpkp') && (
-                  <Radio colorScheme='red' value='Non-PKP' className='ml-4'>
-                    Non-PKP
+      <div className='px-4 '>
+        {auth?.company && !(company_type === 'nonpkp') && (
+          <>
+            <div className='mb-4'>
+              <p className='text-black font-bold mb-2'>
+                Bisnis Terdaftar di Indoteknik?
+              </p>
+              <RadioGroup
+                onChange={handleChangeBisnis}
+                value={selectedValueBisnis}
+              >
+                <Stack direction='row'>
+                  <Radio colorScheme='red' value='true'>
+                    Sudah Terdaftar
                   </Radio>
-                )}
-              </Stack>
-            </RadioGroup>
-          </div>
+                  <Radio colorScheme='red' value='false' className='ml-2'>
+                    Belum Terdaftar
+                  </Radio>
+                </Stack>
+              </RadioGroup>
+            </div>
+            {!isTerdaftar && (
+              <div className=''>
+                <p className='text-black font-bold mb-2'>Tipe Bisnis</p>
+                <RadioGroup onChange={handleChange} value={selectedValue}>
+                  <Stack direction='row' className='font-bold'>
+                    <Radio colorScheme='red' value='PKP'>
+                      PKP
+                    </Radio>
+                    {!(company_type === 'nonpkp') && (
+                      <Radio colorScheme='red' value='Non-PKP' className='ml-4'>
+                        Non-PKP
+                      </Radio>
+                    )}
+                  </Stack>
+                </RadioGroup>
+              </div>
+            )}
+          </>
         )}
         <FormBisnis
           type={isDesktop ? 'profil' : 'bisnis'}
-- 
cgit v1.2.3

