summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-09-26 13:35:53 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-09-26 13:35:53 +0700
commit062e2caf344fedf504ad601a88aaab7a3764ec21 (patch)
treec1d3fc4133866e341fe944fa50eb822d8e1f1a8c /src
parent9dc7af1641f06f3c7cffda102febe90c806ffee1 (diff)
<iman> update informasi bisnis logic save field inputan
Diffstat (limited to 'src')
-rw-r--r--src/lib/auth/components/CompanyProfile.jsx23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx
index 7bebb02f..d066cef7 100644
--- a/src/lib/auth/components/CompanyProfile.jsx
+++ b/src/lib/auth/components/CompanyProfile.jsx
@@ -63,6 +63,7 @@ const CompanyProfile = () => {
setValue('npwp', dataProfile.npwp);
setValue('alamat_wajib_pajak', dataProfile.alamatWajibPajak);
setValue('alamat_bisnis', dataProfile.alamatBisnis);
+ setValue('company_type', dataProfile.company_type);
};
if (auth) loadProfile();
}, [auth, setValue]);
@@ -248,12 +249,28 @@ export default CompanyProfile;
const validationSchema = Yup.object().shape({
alamat_bisnis: Yup.string().required('Harus di-isi'),
- alamat_wajib_pajak: Yup.string().required('Harus di-isi'),
- taxName: Yup.string().required('Harus di-isi'),
- npwp: Yup.string().required('Harus di-isi'),
name: Yup.string().required('Harus di-isi'),
industry: Yup.string().required('Harus di-pilih'),
companyType: Yup.string().required('Harus di-pilih'),
+ taxName: Yup.string(),
+ npwp: Yup.string(),
+ alamat_wajib_pajak: Yup.string(),
+ company_type: Yup.string(),
+ taxName: Yup.string().when('company_type', {
+ is: (company_type) => company_type !== 'PKP',
+ then: Yup.string().required('Harus di-isi'),
+ otherwise: Yup.string().notRequired(),
+ }),
+ npwp: Yup.string().when('company_type', {
+ is: (company_type) => company_type !== 'PKP',
+ then: Yup.string().required('Harus di-isi'),
+ otherwise: Yup.string().notRequired(),
+ }),
+ alamat_wajib_pajak: Yup.string().when('company_type', {
+ is: (company_type) => company_type !== 'PKP',
+ then: Yup.string().required('Harus di-isi'),
+ otherwise: Yup.string().notRequired(),
+ }),
});
const defaultValues = {