mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
Merge branch 'fix/persist-filter' into 'development'
[FIX/FE] Persist Filter See merge request mbugroup/lti-web-client!453
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import axios from 'axios';
|
||||
import {
|
||||
ChangeEventHandler,
|
||||
useCallback,
|
||||
@@ -722,7 +721,7 @@ const ExpensesTable = () => {
|
||||
};
|
||||
|
||||
const searchChangeHandler: ChangeEventHandler<HTMLInputElement> = (e) => {
|
||||
updateFilter('search', e.target.value);
|
||||
updateFilter('search', e.target.value, true);
|
||||
};
|
||||
|
||||
// ===== FILTER MODAL HANDLERS =====
|
||||
@@ -741,41 +740,52 @@ const ExpensesTable = () => {
|
||||
project_flock?: OptionType<number> | null;
|
||||
project_flock_kandang?: OptionType<number> | null;
|
||||
}) => {
|
||||
updateFilter('transactionDate', values.transaction_date || '');
|
||||
updateFilter('realizationDate', values.realization_date || '');
|
||||
updateFilter('transactionDate', values.transaction_date || '', true);
|
||||
updateFilter('realizationDate', values.realization_date || '', true);
|
||||
updateFilter(
|
||||
'locationId',
|
||||
values.location?.value ? String(values.location?.value) : ''
|
||||
values.location?.value ? String(values.location?.value) : '',
|
||||
true
|
||||
);
|
||||
updateFilter(
|
||||
'locationName',
|
||||
values.location?.label ? String(values.location?.label) : ''
|
||||
values.location?.label ? String(values.location?.label) : '',
|
||||
true
|
||||
);
|
||||
updateFilter(
|
||||
'vendorId',
|
||||
values.vendor?.value ? String(values.vendor?.value) : ''
|
||||
values.vendor?.value ? String(values.vendor?.value) : '',
|
||||
true
|
||||
);
|
||||
updateFilter(
|
||||
'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(
|
||||
'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(
|
||||
'projectFlockKandangId',
|
||||
values.project_flock_kandang?.value
|
||||
? String(values.project_flock_kandang.value)
|
||||
: ''
|
||||
: '',
|
||||
true
|
||||
);
|
||||
updateFilter(
|
||||
'projectFlockKandangName',
|
||||
values.project_flock_kandang?.label || ''
|
||||
values.project_flock_kandang?.label || '',
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -203,40 +203,31 @@ const ExpensesFilterModal = ({
|
||||
|
||||
{/* Modal Body */}
|
||||
<div className='p-4 flex flex-col gap-1.5'>
|
||||
<div className='flex flex-col'>
|
||||
<span className='py-2 text-xs font-semibold'>Tanggal</span>
|
||||
<div className='flex flex-row items-center gap-1.5'>
|
||||
<DateInput
|
||||
name='transaction_date'
|
||||
placeholder='Tanggal Transaksi'
|
||||
value={formik.values.transaction_date || ''}
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur}
|
||||
isError={
|
||||
formik.touched.transaction_date &&
|
||||
!!formik.errors.transaction_date
|
||||
}
|
||||
/>
|
||||
<hr className='w-full max-w-3 h-px border-base-content/10' />
|
||||
<DateInput
|
||||
name='realization_date'
|
||||
placeholder='Tanggal Realisasi'
|
||||
value={formik.values.realization_date || ''}
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur}
|
||||
isError={
|
||||
formik.touched.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>
|
||||
<DateInput
|
||||
name='transaction_date'
|
||||
label='Tanggal Transaksi'
|
||||
placeholder='Tanggal Transaksi'
|
||||
value={formik.values.transaction_date || ''}
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur}
|
||||
isError={
|
||||
formik.touched.transaction_date &&
|
||||
!!formik.errors.transaction_date
|
||||
}
|
||||
/>
|
||||
|
||||
<DateInput
|
||||
name='realization_date'
|
||||
label='Tanggal Realisasi'
|
||||
placeholder='Tanggal Realisasi'
|
||||
value={formik.values.realization_date || ''}
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur}
|
||||
isError={
|
||||
formik.touched.realization_date &&
|
||||
!!formik.errors.realization_date
|
||||
}
|
||||
/>
|
||||
|
||||
<SelectInput
|
||||
label='Lokasi'
|
||||
|
||||
Reference in New Issue
Block a user