fix search filter manage products

This commit is contained in:
Wikzyy
2025-04-07 17:43:33 +07:00
parent c274809e56
commit c171716ee7

View File

@ -73,7 +73,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
const columns = useMemo<ColumnDef<any>[]>( const columns = useMemo<ColumnDef<any>[]>(
() => [ () => [
{ {
accessorFn: (row) => row.products_name, accessorFn: (row) => row.name,
id: 'name', id: 'name',
header: ({ column }) => <DataGridColumnHeader title="Name" column={column} />, header: ({ column }) => <DataGridColumnHeader title="Name" column={column} />,
enableSorting: true, enableSorting: true,
@ -83,7 +83,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
} }
}, },
{ {
accessorFn: (row) => row.products_description, accessorFn: (row) => row.description,
id: 'description', id: 'description',
header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />, header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />,
enableSorting: true, enableSorting: true,
@ -93,7 +93,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
} }
}, },
{ {
accessorFn: (row) => row.products_price_point, accessorFn: (row) => row.price_point,
id: 'price_point', id: 'price_point',
header: ({ column }) => <DataGridColumnHeader title="Price Point" column={column} />, header: ({ column }) => <DataGridColumnHeader title="Price Point" column={column} />,
enableSorting: true, enableSorting: true,
@ -103,7 +103,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
} }
}, },
{ {
accessorFn: (row) => row.products_price_cash, accessorFn: (row) => row.price_cash,
id: 'price_cash', id: 'price_cash',
header: ({ column }) => <DataGridColumnHeader title="Price Cash" column={column} />, header: ({ column }) => <DataGridColumnHeader title="Price Cash" column={column} />,
enableSorting: true, enableSorting: true,
@ -186,7 +186,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
pagination={{ size: 10 }} pagination={{ size: 10 }}
toolbar={<ListToolbar />} toolbar={<ListToolbar />}
layout={{ card: true }} layout={{ card: true }}
sorting={[{ id: 'id', desc: false }]} sorting={[{ id: 'Product.id', desc: false }]}
serverSide={true} serverSide={true}
onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) => onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) =>
getProductsLists(pageIndex, pageSize, sorting, columnFilters) getProductsLists(pageIndex, pageSize, sorting, columnFilters)