fix(FE): change hatchery to optional in master data supplier

This commit is contained in:
randy-ar
2025-12-29 13:26:39 +07:00
parent ea7f8a68f4
commit cd42bd6bc0
3 changed files with 9 additions and 10 deletions
@@ -142,7 +142,7 @@ const SupplierForm = ({
pic: values.pic,
type: values.type.value,
category: values.category.value,
hatchery: values.hatchery,
hatchery: values.hatchery ?? '',
phone: values.phone,
email: values.email,
address: values.address,
@@ -171,12 +171,12 @@ const SupplierForm = ({
useEffect(() => {
formikSetValues(formikInitialValues);
if (formType != 'add') {
const hatcheryArrays = formikInitialValues.hatchery.split(',');
const hatcheryCreatedOptions = hatcheryArrays.map((item) => ({
const hatcheryArrays = formikInitialValues.hatchery?.split(',');
const hatcheryCreatedOptions = hatcheryArrays?.map((item) => ({
value: item,
label: item,
}));
setHatcheryOptionValues(hatcheryCreatedOptions);
setHatcheryOptionValues(hatcheryCreatedOptions ?? []);
}
}, [formikSetValues, formikInitialValues, setHatcheryOptionValues]);
useEffect(() => {
@@ -302,7 +302,6 @@ const SupplierForm = ({
<SelectInput
isMulti
createables
required
placeholder='Pilih Hatchery'
label='Hatchery'
value={hatcheryOptionsValues}