From 34f33b1cba1e4fbb6faacc151a3b59a1ba221d60 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 10 Sep 2024 16:26:17 +0700
Subject: <iman>add feature switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 144 ++++++++++++++++++++++++++++++
 1 file changed, 144 insertions(+)
 create mode 100644 src/lib/auth/components/SwitchAccount.jsx

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

diff --git a/src/lib/auth/components/SwitchAccount.jsx b/src/lib/auth/components/SwitchAccount.jsx
new file mode 100644
index 00000000..e1249779
--- /dev/null
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -0,0 +1,144 @@
+import useAuth from '@/core/hooks/useAuth';
+import { setAuth } from '@/core/utils/auth';
+import addressApi from '@/lib/address/api/addressApi';
+import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
+import { useEffect, useState } from 'react';
+import { useForm } from 'react-hook-form';
+import { toast } from 'react-hot-toast';
+import editPersonalProfileApi from '../api/editPersonalProfileApi';
+import FormBisnis from '~/modules/register/components/FormBisnis.tsx';
+import RegistrasiBisnis from '~/modules/register/components/RegistrasiBisnis.tsx';
+import { Radio, RadioGroup, Stack, Divider, Button } from '@chakra-ui/react';
+import { useRegisterStore } from '~/modules/register/stores/useRegisterStore.ts';
+const SwitchAccount = () => {
+  const auth = useAuth();
+  const [isOpen, setIsOpen] = useState(true);
+  const toggle = () => setIsOpen(!isOpen);
+  const [isPKP, setIsPKP] = useState(true);
+  const [isTerdaftar, setIsTerdaftar] = useState(false);
+  const [isChecked, setIsChecked] = useState(false);
+  const [selectedValueBisnis, setSelectedValueBisnis] = useState('false');
+  const [selectedValue, setSelectedValue] = useState('PKP');
+  const { register, setValue, handleSubmit } = useForm({
+    defaultValues: {
+      email: '',
+      name: '',
+      phone: '',
+      password: '',
+    },
+  });
+
+  const { form, isCheckedTNC, isValidCaptcha, errors, validate, updateForm } =
+    useRegisterStore();
+  console.log('form', form);
+  useEffect(() => {
+    const loadProfile = async () => {
+      const dataProfile = await addressApi({ id: auth.partnerId });
+      setValue('email', dataProfile?.email);
+      setValue('name', dataProfile?.name);
+      setValue('phone', dataProfile?.phone);
+    };
+    if (auth) loadProfile();
+  }, [auth, setValue]);
+
+  useEffect(() => {
+    if (selectedValue === 'PKP') {
+      updateForm('is_pkp', 'true');
+      validate();
+    } else {
+      updateForm('is_pkp', 'false');
+      validate();
+    }
+  }, [selectedValue]);
+
+  useEffect(() => {
+    if (isTerdaftar) {
+      updateForm('is_terdaftar', 'true');
+      validate();
+    } else {
+      updateForm('is_terdaftar', 'false');
+      validate();
+    }
+  }, [isTerdaftar]);
+
+  const handleChangeBisnis = (value) => {
+    setSelectedValueBisnis(value);
+    if (value === 'true') {
+      validate();
+      setIsTerdaftar(true);
+    } else {
+      validate();
+      setIsTerdaftar(false);
+    }
+  };
+  const handleChange = (value) => {
+    setSelectedValue(value);
+    if (value === 'PKP') {
+      validate();
+      setIsPKP(true);
+    } else {
+      validate();
+      setIsPKP(false);
+      setIsPKP(false);
+    }
+  };
+  return (
+    <>
+      <button
+        type='button'
+        onClick={toggle}
+        className='p-4 flex items-center text-left w-full'
+      >
+        <div className='flex flex-row items-center bg-slate-50'>
+          <div className='flex font-semibold mr-2'>Informasi Bisnis</div>
+          <div className='text-red-500 text-xs'>
+            *Perubahan akun tidak dapat diubah kembali
+          </div>
+        </div>
+        <div className='ml-auto p-2 bg-gray_r-3 rounded'>
+          {!isOpen && <ChevronDownIcon className='w-6' />}
+          {isOpen && <ChevronUpIcon className='w-6' />}
+        </div>
+      </button>
+
+      {isOpen && (
+        <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>
+          <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>
+                <Radio colorScheme='red' value='Non-PKP' className='ml-4'>
+                  Non-PKP
+                </Radio>
+              </Stack>
+            </RadioGroup>
+          </div>
+          <FormBisnis type='bisnis' required={isTerdaftar} isPKP={isPKP} />
+        </div>
+      )}
+    </>
+  );
+};
+
+export default SwitchAccount;
-- 
cgit v1.2.3


From b89d57916ec9d2be3db786a8481a0acc5fd74e2f Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 11:11:38 +0700
Subject: <iman> update tampilan desktop switcj account

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

