@@ -10,7 +10,7 @@ import {
10
10
IconCheck , IconEye , IconHourglassEmpty , IconPrinter , IconRefresh , IconX ,
11
11
} from '@tabler/icons-react' ;
12
12
13
- export function PrintTasksTable ( { codes , refresh } ) {
13
+ function PrintTaskRow ( { task , refresh } ) {
14
14
const [ loading , setLoading ] = React . useState ( false ) ;
15
15
16
16
const codeActions = async ( _id , operation ) => {
@@ -43,12 +43,12 @@ export function PrintTasksTable({ codes, refresh }) {
43
43
console . error ( e ) ;
44
44
notifications . show ( { title : 'Error' , message : 'Failed to update code' , color : 'red' } ) ;
45
45
}
46
+ refresh ( ) ;
46
47
}
47
48
setLoading ( false ) ;
48
- refresh ( ) ;
49
49
} ;
50
50
51
- const rows = codes . map ( ( task : any ) => (
51
+ return (
52
52
< Table . Tr key = { task . _id } >
53
53
< Table . Td >
54
54
< ThemeIcon radius = "xl" size = "sm" color = { task . done ? 'green' : task . printer ? 'blue' : 'gray' } >
@@ -90,8 +90,10 @@ export function PrintTasksTable({ codes, refresh }) {
90
90
</ Group >
91
91
</ Table . Td >
92
92
</ Table . Tr >
93
- ) ) ;
93
+ ) ;
94
+ }
94
95
96
+ export function PrintTasksTable ( { codes, refresh } ) {
95
97
return (
96
98
< Table
97
99
horizontalSpacing = "md" verticalSpacing = "xs" miw = { 700 }
@@ -106,7 +108,7 @@ export function PrintTasksTable({ codes, refresh }) {
106
108
< Table . Th > Actions</ Table . Th >
107
109
</ Table . Tr >
108
110
</ Table . Thead >
109
- < Table . Tbody > { rows } </ Table . Tbody >
111
+ < Table . Tbody > { codes . map ( ( task ) => < PrintTaskRow key = { task . _id } task = { task } refresh = { refresh } /> ) } </ Table . Tbody >
110
112
</ Table >
111
113
) ;
112
114
}
0 commit comments