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