update search
This commit is contained in:
@ -1,22 +1,10 @@
|
|||||||
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
||||||
import { useManageNotificationContext } from '../hooks/useManageNotificationContext';
|
import { useManageNotificationContext } from '../hooks/useManageNotificationContext';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import React, { useState } from 'react';
|
|
||||||
|
|
||||||
const ListToolBar = () => {
|
const ListToolBar = () => {
|
||||||
const { table, reload } = useDataGrid();
|
const { table, reload } = useDataGrid();
|
||||||
const { handleAddDialog } = useManageNotificationContext();
|
const { handleAddDialog } = useManageNotificationContext();
|
||||||
const [searchValue, setSearchValue] = useState('');
|
|
||||||
|
|
||||||
const handleKeydown = (event: React.KeyboardEvent) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
handleSearch();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSearch = () => {
|
|
||||||
table.getColumn('content')?.setFilterValue(searchValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
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">
|
||||||
@ -27,13 +15,12 @@ const ListToolBar = () => {
|
|||||||
<KeenIcon icon="magnifier" />
|
<KeenIcon icon="magnifier" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search users"
|
placeholder="Search notifications"
|
||||||
value={searchValue}
|
value={table.getColumn(`content`)?.getFilterValue() as string}
|
||||||
onChange={(event) => setSearchValue(event.target.value)}
|
onChange={(event) => table.getColumn('content')?.setFilterValue(event.target.value)}
|
||||||
onKeyDown={handleKeydown}
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<DefaultTooltip title={'Search'} placement={'top'}>
|
{/* <DefaultTooltip title={'Search'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-7.5 disabled:bg-gray-400"
|
className="h-7.5 disabled:bg-gray-400"
|
||||||
@ -41,7 +28,7 @@ const ListToolBar = () => {
|
|||||||
>
|
>
|
||||||
<KeenIcon icon="magnifier" />
|
<KeenIcon icon="magnifier" />
|
||||||
</Button>
|
</Button>
|
||||||
</DefaultTooltip>
|
</DefaultTooltip> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-3 items-center">
|
<div className="flex gap-3 items-center">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@ -6,17 +6,6 @@ import { useState } from 'react';
|
|||||||
const ListToolBar = () => {
|
const ListToolBar = () => {
|
||||||
const { table, reload } = useDataGrid();
|
const { table, reload } = useDataGrid();
|
||||||
const { handleAddDialog } = useManagePositionContext();
|
const { handleAddDialog } = useManagePositionContext();
|
||||||
const [searchValue, setSearchValue] = useState('');
|
|
||||||
|
|
||||||
const handleSearch = () => {
|
|
||||||
table.getColumn('name')?.setFilterValue(searchValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleKeyDown = (event: React.KeyboardEvent) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
handleSearch();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
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">
|
||||||
@ -28,12 +17,11 @@ const ListToolBar = () => {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search roles"
|
placeholder="Search roles"
|
||||||
value={searchValue}
|
value={table.getColumn(`name`)?.getFilterValue() as string}
|
||||||
onChange={(event) => setSearchValue(event.target.value)}
|
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
||||||
onKeyDown={handleKeyDown}
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<DefaultTooltip title={'Search'} placement={'top'}>
|
{/* <DefaultTooltip title={'Search'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-7.5 disabled:bg-gray-400"
|
className="h-7.5 disabled:bg-gray-400"
|
||||||
@ -41,7 +29,7 @@ const ListToolBar = () => {
|
|||||||
>
|
>
|
||||||
<KeenIcon icon="magnifier" />
|
<KeenIcon icon="magnifier" />
|
||||||
</Button>
|
</Button>
|
||||||
</DefaultTooltip>
|
</DefaultTooltip> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-3 items-center">
|
<div className="flex gap-3 items-center">
|
||||||
|
|||||||
@ -1,22 +1,10 @@
|
|||||||
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
||||||
import { useUserContext } from '../hooks';
|
import { useUserContext } from '../hooks';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import React, { useState } from 'react';
|
|
||||||
|
|
||||||
const ListToolBar = () => {
|
const ListToolBar = () => {
|
||||||
const { table, reload } = useDataGrid();
|
const { table, reload } = useDataGrid();
|
||||||
const { handleAddDialog } = useUserContext();
|
const { handleAddDialog } = useUserContext();
|
||||||
const [searchValue, setSearchValue] = useState('');
|
|
||||||
|
|
||||||
const handleSearch = () => {
|
|
||||||
table.getColumn('username')?.setFilterValue(searchValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleKeyDown = (event: React.KeyboardEvent) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
handleSearch();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
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">
|
||||||
@ -28,12 +16,13 @@ const ListToolBar = () => {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Username"
|
placeholder="Search Username"
|
||||||
value={searchValue}
|
value={table.getColumn(`username`)?.getFilterValue() as string}
|
||||||
onChange={(event) => setSearchValue(event.target.value)}
|
onChange={(event) =>
|
||||||
onKeyDown={handleKeyDown}
|
table.getColumn('username')?.setFilterValue(event.target.value)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<DefaultTooltip title={'Search'} placement={'top'}>
|
{/* <DefaultTooltip title={'Search'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-7.5 disabled:bg-gray-400"
|
className="h-7.5 disabled:bg-gray-400"
|
||||||
@ -41,7 +30,7 @@ const ListToolBar = () => {
|
|||||||
>
|
>
|
||||||
<KeenIcon icon="magnifier" />
|
<KeenIcon icon="magnifier" />
|
||||||
</Button>
|
</Button>
|
||||||
</DefaultTooltip>
|
</DefaultTooltip> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-3 items-center">
|
<div className="flex gap-3 items-center">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user