(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 e1249779..da0ff068 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -134,7 +134,7 @@ const SwitchAccount = () => {
               </Stack>
             </RadioGroup>
           </div>
-          <FormBisnis type='bisnis' required={isTerdaftar} isPKP={isPKP} />
+          <FormBisnis type='profil' required={isTerdaftar} isPKP={isPKP} />
         </div>
       )}
     </>
-- 
cgit v1.2.3


From ab39764b288b4d60923cc8cc6146ccdc1b4bfbac Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 14:01:53 +0700
Subject: <iman> update switch acc

---
 src/lib/auth/components/SwitchAccount.jsx | 49 +++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 3 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 da0ff068..71571bd7 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -2,7 +2,7 @@ import useAuth from '@/core/hooks/useAuth';
 import { setAuth } from '@/core/utils/auth';
 import addressApi from '@/lib/address/api/addressApi';
 import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
-import { useEffect, useState } from 'react';
+import { useEffect, useState, useMemo } from 'react';
 import { useForm } from 'react-hook-form';
 import { toast } from 'react-hot-toast';
 import editPersonalProfileApi from '../api/editPersonalProfileApi';
@@ -10,6 +10,9 @@ import FormBisnis from '~/modules/register/components/FormBisnis.tsx';
 import RegistrasiBisnis from '~/modules/register/components/RegistrasiBisnis.tsx';
 import { Radio, RadioGroup, Stack, Divider, Button } from '@chakra-ui/react';
 import { useRegisterStore } from '~/modules/register/stores/useRegisterStore.ts';
+import { registerUser } from '~/services/auth';
+import { useMutation } from 'react-query';
+import { isValid } from 'zod';
 const SwitchAccount = () => {
   const auth = useAuth();
   const [isOpen, setIsOpen] = useState(true);
@@ -27,10 +30,14 @@ const SwitchAccount = () => {
       password: '',
     },
   });
-
+  const mutation = useMutation({
+    mutationFn: (data) => registerUser(data),
+  });
+  const [notValid, setNotValid] = useState(false);
   const { form, isCheckedTNC, isValidCaptcha, errors, validate, updateForm } =
     useRegisterStore();
   console.log('form', form);
+  const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]);
   useEffect(() => {
     const loadProfile = async () => {
       const dataProfile = await addressApi({ id: auth.partnerId });
@@ -82,6 +89,28 @@ const SwitchAccount = () => {
       setIsPKP(false);
     }
   };
+
+  const onSubmitHandler = async (values) => {
+    let data = values;
+    console.log('data', data);
+    if (!isFormValid) {
+      setNotValid(true);
+      return;
+    } else {
+      setNotValid(false);
+    }
+    // if (!values.password) delete data.password;
+    // const isUpdated = await editPersonalProfileApi({ data });
+
+    // if (isUpdated?.user) {
+    //   setAuth(isUpdated.user);
+    //   setValue('password', '');
+    //   toast.success('Berhasil mengubah profil', { duration: 1500 });
+    //   return;
+    // }
+    // toast.error('Terjadi kesalahan internal');
+  };
+
   return (
     <>
       <button
@@ -134,9 +163,23 @@ const SwitchAccount = () => {
               </Stack>
             </RadioGroup>
           </div>
-          <FormBisnis type='profil' required={isTerdaftar} isPKP={isPKP} />
+          <FormBisnis
+            type='profil'
+            required={isTerdaftar}
+            isPKP={isPKP}
+            chekValid={notValid}
+          />
         </div>
       )}
+      <div className='flex justify-end mb-4'>
+        <button
+          type='submit'
+          onClick={onSubmitHandler}
+          className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6'
+        >
+          {mutation.isLoading ? 'Loading...' : 'Simpan Perubahan'}
+        </button>
+      </div>
     </>
   );
 };
-- 
cgit v1.2.3


From 752e55686dfee0d536f9e4e128336e91681ba794 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 17:07:49 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 37 +++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 12 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 71571bd7..3146a3da 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -5,7 +5,7 @@ import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
 import { useEffect, useState, useMemo } from 'react';
 import { useForm } from 'react-hook-form';
 import { toast } from 'react-hot-toast';
-import editPersonalProfileApi from '../api/editPersonalProfileApi';
+import switchAccountApi from '../api/switchAccountApi';
 import FormBisnis from '~/modules/register/components/FormBisnis.tsx';
 import RegistrasiBisnis from '~/modules/register/components/RegistrasiBisnis.tsx';
 import { Radio, RadioGroup, Stack, Divider, Button } from '@chakra-ui/react';
@@ -68,6 +68,14 @@ const SwitchAccount = () => {
     }
   }, [isTerdaftar]);
 
