From 6ff4b7d58af61025bc29b99dc92baa2bc95b2753 Mon Sep 17 00:00:00 2001 From: Wikzyy Date: Fri, 11 Apr 2025 16:19:49 +0700 Subject: [PATCH] add column on table Products --- .../products/hooks/ManageProductsContext.tsx | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/pages/master/products/hooks/ManageProductsContext.tsx b/src/pages/master/products/hooks/ManageProductsContext.tsx index cfe1ed4..8c07643 100644 --- a/src/pages/master/products/hooks/ManageProductsContext.tsx +++ b/src/pages/master/products/hooks/ManageProductsContext.tsx @@ -171,9 +171,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode { accessorFn: (row) => row.process_on_third_party, id: 'process_on_third_party', - header: ({ column }) => ( - - ), + header: ({ column }) => , cell: ({ row }) => { const isActive = row.original.process_on_third_party === 'Y'; @@ -185,6 +183,29 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode headerClassName: 'w-[100px]' } }, + { + accessorFn: (row) => row.status, + id: 'status', + header: ({ column }) => , + cell: ({ row }) => { + const isActive = row.original.status === 'Y'; + + return ( + + {isActive ? 'Active' : 'Inactive'} + + ); + }, + enableSorting: true, + enableHiding: false, + meta: { + headerClassName: 'w-[100px]' + } + }, { id: 'actions', header: ({ column }) => , @@ -230,7 +251,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode order_direction: sorting[0].desc == false ? 'ASC' : 'DESC', filter: JSON.stringify(filter) }); - // console.log(response?.data); + console.log(response?.data); setProducts(response?.data.list); return { data: response?.data.list, totalCount: response?.data.total_count }; } catch (error) {