Merge branch 'master' of https://git.shiblysolution.id/TPAY/dashboard
This commit is contained in:
@ -1,10 +1,22 @@
|
|||||||
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { useManageAldeiasContext } from '../hooks/useManageAldeiasContext';
|
import { useManageAldeiasContext } from '../hooks/useManageAldeiasContext';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const ListToolbar = () => {
|
const ListToolbar = () => {
|
||||||
const { table, reload } = useDataGrid();
|
const { table, reload } = useDataGrid();
|
||||||
const { handleAddDialog, handleSearchDialog } = useManageAldeiasContext();
|
const { handleAddDialog, handleSearchDialog } = useManageAldeiasContext();
|
||||||
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
||||||
|
const handleKeyDown = (event: React.KeyboardEvent) => {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
table.getColumn('name')?.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">
|
||||||
@ -16,10 +28,16 @@ const ListToolbar = () => {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Aldeia"
|
placeholder="Search Aldeia"
|
||||||
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
value={searchValue}
|
||||||
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
onChange={(event) => setSearchValue(event.target.value)}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<DefaultTooltip title={'Search'} placement={'top'}>
|
||||||
|
<Button variant="outline" className="h-7.5" onClick={handleSearch}>
|
||||||
|
<KeenIcon icon="magnifier" />
|
||||||
|
</Button>
|
||||||
|
</DefaultTooltip>
|
||||||
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
|||||||
@ -9,6 +9,7 @@ const ListToolbar = () => {
|
|||||||
const { handleAddDialog, handleSearchDialog } = useManageMunicipiosContext();
|
const { handleAddDialog, handleSearchDialog } = useManageMunicipiosContext();
|
||||||
const [searchName, setSearchName] = useState('');
|
const [searchName, setSearchName] = useState('');
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
||||||
const handleFilterData = useCallback(() => {
|
const handleFilterData = useCallback(() => {
|
||||||
try {
|
try {
|
||||||
@ -19,6 +20,16 @@ const ListToolbar = () => {
|
|||||||
}
|
}
|
||||||
}, [searchName, table]);
|
}, [searchName, table]);
|
||||||
|
|
||||||
|
const handleKeyDown = (event: React.KeyboardEvent) => {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
table.getColumn('name')?.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">
|
||||||
<div className="flex flex-wrap gap-2 lg:gap-5 w-full">
|
<div className="flex flex-wrap gap-2 lg:gap-5 w-full">
|
||||||
@ -29,10 +40,16 @@ const ListToolbar = () => {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Municipio"
|
placeholder="Search Municipio"
|
||||||
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
value={searchValue}
|
||||||
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
onChange={(event) => setSearchValue(event.target.value)}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<DefaultTooltip title={'Search'} placement={'top'}>
|
||||||
|
<Button variant="outline" className="h-7.5" onClick={handleSearch}>
|
||||||
|
<KeenIcon icon="magnifier" />
|
||||||
|
</Button>
|
||||||
|
</DefaultTooltip>
|
||||||
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
|||||||
@ -8,7 +8,6 @@ const ListToolbar = () => {
|
|||||||
const { table, reload } = useDataGrid();
|
const { table, reload } = useDataGrid();
|
||||||
const { handleAddDialog, handleSearchDialog } = useManagePostoAdmsContext();
|
const { handleAddDialog, handleSearchDialog } = useManagePostoAdmsContext();
|
||||||
const [searchPosto, setSearchPosto] = useState('');
|
const [searchPosto, setSearchPosto] = useState('');
|
||||||
const [searchMunicipio, setSearchMunicipio] = useState('');
|
|
||||||
|
|
||||||
const handleKeyDown = (event: React.KeyboardEvent) => {
|
const handleKeyDown = (event: React.KeyboardEvent) => {
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
|
|||||||
@ -1,10 +1,22 @@
|
|||||||
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { useManageSucosContext } from '../hooks/useManageSucosContext';
|
import { useManageSucosContext } from '../hooks/useManageSucosContext';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
const ListToolbar = () => {
|
const ListToolbar = () => {
|
||||||
const { table, reload } = useDataGrid();
|
const { table, reload } = useDataGrid();
|
||||||
const { handleAddDialog, handleSearchDialog } = useManageSucosContext();
|
const { handleAddDialog, handleSearchDialog } = useManageSucosContext();
|
||||||
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
||||||
|
const handleKeyDown = (event: React.KeyboardEvent) => {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
table.getColumn('sucos_name')?.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">
|
||||||
@ -16,12 +28,16 @@ const ListToolbar = () => {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Sucos"
|
placeholder="Search Sucos"
|
||||||
value={String(table.getColumn(`sucos_name`)?.getFilterValue() ?? '')}
|
value={searchValue}
|
||||||
onChange={(event) =>
|
onChange={(event) => setSearchValue(event.target.value)}
|
||||||
table.getColumn('sucos_name')?.setFilterValue(event.target.value)
|
onKeyDown={handleKeyDown}
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<DefaultTooltip title={'Search'} placement={'top'}>
|
||||||
|
<Button variant="outline" className="h-7.5" onClick={handleSearch}>
|
||||||
|
<KeenIcon icon="magnifier" />
|
||||||
|
</Button>
|
||||||
|
</DefaultTooltip>
|
||||||
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
|||||||
@ -86,7 +86,7 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode })
|
|||||||
const columns = useMemo<ColumnDef<any>[]>(
|
const columns = useMemo<ColumnDef<any>[]>(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.sucos_name,
|
accessorFn: (row) => row.name,
|
||||||
id: 'sucos_name',
|
id: 'sucos_name',
|
||||||
filterFn: (row, columnId, filterValue) => {
|
filterFn: (row, columnId, filterValue) => {
|
||||||
const value = row.getValue<string>(columnId);
|
const value = row.getValue<string>(columnId);
|
||||||
@ -100,7 +100,7 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode })
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'posto_name',
|
accessorKey: 'posto.name',
|
||||||
id: 'posto_name',
|
id: 'posto_name',
|
||||||
filterFn: (row, columnId, filterValue) => {
|
filterFn: (row, columnId, filterValue) => {
|
||||||
const value = row.getValue<string>(columnId);
|
const value = row.getValue<string>(columnId);
|
||||||
|
|||||||
Reference in New Issue
Block a user