@openmrs/esm-laboratory-app 1.0.1-pre.106
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +32 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo/turbo-build.log +30 -0
- package/.turbo/turbo-lint.log +12 -0
- package/.turbo/turbo-typescript.log +0 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/3d4697b8.yml +0 -0
- package/README.md +39 -0
- package/__mocks__/react-i18next.js +50 -0
- package/assets/logo/logo.png +0 -0
- package/assets/logo/moh_logo_without_word.png +0 -0
- package/assets/screenshots/labs_enter_results.png +0 -0
- package/assets/screenshots/labs_general_dashboard.png +0 -0
- package/dist/142.js +1 -0
- package/dist/142.js.map +1 -0
- package/dist/319.js +1 -0
- package/dist/36.js +1 -0
- package/dist/36.js.map +1 -0
- package/dist/395.js +1 -0
- package/dist/395.js.map +1 -0
- package/dist/453.js +1 -0
- package/dist/453.js.map +1 -0
- package/dist/533.js +1 -0
- package/dist/533.js.map +1 -0
- package/dist/56.js +2 -0
- package/dist/56.js.LICENSE.txt +32 -0
- package/dist/56.js.map +1 -0
- package/dist/572.js +1 -0
- package/dist/572.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/581.js +1 -0
- package/dist/581.js.map +1 -0
- package/dist/66.js +1 -0
- package/dist/66.js.map +1 -0
- package/dist/757.js +1 -0
- package/dist/769.js +1 -0
- package/dist/769.js.map +1 -0
- package/dist/770.js +1 -0
- package/dist/770.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/809.js +1 -0
- package/dist/809.js.map +1 -0
- package/dist/889.js +1 -0
- package/dist/889.js.map +1 -0
- package/dist/894.js +2 -0
- package/dist/894.js.LICENSE.txt +48 -0
- package/dist/894.js.map +1 -0
- package/dist/924.js +1 -0
- package/dist/924.js.map +1 -0
- package/dist/928.js +1 -0
- package/dist/928.js.map +1 -0
- package/dist/967b98e46b0984c4.png +0 -0
- package/dist/97.js +1 -0
- package/dist/97.js.map +1 -0
- package/dist/983.js +1 -0
- package/dist/983.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +48 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-laboratory-app.js +1 -0
- package/dist/openmrs-esm-laboratory-app.js.buildmanifest.json +628 -0
- package/dist/openmrs-esm-laboratory-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +16 -0
- package/package.json +121 -0
- package/src/completed-list/completed-list.component.tsx +242 -0
- package/src/completed-list/completed-list.resource.ts +0 -0
- package/src/completed-list/completed-list.scss +232 -0
- package/src/components/create-dashboard-link.component.tsx +44 -0
- package/src/components/overlay/hook.ts +47 -0
- package/src/components/overlay/overlay.component.tsx +52 -0
- package/src/components/overlay/overlay.scss +93 -0
- package/src/config-schema.ts +36 -0
- package/src/constants.ts +5 -0
- package/src/declarations.d.ts +6 -0
- package/src/header/laboratory-header.component.tsx +35 -0
- package/src/header/laboratory-header.scss +68 -0
- package/src/header/laboratory-illustration.component.tsx +13 -0
- package/src/index.ts +92 -0
- package/src/laboratory.component.tsx +18 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.component.tsx +39 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.resource.ts +290 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.scss +0 -0
- package/src/patient-chart/laboratory-order.component.tsx +453 -0
- package/src/patient-chart/laboratory-order.resource.ts +437 -0
- package/src/patient-chart/laboratory-order.scss +66 -0
- package/src/patient-chart/results-summary/print-results-summary.component.tsx +240 -0
- package/src/patient-chart/results-summary/print-results-summary.scss +105 -0
- package/src/patient-chart/results-summary/print-results-table.component.tsx +163 -0
- package/src/patient-chart/results-summary/results/results.component.tsx +25 -0
- package/src/patient-chart/results-summary/results/results.resource.ts +50 -0
- package/src/patient-chart/results-summary/results/results.scss +0 -0
- package/src/patient-chart/results-summary/results-dialog/edit-results-dialog.component.tsx +46 -0
- package/src/patient-chart/results-summary/results-summary.component.tsx +98 -0
- package/src/patient-chart/results-summary/results-summary.resource.tsx +185 -0
- package/src/patient-chart/results-summary/results-summary.scss +154 -0
- package/src/patient-chart/results-summary/send-email-dialog.component.tsx +111 -0
- package/src/patient-chart/results-summary/test-children-results.component.tsx +221 -0
- package/src/patient-chart/results-summary/test-print-results-table.component.tsx +148 -0
- package/src/patient-chart/results-summary/test-results-delete-action-menu.component.tsx +27 -0
- package/src/patient-chart/results-summary/test-results-rescend-action-menu.component.tsx +26 -0
- package/src/patient-chart/results-summary/test-results-table.component.tsx +153 -0
- package/src/patient-chart/results-summary/tests-children-detail.component.tsx +54 -0
- package/src/patient-chart/results-summary/views/email.handlebars +13 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +323 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts +155 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.scss +20 -0
- package/src/queue-list/lab-tests/lab-tests.component.tsx +116 -0
- package/src/queue-list/lab-tests/lab-tests.resource.ts +17 -0
- package/src/queue-list/lab-tests/lab-tests.scss +12 -0
- package/src/queue-list/laboratory-patient-list.component.tsx +277 -0
- package/src/queue-list/laboratory-patient-list.resource.ts +86 -0
- package/src/queue-list/laboratory-queue.component.tsx +120 -0
- package/src/queue-list/laboratory-queue.scss +213 -0
- package/src/queue-list/laboratory-tabs.component.tsx +81 -0
- package/src/queue-list/pick-lab-request-menu.component.tsx +38 -0
- package/src/reject-order/reject-order-dialog.component.tsx +114 -0
- package/src/reject-order/reject-order-dialog.resource.ts +14 -0
- package/src/reject-order/reject-order-dialog.scss +14 -0
- package/src/results/result-form.component.tsx +223 -0
- package/src/results/result-form.resource.ts +328 -0
- package/src/results/result-form.scss +19 -0
- package/src/review-list/dialog/review-item.component.tsx +283 -0
- package/src/review-list/dialog/review-item.resource.ts +14 -0
- package/src/review-list/dialog/review-item.scss +0 -0
- package/src/review-list/review-list.component.tsx +277 -0
- package/src/review-list/review-list.resource.ts +0 -0
- package/src/review-list/review-list.scss +189 -0
- package/src/root.component.tsx +15 -0
- package/src/root.scss +50 -0
- package/src/routes.json +72 -0
- package/src/setup-tests.ts +1 -0
- package/src/summary-tiles/laboratory-summary-tiles.component.tsx +53 -0
- package/src/summary-tiles/laboratory-summary-tiles.scss +12 -0
- package/src/summary-tiles/laboratory-summary.resource.tsx +50 -0
- package/src/summary-tiles/summary-tile.component.tsx +48 -0
- package/src/summary-tiles/summary-tile.scss +43 -0
- package/src/types/index.ts +412 -0
- package/src/types/patient-queues.ts +189 -0
- package/src/utils/functions.ts +246 -0
- package/src/work-list/work-list.component.tsx +310 -0
- package/src/work-list/work-list.resource.ts +136 -0
- package/src/work-list/work-list.scss +215 -0
- package/translations/en.json +16 -0
- package/translations/es.json +3 -0
- package/translations/fr.json +3 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +29 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
DataTableSkeleton,
|
|
5
|
+
Form,
|
|
6
|
+
ModalBody,
|
|
7
|
+
ModalFooter,
|
|
8
|
+
} from "@carbon/react";
|
|
9
|
+
import { Printer, MailAll, Edit } from "@carbon/react/icons";
|
|
10
|
+
import styles from "./results-summary.scss";
|
|
11
|
+
import TestsResults from "./test-results-table.component";
|
|
12
|
+
import { useReactToPrint } from "react-to-print";
|
|
13
|
+
import { EncounterResponse } from "../laboratory-item/view-laboratory-item.resource";
|
|
14
|
+
import PrintResultsSummary from "./print-results-summary.component";
|
|
15
|
+
import { formatDate, parseDate, showModal } from "@openmrs/esm-framework";
|
|
16
|
+
import { useTranslation } from "react-i18next";
|
|
17
|
+
import { Order } from "../laboratory-order.resource";
|
|
18
|
+
|
|
19
|
+
interface ResultsSummaryProps {
|
|
20
|
+
encounter: EncounterResponse;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const ResultsSummary: React.FC<ResultsSummaryProps> = ({ encounter }) => {
|
|
24
|
+
const { t } = useTranslation();
|
|
25
|
+
// get encouter details
|
|
26
|
+
// const { encounter, isLoading, isError } = useGetEncounterById(encounterUuid);
|
|
27
|
+
|
|
28
|
+
// print button
|
|
29
|
+
|
|
30
|
+
// email button
|
|
31
|
+
|
|
32
|
+
// if (encounter) {
|
|
33
|
+
// return <DataTableSkeleton role="progressbar" />;
|
|
34
|
+
// }
|
|
35
|
+
// if (isError) {
|
|
36
|
+
// return <ErrorState error={isError} headerTitle={"Error"} />;
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
const obsData = encounter.obs.filter((ob) => ob?.order?.type === "testorder");
|
|
40
|
+
|
|
41
|
+
if (encounter) {
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
<Form>
|
|
45
|
+
<ModalBody>
|
|
46
|
+
<section className={styles.section}>
|
|
47
|
+
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
|
48
|
+
<div></div>
|
|
49
|
+
<div style={{ display: "flex", flexDirection: "row" }}>
|
|
50
|
+
{/* <PrintButtonAction /> */}
|
|
51
|
+
{/* <EmailButtonAction /> */}
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
<section className={styles.section}>
|
|
56
|
+
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
57
|
+
<span style={{ margin: "5px" }}>
|
|
58
|
+
Date :{" "}
|
|
59
|
+
{formatDate(parseDate(encounter.encounterDatetime), {
|
|
60
|
+
time: true,
|
|
61
|
+
})}
|
|
62
|
+
</span>
|
|
63
|
+
<span style={{ margin: "5px" }}>
|
|
64
|
+
Ordered By : {encounter?.auditInfo?.creator?.display}
|
|
65
|
+
</span>
|
|
66
|
+
</div>
|
|
67
|
+
</section>
|
|
68
|
+
<section className={styles.section}>
|
|
69
|
+
<div
|
|
70
|
+
style={{
|
|
71
|
+
display: "flex",
|
|
72
|
+
justifyContent: "space-between",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<div>
|
|
77
|
+
<span> Results Ordered</span>
|
|
78
|
+
</div>
|
|
79
|
+
<div>
|
|
80
|
+
{/* <EditButtonAction encounterResponse={encounter} /> */}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</section>
|
|
84
|
+
<section className={styles.section}>
|
|
85
|
+
{/* <TestsResults obs={obsData} /> */}
|
|
86
|
+
</section>
|
|
87
|
+
</ModalBody>
|
|
88
|
+
{/* <ModalFooter>
|
|
89
|
+
<Button kind="secondary">{t("cancel", "Cancel")}</Button>
|
|
90
|
+
<Button type="submit">{t("results", "Save")}</Button>
|
|
91
|
+
</ModalFooter> */}
|
|
92
|
+
</Form>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default ResultsSummary;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { openmrsFetch } from "@openmrs/esm-framework";
|
|
2
|
+
import { ObsMetaInfo } from "@openmrs/esm-patient-common-lib";
|
|
3
|
+
|
|
4
|
+
import useSWR from "swr";
|
|
5
|
+
|
|
6
|
+
export type ObservationInterpretation =
|
|
7
|
+
| "critically_low"
|
|
8
|
+
| "critically_high"
|
|
9
|
+
| "high"
|
|
10
|
+
| "low"
|
|
11
|
+
| "normal";
|
|
12
|
+
|
|
13
|
+
export interface ConceptResponse {
|
|
14
|
+
uuid: string;
|
|
15
|
+
display: string;
|
|
16
|
+
name: Name;
|
|
17
|
+
datatype: Datatype;
|
|
18
|
+
conceptClass: ConceptClass;
|
|
19
|
+
set: boolean;
|
|
20
|
+
version: any;
|
|
21
|
+
retired: boolean;
|
|
22
|
+
names: Name2[];
|
|
23
|
+
descriptions: Description[];
|
|
24
|
+
mappings: Mapping[];
|
|
25
|
+
answers: any[];
|
|
26
|
+
setMembers: any[];
|
|
27
|
+
auditInfo: AuditInfo;
|
|
28
|
+
hiNormal: number;
|
|
29
|
+
hiAbsolute: number;
|
|
30
|
+
hiCritical: number;
|
|
31
|
+
lowNormal: number;
|
|
32
|
+
lowAbsolute: number;
|
|
33
|
+
lowCritical: number;
|
|
34
|
+
units: string;
|
|
35
|
+
allowDecimal: boolean;
|
|
36
|
+
displayPrecision: any;
|
|
37
|
+
attributes: any[];
|
|
38
|
+
links: Link[];
|
|
39
|
+
resourceVersion: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface Name {
|
|
43
|
+
display: string;
|
|
44
|
+
uuid: string;
|
|
45
|
+
name: string;
|
|
46
|
+
locale: string;
|
|
47
|
+
localePreferred: boolean;
|
|
48
|
+
conceptNameType: string;
|
|
49
|
+
links: Link[];
|
|
50
|
+
resourceVersion: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface Link {
|
|
54
|
+
rel: string;
|
|
55
|
+
uri: string;
|
|
56
|
+
resourceAlias: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface Datatype {
|
|
60
|
+
uuid: string;
|
|
61
|
+
display: string;
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
hl7Abbreviation: string;
|
|
65
|
+
retired: boolean;
|
|
66
|
+
links: Link[];
|
|
67
|
+
resourceVersion: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ConceptClass {
|
|
71
|
+
uuid: string;
|
|
72
|
+
display: string;
|
|
73
|
+
name: string;
|
|
74
|
+
description: string;
|
|
75
|
+
retired: boolean;
|
|
76
|
+
links: Link[];
|
|
77
|
+
resourceVersion: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface Name2 {
|
|
81
|
+
display: string;
|
|
82
|
+
uuid: string;
|
|
83
|
+
name: string;
|
|
84
|
+
locale: string;
|
|
85
|
+
localePreferred: boolean;
|
|
86
|
+
conceptNameType?: string;
|
|
87
|
+
links: Link[];
|
|
88
|
+
resourceVersion: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface Description {
|
|
92
|
+
display: string;
|
|
93
|
+
uuid: string;
|
|
94
|
+
description: string;
|
|
95
|
+
locale: string;
|
|
96
|
+
links: Link[];
|
|
97
|
+
resourceVersion: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Mapping {
|
|
101
|
+
display: string;
|
|
102
|
+
uuid: string;
|
|
103
|
+
conceptReferenceTerm: ConceptReferenceTerm;
|
|
104
|
+
conceptMapType: ConceptMapType;
|
|
105
|
+
links: Link[];
|
|
106
|
+
resourceVersion: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface ConceptReferenceTerm {
|
|
110
|
+
uuid: string;
|
|
111
|
+
display: string;
|
|
112
|
+
links: Link[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface ConceptMapType {
|
|
116
|
+
uuid: string;
|
|
117
|
+
display: string;
|
|
118
|
+
links: Link[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface AuditInfo {
|
|
122
|
+
creator: Creator;
|
|
123
|
+
dateCreated: string;
|
|
124
|
+
changedBy: ChangedBy;
|
|
125
|
+
dateChanged: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface Creator {
|
|
129
|
+
uuid: string;
|
|
130
|
+
display: string;
|
|
131
|
+
links: Link[];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface ChangedBy {
|
|
135
|
+
uuid: string;
|
|
136
|
+
display: string;
|
|
137
|
+
links: Link[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function assessValue(
|
|
141
|
+
value: number,
|
|
142
|
+
range: ObsMetaInfo
|
|
143
|
+
): ObservationInterpretation {
|
|
144
|
+
if (range?.hiCritical && value >= range.hiCritical) {
|
|
145
|
+
return "critically_high";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (range?.hiNormal && value > range.hiNormal) {
|
|
149
|
+
return "high";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (range?.lowCritical && value <= range.lowCritical) {
|
|
153
|
+
return "critically_low";
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (range?.lowNormal && value < range.lowNormal) {
|
|
157
|
+
return "low";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return "normal";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function useGetConceptById(conceptUuid: string) {
|
|
164
|
+
const apiUrl = `/ws/rest/v1/concept/${conceptUuid}?v=full`;
|
|
165
|
+
const { data, error, isLoading } = useSWR<{ data: ConceptResponse }, Error>(
|
|
166
|
+
apiUrl,
|
|
167
|
+
openmrsFetch
|
|
168
|
+
);
|
|
169
|
+
return {
|
|
170
|
+
concept: data?.data,
|
|
171
|
+
isLoading,
|
|
172
|
+
isError: error,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export async function GetPatientByUuid(uuid: string) {
|
|
177
|
+
const abortController = new AbortController();
|
|
178
|
+
|
|
179
|
+
return openmrsFetch(`/ws/rest/v1/patient/${uuid}`, {
|
|
180
|
+
headers: {
|
|
181
|
+
"Content-Type": "application/json",
|
|
182
|
+
},
|
|
183
|
+
signal: abortController.signal,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@use '@carbon/styles/scss/colors';
|
|
4
|
+
@import "~@openmrs/esm-styleguide/src/vars";
|
|
5
|
+
@import '../../root.scss';
|
|
6
|
+
|
|
7
|
+
.section {
|
|
8
|
+
margin: 5px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.headerBtnContainer {
|
|
12
|
+
background-color: $ui-background;
|
|
13
|
+
padding: spacing.$spacing-05;
|
|
14
|
+
text-align: right;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tileContainer {
|
|
18
|
+
background-color: $ui-02;
|
|
19
|
+
border-top: 1px solid $ui-03;
|
|
20
|
+
padding: 5rem 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tile {
|
|
24
|
+
margin: auto;
|
|
25
|
+
width: fit-content;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tileContent {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.content {
|
|
35
|
+
@include type.type-style('heading-compact-02');
|
|
36
|
+
color: $text-02;
|
|
37
|
+
margin-bottom: 0.5rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.helper {
|
|
41
|
+
@include type.type-style('body-compact-01');
|
|
42
|
+
color: $text-02;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.separator {
|
|
46
|
+
@include type.type-style('body-compact-02');
|
|
47
|
+
color: $text-02;
|
|
48
|
+
width: 80%;
|
|
49
|
+
margin: 1.5rem auto;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
text-align: center;
|
|
52
|
+
|
|
53
|
+
&::before,
|
|
54
|
+
&::after {
|
|
55
|
+
background-color: $text-03;
|
|
56
|
+
content: '';
|
|
57
|
+
display: inline-block;
|
|
58
|
+
height: 1px;
|
|
59
|
+
position: relative;
|
|
60
|
+
vertical-align: middle;
|
|
61
|
+
width: 50%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&::before {
|
|
65
|
+
right: 0.5rem;
|
|
66
|
+
margin-left: -50%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&::after {
|
|
70
|
+
left: 0.5rem;
|
|
71
|
+
margin-right: -50%;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
td {
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.criticallyLow, .criticallyHigh, .low, .high {
|
|
81
|
+
td:nth-child(2) {
|
|
82
|
+
@include type.type-style("heading-compact-01");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.criticallyLow, .criticallyHigh {
|
|
87
|
+
border: 2px solid colors.$red-60 !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.low, .high {
|
|
91
|
+
border: 1.5px solid colors.$black-100 !important;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.criticallyLow {
|
|
95
|
+
td:nth-child(2)::after {
|
|
96
|
+
content: " ↓↓";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.criticallyHigh {
|
|
101
|
+
td:nth-child(2)::after {
|
|
102
|
+
content: " ↑↑";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.low {
|
|
107
|
+
td:nth-child(2)::after {
|
|
108
|
+
content: " ↓";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.high {
|
|
113
|
+
td:nth-child(2)::after {
|
|
114
|
+
content: " ↑";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.off-scale-low {
|
|
119
|
+
td:nth-child(2)::after {
|
|
120
|
+
content: " ↓↓↓";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.off-scale-high {
|
|
125
|
+
td:nth-child(2)::after {
|
|
126
|
+
content: " ↑↑↑";
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.offScaleHigh,
|
|
131
|
+
.offScaleLow,
|
|
132
|
+
.criticallyHigh,
|
|
133
|
+
.criticallyLow,
|
|
134
|
+
.high,
|
|
135
|
+
.low {
|
|
136
|
+
@include type.type-style('heading-compact-01');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.criticallyLow::after {
|
|
140
|
+
content: " ↓↓";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.criticallyHigh::after {
|
|
144
|
+
content: " ↑↑";
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.low::after {
|
|
148
|
+
content: " ↓";
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.high::after {
|
|
152
|
+
content: " ↑";
|
|
153
|
+
}
|
|
154
|
+
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Form,
|
|
4
|
+
ModalBody,
|
|
5
|
+
ModalFooter,
|
|
6
|
+
ModalHeader,
|
|
7
|
+
TextInput,
|
|
8
|
+
FileUploader,
|
|
9
|
+
} from "@carbon/react";
|
|
10
|
+
import React, { useState } from "react";
|
|
11
|
+
// import nodemailer from "nodemailer";
|
|
12
|
+
import { useTranslation } from "react-i18next";
|
|
13
|
+
// import hbs from "nodemailer-express-handlebars";
|
|
14
|
+
import path from "path";
|
|
15
|
+
import { showNotification, showToast } from "@openmrs/esm-framework";
|
|
16
|
+
|
|
17
|
+
interface SendEmailDialogProps {
|
|
18
|
+
closeModal: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const SendEmailDialog: React.FC<SendEmailDialogProps> = ({ closeModal }) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
|
|
24
|
+
const [email, setEmail] = useState();
|
|
25
|
+
const [file, setFile] = useState();
|
|
26
|
+
|
|
27
|
+
// generate pdf
|
|
28
|
+
|
|
29
|
+
const sendEmail = async () => {
|
|
30
|
+
// initialize nodemailer
|
|
31
|
+
// var transporter = nodemailer.createTransport({
|
|
32
|
+
// service: "gmail",
|
|
33
|
+
// secure: true,
|
|
34
|
+
// tls: {
|
|
35
|
+
// rejectUnauthorized: false,
|
|
36
|
+
// },
|
|
37
|
+
// auth: {
|
|
38
|
+
// user: "services.ugandaemr@gmail.com",
|
|
39
|
+
// pass: "Admin1234_",
|
|
40
|
+
// },
|
|
41
|
+
// });
|
|
42
|
+
// // point to the template folder
|
|
43
|
+
// const handlebarOptions = {
|
|
44
|
+
// viewEngine: {
|
|
45
|
+
// extname: ".hbs",
|
|
46
|
+
// layoutsDir: "views/",
|
|
47
|
+
// defaultLayout: "template",
|
|
48
|
+
// partialsDir: "views/partials/",
|
|
49
|
+
// },
|
|
50
|
+
// viewPath: "views/",
|
|
51
|
+
// extName: ".hbs",
|
|
52
|
+
// };
|
|
53
|
+
// transporter.use("compile", hbs(handlebarOptions));
|
|
54
|
+
// const mailOptions = {
|
|
55
|
+
// from: "services.ugandaemr@gmail.com",
|
|
56
|
+
// to: email,
|
|
57
|
+
// subject: `Tests results`,
|
|
58
|
+
// attachments: [{ filename: "testResults.pdf", path: file }],
|
|
59
|
+
// };
|
|
60
|
+
// transporter.sendMail(mailOptions, (error, info) => {
|
|
61
|
+
// if (error) {
|
|
62
|
+
// showNotification({
|
|
63
|
+
// title: `Error in sending results`,
|
|
64
|
+
// kind: "error",
|
|
65
|
+
// critical: true,
|
|
66
|
+
// description: error?.message,
|
|
67
|
+
// });
|
|
68
|
+
// } else {
|
|
69
|
+
// showToast({
|
|
70
|
+
// critical: true,
|
|
71
|
+
// title: `Sent Test Results`,
|
|
72
|
+
// kind: "success",
|
|
73
|
+
// description: `Test results sent Successfully`,
|
|
74
|
+
// });
|
|
75
|
+
// }
|
|
76
|
+
// });
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
<Form onSubmit={sendEmail}>
|
|
82
|
+
<ModalHeader
|
|
83
|
+
closeModal={closeModal}
|
|
84
|
+
title={t("sendResults", "Send Results")}
|
|
85
|
+
/>
|
|
86
|
+
<ModalBody>
|
|
87
|
+
<>
|
|
88
|
+
<div>
|
|
89
|
+
<TextInput
|
|
90
|
+
id="text-input-email"
|
|
91
|
+
invalidText="Error message goes here"
|
|
92
|
+
labelText="Email"
|
|
93
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
94
|
+
size="md"
|
|
95
|
+
type="email"
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
</>
|
|
99
|
+
</ModalBody>
|
|
100
|
+
<ModalFooter>
|
|
101
|
+
<Button kind="secondary" onClick={closeModal}>
|
|
102
|
+
{t("cancel", "Cancel")}
|
|
103
|
+
</Button>
|
|
104
|
+
<Button type="submit">{t("sendEmail", "Send Email")}</Button>
|
|
105
|
+
</ModalFooter>
|
|
106
|
+
</Form>
|
|
107
|
+
</>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default SendEmailDialog;
|