diff --git a/src/pages/master/products/blocks/ListToolbar.tsx b/src/pages/master/products/blocks/ListToolbar.tsx
index 92bd362..efb5d3a 100644
--- a/src/pages/master/products/blocks/ListToolbar.tsx
+++ b/src/pages/master/products/blocks/ListToolbar.tsx
@@ -1,10 +1,24 @@
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
import { useManageProductsContext } from '../hooks/useManageProductsContext';
import { Button } from '@/components/ui/button';
+import { useState } from 'react';
const ListToolbar = () => {
const { table, reload } = useDataGrid();
const { handleAddDialog } = useManageProductsContext();
+ const[searchProduct, setSearchProduct] = useState('');
+
+
+ const handleSearch = ()=>{
+ table.getColumn('name')?.setFilterValue(searchProduct);
+ table.setPageIndex(0);
+ }
+
+ const handleKeyDown = (event:React.KeyboardEvent) =>{
+ if(event.key==='Enter'){
+ handleSearch();
+ }
+ }
return (
@@ -16,10 +30,16 @@ const ListToolbar = () => {
table.getColumn('name')?.setFilterValue(event.target.value)}
+ value={ searchProduct}
+ onChange={(event) => setSearchProduct(event.target.value)}
+ onKeyDown={handleKeyDown}
/>
+
+
+
{/*
diff --git a/src/pages/master/products/hooks/ManageProductsContext.tsx b/src/pages/master/products/hooks/ManageProductsContext.tsx
index 236e306..f785421 100644
--- a/src/pages/master/products/hooks/ManageProductsContext.tsx
+++ b/src/pages/master/products/hooks/ManageProductsContext.tsx
@@ -231,7 +231,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
);
},
meta: {
- headerClassName: 'w-[100px]',
+ headerClassName: 'w-[100px] text-center',
cellClassName: 'text-center'
}
}
diff --git a/src/pages/master/profession/blocks/ListToolbar.tsx b/src/pages/master/profession/blocks/ListToolbar.tsx
index 9c04194..0e5b23d 100644
--- a/src/pages/master/profession/blocks/ListToolbar.tsx
+++ b/src/pages/master/profession/blocks/ListToolbar.tsx
@@ -1,10 +1,27 @@
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
import { useManageProfessionContext } from '../hooks/useManageProfessionContext';
import { Button } from '@/components/ui/button';
+import { useState } from 'react';
+import { set } from 'date-fns';
const ListToolbar = () => {
const { reload, table } = useDataGrid();
const { handleAddDialog } = useManageProfessionContext();
+ const [searchProfession, setSearchProfession]= useState('');
+
+ const handleKeyDown = (event: React.KeyboardEvent) =>{
+ if(event.key==='Enter'){
+ handleSearch();
+ }
+ }
+
+ const handleSearch = () =>{
+ table.getColumn('name')?.setFilterValue(searchProfession);
+ table.setPageIndex(0);
+ }
+
+
+
return (
@@ -16,12 +33,18 @@ const ListToolbar = () => {
- table.getColumn('name')?.setFilterValue(event.target.value)
+ setSearchProfession(event.target.value)
}
+ onKeyDown={handleKeyDown}
/>
+
+
+
{/*
}
layout={{ card: true }}
- sorting={[{ id: 'id', desc: false }]}
+ sorting={[{ id: 'name', desc: false }]}
serverSide={true}
onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) =>
getProfessionLists(pageIndex, pageSize, sorting, columnFilters)
diff --git a/src/pages/master/provider/blocks/ListToolbar.tsx b/src/pages/master/provider/blocks/ListToolbar.tsx
index 6915202..b60b23f 100644
--- a/src/pages/master/provider/blocks/ListToolbar.tsx
+++ b/src/pages/master/provider/blocks/ListToolbar.tsx
@@ -1,10 +1,23 @@
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
import { useManageProviderContext } from '../hooks/useManageProviderContext';
import { Button } from '@/components/ui/button';
+import { useState } from 'react';
const ListToolbar = () => {
const { reload, table } = useDataGrid();
const { handleAddDialog } = useManageProviderContext();
+ const [searchProvider, setSearchProvider] = useState('');
+
+ const handleSearch = () =>{
+ table.getColumn('name')?.setFilterValue(searchProvider);
+ table.setPageIndex(0);
+ }
+
+ const handleKeyDown = (event: React.KeyboardEvent)=>{
+ if(event.key === 'Enter'){
+ handleSearch();
+ }
+ }
return (