update column on table Products
This commit is contained in:
@ -72,6 +72,19 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
|
|
||||||
const columns = useMemo<ColumnDef<any>[]>(
|
const columns = useMemo<ColumnDef<any>[]>(
|
||||||
() => [
|
() => [
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.code,
|
||||||
|
id: 'code',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Code" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[100px]'
|
||||||
|
},
|
||||||
|
filterFn: (row, id, value) => {
|
||||||
|
return row.original.products_name.toLowerCase().includes(value.toLowerCase());
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.name,
|
accessorFn: (row) => row.name,
|
||||||
id: 'name',
|
id: 'name',
|
||||||
@ -89,7 +102,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
accessorFn: (row) => row.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: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: {
|
meta: {
|
||||||
headerClassName: 'w-[250px]'
|
headerClassName: 'w-[250px]'
|
||||||
@ -99,12 +112,22 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
accessorFn: (row) => row.provider?.name,
|
accessorFn: (row) => row.provider?.name,
|
||||||
id: 'provider_name',
|
id: 'provider_name',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Provider Name" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Provider Name" column={column} />,
|
||||||
enableSorting: true,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: {
|
meta: {
|
||||||
headerClassName: 'w-[250px]'
|
headerClassName: 'w-[250px]'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.type,
|
||||||
|
id: 'type',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Type" column={column} />,
|
||||||
|
enableSorting: false,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[150px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.price_point,
|
accessorFn: (row) => row.price_point,
|
||||||
id: 'price_point',
|
id: 'price_point',
|
||||||
@ -125,6 +148,43 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
headerClassName: 'w-[100px]'
|
headerClassName: 'w-[100px]'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.cashback_point,
|
||||||
|
id: 'cashback_point',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Cashback Point" column={column} />,
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[100px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.cashback_cash,
|
||||||
|
id: 'cashback_cash',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Cashback Cash" column={column} />,
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[100px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.process_on_third_party,
|
||||||
|
id: 'process_on_third_party',
|
||||||
|
header: ({ column }) => (
|
||||||
|
<DataGridColumnHeader title="Process on Third Party" column={column} />
|
||||||
|
),
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const isActive = row.original.process_on_third_party === 'Y';
|
||||||
|
|
||||||
|
return <span>{isActive ? 'Yes' : 'No'}</span>;
|
||||||
|
},
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[100px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'actions',
|
id: 'actions',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Actions" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Actions" column={column} />,
|
||||||
|
|||||||
Reference in New Issue
Block a user