@openmrs/esm-dispensing-app 1.0.0-pre.4 → 1.0.0-pre.41
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/.github/workflows/node.js.yml +2 -2
- package/.husky/pre-commit +1 -1
- package/.husky/pre-push +1 -3
- package/jest.config.json +4 -4
- package/package.json +30 -40
- package/src/components/history-and-comments.component.tsx +33 -0
- package/src/components/history-and-comments.scss +26 -0
- package/src/components/medication-card.component.tsx +55 -0
- package/src/components/medication-card.scss +26 -0
- package/src/components/order-expanded.component.tsx +65 -0
- package/src/components/order-expanded.scss +46 -0
- package/src/components/patient-details.component.tsx +106 -0
- package/src/components/patient-details.scss +97 -0
- package/src/components/prescription-details.component.tsx +66 -0
- package/src/components/prescription-details.scss +58 -0
- package/src/config-schema.ts +9 -2
- package/src/constants.ts +3 -0
- package/src/declarations.d.tsx +1 -0
- package/src/dispensing-link.tsx +13 -0
- package/src/dispensing-tiles/dispensing-tile.component.tsx +47 -0
- package/src/dispensing-tiles/dispensing-tile.scss +43 -0
- package/src/dispensing-tiles/dispensing-tiles.component.tsx +42 -0
- package/src/dispensing-tiles/dispensing-tiles.resource.tsx +33 -0
- package/src/dispensing-tiles/dispensing-tiles.scss +12 -0
- package/src/dispensing.component.tsx +14 -0
- package/src/{home.test.tsx → dispensing.test.tsx} +3 -16
- package/src/index.ts +15 -32
- package/src/medication-request/medication-request.resource.tsx +183 -0
- package/src/pharmacy-header/pharmacy-header.component.tsx +35 -0
- package/src/pharmacy-header/pharmacy-header.scss +57 -0
- package/src/pharmacy-header/pharmacy-illustration.component.tsx +35 -0
- package/src/prescriptions/prescription-tab-lists.component.tsx +204 -0
- package/src/prescriptions/prescriptions.scss +87 -0
- package/src/root.scss +50 -0
- package/src/types.ts +274 -0
- package/src/utils.ts +40 -0
- package/translations/en.json +10 -1
- package/tsconfig.json +4 -1
- package/babel.config.json +0 -8
- package/dist/16.js +0 -3
- package/dist/16.js.LICENSE.txt +0 -1
- package/dist/16.js.map +0 -1
- package/dist/269.js +0 -2
- package/dist/269.js.map +0 -1
- package/dist/294.js +0 -3
- package/dist/294.js.LICENSE.txt +0 -14
- package/dist/294.js.map +0 -1
- package/dist/476.js +0 -2
- package/dist/476.js.map +0 -1
- package/dist/574.js +0 -1
- package/dist/867.js +0 -2
- package/dist/867.js.map +0 -1
- package/dist/openmrs-esm-dispensing-app.js +0 -1
- package/dist/openmrs-esm-dispensing-app.js.buildmanifest.json +0 -195
- package/dist/openmrs-esm-dispensing-app.js.map +0 -1
- package/dist/openmrs-esm-dispensing-app.old +0 -2
- package/src/home.css +0 -3
- package/src/home.tsx +0 -23
|
@@ -51,9 +51,9 @@ jobs:
|
|
|
51
51
|
with:
|
|
52
52
|
node-version: "16.x"
|
|
53
53
|
registry-url: "https://registry.npmjs.org"
|
|
54
|
-
- run:
|
|
54
|
+
- run: yarn
|
|
55
55
|
- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
|
|
56
|
-
- run:
|
|
56
|
+
- run: yarn publish --access public --tag next
|
|
57
57
|
env:
|
|
58
58
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
59
59
|
|
package/.husky/pre-commit
CHANGED
package/.husky/pre-push
CHANGED
package/jest.config.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"transform": {
|
|
3
|
-
"^.+\\.tsx?$": "
|
|
3
|
+
"^.+\\.tsx?$": "@swc/jest"
|
|
4
4
|
},
|
|
5
5
|
"transformIgnorePatterns": [
|
|
6
6
|
"/node_modules/(?!@openmrs)"
|
|
7
7
|
],
|
|
8
8
|
"moduleNameMapper": {
|
|
9
|
-
"^@carbon/icons-react/es/(.*)$": "@carbon/icons-react/lib/$1",
|
|
10
|
-
"^carbon-components-react/es/(.*)$": "carbon-components-react/lib/$1",
|
|
11
9
|
"@openmrs/esm-framework": "@openmrs/esm-framework/mock",
|
|
12
|
-
"\\.(s?css)$": "identity-obj-proxy"
|
|
10
|
+
"\\.(s?css)$": "identity-obj-proxy",
|
|
11
|
+
"^lodash-es/(.*)$": "lodash/$1",
|
|
12
|
+
"^uuid$": "<rootDir>/node_modules/uuid/dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"setupFilesAfterEnv": [
|
|
15
15
|
"<rootDir>/src/setup-tests.ts"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-dispensing-app",
|
|
3
|
-
"version": "1.0.0-pre.
|
|
3
|
+
"version": "1.0.0-pre.41",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Medication dispensing application",
|
|
6
6
|
"browser": "dist/openmrs-esm-dispensing-app.js",
|
|
@@ -11,18 +11,14 @@
|
|
|
11
11
|
"serve": "webpack serve --mode=development",
|
|
12
12
|
"build": "webpack --mode production",
|
|
13
13
|
"analyze": "webpack --mode=production --env.analyze=true",
|
|
14
|
-
"lint": "eslint src --ext js,jsx,ts,tsx",
|
|
15
14
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
16
|
-
"
|
|
15
|
+
"lint": "eslint src --ext js,jsx,ts,tsx",
|
|
17
16
|
"test": "jest --config jest.config.json",
|
|
18
|
-
"
|
|
17
|
+
"typescript": "tsc",
|
|
18
|
+
"verify": "concurrently 'yarn:lint' 'yarn:test' 'yarn:typescript'",
|
|
19
|
+
"coverage": "yarn test --coverage",
|
|
19
20
|
"prepare": "husky install"
|
|
20
21
|
},
|
|
21
|
-
"husky": {
|
|
22
|
-
"hooks": {
|
|
23
|
-
"pre-commit": "pretty-quick --staged && concurrently 'npm:lint' 'npm:test' 'npm:typescript'"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
22
|
"browserslist": [
|
|
27
23
|
"extends browserslist-config-openmrs"
|
|
28
24
|
],
|
|
@@ -45,44 +41,34 @@
|
|
|
45
41
|
"url": "https://github.com/openmrs/openmrs-esm-dispensing/issues"
|
|
46
42
|
},
|
|
47
43
|
"dependencies": {
|
|
48
|
-
"@carbon/
|
|
49
|
-
"
|
|
50
|
-
"
|
|
44
|
+
"@carbon/react": "^1.9.0",
|
|
45
|
+
"lodash-es": "^4.17.15",
|
|
46
|
+
"swr": "^1.3.0"
|
|
51
47
|
},
|
|
52
48
|
"peerDependencies": {
|
|
53
|
-
"@openmrs/esm-framework": "
|
|
54
|
-
"carbon-components": "10.x",
|
|
55
|
-
"carbon-icons": "7.x",
|
|
49
|
+
"@openmrs/esm-framework": "4.x",
|
|
56
50
|
"dayjs": "1.x",
|
|
57
|
-
"react": "
|
|
51
|
+
"react": "18.x",
|
|
52
|
+
"react-dom": "18.x",
|
|
58
53
|
"react-i18next": "11.x",
|
|
59
|
-
"react-router-dom": "
|
|
54
|
+
"react-router-dom": "6.x",
|
|
60
55
|
"rxjs": "6.x"
|
|
61
56
|
},
|
|
62
57
|
"devDependencies": {
|
|
63
|
-
"@babel/core": "^7.14.3",
|
|
64
|
-
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
65
|
-
"@babel/preset-env": "^7.14.4",
|
|
66
|
-
"@babel/preset-react": "^7.13.13",
|
|
67
|
-
"@babel/preset-typescript": "^7.13.0",
|
|
68
|
-
"@babel/runtime": "^7.14.0",
|
|
69
58
|
"@openmrs/esm-framework": "next",
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@testing-library/
|
|
73
|
-
"@testing-library/
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@types/jest": "^
|
|
77
|
-
"@types/react": "^
|
|
78
|
-
"@types/react-dom": "^
|
|
59
|
+
"@swc/core": "^1.2.189",
|
|
60
|
+
"@swc/jest": "^0.2.21",
|
|
61
|
+
"@testing-library/dom": "^8.16.0",
|
|
62
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
63
|
+
"@testing-library/react": "^13.3.0",
|
|
64
|
+
"@testing-library/user-event": "^14.2.1",
|
|
65
|
+
"@types/jest": "^28.1.4",
|
|
66
|
+
"@types/react": "^18.0.14",
|
|
67
|
+
"@types/react-dom": "^18.0.5",
|
|
79
68
|
"@types/react-router": "^5.1.14",
|
|
80
69
|
"@types/react-router-dom": "^5.1.7",
|
|
81
70
|
"@types/webpack-env": "^1.16.0",
|
|
82
71
|
"@typescript-eslint/parser": "^4.26.0",
|
|
83
|
-
"babel-eslint": "^10.1.0",
|
|
84
|
-
"babel-jest": "^27.0.2",
|
|
85
|
-
"babel-preset-minify": "^0.5.1",
|
|
86
72
|
"concurrently": "^6.2.0",
|
|
87
73
|
"eslint": "^7.27.0",
|
|
88
74
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -90,16 +76,20 @@
|
|
|
90
76
|
"eslint-plugin-prettier": "^3.4.0",
|
|
91
77
|
"husky": "^6.0.0",
|
|
92
78
|
"identity-obj-proxy": "^3.0.0",
|
|
93
|
-
"jest": "^
|
|
94
|
-
"jest-cli": "^
|
|
79
|
+
"jest": "^28.1.2",
|
|
80
|
+
"jest-cli": "^28.1.2",
|
|
81
|
+
"jest-environment-jsdom": "^28.1.2",
|
|
95
82
|
"openmrs": "next",
|
|
96
83
|
"prettier": "^2.3.0",
|
|
97
84
|
"pretty-quick": "^3.1.0",
|
|
98
|
-
"react": "^
|
|
99
|
-
"react-dom": "^
|
|
85
|
+
"react": "^18.2.0",
|
|
86
|
+
"react-dom": "^18.2.0",
|
|
100
87
|
"react-i18next": "^11.7.0",
|
|
101
|
-
"react-router-dom": "^
|
|
88
|
+
"react-router-dom": "^6.3.0",
|
|
102
89
|
"rxjs": "^6.5.4",
|
|
103
90
|
"typescript": "^4.3.2"
|
|
91
|
+
},
|
|
92
|
+
"resolutions": {
|
|
93
|
+
"**/@types/react": "^18.0.14"
|
|
104
94
|
}
|
|
105
95
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Form, TextInput } from "@carbon/react";
|
|
3
|
+
import { OverflowMenuVertical } from "@carbon/react/icons";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import styles from "./history-and-comments.scss";
|
|
6
|
+
|
|
7
|
+
const HistoryAndComments: React.FC = () => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div className={styles.commentsContainer}>
|
|
12
|
+
<Form>
|
|
13
|
+
<TextInput
|
|
14
|
+
id="test2"
|
|
15
|
+
invalidText="Invalid error message."
|
|
16
|
+
placeholder="Add note"
|
|
17
|
+
labelText={""}
|
|
18
|
+
/>
|
|
19
|
+
<Button kind="primary" tabIndex={0} type="submit">
|
|
20
|
+
{t("post", "Post")}
|
|
21
|
+
</Button>
|
|
22
|
+
<Button
|
|
23
|
+
kind="ghost"
|
|
24
|
+
renderIcon={(props) => <OverflowMenuVertical size={16} />}
|
|
25
|
+
>
|
|
26
|
+
{t("addItem", "Add item")}
|
|
27
|
+
</Button>
|
|
28
|
+
</Form>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default HistoryAndComments;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.commentsContainer {
|
|
2
|
+
max-width: 80%;
|
|
3
|
+
|
|
4
|
+
form {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-flow: row wrap;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
form input {
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
margin: 0 10px 0 0;
|
|
13
|
+
padding: 10px;
|
|
14
|
+
border: 1px solid #8d8d8d !important;
|
|
15
|
+
background-color: white;
|
|
16
|
+
}
|
|
17
|
+
form button {
|
|
18
|
+
width: 90px;
|
|
19
|
+
height: 20px;
|
|
20
|
+
min-height: 2.5rem !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
form :global(.cds--btn--ghost) {
|
|
24
|
+
width: 8rem !important;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DosageInstruction, MedicationRequest } from "../types";
|
|
3
|
+
import styles from "./medication-card.scss";
|
|
4
|
+
import { getDosageInstruction } from "../utils";
|
|
5
|
+
import { Tile } from "@carbon/react";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
|
|
8
|
+
const MedicationCard: React.FC<{ medication: MedicationRequest }> = ({
|
|
9
|
+
medication,
|
|
10
|
+
}) => {
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const dosageInstruction: DosageInstruction = getDosageInstruction(
|
|
13
|
+
medication.dosageInstruction
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Tile className={styles.medicationTile}>
|
|
18
|
+
<div>
|
|
19
|
+
<p className={styles.medicationName}>
|
|
20
|
+
<strong>{medication.medicationReference?.display}</strong>
|
|
21
|
+
</p>
|
|
22
|
+
<p className={styles.bodyLong01}>
|
|
23
|
+
<span className={styles.label01}>
|
|
24
|
+
{t("dose", "Dose").toUpperCase()}
|
|
25
|
+
</span>{" "}
|
|
26
|
+
{dosageInstruction && (
|
|
27
|
+
<>
|
|
28
|
+
<span className={styles.dosage}>
|
|
29
|
+
{dosageInstruction.doseAndRate &&
|
|
30
|
+
dosageInstruction?.doseAndRate.map((doseAndRate) => {
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
{doseAndRate?.doseQuantity?.value}{" "}
|
|
34
|
+
{doseAndRate?.doseQuantity?.unit}
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
})}
|
|
38
|
+
</span>{" "}
|
|
39
|
+
— {dosageInstruction?.route?.text} —{" "}
|
|
40
|
+
{dosageInstruction?.timing?.code?.text}{" "}
|
|
41
|
+
{dosageInstruction?.timing?.repeat?.duration
|
|
42
|
+
? "for " +
|
|
43
|
+
dosageInstruction?.timing?.repeat?.duration +
|
|
44
|
+
" " +
|
|
45
|
+
dosageInstruction?.timing?.repeat?.durationUnit
|
|
46
|
+
: " "}
|
|
47
|
+
</>
|
|
48
|
+
)}
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
</Tile>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default MedicationCard;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import "~@openmrs/esm-styleguide/src/vars";
|
|
4
|
+
|
|
5
|
+
.medicationTile {
|
|
6
|
+
width: 100%;
|
|
7
|
+
margin: 2px 0 8px;
|
|
8
|
+
padding: 0 48px 0 0;
|
|
9
|
+
background-color: #fff;
|
|
10
|
+
border-left: 4px solid #007d79;
|
|
11
|
+
color: $text-02;
|
|
12
|
+
margin-bottom: 1rem !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.medicationName {
|
|
16
|
+
font-size: 15px !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.bodyLong01 {
|
|
20
|
+
font-size: 13px !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dosage {
|
|
24
|
+
color: #525252;
|
|
25
|
+
font-weight: bold;
|
|
26
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PatientUuid } from "@openmrs/esm-framework";
|
|
3
|
+
import { Tab, Tabs, TabList, TabPanels, TabPanel } from "@carbon/react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import HistoryAndComments from "./history-and-comments.component";
|
|
6
|
+
import styles from "./order-expanded.scss";
|
|
7
|
+
import PatientDetails from "./patient-details.component";
|
|
8
|
+
import PrescriptionDetails from "./prescription-details.component";
|
|
9
|
+
|
|
10
|
+
interface TabItem {
|
|
11
|
+
name: string;
|
|
12
|
+
component: JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const OrderExpanded: React.FC<{
|
|
16
|
+
encounterUuid: string;
|
|
17
|
+
patientUuid: PatientUuid;
|
|
18
|
+
}> = ({ encounterUuid, patientUuid }) => {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
|
|
21
|
+
const tabs: TabItem[] = [
|
|
22
|
+
{
|
|
23
|
+
name: t("prescriptionDetails", "Prescription details"),
|
|
24
|
+
component: (
|
|
25
|
+
<PrescriptionDetails
|
|
26
|
+
encounterUuid={encounterUuid}
|
|
27
|
+
patientUuid={patientUuid}
|
|
28
|
+
/>
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: t("historyComments", "History and comments"),
|
|
33
|
+
component: <HistoryAndComments />,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: t("patientDetails", "Patient details"),
|
|
37
|
+
component: <PatientDetails patientUuid={patientUuid} />,
|
|
38
|
+
},
|
|
39
|
+
// {
|
|
40
|
+
// name: t("billing", "Billing"),
|
|
41
|
+
// component: <div>Billing</div>,
|
|
42
|
+
// },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={styles.expandedTabsContainer}>
|
|
47
|
+
<Tabs>
|
|
48
|
+
<TabList>
|
|
49
|
+
{tabs.map((tab: TabItem, index: number) => (
|
|
50
|
+
<Tab key={index} className={styles.orderTabs}>
|
|
51
|
+
{tab.name}
|
|
52
|
+
</Tab>
|
|
53
|
+
))}
|
|
54
|
+
</TabList>
|
|
55
|
+
<TabPanels>
|
|
56
|
+
{tabs.map((tab: TabItem) => (
|
|
57
|
+
<TabPanel>{tab.component}</TabPanel>
|
|
58
|
+
))}
|
|
59
|
+
</TabPanels>
|
|
60
|
+
</Tabs>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default OrderExpanded;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import "~@openmrs/esm-styleguide/src/vars";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.expandedTabsContainer {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
|
|
10
|
+
:global(.cds--tabs) {
|
|
11
|
+
margin: 1rem 0;
|
|
12
|
+
width: 20%;
|
|
13
|
+
max-height: 8rem !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:global(.cds--tab--list) {
|
|
17
|
+
flex-direction: column !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:global(.cds--tab-content) {
|
|
21
|
+
margin: 1rem 0;
|
|
22
|
+
width: 100% !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:global(.cds--tabs__nav-link) {
|
|
26
|
+
border-bottom: 0 !important;
|
|
27
|
+
border-left: 3px solid $ui-03 !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:global(.cds--tabs__nav-item--selected) {
|
|
31
|
+
border-bottom: 0px !important;
|
|
32
|
+
border-left: 3px solid var(--brand-03) !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-item+.cds--tabs--scrollable__nav-item) {
|
|
36
|
+
margin-left: 0rem !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
>ul {
|
|
40
|
+
flex-direction: column !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
>ul>li button {
|
|
44
|
+
width: 12rem !important;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
attach,
|
|
4
|
+
ConfigurableLink,
|
|
5
|
+
detach,
|
|
6
|
+
ExtensionSlot,
|
|
7
|
+
formatDate,
|
|
8
|
+
interpolateString,
|
|
9
|
+
parseDate,
|
|
10
|
+
PatientUuid,
|
|
11
|
+
useConfig,
|
|
12
|
+
usePatient,
|
|
13
|
+
} from "@openmrs/esm-framework";
|
|
14
|
+
import styles from "./patient-details.scss";
|
|
15
|
+
import { useTranslation } from "react-i18next";
|
|
16
|
+
import { Patient } from "../types";
|
|
17
|
+
|
|
18
|
+
const PatientDetails: React.FC<{
|
|
19
|
+
patientUuid: PatientUuid;
|
|
20
|
+
}> = ({ patientUuid }) => {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const config = useConfig();
|
|
23
|
+
const { patient } = usePatient(patientUuid);
|
|
24
|
+
|
|
25
|
+
const patientName = patient;
|
|
26
|
+
const patientPhotoSlotState = React.useMemo(
|
|
27
|
+
() => ({ patientUuid, patientName }),
|
|
28
|
+
[patientUuid, patientName]
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const [showContactDetails, setShowContactDetails] = React.useState(false);
|
|
32
|
+
const toggleContactDetails = React.useCallback((event: MouseEvent) => {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
setShowContactDetails((value) => !value);
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
const patientAvatar = (
|
|
38
|
+
<div className={styles.patientAvatar} role="img">
|
|
39
|
+
<ExtensionSlot
|
|
40
|
+
extensionSlotName="patient-photo-slot"
|
|
41
|
+
state={patientPhotoSlotState}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const getGender = (gender) => {
|
|
47
|
+
switch (gender) {
|
|
48
|
+
case "M":
|
|
49
|
+
return t("male", "Male");
|
|
50
|
+
case "F":
|
|
51
|
+
return t("female", "Female");
|
|
52
|
+
case "O":
|
|
53
|
+
return t("other", "Other");
|
|
54
|
+
case "U":
|
|
55
|
+
return t("unknown", "Unknown");
|
|
56
|
+
default:
|
|
57
|
+
return gender;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
attach("dispensing-patient-banner-slot", "patient-banner");
|
|
63
|
+
attach("dispensing-patient-vitals-slot", "vitals-overview-widget");
|
|
64
|
+
attach("dispensing-patient-allergies-slot", "allergies-overview-widget");
|
|
65
|
+
|
|
66
|
+
return () => {
|
|
67
|
+
detach("dispensing-patient-banner-slot", "patient-banner");
|
|
68
|
+
detach("dispensing-patient-vitals-slot", "vitals-overview-widget");
|
|
69
|
+
detach("dispensing-patient-allergies-slot", "allergies-overview-widget");
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div>
|
|
75
|
+
{patient && (
|
|
76
|
+
<div className={styles.patientDetailsContainer}>
|
|
77
|
+
<ExtensionSlot
|
|
78
|
+
extensionSlotName="dispensing-patient-banner-slot"
|
|
79
|
+
state={{
|
|
80
|
+
patient,
|
|
81
|
+
patientUuid: patientUuid,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
<ExtensionSlot
|
|
86
|
+
extensionSlotName="dispensing-patient-vitals-slot"
|
|
87
|
+
state={{
|
|
88
|
+
patient,
|
|
89
|
+
patientUuid: patientUuid,
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
<ExtensionSlot
|
|
94
|
+
extensionSlotName="dispensing-patient-allergies-slot"
|
|
95
|
+
state={{
|
|
96
|
+
patient,
|
|
97
|
+
patientUuid: patientUuid,
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default PatientDetails;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import "~@openmrs/esm-styleguide/src/vars";
|
|
4
|
+
|
|
5
|
+
.patientDetailsContainer > div {
|
|
6
|
+
margin-bottom: 1rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.container {
|
|
10
|
+
border-bottom: 0.063rem solid $ui-03;
|
|
11
|
+
background-color: $ui-02;
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: 1fr auto;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.patientBanner {
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-columns: auto 1fr;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.patientName {
|
|
23
|
+
@include type.type-style('heading-03');
|
|
24
|
+
margin-right: 0.25rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.patientAvatar {
|
|
28
|
+
width: 5rem;
|
|
29
|
+
height: 5rem;
|
|
30
|
+
margin: 1rem;
|
|
31
|
+
border-radius: 1px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.patientAvatarButton {
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
border: none;
|
|
37
|
+
padding: 0px;
|
|
38
|
+
background: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.patientInfo {
|
|
42
|
+
width: 100%;
|
|
43
|
+
padding-right: 1rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.demographics {
|
|
47
|
+
@include type.type-style('body-compact-02');
|
|
48
|
+
color: $text-02;
|
|
49
|
+
margin-top: 0.375rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.row {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
align-items: flex-start;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.patientNameRow {
|
|
60
|
+
margin-top: spacing.$spacing-05;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.flexRow {
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-flow: row wrap;
|
|
66
|
+
align-items: center;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.identifiers {
|
|
70
|
+
@include type.type-style('body-compact-02');
|
|
71
|
+
color: $ui-04;
|
|
72
|
+
margin-top: 0.375rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.tooltipPadding {
|
|
76
|
+
padding: 0.25rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.tooltipSmallText {
|
|
80
|
+
font-size: 80%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.actionsButtonText {
|
|
84
|
+
@include type.type-style('body-compact-01');
|
|
85
|
+
color: $interactive-01;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:global(.cds--tooltip--definition .cds--tooltip__trigger) {
|
|
89
|
+
border-bottom: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.buttonCol {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
justify-content: space-between;
|
|
96
|
+
align-items: flex-end;
|
|
97
|
+
}
|