@@ -534,37 +569,31 @@ const DebtSupplierTab = () => {
{
- setFilterStartDate(e.target.value);
- setFilterErrors((prev) => ({ ...prev, start_date: '' }));
+ formik.setFieldValue('startDate', e.target.value || null);
}}
className={{ wrapper: 'w-full' }}
+ isError={
+ formik.touched.startDate && !!formik.errors.startDate
+ }
+ errorMessage={formik.errors.startDate}
/>
- {filterErrors.start_date && (
-
- {filterErrors.start_date}
-
- )}
{
- setFilterEndDate(e.target.value);
- setFilterErrors((prev) => ({ ...prev, end_date: '' }));
+ formik.setFieldValue('endDate', e.target.value || null);
}}
className={{ wrapper: 'w-full' }}
+ isError={formik.touched.endDate && !!formik.errors.endDate}
+ errorMessage={formik.errors.endDate}
/>
- {filterErrors.end_date && (
-
- {filterErrors.end_date}
-
- )}
@@ -574,15 +603,20 @@ const DebtSupplierTab = () => {
placeholder='Pilih Supplier'
isMulti
options={supplierOptions}
- value={filterSupplier}
+ value={formik.values.supplierIds || []}
onChange={(val) => {
- setFilterSupplier(
- Array.isArray(val) ? val : val ? [val] : []
+ formik.setFieldValue(
+ 'supplierIds',
+ Array.isArray(val) ? val : val ? [val] : null
);
}}
isLoading={isLoadingSuppliers}
isClearable
className={{ wrapper: 'w-full' }}
+ isError={
+ formik.touched.supplierIds && !!formik.errors.supplierIds
+ }
+ errorMessage={formik.errors.supplierIds as string}
/>
@@ -591,12 +625,17 @@ const DebtSupplierTab = () => {
label='Filter Berdasarkan'
placeholder='Pilih Filter Berdasarkan'
options={dataTypeOptions}
- value={filterDateType}
+ value={formik.values.filterBy || null}
onChange={(val) => {
- setFilterDateType(val ? (val as OptionType) : undefined);
+ formik.setFieldValue(
+ 'filterBy',
+ val ? (val as OptionType) : null
+ );
}}
className={{ wrapper: 'w-full' }}
isClearable
+ isError={formik.touched.filterBy && !!formik.errors.filterBy}
+ errorMessage={formik.errors.filterBy as string}
/>