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