Merge branch 'fix/persist-filter' into 'development'

[FIX/FE] Persist Filter

See merge request mbugroup/lti-web-client!453
This commit is contained in:
Rivaldi A N S
2026-04-30 10:02:56 +00:00
2 changed files with 50 additions and 49 deletions
+25 -15
View File
@@ -1,6 +1,5 @@
'use client'; 'use client';
import axios from 'axios';
import { import {
ChangeEventHandler, ChangeEventHandler,
useCallback, useCallback,
@@ -722,7 +721,7 @@ const ExpensesTable = () => {
}; };
const searchChangeHandler: ChangeEventHandler<HTMLInputElement> = (e) => { const searchChangeHandler: ChangeEventHandler<HTMLInputElement> = (e) => {
updateFilter('search', e.target.value); updateFilter('search', e.target.value, true);
}; };
// ===== FILTER MODAL HANDLERS ===== // ===== FILTER MODAL HANDLERS =====
@@ -741,41 +740,52 @@ const ExpensesTable = () => {
project_flock?: OptionType<number> | null; project_flock?: OptionType<number> | null;
project_flock_kandang?: OptionType<number> | null; project_flock_kandang?: OptionType<number> | null;
}) => { }) => {
updateFilter('transactionDate', values.transaction_date || ''); updateFilter('transactionDate', values.transaction_date || '', true);
updateFilter('realizationDate', values.realization_date || ''); updateFilter('realizationDate', values.realization_date || '', true);
updateFilter( updateFilter(
'locationId', 'locationId',
values.location?.value ? String(values.location?.value) : '' values.location?.value ? String(values.location?.value) : '',
true
); );
updateFilter( updateFilter(
'locationName', 'locationName',
values.location?.label ? String(values.location?.label) : '' values.location?.label ? String(values.location?.label) : '',
true
); );
updateFilter( updateFilter(
'vendorId', 'vendorId',
values.vendor?.value ? String(values.vendor?.value) : '' values.vendor?.value ? String(values.vendor?.value) : '',
true
); );
updateFilter( updateFilter(
'vendorName', 'vendorName',
values.vendor?.label ? String(values.vendor?.label) : '' values.vendor?.label ? String(values.vendor?.label) : '',
true
);
updateFilter('category', values.category?.value || '', true);
updateFilter('approvalStatus', values.approval_status?.value || '', true);
updateFilter(
'realizationStatus',
values.realization_status?.value || '',
true
); );
updateFilter('category', values.category?.value || '');
updateFilter('approvalStatus', values.approval_status?.value || '');
updateFilter('realizationStatus', values.realization_status?.value || '');
updateFilter( updateFilter(
'projectFlockId', 'projectFlockId',
values.project_flock?.value ? String(values.project_flock.value) : '' values.project_flock?.value ? String(values.project_flock.value) : '',
true
); );
updateFilter('projectFlockName', values.project_flock?.label || ''); updateFilter('projectFlockName', values.project_flock?.label || '', true);
updateFilter( updateFilter(
'projectFlockKandangId', 'projectFlockKandangId',
values.project_flock_kandang?.value values.project_flock_kandang?.value
? String(values.project_flock_kandang.value) ? String(values.project_flock_kandang.value)
: '' : '',
true
); );
updateFilter( updateFilter(
'projectFlockKandangName', 'projectFlockKandangName',
values.project_flock_kandang?.label || '' values.project_flock_kandang?.label || '',
true
); );
}; };
@@ -203,40 +203,31 @@ const ExpensesFilterModal = ({
{/* Modal Body */} {/* Modal Body */}
<div className='p-4 flex flex-col gap-1.5'> <div className='p-4 flex flex-col gap-1.5'>
<div className='flex flex-col'> <DateInput
<span className='py-2 text-xs font-semibold'>Tanggal</span> name='transaction_date'
<div className='flex flex-row items-center gap-1.5'> label='Tanggal Transaksi'
<DateInput placeholder='Tanggal Transaksi'
name='transaction_date' value={formik.values.transaction_date || ''}
placeholder='Tanggal Transaksi' onChange={formik.handleChange}
value={formik.values.transaction_date || ''} onBlur={formik.handleBlur}
onChange={formik.handleChange} isError={
onBlur={formik.handleBlur} formik.touched.transaction_date &&
isError={ !!formik.errors.transaction_date
formik.touched.transaction_date && }
!!formik.errors.transaction_date />
}
/> <DateInput
<hr className='w-full max-w-3 h-px border-base-content/10' /> name='realization_date'
<DateInput label='Tanggal Realisasi'
name='realization_date' placeholder='Tanggal Realisasi'
placeholder='Tanggal Realisasi' value={formik.values.realization_date || ''}
value={formik.values.realization_date || ''} onChange={formik.handleChange}
onChange={formik.handleChange} onBlur={formik.handleBlur}
onBlur={formik.handleBlur} isError={
isError={ formik.touched.realization_date &&
formik.touched.realization_date && !!formik.errors.realization_date
!!formik.errors.realization_date }
} />
/>
</div>
{formik.touched.realization_date &&
formik.errors.realization_date && (
<span className='text-xs text-error'>
{formik.errors.realization_date}
</span>
)}
</div>
<SelectInput <SelectInput
label='Lokasi' label='Lokasi'