summaryrefslogtreecommitdiff
path: root/src-migrate/modules/register/components/FormBisnis.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/modules/register/components/FormBisnis.tsx')
-rw-r--r--src-migrate/modules/register/components/FormBisnis.tsx39
1 files changed, 27 insertions, 12 deletions
diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index b58f2fec..f969efdf 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -23,13 +23,14 @@ interface industry_id {
category: string;
}
-interface company_type_id {
+interface companyType {
value: string;
label: string;
}
const FormBisnis: React.FC<FormProps> = ({ type, required, isPKP }) => {
const {
+ form,
formBisnis,
isCheckedTNC,
isValidCaptcha,
@@ -43,7 +44,7 @@ const FormBisnis: React.FC<FormProps> = ({ type, required, isPKP }) => {
const [selectedCompanyId, setSelectedCompanyId] = useState<string>('');
const [industries, setIndustries] = useState<industry_id[]>([]);
- const [companyTypes, setCompanyTypes] = useState<company_type_id[]>([]);
+ const [companyTypes, setCompanyTypes] = useState<companyType[]>([]);
const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]);
const router = useRouter();
@@ -58,19 +59,19 @@ const FormBisnis: React.FC<FormProps> = ({ type, required, isPKP }) => {
}, []);
useEffect(() => {
- const selectedCompanyType = companyTypes.find(company => company.value === watch('company_type_id'));
+ const selectedCompanyType = companyTypes.find(company => company.value === watch('companyType'));
if (selectedCompanyType) {
- updateFormBisnis("company_type_id", selectedCompanyType?.value);
+ updateFormBisnis("company_type_id", `${selectedCompanyType?.value}`);
setSelectedCompanyId(selectedCompanyType?.label)
validateFormBisnis();
}
- }, [watch('company_type_id'), companyTypes]);
+ }, [watch('companyType'), companyTypes]);
useEffect(() => {
const selectedIndustryType = industries.find(industry => industry.value === watch('industry_id'));
if (selectedIndustryType) {
- updateFormBisnis("industry_id", selectedIndustryType?.value);
- setSelectedCategory(selectedIndustryType.label);
+ updateFormBisnis("industry_id", `${selectedIndustryType?.value}`);
+ setSelectedCategory(selectedIndustryType.category);
validateFormBisnis();
}
}, [watch('industry_id'), industries]);
@@ -85,15 +86,29 @@ const FormBisnis: React.FC<FormProps> = ({ type, required, isPKP }) => {
const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {
const { name, value } = event.target;
+ updateFormBisnis('type_acc',`business`)
+ updateFormBisnis('is_pkp',`${isPKP}`)
updateFormBisnis(name, value);
- updateFormBisnis('name','iman');
- updateFormBisnis('email','it@fixcomart.co.id');
- updateFormBisnis('password','Fixcomart378');
- updateFormBisnis('phone','082339129611');
+ updateFormBisnis('name',form.name);
+ updateFormBisnis('email',form.email);
+ updateFormBisnis('password',form.password);
+ updateFormBisnis('phone',form.phone);
validateFormBisnis();
};
const handleFileChange = async (event: ChangeEvent<HTMLInputElement>) => {
+ // const file = poFile.current.files[0];
+ // const name = poNumber.current.value;
+ // if (typeof file === 'undefined' || !name) {
+ // toast.error('Nomor dan Dokumen PO harus diisi');
+ // return;
+ // }
+ // if (file.size > 5000000) {
+ // toast.error('Maksimal ukuran file adalah 5MB');
+ // return;
+ // }
+ // const data = { name, file: await getFileBase64(file) };
+
let fileBase64 = '';
const { name} = event.target;
const file = event.target.files?.[0];
@@ -183,7 +198,7 @@ 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='company_type_id'
+ name='companyType'
control={control}
render={(props) => <HookFormSelect {...props} options={companyTypes} disabled={required} placeholder="Badan Usaha"/>}
/>