fix(FE-51-54): fixing bug and layout form adjustment

This commit is contained in:
randy-ar
2025-10-11 23:26:30 +07:00
parent 1fd4b2aba5
commit f662f2951e
10 changed files with 70 additions and 167 deletions
@@ -41,7 +41,6 @@ const CustomerForm = ({
const [customerFormErrorMessage, setCustomerFormErrorMessage] = useState('');
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
const [picSelectInputValue, setPicSelectInputValue] = useState('');
const [typeSelectInputValue, setTypeSelectInputValue] = useState('');
// Fetch Data
const picUrl = `${UserApi.basePath}?${new URLSearchParams({
@@ -252,7 +251,6 @@ const CustomerForm = ({
}
onChange={typeChangeHandler}
options={typeOptions}
onInputChange={setTypeSelectInputValue}
isError={formik.touched.type && Boolean(formik.errors.type)}
errorMessage={formik.errors.type as string}
isDisabled={formType === 'detail'}
@@ -42,8 +42,6 @@ const SupplierForm = ({
// Setup State
const [supplierFormErrorMessage, setSupplierFormErrorMessage] = useState('');
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
const [typeSelectInputValue, setTypeSelectInputValue] = useState('');
const [categorySelectInputValue, setCategorySelectInputValue] = useState('');
const [hatcheryTagInputValue, setHatcheryTagInputValue] = useState('');
// -- Options data mapping
@@ -108,8 +106,6 @@ const SupplierForm = ({
};
// Memo
console.log('Memo');
console.log(initialValues);
const formikInitialValues = useMemo<SupplierFormValues>(() => {
return {
name: initialValues?.name ?? '',
@@ -125,7 +121,7 @@ const SupplierForm = ({
account_number: initialValues?.account_number ?? '',
due_date: initialValues?.due_date ?? 1,
};
}, [initialValues]);
}, [initialValues, typeOptions, categoryOptions]);
// Formik
const formik = useFormik<SupplierFormValues>({
@@ -260,7 +256,6 @@ const SupplierForm = ({
}
onChange={typeChangeHandler}
options={typeOptions}
onInputChange={setTypeSelectInputValue}
isError={formik.touched.type && Boolean(formik.errors.type)}
errorMessage={formik.errors.type as string}
isDisabled={formType === 'detail'}
@@ -278,7 +273,6 @@ const SupplierForm = ({
}
onChange={categoryChangeHandler}
options={categoryOptions}
onInputChange={setCategorySelectInputValue}
isError={
formik.touched.category && Boolean(formik.errors.category)
}