From 31ef67c8c2c3d80bf0c0cc040e551b4a45c3dedc Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 27 Sep 2024 15:36:39 +0700 Subject: update form bisnis to switch account --- src/lib/auth/components/CompanyProfile.jsx | 22 ++++++++++----------- src/lib/auth/components/SwitchAccount.jsx | 31 +++++++++++++++--------------- 2 files changed, 27 insertions(+), 26 deletions(-) (limited to 'src/lib/auth/components') 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 = () => {
- {company_type === 'Non PKP' && ( + {company_type === 'nonpkp' && (
{ 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 = () => {
-- cgit v1.2.3