@openmrs/esm-fast-data-entry-app 1.0.0-pre.11 → 1.0.0-pre.17
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/dist/132.js +1 -0
- package/dist/294.js +1 -2
- package/dist/338.js +2 -0
- package/dist/{382.js.LICENSE.txt → 338.js.LICENSE.txt} +0 -0
- package/dist/350.js +1 -0
- package/dist/418.js +1 -0
- package/dist/482.js +1 -0
- package/dist/595.js +1 -2
- package/dist/666.js +1 -0
- package/dist/767.js +2 -0
- package/dist/{502.js.LICENSE.txt → 767.js.LICENSE.txt} +0 -30
- package/dist/776.js +1 -0
- package/dist/804.js +1 -0
- package/dist/906.js +2 -2
- package/dist/906.js.LICENSE.txt +27 -0
- package/dist/935.js +2 -0
- package/dist/935.js.LICENSE.txt +23 -0
- package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +163 -106
- package/dist/openmrs-esm-fast-data-entry-app.old +1 -2
- package/package.json +31 -33
- package/src/FormEntry.tsx +42 -0
- package/src/Loader.tsx +16 -0
- package/src/Root.tsx +7 -3
- package/src/forms/FormWorkflow.tsx +135 -0
- package/src/forms/FormsRoot.tsx +1 -5
- package/src/forms/FormsTable.tsx +2 -2
- package/src/forms/PatientCard.tsx +37 -0
- package/src/forms/PatientInfo.test.tsx +9 -0
- package/src/forms/PatientInfo.tsx +140 -0
- package/src/forms/patient-info.scss +59 -0
- package/src/forms/styles.scss +13 -0
- package/src/forms/useGetPatient.ts +23 -0
- package/src/index.ts +13 -1
- package/src/loader.scss +9 -0
- package/tsconfig.json +26 -23
- package/.husky/pre-commit +0 -6
- package/.husky/pre-push +0 -6
- package/dist/24.js +0 -3
- package/dist/24.js.LICENSE.txt +0 -16
- package/dist/24.js.map +0 -1
- package/dist/294.js.map +0 -1
- package/dist/296.js +0 -2
- package/dist/296.js.map +0 -1
- package/dist/299.js +0 -2
- package/dist/299.js.map +0 -1
- package/dist/382.js +0 -3
- package/dist/382.js.map +0 -1
- package/dist/415.js +0 -2
- package/dist/415.js.map +0 -1
- package/dist/502.js +0 -3
- package/dist/502.js.map +0 -1
- package/dist/595.js.map +0 -1
- package/dist/69.js +0 -2
- package/dist/69.js.map +0 -1
- package/dist/777.js +0 -2
- package/dist/777.js.map +0 -1
- package/dist/860.js +0 -2
- package/dist/860.js.map +0 -1
- package/dist/906.js.map +0 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.map +0 -1
- package/src/patient-getter/patient-getter.resource.ts +0 -31
- package/src/patient-getter/patient-getter.test.tsx +0 -28
- package/src/patient-getter/patient-getter.tsx +0 -28
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ExtensionSlot } from "@openmrs/esm-framework";
|
|
3
|
+
import useGetPatient from "./forms/useGetPatient";
|
|
4
|
+
interface FormParams {
|
|
5
|
+
formUuid: string;
|
|
6
|
+
patientUuid: string;
|
|
7
|
+
visitUuid?: string;
|
|
8
|
+
visitTypeUuid?: string;
|
|
9
|
+
encounterUuid?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const FormEntry = ({
|
|
13
|
+
formUuid,
|
|
14
|
+
patientUuid,
|
|
15
|
+
visitUuid,
|
|
16
|
+
visitTypeUuid,
|
|
17
|
+
encounterUuid,
|
|
18
|
+
}: FormParams) => {
|
|
19
|
+
const patient = useGetPatient(patientUuid);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div>
|
|
23
|
+
{formUuid && patientUuid && patient && (
|
|
24
|
+
<ExtensionSlot
|
|
25
|
+
extensionSlotName="form-widget-slot"
|
|
26
|
+
state={{
|
|
27
|
+
view: "form",
|
|
28
|
+
formUuid,
|
|
29
|
+
visitUuid: visitUuid ?? "",
|
|
30
|
+
visitTypeUuid: visitTypeUuid ?? "",
|
|
31
|
+
patientUuid,
|
|
32
|
+
patient,
|
|
33
|
+
encounterUuid: encounterUuid ?? "",
|
|
34
|
+
closeWorkspace: () => {},
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default FormEntry;
|
package/src/Loader.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styles from "./loader.scss";
|
|
3
|
+
import { InlineLoading } from "carbon-components-react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
|
|
6
|
+
const Loader: React.FC = () => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
return (
|
|
9
|
+
<InlineLoading
|
|
10
|
+
className={styles.loading}
|
|
11
|
+
description={`${t("loading", "Loading")} ...`}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default Loader;
|
package/src/Root.tsx
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { BrowserRouter, Route } from "react-router-dom";
|
|
2
|
+
import { BrowserRouter, Route, Switch } from "react-router-dom";
|
|
3
3
|
import { appPath } from "./constant";
|
|
4
|
-
|
|
4
|
+
const FormsRoot = React.lazy(() => import("./forms/FormsRoot"));
|
|
5
|
+
const FormWorkflow = React.lazy(() => import("./forms/FormWorkflow"));
|
|
5
6
|
|
|
6
7
|
const Root = () => {
|
|
7
8
|
return (
|
|
8
9
|
<main>
|
|
9
10
|
<BrowserRouter basename={appPath}>
|
|
10
|
-
<
|
|
11
|
+
<Switch>
|
|
12
|
+
<Route exact path="/" children={<FormsRoot />} />
|
|
13
|
+
<Route path="/:formUuid?" children={<FormWorkflow />} />
|
|
14
|
+
</Switch>
|
|
11
15
|
</BrowserRouter>
|
|
12
16
|
</main>
|
|
13
17
|
);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Add20, Close20 } from "@carbon/icons-react";
|
|
2
|
+
import { ExtensionSlot } from "@openmrs/esm-framework";
|
|
3
|
+
import { Button } from "carbon-components-react";
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import { useParams } from "react-router-dom";
|
|
6
|
+
import FormEntry from "../FormEntry";
|
|
7
|
+
import PatientCard from "./PatientCard";
|
|
8
|
+
import PatientInfo from "./PatientInfo";
|
|
9
|
+
import styles from "./styles.scss";
|
|
10
|
+
|
|
11
|
+
const PatientSearchHeader = ({
|
|
12
|
+
patientUuids,
|
|
13
|
+
setPatientUuids,
|
|
14
|
+
setActivePatientUuid,
|
|
15
|
+
}) => {
|
|
16
|
+
const handleSelectPatient = (uuid) => {
|
|
17
|
+
setPatientUuids([...patientUuids, uuid]), setActivePatientUuid(uuid);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
display: "flex",
|
|
24
|
+
backgroundColor: "white",
|
|
25
|
+
padding: "2rem 1rem",
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<span style={{ padding: "1rem" }}>Next patient:</span>
|
|
29
|
+
<span style={{ minWidth: "35rem" }}>
|
|
30
|
+
<ExtensionSlot
|
|
31
|
+
extensionSlotName="patient-search-bar-slot"
|
|
32
|
+
state={{
|
|
33
|
+
selectPatientAction: handleSelectPatient,
|
|
34
|
+
buttonProps: {
|
|
35
|
+
kind: "primary",
|
|
36
|
+
},
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
</span>
|
|
40
|
+
<span style={{ padding: "1rem" }}>or</span>
|
|
41
|
+
<span>
|
|
42
|
+
<Button disabled>
|
|
43
|
+
Create new patient <Add20 />
|
|
44
|
+
</Button>
|
|
45
|
+
</span>
|
|
46
|
+
<span style={{ flexGrow: 1 }} />
|
|
47
|
+
<span>
|
|
48
|
+
<Button kind="ghost" disabled>
|
|
49
|
+
Cancel <Close20 />
|
|
50
|
+
</Button>
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
interface ParamTypes {
|
|
57
|
+
formUuid: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const FormWorkflow = () => {
|
|
61
|
+
const { formUuid } = useParams() as ParamTypes;
|
|
62
|
+
const [patientUuids, setPatientUuids] = useState([]);
|
|
63
|
+
const [activePatientUuid, setActivePatientUuid] = useState(null);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div>
|
|
67
|
+
<div className={styles.breadcrumbsContainer}>
|
|
68
|
+
<ExtensionSlot extensionSlotName="breadcrumbs-slot" />
|
|
69
|
+
</div>
|
|
70
|
+
{!activePatientUuid && (
|
|
71
|
+
<PatientSearchHeader
|
|
72
|
+
{...{ patientUuids, setPatientUuids, setActivePatientUuid }}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
{activePatientUuid && <PatientInfo patientUuid={activePatientUuid} />}
|
|
76
|
+
<div style={{ display: "flex", justifyContent: "center" }}>
|
|
77
|
+
<div style={{ width: "1100px" }}>
|
|
78
|
+
{!patientUuids.length && (
|
|
79
|
+
<div style={{ margin: "2rem", textAlign: "center" }}>
|
|
80
|
+
Please select a patient first
|
|
81
|
+
</div>
|
|
82
|
+
)}
|
|
83
|
+
{!!patientUuids.length && (
|
|
84
|
+
<div className={styles.formContainer}>
|
|
85
|
+
<div style={{ flexGrow: 1 }}>
|
|
86
|
+
<FormEntry
|
|
87
|
+
patientUuid={activePatientUuid}
|
|
88
|
+
{...{
|
|
89
|
+
formUuid,
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
<div style={{ width: "13rem", textAlign: "left" }}>
|
|
94
|
+
<h4>Forms filled</h4>
|
|
95
|
+
<div
|
|
96
|
+
style={{
|
|
97
|
+
margin: "1rem 0",
|
|
98
|
+
borderBottom: "1px solid #f4f4f4",
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
{patientUuids.map((patientUuid) => (
|
|
102
|
+
<PatientCard patientUuid={patientUuid} key={patientUuid} />
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
<div
|
|
106
|
+
style={{
|
|
107
|
+
display: "flex",
|
|
108
|
+
flexDirection: "column",
|
|
109
|
+
rowGap: "0.5rem",
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<Button
|
|
113
|
+
kind="primary"
|
|
114
|
+
onClick={() => setActivePatientUuid(null)}
|
|
115
|
+
style={{ width: "100%" }}
|
|
116
|
+
>
|
|
117
|
+
Next Patient
|
|
118
|
+
</Button>
|
|
119
|
+
<Button kind="secondary" disabled style={{ width: "100%" }}>
|
|
120
|
+
Review & Save
|
|
121
|
+
</Button>
|
|
122
|
+
<Button kind="tertiary" disabled style={{ width: "100%" }}>
|
|
123
|
+
Cancel
|
|
124
|
+
</Button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default FormWorkflow;
|
package/src/forms/FormsRoot.tsx
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { openmrsFetch, useConfig } from "@openmrs/esm-framework";
|
|
2
2
|
import { Tab, Tabs } from "carbon-components-react";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { from } from "rxjs";
|
|
5
4
|
import useSWR from "swr";
|
|
6
5
|
import { Config } from "../config-schema";
|
|
7
6
|
import FormsTable from "./FormsTable";
|
|
8
|
-
import { tableData } from "./mockData";
|
|
9
7
|
|
|
10
8
|
export const customFormRepresentation =
|
|
11
9
|
"(uuid,name,display,encounterType:(uuid,name,viewPrivilege,editPrivilege),version,published,retired,resources:(uuid,name,dataType,valueReference))";
|
|
@@ -38,12 +36,10 @@ const cleanForms = (rawFormData) => {
|
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
|
|
41
|
-
const FormsRoot = (
|
|
42
|
-
const { tab } = match?.params;
|
|
39
|
+
const FormsRoot = () => {
|
|
43
40
|
const config = useConfig() as Config;
|
|
44
41
|
const { formCategories, formCategoriesToShow } = config;
|
|
45
42
|
const { data: forms } = useFormEncounters();
|
|
46
|
-
const { rows: mockRows } = tableData;
|
|
47
43
|
const cleanRows = cleanForms(forms);
|
|
48
44
|
|
|
49
45
|
const categoryRows = formCategoriesToShow.map((name) => {
|
package/src/forms/FormsTable.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
TableToolbarSearch,
|
|
14
14
|
} from "carbon-components-react";
|
|
15
15
|
import React from "react";
|
|
16
|
-
import {
|
|
16
|
+
import { Link } from "react-router-dom";
|
|
17
17
|
|
|
18
18
|
const formsHeader = [
|
|
19
19
|
{
|
|
@@ -29,7 +29,7 @@ const formsHeader = [
|
|
|
29
29
|
const FormsTable = ({ rows }) => {
|
|
30
30
|
const augmenteRows = rows?.map((row) => ({
|
|
31
31
|
...row,
|
|
32
|
-
actions:
|
|
32
|
+
actions: <Link to={row.uuid}>Fill Form</Link>,
|
|
33
33
|
}));
|
|
34
34
|
if (!rows || !rows?.length) {
|
|
35
35
|
return <DataTableSkeleton />;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SkeletonText } from "carbon-components-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import useGetPatient from "./useGetPatient";
|
|
4
|
+
|
|
5
|
+
const CardContainer = ({ children }) => {
|
|
6
|
+
return <div style={{ padding: "1rem" }}>{children}</div>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const PatientCard = ({ patientUuid }) => {
|
|
10
|
+
const patient = useGetPatient(patientUuid);
|
|
11
|
+
const givenName = patient?.name?.[0]?.given?.[0];
|
|
12
|
+
const familyName = patient?.name?.[0]?.family;
|
|
13
|
+
const identifier = patient?.identifier?.[0]?.value;
|
|
14
|
+
|
|
15
|
+
if (!patient) {
|
|
16
|
+
return (
|
|
17
|
+
<CardContainer>
|
|
18
|
+
<SkeletonText style={{ maxWidth: "8rem" }} />
|
|
19
|
+
</CardContainer>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<CardContainer>
|
|
25
|
+
<div
|
|
26
|
+
style={{ fontWeight: 300, fontSize: "0.8rem", lineHeight: "0.9rem" }}
|
|
27
|
+
>
|
|
28
|
+
{identifier}
|
|
29
|
+
</div>
|
|
30
|
+
<div style={{ fontWeight: "bold" }}>
|
|
31
|
+
{givenName} {familyName}
|
|
32
|
+
</div>
|
|
33
|
+
</CardContainer>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default PatientCard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import PatientInfo from "./PatientInfo";
|
|
4
|
+
|
|
5
|
+
describe("PatientInfo", () => {
|
|
6
|
+
it("renders placeholder information when no data is present", () => {
|
|
7
|
+
render(<PatientInfo patientUuid={null} />);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
age,
|
|
3
|
+
ExtensionSlot,
|
|
4
|
+
formatDate,
|
|
5
|
+
parseDate,
|
|
6
|
+
} from "@openmrs/esm-framework";
|
|
7
|
+
import {
|
|
8
|
+
Button,
|
|
9
|
+
SkeletonPlaceholder,
|
|
10
|
+
SkeletonText,
|
|
11
|
+
} from "carbon-components-react";
|
|
12
|
+
import React, { useState } from "react";
|
|
13
|
+
import styles from "./patient-info.scss";
|
|
14
|
+
import ChevronDown16 from "@carbon/icons-react/es/chevron--down/16";
|
|
15
|
+
import ChevronUp16 from "@carbon/icons-react/es/chevron--up/16";
|
|
16
|
+
import { useTranslation } from "react-i18next";
|
|
17
|
+
import useGetPatient from "./useGetPatient";
|
|
18
|
+
interface PatientInfoProps {
|
|
19
|
+
patientUuid: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const SkeletonPatientInfo = () => {
|
|
23
|
+
return (
|
|
24
|
+
<div className={styles.container}>
|
|
25
|
+
<div className={styles.patientInfoContainer}>
|
|
26
|
+
<SkeletonPlaceholder />
|
|
27
|
+
<div className={styles.patientInfoContent}>
|
|
28
|
+
<div className={styles.patientInfoRow}>
|
|
29
|
+
<span className={styles.patientName}>
|
|
30
|
+
<SkeletonText />
|
|
31
|
+
</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div className={styles.patientInfoRow}>
|
|
34
|
+
<div className={styles.demographics}>
|
|
35
|
+
<span>
|
|
36
|
+
<SkeletonText />
|
|
37
|
+
</span>
|
|
38
|
+
<span>
|
|
39
|
+
<SkeletonText />
|
|
40
|
+
</span>
|
|
41
|
+
<span>
|
|
42
|
+
<SkeletonText />
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div className={styles.patientInfoRow}>
|
|
47
|
+
<span className={styles.identifier}>
|
|
48
|
+
<SkeletonText />
|
|
49
|
+
</span>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const PatientInfo: React.FC<PatientInfoProps> = ({ patientUuid }) => {
|
|
58
|
+
const patient = useGetPatient(patientUuid);
|
|
59
|
+
const { t } = useTranslation();
|
|
60
|
+
const [showContactDetails, setShowContactDetails] = useState<boolean>(false);
|
|
61
|
+
const patientName = `${patient?.name?.[0].given?.join(" ")} ${
|
|
62
|
+
patient?.name?.[0]?.family
|
|
63
|
+
}`;
|
|
64
|
+
|
|
65
|
+
const patientPhotoSlotState = React.useMemo(
|
|
66
|
+
() => ({ patientUuid: patient?.id, patientName }),
|
|
67
|
+
[patient?.id, patientName]
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const toggleShowMore = (e: React.MouseEvent) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
setShowContactDetails((prevState) => !prevState);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
if (!patient) {
|
|
76
|
+
return <SkeletonPatientInfo />;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div className={styles.container}>
|
|
81
|
+
<div
|
|
82
|
+
className={`${
|
|
83
|
+
showContactDetails
|
|
84
|
+
? styles.activePatientInfoContainer
|
|
85
|
+
: styles.patientInfoContainer
|
|
86
|
+
}`}
|
|
87
|
+
>
|
|
88
|
+
<ExtensionSlot
|
|
89
|
+
extensionSlotName="patient-photo-slot"
|
|
90
|
+
state={patientPhotoSlotState}
|
|
91
|
+
/>
|
|
92
|
+
<div className={styles.patientInfoContent}>
|
|
93
|
+
<div className={styles.patientInfoRow}>
|
|
94
|
+
<span className={styles.patientName}>{patientName}</span>
|
|
95
|
+
</div>
|
|
96
|
+
<div className={styles.patientInfoRow}>
|
|
97
|
+
<div className={styles.demographics}>
|
|
98
|
+
<span>
|
|
99
|
+
{(patient.gender ?? t("unknown", "Unknown")).replace(
|
|
100
|
+
/^\w/,
|
|
101
|
+
(c) => c.toUpperCase()
|
|
102
|
+
)}{" "}
|
|
103
|
+
·{" "}
|
|
104
|
+
</span>
|
|
105
|
+
<span>{age(patient.birthDate)} · </span>
|
|
106
|
+
<span>
|
|
107
|
+
{formatDate(parseDate(patient.birthDate), {
|
|
108
|
+
mode: "wide",
|
|
109
|
+
time: false,
|
|
110
|
+
})}
|
|
111
|
+
</span>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
<div className={styles.patientInfoRow}>
|
|
115
|
+
<span className={styles.identifier}>
|
|
116
|
+
{patient.identifier.length
|
|
117
|
+
? patient.identifier
|
|
118
|
+
.map((identifier) => identifier.value)
|
|
119
|
+
.join(", ")
|
|
120
|
+
: "--"}
|
|
121
|
+
</span>
|
|
122
|
+
<Button
|
|
123
|
+
kind="ghost"
|
|
124
|
+
renderIcon={showContactDetails ? ChevronUp16 : ChevronDown16}
|
|
125
|
+
iconDescription="Toggle contact details"
|
|
126
|
+
onClick={(e) => toggleShowMore(e)}
|
|
127
|
+
disabled
|
|
128
|
+
>
|
|
129
|
+
{showContactDetails
|
|
130
|
+
? t("showLess", "Show less")
|
|
131
|
+
: t("showAllDetails", "Show all details")}
|
|
132
|
+
</Button>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default PatientInfo;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
2
|
+
@import '~carbon-components/src/globals/scss/vars';
|
|
3
|
+
@import '~carbon-components/src/globals/scss/mixins';
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
border-bottom: 0.0125rem solid $color-gray-30;
|
|
7
|
+
background-color: $ui-02;
|
|
8
|
+
padding: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.patientInfoContainer {
|
|
12
|
+
padding: 0 0 0 $spacing-05;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
min-height: 7rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.activePatientInfoContainer {
|
|
19
|
+
background-color: $color-blue-10;
|
|
20
|
+
padding: 0 0 0 $spacing-05;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
min-height: 7rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.patientName {
|
|
27
|
+
@include carbon--type-style('productive-heading-03');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.patientInfoContent {
|
|
31
|
+
margin: $spacing-05 0 0 $spacing-05;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.demographics {
|
|
36
|
+
@include carbon--type-style('body-short-02');
|
|
37
|
+
color: $text-02;
|
|
38
|
+
margin-top: $spacing-02;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.identifier {
|
|
42
|
+
@include carbon--type-style('body-short-02');
|
|
43
|
+
color: $ui-04;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.patientInfoRow {
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
align-items: center;
|
|
50
|
+
|
|
51
|
+
& > button {
|
|
52
|
+
min-height: 2rem;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.patientEditBtn {
|
|
57
|
+
color: $ui-05;
|
|
58
|
+
margin: $spacing-03;
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@import "~@openmrs/esm-styleguide/src/vars";
|
|
2
|
+
|
|
3
|
+
.breadcrumbsContainer > div > div > nav {
|
|
4
|
+
background-color: white;
|
|
5
|
+
padding: 0.5rem;
|
|
6
|
+
border-bottom: 1px solid $openmrs-background-grey;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.formContainer {
|
|
10
|
+
display: flex;
|
|
11
|
+
text-align: center;
|
|
12
|
+
margin-top: 1rem;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { fetchCurrentPatient } from "@openmrs/esm-framework";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
const useGetPatient = (patientUuid) => {
|
|
5
|
+
const [patient, setPatient] = useState(null);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!patientUuid) {
|
|
9
|
+
setPatient(null);
|
|
10
|
+
} else {
|
|
11
|
+
getPatient(patientUuid);
|
|
12
|
+
}
|
|
13
|
+
}, [patientUuid]);
|
|
14
|
+
|
|
15
|
+
const getPatient = async (uuid) => {
|
|
16
|
+
const result = await fetchCurrentPatient(uuid);
|
|
17
|
+
setPatient(result?.data);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return patient;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default useGetPatient;
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* microfrontend.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
getAsyncLifecycle,
|
|
10
|
+
defineConfigSchema,
|
|
11
|
+
registerBreadcrumbs,
|
|
12
|
+
} from "@openmrs/esm-framework";
|
|
9
13
|
import { configSchema } from "./config-schema";
|
|
10
14
|
|
|
11
15
|
/**
|
|
@@ -53,6 +57,14 @@ function setupOpenMRS() {
|
|
|
53
57
|
|
|
54
58
|
defineConfigSchema(moduleName, configSchema);
|
|
55
59
|
|
|
60
|
+
registerBreadcrumbs([
|
|
61
|
+
{
|
|
62
|
+
path: `${window.spaBase}/forms`,
|
|
63
|
+
title: "Forms",
|
|
64
|
+
parent: `${window.spaBase}/home`,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
|
|
56
68
|
return {
|
|
57
69
|
pages: [
|
|
58
70
|
{
|
package/src/loader.scss
ADDED
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"esModuleInterop": true,
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"allowSyntheticDefaultImports": true,
|
|
6
|
-
"jsx": "react",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"lib": [
|
|
10
|
-
"dom",
|
|
11
|
-
"es5",
|
|
12
|
-
"scripthost",
|
|
13
|
-
"es2015",
|
|
14
|
-
"es2015.promise",
|
|
15
|
-
"es2016.array.include",
|
|
16
|
-
"es2018",
|
|
17
|
-
"es2020"
|
|
18
|
-
],
|
|
19
|
-
"resolveJsonModule": true,
|
|
20
|
-
"noEmit": true,
|
|
21
|
-
"target": "esnext"
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"allowSyntheticDefaultImports": true,
|
|
6
|
+
"jsx": "react",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"lib": [
|
|
10
|
+
"dom",
|
|
11
|
+
"es5",
|
|
12
|
+
"scripthost",
|
|
13
|
+
"es2015",
|
|
14
|
+
"es2015.promise",
|
|
15
|
+
"es2016.array.include",
|
|
16
|
+
"es2018",
|
|
17
|
+
"es2020"
|
|
18
|
+
],
|
|
19
|
+
"resolveJsonModule": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"target": "esnext",
|
|
22
|
+
// "paths": {
|
|
23
|
+
// "@openmrs/*": ["./node_modules/@openmrs/*"]
|
|
24
|
+
// }
|
|
25
|
+
}
|
|
26
|
+
}
|
package/.husky/pre-commit
DELETED