fix toolbar on transfer type + wallet history
This commit is contained in:
@ -11,7 +11,7 @@
|
|||||||
<div className="flex flex-wrap gap-2 lg:gap-5 w-full">
|
<div className="flex flex-wrap gap-2 lg:gap-5 w-full">
|
||||||
<div className="flex justify-between w-full items-center">
|
<div className="flex justify-between w-full items-center">
|
||||||
<div className="flex w-[50%] gap-3 items-center">
|
<div className="flex w-[50%] gap-3 items-center">
|
||||||
<label className="input input-sm w-1/3">
|
{/* <label className="input input-sm w-1/3">
|
||||||
<KeenIcon icon="magnifier" />
|
<KeenIcon icon="magnifier" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@ -19,7 +19,7 @@
|
|||||||
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
||||||
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-3 items-center">
|
<div className="flex gap-3 items-center">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@ -59,21 +59,28 @@ const ListToolbar = () => {
|
|||||||
const unique = (arr: string[]) => Array.from(new Set(arr));
|
const unique = (arr: string[]) => Array.from(new Set(arr));
|
||||||
const types = unique(transferTypes.map((t) => t.type));
|
const types = unique(transferTypes.map((t) => t.type));
|
||||||
|
|
||||||
|
const handleKeyDown = (event: React.KeyboardEvent) => {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
table.getColumn('name')?.setFilterValue(searchValue);
|
||||||
|
table.setPageIndex(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
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);
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [searchValue]);
|
}, [searchValue, table]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
table.getColumn('type')?.setFilterValue(statusTypes);
|
table.getColumn('type')?.setFilterValue(statusTypes);
|
||||||
}, [statusTypes]);
|
}, [statusTypes, table]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
table.getColumn('status_approval')?.setFilterValue(approval);
|
table.getColumn('status_approval')?.setFilterValue(approval);
|
||||||
}, [approval]);
|
}, [approval, table]);
|
||||||
|
|
||||||
const fetchTransferTypes = async () => {
|
const fetchTransferTypes = async () => {
|
||||||
try {
|
try {
|
||||||
@ -114,16 +121,19 @@ const ListToolbar = () => {
|
|||||||
<div className="flex flex-wrap gap-1 w-full">
|
<div className="flex flex-wrap gap-1 w-full">
|
||||||
<div className="flex justify-between w-full items-center mb-3">
|
<div className="flex justify-between w-full items-center mb-3">
|
||||||
<div className="flex flex-nowrap items-end gap-3 w-full overflow-x-auto">
|
<div className="flex flex-nowrap items-end gap-3 w-full overflow-x-auto">
|
||||||
<div className="w-48 shrink-0">
|
{/* Fixed Search Input dengan icon yang selalu terlihat */}
|
||||||
<label className="input input-sm w-full text-sm">
|
<div className="relative w-48 shrink-0">
|
||||||
|
<div className="absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none ">
|
||||||
<KeenIcon icon="magnifier" />
|
<KeenIcon icon="magnifier" />
|
||||||
<input
|
</div>
|
||||||
type="text"
|
<input
|
||||||
placeholder="Search Name"
|
type="text"
|
||||||
value={searchValue}
|
placeholder="Search Name"
|
||||||
onChange={(e) => setSearchValue(e.target.value)}
|
value={searchValue}
|
||||||
/>
|
onChange={(e) => setSearchValue(e.target.value)}
|
||||||
</label>
|
className="input input-sm w-full pl-9 text-ellipsis overflow-hidden"
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="min-w-[220px] shrink-0">
|
<div className="min-w-[220px] shrink-0">
|
||||||
@ -132,8 +142,8 @@ const ListToolbar = () => {
|
|||||||
value={statusTypes}
|
value={statusTypes}
|
||||||
onValueChange={setStatusTypes}
|
onValueChange={setStatusTypes}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="h-8 text-sm">
|
<SelectTrigger className="h-8">
|
||||||
<SelectValue placeholder="Select Status Transaction Type" />
|
<SelectValue placeholder="Select Status Transaction Type" className="text-ellipsis overflow-hidden" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent className="max-h-64 overflow-y-auto">
|
<SelectContent className="max-h-64 overflow-y-auto">
|
||||||
{types.map((opt) => (
|
{types.map((opt) => (
|
||||||
@ -151,8 +161,8 @@ const ListToolbar = () => {
|
|||||||
value={approval}
|
value={approval}
|
||||||
onValueChange={setApproval}
|
onValueChange={setApproval}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="h-8 text-sm">
|
<SelectTrigger className="h-8">
|
||||||
<SelectValue placeholder="Select Status Approval" />
|
<SelectValue placeholder="Select Status Approval" className="text-ellipsis overflow-hidden" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent className="max-h-64 overflow-y-auto">
|
<SelectContent className="max-h-64 overflow-y-auto">
|
||||||
<SelectItem value="Y" className="truncate">
|
<SelectItem value="Y" className="truncate">
|
||||||
@ -167,7 +177,7 @@ const ListToolbar = () => {
|
|||||||
<DefaultTooltip title={'Reset Filter'} placement={'top'}>
|
<DefaultTooltip title={'Reset Filter'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-7.5 disabled:bg-gray-400"
|
className="h-7.5 disabled:bg-gray-400 shrink-0"
|
||||||
onClick={handleClearFilter}
|
onClick={handleClearFilter}
|
||||||
>
|
>
|
||||||
<KeenIcon icon="arrow-circle-left" />
|
<KeenIcon icon="arrow-circle-left" />
|
||||||
@ -175,7 +185,7 @@ const ListToolbar = () => {
|
|||||||
</DefaultTooltip>
|
</DefaultTooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-2 items-center ml-2 shrink-0">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-8 px-3 text-xs"
|
className="h-8 px-3 text-xs"
|
||||||
@ -196,4 +206,4 @@ const ListToolbar = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ListToolbar;
|
export default ListToolbar;
|
||||||
@ -212,7 +212,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
header: ({ column }) => (
|
header: ({ column }) => (
|
||||||
<DataGridColumnHeader title="Status Transaction Type" column={column} />
|
<DataGridColumnHeader title="Status Transaction Type" column={column} />
|
||||||
),
|
),
|
||||||
enableSorting: true,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: { headerClassName: 'w-[250px]' }
|
meta: { headerClassName: 'w-[250px]' }
|
||||||
},
|
},
|
||||||
@ -241,7 +241,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
header: ({ column }) => (
|
header: ({ column }) => (
|
||||||
<DataGridColumnHeader title="Status Kind" column={column} />
|
<DataGridColumnHeader title="Status Kind" column={column} />
|
||||||
),
|
),
|
||||||
enableSorting: true,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: { headerClassName: 'w-[250px]' }
|
meta: { headerClassName: 'w-[250px]' }
|
||||||
},
|
},
|
||||||
|
|||||||
@ -162,6 +162,7 @@ const ListToolbar = () => {
|
|||||||
placeholder="Search MSISDN"
|
placeholder="Search MSISDN"
|
||||||
value={searchValue}
|
value={searchValue}
|
||||||
onChange={(e) => setSearchValue(e.target.value)}
|
onChange={(e) => setSearchValue(e.target.value)}
|
||||||
|
className="overflow-hidden text-ellipsis w-full"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ const ListToolbar = () => {
|
|||||||
<DefaultTooltip title={'Reset Filter'} placement={'top'}>
|
<DefaultTooltip title={'Reset Filter'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-7.5 disabled:bg-gray-400"
|
className="h-8 disabled:bg-gray-400"
|
||||||
onClick={handleClearAllFilters}
|
onClick={handleClearAllFilters}
|
||||||
>
|
>
|
||||||
<KeenIcon icon="arrow-circle-left" />
|
<KeenIcon icon="arrow-circle-left" />
|
||||||
@ -203,4 +204,4 @@ const ListToolbar = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ListToolbar;
|
export default ListToolbar;
|
||||||
Reference in New Issue
Block a user