@kenyaemr/esm-shr-app 5.4.4-pre.98 → 5.4.5-pre.16
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/package.json +2 -2
- package/src/config-schema.ts +6 -6
- package/src/hooks/usePatient.ts +23 -9
- package/src/hooks/useSHRSummary.ts +1 -3
- package/src/index.ts +1 -4
- package/src/referrals/dependents/dependents.component.tsx +8 -1
- package/src/referrals/referral-reasons/referral-reasons.component.tsx +2 -2
- package/src/referrals/referral-tabs/referrals-tabs.component.tsx +9 -2
- package/src/referrals/referrals-actions.component.tsx +66 -7
- package/src/referrals/referrals.component.tsx +2 -2
- package/src/routes.json +92 -78
- package/src/shr-summary/shr-summary.component.tsx +10 -5
- package/src/shr-summary/shr-summary.resource.ts +74 -74
- package/src/shr-summary/tables/shr-summary-table.component.tsx +50 -18
- package/src/utils/function.tsx +9 -4
- package/src/workspace/referral-workspace.resource.ts +1 -2
- package/src/workspace/referral.workspace.scss +4 -2
- package/src/workspace/referrals.workspace.component.tsx +189 -182
- package/translations/am.json +4 -1
- package/translations/en.json +4 -1
- package/translations/fr.json +4 -2
- package/translations/sw.json +4 -1
- package/.turbo/turbo-build.log +0 -6
- package/dist/1074.js +0 -1
- package/dist/1074.js.map +0 -1
- package/dist/12.js +0 -17
- package/dist/12.js.map +0 -1
- package/dist/1311.js +0 -1
- package/dist/1311.js.map +0 -1
- package/dist/1462.js +0 -1
- package/dist/1462.js.map +0 -1
- package/dist/1469.js +0 -1
- package/dist/1469.js.map +0 -1
- package/dist/1506.js +0 -13
- package/dist/1506.js.map +0 -1
- package/dist/1718.js +0 -1
- package/dist/1718.js.map +0 -1
- package/dist/1772.js +0 -1
- package/dist/1772.js.map +0 -1
- package/dist/1889.js +0 -1
- package/dist/1889.js.map +0 -1
- package/dist/1972.js +0 -1
- package/dist/1972.js.map +0 -1
- package/dist/1990.js +0 -1
- package/dist/1990.js.map +0 -1
- package/dist/2016.js +0 -1
- package/dist/2016.js.map +0 -1
- package/dist/2153.js +0 -1
- package/dist/2153.js.map +0 -1
- package/dist/216.js +0 -1
- package/dist/216.js.map +0 -1
- package/dist/2270.js +0 -1
- package/dist/2270.js.map +0 -1
- package/dist/2294.js +0 -1
- package/dist/2294.js.map +0 -1
- package/dist/2345.js +0 -1
- package/dist/2345.js.map +0 -1
- package/dist/2388.js +0 -1
- package/dist/2388.js.map +0 -1
- package/dist/2391.js +0 -1
- package/dist/2391.js.map +0 -1
- package/dist/2500.js +0 -1
- package/dist/2500.js.map +0 -1
- package/dist/251.js +0 -1
- package/dist/251.js.map +0 -1
- package/dist/257.js +0 -1
- package/dist/257.js.map +0 -1
- package/dist/2586.js +0 -1
- package/dist/2586.js.map +0 -1
- package/dist/2625.js +0 -1
- package/dist/2625.js.map +0 -1
- package/dist/2685.js +0 -1
- package/dist/2685.js.map +0 -1
- package/dist/2736.js +0 -1
- package/dist/2736.js.map +0 -1
- package/dist/2948.js +0 -1
- package/dist/2948.js.map +0 -1
- package/dist/3089.js +0 -1
- package/dist/3089.js.map +0 -1
- package/dist/3190.js +0 -1
- package/dist/3190.js.map +0 -1
- package/dist/3548.js +0 -1
- package/dist/3548.js.map +0 -1
- package/dist/379.js +0 -1
- package/dist/379.js.map +0 -1
- package/dist/3798.js +0 -1
- package/dist/3798.js.map +0 -1
- package/dist/3816.js +0 -1
- package/dist/3816.js.map +0 -1
- package/dist/3906.js +0 -1
- package/dist/3906.js.map +0 -1
- package/dist/3963.js +0 -1
- package/dist/3963.js.map +0 -1
- package/dist/405.js +0 -1
- package/dist/405.js.map +0 -1
- package/dist/4180.js +0 -1
- package/dist/4180.js.map +0 -1
- package/dist/4282.js +0 -1
- package/dist/4282.js.map +0 -1
- package/dist/4296.js +0 -1
- package/dist/4296.js.map +0 -1
- package/dist/4337.js +0 -1
- package/dist/4337.js.map +0 -1
- package/dist/4368.js +0 -1
- package/dist/4368.js.map +0 -1
- package/dist/452.js +0 -1
- package/dist/452.js.map +0 -1
- package/dist/4735.js +0 -1
- package/dist/4735.js.map +0 -1
- package/dist/4744.js +0 -1
- package/dist/4744.js.map +0 -1
- package/dist/4813.js +0 -2
- package/dist/4813.js.map +0 -1
- package/dist/4858.js +0 -1
- package/dist/4858.js.map +0 -1
- package/dist/487.js +0 -1
- package/dist/487.js.map +0 -1
- package/dist/5202.js +0 -1
- package/dist/5202.js.map +0 -1
- package/dist/5437.js +0 -1
- package/dist/5437.js.map +0 -1
- package/dist/5592.js +0 -1
- package/dist/5592.js.map +0 -1
- package/dist/5669.js +0 -1
- package/dist/5669.js.map +0 -1
- package/dist/6178.js +0 -1
- package/dist/6178.js.map +0 -1
- package/dist/6355.js +0 -1
- package/dist/6355.js.map +0 -1
- package/dist/6455.js +0 -1
- package/dist/6455.js.map +0 -1
- package/dist/6456.js +0 -1
- package/dist/6466.js +0 -3
- package/dist/6466.js.map +0 -1
- package/dist/6492.js +0 -1
- package/dist/6492.js.map +0 -1
- package/dist/6495.js +0 -1
- package/dist/6495.js.map +0 -1
- package/dist/6800.js +0 -1
- package/dist/6800.js.map +0 -1
- package/dist/6925.js +0 -1
- package/dist/6925.js.map +0 -1
- package/dist/7005.js +0 -1
- package/dist/7005.js.map +0 -1
- package/dist/7201.js +0 -1
- package/dist/7201.js.map +0 -1
- package/dist/7234.js +0 -1
- package/dist/7234.js.map +0 -1
- package/dist/7261.js +0 -1
- package/dist/7261.js.map +0 -1
- package/dist/7326.js +0 -1
- package/dist/7383.js +0 -1
- package/dist/7383.js.map +0 -1
- package/dist/7463.js +0 -1
- package/dist/7463.js.map +0 -1
- package/dist/7607.js +0 -1
- package/dist/7626.js +0 -1
- package/dist/7626.js.map +0 -1
- package/dist/7717.js +0 -1
- package/dist/7717.js.map +0 -1
- package/dist/7737.js +0 -1
- package/dist/7737.js.map +0 -1
- package/dist/7739.js +0 -1
- package/dist/7739.js.map +0 -1
- package/dist/7765.js +0 -1
- package/dist/7765.js.map +0 -1
- package/dist/7820.js +0 -1
- package/dist/7820.js.map +0 -1
- package/dist/7971.js +0 -1
- package/dist/7971.js.map +0 -1
- package/dist/8159.js +0 -7
- package/dist/8159.js.map +0 -1
- package/dist/8244.js +0 -1
- package/dist/8244.js.map +0 -1
- package/dist/8323.js +0 -1
- package/dist/8323.js.map +0 -1
- package/dist/845.js +0 -1
- package/dist/845.js.map +0 -1
- package/dist/8570.js +0 -1
- package/dist/8570.js.map +0 -1
- package/dist/87.js +0 -1
- package/dist/87.js.map +0 -1
- package/dist/8727.js +0 -1
- package/dist/9124.js +0 -1
- package/dist/9124.js.map +0 -1
- package/dist/9182.js +0 -1
- package/dist/921.js +0 -1
- package/dist/921.js.map +0 -1
- package/dist/9255.js +0 -1
- package/dist/9255.js.map +0 -1
- package/dist/9310.js +0 -1
- package/dist/9310.js.map +0 -1
- package/dist/9404.js +0 -1
- package/dist/9404.js.map +0 -1
- package/dist/9446.js +0 -1
- package/dist/9446.js.map +0 -1
- package/dist/9449.js +0 -1
- package/dist/9449.js.map +0 -1
- package/dist/9566.js +0 -5
- package/dist/9566.js.map +0 -1
- package/dist/9641.js +0 -1
- package/dist/9641.js.map +0 -1
- package/dist/9727.js +0 -1
- package/dist/9727.js.map +0 -1
- package/dist/9801.js +0 -1
- package/dist/9801.js.map +0 -1
- package/dist/9835.js +0 -11
- package/dist/9835.js.map +0 -1
- package/dist/kenyaemr-esm-shr-app.js +0 -5
- package/dist/kenyaemr-esm-shr-app.js.buildmanifest.json +0 -2634
- package/dist/kenyaemr-esm-shr-app.js.map +0 -1
- package/dist/main.js +0 -5
- package/dist/main.js.map +0 -1
- package/dist/routes.json +0 -1
- package/src/shr-summary/shr-authorization-form.workspace.tsx +0 -149
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenyaemr/esm-shr-app",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.5-pre.16",
|
|
4
4
|
"description": "Patient care panels microfrontend for the OpenMRS SPA",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openmrs"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"stableVersion": "5.4.
|
|
50
|
+
"stableVersion": "5.4.4"
|
|
51
51
|
}
|
package/src/config-schema.ts
CHANGED
|
@@ -6,6 +6,11 @@ export const configSchema = {
|
|
|
6
6
|
_description: 'The national patient unique identifier',
|
|
7
7
|
_default: 'f85081e2-b4be-4e48-b3a4-7994b69bb101',
|
|
8
8
|
},
|
|
9
|
+
nationalIdIdentifierType: {
|
|
10
|
+
_type: Type.UUID,
|
|
11
|
+
_description: 'The national patient unique identifier',
|
|
12
|
+
_default: '49af6cdc-7968-4abb-bf46-de10d7f4859f',
|
|
13
|
+
},
|
|
9
14
|
phoneNumberAttributeType: {
|
|
10
15
|
_type: Type.UUID,
|
|
11
16
|
_description: 'The patient phone number attribute type uuid',
|
|
@@ -16,16 +21,11 @@ export const configSchema = {
|
|
|
16
21
|
_description: 'Social Health Authority Unique Identification Number',
|
|
17
22
|
_default: '24aedd37-b5be-4e08-8311-3721b8d5100d',
|
|
18
23
|
},
|
|
19
|
-
artDirectoryUrl: {
|
|
20
|
-
_type: Type.String,
|
|
21
|
-
_description: 'URL for the ART Directory',
|
|
22
|
-
_default: 'https://art.kenyahmis.org/api/patients',
|
|
23
|
-
},
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type ReferralConfigObject = {
|
|
27
27
|
nationalPatientUniqueIdentifier: string;
|
|
28
|
+
nationalIdIdentifierType: string;
|
|
28
29
|
phoneNumberAttributeType: string;
|
|
29
30
|
socialHealthAuthorityIdentifierType: string;
|
|
30
|
-
artDirectoryUrl: string;
|
|
31
31
|
};
|
package/src/hooks/usePatient.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type FetchResponse, openmrsFetch, type Patient, restBaseUrl, useConfig } from '@openmrs/esm-framework';
|
|
2
2
|
import useSWR from 'swr';
|
|
3
3
|
import { ReferralConfigObject } from '../config-schema';
|
|
4
|
+
import { useMemo } from 'react';
|
|
4
5
|
|
|
5
6
|
function extractValue(display: string) {
|
|
6
7
|
const pattern = /=\s*(.*)$/;
|
|
@@ -15,20 +16,33 @@ const usePatient = (uuid: string) => {
|
|
|
15
16
|
const customPresentation =
|
|
16
17
|
'custom:(uuid,display,identifiers,person:(uuid,display,attributes:(uuid,display,attributeType:(uuid,display))))';
|
|
17
18
|
const url = `${restBaseUrl}/patient/${uuid}?v=${customPresentation}`;
|
|
18
|
-
const { phoneNumberAttributeType } = useConfig<ReferralConfigObject>();
|
|
19
|
+
const { phoneNumberAttributeType, nationalIdIdentifierType } = useConfig<ReferralConfigObject>();
|
|
19
20
|
const { data, error, isLoading } = useSWR<FetchResponse<Patient>>(url, openmrsFetch);
|
|
21
|
+
const nationalId = useMemo(
|
|
22
|
+
() =>
|
|
23
|
+
data?.data?.identifiers
|
|
24
|
+
?.find((id) => id.identifierType?.uuid === nationalIdIdentifierType)
|
|
25
|
+
?.display?.split('=')?.[1]
|
|
26
|
+
?.trim(),
|
|
27
|
+
[data, nationalIdIdentifierType],
|
|
28
|
+
);
|
|
29
|
+
const patientPhoneNumber = useMemo(() => {
|
|
30
|
+
const phone = data?.data?.person?.attributes?.find(
|
|
31
|
+
(attr) => attr.attributeType?.uuid === phoneNumberAttributeType,
|
|
32
|
+
)?.display;
|
|
33
|
+
if (phone) {
|
|
34
|
+
return extractValue(phone);
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}, [data?.data?.person?.attributes, phoneNumberAttributeType]);
|
|
38
|
+
|
|
20
39
|
return {
|
|
21
40
|
isLoading,
|
|
22
41
|
error,
|
|
23
42
|
patient: data?.data,
|
|
24
|
-
patientName: data?.data?.person
|
|
25
|
-
patientPhoneNumber
|
|
26
|
-
|
|
27
|
-
)?.display
|
|
28
|
-
? extractValue(
|
|
29
|
-
data?.data?.person?.attributes?.find((attr) => attr.attributeType.uuid === phoneNumberAttributeType)?.display,
|
|
30
|
-
)
|
|
31
|
-
: undefined,
|
|
43
|
+
patientName: data?.data?.person?.display,
|
|
44
|
+
patientPhoneNumber,
|
|
45
|
+
nationalId,
|
|
32
46
|
};
|
|
33
47
|
};
|
|
34
48
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
2
|
import useSWR from 'swr';
|
|
3
3
|
import { SHRSummary } from '../types/index';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import { deepMerge } from '../utils/function';
|
|
6
4
|
|
|
7
5
|
export const useSHRSummary = (patientUuid: string) => {
|
|
8
|
-
const shrSummaryUrl = `/ws/rest/v1/kenyaemril/
|
|
6
|
+
const shrSummaryUrl = `/ws/rest/v1/kenyaemril/hie-patient-history?patientUuid=${patientUuid}`;
|
|
9
7
|
const { data, mutate, error, isLoading } = useSWR<{ data: SHRSummary }>(shrSummaryUrl, openmrsFetch);
|
|
10
8
|
|
|
11
9
|
return {
|
package/src/index.ts
CHANGED
|
@@ -82,8 +82,5 @@ export const facilityRefferalForm = getAsyncLifecycle(
|
|
|
82
82
|
|
|
83
83
|
// SHR Summary
|
|
84
84
|
export const patientSHRSummary = getAsyncLifecycle(() => import('./shr-summary/shr-summary.component'), options);
|
|
85
|
-
|
|
86
|
-
() => import('./shr-summary/shr-authorization-form.workspace'),
|
|
87
|
-
options,
|
|
88
|
-
);
|
|
85
|
+
|
|
89
86
|
export const referralWrap = getAsyncLifecycle(() => import('./referrals-wrap'), options);
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
} from '@carbon/react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import capitalize from 'lodash/capitalize';
|
|
16
|
+
import { FHIRResource } from '@openmrs/esm-framework';
|
|
17
|
+
import { EmptyState } from '@openmrs/esm-patient-common-lib';
|
|
16
18
|
|
|
17
19
|
type DependentProps = {
|
|
18
20
|
patientUuid: string;
|
|
@@ -76,7 +78,12 @@ const DependentsComponent: React.FC<DependentProps> = ({ patient, patientUuid })
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
if (dependents.length === 0) {
|
|
79
|
-
return
|
|
81
|
+
return (
|
|
82
|
+
<EmptyState
|
|
83
|
+
headerTitle={t('hieDependants', 'HIE Dependants')}
|
|
84
|
+
displayText={t('hieDependants', 'HIE Dependants')}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
return (
|
|
@@ -21,10 +21,10 @@ const ReferralReasonsDialogPopup: React.FC<ReferralReasonsDialogPopupProps> = ({
|
|
|
21
21
|
}) => {
|
|
22
22
|
const { t } = useTranslation();
|
|
23
23
|
|
|
24
|
-
const handleServeClient =
|
|
24
|
+
const handleServeClient = () => {
|
|
25
25
|
try {
|
|
26
|
-
await handleProcessReferral();
|
|
27
26
|
closeModal();
|
|
27
|
+
handleProcessReferral();
|
|
28
28
|
} catch (error) {
|
|
29
29
|
showNotification({
|
|
30
30
|
title: t('referralError', 'Error processing referral'),
|
|
@@ -3,7 +3,14 @@ import { mutate } from 'swr';
|
|
|
3
3
|
import useSWRMutation from 'swr/mutation';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Tab, TabList, Tabs, Button, TabPanel, TabPanels, InlineLoading } from '@carbon/react';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
isDesktop,
|
|
8
|
+
launchWorkspace,
|
|
9
|
+
useLayoutType,
|
|
10
|
+
showSnackbar,
|
|
11
|
+
restBaseUrl,
|
|
12
|
+
launchWorkspace2,
|
|
13
|
+
} from '@openmrs/esm-framework';
|
|
7
14
|
import { AirlineManageGates, UpdateNow } from '@carbon/react/icons';
|
|
8
15
|
|
|
9
16
|
import ReferralTable from '../referrals.component';
|
|
@@ -46,7 +53,7 @@ const ReferralTabs: React.FC = () => {
|
|
|
46
53
|
);
|
|
47
54
|
|
|
48
55
|
const handleReferral = () => {
|
|
49
|
-
|
|
56
|
+
launchWorkspace2('facility-referral-form', {
|
|
50
57
|
workspaceTitle: t('referralForm', 'Referral Form'),
|
|
51
58
|
});
|
|
52
59
|
};
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { Button } from '@carbon/react';
|
|
1
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
2
|
+
import { Button, InlineLoading } from '@carbon/react';
|
|
3
3
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { navigate, showModal, showSnackbar } from '@openmrs/esm-framework';
|
|
6
6
|
import { ReferralReasonsProps } from '../types';
|
|
7
7
|
import { processCommunityReferral } from './refferals.resource';
|
|
8
|
+
import usePatient from '../hooks/usePatient';
|
|
9
|
+
import { sendSHAOtp, verifyOtp } from '../shr-summary/shr-summary.resource';
|
|
8
10
|
|
|
9
11
|
interface ReferralReasonData {
|
|
10
12
|
referralData: ReferralReasonsProps;
|
|
11
13
|
status: string;
|
|
14
|
+
patientUuid: string;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
const CommunityReferralActions: React.FC<ReferralReasonData> = ({ status, referralData }) => {
|
|
17
|
+
const CommunityReferralActions: React.FC<ReferralReasonData> = ({ status, referralData, patientUuid }) => {
|
|
15
18
|
const { t } = useTranslation();
|
|
19
|
+
const idRef = useRef<string>();
|
|
20
|
+
const [accessGranted, setAccessGranted] = useState(true);
|
|
21
|
+
const [isAuthorizing, setIsAuthorizing] = useState(false);
|
|
22
|
+
|
|
23
|
+
const { error, isLoading, patientPhoneNumber, patientName, nationalId } = usePatient(patientUuid);
|
|
16
24
|
|
|
17
25
|
const handleProcessReferral = useCallback(() => {
|
|
18
26
|
processCommunityReferral(referralData.messageId)
|
|
@@ -39,22 +47,73 @@ const CommunityReferralActions: React.FC<ReferralReasonData> = ({ status, referr
|
|
|
39
47
|
});
|
|
40
48
|
}, [referralData, t]);
|
|
41
49
|
|
|
50
|
+
const handleInitiateAuthorization = useCallback(() => {
|
|
51
|
+
const dispose = showModal('otp-verification-modal', {
|
|
52
|
+
onClose: () => {
|
|
53
|
+
if (!accessGranted) {
|
|
54
|
+
setIsAuthorizing(false);
|
|
55
|
+
}
|
|
56
|
+
dispose();
|
|
57
|
+
},
|
|
58
|
+
phoneNumber: patientPhoneNumber || '',
|
|
59
|
+
otpLength: 5,
|
|
60
|
+
expiryMinutes: 5,
|
|
61
|
+
centerBoxes: true,
|
|
62
|
+
onRequestOtp: async (_phone: string) => {
|
|
63
|
+
const { status, id } = await sendSHAOtp(_phone, nationalId as string);
|
|
64
|
+
idRef.current = id;
|
|
65
|
+
if (status !== 'success') {
|
|
66
|
+
throw new Error(t('otpFailed', 'Failed to send OTP'));
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
onVerify: async (enteredOtp: string) => {
|
|
71
|
+
const { status, data, error } = await verifyOtp(enteredOtp, idRef.current as string);
|
|
72
|
+
if (status !== 'success') {
|
|
73
|
+
throw new Error(t('authorizeFailed', 'Authorization failed'));
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
onVerificationSuccess: () => {
|
|
78
|
+
dispose();
|
|
79
|
+
setIsAuthorizing(false);
|
|
80
|
+
setAccessGranted(true);
|
|
81
|
+
handleProcessReferral();
|
|
82
|
+
showSnackbar({
|
|
83
|
+
title: t('success', 'Success'),
|
|
84
|
+
subtitle: t('otpVerificationSuccessMessage', 'OTP Vefification succesfull'),
|
|
85
|
+
kind: 'success',
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
onCleanup: () => {
|
|
90
|
+
if (!accessGranted) {
|
|
91
|
+
setIsAuthorizing(false);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}, [accessGranted, handleProcessReferral, nationalId, patientPhoneNumber, t]);
|
|
96
|
+
|
|
42
97
|
const refearralReasonsHandleClick = useCallback(() => {
|
|
43
98
|
const dispose = showModal('referral-reasons-dialog', {
|
|
44
99
|
closeModal: () => dispose(),
|
|
45
100
|
referralReasons: referralData,
|
|
46
101
|
status: status,
|
|
47
|
-
handleProcessReferral,
|
|
102
|
+
handleProcessReferral: handleInitiateAuthorization,
|
|
48
103
|
});
|
|
49
|
-
}, [referralData,
|
|
104
|
+
}, [referralData, handleInitiateAuthorization, status]);
|
|
105
|
+
|
|
106
|
+
if (isLoading || isAuthorizing) {
|
|
107
|
+
return <InlineLoading description={t('loading', 'Loading...')} />;
|
|
108
|
+
}
|
|
50
109
|
|
|
51
110
|
return (
|
|
52
111
|
<>
|
|
53
|
-
<Button kind="primary" size="md" onClick={
|
|
112
|
+
<Button kind="primary" size="md" onClick={refearralReasonsHandleClick}>
|
|
54
113
|
{t('viewReasons', 'View reasons')}
|
|
55
114
|
</Button>
|
|
56
115
|
{status === 'completed' ? null : (
|
|
57
|
-
<Button kind="primary" size="md" onClick={
|
|
116
|
+
<Button kind="primary" size="md" onClick={handleInitiateAuthorization}>
|
|
58
117
|
{t('serveClient', 'Serve client')}
|
|
59
118
|
</Button>
|
|
60
119
|
)}
|
|
@@ -23,7 +23,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
23
23
|
import { useCommunityReferrals } from './refferals.resource';
|
|
24
24
|
import CommunityReferralActions from './referrals-actions.component';
|
|
25
25
|
import { ReferralReasonsProps } from '../types';
|
|
26
|
-
import { usePaginationInfo } from '@openmrs/esm-patient-common-lib
|
|
26
|
+
import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
27
27
|
|
|
28
28
|
type ReferralProps = {
|
|
29
29
|
status: string;
|
|
@@ -124,7 +124,7 @@ const ReferralTable: React.FC<ReferralProps> = ({ status }) => {
|
|
|
124
124
|
dateReferred: record.dateReferred,
|
|
125
125
|
referredFrom: record.referredFrom,
|
|
126
126
|
referralService: record.referralReasons?.category,
|
|
127
|
-
actions: <CommunityReferralActions status={status} referralData={referralReasonsx} />,
|
|
127
|
+
actions: <CommunityReferralActions status={status} referralData={referralReasonsx} patientUuid={record.uuid} />,
|
|
128
128
|
};
|
|
129
129
|
rowData.push(s);
|
|
130
130
|
});
|
package/src/routes.json
CHANGED
|
@@ -1,80 +1,94 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
|
3
|
+
"backendDependencies": {
|
|
4
|
+
"kenyaemr": "^19.0.0"
|
|
5
|
+
},
|
|
6
|
+
"pages": [
|
|
7
|
+
{
|
|
8
|
+
"component": "shrHome",
|
|
9
|
+
"route": "referrals"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"extensions": [
|
|
13
|
+
{
|
|
14
|
+
"name": "patient-chart-shr-summary-dashboard-link",
|
|
15
|
+
"component": "shrSummaryDashboardLink",
|
|
16
|
+
"meta": {
|
|
17
|
+
"columns": 1,
|
|
18
|
+
"columnSpan": 1,
|
|
19
|
+
"slot": "patient-chart-shr-summary-dashboard-slot",
|
|
20
|
+
"path": "SHR Portal"
|
|
21
|
+
},
|
|
22
|
+
"featureFlag": "healthInformationExchange"
|
|
5
23
|
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"offline": false
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
24
|
+
{
|
|
25
|
+
"name": "SHR Portal",
|
|
26
|
+
"slot": "patient-chart-shr-summary-dashboard-slot",
|
|
27
|
+
"component": "patientSHRSummary",
|
|
28
|
+
"meta": {
|
|
29
|
+
"columnSpan": 4
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "referrals",
|
|
34
|
+
"slot": "referrals-slot",
|
|
35
|
+
"component": "referralWrap"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "referrals-link",
|
|
39
|
+
"slot": "homepage-dashboard-slot",
|
|
40
|
+
"component": "ReferralsDashboardLink",
|
|
41
|
+
"meta": {
|
|
42
|
+
"name": "referrals",
|
|
43
|
+
"title": "referrals",
|
|
44
|
+
"slot": "referrals-slot"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "referral-reasons-dialog",
|
|
49
|
+
"component": "referralReasonsDialogPopup"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "referral-view-link",
|
|
53
|
+
"component": "referralLink",
|
|
54
|
+
"order": 13,
|
|
55
|
+
"meta": {
|
|
56
|
+
"columns": 1,
|
|
57
|
+
"columnSpan": 1,
|
|
58
|
+
"slot": "patient-chart-referral-slot",
|
|
59
|
+
"path": "referral",
|
|
60
|
+
"layoutMode": "anchored"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "referral-view",
|
|
65
|
+
"slot": "patient-chart-referral-slot",
|
|
66
|
+
"component": "referralWidget",
|
|
67
|
+
"order": 0,
|
|
68
|
+
"online": true,
|
|
69
|
+
"offline": false
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"workspaces2": [
|
|
73
|
+
{
|
|
74
|
+
"name": "facility-referral-form",
|
|
75
|
+
"component": "facilityRefferalForm",
|
|
76
|
+
"window": "referral-workspace-window"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"workspaceWindows2": [
|
|
80
|
+
{
|
|
81
|
+
"name": "referral-workspace-window",
|
|
82
|
+
"group": "referral-workspace-group",
|
|
83
|
+
"canMaximize": false,
|
|
84
|
+
"width": "wider"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"workspaceGroups2": [
|
|
88
|
+
{
|
|
89
|
+
"name": "referral-workspace-group",
|
|
90
|
+
"persistence": "closeable",
|
|
91
|
+
"closeable": true
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { DataTableSkeleton,
|
|
1
|
+
import { DataTableSkeleton, Tab, TabList, TabPanel, TabPanels, Tabs } from '@carbon/react';
|
|
2
2
|
import { ErrorState } from '@openmrs/esm-patient-common-lib';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { FC } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import usePatientIdentifiers from '../hooks/usePatientIdentifiers';
|
|
6
|
-
import PatientSHRSummaryTable from './tables/shr-summary-table.component';
|
|
7
6
|
import DependentsComponent from '../referrals/dependents/dependents.component';
|
|
7
|
+
import PatientSHRSummaryTable from './tables/shr-summary-table.component';
|
|
8
|
+
|
|
9
|
+
type SHRSummaryPanelProps = {
|
|
10
|
+
patientUuid: string;
|
|
11
|
+
patient: fhir.Patient;
|
|
12
|
+
};
|
|
8
13
|
|
|
9
|
-
const SHRSummaryPanel = ({ patient, patientUuid }) => {
|
|
14
|
+
const SHRSummaryPanel: FC<SHRSummaryPanelProps> = ({ patient, patientUuid }) => {
|
|
10
15
|
const { t } = useTranslation();
|
|
11
16
|
const { error, isLoading } = usePatientIdentifiers(patientUuid);
|
|
12
17
|
|
|
@@ -30,7 +35,7 @@ const SHRSummaryPanel = ({ patient, patientUuid }) => {
|
|
|
30
35
|
<DependentsComponent patientUuid={patientUuid} patient={patient} />
|
|
31
36
|
</TabPanel>
|
|
32
37
|
<TabPanel>
|
|
33
|
-
<PatientSHRSummaryTable />
|
|
38
|
+
<PatientSHRSummaryTable patient={patient} patientUuid={patientUuid} />
|
|
34
39
|
</TabPanel>
|
|
35
40
|
</TabPanels>
|
|
36
41
|
</Tabs>
|