@openmrs/esm-dispensing-app 1.3.2-pre.280 → 1.3.2-pre.283
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/.eslintrc +43 -10
- package/.husky/pre-commit +1 -1
- package/dist/985.js.map +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-dispensing-app.js.buildmanifest.json +2 -2
- package/dist/routes.json +1 -1
- package/package.json +11 -6
- package/src/components/action-buttons.component.tsx +3 -3
- package/src/components/medication-card.component.tsx +1 -1
- package/src/components/medication-event.component.tsx +1 -1
- package/src/components/patient-details.component.tsx +2 -3
- package/src/config-schema.ts +2 -2
- package/src/dashboard/dispensing-dashboard.component.tsx +2 -2
- package/src/dispensing-tiles/dispensing-tiles.resource.tsx +1 -1
- package/src/forms/close-dispense-form.component.tsx +3 -3
- package/src/forms/dispense-form.component.tsx +3 -3
- package/src/forms/medication-dispense-review.component.tsx +5 -5
- package/src/forms/pause-dispense-form.component.tsx +3 -3
- package/src/history/history-and-comments.component.tsx +4 -4
- package/src/location/location.resource.tsx +2 -2
- package/src/medication/medication.resource.tsx +1 -1
- package/src/medication-dispense/medication-dispense.resource.tsx +8 -2
- package/src/medication-request/medication-request.resource.tsx +11 -11
- package/src/pharmacy-header/pharmacy-header.component.tsx +2 -2
- package/src/prescriptions/prescription-details.component.tsx +4 -4
- package/src/prescriptions/prescription-expanded.component.tsx +1 -1
- package/src/prescriptions/prescription-tab-lists.component.tsx +3 -3
- package/src/prescriptions/prescription-tab-panel.component.tsx +6 -6
- package/src/types.ts +1 -1
- package/src/utils.test.ts +7 -7
- package/src/utils.ts +8 -8
- /package/.yarn/versions/{184bd0a4.yml → 908d73b7.yml} +0 -0
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"auxiliaryFiles": [
|
|
26
26
|
"main.js.map"
|
|
27
27
|
],
|
|
28
|
-
"hash": "
|
|
28
|
+
"hash": "84156c9c0f02ff38",
|
|
29
29
|
"childrenByOrder": {}
|
|
30
30
|
},
|
|
31
31
|
{
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
"auxiliaryFiles": [
|
|
340
340
|
"985.js.map"
|
|
341
341
|
],
|
|
342
|
-
"hash": "
|
|
342
|
+
"hash": "bbafbbc86cf5f9c3",
|
|
343
343
|
"childrenByOrder": {}
|
|
344
344
|
},
|
|
345
345
|
{
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}}],"version":"1.3.2-pre.
|
|
1
|
+
{"backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}}],"version":"1.3.2-pre.283"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-dispensing-app",
|
|
3
|
-
"version": "1.3.2-pre.
|
|
3
|
+
"version": "1.3.2-pre.283",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Medication dispensing application",
|
|
6
6
|
"browser": "dist/openmrs-esm-dispensing-app.js",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"serve": "webpack serve --mode=development",
|
|
12
12
|
"build": "webpack --mode production",
|
|
13
13
|
"analyze": "webpack --mode=production --env.analyze=true",
|
|
14
|
-
"prettier": "prettier --write \"src/**/*.{ts,tsx}\" --list-different --ignore-unknown",
|
|
15
14
|
"lint": "eslint src --ext js,jsx,ts,tsx",
|
|
16
15
|
"test": "jest --config jest.config.js",
|
|
17
16
|
"typescript": "tsc",
|
|
@@ -67,20 +66,20 @@
|
|
|
67
66
|
"@types/react-router": "^5.1.14",
|
|
68
67
|
"@types/react-router-dom": "^5.1.7",
|
|
69
68
|
"@types/webpack-env": "^1.16.0",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
70
70
|
"@typescript-eslint/parser": "^7.5.0",
|
|
71
71
|
"concurrently": "^6.2.0",
|
|
72
72
|
"dayjs": "1.x",
|
|
73
|
-
"eslint": "^
|
|
74
|
-
"eslint-config-prettier": "^8.3.0",
|
|
73
|
+
"eslint": "^8.57.0",
|
|
75
74
|
"eslint-plugin-unused-imports": "^2.0.0",
|
|
76
75
|
"husky": "^6.0.0",
|
|
77
76
|
"identity-obj-proxy": "^3.0.0",
|
|
78
77
|
"jest": "^28.1.2",
|
|
79
78
|
"jest-cli": "^28.1.2",
|
|
80
79
|
"jest-environment-jsdom": "^28.1.2",
|
|
80
|
+
"lint-staged": "^15.2.2",
|
|
81
81
|
"openmrs": "next",
|
|
82
|
-
"prettier": "^2.
|
|
83
|
-
"pretty-quick": "^3.1.0",
|
|
82
|
+
"prettier": "^3.2.5",
|
|
84
83
|
"react": "^18.2.0",
|
|
85
84
|
"react-dom": "^18.2.0",
|
|
86
85
|
"react-i18next": "^11.7.0",
|
|
@@ -90,6 +89,12 @@
|
|
|
90
89
|
"typescript": "^4.3.2",
|
|
91
90
|
"webpack": "^5.88.0"
|
|
92
91
|
},
|
|
92
|
+
"lint-staged": {
|
|
93
|
+
"*.{js,jsx,ts,tsx}": [
|
|
94
|
+
"eslint --cache --fix",
|
|
95
|
+
"prettier --cache --write --ignore-unknown --list-different"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
93
98
|
"packageManager": "yarn@3.6.4",
|
|
94
99
|
"stableVersion": "1.3.1"
|
|
95
100
|
}
|
|
@@ -3,14 +3,14 @@ import { Button } from '@carbon/react';
|
|
|
3
3
|
import { useConfig, useSession } from '@openmrs/esm-framework';
|
|
4
4
|
import styles from './action-buttons.scss';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { MedicationDispenseStatus, MedicationRequestBundle, MedicationRequestStatus } from '../types';
|
|
7
|
-
import { PharmacyConfig } from '../config-schema';
|
|
6
|
+
import { MedicationDispenseStatus, type MedicationRequestBundle, MedicationRequestStatus } from '../types';
|
|
8
7
|
import { launchOverlay } from '../hooks/useOverlay';
|
|
9
8
|
import {
|
|
10
9
|
computeMedicationRequestStatus,
|
|
11
10
|
computeQuantityRemaining,
|
|
12
11
|
getMostRecentMedicationDispenseStatus,
|
|
13
12
|
} from '../utils';
|
|
13
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
14
14
|
import DispenseForm from '../forms/dispense-form.component';
|
|
15
15
|
import { initiateMedicationDispenseBody } from '../medication-dispense/medication-dispense.resource';
|
|
16
16
|
import PauseDispenseForm from '../forms/pause-dispense-form.component';
|
|
@@ -24,7 +24,7 @@ interface ActionButtonsProps {
|
|
|
24
24
|
|
|
25
25
|
const ActionButtons: React.FC<ActionButtonsProps> = ({ medicationRequestBundle, patientUuid, encounterUuid }) => {
|
|
26
26
|
const { t } = useTranslation();
|
|
27
|
-
const config = useConfig()
|
|
27
|
+
const config = useConfig<PharmacyConfig>();
|
|
28
28
|
const session = useSession();
|
|
29
29
|
const mostRecentMedicationDispenseStatus: MedicationDispenseStatus = getMostRecentMedicationDispenseStatus(
|
|
30
30
|
medicationRequestBundle.dispenses,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tile } from '@carbon/react';
|
|
3
3
|
import { Edit } from '@carbon/react/icons';
|
|
4
|
-
import { MedicationReferenceOrCodeableConcept } from '../types';
|
|
4
|
+
import { type MedicationReferenceOrCodeableConcept } from '../types';
|
|
5
5
|
import styles from './medication-card.scss';
|
|
6
6
|
import { getMedicationDisplay } from '../utils';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DosageInstruction, MedicationDispense, MedicationRequest, Quantity } from '../types';
|
|
2
|
+
import { type DosageInstruction, type MedicationDispense, type MedicationRequest, type Quantity } from '../types';
|
|
3
3
|
import styles from './medication-event.scss';
|
|
4
4
|
import {
|
|
5
5
|
getDosageInstruction,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { attach, detach, ExtensionSlot, PatientUuid, useConfig, usePatient } from '@openmrs/esm-framework';
|
|
3
|
-
import styles from './patient-details.scss';
|
|
4
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { attach, detach, ExtensionSlot, type PatientUuid, usePatient } from '@openmrs/esm-framework';
|
|
4
|
+
import styles from './patient-details.scss';
|
|
5
5
|
|
|
6
6
|
const PatientDetails: React.FC<{
|
|
7
7
|
patientUuid: PatientUuid;
|
|
8
8
|
}> = ({ patientUuid }) => {
|
|
9
9
|
const { t } = useTranslation();
|
|
10
|
-
const config = useConfig();
|
|
11
10
|
const { patient } = usePatient(patientUuid);
|
|
12
11
|
|
|
13
12
|
const patientName = patient;
|
package/src/config-schema.ts
CHANGED
|
@@ -123,7 +123,7 @@ export const configSchema = {
|
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
export
|
|
126
|
+
export interface PharmacyConfig {
|
|
127
127
|
appName: string;
|
|
128
128
|
actionButtons: {
|
|
129
129
|
pauseButton: {
|
|
@@ -162,4 +162,4 @@ export type PharmacyConfig = {
|
|
|
162
162
|
uuid: string;
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
|
-
}
|
|
165
|
+
}
|
|
@@ -3,12 +3,12 @@ import { InlineNotification } from '@carbon/react';
|
|
|
3
3
|
import Overlay from '../forms/overlay/overlay.component';
|
|
4
4
|
import { PharmacyHeader } from '../pharmacy-header/pharmacy-header.component';
|
|
5
5
|
import PrescriptionTabLists from '../prescriptions/prescription-tab-lists.component';
|
|
6
|
-
import { PharmacyConfig } from '../config-schema';
|
|
7
6
|
import { useConfig } from '@openmrs/esm-framework';
|
|
8
7
|
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
9
9
|
|
|
10
10
|
export default function DispensingDashboard() {
|
|
11
|
-
const config = useConfig()
|
|
11
|
+
const config = useConfig<PharmacyConfig>();
|
|
12
12
|
const { t } = useTranslation();
|
|
13
13
|
if (config.dispenseBehavior.restrictTotalQuantityDispensed && config.dispenseBehavior.allowModifyingPrescription) {
|
|
14
14
|
return (
|
|
@@ -12,9 +12,9 @@ import { Button, ComboBox, InlineLoading } from '@carbon/react';
|
|
|
12
12
|
import { saveMedicationDispense, useReasonForCloseValueSet } from '../medication-dispense/medication-dispense.resource';
|
|
13
13
|
import { closeOverlay } from '../hooks/useOverlay';
|
|
14
14
|
import styles from './forms.scss';
|
|
15
|
-
import { PharmacyConfig } from '../config-schema';
|
|
16
15
|
import { updateMedicationRequestFulfillerStatus } from '../medication-request/medication-request.resource';
|
|
17
|
-
import { MedicationDispense, MedicationDispenseStatus, MedicationRequestFulfillerStatus } from '../types';
|
|
16
|
+
import { type MedicationDispense, MedicationDispenseStatus, MedicationRequestFulfillerStatus } from '../types';
|
|
17
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
18
18
|
import { getUuidFromReference, revalidate } from '../utils';
|
|
19
19
|
|
|
20
20
|
interface CloseDispenseFormProps {
|
|
@@ -31,7 +31,7 @@ const CloseDispenseForm: React.FC<CloseDispenseFormProps> = ({
|
|
|
31
31
|
encounterUuid,
|
|
32
32
|
}) => {
|
|
33
33
|
const { t } = useTranslation();
|
|
34
|
-
const config = useConfig()
|
|
34
|
+
const config = useConfig<PharmacyConfig>();
|
|
35
35
|
const isTablet = useLayoutType() === 'tablet';
|
|
36
36
|
const { patient, isLoading } = usePatient(patientUuid);
|
|
37
37
|
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
import { Button, FormLabel, InlineLoading } from '@carbon/react';
|
|
12
12
|
import styles from './forms.scss';
|
|
13
13
|
import { closeOverlay } from '../hooks/useOverlay';
|
|
14
|
-
import { MedicationDispense, MedicationDispenseStatus, MedicationRequestBundle } from '../types';
|
|
15
|
-
import { PharmacyConfig } from '../config-schema';
|
|
14
|
+
import { type MedicationDispense, MedicationDispenseStatus, type MedicationRequestBundle } from '../types';
|
|
16
15
|
import { saveMedicationDispense } from '../medication-dispense/medication-dispense.resource';
|
|
17
16
|
import MedicationDispenseReview from './medication-dispense-review.component';
|
|
18
17
|
import {
|
|
@@ -22,6 +21,7 @@ import {
|
|
|
22
21
|
revalidate,
|
|
23
22
|
} from '../utils';
|
|
24
23
|
import { updateMedicationRequestFulfillerStatus } from '../medication-request/medication-request.resource';
|
|
24
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
25
25
|
|
|
26
26
|
interface DispenseFormProps {
|
|
27
27
|
medicationDispense: MedicationDispense;
|
|
@@ -43,7 +43,7 @@ const DispenseForm: React.FC<DispenseFormProps> = ({
|
|
|
43
43
|
const { t } = useTranslation();
|
|
44
44
|
const isTablet = useLayoutType() === 'tablet';
|
|
45
45
|
const { patient, isLoading } = usePatient(patientUuid);
|
|
46
|
-
const config = useConfig()
|
|
46
|
+
const config = useConfig<PharmacyConfig>();
|
|
47
47
|
|
|
48
48
|
// Keep track of medication dispense payload
|
|
49
49
|
const [medicationDispensePayload, setMedicationDispensePayload] = useState<MedicationDispense>();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Medication, MedicationDispense } from '../types';
|
|
2
|
+
import { type Medication, type MedicationDispense } from '../types';
|
|
3
3
|
import MedicationCard from '../components/medication-card.component';
|
|
4
4
|
import { TextArea, ComboBox, Dropdown, NumberInput } from '@carbon/react';
|
|
5
5
|
import { useLayoutType, useConfig, useSession, userHasAccess } from '@openmrs/esm-framework';
|
|
@@ -8,13 +8,13 @@ import { getConceptCodingUuid, getMedicationReferenceOrCodeableConcept, getOpenM
|
|
|
8
8
|
import styles from '../components/medication-dispense-review.scss';
|
|
9
9
|
import { useMedicationCodeableConcept, useMedicationFormulations } from '../medication/medication.resource';
|
|
10
10
|
import { useMedicationRequest } from '../medication-request/medication-request.resource';
|
|
11
|
-
import { PharmacyConfig } from '../config-schema';
|
|
12
11
|
import {
|
|
13
12
|
useOrderConfig,
|
|
14
13
|
useSubstitutionReasonValueSet,
|
|
15
14
|
useSubstitutionTypeValueSet,
|
|
16
15
|
} from '../medication-dispense/medication-dispense.resource';
|
|
17
16
|
import { PRIVILEGE_CREATE_DISPENSE_MODIFY_DETAILS } from '../constants';
|
|
17
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
18
18
|
|
|
19
19
|
interface MedicationDispenseReviewProps {
|
|
20
20
|
medicationDispense: MedicationDispense;
|
|
@@ -28,7 +28,7 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
|
|
|
28
28
|
quantityRemaining,
|
|
29
29
|
}) => {
|
|
30
30
|
const { t } = useTranslation();
|
|
31
|
-
const config = useConfig()
|
|
31
|
+
const config = useConfig<PharmacyConfig>();
|
|
32
32
|
const session = useSession();
|
|
33
33
|
const [isEditingFormulation, setIsEditingFormulation] = useState(false);
|
|
34
34
|
const [isSubstitution, setIsSubstitution] = useState(false);
|
|
@@ -141,8 +141,8 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
|
|
|
141
141
|
existingMedicationCodeableConceptUuid
|
|
142
142
|
? existingMedicationCodeableConceptUuid
|
|
143
143
|
: medicationCodeableConceptUuid
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
? medicationCodeableConceptUuid
|
|
145
|
+
: null,
|
|
146
146
|
);
|
|
147
147
|
|
|
148
148
|
// get the medication request associated with this dispense event
|
|
@@ -12,10 +12,10 @@ import { Button, ComboBox, InlineLoading } from '@carbon/react';
|
|
|
12
12
|
import { saveMedicationDispense, useReasonForPauseValueSet } from '../medication-dispense/medication-dispense.resource';
|
|
13
13
|
import { closeOverlay } from '../hooks/useOverlay';
|
|
14
14
|
import styles from './forms.scss';
|
|
15
|
-
import { PharmacyConfig } from '../config-schema';
|
|
16
15
|
import { updateMedicationRequestFulfillerStatus } from '../medication-request/medication-request.resource';
|
|
17
16
|
import { getUuidFromReference, revalidate } from '../utils';
|
|
18
|
-
import { MedicationDispense, MedicationDispenseStatus, MedicationRequestFulfillerStatus } from '../types';
|
|
17
|
+
import { type MedicationDispense, MedicationDispenseStatus, MedicationRequestFulfillerStatus } from '../types';
|
|
18
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
19
19
|
|
|
20
20
|
interface PauseDispenseFormProps {
|
|
21
21
|
medicationDispense: MedicationDispense;
|
|
@@ -31,7 +31,7 @@ const PauseDispenseForm: React.FC<PauseDispenseFormProps> = ({
|
|
|
31
31
|
encounterUuid,
|
|
32
32
|
}) => {
|
|
33
33
|
const { t } = useTranslation();
|
|
34
|
-
const config = useConfig()
|
|
34
|
+
const config = useConfig<PharmacyConfig>();
|
|
35
35
|
const isTablet = useLayoutType() === 'tablet';
|
|
36
36
|
const { patient, isLoading } = usePatient(patientUuid);
|
|
37
37
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DataTableSkeleton, OverflowMenu, OverflowMenuItem, Tag, Tile } from '@carbon/react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { formatDatetime, parseDate, Session, useConfig, userHasAccess, useSession } from '@openmrs/esm-framework';
|
|
4
|
+
import { formatDatetime, parseDate, type Session, useConfig, userHasAccess, useSession } from '@openmrs/esm-framework';
|
|
5
5
|
import styles from './history-and-comments.scss';
|
|
6
6
|
import {
|
|
7
7
|
updateMedicationRequestFulfillerStatus,
|
|
@@ -10,9 +10,8 @@ import {
|
|
|
10
10
|
import { deleteMedicationDispense } from '../medication-dispense/medication-dispense.resource';
|
|
11
11
|
import MedicationEvent from '../components/medication-event.component';
|
|
12
12
|
import { launchOverlay } from '../hooks/useOverlay';
|
|
13
|
-
import { PharmacyConfig } from '../config-schema';
|
|
14
13
|
import DispenseForm from '../forms/dispense-form.component';
|
|
15
|
-
import { MedicationDispense, MedicationDispenseStatus, MedicationRequestBundle } from '../types';
|
|
14
|
+
import { type MedicationDispense, MedicationDispenseStatus, type MedicationRequestBundle } from '../types';
|
|
16
15
|
import {
|
|
17
16
|
PRIVILEGE_DELETE_DISPENSE,
|
|
18
17
|
PRIVILEGE_DELETE_DISPENSE_THIS_PROVIDER_ONLY,
|
|
@@ -30,6 +29,7 @@ import {
|
|
|
30
29
|
} from '../utils';
|
|
31
30
|
import PauseDispenseForm from '../forms/pause-dispense-form.component';
|
|
32
31
|
import CloseDispenseForm from '../forms/close-dispense-form.component';
|
|
32
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
33
33
|
|
|
34
34
|
const HistoryAndComments: React.FC<{
|
|
35
35
|
encounterUuid: string;
|
|
@@ -37,7 +37,7 @@ const HistoryAndComments: React.FC<{
|
|
|
37
37
|
}> = ({ encounterUuid, patientUuid }) => {
|
|
38
38
|
const { t } = useTranslation();
|
|
39
39
|
const session = useSession();
|
|
40
|
-
const config = useConfig()
|
|
40
|
+
const config = useConfig<PharmacyConfig>();
|
|
41
41
|
const { medicationRequestBundles, prescriptionDate, isError, isLoading } = usePrescriptionDetails(
|
|
42
42
|
encounterUuid,
|
|
43
43
|
config.refreshInterval,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
2
|
import { fhirBaseUrl, openmrsFetch } from '@openmrs/esm-framework';
|
|
3
|
-
import { LocationResponse, SimpleLocation } from '../types';
|
|
4
|
-
import { PharmacyConfig } from '../config-schema';
|
|
3
|
+
import { type LocationResponse, type SimpleLocation } from '../types';
|
|
4
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
5
5
|
|
|
6
6
|
export function useLocationForFiltering(config: PharmacyConfig) {
|
|
7
7
|
const { data, error } = useSWR<{ data: LocationResponse }, Error>(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
|
-
import { Medication, MedicationFormulationsResponse } from '../types';
|
|
2
|
+
import { type Medication, type MedicationFormulationsResponse } from '../types';
|
|
3
3
|
import { fhirBaseUrl, openmrsFetch } from '@openmrs/esm-framework';
|
|
4
4
|
import { getConceptCodingUuid, getMedicationsByConceptEndpoint } from '../utils';
|
|
5
5
|
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { fhirBaseUrl, openmrsFetch, Session } from '@openmrs/esm-framework';
|
|
1
|
+
import { fhirBaseUrl, openmrsFetch, type Session } from '@openmrs/esm-framework';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import useSWR from 'swr';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
type MedicationDispense,
|
|
6
|
+
MedicationDispenseStatus,
|
|
7
|
+
type MedicationRequest,
|
|
8
|
+
type OrderConfig,
|
|
9
|
+
type ValueSet,
|
|
10
|
+
} from '../types';
|
|
5
11
|
|
|
6
12
|
export function saveMedicationDispense(
|
|
7
13
|
medicationDispense: MedicationDispense,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
2
|
import { fhirBaseUrl, openmrsFetch, parseDate } from '@openmrs/esm-framework';
|
|
3
3
|
import {
|
|
4
|
-
AllergyIntoleranceResponse,
|
|
5
|
-
EncounterResponse,
|
|
6
|
-
MedicationRequest,
|
|
7
|
-
MedicationRequestResponse,
|
|
8
|
-
PrescriptionsTableRow,
|
|
9
|
-
MedicationDispense,
|
|
10
|
-
Encounter,
|
|
11
|
-
MedicationRequestFulfillerStatus,
|
|
12
|
-
MedicationRequestBundle,
|
|
4
|
+
type AllergyIntoleranceResponse,
|
|
5
|
+
type EncounterResponse,
|
|
6
|
+
type MedicationRequest,
|
|
7
|
+
type MedicationRequestResponse,
|
|
8
|
+
type PrescriptionsTableRow,
|
|
9
|
+
type MedicationDispense,
|
|
10
|
+
type Encounter,
|
|
11
|
+
type MedicationRequestFulfillerStatus,
|
|
12
|
+
type MedicationRequestBundle,
|
|
13
13
|
} from '../types';
|
|
14
14
|
import {
|
|
15
15
|
getPrescriptionDetailsEndpoint,
|
|
@@ -124,7 +124,7 @@ function buildPrescriptionsTableRow(
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export function usePrescriptionDetails(encounterUuid: string, refreshInterval) {
|
|
127
|
-
|
|
127
|
+
const medicationRequestBundles: Array<MedicationRequestBundle> = [];
|
|
128
128
|
let prescriptionDate: Date;
|
|
129
129
|
let isLoading = true;
|
|
130
130
|
|
|
@@ -182,7 +182,7 @@ export function usePatientAllergies(patientUuid: string, refreshInterval) {
|
|
|
182
182
|
{ refreshInterval: refreshInterval },
|
|
183
183
|
);
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
const allergies = [];
|
|
186
186
|
if (data) {
|
|
187
187
|
const entries = data?.data.entry;
|
|
188
188
|
entries?.map((allergy) => {
|
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Calendar, Location } from '@carbon/react/icons';
|
|
4
4
|
import { useConfig, useSession, formatDate } from '@openmrs/esm-framework';
|
|
5
|
-
import { PharmacyConfig } from '../config-schema';
|
|
6
5
|
import PharmacyIllustration from './pharmacy-illustration.component';
|
|
6
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
7
7
|
import styles from './pharmacy-header.scss';
|
|
8
8
|
|
|
9
9
|
export const PharmacyHeader: React.FC = () => {
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const userSession = useSession();
|
|
12
|
-
const config = useConfig()
|
|
12
|
+
const config = useConfig<PharmacyConfig>();
|
|
13
13
|
const userLocation = userSession?.sessionLocation?.display;
|
|
14
14
|
|
|
15
15
|
return (
|
|
@@ -5,19 +5,19 @@ import { WarningFilled } from '@carbon/react/icons';
|
|
|
5
5
|
import { usePatientAllergies, usePrescriptionDetails } from '../medication-request/medication-request.resource';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import MedicationEvent from '../components/medication-event.component';
|
|
8
|
-
import { PatientUuid, useConfig, UserHasAccess } from '@openmrs/esm-framework';
|
|
9
|
-
import { AllergyIntolerance, MedicationRequest, MedicationRequestCombinedStatus } from '../types';
|
|
10
|
-
import { PharmacyConfig } from '../config-schema';
|
|
8
|
+
import { type PatientUuid, useConfig, UserHasAccess } from '@openmrs/esm-framework';
|
|
9
|
+
import { type AllergyIntolerance, type MedicationRequest, MedicationRequestCombinedStatus } from '../types';
|
|
11
10
|
import { computeMedicationRequestCombinedStatus, getConceptCodingDisplay } from '../utils';
|
|
12
11
|
import ActionButtons from '../components/action-buttons.component';
|
|
13
12
|
import { PRIVILEGE_CREATE_DISPENSE } from '../constants';
|
|
13
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
14
14
|
|
|
15
15
|
const PrescriptionDetails: React.FC<{
|
|
16
16
|
encounterUuid: string;
|
|
17
17
|
patientUuid: PatientUuid;
|
|
18
18
|
}> = ({ encounterUuid, patientUuid }) => {
|
|
19
19
|
const { t } = useTranslation();
|
|
20
|
-
const config = useConfig()
|
|
20
|
+
const config = useConfig<PharmacyConfig>();
|
|
21
21
|
const [isAllergiesLoading, setAllergiesLoadingStatus] = useState(true);
|
|
22
22
|
const { allergies, totalAllergies } = usePatientAllergies(patientUuid, config.refreshInterval);
|
|
23
23
|
const { medicationRequestBundles, isError, isLoading } = usePrescriptionDetails(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PatientUuid } from '@openmrs/esm-framework';
|
|
2
|
+
import { type PatientUuid } from '@openmrs/esm-framework';
|
|
3
3
|
import { Tab, Tabs, TabList, TabPanels, TabPanel } from '@carbon/react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import HistoryAndComments from '../history/history-and-comments.component';
|
|
@@ -5,12 +5,12 @@ import PrescriptionTabPanel from './prescription-tab-panel.component';
|
|
|
5
5
|
import styles from './prescriptions.scss';
|
|
6
6
|
import { useLocationForFiltering } from '../location/location.resource';
|
|
7
7
|
import { useConfig } from '@openmrs/esm-framework';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { type SimpleLocation } from '../types';
|
|
9
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
10
10
|
|
|
11
11
|
const PrescriptionTabLists: React.FC = () => {
|
|
12
12
|
const { t } = useTranslation();
|
|
13
|
-
const config = useConfig()
|
|
13
|
+
const config = useConfig<PharmacyConfig>();
|
|
14
14
|
const { filterLocations, isLoading: isFilterLocationsLoading } = useLocationForFiltering(config);
|
|
15
15
|
const [searchTermUserInput, setSearchTermUserInput] = useState(''); // we have a separate "searchTermUserInput" and "searchTerm" in order to debounce
|
|
16
16
|
const [searchTerm, setSearchTerm] = useState('');
|
|
@@ -20,7 +20,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
20
20
|
import { formatDatetime, parseDate, useConfig } from '@openmrs/esm-framework';
|
|
21
21
|
import PrescriptionExpanded from './prescription-expanded.component';
|
|
22
22
|
import { usePrescriptionsTable } from '../medication-request/medication-request.resource';
|
|
23
|
-
import { PharmacyConfig } from '../config-schema';
|
|
23
|
+
import { type PharmacyConfig } from '../config-schema';
|
|
24
24
|
import styles from './prescriptions.scss';
|
|
25
25
|
|
|
26
26
|
interface PrescriptionTabPanelProps {
|
|
@@ -31,7 +31,7 @@ interface PrescriptionTabPanelProps {
|
|
|
31
31
|
|
|
32
32
|
const PrescriptionTabPanel: React.FC<PrescriptionTabPanelProps> = ({ searchTerm, location, status }) => {
|
|
33
33
|
const { t } = useTranslation();
|
|
34
|
-
const config = useConfig()
|
|
34
|
+
const config = useConfig<PharmacyConfig>();
|
|
35
35
|
const [page, setPage] = useState(1);
|
|
36
36
|
const [pageSize, setPageSize] = useState(10);
|
|
37
37
|
const [nextOffSet, setNextOffSet] = useState(0);
|
|
@@ -93,10 +93,10 @@ const PrescriptionTabPanel: React.FC<PrescriptionTabPanelProps> = ({ searchTerm,
|
|
|
93
93
|
{cell.id.endsWith('created')
|
|
94
94
|
? formatDatetime(parseDate(cell.value))
|
|
95
95
|
: cell.id.endsWith('patient')
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
? cell.value.name
|
|
97
|
+
: cell.id.endsWith('status')
|
|
98
|
+
? t(cell.value)
|
|
99
|
+
: cell.value}
|
|
100
100
|
</TableCell>
|
|
101
101
|
))}
|
|
102
102
|
</TableExpandRow>
|
package/src/types.ts
CHANGED
package/src/utils.test.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Coding,
|
|
3
|
-
DosageInstruction,
|
|
4
|
-
Medication,
|
|
5
|
-
MedicationDispense,
|
|
2
|
+
type Coding,
|
|
3
|
+
type DosageInstruction,
|
|
4
|
+
type Medication,
|
|
5
|
+
type MedicationDispense,
|
|
6
6
|
MedicationDispenseStatus,
|
|
7
|
-
MedicationReferenceOrCodeableConcept,
|
|
8
|
-
MedicationRequest,
|
|
9
|
-
MedicationRequestBundle,
|
|
7
|
+
type MedicationReferenceOrCodeableConcept,
|
|
8
|
+
type MedicationRequest,
|
|
9
|
+
type MedicationRequestBundle,
|
|
10
10
|
MedicationRequestCombinedStatus,
|
|
11
11
|
MedicationRequestFulfillerStatus,
|
|
12
12
|
MedicationRequestStatus,
|
package/src/utils.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { mutate } from 'swr';
|
|
2
2
|
import {
|
|
3
|
-
Coding,
|
|
4
|
-
DosageInstruction,
|
|
5
|
-
Medication,
|
|
6
|
-
MedicationDispense,
|
|
3
|
+
type Coding,
|
|
4
|
+
type DosageInstruction,
|
|
5
|
+
type Medication,
|
|
6
|
+
type MedicationDispense,
|
|
7
7
|
MedicationDispenseStatus,
|
|
8
|
-
MedicationReferenceOrCodeableConcept,
|
|
9
|
-
MedicationRequest,
|
|
10
|
-
MedicationRequestBundle,
|
|
8
|
+
type MedicationReferenceOrCodeableConcept,
|
|
9
|
+
type MedicationRequest,
|
|
10
|
+
type MedicationRequestBundle,
|
|
11
11
|
MedicationRequestCombinedStatus,
|
|
12
12
|
MedicationRequestFulfillerStatus,
|
|
13
13
|
MedicationRequestStatus,
|
|
14
|
-
Quantity,
|
|
14
|
+
type Quantity,
|
|
15
15
|
} from './types';
|
|
16
16
|
import { fhirBaseUrl, parseDate } from '@openmrs/esm-framework';
|
|
17
17
|
import {
|
|
File without changes
|