From 1522d1e615dbabaf9c91aa1245ae59013ca86515 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 26 Sep 2024 11:03:37 +1000 Subject: [PATCH] Hide "Expiry Date" column if feature not enabled (#8172) --- src/frontend/src/tables/stock/StockItemTable.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/tables/stock/StockItemTable.tsx b/src/frontend/src/tables/stock/StockItemTable.tsx index e293c6876e..2aa326ff84 100644 --- a/src/frontend/src/tables/stock/StockItemTable.tsx +++ b/src/frontend/src/tables/stock/StockItemTable.tsx @@ -25,6 +25,7 @@ import { notYetImplemented } from '../../functions/notifications'; import { useCreateApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { apiUrl } from '../../states/ApiState'; +import { useGlobalSettingsState } from '../../states/SettingsState'; import { useUserState } from '../../states/UserState'; import { TableColumn } from '../Column'; import { @@ -234,7 +235,8 @@ function stockItemTableColumns(): TableColumn[] { }), DateColumn({ title: t`Expiry Date`, - accessor: 'expiry_date' + accessor: 'expiry_date', + hidden: !useGlobalSettingsState.getState().isSet('STOCK_ENABLE_EXPIRY') }), DateColumn({ title: t`Last Updated`,