@@ -3,7 +3,8 @@ import { Button, Stack, ComboButton, MenuItem } from '@carbon/react';
3
3
import { Printer } from '@carbon/react/icons' ;
4
4
import { useTranslation } from 'react-i18next' ;
5
5
import { useStockItem } from '../../../stock-items.resource' ;
6
- import { showModal } from '@openmrs/esm-framework' ;
6
+ import { showModal , useConfig } from '@openmrs/esm-framework' ;
7
+ import { type ConfigObject } from '../../../../config-schema' ;
7
8
import styles from './printable-transaction.scss' ;
8
9
import { useEffect , useMemo , useState } from 'react' ;
9
10
import { StockItemInventoryFilter , useStockItemTransactions } from '../../../stock-items.resource' ;
@@ -18,6 +19,8 @@ type Props = {
18
19
const TransactionsPrintAction : React . FC < Props > = ( { columns, data, itemUuid } ) => {
19
20
const { t } = useTranslation ( ) ;
20
21
22
+ const { enablePrintButton } = useConfig < ConfigObject > ( ) ;
23
+
21
24
const [ stockCardItemFilter , setStockCardItemFilter ] = useState < StockItemInventoryFilter > ( {
22
25
startIndex : 0 ,
23
26
totalCount : true ,
@@ -86,22 +89,24 @@ const TransactionsPrintAction: React.FC<Props> = ({ columns, data, itemUuid }) =
86
89
87
90
return (
88
91
< >
89
- < ComboButton label = "Print" >
90
- < MenuItem
91
- label = { t ( 'printStockCard' , 'Print Stock Card' ) }
92
- renderIcon = { ( props ) => < Printer size = { 24 } { ...props } /> }
93
- iconDescription = "Print Stock Card"
94
- onClick = { handleStockcardClick }
95
- disabled = { isStockItemLoading || isStockCardLoading }
96
- />
97
- < MenuItem
98
- label = { t ( 'printBinCard' , 'Print Bin Card' ) }
99
- renderIcon = { ( props ) => < Printer size = { 24 } { ...props } /> }
100
- iconDescription = "Print Bin Card"
101
- onClick = { handleBincardClick }
102
- disabled = { isStockItemLoading }
103
- />
104
- </ ComboButton >
92
+ { enablePrintButton && (
93
+ < ComboButton label = "Print" >
94
+ < MenuItem
95
+ label = { t ( 'printStockCard' , 'Print Stock Card' ) }
96
+ renderIcon = { ( props ) => < Printer size = { 24 } { ...props } /> }
97
+ iconDescription = "Print Stock Card"
98
+ onClick = { handleStockcardClick }
99
+ disabled = { isStockItemLoading || isStockCardLoading }
100
+ />
101
+ < MenuItem
102
+ label = { t ( 'printBinCard' , 'Print Bin Card' ) }
103
+ renderIcon = { ( props ) => < Printer size = { 24 } { ...props } /> }
104
+ iconDescription = "Print Bin Card"
105
+ onClick = { handleBincardClick }
106
+ disabled = { isStockItemLoading }
107
+ />
108
+ </ ComboButton >
109
+ ) }
105
110
</ >
106
111
) ;
107
112
} ;
0 commit comments