@ampath/esm-dha-workflow-app 4.0.0-next.12 → 4.0.0-next.14
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/198.js +1 -1
- package/dist/198.js.map +1 -1
- package/dist/200.js +2 -0
- package/dist/200.js.map +1 -0
- package/dist/306.js +1 -0
- package/dist/306.js.map +1 -0
- package/dist/860.js +1 -1
- package/dist/860.js.map +1 -1
- package/dist/91.js +1 -1
- package/dist/91.js.map +1 -1
- package/dist/93.js +1 -2
- package/dist/93.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-home-app.js +1 -1
- package/dist/openmrs-esm-home-app.js.buildmanifest.json +65 -65
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/left-panel/left-panel.component.tsx +0 -2
- package/src/registry/mock-client.ts +627 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.tsx +13 -11
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +7 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +97 -72
- package/src/registry/registry.component.scss +12 -1
- package/src/registry/registry.component.tsx +168 -104
- package/src/registry/types/index.ts +59 -1
- package/src/registry/utils/error-handler.ts +33 -0
- package/src/registry/utils/format-dependant-display-data.ts +8 -0
- package/src/registry/utils/hie-client-adapter.ts +309 -0
- package/src/resources/hie-amrs-automatic-registration.service.ts +16 -0
- package/src/resources/identifier-types.ts +27 -0
- package/src/resources/patient-resource.ts +60 -0
- package/src/shared/constants/civil-status.ts +29 -0
- package/src/shared/constants/person-attributes.ts +33 -0
- package/src/side-nav-menu/nav-link-config.ts +40 -6
- package/src/side-nav-menu/nav-links.tsx +26 -8
- package/dist/16.js +0 -1
- package/dist/16.js.map +0 -1
- package/dist/93.js.LICENSE.txt +0 -5
- package/dist/970.js +0 -2
- package/dist/970.js.map +0 -1
- /package/dist/{970.js.LICENSE.txt → 200.js.LICENSE.txt} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { type RequestCustomOtpDto } from '../../types';
|
|
2
|
+
import { OtpStatus, type RequestCustomOtpDto } from '../../types';
|
|
3
3
|
import { Button, InlineLoading, Modal, ModalBody, TextInput } from '@carbon/react';
|
|
4
4
|
import styles from './otp-verification-modal.scss';
|
|
5
5
|
import { showSnackbar } from '@openmrs/esm-framework';
|
|
@@ -11,15 +11,17 @@ interface OtpVerificationModalpProps {
|
|
|
11
11
|
phoneNumber: string;
|
|
12
12
|
open: boolean;
|
|
13
13
|
onModalClose: () => void;
|
|
14
|
+
onOtpSuccessfullVerification: () => void;
|
|
14
15
|
}
|
|
15
16
|
const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
16
17
|
requestCustomOtpDto,
|
|
17
18
|
phoneNumber,
|
|
18
19
|
open,
|
|
19
20
|
onModalClose,
|
|
21
|
+
onOtpSuccessfullVerification,
|
|
20
22
|
}) => {
|
|
21
23
|
const [otp, setOtp] = useState('');
|
|
22
|
-
const [otpStatus, setOtpStatus] = useState<string>(
|
|
24
|
+
const [otpStatus, setOtpStatus] = useState<string>(OtpStatus.Draft);
|
|
23
25
|
const [loading, setLoading] = useState<boolean>(false);
|
|
24
26
|
const [sessionId, setSessionId] = useState<string>('');
|
|
25
27
|
|
|
@@ -32,7 +34,7 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
32
34
|
try {
|
|
33
35
|
const response = await requestCustomOtp(requestCustomOtpDto);
|
|
34
36
|
setSessionId(response.sessionId);
|
|
35
|
-
setOtpStatus(
|
|
37
|
+
setOtpStatus(OtpStatus.Sent);
|
|
36
38
|
|
|
37
39
|
showAlert('success', 'OTP sent successfully', `A code was sent to ${response.maskedPhone}`);
|
|
38
40
|
} catch (err: any) {
|
|
@@ -62,7 +64,7 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
62
64
|
const payload = { sessionId, otp, locationUuid: requestCustomOtpDto.locationUuid };
|
|
63
65
|
await validateCustomOtp(payload);
|
|
64
66
|
|
|
65
|
-
setOtpStatus(
|
|
67
|
+
setOtpStatus(OtpStatus.Verified);
|
|
66
68
|
|
|
67
69
|
showSnackbar({
|
|
68
70
|
kind: 'success',
|
|
@@ -104,7 +106,7 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
104
106
|
</div>
|
|
105
107
|
<div className={styles.sectionContent}>
|
|
106
108
|
<div className={styles.contentHeader}>
|
|
107
|
-
{otpStatus ===
|
|
109
|
+
{otpStatus === OtpStatus.Draft ? (
|
|
108
110
|
<>
|
|
109
111
|
<h6>Send Code to Phone {maskValue(phoneNumber)}</h6>
|
|
110
112
|
</>
|
|
@@ -112,7 +114,7 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
112
114
|
<></>
|
|
113
115
|
)}
|
|
114
116
|
|
|
115
|
-
{otpStatus ===
|
|
117
|
+
{otpStatus === OtpStatus.Sent ? (
|
|
116
118
|
<>
|
|
117
119
|
<TextInput
|
|
118
120
|
id="otp-input"
|
|
@@ -126,7 +128,7 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
126
128
|
<></>
|
|
127
129
|
)}
|
|
128
130
|
|
|
129
|
-
{otpStatus ===
|
|
131
|
+
{otpStatus === OtpStatus.Verified ? (
|
|
130
132
|
<>
|
|
131
133
|
<h6>OTP Verification Successfull!</h6>
|
|
132
134
|
</>
|
|
@@ -136,7 +138,7 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
136
138
|
</div>
|
|
137
139
|
</div>
|
|
138
140
|
<div className={styles.sectionAction}>
|
|
139
|
-
{otpStatus ===
|
|
141
|
+
{otpStatus === OtpStatus.Draft ? (
|
|
140
142
|
<>
|
|
141
143
|
<Button kind="primary" onClick={handleSendOtp}>
|
|
142
144
|
{loading ? <InlineLoading description="Sending OTP..." /> : 'Send OTP'}
|
|
@@ -146,7 +148,7 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
146
148
|
<></>
|
|
147
149
|
)}
|
|
148
150
|
|
|
149
|
-
{otpStatus ===
|
|
151
|
+
{otpStatus === OtpStatus.Sent ? (
|
|
150
152
|
<>
|
|
151
153
|
<Button kind="primary" onClick={handleVerifyOtp}>
|
|
152
154
|
{loading ? <InlineLoading description="Verifying OTP..." /> : 'Verify'}
|
|
@@ -156,9 +158,9 @@ const OtpVerificationModal: React.FC<OtpVerificationModalpProps> = ({
|
|
|
156
158
|
<></>
|
|
157
159
|
)}
|
|
158
160
|
|
|
159
|
-
{otpStatus ===
|
|
161
|
+
{otpStatus === OtpStatus.Verified ? (
|
|
160
162
|
<>
|
|
161
|
-
<Button kind="primary" onClick={
|
|
163
|
+
<Button kind="primary" onClick={onOtpSuccessfullVerification}>
|
|
162
164
|
Continue
|
|
163
165
|
</Button>
|
|
164
166
|
</>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: 100%;
|
|
5
5
|
row-gap: 5px;
|
|
6
|
+
margin-top: 15px;
|
|
6
7
|
}
|
|
7
8
|
.formRow{
|
|
8
9
|
display: flex;
|
|
@@ -21,4 +22,10 @@
|
|
|
21
22
|
flex-direction: row;
|
|
22
23
|
column-gap: 5px;
|
|
23
24
|
margin-top: 15px;
|
|
25
|
+
}
|
|
26
|
+
.patientAction{
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
column-gap: 5px;
|
|
30
|
+
margin-top: 15px;
|
|
24
31
|
}
|
|
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
4
|
Checkbox,
|
|
5
|
-
Dropdown,
|
|
6
5
|
InlineLoading,
|
|
7
6
|
Modal,
|
|
8
7
|
ModalBody,
|
|
@@ -16,15 +15,8 @@ import {
|
|
|
16
15
|
TableRow,
|
|
17
16
|
} from '@carbon/react';
|
|
18
17
|
import styles from './send-to-triage.modal.scss';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
type Patient,
|
|
22
|
-
useVisitTypes,
|
|
23
|
-
useSession,
|
|
24
|
-
showSnackbar,
|
|
25
|
-
type Visit,
|
|
26
|
-
} from '@openmrs/esm-framework';
|
|
27
|
-
import { type CreateVisitDto, type QueueEntryDto, type ServiceQueue } from '../../types';
|
|
18
|
+
import { type Patient, useVisitTypes, useSession, showSnackbar } from '@openmrs/esm-framework';
|
|
19
|
+
import { type HieClient, type CreateVisitDto, type QueueEntryDto, type ServiceQueue } from '../../types';
|
|
28
20
|
import { createQueueEntry, fetchServiceQueuesByLocationUuid } from '../../../resources/queue.resource';
|
|
29
21
|
import { QUEUE_PRIORITIES_UUIDS, QUEUE_STATUS_UUIDS } from '../../../shared/constants/concepts';
|
|
30
22
|
import { createVisit } from '../../../resources/visit.resource';
|
|
@@ -34,9 +26,20 @@ interface SendToTriageModalProps {
|
|
|
34
26
|
open: boolean;
|
|
35
27
|
onModalClose: (modalCloseResp?: { success: boolean }) => void;
|
|
36
28
|
onSubmit: () => void;
|
|
29
|
+
client: HieClient;
|
|
30
|
+
onCreateAmrsPatient: (client: HieClient) => void;
|
|
31
|
+
onManualRegistration: () => void;
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
34
|
+
const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
35
|
+
patients,
|
|
36
|
+
open,
|
|
37
|
+
onModalClose,
|
|
38
|
+
onSubmit,
|
|
39
|
+
client,
|
|
40
|
+
onCreateAmrsPatient,
|
|
41
|
+
onManualRegistration,
|
|
42
|
+
}) => {
|
|
40
43
|
const [selectedPatient, setSelectedPatient] = useState<Patient>();
|
|
41
44
|
const [selectedVisitType, setSelectedVisitType] = useState<string>();
|
|
42
45
|
const [serviceQueues, setServiceQueues] = useState<ServiceQueue[]>();
|
|
@@ -164,6 +167,7 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
164
167
|
subtitle: subtitle,
|
|
165
168
|
});
|
|
166
169
|
};
|
|
170
|
+
|
|
167
171
|
return (
|
|
168
172
|
<>
|
|
169
173
|
<Modal
|
|
@@ -180,73 +184,94 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({ patients, open, o
|
|
|
180
184
|
<div className={styles.sectionHeader}>
|
|
181
185
|
<h4 className={styles.sectionTitle}>Send To Triage</h4>
|
|
182
186
|
</div>
|
|
183
|
-
|
|
184
|
-
<div className={styles.
|
|
185
|
-
<
|
|
186
|
-
<
|
|
187
|
-
<
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
</TableHead>
|
|
194
|
-
<TableBody>
|
|
195
|
-
{patients.map((p, index) => (
|
|
196
|
-
<TableRow key={p.uuid}>
|
|
197
|
-
<TableCell>{index + 1}</TableCell>
|
|
198
|
-
<TableCell>{p.person.preferredName.display}</TableCell>
|
|
199
|
-
<TableCell>{p.person.birthdate}</TableCell>
|
|
200
|
-
<TableCell>
|
|
201
|
-
<Checkbox id={p.uuid} labelText="" onChange={() => onPatientSelect(p)} />
|
|
202
|
-
</TableCell>
|
|
187
|
+
{patients.length > 0 ? (
|
|
188
|
+
<div className={styles.sectionContent}>
|
|
189
|
+
<div className={styles.patientSelect}>
|
|
190
|
+
<Table>
|
|
191
|
+
<TableHead>
|
|
192
|
+
<TableRow>
|
|
193
|
+
<TableHeader>No</TableHeader>
|
|
194
|
+
<TableHeader>Name</TableHeader>
|
|
195
|
+
<TableHeader>Gender</TableHeader>
|
|
196
|
+
<TableHeader>Select Patient</TableHeader>
|
|
203
197
|
</TableRow>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</div>
|
|
219
|
-
<div className={styles.formControl}>
|
|
220
|
-
<Select id="service" labelText="Select a Service" onChange={serviceChangeHandler}>
|
|
221
|
-
<SelectItem value="" text="Select" />;
|
|
222
|
-
{serviceQueues &&
|
|
223
|
-
serviceQueues.map((sq) => {
|
|
224
|
-
return <SelectItem value={sq.uuid} text={sq.display} />;
|
|
225
|
-
})}
|
|
226
|
-
</Select>
|
|
227
|
-
</div>
|
|
198
|
+
</TableHead>
|
|
199
|
+
<TableBody>
|
|
200
|
+
{patients.map((p, index) => (
|
|
201
|
+
<TableRow key={p.uuid}>
|
|
202
|
+
<TableCell>{index + 1}</TableCell>
|
|
203
|
+
<TableCell>{p.person.preferredName.display}</TableCell>
|
|
204
|
+
<TableCell>{p.person.gender}</TableCell>
|
|
205
|
+
<TableCell>
|
|
206
|
+
<Checkbox id={p.uuid} labelText="" onChange={() => onPatientSelect(p)} />
|
|
207
|
+
</TableCell>
|
|
208
|
+
</TableRow>
|
|
209
|
+
))}
|
|
210
|
+
</TableBody>
|
|
211
|
+
</Table>
|
|
228
212
|
</div>
|
|
229
|
-
<div className={styles.
|
|
230
|
-
<div className={styles.
|
|
231
|
-
<
|
|
232
|
-
id="
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
</
|
|
213
|
+
<div className={styles.formSection}>
|
|
214
|
+
<div className={styles.formRow}>
|
|
215
|
+
<div className={styles.formControl}>
|
|
216
|
+
<Select id="visit-type" labelText="Select a Visit Type" onChange={visitTypeChangeHandler}>
|
|
217
|
+
<SelectItem value="" text="Select" />;
|
|
218
|
+
{visitTypes &&
|
|
219
|
+
visitTypes.map((vt) => {
|
|
220
|
+
return <SelectItem value={vt.uuid} text={vt.display} />;
|
|
221
|
+
})}
|
|
222
|
+
</Select>
|
|
223
|
+
</div>
|
|
224
|
+
<div className={styles.formControl}>
|
|
225
|
+
<Select id="service" labelText="Select a Service" onChange={serviceChangeHandler}>
|
|
226
|
+
<SelectItem value="" text="Select" />;
|
|
227
|
+
{serviceQueues &&
|
|
228
|
+
serviceQueues.map((sq) => {
|
|
229
|
+
return <SelectItem value={sq.uuid} text={sq.display} />;
|
|
230
|
+
})}
|
|
231
|
+
</Select>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
<div className={styles.formRow}>
|
|
235
|
+
<div className={styles.formControl}>
|
|
236
|
+
<Select
|
|
237
|
+
id="priority"
|
|
238
|
+
labelText="Select Priority"
|
|
239
|
+
onChange={($event) => priorityChangeHandler($event.target.value)}
|
|
240
|
+
>
|
|
241
|
+
<SelectItem value="" text="Select" />;
|
|
242
|
+
<SelectItem value={QUEUE_PRIORITIES_UUIDS.NORMAL_PRIORITY_UUID} text="NORMAL" />;
|
|
243
|
+
<SelectItem value={QUEUE_PRIORITIES_UUIDS.EMERGENCY_PRIORITY_UUID} text="EMERGENCY" />;
|
|
244
|
+
</Select>
|
|
245
|
+
</div>
|
|
240
246
|
</div>
|
|
241
247
|
</div>
|
|
242
248
|
</div>
|
|
243
|
-
|
|
249
|
+
) : (
|
|
250
|
+
<></>
|
|
251
|
+
)}
|
|
244
252
|
<div className={styles.actionSection}>
|
|
245
|
-
|
|
246
|
-
<
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
{patients.length > 0 ? (
|
|
254
|
+
<div className={styles.btnContainer}>
|
|
255
|
+
<Button kind="primary" onClick={sendToTriage}>
|
|
256
|
+
{loading ? <InlineLoading description="Sending To Triage..." /> : 'Send To Triage'}
|
|
257
|
+
</Button>
|
|
258
|
+
</div>
|
|
259
|
+
) : (
|
|
260
|
+
<>
|
|
261
|
+
<div className={styles.patientAction}>
|
|
262
|
+
<div className={styles.btnContainer}>
|
|
263
|
+
<Button kind="primary" onClick={() => onCreateAmrsPatient(client)}>
|
|
264
|
+
Automatically Register in AMRS
|
|
265
|
+
</Button>
|
|
266
|
+
</div>
|
|
267
|
+
<div className={styles.btnContainer}>
|
|
268
|
+
<Button kind="secondary" onClick={onManualRegistration}>
|
|
269
|
+
Manually Register
|
|
270
|
+
</Button>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
</>
|
|
274
|
+
)}
|
|
250
275
|
</div>
|
|
251
276
|
</div>
|
|
252
277
|
</ModalBody>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
margin-top: 15px;
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: column;
|
|
38
|
-
width:
|
|
38
|
+
width: 80%;
|
|
39
39
|
row-gap: 10px;
|
|
40
40
|
}
|
|
41
41
|
.btnContainer{
|
|
@@ -69,4 +69,15 @@
|
|
|
69
69
|
}
|
|
70
70
|
.registrySearchBtn{
|
|
71
71
|
height: 30px;
|
|
72
|
+
}
|
|
73
|
+
.principalDependantSection{
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: row;
|
|
76
|
+
width: 100%;
|
|
77
|
+
margin-top: 15px;
|
|
78
|
+
}
|
|
79
|
+
.dependantCard{
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
width: 30%;
|
|
72
83
|
}
|