fixing filter on tranfer type
This commit is contained in:
@ -39,10 +39,31 @@ const ListToolbar = () => {
|
|||||||
const types = unique(transferTypes.map((t) => t.type));
|
const types = unique(transferTypes.map((t) => t.type));
|
||||||
const origins = unique(transferTypes.map((t) => t.wallet_origin.name));
|
const origins = unique(transferTypes.map((t) => t.wallet_origin.name));
|
||||||
const destinations = unique(transferTypes.map((t) => t.wallet_destination.name));
|
const destinations = unique(transferTypes.map((t) => t.wallet_destination.name));
|
||||||
|
const typeLabelMap: Record<string, string> = {
|
||||||
|
D: 'Disbursement',
|
||||||
|
O: 'Other',
|
||||||
|
CA: 'Change Group Emoney Customer to Agent',
|
||||||
|
AC: 'Change Group Emoney Agent to Customer',
|
||||||
|
PC: 'Change Group Point Agent to Customer',
|
||||||
|
PA: 'Change Group Point Customer to Agent',
|
||||||
|
CE: 'Return Customer Emoney',
|
||||||
|
AD: 'Return Agent Deposit',
|
||||||
|
AM: 'Return Agent Merchant',
|
||||||
|
AE: 'Return Agent Emoney',
|
||||||
|
R: 'Reward Point',
|
||||||
|
TE: 'Top Up Escrow',
|
||||||
|
TM: 'Top Up Master Agent',
|
||||||
|
TA: 'Top Up Agent',
|
||||||
|
PL: 'Purchase Loja',
|
||||||
|
DE: 'Disbursment Escrow',
|
||||||
|
DM: 'Disbursment Master Agent',
|
||||||
|
DA: 'Disbursment Agent',
|
||||||
|
WI: 'Withdraw Merchant',
|
||||||
|
IC: 'Income Merchant'
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
|
|
||||||
table.getColumn('name')?.setFilterValue(searchValue);
|
table.getColumn('name')?.setFilterValue(searchValue);
|
||||||
table.setPageIndex(0);
|
table.setPageIndex(0);
|
||||||
}, 200);
|
}, 200);
|
||||||
@ -106,7 +127,8 @@ const ListToolbar = () => {
|
|||||||
placeholder: string,
|
placeholder: string,
|
||||||
value: string,
|
value: string,
|
||||||
onChange: (val: string) => void,
|
onChange: (val: string) => void,
|
||||||
options: string[]
|
options: string[],
|
||||||
|
labelMap?: Record<string, string>
|
||||||
) => (
|
) => (
|
||||||
<div className="min-w-[220px]">
|
<div className="min-w-[220px]">
|
||||||
<Select value={value === '' ? undefined : value} onValueChange={onChange}>
|
<Select value={value === '' ? undefined : value} onValueChange={onChange}>
|
||||||
@ -116,13 +138,14 @@ const ListToolbar = () => {
|
|||||||
<SelectContent>
|
<SelectContent>
|
||||||
{options.map((opt) => (
|
{options.map((opt) => (
|
||||||
<SelectItem key={opt} value={opt}>
|
<SelectItem key={opt} value={opt}>
|
||||||
{opt}
|
{labelMap?.[opt] ?? opt}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card-header flex-wrap gap-2 border-b-0 px-5">
|
<div className="card-header flex-wrap gap-2 border-b-0 px-5">
|
||||||
@ -161,7 +184,13 @@ const ListToolbar = () => {
|
|||||||
|
|
||||||
{/* Filter bar */}
|
{/* Filter bar */}
|
||||||
<div className="flex flex-wrap gap-2 w-full">
|
<div className="flex flex-wrap gap-2 w-full">
|
||||||
{renderSelect('Select Status Transaction Type', statusTypes, setStatusTypes, types)}
|
{renderSelect(
|
||||||
|
'Select Status Transaction Type',
|
||||||
|
statusTypes,
|
||||||
|
setStatusTypes,
|
||||||
|
types,
|
||||||
|
typeLabelMap
|
||||||
|
)}
|
||||||
{renderSelect('Select Status Approval', approval, setApproval, ['Y', 'N'])}
|
{renderSelect('Select Status Approval', approval, setApproval, ['Y', 'N'])}
|
||||||
{/* {renderSelect('Select Origin Wallet', walletOrigins, setWalletOrigin, origins)}
|
{/* {renderSelect('Select Origin Wallet', walletOrigins, setWalletOrigin, origins)}
|
||||||
{renderSelect(
|
{renderSelect(
|
||||||
|
|||||||
Reference in New Issue
Block a user