+  useEffect(() => {
+    updateForm('name', '-');
+    updateForm('email', 'example@mail.com');
+    updateForm('password', 'example@mail.com');
+    updateForm('phone', '081234567890');
+    validate();
+  }, []);
+
   const handleChangeBisnis = (value) => {
     setSelectedValueBisnis(value);
     if (value === 'true') {
@@ -89,26 +97,31 @@ const SwitchAccount = () => {
       setIsPKP(false);
     }
   };
-
+  console.log('auth', auth);
   const onSubmitHandler = async (values) => {
-    let data = values;
+    let data = form;
     console.log('data', data);
     if (!isFormValid) {
+      console.log('masih ada yang belum valid');
       setNotValid(true);
       return;
     } else {
       setNotValid(false);
     }
     // if (!values.password) delete data.password;
-    // const isUpdated = await editPersonalProfileApi({ data });
+    const isUpdated = await switchAccountApi({ data });
+    console.log('isupdate', isUpdated);
 
-    // if (isUpdated?.user) {
-    //   setAuth(isUpdated.user);
-    //   setValue('password', '');
-    //   toast.success('Berhasil mengubah profil', { duration: 1500 });
-    //   return;
-    // }
-    // toast.error('Terjadi kesalahan internal');
+    if (isUpdated.switch === 'Pending') {
+      // setAuth(isUpdated.user);
+      // setValue('password', '');
+      toast.success('Berhasil mengubah akun', { duration: 1500 });
+      setTimeout(() => {
+        window.location.reload();
+      }, 1500);
+      return;
+    }
+    toast.error('Terjadi kesalahan internal');
   };
 
   return (
@@ -171,7 +184,7 @@ const SwitchAccount = () => {
           />
         </div>
       )}
-      <div className='flex justify-end mb-4'>
+      <div className='flex justify-end mb-4 mr-4'>
         <button
           type='submit'
           onClick={onSubmitHandler}
-- 
cgit v1.2.3


From 870bede9df9920b23f2e5cb771ff5ae6448e3ac7 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 18 Sep 2024 15:19:29 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 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 3146a3da..b7b67864 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -182,17 +182,17 @@ const SwitchAccount = () => {
             isPKP={isPKP}
             chekValid={notValid}
           />
+          <div className='flex justify-end mb-4 mr-4'>
+            <button
+              type='submit'
+              onClick={onSubmitHandler}
+              className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6'
+            >
+              {mutation.isLoading ? 'Loading...' : 'Simpan Perubahan'}
+            </button>
+          </div>
         </div>
       )}
-      <div className='flex justify-end mb-4 mr-4'>
-        <button
-          type='submit'
-          onClick={onSubmitHandler}
-          className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6'
-        >
-          {mutation.isLoading ? 'Loading...' : 'Simpan Perubahan'}
-        </button>
-      </div>
     </>
   );
 };
-- 
cgit v1.2.3


