diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-09-26 17:02:45 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-09-26 17:02:45 +0700 |
| commit | 935066853ab4847fbff605eed21f98ddbb445864 (patch) | |
| tree | ab3228473d120d168ba92433e43fa326617d1c55 /src-migrate | |
| parent | 979b4556ab104767f677d0d5a328f7b414ca3b4c (diff) | |
<iman> update form bisnis
Diffstat (limited to 'src-migrate')
| -rw-r--r-- | src-migrate/modules/register/components/FormBisnis.tsx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx index 6185179f..c88ec735 100644 --- a/src-migrate/modules/register/components/FormBisnis.tsx +++ b/src-migrate/modules/register/components/FormBisnis.tsx @@ -87,16 +87,31 @@ const form: React.FC<FormProps> = ({ label: o.name, })) ); + // setValue('companyType', form.company_type_id); }; loadCompanyTypes(); }, []); useEffect(() => { + if (form.company_type_id) { + console.log('form.company_type_id', form.company_type_id); + setValue('companyType', form.company_type_id); + } + }, [form.company_type_id]); + + useEffect(() => { const selectedCompanyType = companyTypes.find( (company) => company.value === watch('companyType') ); if (selectedCompanyType) { + console.log('selectedCompanyType', selectedCompanyType); updateForm('company_type_id', `${selectedCompanyType?.value}`); + // setCompanyTypes([ + // { + // value: '2', + // label: 'Distributor', + // }, + // ]); validate(); } }, [watch('companyType'), companyTypes]); @@ -122,6 +137,7 @@ const form: React.FC<FormProps> = ({ category: o.category, })) ); + // setValue('industry_id', form.industry_id); }; loadIndustries(); }, []); @@ -582,7 +598,13 @@ const form: React.FC<FormProps> = ({ readOnly={required} ref={npwpRef} placeholder='000.000.000.0-000.000' - value={!required ? formattedNpwp : ''} + value={ + !required + ? formattedNpwp === '' + ? form.npwp + : formattedNpwp + : '' + } maxLength={21} // Set maximum length to 16 characters onChange={(e) => { if (!required) { |
