@thrustdevs/esm-procedure-orders-app 1.0.2-pre.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/.turbo/turbo-build.log +41 -0
  2. package/README.md +7 -0
  3. package/dist/122.js +1 -0
  4. package/dist/122.js.map +1 -0
  5. package/dist/144.js +2 -0
  6. package/dist/144.js.LICENSE.txt +19 -0
  7. package/dist/144.js.map +1 -0
  8. package/dist/182.js +1 -0
  9. package/dist/182.js.map +1 -0
  10. package/dist/205.js +1 -0
  11. package/dist/205.js.map +1 -0
  12. package/dist/216.js +2 -0
  13. package/dist/216.js.LICENSE.txt +9 -0
  14. package/dist/216.js.map +1 -0
  15. package/dist/290.js +2 -0
  16. package/dist/290.js.LICENSE.txt +5 -0
  17. package/dist/290.js.map +1 -0
  18. package/dist/300.js +1 -0
  19. package/dist/341.js +2 -0
  20. package/dist/341.js.LICENSE.txt +29 -0
  21. package/dist/341.js.map +1 -0
  22. package/dist/41.js +2 -0
  23. package/dist/41.js.LICENSE.txt +9 -0
  24. package/dist/41.js.map +1 -0
  25. package/dist/470.js +1 -0
  26. package/dist/470.js.map +1 -0
  27. package/dist/495.js +1 -0
  28. package/dist/495.js.map +1 -0
  29. package/dist/506.js +2 -0
  30. package/dist/506.js.LICENSE.txt +39 -0
  31. package/dist/506.js.map +1 -0
  32. package/dist/537.js +1 -0
  33. package/dist/537.js.map +1 -0
  34. package/dist/647.js +2 -0
  35. package/dist/647.js.LICENSE.txt +5 -0
  36. package/dist/647.js.map +1 -0
  37. package/dist/7.js +1 -0
  38. package/dist/7.js.map +1 -0
  39. package/dist/719.js +2 -0
  40. package/dist/719.js.LICENSE.txt +5 -0
  41. package/dist/719.js.map +1 -0
  42. package/dist/720.js +1 -0
  43. package/dist/720.js.map +1 -0
  44. package/dist/876.js +1 -0
  45. package/dist/876.js.map +1 -0
  46. package/dist/883.js +1 -0
  47. package/dist/883.js.map +1 -0
  48. package/dist/89.js +1 -0
  49. package/dist/89.js.map +1 -0
  50. package/dist/892.js +1 -0
  51. package/dist/892.js.map +1 -0
  52. package/dist/895.js +1 -0
  53. package/dist/895.js.map +1 -0
  54. package/dist/913.js +2 -0
  55. package/dist/913.js.LICENSE.txt +32 -0
  56. package/dist/913.js.map +1 -0
  57. package/dist/924.js +1 -0
  58. package/dist/924.js.map +1 -0
  59. package/dist/943.js +1 -0
  60. package/dist/943.js.map +1 -0
  61. package/dist/99.js +2 -0
  62. package/dist/99.js.LICENSE.txt +5 -0
  63. package/dist/99.js.map +1 -0
  64. package/dist/kenyaemr-esm-procedure-orders-app.js +1 -0
  65. package/dist/kenyaemr-esm-procedure-orders-app.js.buildmanifest.json +786 -0
  66. package/dist/kenyaemr-esm-procedure-orders-app.js.map +1 -0
  67. package/dist/main.js +2 -0
  68. package/dist/main.js.LICENSE.txt +35 -0
  69. package/dist/main.js.map +1 -0
  70. package/dist/routes.json +1 -0
  71. package/jest.config.js +8 -0
  72. package/package.json +55 -0
  73. package/src/completed-list/completed-list.component.tsx +40 -0
  74. package/src/completed-list/completed-list.resource.ts +0 -0
  75. package/src/completed-list/completed-list.scss +223 -0
  76. package/src/components/create-dashboard-link.component.tsx +35 -0
  77. package/src/components/overlay/hook.ts +47 -0
  78. package/src/components/overlay/overlay.component.tsx +42 -0
  79. package/src/components/overlay/overlay.scss +92 -0
  80. package/src/config-schema.ts +78 -0
  81. package/src/constants.ts +5 -0
  82. package/src/declarations.d.ts +6 -0
  83. package/src/empty-state/empty-state-component.tsx +21 -0
  84. package/src/empty-state/empty-state.scss +23 -0
  85. package/src/form/post-procedures/post-procedure-form.component.tsx +468 -0
  86. package/src/form/post-procedures/post-procedure-form.scss +189 -0
  87. package/src/form/post-procedures/post-procedure.resource.tsx +71 -0
  88. package/src/form/procedures-orders/add-procedures-order/add-procedures-order.scss +44 -0
  89. package/src/form/procedures-orders/add-procedures-order/add-procedures-order.workspace.tsx +93 -0
  90. package/src/form/procedures-orders/add-procedures-order/procedures-order-form.component.tsx +476 -0
  91. package/src/form/procedures-orders/add-procedures-order/procedures-order-form.scss +80 -0
  92. package/src/form/procedures-orders/add-procedures-order/procedures-order.ts +17 -0
  93. package/src/form/procedures-orders/add-procedures-order/procedures-type-search.scss +115 -0
  94. package/src/form/procedures-orders/add-procedures-order/procedures-type-search.tsx +236 -0
  95. package/src/form/procedures-orders/add-procedures-order/useProceduresTypes.ts +93 -0
  96. package/src/form/procedures-orders/api.ts +282 -0
  97. package/src/form/procedures-orders/order-config.ts +48 -0
  98. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-icon.component.tsx +39 -0
  99. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-item-tile.component.tsx +100 -0
  100. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-item-tile.scss +72 -0
  101. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-panel.extension.tsx +190 -0
  102. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-panel.scss +74 -0
  103. package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket.scss +55 -0
  104. package/src/header/procedure-header.component.tsx +32 -0
  105. package/src/header/procedure-header.scss +70 -0
  106. package/src/header/procedure-illustration.component.tsx +52 -0
  107. package/src/hooks/useOrdersWorklist.ts +70 -0
  108. package/src/hooks/useSearchGroupedResults.ts +22 -0
  109. package/src/hooks/useSearchResults.ts +39 -0
  110. package/src/index.ts +59 -0
  111. package/src/left-panel-link.tsx +40 -0
  112. package/src/not-done-list/not-done-list.component.tsx +44 -0
  113. package/src/not-done-list/not-done.scss +207 -0
  114. package/src/patient-chart/patient-procedure-order-results-table.resource.ts +43 -0
  115. package/src/patient-chart/patient-procedure-order-results.component.tsx +12 -0
  116. package/src/patient-chart/patient-procedure-order-results.resource.ts +485 -0
  117. package/src/patient-chart/patient-procedure-results.component.tsx +30 -0
  118. package/src/patient-chart/procedure-active-order/procedure-active-order-results.component.tsx +390 -0
  119. package/src/patient-chart/procedure-active-order/procedure-active-order-results.scss +78 -0
  120. package/src/patient-chart/procedure-order-referals/procedure-order-referals.component.tsx +394 -0
  121. package/src/patient-chart/procedure-order-referals/procedure-order-referals.resource.tsx +0 -0
  122. package/src/patient-chart/procedure-order-referals/procedure-order-referals.scss +78 -0
  123. package/src/patient-chart/procedure-past-test/laboratory-past-test-order-results.component.tsx +366 -0
  124. package/src/patient-chart/procedure-past-test/laboratory-past-test-order-results.scss +74 -0
  125. package/src/patient-chart/procedure-tabs/laboratory-order-tabs.component.tsx +44 -0
  126. package/src/patient-chart/procedure-tabs/laboratory-order-tabs.scss +7 -0
  127. package/src/patient-chart/procedure-workspaces/laboratory-referral.workspace.component.tsx +11 -0
  128. package/src/patient-chart/procedure-workspaces/laboratory-referral.workspace.scss +0 -0
  129. package/src/patient-chart/results-summary/print-results-summary.component.tsx +152 -0
  130. package/src/patient-chart/results-summary/print-results-summary.scss +80 -0
  131. package/src/patient-chart/results-summary/print-results-table.component.tsx +134 -0
  132. package/src/patient-chart/results-summary/results-summary.resource.tsx +174 -0
  133. package/src/patient-chart/results-summary/results-summary.scss +158 -0
  134. package/src/patient-chart/results-summary/send-email-dialog.component.tsx +59 -0
  135. package/src/patient-chart/results-summary/test-children-results.component.tsx +177 -0
  136. package/src/patient-chart/results-summary/test-print-results-table.component.tsx +105 -0
  137. package/src/patient-chart/results-summary/test-results-table.component.tsx +103 -0
  138. package/src/print/print-procedure-results.component.tsx +49 -0
  139. package/src/print/print-procedure.component.tsx +105 -0
  140. package/src/print/print-procedure.scss +98 -0
  141. package/src/procedure-tabs/completed-tab.component.tsx +12 -0
  142. package/src/procedure-tabs/not-done-tab.component.tsx +12 -0
  143. package/src/procedure-tabs/referred-tab.component.tsx +12 -0
  144. package/src/procedure-tabs/work-list-tab.component.tsx +13 -0
  145. package/src/procedure.component.tsx +24 -0
  146. package/src/procedures-ordered/_pick-procedure-request-menu.component.tsx +33 -0
  147. package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.component.tsx +105 -0
  148. package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.resource.ts +106 -0
  149. package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.scss +38 -0
  150. package/src/procedures-ordered/pick-procedure-request-menu.component.tsx +32 -0
  151. package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.component.tsx +300 -0
  152. package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.resource.ts +153 -0
  153. package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.scss +38 -0
  154. package/src/procedures-ordered/procedure-instructions/instructions.scss +24 -0
  155. package/src/procedures-ordered/procedure-instructions/procedure-instructions-menu.component.tsx +32 -0
  156. package/src/procedures-ordered/procedure-instructions/procedure-instructions.component.tsx +78 -0
  157. package/src/procedures-ordered/procedure-instructions/procedure-instructions.scss +24 -0
  158. package/src/procedures-ordered/procedure-queue.scss +211 -0
  159. package/src/procedures-ordered/procedure-tabs.component.tsx +104 -0
  160. package/src/procedures-ordered/procedure-tests/procedure-tests.component.tsx +83 -0
  161. package/src/procedures-ordered/procedure-tests/procedure-tests.resource.ts +14 -0
  162. package/src/procedures-ordered/procedure-tests/procedure-tests.scss +12 -0
  163. package/src/procedures-ordered/procedures-ordered-list.component.tsx +38 -0
  164. package/src/procedures-ordered/reject-order-dialog/reject-order-dialog.scss +14 -0
  165. package/src/procedures-ordered/reject-order-dialog/reject-procedure-order-dialog.component.tsx +98 -0
  166. package/src/procedures-ordered/reject-reason/procedure-reject-reason-menu.component.tsx +32 -0
  167. package/src/procedures-ordered/reject-reason/procedure-reject-reason.component.tsx +40 -0
  168. package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component.tsx +42 -0
  169. package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss +14 -0
  170. package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.test.tsx +67 -0
  171. package/src/referred-procedures/referred-procedures.component.tsx +37 -0
  172. package/src/results/result-form-field.component.tsx +141 -0
  173. package/src/results/result-form.component.tsx +120 -0
  174. package/src/results/result-form.resource.ts +361 -0
  175. package/src/results/result-form.scss +22 -0
  176. package/src/root.component.tsx +16 -0
  177. package/src/routes.json +152 -0
  178. package/src/setup-tests.ts +7 -0
  179. package/src/shared/ui/common/action-button/action-button.component.tsx +68 -0
  180. package/src/shared/ui/common/action-button/action-button.scss +12 -0
  181. package/src/shared/ui/common/action-button/order-action-extension.component.tsx +21 -0
  182. package/src/shared/ui/common/grouped-orders-table.component.tsx +176 -0
  183. package/src/shared/ui/common/grouped-orders-table.scss +30 -0
  184. package/src/shared/ui/common/grouped-procedure-types.ts +47 -0
  185. package/src/shared/ui/common/list-order-details.component.tsx +171 -0
  186. package/src/shared/ui/common/list-order-details.resource.ts +41 -0
  187. package/src/shared/ui/common/list-order-details.scss +118 -0
  188. package/src/shared/ui/common/orders-date-range-picker.scss +15 -0
  189. package/src/shared/ui/common/orders-date-range-picker.tsx +38 -0
  190. package/src/summary-tiles/procedure-summary-tiles.component.tsx +36 -0
  191. package/src/summary-tiles/procedure-summary-tiles.scss +11 -0
  192. package/src/summary-tiles/procedure-summary.resource.tsx +79 -0
  193. package/src/summary-tiles/summary-tile.component.tsx +41 -0
  194. package/src/summary-tiles/summary-tile.scss +53 -0
  195. package/src/types/index.ts +661 -0
  196. package/src/types/patient-queue.ts +77 -0
  197. package/src/ui-components/overflow-menu.component.tsx +74 -0
  198. package/src/ui-components/overflow-menu.scss +39 -0
  199. package/src/utils/functions.ts +236 -0
  200. package/src/utils/orders-table/orders-data-table.component.tsx +129 -0
  201. package/src/utils/orders-table/orders-data-table.scss +50 -0
  202. package/src/work-list/work-list.component.tsx +38 -0
  203. package/src/work-list/work-list.resource.ts +26 -0
  204. package/src/work-list/work-list.scss +207 -0
  205. package/translations/en.json +141 -0
  206. package/tsconfig.json +5 -0
  207. package/webpack.config.js +1 -0
