@kenyaemr/esm-patient-registration-app 5.2.2 → 6.0.0
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/130.js +1 -1
- package/dist/130.js.map +1 -1
- package/dist/271.js +1 -0
- package/dist/319.js +1 -1
- package/dist/330.js +1 -1
- package/dist/460.js +1 -1
- package/dist/537.js +1 -1
- package/dist/574.js +1 -1
- package/dist/59.js +1 -1
- package/dist/59.js.map +1 -1
- package/dist/619.js +1 -0
- package/dist/619.js.map +1 -0
- package/dist/644.js +1 -0
- package/dist/735.js +1 -1
- package/dist/757.js +1 -1
- package/dist/784.js +1 -1
- package/dist/788.js +1 -1
- package/dist/807.js +1 -1
- package/dist/833.js +1 -1
- package/dist/895.js +2 -0
- package/dist/{388.js.LICENSE.txt → 895.js.LICENSE.txt} +4 -2
- package/dist/895.js.map +1 -0
- package/dist/{openmrs-esm-patient-registration-app.js → kenyaemr-esm-patient-registration-app.js} +1 -1
- package/dist/{openmrs-esm-patient-registration-app.js.buildmanifest.json → kenyaemr-esm-patient-registration-app.js.buildmanifest.json} +117 -73
- package/dist/kenyaemr-esm-patient-registration-app.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +4 -2
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +6 -5
- package/src/add-patient-link.test.tsx +9 -7
- package/src/config-schema.ts +31 -38
- package/src/constants.ts +1 -1
- package/src/offline.resources.ts +13 -18
- package/src/offline.ts +8 -6
- package/src/patient-registration/before-save-prompt.tsx +2 -1
- package/src/patient-registration/field/__mocks__/field.resource.ts +1 -1
- package/src/patient-registration/field/address/address-field.component.tsx +5 -4
- package/src/patient-registration/field/address/address-hierarchy.resource.tsx +2 -2
- package/src/patient-registration/field/address/address-search.component.tsx +1 -14
- package/src/patient-registration/field/address/custom-address-field.component.tsx +1 -1
- package/src/patient-registration/field/address/tests/address-hierarchy.test.tsx +3 -3
- package/src/patient-registration/field/address/tests/address-search-component.test.tsx +14 -7
- package/src/patient-registration/field/custom-field.component.tsx +1 -1
- package/src/patient-registration/field/dob/dob.component.tsx +2 -2
- package/src/patient-registration/field/dob/dob.test.tsx +0 -3
- package/src/patient-registration/field/field.component.tsx +4 -1
- package/src/patient-registration/field/field.resource.ts +4 -4
- package/src/patient-registration/field/field.test.tsx +98 -95
- package/src/patient-registration/field/gender/gender-field.component.tsx +4 -4
- package/src/patient-registration/field/gender/gender-field.test.tsx +7 -14
- package/src/patient-registration/field/id/id-field.component.tsx +6 -6
- package/src/patient-registration/field/id/id-field.test.tsx +9 -7
- package/src/patient-registration/field/id/identifier-selection-overlay.component.tsx +1 -1
- package/src/patient-registration/field/name/name-field.component.tsx +1 -1
- package/src/patient-registration/field/obs/obs-field.component.tsx +35 -33
- package/src/patient-registration/field/obs/obs-field.test.tsx +106 -28
- package/src/patient-registration/field/person-attributes/coded-attributes.component.tsx +1 -1
- package/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx +70 -24
- package/src/patient-registration/field/person-attributes/coded-person-attribute-field.test.tsx +54 -30
- package/src/patient-registration/field/person-attributes/person-attribute-field.component.tsx +4 -3
- package/src/patient-registration/field/person-attributes/person-attribute-field.test.tsx +1 -1
- package/src/patient-registration/field/person-attributes/{person-attributes.resource.tsx → person-attributes.resource.ts} +3 -3
- package/src/patient-registration/field/person-attributes/text-person-attribute-field.component.tsx +1 -1
- package/src/patient-registration/field/phone/phone-field.component.tsx +16 -0
- package/src/patient-registration/form-manager.test.ts +1 -1
- package/src/patient-registration/form-manager.ts +22 -24
- package/src/patient-registration/input/basic-input/select/select-input.test.tsx +3 -3
- package/src/patient-registration/input/custom-input/autosuggest/autosuggest.component.tsx +5 -5
- package/src/patient-registration/input/custom-input/autosuggest/autosuggest.test.tsx +70 -58
- package/src/patient-registration/input/custom-input/identifier/identifier-input.component.tsx +2 -2
- package/src/patient-registration/input/custom-input/identifier/identifier-input.test.tsx +2 -5
- package/src/patient-registration/input/custom-input/identifier/utils.ts +1 -1
- package/src/patient-registration/input/dummy-data/dummy-data-input.component.tsx +1 -1
- package/src/patient-registration/input/dummy-data/dummy-data-input.test.tsx +6 -6
- package/src/patient-registration/patient-registration-context.ts +3 -4
- package/src/patient-registration/patient-registration-hooks.ts +25 -20
- package/src/patient-registration/patient-registration-utils.ts +7 -7
- package/src/patient-registration/patient-registration.component.tsx +20 -10
- package/src/patient-registration/patient-registration.resource.test.tsx +3 -3
- package/src/patient-registration/{patient-registration.resource.tsx → patient-registration.resource.ts} +15 -15
- package/src/patient-registration/patient-registration.test.tsx +270 -251
- package/src/patient-registration/{patient-registration.types.tsx → patient-registration.types.ts} +12 -3
- package/src/patient-registration/section/death-info/death-info-section.test.tsx +33 -45
- package/src/patient-registration/section/demographics/demographics-section.test.tsx +1 -2
- package/src/patient-registration/section/generic-section.component.tsx +1 -1
- package/src/patient-registration/section/patient-relationships/relationships-section.component.tsx +3 -3
- package/src/patient-registration/section/patient-relationships/relationships-section.test.tsx +17 -5
- package/src/patient-registration/section/patient-relationships/relationships.resource.tsx +4 -4
- package/src/patient-registration/section/section-wrapper.component.tsx +1 -1
- package/src/patient-registration/section/section.component.tsx +1 -1
- package/src/patient-registration/validation/patient-registration-validation.test.tsx +140 -126
- package/src/patient-registration/validation/patient-registration-validation.tsx +54 -46
- package/src/patient-verification/patient-verification-hook.tsx +13 -4
- package/src/patient-verification/patient-verification-utils.ts +20 -12
- package/src/patient-verification/patient-verification.component.tsx +13 -6
- package/src/patient-verification/patient-verification.scss +0 -1
- package/src/patient-verification/verification-modal/confirm-prompt.component.tsx +2 -11
- package/src/routes.json +1 -0
- package/src/widgets/cancel-patient-edit.test.tsx +7 -4
- package/src/widgets/delete-identifier-confirmation-modal.test.tsx +7 -4
- package/src/widgets/display-photo.test.tsx +1 -1
- package/src/widgets/edit-patient-details-button.test.tsx +12 -7
- package/translations/am.json +30 -14
- package/translations/ar.json +30 -14
- package/translations/en.json +11 -11
- package/translations/es.json +34 -22
- package/translations/fr.json +48 -40
- package/translations/he.json +22 -2
- package/translations/km.json +22 -2
- package/translations/zh.json +97 -0
- package/translations/zh_CN.json +97 -0
- package/tsconfig.json +1 -1
- package/__mocks__/autogenerationoptions.mock.ts +0 -34
- package/dist/388.js +0 -2
- package/dist/388.js.map +0 -1
- package/dist/598.js +0 -1
- package/dist/598.js.map +0 -1
- package/dist/openmrs-esm-patient-registration-app.js.map +0 -1
- package/src/patient-registration/field/__mocks__/identifier-types.mock.ts +0 -76
- package/src/patient-registration/field/__mocks__/identifiers.mock.ts +0 -27
- package/src/patient-registration/field/address/tests/mocks.ts +0 -98
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import { FetchResponse, openmrsFetch, showNotification, showToast } from '@openmrs/esm-framework';
|
|
1
|
+
import { type FetchResponse, openmrsFetch, showNotification, showToast } from '@openmrs/esm-framework';
|
|
2
2
|
import { generateNUPIPayload, handleClientRegistryResponse } from './patient-verification-utils';
|
|
3
3
|
import useSWR from 'swr';
|
|
4
4
|
import useSWRImmutable from 'swr/immutable';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type ConceptAnswers,
|
|
7
|
+
type ConceptResponse,
|
|
8
|
+
type FormValues,
|
|
9
|
+
} from '../patient-registration/patient-registration.types';
|
|
6
10
|
|
|
7
|
-
export function searchClientRegistry(
|
|
8
|
-
|
|
11
|
+
export function searchClientRegistry(
|
|
12
|
+
identifierType: string,
|
|
13
|
+
searchTerm: string,
|
|
14
|
+
token: string,
|
|
15
|
+
countryCode: string = 'KE',
|
|
16
|
+
) {
|
|
17
|
+
const url = `https://afyakenyaapi.health.go.ke/partners/registry/search/${countryCode}/${identifierType}/${searchTerm}`;
|
|
9
18
|
return fetch(url, { headers: { Authorization: `Bearer ${token}` } }).then((r) => r.json());
|
|
10
19
|
}
|
|
11
20
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { showModal } from '@openmrs/esm-framework';
|
|
2
|
-
import { FormikProps } from 'formik';
|
|
3
|
-
import { ClientRegistryPatient, RegistryPatient } from './verification-types';
|
|
2
|
+
import { type FormikProps } from 'formik';
|
|
3
|
+
import { type ClientRegistryPatient, type RegistryPatient } from './verification-types';
|
|
4
4
|
import counties from './assets/counties.json';
|
|
5
|
-
import { FormValues } from '../patient-registration/patient-registration.types';
|
|
5
|
+
import { type FormValues } from '../patient-registration/patient-registration.types';
|
|
6
|
+
import { capitalize } from 'lodash-es';
|
|
6
7
|
|
|
7
8
|
export function handleClientRegistryResponse(
|
|
8
9
|
clientResponse: ClientRegistryPatient,
|
|
@@ -83,7 +84,7 @@ export function handleClientRegistryResponse(
|
|
|
83
84
|
familyName: lastName,
|
|
84
85
|
middleName: middleName,
|
|
85
86
|
givenName: firstName,
|
|
86
|
-
gender: gender
|
|
87
|
+
gender: clientResponse.client.gender,
|
|
87
88
|
birthdate: new Date(dateOfBirth),
|
|
88
89
|
isDead: !isAlive,
|
|
89
90
|
attributes: {
|
|
@@ -94,9 +95,9 @@ export function handleClientRegistryResponse(
|
|
|
94
95
|
address: {
|
|
95
96
|
address1: residence?.address,
|
|
96
97
|
address2: '',
|
|
97
|
-
address4: residence?.ward,
|
|
98
|
+
address4: capitalize(residence?.ward ?? ''),
|
|
98
99
|
cityVillage: residence?.village,
|
|
99
|
-
stateProvince: residence?.subCounty,
|
|
100
|
+
stateProvince: capitalize(residence?.subCounty ?? ''),
|
|
100
101
|
countyDistrict: counties.find((county) => county.code === parseInt(residence?.county))?.name,
|
|
101
102
|
country: 'Kenya',
|
|
102
103
|
postalCode: residence?.address,
|
|
@@ -104,14 +105,21 @@ export function handleClientRegistryResponse(
|
|
|
104
105
|
identifiers: { ...props.values.identifiers, ...nupiIdentifiers },
|
|
105
106
|
obs: {
|
|
106
107
|
'1054AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':
|
|
107
|
-
props.values.concepts.find(
|
|
108
|
-
|
|
108
|
+
props.values.concepts.find(
|
|
109
|
+
(concept) =>
|
|
110
|
+
concept.display?.toLowerCase()?.includes(clientResponse.client.maritalStatus?.toLowerCase()),
|
|
111
|
+
)?.uuid ?? '',
|
|
109
112
|
'1712AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':
|
|
110
|
-
props.values.concepts.find(
|
|
111
|
-
|
|
113
|
+
props.values.concepts.find(
|
|
114
|
+
(concept) =>
|
|
115
|
+
concept.display?.toLowerCase()?.includes(clientResponse.client.educationLevel?.toLowerCase()),
|
|
116
|
+
)?.uuid ?? '',
|
|
112
117
|
'1542AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
clientResponse.client.occupation === undefined || clientResponse.client.occupation === null
|
|
119
|
+
? '1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
120
|
+
: props.values.concepts.find(
|
|
121
|
+
(concept) => concept.display?.toLowerCase() === clientResponse.client.occupation?.toLowerCase(),
|
|
122
|
+
)?.uuid ?? '5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
115
123
|
},
|
|
116
124
|
});
|
|
117
125
|
dispose();
|
|
@@ -6,11 +6,12 @@ import { countries, verificationIdentifierTypes } from './assets/verification-as
|
|
|
6
6
|
import { searchClientRegistry, useGlobalProperties } from './patient-verification-hook';
|
|
7
7
|
import { showToast } from '@openmrs/esm-framework';
|
|
8
8
|
import { handleClientRegistryResponse } from './patient-verification-utils';
|
|
9
|
-
import { FormikProps } from 'formik';
|
|
10
|
-
import { FormValues } from '../patient-registration/patient-registration.types';
|
|
9
|
+
import { type FormikProps } from 'formik';
|
|
10
|
+
import { type FormValues } from '../patient-registration/patient-registration.types';
|
|
11
11
|
|
|
12
12
|
interface PatientVerificationProps {
|
|
13
13
|
props: FormikProps<FormValues>;
|
|
14
|
+
setInitialFormValues: React.Dispatch<FormValues>;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
|
|
@@ -19,6 +20,7 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
|
|
|
19
20
|
const [verificationCriteria, setVerificationCriteria] = useState({
|
|
20
21
|
searchTerm: '',
|
|
21
22
|
identifierType: '',
|
|
23
|
+
countryCode: 'KE',
|
|
22
24
|
});
|
|
23
25
|
const [isLoadingSearch, setIsLoadingSearch] = useState(false);
|
|
24
26
|
|
|
@@ -29,8 +31,10 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
|
|
|
29
31
|
verificationCriteria.identifierType,
|
|
30
32
|
verificationCriteria.searchTerm,
|
|
31
33
|
props.values.token,
|
|
34
|
+
verificationCriteria.countryCode,
|
|
32
35
|
);
|
|
33
36
|
setIsLoadingSearch(false);
|
|
37
|
+
|
|
34
38
|
handleClientRegistryResponse(clientRegistryResponse, props, verificationCriteria.searchTerm);
|
|
35
39
|
} catch (error) {
|
|
36
40
|
showToast({
|
|
@@ -67,9 +71,12 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
|
|
|
67
71
|
id="selectCountry"
|
|
68
72
|
items={countries}
|
|
69
73
|
itemToString={(item) => item?.name ?? ''}
|
|
70
|
-
label="
|
|
74
|
+
label="Select country"
|
|
71
75
|
titleText={t('selectCountry', 'Select country')}
|
|
72
76
|
initialSelectedItem={countries[0]}
|
|
77
|
+
onChange={({ selectedItem }) =>
|
|
78
|
+
setVerificationCriteria({ ...verificationCriteria, countryCode: selectedItem.initials })
|
|
79
|
+
}
|
|
73
80
|
/>
|
|
74
81
|
</Layer>
|
|
75
82
|
<Layer>
|
|
@@ -78,7 +85,7 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
|
|
|
78
85
|
id="selectIdentifierType"
|
|
79
86
|
items={verificationIdentifierTypes}
|
|
80
87
|
itemToString={(item) => item?.name ?? ''}
|
|
81
|
-
label="
|
|
88
|
+
label="Select identifier type"
|
|
82
89
|
titleText={t('selectIdentifierType', 'Select identifier type')}
|
|
83
90
|
onChange={({ selectedItem }) =>
|
|
84
91
|
setVerificationCriteria({ ...verificationCriteria, identifierType: selectedItem.value })
|
|
@@ -87,9 +94,9 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
|
|
|
87
94
|
</Layer>
|
|
88
95
|
<Layer>
|
|
89
96
|
<Search
|
|
90
|
-
id="
|
|
97
|
+
id="clientRegistrySearch"
|
|
91
98
|
autoFocus
|
|
92
|
-
placeHolderText=
|
|
99
|
+
placeHolderText={t('searchClientRegistry', 'Search client registry')}
|
|
93
100
|
disabled={!verificationCriteria.identifierType}
|
|
94
101
|
onChange={(event) => setVerificationCriteria({ ...verificationCriteria, searchTerm: event.target.value })}
|
|
95
102
|
/>
|
|
@@ -22,8 +22,6 @@ interface ConfirmPromptProps {
|
|
|
22
22
|
|
|
23
23
|
const ConfirmPrompt: React.FC<ConfirmPromptProps> = ({ close, onConfirm, patient }) => {
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
-
const { facilityName, isLoading } = useFacilityName(patient?.originFacilityKmflCode);
|
|
26
|
-
|
|
27
25
|
return (
|
|
28
26
|
<>
|
|
29
27
|
<div className="cds--modal-header">
|
|
@@ -56,15 +54,8 @@ const ConfirmPrompt: React.FC<ConfirmPromptProps> = ({ close, onConfirm, patient
|
|
|
56
54
|
<PatientInfo label={t('age', 'Age')} value={age(patient?.dateOfBirth)} />
|
|
57
55
|
<PatientInfo label={t('dateOfBirth', 'Date of birth')} value={formatDate(new Date(patient?.dateOfBirth))} />
|
|
58
56
|
<PatientInfo label={t('gender', 'Gender')} value={capitalize(patient?.gender)} />
|
|
59
|
-
<PatientInfo label={t('
|
|
60
|
-
<PatientInfo
|
|
61
|
-
label={t('originFacilityCode', 'Origin facility code')}
|
|
62
|
-
value={patient?.originFacilityKmflCode}
|
|
63
|
-
/>
|
|
64
|
-
<PatientInfo
|
|
65
|
-
label={t('originFacilityName', 'Origin facility name')}
|
|
66
|
-
value={isLoading ? '--' : facilityName?.name}
|
|
67
|
-
/>
|
|
57
|
+
<PatientInfo label={t('NUPI')} value={patient?.clientNumber} />
|
|
58
|
+
<PatientInfo label={t('SHA Number')} value={'--'} />
|
|
68
59
|
</div>
|
|
69
60
|
</div>
|
|
70
61
|
</div>
|
package/src/routes.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { screen, render } from '@testing-library/react';
|
|
3
4
|
import CancelPatientEdit from './cancel-patient-edit.component';
|
|
4
5
|
|
|
5
6
|
describe('CancelPatientEdit component', () => {
|
|
@@ -10,15 +11,17 @@ describe('CancelPatientEdit component', () => {
|
|
|
10
11
|
jest.clearAllMocks();
|
|
11
12
|
});
|
|
12
13
|
|
|
13
|
-
it('renders the modal and triggers close and onConfirm functions', () => {
|
|
14
|
+
it('renders the modal and triggers close and onConfirm functions', async () => {
|
|
15
|
+
const user = userEvent.setup();
|
|
16
|
+
|
|
14
17
|
render(<CancelPatientEdit close={mockClose} onConfirm={mockOnConfirm} />);
|
|
15
18
|
|
|
16
19
|
const cancelButton = screen.getByRole('button', { name: /Cancel/i });
|
|
17
|
-
|
|
20
|
+
await user.click(cancelButton);
|
|
18
21
|
expect(mockClose).toHaveBeenCalledTimes(1);
|
|
19
22
|
|
|
20
23
|
const discardButton = screen.getByRole('button', { name: /discard/i });
|
|
21
|
-
|
|
24
|
+
await user.click(discardButton);
|
|
22
25
|
expect(mockOnConfirm).toHaveBeenCalledTimes(1);
|
|
23
26
|
});
|
|
24
27
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import DeleteIdentifierConfirmationModal from './delete-identifier-confirmation-modal';
|
|
4
5
|
|
|
5
6
|
describe('DeleteIdentifierConfirmationModal component', () => {
|
|
@@ -11,7 +12,9 @@ describe('DeleteIdentifierConfirmationModal component', () => {
|
|
|
11
12
|
jest.clearAllMocks();
|
|
12
13
|
});
|
|
13
14
|
|
|
14
|
-
it('renders the modal and triggers deleteIdentifier function', () => {
|
|
15
|
+
it('renders the modal and triggers deleteIdentifier function', async () => {
|
|
16
|
+
const user = userEvent.setup();
|
|
17
|
+
|
|
15
18
|
render(
|
|
16
19
|
<DeleteIdentifierConfirmationModal
|
|
17
20
|
deleteIdentifier={mockDeleteIdentifier}
|
|
@@ -21,11 +24,11 @@ describe('DeleteIdentifierConfirmationModal component', () => {
|
|
|
21
24
|
);
|
|
22
25
|
|
|
23
26
|
const cancelButton = screen.getByRole('button', { name: /cancel/i });
|
|
24
|
-
|
|
27
|
+
await user.click(cancelButton);
|
|
25
28
|
expect(mockDeleteIdentifier).toHaveBeenCalledWith(false);
|
|
26
29
|
|
|
27
30
|
const removeButton = screen.getByRole('button', { name: /remove identifier/i });
|
|
28
|
-
|
|
31
|
+
await user.click(removeButton);
|
|
29
32
|
expect(mockDeleteIdentifier).toHaveBeenCalledWith(true);
|
|
30
33
|
});
|
|
31
34
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { mockPatient } from '__mocks__';
|
|
3
4
|
import DisplayPatientPhoto from './display-photo.component';
|
|
4
|
-
import { mockPatient } from '../../../../__mocks__/appointments.mock';
|
|
5
5
|
|
|
6
6
|
jest.mock('../patient-registration/patient-registration.resource', () => ({
|
|
7
7
|
usePatientPhoto: jest.fn().mockReturnValue({ data: { imageSrc: 'test-image-src' } }),
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { navigate } from '@openmrs/esm-framework';
|
|
5
|
-
import { mockPatient } from '
|
|
5
|
+
import { mockPatient } from '__mocks__';
|
|
6
|
+
import EditPatientDetailsButton from './edit-patient-details-button.component';
|
|
6
7
|
|
|
7
8
|
describe('EditPatientDetailsButton', () => {
|
|
8
9
|
const patientUuid = mockPatient.uuid;
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
it('should navigate to the edit page when clicked', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
10
13
|
const mockNavigate = navigate as jest.Mock;
|
|
11
14
|
|
|
12
15
|
jest.mock('@openmrs/esm-framework', () => {
|
|
@@ -19,17 +22,19 @@ describe('EditPatientDetailsButton', () => {
|
|
|
19
22
|
render(<EditPatientDetailsButton patientUuid={patientUuid} />);
|
|
20
23
|
|
|
21
24
|
const button = screen.getByRole('menuitem');
|
|
22
|
-
|
|
25
|
+
await user.click(button);
|
|
23
26
|
|
|
24
27
|
expect(mockNavigate).toHaveBeenCalledWith({ to: expect.stringContaining(`/patient/${patientUuid}/edit`) });
|
|
25
28
|
});
|
|
26
29
|
|
|
27
|
-
it('should call the onTransition function when provided', () => {
|
|
30
|
+
it('should call the onTransition function when provided', async () => {
|
|
31
|
+
const user = userEvent.setup();
|
|
32
|
+
|
|
28
33
|
const onTransitionMock = jest.fn();
|
|
29
34
|
render(<EditPatientDetailsButton patientUuid={patientUuid} onTransition={onTransitionMock} />);
|
|
30
35
|
|
|
31
36
|
const button = screen.getByRole('menuitem');
|
|
32
|
-
|
|
37
|
+
await user.click(button);
|
|
33
38
|
|
|
34
39
|
expect(onTransitionMock).toHaveBeenCalled();
|
|
35
40
|
});
|
package/translations/am.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"addRelationshipButtonText": "Add Relationship",
|
|
3
3
|
"addressHeader": "Address",
|
|
4
|
+
"age": "Age",
|
|
4
5
|
"allFieldsRequiredText": "All fields are required unless marked optional",
|
|
5
6
|
"autoGeneratedPlaceholderText": "Auto-generated",
|
|
6
|
-
"birthdayNotInTheFuture": "",
|
|
7
|
-
"birthdayRequired": "",
|
|
7
|
+
"birthdayNotInTheFuture": "Birthday cannot be in the future",
|
|
8
|
+
"birthdayRequired": "Birthday is required",
|
|
8
9
|
"birthFieldLabelText": "Birth",
|
|
9
10
|
"cancel": "Cancel",
|
|
10
11
|
"causeOfDeathInputLabel": "Cause of Death",
|
|
12
|
+
"clientRegistryEmpty": "Create & Post Patient",
|
|
13
|
+
"clientVerificationWithClientRegistry": "Client verification with client registry",
|
|
11
14
|
"closeOverlay": "Close overlay",
|
|
15
|
+
"codedPersonAttributeAnswerSetEmpty": "The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an answer concept set UUID '{{answerConceptSetUuid}}' that does not have any concept answers.",
|
|
16
|
+
"codedPersonAttributeAnswerSetInvalid": "The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an invalid answer concept set UUID '{{answerConceptSetUuid}}'.",
|
|
17
|
+
"codedPersonAttributeNoAnswerSet": "The person attribute field '{{codedPersonAttributeFieldId}}' is of type 'coded' but has been defined without an answer concept set UUID. The 'answerConceptSetUuid' key is required.",
|
|
12
18
|
"configure": "Configure",
|
|
13
19
|
"configureIdentifiers": "Configure identifiers",
|
|
14
20
|
"contactSection": "Contact Details",
|
|
21
|
+
"continue": "Continue to registration",
|
|
15
22
|
"createNew": "Create New",
|
|
23
|
+
"dateOfBirth": "Date of birth",
|
|
16
24
|
"dateOfBirthLabelText": "Date of Birth",
|
|
17
25
|
"deathDateInputLabel": "Date of Death",
|
|
18
|
-
"deathdayNotInTheFuture": "",
|
|
26
|
+
"deathdayNotInTheFuture": "Death day cannot be in the future",
|
|
19
27
|
"deathSection": "Death Info",
|
|
20
28
|
"deleteIdentifierTooltip": "Delete",
|
|
21
29
|
"deleteRelationshipTooltipText": "Delete",
|
|
@@ -33,35 +41,41 @@
|
|
|
33
41
|
"estimatedAgeInMonthsLabelText": "Estimated age in months",
|
|
34
42
|
"estimatedAgeInYearsLabelText": "Estimated age in years",
|
|
35
43
|
"familyNameLabelText": "Family Name",
|
|
36
|
-
"familyNameRequired": "",
|
|
44
|
+
"familyNameRequired": "Family name is required",
|
|
37
45
|
"female": "Female",
|
|
38
46
|
"fullNameLabelText": "Full Name",
|
|
47
|
+
"gender": "Gender",
|
|
39
48
|
"genderLabelText": "Sex",
|
|
40
|
-
"genderRequired": "",
|
|
41
|
-
"genderUnspecified": "",
|
|
49
|
+
"genderRequired": "Gender is required",
|
|
50
|
+
"genderUnspecified": "Gender is not specified",
|
|
42
51
|
"givenNameLabelText": "First Name",
|
|
43
|
-
"givenNameRequired": "",
|
|
52
|
+
"givenNameRequired": "Given name is required",
|
|
44
53
|
"identifierValueRequired": "Identifier value is required",
|
|
45
54
|
"idFieldLabelText": "Identifiers",
|
|
46
55
|
"IDInstructions": "Select the identifiers you'd like to add for this patient:",
|
|
47
56
|
"incompleteForm": "Incomplete form",
|
|
48
|
-
"invalidEmail": "",
|
|
57
|
+
"invalidEmail": "A valid email has to be given",
|
|
49
58
|
"invalidInput": "Invalid Input",
|
|
50
59
|
"isDeadInputLabel": "Is Dead",
|
|
51
60
|
"jumpTo": "Jump to",
|
|
52
|
-
"loadingResults": "Loading results",
|
|
53
61
|
"male": "Male",
|
|
54
62
|
"middleNameLabelText": "Middle Name",
|
|
55
|
-
"negativeMonths": "",
|
|
56
|
-
"negativeYears": "",
|
|
63
|
+
"negativeMonths": "Negative months",
|
|
64
|
+
"negativeYears": "Negative years",
|
|
57
65
|
"no": "No",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
66
|
+
"numberInNameDubious": "Number in name is dubious",
|
|
67
|
+
"obsFieldUnknownDatatype": "Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",
|
|
60
68
|
"optional": "optional",
|
|
69
|
+
"originFacilityCode": "Origin facility code",
|
|
70
|
+
"originFacilityName": "Origin facility name",
|
|
61
71
|
"other": "Other",
|
|
62
72
|
"patient": "Patient",
|
|
73
|
+
"patientDetailsFound": "Patient information found in the registry, do you want to use the information to continue with registration?",
|
|
74
|
+
"patientName": "Patient name",
|
|
63
75
|
"patientNameKnown": "Patient's Name is Known?",
|
|
76
|
+
"patientNotFound": "The patient records could not be found in Client registry, do you want to continue to create and post patient to registry",
|
|
64
77
|
"patientRegistrationBreadcrumb": "Patient Registration",
|
|
78
|
+
"postToRegistry": "Post to registry",
|
|
65
79
|
"registerPatient": "Register Patient",
|
|
66
80
|
"registerPatientSuccessSnackbarSubtitle": "The patient can now be found by searching for them using their name or ID number",
|
|
67
81
|
"registerPatientSuccessSnackbarTitle": "New Patient Created",
|
|
@@ -79,6 +93,8 @@
|
|
|
79
93
|
"searchAddress": "Search address",
|
|
80
94
|
"searchIdentifierPlaceholder": "Search identifier",
|
|
81
95
|
"selectAnOption": "Select an option",
|
|
96
|
+
"selectCountry": "Select country",
|
|
97
|
+
"selectIdentifierType": "Select identifier type",
|
|
82
98
|
"sexFieldLabelText": "Sex",
|
|
83
99
|
"source": "Source",
|
|
84
100
|
"stroke": "Stroke",
|
|
@@ -90,6 +106,6 @@
|
|
|
90
106
|
"updatePatientErrorSnackbarTitle": "Patient Details Update Failed",
|
|
91
107
|
"updatePatientSuccessSnackbarSubtitle": "The patient's information has been successfully updated",
|
|
92
108
|
"updatePatientSuccessSnackbarTitle": "Patient Details Updated",
|
|
93
|
-
"yearsEstimateRequired": "",
|
|
109
|
+
"yearsEstimateRequired": "Years estimate required",
|
|
94
110
|
"yes": "Yes"
|
|
95
111
|
}
|
package/translations/ar.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"addRelationshipButtonText": "أضف علاقة",
|
|
3
3
|
"addressHeader": "العنوان",
|
|
4
|
+
"age": "Age",
|
|
4
5
|
"allFieldsRequiredText": "جميع الحقول مطلوبة ما لم يتم التأشير عليها بأنها اختيارية",
|
|
5
6
|
"autoGeneratedPlaceholderText": "تم إنشاؤه تلقائيًا",
|
|
6
|
-
"birthdayNotInTheFuture": "",
|
|
7
|
-
"birthdayRequired": "",
|
|
7
|
+
"birthdayNotInTheFuture": "Birthday cannot be in the future",
|
|
8
|
+
"birthdayRequired": "Birthday is required",
|
|
8
9
|
"birthFieldLabelText": "الميلاد",
|
|
9
10
|
"cancel": "إلغاء",
|
|
10
11
|
"causeOfDeathInputLabel": "سبب الوفاة",
|
|
12
|
+
"clientRegistryEmpty": "Create & Post Patient",
|
|
13
|
+
"clientVerificationWithClientRegistry": "Client verification with client registry",
|
|
11
14
|
"closeOverlay": "Close overlay",
|
|
15
|
+
"codedPersonAttributeAnswerSetEmpty": "The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an answer concept set UUID '{{answerConceptSetUuid}}' that does not have any concept answers.",
|
|
16
|
+
"codedPersonAttributeAnswerSetInvalid": "The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an invalid answer concept set UUID '{{answerConceptSetUuid}}'.",
|
|
17
|
+
"codedPersonAttributeNoAnswerSet": "The person attribute field '{{codedPersonAttributeFieldId}}' is of type 'coded' but has been defined without an answer concept set UUID. The 'answerConceptSetUuid' key is required.",
|
|
12
18
|
"configure": "تكوين",
|
|
13
19
|
"configureIdentifiers": "Configure identifiers",
|
|
14
20
|
"contactSection": "تفاصيل الاتصال",
|
|
21
|
+
"continue": "Continue to registration",
|
|
15
22
|
"createNew": "أنشئ جديد",
|
|
23
|
+
"dateOfBirth": "Date of birth",
|
|
16
24
|
"dateOfBirthLabelText": "تاريخ الميلاد",
|
|
17
25
|
"deathDateInputLabel": "تاريخ الوفاة",
|
|
18
|
-
"deathdayNotInTheFuture": "",
|
|
26
|
+
"deathdayNotInTheFuture": "Death day cannot be in the future",
|
|
19
27
|
"deathSection": "معلومات الوفاة",
|
|
20
28
|
"deleteIdentifierTooltip": "حذف",
|
|
21
29
|
"deleteRelationshipTooltipText": "حذف",
|
|
@@ -33,35 +41,41 @@
|
|
|
33
41
|
"estimatedAgeInMonthsLabelText": "العمر المقدر بالشهور",
|
|
34
42
|
"estimatedAgeInYearsLabelText": "العمر المقدر بالسنوات",
|
|
35
43
|
"familyNameLabelText": "اسم العائلة",
|
|
36
|
-
"familyNameRequired": "",
|
|
44
|
+
"familyNameRequired": "Family name is required",
|
|
37
45
|
"female": "أنثى",
|
|
38
46
|
"fullNameLabelText": "الاسم الكامل",
|
|
47
|
+
"gender": "Gender",
|
|
39
48
|
"genderLabelText": "الجنس",
|
|
40
|
-
"genderRequired": "",
|
|
41
|
-
"genderUnspecified": "",
|
|
49
|
+
"genderRequired": "Gender is required",
|
|
50
|
+
"genderUnspecified": "Gender is not specified",
|
|
42
51
|
"givenNameLabelText": "الاسم الأول",
|
|
43
|
-
"givenNameRequired": "",
|
|
52
|
+
"givenNameRequired": "Given name is required",
|
|
44
53
|
"identifierValueRequired": "قيمة المعرف مطلوبة",
|
|
45
54
|
"idFieldLabelText": "المعرفات",
|
|
46
55
|
"IDInstructions": "Select the identifiers you'd like to add for this patient:",
|
|
47
56
|
"incompleteForm": "نموذج غير مكتمل",
|
|
48
|
-
"invalidEmail": "",
|
|
57
|
+
"invalidEmail": "A valid email has to be given",
|
|
49
58
|
"invalidInput": "إدخال غير صالح",
|
|
50
59
|
"isDeadInputLabel": "هل المريض متوفى؟",
|
|
51
60
|
"jumpTo": "اذهب إلى",
|
|
52
|
-
"loadingResults": "جارٍ تحميل النتائج",
|
|
53
61
|
"male": "ذكر",
|
|
54
62
|
"middleNameLabelText": "الاسم الأوسط",
|
|
55
|
-
"negativeMonths": "",
|
|
56
|
-
"negativeYears": "",
|
|
63
|
+
"negativeMonths": "Negative months",
|
|
64
|
+
"negativeYears": "Negative years",
|
|
57
65
|
"no": "لا",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
66
|
+
"numberInNameDubious": "Number in name is dubious",
|
|
67
|
+
"obsFieldUnknownDatatype": "Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",
|
|
60
68
|
"optional": "اختياري",
|
|
69
|
+
"originFacilityCode": "Origin facility code",
|
|
70
|
+
"originFacilityName": "Origin facility name",
|
|
61
71
|
"other": "آخر",
|
|
62
72
|
"patient": "المريض",
|
|
73
|
+
"patientDetailsFound": "Patient information found in the registry, do you want to use the information to continue with registration?",
|
|
74
|
+
"patientName": "Patient name",
|
|
63
75
|
"patientNameKnown": "هل اسم المريض معروف؟",
|
|
76
|
+
"patientNotFound": "The patient records could not be found in Client registry, do you want to continue to create and post patient to registry",
|
|
64
77
|
"patientRegistrationBreadcrumb": "Patient Registration",
|
|
78
|
+
"postToRegistry": "Post to registry",
|
|
65
79
|
"registerPatient": "تسجيل المريض",
|
|
66
80
|
"registerPatientSuccessSnackbarSubtitle": "The patient can now be found by searching for them using their name or ID number",
|
|
67
81
|
"registerPatientSuccessSnackbarTitle": "New Patient Created",
|
|
@@ -79,6 +93,8 @@
|
|
|
79
93
|
"searchAddress": "ابحث عن العنوان",
|
|
80
94
|
"searchIdentifierPlaceholder": "Search identifier",
|
|
81
95
|
"selectAnOption": "اختر خيارًا",
|
|
96
|
+
"selectCountry": "Select country",
|
|
97
|
+
"selectIdentifierType": "Select identifier type",
|
|
82
98
|
"sexFieldLabelText": "الجنس",
|
|
83
99
|
"source": "Source",
|
|
84
100
|
"stroke": "جلطة",
|
|
@@ -90,6 +106,6 @@
|
|
|
90
106
|
"updatePatientErrorSnackbarTitle": "Patient Details Update Failed",
|
|
91
107
|
"updatePatientSuccessSnackbarSubtitle": "The patient's information has been successfully updated",
|
|
92
108
|
"updatePatientSuccessSnackbarTitle": "Patient Details Updated",
|
|
93
|
-
"yearsEstimateRequired": "",
|
|
109
|
+
"yearsEstimateRequired": "Years estimate required",
|
|
94
110
|
"yes": "نعم"
|
|
95
111
|
}
|
package/translations/en.json
CHANGED
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"birthFieldLabelText": "Birth",
|
|
10
10
|
"cancel": "Cancel",
|
|
11
11
|
"causeOfDeathInputLabel": "Cause of Death",
|
|
12
|
+
"clientRegistryEmpty": "Create & Post Patient",
|
|
13
|
+
"clientVerificationWithClientRegistry": "Client verification with client registry",
|
|
12
14
|
"closeOverlay": "Close overlay",
|
|
15
|
+
"codedPersonAttributeAnswerSetEmpty": "The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an answer concept set UUID '{{answerConceptSetUuid}}' that does not have any concept answers.",
|
|
16
|
+
"codedPersonAttributeAnswerSetInvalid": "The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an invalid answer concept set UUID '{{answerConceptSetUuid}}'.",
|
|
17
|
+
"codedPersonAttributeNoAnswerSet": "The person attribute field '{{codedPersonAttributeFieldId}}' is of type 'coded' but has been defined without an answer concept set UUID. The 'answerConceptSetUuid' key is required.",
|
|
13
18
|
"configure": "Configure",
|
|
14
19
|
"configureIdentifiers": "Configure identifiers",
|
|
15
20
|
"contactSection": "Contact Details",
|
|
16
|
-
"cityVillage": "City",
|
|
17
|
-
"clientRegistryEmpty": "Create & Post Patient",
|
|
18
|
-
"clientVerificationWithClientRegistry": "Client verification with client registry",
|
|
19
21
|
"continue": "Continue",
|
|
20
|
-
"country": "Country",
|
|
21
|
-
"countyDistrict": "District",
|
|
22
22
|
"createNew": "Create New",
|
|
23
23
|
"dateOfBirth": "Date of birth",
|
|
24
24
|
"dateOfBirthLabelText": "Date of Birth",
|
|
@@ -58,16 +58,15 @@
|
|
|
58
58
|
"invalidInput": "Invalid Input",
|
|
59
59
|
"isDeadInputLabel": "Is Dead",
|
|
60
60
|
"jumpTo": "Jump to",
|
|
61
|
-
"loadingResults": "Loading results",
|
|
62
61
|
"male": "Male",
|
|
63
62
|
"middleNameLabelText": "Middle Name",
|
|
64
|
-
"nascopNumber": "Nascop facility no",
|
|
65
63
|
"nationalId": "National ID",
|
|
66
64
|
"negativeMonths": "Negative months",
|
|
67
65
|
"negativeYears": "Negative years",
|
|
68
66
|
"no": "No",
|
|
69
|
-
"noResultsFound": "No results found",
|
|
70
67
|
"numberInNameDubious": "Number in name is dubious",
|
|
68
|
+
"NUPI": "",
|
|
69
|
+
"obsFieldUnknownDatatype": "Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",
|
|
71
70
|
"optional": "optional",
|
|
72
71
|
"other": "Other",
|
|
73
72
|
"patient": "Patient",
|
|
@@ -75,7 +74,7 @@
|
|
|
75
74
|
"patientName": "Patient name",
|
|
76
75
|
"patientNameKnown": "Patient's Name is Known?",
|
|
77
76
|
"patientNotFound": "The patient records could not be found in Client registry, do you want to continue to create and post patient to registry",
|
|
78
|
-
"
|
|
77
|
+
"patientRegistrationBreadcrumb": "Patient Registration",
|
|
79
78
|
"postToRegistry": "Post to registry",
|
|
80
79
|
"registerPatient": "Register Patient",
|
|
81
80
|
"registerPatientSuccessSnackbarSubtitle": "The patient can now be found by searching for them using their name or ID number",
|
|
@@ -92,10 +91,13 @@
|
|
|
92
91
|
"resetIdentifierTooltip": "Reset",
|
|
93
92
|
"restoreRelationshipActionButton": "Undo",
|
|
94
93
|
"searchAddress": "Search address",
|
|
94
|
+
"searchClientRegistry": "Search client registry",
|
|
95
|
+
"searchIdentifierPlaceholder": "Search identifier",
|
|
95
96
|
"selectAnOption": "Select an option",
|
|
96
97
|
"selectCountry": "Select country",
|
|
97
98
|
"selectIdentifierType": "Select identifier type",
|
|
98
99
|
"sexFieldLabelText": "Sex",
|
|
100
|
+
"SHA Number": "",
|
|
99
101
|
"source": "Source",
|
|
100
102
|
"stroke": "Stroke",
|
|
101
103
|
"submitting": "Submitting",
|
|
@@ -106,8 +108,6 @@
|
|
|
106
108
|
"updatePatientErrorSnackbarTitle": "Patient Details Update Failed",
|
|
107
109
|
"updatePatientSuccessSnackbarSubtitle": "The patient's information has been successfully updated",
|
|
108
110
|
"updatePatientSuccessSnackbarTitle": "Patient Details Updated",
|
|
109
|
-
"updationSuccessToastDescription": "The patient's information has been successfully updated",
|
|
110
|
-
"updationSuccessToastTitle": "Patient Details Updated",
|
|
111
111
|
"useValues": "Use values",
|
|
112
112
|
"validate": "Validate",
|
|
113
113
|
"yearsEstimateRequired": "Years estimate required",
|