diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-23 13:29:30 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-23 13:29:30 +0700 |
| commit | 453f377e42866cc68a03b2fef0a672590dfd68dd (patch) | |
| tree | 6d2cc312feba6c2dc4cca3b10f509c056fd5b374 /src-migrate/modules/register | |
| parent | 15a9e599c1c1dc688f601da12be421ae55f61916 (diff) | |
<iman> update new register
Diffstat (limited to 'src-migrate/modules/register')
| -rw-r--r-- | src-migrate/modules/register/components/FormBisnis.tsx | 12 | ||||
| -rw-r--r-- | src-migrate/modules/register/stores/useRegisterStore.ts | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx index dec1bbf8..42d7aaa3 100644 --- a/src-migrate/modules/register/components/FormBisnis.tsx +++ b/src-migrate/modules/register/components/FormBisnis.tsx @@ -23,7 +23,7 @@ interface Industry { category: string; } -interface CompanyType { +interface company_type_id { value: string; label: string; } @@ -43,7 +43,7 @@ const FormBisnis: React.FC<FormProps> = ({ type, required, isPKP }) => { const [selectedCompanyId, setSelectedCompanyId] = useState<string>(''); const [industries, setIndustries] = useState<Industry[]>([]); - const [companyTypes, setCompanyTypes] = useState<CompanyType[]>([]); + const [companyTypes, setCompanyTypes] = useState<company_type_id[]>([]); const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]); const router = useRouter(); @@ -58,13 +58,13 @@ const FormBisnis: React.FC<FormProps> = ({ type, required, isPKP }) => { }, []); useEffect(() => { - const selectedCompanyType = companyTypes.find(company => company.value === watch('companyType')); + const selectedCompanyType = companyTypes.find(company => company.value === watch('company_type_id')); if (selectedCompanyType) { updateFormBisnis("company_type_id", selectedCompanyType?.value); setSelectedCompanyId(selectedCompanyType?.label) validateFormBisnis(); } - }, [watch('companyType'), companyTypes]); + }, [watch('company_type_id'), companyTypes]); useEffect(() => { const selectedIndustryType = industries.find(industry => industry.value === watch('industry')); @@ -183,11 +183,11 @@ const FormBisnis: React.FC<FormProps> = ({ type, required, isPKP }) => { <div className="flex justify-between items-start gap-2 h-12"> <div className='w-4/5 pr-1'> <Controller - name='companyType' + name='company_type_id' control={control} render={(props) => <HookFormSelect {...props} options={companyTypes} disabled={required} placeholder="Badan Usaha"/>} /> - {!required && !!errors.companyType && <span className="form-msg-danger">{errors.companyType}</span>} + {!required && !!errors.company_type_id && <span className="form-msg-danger">{errors.company_type_id}</span>} </div> <div className="w-[120%]"> <input diff --git a/src-migrate/modules/register/stores/useRegisterStore.ts b/src-migrate/modules/register/stores/useRegisterStore.ts index 7b414ec6..de237b0d 100644 --- a/src-migrate/modules/register/stores/useRegisterStore.ts +++ b/src-migrate/modules/register/stores/useRegisterStore.ts @@ -28,7 +28,7 @@ type Action = { export const useRegisterStore = create<State & Action>((set, get) => ({ form: { business_name: '', - companyType: '', + company_type_id: 0, name: '', email: '', email_partner: '', @@ -37,7 +37,7 @@ export const useRegisterStore = create<State & Action>((set, get) => ({ sppkp_document: '', npwp_document: '', nameWajibPajak: '', - industry: '', + industry: { value: '', label: '' }, badanUsaha: '', jenisUsaha: '', npwp: '', @@ -45,7 +45,7 @@ export const useRegisterStore = create<State & Action>((set, get) => ({ is_pkp: '', }, formBisnis: { - companyType: '', + company_type_id: 0, business_name: '', name: '', nama_wajib_pajak : '', @@ -56,7 +56,7 @@ export const useRegisterStore = create<State & Action>((set, get) => ({ sppkp_document: '', npwp_document: '', nameWajibPajak: '', - industry: '', + industry: { value: '', label: '' }, badanUsaha: '', jenisUsaha: '', npwp: '', |