@@ -0,0 +1,390 @@
1
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import styles from './laboratory-active-test-order-results.scss';
4
+ import { formatDate, parseDate, ErrorState, showModal, useConfig, usePagination } from '@openmrs/esm-framework';
5
+ import { mutate } from 'swr';
6
+ import {
7
+ DataTable,
8
+ DataTableSkeleton,
9
+ Table,
10
+ TableBody,
11
+ TableCell,
12
+ TableContainer,
13
+ TableHead,
14
+ TableHeader,
15
+ TableRow,
16
+ TableToolbar,
17
+ TableToolbarContent,
18
+ TableToolbarSearch,
19
+ Layer,
20
+ Tag,
21
+ Tile,
22
+ Tooltip,
23
+ Pagination,
24
+ TableExpandHeader,
25
+ TableExpandRow,
26
+ TableExpandedRow,
27
+ Button,
28
+ IconButton,
29
+ InlineLoading,
30
+ } from '@carbon/react';
31
+
32
+ import { Printer, MailAll, Add, Checkmark, SendAlt, NotSent } from '@carbon/react/icons';
33
+
34
+ import TestsResults from '../results-summary/test-results-table.component';
35
+ import { useReactToPrint } from 'react-to-print';
36
+ import PrintResultsSummary from '../results-summary/print-results-summary.component';
37
+ import { useGetPatientByUuid } from '../../utils/functions';
38
+ import { ResourceRepresentation, type Result, getOrderColor } from '../patient-procedure-order-results.resource';
39
+ import { useLaboratoryOrderResultsPages } from '../patient-procedure-order-results-table.resource';
40
+ import { CardHeader, launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
41
+
42
+ interface LaboratoryActiveTestOrderResultsProps {
43
+ patientUuid: string;
44
+ }
45
+
46
+ interface PrintProps {
47
+ encounter: Result;
48
+ }
49
+
50
+ const LaboratoryActiveTestOrderResults: React.FC<LaboratoryActiveTestOrderResultsProps> = ({ patientUuid }) => {
51
+ const { t } = useTranslation();
52
+
53
+ const { enableSendingLabTestsByEmail, laboratoryEncounterTypeUuid } = useConfig();
54
+
55
+ const displayText = t('activelLaboratoryTestsDisplayTextTitle', 'Active Laboratory Tests');
56
+
57
+ const { items, tableHeaders, isLoading, isError } = useLaboratoryOrderResultsPages({
58
+ v: ResourceRepresentation.Full,
59
+ totalCount: true,
60
+ patientUuid: patientUuid,
61
+ laboratoryEncounterTypeUuid: laboratoryEncounterTypeUuid,
62
+ });
63
+ const pageSizes = [10, 20, 30, 40, 50];
64
+ const [currentPageSize, setPageSize] = useState(10);
65
+
66
+ const sortedLabRequests = useMemo(() => {
67
+ return [...items]
68
+ ?.filter((item) => item?.encounterType?.uuid === laboratoryEncounterTypeUuid)
69
+ ?.sort((a, b) => {
70
+ const dateA = new Date(a.encounterDatetime);
71
+ const dateB = new Date(b.encounterDatetime);
72
+ return dateB.getTime() - dateA.getTime();
73
+ });
74
+ }, [items, laboratoryEncounterTypeUuid]);
75
+
76
+ const [searchTerm, setSearchTerm] = useState('');
77
+ const [laboratoryOrders, setLaboratoryOrders] = useState(sortedLabRequests);
78
+ const [initialTests, setInitialTests] = useState(sortedLabRequests);
79
+
80
+ const handleChange = useCallback((event) => {
81
+ const searchText = event?.target?.value?.trim().toLowerCase();
82
+ setSearchTerm(searchText);
83
+ }, []);
84
+
85
+ useEffect(() => {
86
+ if (!searchTerm) {
87
+ setLaboratoryOrders(initialTests);
88
+ } else {
89
+ const filteredItems = initialTests.filter((item) =>
90
+ item?.orders?.some((order) => order?.concept?.display.toLowerCase().includes(searchTerm)),
91
+ );
92
+ setLaboratoryOrders(filteredItems);
93
+ }
94
+ }, [searchTerm, initialTests]);
95
+
96
+ useEffect(() => {
97
+ setInitialTests(sortedLabRequests);
98
+ }, [sortedLabRequests]);
99
+
100
+ const EmailButtonAction: React.FC = () => {
101
+ const launchSendEmailModal = useCallback(() => {
102
+ const dispose = showModal('send-email-dialog', {
103
+ closeModal: () => dispose(),
104
+ });
105
+ }, []);
106
+
107
+ return (
108
+ <Button
109
+ kind="ghost"
110
+ size="sm"
111
+ onClick={(e) => launchSendEmailModal()}
112
+ renderIcon={(props) => <MailAll size={16} {...props} />}
113
+ />
114
+ );
115
+ };
116
+
117
+ const launchLabRequestForm = () => {
118
+ launchPatientWorkspace('patient-laboratory-referral-workspace', {
119
+ workspaceTitle: 'Lab Request Form',
120
+ mutateForm: () => {
121
+ mutate((key) => true, undefined, {
122
+ revalidate: true,
123
+ });
124
+ },
125
+ formInfo: {
126
+ encounterUuid: '',
127
+ formUuid: 'c6f3b5ad-b7eb-44ad-b212-fb26456e155b',
128
+ },
129
+ });
130
+ };
131
+
132
+ const LaunchLabRequestForm: React.FC = () => {
133
+ return (
134
+ <IconButton label="Add">
135
+ <Add onClick={launchLabRequestForm} />
136
+ </IconButton>
137
+ );
138
+ };
139
+ const PrintButtonAction: React.FC<PrintProps> = ({ encounter }) => {
140
+ const { patient } = useGetPatientByUuid(encounter.patient.uuid);
141
+
142
+ const [isPrinting, setIsPrinting] = useState(false);
143
+
144
+ const contentToPrintRef = useRef(null);
145
+
146
+ const onBeforeGetContentResolve = useRef(null);
147
+
148
+ useEffect(() => {
149
+ if (onBeforeGetContentResolve.current) {
150
+ onBeforeGetContentResolve.current();
151
+ }
152
+ }, [isPrinting]);
153
+
154
+ const handlePrint = useReactToPrint({
155
+ content: () => contentToPrintRef.current,
156
+ onBeforeGetContent: () =>
157
+ new Promise((resolve) => {
158
+ onBeforeGetContentResolve.current = resolve;
159
+ setIsPrinting(true);
160
+ }),
161
+ onAfterPrint: () => {
162
+ onBeforeGetContentResolve.current = null;
163
+ setIsPrinting(false);
164
+ },
165
+ });
166
+
167
+ return (
168
+ <div>
169
+ <div ref={contentToPrintRef}>
170
+ <PrintResultsSummary encounterResponse={encounter} patient={patient} />
171
+ </div>
172
+ <Tooltip align="bottom" label="Print out results">
173
+ <Button
174
+ kind="ghost"
175
+ size="sm"
176
+ onClick={handlePrint}
177
+ renderIcon={(props) => <Printer size={16} {...props} />}
178
+ />
179
+ </Tooltip>
180
+ </div>
181
+ );
182
+ };
183
+
184
+ const currentDateTime = new Date().getTime();
185
+ const twentyFourHoursAgo = currentDateTime - 24 * 60 * 60 * 1000;
186
+
187
+ const filteredActiveTestOrderResults = useMemo(() => {
188
+ return laboratoryOrders?.filter((entry) => {
189
+ const entryDate = new Date(entry.encounterDatetime).getTime();
190
+ return entryDate >= twentyFourHoursAgo && entryDate <= currentDateTime;
191
+ });
192
+ }, [currentDateTime, laboratoryOrders, twentyFourHoursAgo]);
193
+
194
+ const {
195
+ goTo,
196
+ results: paginatedActiveTestOrderResults,
197
+ currentPage,
198
+ } = usePagination(filteredActiveTestOrderResults, currentPageSize);
199
+
200
+ const tableRows = useMemo(() => {
201
+ return paginatedActiveTestOrderResults?.map((entry, index) => ({
202
+ ...entry,
203
+ id: entry.uuid,
204
+ orderDate: formatDate(parseDate(entry.encounterDatetime), {
205
+ mode: 'standard',
206
+ time: true,
207
+ }),
208
+ orders: (
209
+ <>
210
+ {entry?.orders
211
+ ?.filter((order) => order?.type === 'testorder' && order?.action === 'NEW')
212
+ .map((order) => (
213
+ <Tag
214
+ style={{
215
+ background: `${getOrderColor(order?.dateActivated, order?.dateStopped)}`,
216
+ color: 'white',
217
+ }}
218
+ role="tooltip"
219
+ key={order?.uuid}>
220
+ {order?.display}
221
+ </Tag>
222
+ ))}
223
+ </>
224
+ ),
225
+ location: entry.location.display,
226
+ status: '--',
227
+ actions: (
228
+ <div style={{ display: 'flex' }}>
229
+ <PrintButtonAction encounter={entry} />
230
+ {enableSendingLabTestsByEmail && <EmailButtonAction />}
231
+ </div>
232
+ ),
233
+ }));
234
+ }, [enableSendingLabTestsByEmail, paginatedActiveTestOrderResults]);
235
+
236
+ if (isLoading) {
237
+ return <DataTableSkeleton role="progressbar" />;
238
+ }
239
+
240
+ if (isError) {
241
+ return <ErrorState error={isError} headerTitle={'Error'} />;
242
+ }
243
+
244
+ if (filteredActiveTestOrderResults?.length >= 0) {
245
+ return (
246
+ <div className={styles.widgetCard}>
247
+ <CardHeader title={displayText}>
248
+ {isLoading ? (
249
+ <span>
250
+ <InlineLoading />
251
+ </span>
252
+ ) : null}
253
+ <div className={styles.buttons}>
254
+ <Button
255
+ kind="ghost"
256
+ renderIcon={(props) => <Add size={16} {...props} />}
257
+ iconDescription="Launch lab Request"
258
+ onClick={launchLabRequestForm}>
259
+ {t('add', 'Add')}
260
+ </Button>
261
+ </div>
262
+ </CardHeader>
263
+
264
+ <DataTable rows={tableRows} headers={tableHeaders} useZebraStyles>
265
+ {({ rows, headers, getHeaderProps, getTableProps, getRowProps }) => (
266
+ <TableContainer className={styles.tableContainer}>
267
+ <TableToolbar
268
+ style={{
269
+ position: 'static',
270
+ height: '3rem',
271
+ overflow: 'visible',
272
+ backgroundColor: 'color',
273
+ }}>
274
+ <TableToolbarContent>
275
+ <div
276
+ style={{
277
+ fontSize: '10px',
278
+ margin: '5px',
279
+ display: 'flex',
280
+ flexDirection: 'row',
281
+ alignItems: 'center',
282
+ }}>
283
+ Key:
284
+ <Tag
285
+ size="sm"
286
+ style={{
287
+ background: '#6F6F6F',
288
+ color: 'white',
289
+ }}
290
+ title="Result Requested"
291
+ renderIcon={() => <SendAlt />}>
292
+ {'Requested'}
293
+ </Tag>
294
+ <Tag
295
+ size="sm"
296
+ style={{
297
+ background: 'green',
298
+ color: 'white',
299
+ }}
300
+ title="Result Complete"
301
+ renderIcon={() => <Checkmark />}>
302
+ {'Completed'}
303
+ </Tag>
304
+ <Tag
305
+ size="sm"
306
+ style={{
307
+ background: 'red',
308
+ color: 'white',
309
+ }}
310
+ title="Result Rejected"
311
+ renderIcon={() => <NotSent />}>
312
+ {'Rejected'}
313
+ </Tag>
314
+ </div>
315
+ <Layer>
316
+ <TableToolbarSearch
317
+ expanded={true}
318
+ value={searchTerm}
319
+ onChange={handleChange}
320
+ placeholder={t('searchThisList', 'Search this list')}
321
+ size="sm"
322
+ />
323
+ </Layer>
324
+ </TableToolbarContent>
325
+ </TableToolbar>
326
+ <Table {...getTableProps()} className={styles.activePatientsTable}>
327
+ <TableHead>
328
+ <TableRow>
329
+ <TableExpandHeader />
330
+ {headers.map((header) => (
331
+ <TableHeader {...getHeaderProps({ header })}>{header.header}</TableHeader>
332
+ ))}
333
+ </TableRow>
334
+ </TableHead>
335
+ <TableBody>
336
+ {rows.map((row, index) => {
337
+ return (
338
+ <React.Fragment key={row.id}>
339
+ <TableExpandRow {...getRowProps({ row })}>
340
+ {row.cells.map((cell) => (
341
+ <TableCell key={cell.id}>{cell.value?.content ?? cell.value}</TableCell>
342
+ ))}
343
+ </TableExpandRow>
344
+ {row.isExpanded ? (
345
+ <TableExpandedRow className={styles.expandedActiveVisitRow} colSpan={headers.length + 2}>
346
+ {sortedLabRequests[index]?.obs !== null && sortedLabRequests[index]?.obs?.length > 0 && (
347
+ <TestsResults obs={sortedLabRequests[index]?.obs} />
348
+ )}
349
+ </TableExpandedRow>
350
+ ) : (
351
+ <TableExpandedRow className={styles.hiddenRow} colSpan={headers.length + 2} />
352
+ )}
353
+ </React.Fragment>
354
+ );
355
+ })}
356
+ </TableBody>
357
+ </Table>
358
+ {rows.length === 0 ? (
359
+ <div className={styles.tileContainer}>
360
+ <Tile className={styles.tile}>
361
+ <div className={styles.tileContent}>
362
+ <p className={styles.content}>{t('noTestOrdersToDisplay', 'No test orders to display')}</p>
363
+ </div>
364
+ </Tile>
365
+ </div>
366
+ ) : null}
367
+ <Pagination
368
+ page={currentPage}
369
+ pageSize={currentPageSize}
370
+ pageSizes={pageSizes}
371
+ totalItems={filteredActiveTestOrderResults?.length}
372
+ onChange={({ pageSize, page }) => {
373
+ if (pageSize !== currentPageSize) {
374
+ setPageSize(pageSize);
375
+ }
376
+ if (page !== currentPage) {
377
+ goTo(page);
378
+ }
379
+ }}
380
+ className={styles.paginationOverride}
381
+ />
382
+ </TableContainer>
383
+ )}
384
+ </DataTable>
385
+ </div>
386
+ );
387
+ }
388
+ };
389
+
390
+ export default LaboratoryActiveTestOrderResults;
@@ -0,0 +1,78 @@
1
+ @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/styles/scss/colors';
3
+ @use '@carbon/styles/scss/type';
4
+ @use '@openmrs/esm-styleguide/src/vars' as vars;
5
+ @import '../../root.scss';
6
+
7
+ .widgetCard {
8
+ border: 1px solid colors.$gray-20;
9
+ border-bottom: none;
10
+ }
11
+
12
+ .headerBtnContainer {
13
+ background-color: vars.$ui-background;
14
+ padding: spacing.$spacing-05;
15
+ text-align: right;
16
+ }
17
+
18
+ .tileContainer {
19
+ background-color: vars.$ui-02;
20
+ border-top: 1px solid vars.$ui-03;
21
+ padding: 5rem 0;
22
+ }
23
+
24
+ .tile {
25
+ margin: auto;
26
+ width: fit-content;
27
+ }
28
+
29
+ .tileContent {
30
+ display: flex;
31
+ flex-direction: column;
32
+ align-items: center;
33
+ }
34
+
35
+ .content {
36
+ @include type.type-style('heading-compact-02');
37
+ color: vars.$text-02;
38
+ margin-bottom: 0.5rem;
39
+ }
40
+
41
+ .helper {
42
+ @include type.type-style('body-compact-01');
43
+ color: vars.$text-02;
44
+ }
45
+
46
+ .container {
47
+ background-color: vars.$ui-01;
48
+ }
49
+
50
+ .separator {
51
+ @include type.type-style('body-compact-02');
52
+ color: vars.$text-02;
53
+ width: 80%;
54
+ margin: 1.5rem auto;
55
+ overflow: hidden;
56
+ text-align: center;
57
+
58
+ &::before,
59
+ &::after {
60
+ background-color: vars.$text-03;
61
+ content: '';
62
+ display: inline-block;
63
+ height: 1px;
64
+ position: relative;
65
+ vertical-align: middle;
66
+ width: 50%;
67
+ }
68
+
69
+ &::before {
70
+ right: 0.5rem;
71
+ margin-left: -50%;
72
+ }
73
+
74
+ &::after {
75
+ left: 0.5rem;
76
+ margin-right: -50%;
77
+ }
78
+ }