add column on table Products
This commit is contained in:
@ -171,9 +171,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
{
|
{
|
||||||
accessorFn: (row) => row.process_on_third_party,
|
accessorFn: (row) => row.process_on_third_party,
|
||||||
id: 'process_on_third_party',
|
id: 'process_on_third_party',
|
||||||
header: ({ column }) => (
|
header: ({ column }) => <DataGridColumnHeader title="Third Party" column={column} />,
|
||||||
<DataGridColumnHeader title="Process on Third Party" column={column} />
|
|
||||||
),
|
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const isActive = row.original.process_on_third_party === 'Y';
|
const isActive = row.original.process_on_third_party === 'Y';
|
||||||
|
|
||||||
@ -185,6 +183,29 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
headerClassName: 'w-[100px]'
|
headerClassName: 'w-[100px]'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.status,
|
||||||
|
id: 'status',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Status" column={column} />,
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const isActive = row.original.status === 'Y';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={`px-2 py-1 text-xs font-semibold rounded-full ${
|
||||||
|
isActive ? 'bg-green-100 text-green-600' : 'bg-red-100 text-red-600'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{isActive ? 'Active' : 'Inactive'}
|
||||||
|
</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} />,
|
||||||
@ -230,7 +251,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC',
|
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC',
|
||||||
filter: JSON.stringify(filter)
|
filter: JSON.stringify(filter)
|
||||||
});
|
});
|
||||||
// console.log(response?.data);
|
console.log(response?.data);
|
||||||
setProducts(response?.data.list);
|
setProducts(response?.data.list);
|
||||||
return { data: response?.data.list, totalCount: response?.data.total_count };
|
return { data: response?.data.list, totalCount: response?.data.total_count };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user