diff options
Diffstat (limited to 'src/lib/auth/components')
| -rw-r--r-- | src/lib/auth/components/CompanyProfile.jsx | 22 | ||||
| -rw-r--r-- | src/lib/auth/components/SwitchAccount.jsx | 31 |
2 files changed, 27 insertions, 26 deletions
diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index e1a604c2..6065efde 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -16,7 +16,7 @@ const CompanyProfile = () => { const [changeConfirmation, setChangeConfirmation] = useState(false); const [changeType, setChangeType] = useState(false); const [isChecked, setIsChecked] = useState(false); - const [company_type, setCompany_type] = useState('Non PKP'); + const [company_type, setCompany_type] = useState('nonpkp'); const auth = useAuth(); const [isOpen, setIsOpen] = useState(false); const toggle = () => setIsOpen(!isOpen); @@ -61,15 +61,15 @@ const CompanyProfile = () => { const dataProfile = await addressApi({ id: auth.parentId ? auth.parentId : auth.parent_id, }); - setCompany_type(dataProfile.companyType); - setValue('name', dataProfile.name); - setValue('industry', dataProfile.industryId); - setValue('companyType', dataProfile.companyTypeId); - setValue('taxName', dataProfile.taxName); - setValue('npwp', dataProfile.npwp); - setValue('alamat_wajib_pajak', dataProfile.alamatWajibPajak); - setValue('alamat_bisnis', dataProfile.alamatBisnis); - setValue('company_type', dataProfile.companyType); + setCompany_type(dataProfile?.companyType); + setValue('name', dataProfile?.name); + setValue('industry', dataProfile?.industryId); + setValue('companyType', dataProfile?.companyTypeId); + setValue('taxName', dataProfile?.taxName); + setValue('npwp', dataProfile?.npwp); + setValue('alamat_wajib_pajak', dataProfile?.alamatWajibPajak); + setValue('alamat_bisnis', dataProfile?.alamatBisnis); + setValue('company_type', dataProfile?.companyType); }; if (auth) loadProfile(); }, [auth, setValue]); @@ -168,7 +168,7 @@ const CompanyProfile = () => { </div> </BottomPopup> <div className='p-4 flex-row items-center text-left w-full'> - {company_type === 'Non PKP' && ( + {company_type === 'nonpkp' && ( <div className='text-sm mb-2 flex items-center'> <Checkbox borderColor='gray.600' 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> |