From f0f002ff77481db91d264069d09f580d58001a8c Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 23 Sep 2024 13:15:02 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 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 b7b67864..bc9dee36 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -22,6 +22,7 @@ const SwitchAccount = () => {
   const [isChecked, setIsChecked] = useState(false);
   const [selectedValueBisnis, setSelectedValueBisnis] = useState('false');
   const [selectedValue, setSelectedValue] = useState('PKP');
+  const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
   const { register, setValue, handleSubmit } = useForm({
     defaultValues: {
       email: '',
@@ -99,20 +100,22 @@ const SwitchAccount = () => {
   };
   console.log('auth', auth);
   const onSubmitHandler = async (values) => {
-    let data = form;
-    console.log('data', data);
+    // let data = { ...form, id: `${auth.partnerId}` };
+    const data = form;
     if (!isFormValid) {
-      console.log('masih ada yang belum valid');
       setNotValid(true);
+      setButtonSubmitClick(!buttonSubmitClick);
       return;
     } else {
+      setButtonSubmitClick(!buttonSubmitClick);
       setNotValid(false);
     }
     // if (!values.password) delete data.password;
+    console.log('data', data);
     const isUpdated = await switchAccountApi({ data });
     console.log('isupdate', isUpdated);
 
-    if (isUpdated.switch === 'Pending') {
+    if (isUpdated?.switch === 'Pending') {
       // setAuth(isUpdated.user);
       // setValue('password', '');
       toast.success('Berhasil mengubah akun', { duration: 1500 });
@@ -181,6 +184,7 @@ const SwitchAccount = () => {
             required={isTerdaftar}
             isPKP={isPKP}
             chekValid={notValid}
+            buttonSubmitClick={buttonSubmitClick}
           />
           <div className='flex justify-end mb-4 mr-4'>
             <button
-- 
cgit v1.2.3


From f404f9801db1f234ae03ec9c9542ba5d4aa1bf46 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 23 Sep 2024 14:17:52 +0700
Subject: <iman> delete console.log

---
 src/lib/auth/components/SwitchAccount.jsx | 4 ----
 1 file changed, 4 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 bc9dee36..e737ef6a 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -37,7 +37,6 @@ const SwitchAccount = () => {
   const [notValid, setNotValid] = useState(false);
   const { form, isCheckedTNC, isValidCaptcha, errors, validate, updateForm } =
     useRegisterStore();
-  console.log('form', form);
   const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]);
   useEffect(() => {
     const loadProfile = async () => {
@@ -98,7 +97,6 @@ const SwitchAccount = () => {
       setIsPKP(false);
     }
   };
-  console.log('auth', auth);
   const onSubmitHandler = async (values) => {
     // let data = { ...form, id: `${auth.partnerId}` };
     const data = form;
@@ -111,9 +109,7 @@ const SwitchAccount = () => {
       setNotValid(false);
     }
     // if (!values.password) delete data.password;
-    console.log('data', data);
     const isUpdated = await switchAccountApi({ data });
-    console.log('isupdate', isUpdated);
 
     if (isUpdated?.switch === 'Pending') {
       // setAuth(isUpdated.user);
-- 
cgit v1.2.3


From c0a72c10864ee5e70ebfba4718be25eba910ccf0 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 23 Sep 2024 16:13:10 +0700
Subject: <iman> update mobile view

---
 src/lib/auth/components/SwitchAccount.jsx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 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 e737ef6a..18c6076f 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -13,7 +13,9 @@ import { useRegisterStore } from '~/modules/register/stores/useRegisterStore.ts'
 import { registerUser } from '~/services/auth';
 import { useMutation } from 'react-query';
 import { isValid } from 'zod';
+import useDevice from '@/core/hooks/useDevice';
 const SwitchAccount = () => {
+  const { isDesktop, isMobile } = useDevice();
   const auth = useAuth();
   const [isOpen, setIsOpen] = useState(true);
   const toggle = () => setIsOpen(!isOpen);
@@ -130,7 +132,11 @@ const SwitchAccount = () => {
         onClick={toggle}
         className='p-4 flex items-center text-left w-full'
       >
-        <div className='flex flex-row items-center bg-slate-50'>
+        <div
+          className={`flex ${
+            isDesktop ? 'flex-row' : 'flex-col gap-y-2'
+          } items-start justify-start bg-slate-50`}
+        >
           <div className='flex font-semibold mr-2'>Informasi Bisnis</div>
           <div className='text-red-500 text-xs'>
             *Perubahan akun tidak dapat diubah kembali
@@ -176,7 +182,7 @@ const SwitchAccount = () => {
             </RadioGroup>
           </div>
           <FormBisnis
-            type='profil'
+            type={isDesktop ? 'profil' : 'bisnis'}
             required={isTerdaftar}
             isPKP={isPKP}
             chekValid={notValid}
-- 
cgit v1.2.3


From 935066853ab4847fbff605eed21f98ddbb445864 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 26 Sep 2024 17:02:45 +0700
Subject: <iman> update form bisnis

---
 src/lib/auth/components/SwitchAccount.jsx | 32 ++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

(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 18c6076f..ad22da0f 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -69,7 +69,26 @@ const SwitchAccount = () => {
       validate();
     }
   }, [isTerdaftar]);
-
+  useEffect(() => {
+    const loadProfile = async () => {
+      const dataProfile = await addressApi({
+        id: auth.parentId ? auth.parentId : auth.parent_id,
+      });
+      if (dataProfile.companyType === 'Non PKP') {
+        setSelectedValue('PKP');
+      }
+      updateForm('email_partner', dataProfile.email_partner);
+      updateForm('business_name', dataProfile.name);
+      updateForm('industry_id', dataProfile.industryId);
+      updateForm('company_type_id', dataProfile.companyTypeId);
+      updateForm('nama_wajib_pajak', dataProfile.taxName);
+      updateForm('npwp', dataProfile.npwp);
+      updateForm('alamat_wajib_pajak', dataProfile.alamatWajibPajak);
+      updateForm('alamat_bisnis', dataProfile.alamatBisnis);
+      validate();
+    };
+    if (auth) loadProfile();
+  }, [auth, setValue]);
   useEffect(() => {
     updateForm('name', '-');
     updateForm('email', 'example@mail.com');
@@ -125,6 +144,10 @@ const SwitchAccount = () => {
     toast.error('Terjadi kesalahan internal');
   };
 
+  const onSubmitHandlerCancel = async (values) => {
+    window.location.reload();
+  };
+
   return (
     <>
       <button
@@ -189,6 +212,13 @@ const SwitchAccount = () => {
             buttonSubmitClick={buttonSubmitClick}
           />
           <div className='flex justify-end mb-4 mr-4'>
+            <button
+              type='submit'
+              onClick={onSubmitHandlerCancel}
+              className='btn-red w-full sm:w-fit sm:ml-auto mt-6'
+            >
+              {mutation.isLoading ? 'Loading...' : 'Batal'}
+            </button>
             <button
               type='submit'
               onClick={onSubmitHandler}
-- 
cgit v1.2.3


From 11f415a8c9438362078d0eceee37701edbdeaafc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 27 Sep 2024 09:28:14 +0700
Subject: <iman> update fetch data

---
 src/lib/auth/components/SwitchAccount.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 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 ad22da0f..14ad7e8a 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -79,8 +79,8 @@ const SwitchAccount = () => {
       }
       updateForm('email_partner', dataProfile.email_partner);
       updateForm('business_name', dataProfile.name);
-      updateForm('industry_id', dataProfile.industryId);
-      updateForm('company_type_id', dataProfile.companyTypeId);
+      updateForm('industry_id', `${dataProfile.industryId}`);
+      updateForm('company_type_id', `${dataProfile.companyTypeId}`);
       updateForm('nama_wajib_pajak', dataProfile.taxName);
       updateForm('npwp', dataProfile.npwp);
       updateForm('alamat_wajib_pajak', dataProfile.alamatWajibPajak);
-- 
cgit v1.2.3


From 31ef67c8c2c3d80bf0c0cc040e551b4a45c3dedc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 27 Sep 2024 15:36:39 +0700
Subject: <iman> update form bisnis to switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 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 14ad7e8a..fa1d3924 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -74,17 +74,18 @@ const SwitchAccount = () => {
       const dataProfile = await addressApi({
         id: auth.parentId ? auth.parentId : auth.parent_id,
       });
-      if (dataProfile.companyType === 'Non PKP') {
+      console.log('dataProfile', dataProfile);
+      if (dataProfile?.companyType === 'nonpkp') {
         setSelectedValue('PKP');
       }
-      updateForm('email_partner', dataProfile.email_partner);
-      updateForm('business_name', dataProfile.name);
-      updateForm('industry_id', `${dataProfile.industryId}`);
-      updateForm('company_type_id', `${dataProfile.companyTypeId}`);
-      updateForm('nama_wajib_pajak', dataProfile.taxName);
-      updateForm('npwp', dataProfile.npwp);
-      updateForm('alamat_wajib_pajak', dataProfile.alamatWajibPajak);
-      updateForm('alamat_bisnis', dataProfile.alamatBisnis);
+      updateForm('email_partner', dataProfile?.email_partner);
+      updateForm('business_name', dataProfile?.name);
+      updateForm('industry_id', `${dataProfile?.industryId}`);
+      updateForm('company_type_id', `${dataProfile?.companyTypeId}`);
+      updateForm('nama_wajib_pajak', dataProfile?.taxName);
+      updateForm('npwp', dataProfile?.npwp);
+      updateForm('alamat_wajib_pajak', dataProfile?.alamatWajibPajak);
+      updateForm('alamat_bisnis', dataProfile?.alamatBisnis);
       validate();
     };
     if (auth) loadProfile();
@@ -214,17 +215,17 @@ const SwitchAccount = () => {
           <div className='flex justify-end mb-4 mr-4'>
             <button
               type='submit'
-              onClick={onSubmitHandlerCancel}
-              className='btn-red w-full sm:w-fit sm:ml-auto mt-6'
+              onClick={onSubmitHandler}
+              className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6'
             >
-              {mutation.isLoading ? 'Loading...' : 'Batal'}
+              {mutation.isLoading ? 'Loading...' : 'Simpan Perubahan'}
             </button>
             <button
               type='submit'
-              onClick={onSubmitHandler}
-              className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6'
+              onClick={onSubmitHandlerCancel}
+              className='btn-red w-full sm:w-fit sm:ml-auto mt-6'
             >
-              {mutation.isLoading ? 'Loading...' : 'Simpan Perubahan'}
+              {mutation.isLoading ? 'Loading...' : 'Batal'}
             </button>
           </div>
         </div>
-- 
cgit v1.2.3


From 016cbe790dd698ee258f17c8218ef6fdc667ad0d Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 27 Sep 2024 17:00:00 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 114 ++++++++++++++++++------------
 1 file changed, 68 insertions(+), 46 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 fa1d3924..d76d1f0e 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -14,7 +14,8 @@ import { registerUser } from '~/services/auth';
 import { useMutation } from 'react-query';
 import { isValid } from 'zod';
 import useDevice from '@/core/hooks/useDevice';
-const SwitchAccount = () => {
+import BottomPopup from '@/core/components/elements/Popup/BottomPopup';
+const SwitchAccount = ({ company_type }) => {
   const { isDesktop, isMobile } = useDevice();
   const auth = useAuth();
   const [isOpen, setIsOpen] = useState(true);
@@ -25,6 +26,7 @@ const SwitchAccount = () => {
   const [selectedValueBisnis, setSelectedValueBisnis] = useState('false');
   const [selectedValue, setSelectedValue] = useState('PKP');
   const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
+  const [changeConfirmation, setChangeConfirmation] = useState(false);
   const { register, setValue, handleSubmit } = useForm({
     defaultValues: {
       email: '',
@@ -74,7 +76,6 @@ const SwitchAccount = () => {
       const dataProfile = await addressApi({
         id: auth.parentId ? auth.parentId : auth.parent_id,
       });
-      console.log('dataProfile', dataProfile);
       if (dataProfile?.companyType === 'nonpkp') {
         setSelectedValue('PKP');
       }
@@ -120,6 +121,7 @@ const SwitchAccount = () => {
     }
   };
   const onSubmitHandler = async (values) => {
+    setChangeConfirmation(false);
     // let data = { ...form, id: `${auth.partnerId}` };
     const data = form;
     if (!isFormValid) {
@@ -151,11 +153,32 @@ const SwitchAccount = () => {
 
   return (
     <>
-      <button
-        type='button'
-        onClick={toggle}
-        className='p-4 flex items-center text-left w-full'
+      <BottomPopup
+        active={changeConfirmation}
+        close={() => setChangeConfirmation(false)}
+        title='Ubah profil Bisnis'
       >
+        <div className='leading-7 text-gray_r-12/80'>
+          Apakah anda yakin mengubah data bisnis?
+        </div>
+        <div className='flex mt-6 gap-x-4 md:justify-end'>
+          <button
+            className='btn-solid-red flex-1 md:flex-none'
+            type='button'
+            onClick={onSubmitHandler}
+          >
+            Ya, Ubah
+          </button>
+          <button
+            className='btn-light flex-1 md:flex-none'
+            type='button'
+            onClick={() => setChangeConfirmation(false)}
+          >
+            Batal
+          </button>
+        </div>
+      </BottomPopup>
+      <div type='button' className='p-4 flex items-center text-left w-full'>
         <div
           className={`flex ${
             isDesktop ? 'flex-row' : 'flex-col gap-y-2'
@@ -166,32 +189,25 @@ const SwitchAccount = () => {
             *Perubahan akun tidak dapat diubah kembali
           </div>
         </div>
-        <div className='ml-auto p-2 bg-gray_r-3 rounded'>
-          {!isOpen && <ChevronDownIcon className='w-6' />}
-          {isOpen && <ChevronUpIcon className='w-6' />}
-        </div>
-      </button>
+      </div>
 
-      {isOpen && (
-        <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>
+      <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}>
@@ -199,37 +215,43 @@ const SwitchAccount = () => {
                 <Radio colorScheme='red' value='PKP'>
                   PKP
                 </Radio>
-                <Radio colorScheme='red' value='Non-PKP' className='ml-4'>
-                  Non-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'}
-            required={isTerdaftar}
-            isPKP={isPKP}
-            chekValid={notValid}
-            buttonSubmitClick={buttonSubmitClick}
-          />
-          <div className='flex justify-end mb-4 mr-4'>
+        )}
+        <FormBisnis
+          type={isDesktop ? 'profil' : 'bisnis'}
+          required={isTerdaftar}
+          isPKP={isPKP}
+          chekValid={notValid}
+          buttonSubmitClick={buttonSubmitClick}
+        />
+        <div className='flex flex-row justify-end mt-4 '>
+          <div>
             <button
               type='submit'
-              onClick={onSubmitHandler}
-              className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6'
+              onClick={() => setChangeConfirmation(true)}
+              className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6 mr-2'
             >
               {mutation.isLoading ? 'Loading...' : 'Simpan Perubahan'}
             </button>
+          </div>
+          <div>
             <button
               type='submit'
               onClick={onSubmitHandlerCancel}
-              className='btn-red w-full sm:w-fit sm:ml-auto mt-6'
+              className='btn-solid-red w-full sm:w-fit sm:ml-auto mt-6'
             >
               {mutation.isLoading ? 'Loading...' : 'Batal'}
             </button>
           </div>
         </div>
-      )}
+      </div>
     </>
   );
 };
-- 
cgit v1.2.3


From 2b9d3ce422c159f3739d3572d73c088740dccf3e Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 28 Sep 2024 13:31:15 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(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 d76d1f0e..a609d9e7 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -159,7 +159,8 @@ const SwitchAccount = ({ company_type }) => {
         title='Ubah profil Bisnis'
       >
         <div className='leading-7 text-gray_r-12/80'>
-          Apakah anda yakin mengubah data bisnis?
+          Mohon diperhatikan bahwa perubahan data akun bisnis akan mengakibatkan
+          perubahan pada informasi yang tertera di faktur pajak dan invoice.?
         </div>
         <div className='flex mt-6 gap-x-4 md:justify-end'>
           <button
-- 
cgit v1.2.3


From 2dc7f7ae3eb62f9821f8ae1fb87db2e7b9234e1b Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 1 Oct 2024 10:57:08 +0700
Subject: <iman> update logic switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 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 a609d9e7..12d00890 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -233,11 +233,11 @@ const SwitchAccount = ({ company_type }) => {
           buttonSubmitClick={buttonSubmitClick}
         />
         <div className='flex flex-row justify-end mt-4 '>
-          <div>
+          <div className='mr-4'>
             <button
               type='submit'
               onClick={() => setChangeConfirmation(true)}
-              className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6 mr-2'
+              className='btn-yellow w-full sm:w-fit sm:ml-auto mt-6 mr-8 md:mr-4'
             >
               {mutation.isLoading ? 'Loading...' : 'Simpan Perubahan'}
             </button>
-- 
cgit v1.2.3


From 09e45bafb7d4a0522643ee3b188ae18b82fb27bb Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 1 Oct 2024 13:31:45 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 37 +++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 12 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 12d00890..9adcc726 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -39,8 +39,15 @@ const SwitchAccount = ({ company_type }) => {
     mutationFn: (data) => registerUser(data),
   });
   const [notValid, setNotValid] = useState(false);
-  const { form, isCheckedTNC, isValidCaptcha, errors, validate, updateForm } =
-    useRegisterStore();
+  const {
+    form,
+    isCheckedTNC,
+    isValidCaptcha,
+    errors,
+    validate,
+    updateForm,
+    resetForm,
+  } = useRegisterStore();
   const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]);
   useEffect(() => {
     const loadProfile = async () => {
@@ -79,15 +86,17 @@ const SwitchAccount = ({ company_type }) => {
       if (dataProfile?.companyType === 'nonpkp') {
         setSelectedValue('PKP');
       }
-      updateForm('email_partner', dataProfile?.email_partner);
-      updateForm('business_name', dataProfile?.name);
-      updateForm('industry_id', `${dataProfile?.industryId}`);
-      updateForm('company_type_id', `${dataProfile?.companyTypeId}`);
-      updateForm('nama_wajib_pajak', dataProfile?.taxName);
-      updateForm('npwp', dataProfile?.npwp);
-      updateForm('alamat_wajib_pajak', dataProfile?.alamatWajibPajak);
-      updateForm('alamat_bisnis', dataProfile?.alamatBisnis);
-      validate();
+      if (auth?.company) {
+        updateForm('email_partner', dataProfile?.email_partner);
+        updateForm('business_name', dataProfile?.name);
+        updateForm('industry_id', `${dataProfile?.industryId}`);
+        updateForm('company_type_id', `${dataProfile?.companyTypeId}`);
+        updateForm('nama_wajib_pajak', dataProfile?.taxName);
+        updateForm('npwp', dataProfile?.npwp);
+        updateForm('alamat_wajib_pajak', dataProfile?.alamatWajibPajak);
+        updateForm('alamat_bisnis', dataProfile?.alamatBisnis);
+        validate();
+      }
     };
     if (auth) loadProfile();
   }, [auth, setValue]);
@@ -97,9 +106,10 @@ const SwitchAccount = ({ company_type }) => {
     updateForm('password', 'example@mail.com');
     updateForm('phone', '081234567890');
     validate();
-  }, []);
+  }, [buttonSubmitClick, changeConfirmation]);
 
   const handleChangeBisnis = (value) => {
+    resetForm();
     setSelectedValueBisnis(value);
     if (value === 'true') {
       validate();
@@ -121,9 +131,12 @@ const SwitchAccount = ({ company_type }) => {
     }
   };
   const onSubmitHandler = async (values) => {
+    console.log('error', errors);
+    console.log('form', form);
     setChangeConfirmation(false);
     // let data = { ...form, id: `${auth.partnerId}` };
     const data = form;
+    console.log('data', data);
     if (!isFormValid) {
       setNotValid(true);
       setButtonSubmitClick(!buttonSubmitClick);
-- 
cgit v1.2.3


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


From 35c40c565730c80948a226d8de7478e6c3b86478 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 1 Oct 2024 15:01:18 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 5 ++---
 1 file changed, 2 insertions(+), 3 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 640d29cc..e080fc39 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -170,8 +170,7 @@ const SwitchAccount = ({ company_type }) => {
         title='Ubah profil Bisnis'
       >
         <div className='leading-7 text-gray_r-12/80'>
-          Mohon diperhatikan bahwa perubahan data akun bisnis akan mengakibatkan
-          perubahan pada informasi yang tertera di faktur pajak dan invoice.?
+          Anda akan merubah profil bisnis anda?
         </div>
         <div className='flex mt-6 gap-x-4 md:justify-end'>
           <button
@@ -224,7 +223,7 @@ const SwitchAccount = ({ company_type }) => {
         </div>
       </div>
 
-      <div className='px-4 '>
+      <div className='px-4 mb-4'>
         {auth?.company && !(company_type === 'nonpkp') && (
           <>
             <div className='mb-4'>
-- 
cgit v1.2.3


From 082a57a5188c594556ba76ce20182472ca9d0b5e Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 2 Oct 2024 11:47:30 +0700
Subject: <iman> update field sppkp

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

(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 e080fc39..6c1176bf 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -93,6 +93,7 @@ const SwitchAccount = ({ company_type }) => {
         updateForm('company_type_id', `${dataProfile?.companyTypeId}`);
         updateForm('nama_wajib_pajak', dataProfile?.taxName);
         updateForm('npwp', dataProfile?.npwp);
+        updateForm('sppkp', dataProfile?.sppkp);
         updateForm('alamat_wajib_pajak', dataProfile?.alamatWajibPajak);
         updateForm('alamat_bisnis', dataProfile?.alamatBisnis);
         validate();
-- 
cgit v1.2.3


From a32fa70ab3271e94a9c2b9004f872360dcb7d1c5 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 2 Oct 2024 13:21:25 +0700
Subject: <iman> update switch account

---
 src/lib/auth/components/SwitchAccount.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 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 6c1176bf..fd9f04f9 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -225,7 +225,7 @@ const SwitchAccount = ({ company_type }) => {
       </div>
 
       <div className='px-4 mb-4'>
-        {auth?.company && !(company_type === 'nonpkp') && (
+        {!auth?.company && company_type === 'nonpkp' && (
           <>
             <div className='mb-4'>
               <p className='text-black font-bold mb-2'>
@@ -253,7 +253,7 @@ const SwitchAccount = ({ company_type }) => {
                     <Radio colorScheme='red' value='PKP'>
                       PKP
                     </Radio>
-                    {!(company_type === 'nonpkp') && (
+                    {!auth?.company && company_type === 'nonpkp' && (
                       <Radio colorScheme='red' value='Non-PKP' className='ml-4'>
                         Non-PKP
                       </Radio>
-- 
cgit v1.2.3


From 5f3c071f0b18055bccb78407ada60619f43bb9c3 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 2 Oct 2024 13:28:00 +0700
Subject: <iman> update color

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

(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 fd9f04f9..36d1e0b6 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -204,7 +204,7 @@ const SwitchAccount = ({ company_type }) => {
       </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'
+          class='flex items-center p-4 mb-4 text-sm border border-red-500 text-red-800 rounded-lg bg-red-50'
           role='alert'
         >
           <svg
-- 
cgit v1.2.3


From 74130f381d4bf3deae9a158cb761eb5b22b98f50 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 6 Nov 2024 10:48:14 +0700
Subject: <iman> add loading toast

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

(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 36d1e0b6..06a802fc 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -132,6 +132,7 @@ const SwitchAccount = ({ company_type }) => {
     }
   };
   const onSubmitHandler = async (values) => {
+    toast.loading('Mengubah status akun...');
     updateForm('parent_id', `${auth.parentId}`);
     setChangeConfirmation(false);
     // let data = { ...form, id: `${auth.partnerId}` };
-- 
cgit v1.2.3


From b2afb5c847c9983b098a3223fbcfdb666e65c8cb Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 29 Nov 2024 10:03:24 +0700
Subject: <iman> update code

---
 src/lib/auth/components/SwitchAccount.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(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 06a802fc..12bbf4bb 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -172,7 +172,8 @@ const SwitchAccount = ({ company_type }) => {
         title='Ubah profil Bisnis'
       >
         <div className='leading-7 text-gray_r-12/80'>
-          Anda akan merubah profil bisnis anda?
+          Anda yakin akan merubah profil bisnis anda dari INDIVIDU menjadi{' '}
+          {selectedValue}?
         </div>
         <div className='flex mt-6 gap-x-4 md:justify-end'>
           <button
-- 
cgit v1.2.3


From 1fa1a7873aa67cdd9ca211c239276a148cd4cdda Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 24 Dec 2024 09:00:50 +0700
Subject: <iman> get email partner

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

(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 12bbf4bb..46e57348 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -87,7 +87,7 @@ const SwitchAccount = ({ company_type }) => {
         setSelectedValue('PKP');
       }
       if (auth?.company) {
-        updateForm('email_partner', dataProfile?.email_partner);
+        updateForm('email_partner', dataProfile?.email);
         updateForm('business_name', dataProfile?.name);
         updateForm('industry_id', `${dataProfile?.industryId}`);
         updateForm('company_type_id', `${dataProfile?.companyTypeId}`);
-- 
cgit v1.2.3

