update
This commit is contained in:
@ -269,7 +269,7 @@ const DashboardHomePage = () => {
|
|||||||
|
|
||||||
<div className="flex space-x-4 mt-5">
|
<div className="flex space-x-4 mt-5">
|
||||||
{bankaccount?.data && bankaccount?.data.length > 0
|
{bankaccount?.data && bankaccount?.data.length > 0
|
||||||
&& getAuth()?.statusbalance=='Y'
|
// && getAuth()?.statusbalance=='Y'
|
||||||
? (
|
? (
|
||||||
bankaccount?.data.map((bankaccountdatas: { id_balance:string,amount: string, credit_limit: string, monthly_limit: string; wallet: string; }, index: number) => (
|
bankaccount?.data.map((bankaccountdatas: { id_balance:string,amount: string, credit_limit: string, monthly_limit: string; wallet: string; }, index: number) => (
|
||||||
<BankSaldo
|
<BankSaldo
|
||||||
|
|||||||
@ -3,8 +3,9 @@ import {
|
|||||||
Dialog,
|
Dialog,
|
||||||
DialogBody,
|
DialogBody,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle
|
||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { apiConfig } from '@/config/api.config';
|
import { apiConfig } from '@/config/api.config';
|
||||||
@ -19,24 +20,6 @@ import {
|
|||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { DefaultTooltip, KeenIcon } from '@/components';
|
import { DefaultTooltip, KeenIcon } from '@/components';
|
||||||
|
|
||||||
interface WalletTransaction {
|
|
||||||
ID: string;
|
|
||||||
transaction_code: string;
|
|
||||||
transaction_type: {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
type: string;
|
|
||||||
amount: number;
|
|
||||||
pre_amount: number;
|
|
||||||
post_amount: number;
|
|
||||||
category: string;
|
|
||||||
notes: string;
|
|
||||||
date: string;
|
|
||||||
msisdn_reff?: string;
|
|
||||||
purpose?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ShowDetailWalletDialogProps {
|
interface ShowDetailWalletDialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
@ -58,107 +41,23 @@ const getDefaultDateRange = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
accessorKey: 'transaction_code',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Transaction Code" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
meta: { headerClassName: 'min-w-[120px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'msisdn_reff',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="MSISDN Reffer" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
meta: { headerClassName: 'min-w-[120px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'transaction_type.name',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Transaction Type" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
meta: { headerClassName: 'min-w-[180px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'type',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Type" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
meta: { headerClassName: 'min-w-[80px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'amount',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Amount" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
cell: (info: any) => info.getValue()?.toFixed(2),
|
|
||||||
meta: { headerClassName: 'min-w-[100px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'pre_amount',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Pre Amount" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
cell: (info: any) => info.getValue()?.toFixed(2),
|
|
||||||
meta: { headerClassName: 'min-w-[100px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'post_amount',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Post Amount" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
cell: (info: any) => info.getValue()?.toFixed(2),
|
|
||||||
meta: { headerClassName: 'min-w-[100px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'category',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Category" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
meta: { headerClassName: 'min-w-[80px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'date',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Date" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
cell: (info: any) => {
|
|
||||||
const val = info.getValue();
|
|
||||||
if (!val) return '-';
|
|
||||||
return new Date(val).toLocaleString('id-ID', {
|
|
||||||
day: '2-digit',
|
|
||||||
month: 'short',
|
|
||||||
year: 'numeric',
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
meta: { headerClassName: 'min-w-[150px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'purpose',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Purpose" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
cell: (info: any) => info.getValue() || '-',
|
|
||||||
meta: { headerClassName: 'min-w-[200px]' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: 'notes',
|
|
||||||
header: ({ column }: any) => <DataGridColumnHeader title="Notes" column={column} />,
|
|
||||||
enableSorting: false,
|
|
||||||
cell: (info: any) => info.getValue() || '-',
|
|
||||||
meta: { headerClassName: 'min-w-[200px]' },
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
||||||
open,
|
open,
|
||||||
onClose,
|
onClose,
|
||||||
idbalance,
|
idbalance,
|
||||||
}) => {
|
}) => {
|
||||||
const { GetData } = useCallApi();
|
const { GetData } = useCallApi();
|
||||||
const [data, setData] = useState<WalletTransaction[]>([]);
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
|
||||||
const [dateRange, setDateRange] = useState(getDefaultDateRange());
|
const [dateRange, setDateRange] = useState(getDefaultDateRange());
|
||||||
const [selectedTransferType, setSelectedTransferType] = useState<string | null>(null);
|
const [selectedTransferType, setSelectedTransferType] = useState<string | null>(null);
|
||||||
|
const [transferType, setTransferType] = useState<TransferType[]>([]);
|
||||||
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
|
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const [transferType, setTransferType] = useState<TransferType[]>([]);
|
|
||||||
const [category, setCategory] = useState<string[]>([]);
|
const [category, setCategory] = useState<string[]>([]);
|
||||||
|
const [transaction, setTransaction] = useState<any[]>([]);
|
||||||
|
const [filters, setFilters] = useState<any>({});
|
||||||
|
|
||||||
const fetchTransferType = async () => {
|
const fetchTransferType = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await GetData(`${apiConfig.service_transaction}/transactiontype/list`, {
|
const response = await GetData(`${apiConfig.service_transaction}/transactiontype/list`, {
|
||||||
limit: 100,
|
limit: 100,
|
||||||
@ -171,71 +70,18 @@ const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching transfer types', error);
|
console.error('Error fetching transfer types', error);
|
||||||
}
|
}
|
||||||
};
|
}, [GetData]);
|
||||||
|
|
||||||
const getDetailList = useCallback(
|
useEffect(() => {
|
||||||
async (
|
fetchTransferType();
|
||||||
limit: number,
|
}, [fetchTransferType]);
|
||||||
page: number,
|
|
||||||
with_deleted: boolean,
|
|
||||||
order_field: string,
|
|
||||||
order_direction: string,
|
|
||||||
filter: any
|
|
||||||
): Promise<WalletTransaction[]> => {
|
|
||||||
if (!idbalance) return [];
|
|
||||||
try {
|
|
||||||
const response = await GetData(
|
|
||||||
`${apiConfig.service_wallet}/dashboard/balance/list-balance-detail/${idbalance}`,
|
|
||||||
{
|
|
||||||
limit,
|
|
||||||
page,
|
|
||||||
with_deleted,
|
|
||||||
order_field,
|
|
||||||
order_direction,
|
|
||||||
filter: JSON.stringify(filter),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return response?.data?.list || [];
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching wallet detail:', error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[GetData, idbalance]
|
|
||||||
);
|
|
||||||
|
|
||||||
const fetchData = useCallback(
|
|
||||||
async (params: {
|
|
||||||
pageIndex: number;
|
|
||||||
pageSize: number;
|
|
||||||
sorting: Array<{ id: string; desc: boolean }>;
|
|
||||||
columnFilters: any[];
|
|
||||||
}): Promise<{ data: WalletTransaction[] }> => {
|
|
||||||
// setIsLoading(true);
|
|
||||||
const order_field = params.sorting.length ? params.sorting[0].id : 'date';
|
|
||||||
const order_direction = params.sorting.length && params.sorting[0].desc ? 'DESC' : 'ASC';
|
|
||||||
const result = await getDetailList(
|
|
||||||
params.pageSize,
|
|
||||||
params.pageIndex + 1,
|
|
||||||
false,
|
|
||||||
order_field,
|
|
||||||
order_direction,
|
|
||||||
params.columnFilters
|
|
||||||
);
|
|
||||||
setData(result);
|
|
||||||
setIsLoading(false);
|
|
||||||
return { data: result };
|
|
||||||
},
|
|
||||||
[getDetailList]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Ambil unique category dari data transaksi setelah data di-fetch
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const uniqueCategories = Array.from(
|
const uniqueCategories = Array.from(
|
||||||
new Set(data.map((tx) => tx.category).filter((cat) => !!cat))
|
new Set(transaction.map((tx) => tx.category).filter((cat) => !!cat))
|
||||||
);
|
);
|
||||||
setCategory(uniqueCategories);
|
setCategory(uniqueCategories);
|
||||||
}, [data]);
|
}, [transaction]);
|
||||||
|
|
||||||
const handleTransferTypeChange = (value: string) => {
|
const handleTransferTypeChange = (value: string) => {
|
||||||
setSelectedTransferType(value === 'all' ? null : value);
|
setSelectedTransferType(value === 'all' ? null : value);
|
||||||
@ -250,30 +96,136 @@ const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
|||||||
setSelectedTransferType(null);
|
setSelectedTransferType(null);
|
||||||
setSelectedCategory(null);
|
setSelectedCategory(null);
|
||||||
setSearchValue('');
|
setSearchValue('');
|
||||||
|
setFilters({});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
const handleApplyFilters = () => {
|
||||||
fetchTransferType();
|
const appliedFilters: any = {};
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
if (dateRange.from) appliedFilters.date_from = dateRange.from+" 00:00:00";
|
||||||
if (!open) return;
|
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;
|
||||||
|
|
||||||
const filters = [];
|
setFilters(appliedFilters);
|
||||||
|
};
|
||||||
|
|
||||||
if (dateRange.from) filters.push({ id: 'date', value: { gte: dateRange.from } });
|
|
||||||
if (dateRange.to) filters.push({ id: 'date', value: { lte: dateRange.to } });
|
|
||||||
if (selectedTransferType) filters.push({ id: 'transaction_type.id', value: selectedTransferType });
|
|
||||||
if (selectedCategory) filters.push({ id: 'category', value: selectedCategory });
|
|
||||||
if (searchValue) filters.push({ id: 'transaction_code', value: searchValue });
|
|
||||||
|
|
||||||
fetchData({
|
const columns = [
|
||||||
pageIndex: 0,
|
{
|
||||||
pageSize: 10,
|
accessorKey: 'transaction_code',
|
||||||
sorting: [{ id: 'date', desc: true }],
|
header: ({ column }: any) => <DataGridColumnHeader title="Transaction Code" column={column} />,
|
||||||
columnFilters: filters,
|
enableSorting: false,
|
||||||
});
|
meta: { headerClassName: 'min-w-[120px]' },
|
||||||
}, [dateRange, selectedTransferType, selectedCategory, searchValue, open]);
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'msisdn_reff',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="MSISDN Reffer" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
meta: { headerClassName: 'min-w-[120px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'transaction_type.name',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Transaction Type" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
meta: { headerClassName: 'min-w-[180px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'type',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Type" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
meta: { headerClassName: 'min-w-[80px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'amount',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Amount" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
cell: (info: any) => info.getValue()?.toFixed(2),
|
||||||
|
meta: { headerClassName: 'min-w-[100px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'pre_amount',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Pre Amount" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
cell: (info: any) => info.getValue()?.toFixed(2),
|
||||||
|
meta: { headerClassName: 'min-w-[100px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'post_amount',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Post Amount" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
cell: (info: any) => info.getValue()?.toFixed(2),
|
||||||
|
meta: { headerClassName: 'min-w-[100px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'category',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Category" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
meta: { headerClassName: 'min-w-[80px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'date',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Date" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
cell: (info: any) => {
|
||||||
|
const val = info.getValue();
|
||||||
|
if (!val) return '-';
|
||||||
|
return new Date(val).toLocaleString('id-ID', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: 'short',
|
||||||
|
year: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
meta: { headerClassName: 'min-w-[150px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'purpose',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Purpose" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
cell: (info: any) => info.getValue() || '-',
|
||||||
|
meta: { headerClassName: 'min-w-[200px]' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'notes',
|
||||||
|
header: ({ column }: any) => <DataGridColumnHeader title="Notes" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
cell: (info: any) => info.getValue() || '-',
|
||||||
|
meta: { headerClassName: 'min-w-[200px]' },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const getTransactionLists = useCallback(
|
||||||
|
async (page: number, limit: number, sorting: any, _columnFilters: any) => {
|
||||||
|
// console.log(idbalance);
|
||||||
|
try {
|
||||||
|
const response = await GetData(`${apiConfig.service_wallet}/dashboard/balance/list-balance-detail/${idbalance}`, {
|
||||||
|
limit,
|
||||||
|
page: page + 1,
|
||||||
|
with_deleted: false,
|
||||||
|
order_field: "created_at",
|
||||||
|
order_direction: 'DESC',
|
||||||
|
filter: filters
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log(filters);
|
||||||
|
|
||||||
|
if (!response || !response.data) {
|
||||||
|
console.warn('No data received:', response);
|
||||||
|
return { data: [], totalCount: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
setTransaction(response.data.list);
|
||||||
|
return { data: response.data.list, totalCount: response.data.total_count };
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching transaction', error);
|
||||||
|
return { data: [], totalCount: 0 };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[GetData, idbalance, filters]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onClose}>
|
<Dialog open={open} onOpenChange={onClose}>
|
||||||
@ -281,98 +233,98 @@ const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
|||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Details Wallet Statement</DialogTitle>
|
<DialogTitle>Details Wallet Statement</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
<DialogDescription />
|
||||||
|
|
||||||
<DialogBody>
|
<DialogBody>
|
||||||
<div className="py-4 max-h-[70vh] overflow-y-auto">
|
<div className="flex flex-wrap gap-2 lg:gap-5 w-full mb-4">
|
||||||
{/* <div className="flex flex-wrap gap-2 lg:gap-5 w-full mb-4">
|
<div className="flex flex-wrap gap-3 w-full">
|
||||||
<div className="flex flex-wrap gap-3 w-full">
|
<label className="input input-sm w-full sm:w-[160px]">
|
||||||
<label className="input input-sm w-full sm:w-[160px]">
|
From
|
||||||
From
|
<input
|
||||||
<input
|
type="date"
|
||||||
type="date"
|
value={dateRange.from}
|
||||||
value={dateRange.from}
|
onChange={(e) => setDateRange({ ...dateRange, from: e.target.value })}
|
||||||
onChange={(e) => setDateRange({ ...dateRange, from: e.target.value })}
|
/>
|
||||||
/>
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<label className="input input-sm w-full sm:w-[160px]">
|
<label className="input input-sm w-full sm:w-[160px]">
|
||||||
To
|
To
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
value={dateRange.to}
|
value={dateRange.to}
|
||||||
onChange={(e) => setDateRange({ ...dateRange, to: e.target.value })}
|
onChange={(e) => setDateRange({ ...dateRange, to: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div className="w-full sm:w-[160px]">
|
<div className="w-full sm:w-[160px]">
|
||||||
<Select value={selectedTransferType || 'all'} onValueChange={handleTransferTypeChange}>
|
<Select value={selectedTransferType || 'all'} onValueChange={handleTransferTypeChange}>
|
||||||
<SelectTrigger className="h-[32px]">
|
<SelectTrigger className="h-[32px]">
|
||||||
<SelectValue placeholder="Transaction Type" />
|
<SelectValue placeholder="Transaction Type" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="all">Select Transaction</SelectItem>
|
<SelectItem value="all">Select Transaction</SelectItem>
|
||||||
{transferType.map((transfer) => (
|
{transferType.map((transfer) => (
|
||||||
<SelectItem key={transfer.id} value={transfer.id}>
|
<SelectItem key={transfer.id} value={transfer.id}>
|
||||||
{transfer.name}
|
{transfer.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full sm:w-[160px]">
|
|
||||||
<Select value={selectedCategory ?? ''} onValueChange={handleCategoryChange}>
|
|
||||||
<SelectTrigger className="h-[32px]">
|
|
||||||
<SelectValue placeholder="Select Category" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
{category.length === 0 ? (
|
|
||||||
<div className="text-gray-500 px-4 py-2">No data</div>
|
|
||||||
) : (
|
|
||||||
category.map((cat) => (
|
|
||||||
<SelectItem key={cat} value={cat}>
|
|
||||||
{cat}
|
|
||||||
</SelectItem>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label className="input input-sm w-full sm:w-[160px]">
|
|
||||||
<KeenIcon icon="magnifier" />
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Transaction Code"
|
|
||||||
className="overflow-hidden text-ellipsis w-full"
|
|
||||||
value={searchValue}
|
|
||||||
onChange={(e) => setSearchValue(e.target.value)}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<DefaultTooltip title="Reset Filter" placement="top">
|
|
||||||
<Button variant="outline" className="h-8" onClick={handleClearAllFilters}>
|
|
||||||
<KeenIcon icon="arrow-circle-left" />
|
|
||||||
</Button>
|
|
||||||
</DefaultTooltip>
|
|
||||||
</div>
|
</div>
|
||||||
</div> */}
|
|
||||||
|
|
||||||
|
<div className="w-full sm:w-[160px]">
|
||||||
|
<Select value={selectedCategory ?? ''} onValueChange={handleCategoryChange}>
|
||||||
|
<SelectTrigger className="h-[32px]">
|
||||||
|
<SelectValue placeholder="Select Category" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{category.length === 0 ? (
|
||||||
|
<div className="text-gray-500 px-4 py-2">No data</div>
|
||||||
|
) : (
|
||||||
|
category.map((cat) => (
|
||||||
|
<SelectItem key={cat} value={cat}>
|
||||||
|
{cat}
|
||||||
|
</SelectItem>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label className="input input-sm w-full sm:w-[160px]">
|
||||||
|
<KeenIcon icon="magnifier" />
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Transaction Code"
|
||||||
|
className="overflow-hidden text-ellipsis w-full"
|
||||||
|
value={searchValue}
|
||||||
|
onChange={(e) => setSearchValue(e.target.value)}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<DefaultTooltip title="Reset Filter" placement="top">
|
||||||
|
<Button variant="outline" className="h-8" onClick={handleClearAllFilters}>
|
||||||
|
<KeenIcon icon="arrow-circle-left" />
|
||||||
|
</Button>
|
||||||
|
</DefaultTooltip>
|
||||||
|
|
||||||
|
<Button variant="outline" className="h-8" onClick={handleApplyFilters}>
|
||||||
|
Filter Data
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="py-4 max-h-[70vh] overflow-y-auto">
|
||||||
<DataGridProvider
|
<DataGridProvider
|
||||||
|
key={JSON.stringify(filters)}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={data}
|
|
||||||
pagination={{ size: 10 }}
|
pagination={{ size: 10 }}
|
||||||
toolbar={null}
|
|
||||||
layout={{ card: true }}
|
layout={{ card: true }}
|
||||||
sorting={[{ id: 'date', desc: true }]}
|
sorting={[{ id: 'id', desc: false }]}
|
||||||
serverSide={false}
|
serverSide={true}
|
||||||
onFetchData={async (params) => {
|
onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) =>
|
||||||
return await fetchData({
|
getTransactionLists(pageIndex, pageSize, sorting, columnFilters)
|
||||||
pageIndex: params.pageIndex,
|
}
|
||||||
pageSize: params.pageSize,
|
|
||||||
sorting: params.sorting ?? [],
|
|
||||||
columnFilters: params.columnFilters ?? [],
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
@ -381,4 +333,4 @@ const ShowDetailWalletDialog: React.FC<ShowDetailWalletDialogProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ShowDetailWalletDialog;
|
export default ShowDetailWalletDialog;
|
||||||
|
|||||||
Reference in New Issue
Block a user