mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
chore: format code using prettier
This commit is contained in:
@@ -41,7 +41,9 @@ const SupplierForm = ({
|
||||
// Setup State
|
||||
const [supplierFormErrorMessage, setSupplierFormErrorMessage] = useState('');
|
||||
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
|
||||
const [hatcheryOptionsValues, setHatcheryOptionValues] = useState<OptionType[]>([]);
|
||||
const [hatcheryOptionsValues, setHatcheryOptionValues] = useState<
|
||||
OptionType[]
|
||||
>([]);
|
||||
|
||||
// -- Options data mapping
|
||||
const typeOptions = TYPE_OPTIONS;
|
||||
@@ -167,7 +169,7 @@ const SupplierForm = ({
|
||||
// Initialize Formik
|
||||
useEffect(() => {
|
||||
formikSetValues(formikInitialValues);
|
||||
if(formType != 'add'){
|
||||
if (formType != 'add') {
|
||||
const hatcheryArrays = formikInitialValues.hatchery.split(',');
|
||||
const hatcheryCreatedOptions = hatcheryArrays.map((item) => ({
|
||||
value: item,
|
||||
@@ -177,11 +179,13 @@ const SupplierForm = ({
|
||||
}
|
||||
}, [formikSetValues, formikInitialValues, setHatcheryOptionValues]);
|
||||
useEffect(() => {
|
||||
const commaSeparatedValues = hatcheryOptionsValues.map((item) => item.value).join(',');
|
||||
const commaSeparatedValues = hatcheryOptionsValues
|
||||
.map((item) => item.value)
|
||||
.join(',');
|
||||
formikSetValues({
|
||||
...formik.values,
|
||||
hatchery: commaSeparatedValues,
|
||||
})
|
||||
});
|
||||
}, [hatcheryOptionsValues, formikSetValues]);
|
||||
|
||||
// Option Handler
|
||||
@@ -305,7 +309,9 @@ const SupplierForm = ({
|
||||
console.log(val); // pastikan val = array of { value, label }
|
||||
setHatcheryOptionValues(val as OptionType[]);
|
||||
}}
|
||||
isError={formik.touched.hatchery && Boolean(formik.errors.hatchery)}
|
||||
isError={
|
||||
formik.touched.hatchery && Boolean(formik.errors.hatchery)
|
||||
}
|
||||
errorMessage={formik.errors.hatchery as string}
|
||||
isDisabled={formType === 'detail'}
|
||||
isClearable
|
||||
|
||||
Reference in New Issue
Block a user