update filter in showdetailwalletdialog.tsx
This commit is contained in:
@ -102,11 +102,26 @@ const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
||||
const handleApplyFilters = () => {
|
||||
const appliedFilters: any = {};
|
||||
|
||||
if (dateRange.from) appliedFilters.date_from = dateRange.from+" 00:00:00";
|
||||
if (dateRange.to) appliedFilters.date_to = dateRange.to+" 23:59:59";
|
||||
if (selectedTransferType) appliedFilters.transaction_type_id = selectedTransferType;
|
||||
if (selectedCategory) appliedFilters.category = selectedCategory;
|
||||
if (searchValue) appliedFilters.transaction_code = searchValue;
|
||||
if (dateRange.from && dateRange.to) {
|
||||
const fromDate = new Date(`${dateRange.from}T00:00:00Z`);
|
||||
const toDate = new Date(`${dateRange.to}T23:59:59Z`);
|
||||
appliedFilters.date = {
|
||||
from: fromDate.toISOString(),
|
||||
to: toDate.toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
if (selectedTransferType) {
|
||||
appliedFilters.transaction_type_id = selectedTransferType;
|
||||
}
|
||||
|
||||
if (selectedCategory) {
|
||||
appliedFilters.category = selectedCategory;
|
||||
}
|
||||
|
||||
if (searchValue) {
|
||||
appliedFilters.transaction_code = searchValue;
|
||||
}
|
||||
|
||||
setFilters(appliedFilters);
|
||||
};
|
||||
@ -207,7 +222,7 @@ const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
||||
with_deleted: false,
|
||||
order_field: "created_at",
|
||||
order_direction: 'DESC',
|
||||
filter: filters
|
||||
filter: JSON.stringify(filters)
|
||||
});
|
||||
|
||||
// console.log(filters);
|
||||
|
||||
Reference in New Issue
Block a user