@ampath/esm-dha-workflow-app 4.0.0-next.52 → 4.0.0-next.53
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/154.js +1 -1
- package/dist/294.js +1 -0
- package/dist/294.js.map +1 -0
- package/dist/826.js +1 -1
- package/dist/esm-dha-workflow-app.js.buildmanifest.json +28 -28
- package/dist/main.js +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/registry/modal/client-details-modal/client-details-modal.tsx +3 -13
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +134 -8
- package/src/registry/types/index.ts +8 -0
- package/dist/757.js +0 -1
- package/dist/757.js.map +0 -1
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{},"pages":[{"component":"root","route":"dha-workflow","online":true,"offline":true}],"extensions":[{"component":"workflowRegistryLink","name":"workflow-registry-link","slot":"app-menu-slot","online":true,"offline":true},{"component":"navLinks","name":"side-nav-workflow-links","slot":"dha-workflow-slot","online":true,"offline":true},{"name":"dha-workflow-dashboard-link","component":"dhaWorkflowDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"dashboard","slot":"dha-workflow-dashboard-slot","title":"Dashboard"},"online":true,"offline":true,"order":0},{"component":"dhaWorkflowDashboard","name":"dashboardExt","slot":"dha-workflow-dashboard-slot"},{"name":"registry-dashboard-link","component":"registryDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"registry","slot":"client-registry-dashboard-slot","title":"Registry"},"online":true,"offline":true,"order":1},{"component":"registryExtension","name":"registry","slot":"client-registry-dashboard-slot"},{"name":"triage-dashboard-link","component":"triageDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"triage","slot":"triage-queue-dashboard-slot","title":"Triage"},"online":true,"offline":false},{"component":"triageQueueExtension","name":"triage","slot":"triage-queue-dashboard-slot"},{"name":"consultation-dashboard-link","component":"consultationDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"consultation","slot":"consultation-dashboard-slot","title":"Consultation"},"online":true,"offline":false},{"component":"consultationQueue","name":"consultation","slot":"consultation-dashboard-slot"},{"name":"mnch-dashboard-link","component":"mnchQueueDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"mnch","slot":"mnch-dashboard-slot","title":"MNCH"},"online":true,"offline":true},{"component":"mnchQueueDashboard","name":"mnch","slot":"mnch-dashboard-slot"},{"name":"pharmacy-dashboard-link","component":"pharmacyDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Pharmacy"},"online":true,"offline":true},{"name":"accounting-dashboard-link","component":"accountingDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"},"online":true,"offline":false},{"component":"accountingDashboard","name":"accounting","slot":"accounting-dashboard-slot"},{"name":"registers-dashboard-link","component":"registersDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"registers","slot":"registers-dashboard-slot","title":"Registers"},"online":true,"offline":false},{"component":"registers","name":"registers","slot":"registers-dashboard-slot"},{"name":"reports-dashboard-link","component":"reportsDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"online":true,"offline":false},{"component":"reports","name":"Reports","slot":"reports-dashboard-slot"},{"name":"bookings-dashboard-link","component":"bookingsDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"bookings","slot":"bookings-dashboard-slot","title":"Bookings"},"online":true,"offline":true},{"component":"bookings","name":"bookings","slot":"bookings-dashboard-slot"}],"modals":[{"name":"sign-off-queue-entry-modal","component":"signOffModal"}],"version":"4.0.0-next.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{},"pages":[{"component":"root","route":"dha-workflow","online":true,"offline":true}],"extensions":[{"component":"workflowRegistryLink","name":"workflow-registry-link","slot":"app-menu-slot","online":true,"offline":true},{"component":"navLinks","name":"side-nav-workflow-links","slot":"dha-workflow-slot","online":true,"offline":true},{"name":"dha-workflow-dashboard-link","component":"dhaWorkflowDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"dashboard","slot":"dha-workflow-dashboard-slot","title":"Dashboard"},"online":true,"offline":true,"order":0},{"component":"dhaWorkflowDashboard","name":"dashboardExt","slot":"dha-workflow-dashboard-slot"},{"name":"registry-dashboard-link","component":"registryDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"registry","slot":"client-registry-dashboard-slot","title":"Registry"},"online":true,"offline":true,"order":1},{"component":"registryExtension","name":"registry","slot":"client-registry-dashboard-slot"},{"name":"triage-dashboard-link","component":"triageDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"triage","slot":"triage-queue-dashboard-slot","title":"Triage"},"online":true,"offline":false},{"component":"triageQueueExtension","name":"triage","slot":"triage-queue-dashboard-slot"},{"name":"consultation-dashboard-link","component":"consultationDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"consultation","slot":"consultation-dashboard-slot","title":"Consultation"},"online":true,"offline":false},{"component":"consultationQueue","name":"consultation","slot":"consultation-dashboard-slot"},{"name":"mnch-dashboard-link","component":"mnchQueueDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"mnch","slot":"mnch-dashboard-slot","title":"MNCH"},"online":true,"offline":true},{"component":"mnchQueueDashboard","name":"mnch","slot":"mnch-dashboard-slot"},{"name":"pharmacy-dashboard-link","component":"pharmacyDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Pharmacy"},"online":true,"offline":true},{"name":"accounting-dashboard-link","component":"accountingDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"},"online":true,"offline":false},{"component":"accountingDashboard","name":"accounting","slot":"accounting-dashboard-slot"},{"name":"registers-dashboard-link","component":"registersDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"registers","slot":"registers-dashboard-slot","title":"Registers"},"online":true,"offline":false},{"component":"registers","name":"registers","slot":"registers-dashboard-slot"},{"name":"reports-dashboard-link","component":"reportsDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"online":true,"offline":false},{"component":"reports","name":"Reports","slot":"reports-dashboard-slot"},{"name":"bookings-dashboard-link","component":"bookingsDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"bookings","slot":"bookings-dashboard-slot","title":"Bookings"},"online":true,"offline":true},{"component":"bookings","name":"bookings","slot":"bookings-dashboard-slot"}],"modals":[{"name":"sign-off-queue-entry-modal","component":"signOffModal"}],"version":"4.0.0-next.53"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@ import { type HieClient } from '../../types';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import styles from './client-details-modal.scss';
|
|
5
5
|
import ClientDetails from '../../client-details/client-details';
|
|
6
|
-
import PaymentOptionsComponent from '../../payment-details/payment-options/payment-options';
|
|
7
6
|
|
|
8
7
|
interface ClientDetailsModalProps {
|
|
9
8
|
client: HieClient;
|
|
@@ -33,28 +32,24 @@ const ClientDetailsModal: React.FC<ClientDetailsModalProps> = ({
|
|
|
33
32
|
size="md"
|
|
34
33
|
onSecondarySubmit={onModalClose}
|
|
35
34
|
onRequestClose={onModalClose}
|
|
36
|
-
onRequestSubmit={
|
|
37
|
-
primaryButtonText="
|
|
35
|
+
onRequestSubmit={() => onSendClientToTriage(client.id)}
|
|
36
|
+
primaryButtonText="Send To Triage"
|
|
38
37
|
secondaryButtonText="Cancel"
|
|
39
38
|
>
|
|
40
39
|
<ModalBody>
|
|
41
40
|
<div className={styles.clientDetailsLayout}>
|
|
42
41
|
<div className={styles.sectionHeader}>
|
|
43
|
-
<h4 className={styles.sectionTitle}>Patient
|
|
42
|
+
<h4 className={styles.sectionTitle}>Patient Details</h4>
|
|
44
43
|
</div>
|
|
45
44
|
<div className={styles.sectionContent}>
|
|
46
45
|
<Tabs>
|
|
47
46
|
<TabList contained>
|
|
48
47
|
<Tab>Patient Details</Tab>
|
|
49
|
-
<Tab>Payment Details</Tab>
|
|
50
48
|
</TabList>
|
|
51
49
|
<TabPanels>
|
|
52
50
|
<TabPanel>
|
|
53
51
|
<ClientDetails client={client} />
|
|
54
52
|
</TabPanel>
|
|
55
|
-
<TabPanel>
|
|
56
|
-
<PaymentOptionsComponent />
|
|
57
|
-
</TabPanel>
|
|
58
53
|
</TabPanels>
|
|
59
54
|
</Tabs>
|
|
60
55
|
</div>
|
|
@@ -65,11 +60,6 @@ const ClientDetailsModal: React.FC<ClientDetailsModalProps> = ({
|
|
|
65
60
|
<div className={styles.btnContainer}>
|
|
66
61
|
<Button kind="secondary">Walk In Orders</Button>
|
|
67
62
|
</div>
|
|
68
|
-
<div className={styles.btnContainer}>
|
|
69
|
-
<Button kind="tertiary" onClick={() => onSendClientToTriage(client.id)}>
|
|
70
|
-
Send To Triage
|
|
71
|
-
</Button>
|
|
72
|
-
</div>
|
|
73
63
|
</div>
|
|
74
64
|
</div>
|
|
75
65
|
</ModalBody>
|
|
@@ -13,10 +13,19 @@ import {
|
|
|
13
13
|
TableHead,
|
|
14
14
|
TableHeader,
|
|
15
15
|
TableRow,
|
|
16
|
+
TextInput,
|
|
16
17
|
} from '@carbon/react';
|
|
17
18
|
import styles from './send-to-triage.modal.scss';
|
|
18
19
|
import { type Patient, useVisitTypes, useSession, showSnackbar, type VisitType } from '@openmrs/esm-framework';
|
|
19
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
type HieClient,
|
|
22
|
+
type CreateVisitDto,
|
|
23
|
+
type QueueEntryDto,
|
|
24
|
+
type ServiceQueue,
|
|
25
|
+
PaymentDetail,
|
|
26
|
+
CCC_UUID,
|
|
27
|
+
type VisitAttribute,
|
|
28
|
+
} from '../../types';
|
|
20
29
|
import { createQueueEntry, getFacilityServiceQueues } from '../../../resources/queue.resource';
|
|
21
30
|
import { QUEUE_PRIORITIES_UUIDS, QUEUE_STATUS_UUIDS } from '../../../shared/constants/concepts';
|
|
22
31
|
import { createVisit } from '../../../resources/visit.resource';
|
|
@@ -69,6 +78,9 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
69
78
|
const [servicePrices, setServicePrices] = useState<ServicePrice[]>([]);
|
|
70
79
|
const [filteredBillableServices, setFilteredBillableServices] = useState<ServicePrice[]>(null);
|
|
71
80
|
const [selectedBillableService, setSelectedBillableService] = useState<ServicePrice>(null);
|
|
81
|
+
const [selectedInsuranceScheme, setSelectedInsuranceScheme] = useState<string>('');
|
|
82
|
+
const [selectedInsurancePolicy, setSelectedInsurancePolicy] = useState<string>('');
|
|
83
|
+
const [selectedPatientCategory, setSelectedPatientCategory] = useState<string>('');
|
|
72
84
|
const [loading, setLoading] = useState<boolean>(false);
|
|
73
85
|
const visitTypes = useVisitTypes();
|
|
74
86
|
const session = useSession();
|
|
@@ -107,11 +119,18 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
107
119
|
showAlert('success', 'Patient has succesfully been moved to the Triage queue', '');
|
|
108
120
|
}
|
|
109
121
|
|
|
110
|
-
// add bill
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
// add bill if it was a paying client
|
|
123
|
+
let createBillResp = null;
|
|
124
|
+
if (selectedPaymentDetail === PaymentDetail.Paying && selectedBillableService) {
|
|
125
|
+
const createBillDto = generateCreateBillDto();
|
|
126
|
+
if (isValidCreateBillDto(createBillDto)) {
|
|
127
|
+
createBillResp = await createBill(createBillDto);
|
|
128
|
+
if (createBillResp) {
|
|
129
|
+
showAlert('success', 'Bill succesfully created', '');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
createBillResp = true;
|
|
115
134
|
}
|
|
116
135
|
|
|
117
136
|
if (queueEntryResp && createBillResp) {
|
|
@@ -172,6 +191,9 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
172
191
|
setSelectedPaymentMode(selectedPaymentMode);
|
|
173
192
|
const paymentModeBillableServices = getBillableServiceByPaymentMode(selectedPaymentMode);
|
|
174
193
|
setFilteredBillableServices(paymentModeBillableServices);
|
|
194
|
+
setSelectedInsuranceScheme('');
|
|
195
|
+
setSelectedInsurancePolicy('');
|
|
196
|
+
setSelectedPriority('');
|
|
175
197
|
};
|
|
176
198
|
const getBillableServiceByPaymentMode = (paymentMode: PaymentMode): PayableBillableService[] => {
|
|
177
199
|
const paymentBillableServices: ServicePrice[] = [];
|
|
@@ -196,6 +218,15 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
196
218
|
});
|
|
197
219
|
setSelectedCashPoint(selectedCashPoint);
|
|
198
220
|
};
|
|
221
|
+
const insuranceSchemeHandler = (selectedInsuranceScheme: string) => {
|
|
222
|
+
setSelectedInsuranceScheme(selectedInsuranceScheme);
|
|
223
|
+
};
|
|
224
|
+
const insurancePolicyHandler = (selectedInsurancePolicy: string) => {
|
|
225
|
+
setSelectedInsurancePolicy(selectedInsurancePolicy);
|
|
226
|
+
};
|
|
227
|
+
const patientCategoryHandler = (categoryUuid: string) => {
|
|
228
|
+
setSelectedPatientCategory(categoryUuid);
|
|
229
|
+
};
|
|
199
230
|
const createPatientVisit = async () => {
|
|
200
231
|
const visitDto = getCreateVisitDto();
|
|
201
232
|
if (!isValidCreateVisitDto(visitDto)) {
|
|
@@ -228,13 +259,18 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
228
259
|
return true;
|
|
229
260
|
};
|
|
230
261
|
const getCreateVisitDto = (): CreateVisitDto => {
|
|
231
|
-
|
|
262
|
+
const visitAttributes = getVisitAttributes();
|
|
263
|
+
const visitDto: CreateVisitDto = {
|
|
232
264
|
visitType: selectedVisitType,
|
|
233
265
|
location: locationUuid,
|
|
234
266
|
startDatetime: null,
|
|
235
267
|
stopDatetime: null,
|
|
236
|
-
patient: selectedPatient?.uuid
|
|
268
|
+
patient: selectedPatient?.uuid,
|
|
237
269
|
};
|
|
270
|
+
if (visitAttributes.length > 0) {
|
|
271
|
+
visitDto['attributes'] = visitAttributes;
|
|
272
|
+
}
|
|
273
|
+
return visitDto;
|
|
238
274
|
};
|
|
239
275
|
const showAlert = (alertType: 'error' | 'success', title: string, subtitle: string) => {
|
|
240
276
|
showSnackbar({
|
|
@@ -244,6 +280,29 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
244
280
|
});
|
|
245
281
|
};
|
|
246
282
|
|
|
283
|
+
function getVisitAttributes(): VisitAttribute[] {
|
|
284
|
+
const attributes: VisitAttribute[] = [];
|
|
285
|
+
if (selectedInsuranceScheme) {
|
|
286
|
+
attributes.push({
|
|
287
|
+
attributeType: '3a988e33-a6c0-4b76-b924-01abb998944b',
|
|
288
|
+
value: selectedInsuranceScheme,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
if (selectedInsurancePolicy) {
|
|
292
|
+
attributes.push({
|
|
293
|
+
attributeType: 'aac48226-d143-4274-80e0-264db4e368ee',
|
|
294
|
+
value: selectedInsurancePolicy,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
if (selectedPaymentMode) {
|
|
298
|
+
attributes.push({
|
|
299
|
+
attributeType: '8553afa0-bdb9-4d3c-8a98-05fa9350aa85',
|
|
300
|
+
value: selectedPaymentMode.uuid,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
return attributes;
|
|
304
|
+
}
|
|
305
|
+
|
|
247
306
|
function generateVisitTypeOptions() {
|
|
248
307
|
return visitTypes.map((vt: VisitType) => {
|
|
249
308
|
return {
|
|
@@ -322,6 +381,32 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
322
381
|
};
|
|
323
382
|
return payload;
|
|
324
383
|
}
|
|
384
|
+
function isValidCreateBillDto(createBillDto: CreateBillDto): boolean {
|
|
385
|
+
if (!createBillDto.patient) {
|
|
386
|
+
showAlert('error', 'Please select a patient', '');
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
if (!createBillDto.status) {
|
|
390
|
+
showAlert('error', 'Bill does not have a status', '');
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
if (!createBillDto.cashPoint) {
|
|
394
|
+
showAlert('error', 'Please select a cashpoint', '');
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
if (!createBillDto.lineItems || createBillDto.lineItems.length === 0) {
|
|
398
|
+
showAlert('error', 'Please select a valid cashpoint', '');
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function hasSelectedPaymentMode(paymentMode: string): boolean {
|
|
405
|
+
if (!selectedPaymentMode) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
return selectedPaymentMode.name.trim().toLowerCase().includes(paymentMode.trim().toLowerCase());
|
|
409
|
+
}
|
|
325
410
|
|
|
326
411
|
return (
|
|
327
412
|
<>
|
|
@@ -417,6 +502,28 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
417
502
|
</Select>
|
|
418
503
|
</div>
|
|
419
504
|
</div>
|
|
505
|
+
{hasSelectedPaymentMode('insurance') ? (
|
|
506
|
+
<>
|
|
507
|
+
<div className={styles.formRow}>
|
|
508
|
+
<div className={styles.formControl}>
|
|
509
|
+
<TextInput
|
|
510
|
+
id="insurance-scheme"
|
|
511
|
+
labelText="Insurance scheme"
|
|
512
|
+
onChange={(e) => insuranceSchemeHandler(e.target.value)}
|
|
513
|
+
/>
|
|
514
|
+
</div>
|
|
515
|
+
<div className={styles.formControl}>
|
|
516
|
+
<TextInput
|
|
517
|
+
id="policy-number"
|
|
518
|
+
labelText="Policy number"
|
|
519
|
+
onChange={(e) => insurancePolicyHandler(e.target.value)}
|
|
520
|
+
/>
|
|
521
|
+
</div>
|
|
522
|
+
</div>
|
|
523
|
+
</>
|
|
524
|
+
) : (
|
|
525
|
+
<></>
|
|
526
|
+
)}
|
|
420
527
|
<div className={styles.formRow}>
|
|
421
528
|
<div className={styles.formControl}>
|
|
422
529
|
<Select
|
|
@@ -436,6 +543,25 @@ const SendToTriageModal: React.FC<SendToTriageModalProps> = ({
|
|
|
436
543
|
) : (
|
|
437
544
|
<></>
|
|
438
545
|
)}
|
|
546
|
+
|
|
547
|
+
{selectedPaymentDetail === PaymentDetail.NonPaying ? (
|
|
548
|
+
<>
|
|
549
|
+
<div className={styles.formRow}>
|
|
550
|
+
<div className={styles.formControl}>
|
|
551
|
+
<Select
|
|
552
|
+
id="patient-category"
|
|
553
|
+
labelText="Patient Category"
|
|
554
|
+
onChange={($event) => patientCategoryHandler($event.target.value)}
|
|
555
|
+
>
|
|
556
|
+
<SelectItem value="" text="Select" />;
|
|
557
|
+
<SelectItem value={CCC_UUID} text="CCC" />;
|
|
558
|
+
</Select>
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
</>
|
|
562
|
+
) : (
|
|
563
|
+
<></>
|
|
564
|
+
)}
|
|
439
565
|
</div>
|
|
440
566
|
<div className={styles.formSection}>
|
|
441
567
|
<div className={styles.formRow}>
|
|
@@ -227,6 +227,12 @@ export type CreateVisitDto = {
|
|
|
227
227
|
startDatetime: null | string;
|
|
228
228
|
stopDatetime: null | string;
|
|
229
229
|
patient: string;
|
|
230
|
+
attributes?: VisitAttribute[];
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export type VisitAttribute = {
|
|
234
|
+
attributeType: string;
|
|
235
|
+
value: string;
|
|
230
236
|
};
|
|
231
237
|
|
|
232
238
|
export type EndVisitDto = {
|
|
@@ -312,3 +318,5 @@ export enum PaymentDetail {
|
|
|
312
318
|
Paying = 'Paying',
|
|
313
319
|
NonPaying = 'Non-Paying',
|
|
314
320
|
}
|
|
321
|
+
|
|
322
|
+
export const CCC_UUID = 'a8a3899a-1350-11df-a1f1-0026b9348838';
|
package/dist/757.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_ampath_esm_dha_workflow_app=globalThis.webpackChunk_ampath_esm_dha_workflow_app||[]).push([[757],{3754:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__send-to-triage-modal__formSection___8euyX{display:flex;flex-direction:column;width:100%;row-gap:5px;margin-top:15px}.-esm-dha-workflow__send-to-triage-modal__formRow___Hf27O{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__send-to-triage-modal__formControl___Gmnpd{display:flex;flex-direction:column;width:45%;row-gap:5px}.-esm-dha-workflow__send-to-triage-modal__actionSection___Dlgbe{display:flex;flex-direction:row;column-gap:5px;margin-top:15px}.-esm-dha-workflow__send-to-triage-modal__patientAction___ECxUB{display:flex;flex-direction:row;column-gap:5px;margin-top:15px}.-esm-dha-workflow__send-to-triage-modal__greenBtn___wFmfq{background-color:#28a745}","",{version:3,sources:["webpack://./src/registry/modal/send-to-triage/send-to-triage.modal.scss"],names:[],mappings:"AAAA,8DACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CACA,eAAA,CAEJ,0DACG,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEH,8DACG,YAAA,CACA,qBAAA,CACA,SAAA,CACA,WAAA,CAEH,gEACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,eAAA,CAEJ,gEACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,eAAA,CAEJ,2DACI,wBAAA",sourcesContent:[".formSection{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n margin-top: 15px;\n}\n.formRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.formControl{\n display: flex;\n flex-direction: column;\n width: 45%;\n row-gap: 5px;\n}\n.actionSection{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n margin-top: 15px;\n}\n.patientAction{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n margin-top: 15px;\n}\n.greenBtn{\n background-color: #28a745;\n}"],sourceRoot:""}]),i.locals={formSection:"-esm-dha-workflow__send-to-triage-modal__formSection___8euyX",formRow:"-esm-dha-workflow__send-to-triage-modal__formRow___Hf27O",formControl:"-esm-dha-workflow__send-to-triage-modal__formControl___Gmnpd",actionSection:"-esm-dha-workflow__send-to-triage-modal__actionSection___Dlgbe",patientAction:"-esm-dha-workflow__send-to-triage-modal__patientAction___ECxUB",greenBtn:"-esm-dha-workflow__send-to-triage-modal__greenBtn___wFmfq"};const l=i},4405:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__otp-input-component__otpDataInput___hnFAW{width:3rem;height:3rem;text-align:center}.-esm-dha-workflow__otp-input-component__otpInputContainer___HV3nG{display:flex;flex-direction:row;column-gap:5px}.-esm-dha-workflow__otp-input-component__otpDataInputContainer___73DPe{width:4rem;height:4rem}","",{version:3,sources:["webpack://./src/shared/ui/otp-input/otp-input.component.scss"],names:[],mappings:"AAAA,8DACE,UAAA,CACA,WAAA,CACA,iBAAA,CAEF,mEACG,YAAA,CACA,kBAAA,CACA,cAAA,CAEH,uEACI,UAAA,CACA,WAAA",sourcesContent:[".otpDataInput{\n width: 3rem;\n height: 3rem;\n text-align: center;\n}\n.otpInputContainer{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n}\n.otpDataInputContainer{\n width: 4rem;\n height: 4rem;\n}"],sourceRoot:""}]),i.locals={otpDataInput:"-esm-dha-workflow__otp-input-component__otpDataInput___hnFAW",otpInputContainer:"-esm-dha-workflow__otp-input-component__otpInputContainer___HV3nG",otpDataInputContainer:"-esm-dha-workflow__otp-input-component__otpDataInputContainer___73DPe"};const l=i},6842:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__registry-component__registryLayout___PF4WP{display:flex;flex-direction:row;width:100%;row-gap:10px;padding:2% 2%}.-esm-dha-workflow__registry-component__mainContent___qOmrp{display:flex;flex-direction:column;width:100%}.-esm-dha-workflow__registry-component__registryHeader___YIQ62{display:flex;flex-direction:column;row-gap:10px;width:100%}.-esm-dha-workflow__registry-component__registryContent___W1b-9{display:flex;flex-direction:column;width:100%}.-esm-dha-workflow__registry-component__formRow___qlwjG{display:flex;flex-direction:row;width:100%;column-gap:5px;margin-top:10px}.-esm-dha-workflow__registry-component__formControl___R5c2A{width:30%}.-esm-dha-workflow__registry-component__hieData___jx5gt{margin-top:15px;display:flex;flex-direction:column;width:80%;row-gap:10px}.-esm-dha-workflow__registry-component__btnContainer___aXZfC{padding:5px 5px}.-esm-dha-workflow__registry-component__selectionHeader___-zRam{display:flex;flex-direction:column;width:100%;row-gap:5px}.-esm-dha-workflow__registry-component__patientSelect___wgPYw{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__registry-component__patientSelectRadio___3aGYW{width:70%}.-esm-dha-workflow__registry-component__patientConfirmSelection___Py9-y{display:flex;flex-direction:row;width:30%;column-gap:5px}.-esm-dha-workflow__registry-component__formBtn___ok0W6{display:flex;flex-direction:row;column-gap:5px}.-esm-dha-workflow__registry-component__registrySearchBtn___jHA2M{height:30px}.-esm-dha-workflow__registry-component__principalDependantSection___y\\+Uv2{display:flex;flex-direction:row;width:100%;margin-top:15px}.-esm-dha-workflow__registry-component__dependantCard___BUkYp{display:flex;flex-direction:row;width:30%}","",{version:3,sources:["webpack://./src/registry/registry.component.scss"],names:[],mappings:"AAAA,+DACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,YAAA,CACA,aAAA,CAEJ,4DACE,YAAA,CACA,qBAAA,CACA,UAAA,CAEF,+DACI,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,UAAA,CAEJ,wDACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CACA,eAAA,CAEJ,4DACI,SAAA,CAEJ,wDACI,eAAA,CACA,YAAA,CACA,qBAAA,CACA,SAAA,CACA,YAAA,CAEJ,6DACI,eAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CAEJ,8DACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEJ,mEACI,SAAA,CAEJ,wEACI,YAAA,CACA,kBAAA,CACA,SAAA,CACA,cAAA,CAEJ,wDACI,YAAA,CACA,kBAAA,CACA,cAAA,CAEJ,kEACI,WAAA,CAEJ,2EACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,eAAA,CAEJ,8DACI,YAAA,CACA,kBAAA,CACA,SAAA",sourcesContent:[".registryLayout{\n display: flex;\n flex-direction: row;\n width: 100%;\n row-gap: 10px;\n padding: 2% 2%;\n}\n.mainContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.registryHeader{\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n}\n.registryContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.formRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n margin-top: 10px;\n}\n.formControl{\n width: 30%;\n}\n.hieData{\n margin-top: 15px;\n display: flex;\n flex-direction: column;\n width: 80%;\n row-gap: 10px;\n}\n.btnContainer{\n padding: 5px 5px;\n}\n.selectionHeader{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n}\n.patientSelect{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.patientSelectRadio{\n width: 70%;\n}\n.patientConfirmSelection{\n display: flex;\n flex-direction: row;\n width: 30%;\n column-gap: 5px;\n}\n.formBtn{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n}\n.registrySearchBtn{\n height: 30px;\n}\n.principalDependantSection{\n display: flex;\n flex-direction: row;\n width: 100%;\n margin-top: 15px;\n}\n.dependantCard{\n display: flex;\n flex-direction: row;\n width: 30%;\n}"],sourceRoot:""}]),i.locals={registryLayout:"-esm-dha-workflow__registry-component__registryLayout___PF4WP",mainContent:"-esm-dha-workflow__registry-component__mainContent___qOmrp",registryHeader:"-esm-dha-workflow__registry-component__registryHeader___YIQ62",registryContent:"-esm-dha-workflow__registry-component__registryContent___W1b-9",formRow:"-esm-dha-workflow__registry-component__formRow___qlwjG",formControl:"-esm-dha-workflow__registry-component__formControl___R5c2A",hieData:"-esm-dha-workflow__registry-component__hieData___jx5gt",btnContainer:"-esm-dha-workflow__registry-component__btnContainer___aXZfC",selectionHeader:"-esm-dha-workflow__registry-component__selectionHeader___-zRam",patientSelect:"-esm-dha-workflow__registry-component__patientSelect___wgPYw",patientSelectRadio:"-esm-dha-workflow__registry-component__patientSelectRadio___3aGYW",patientConfirmSelection:"-esm-dha-workflow__registry-component__patientConfirmSelection___Py9-y",formBtn:"-esm-dha-workflow__registry-component__formBtn___ok0W6",registrySearchBtn:"-esm-dha-workflow__registry-component__registrySearchBtn___jHA2M",principalDependantSection:"-esm-dha-workflow__registry-component__principalDependantSection___y+Uv2",dependantCard:"-esm-dha-workflow__registry-component__dependantCard___BUkYp"};const l=i},49757:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Qe});var r=n(39246),a=n(16072),o=n.n(a),i=n(85072),l=n.n(i),c=n(97825),u=n.n(c),s=n(77659),d=n.n(s),f=n(55056),m=n.n(f),p=n(10540),A=n.n(p),h=n(41113),y=n.n(h),_=n(6842),b={};b.styleTagTransform=y(),b.setAttributes=m(),b.insert=d().bind(null,"head"),b.domAPI=u(),b.insertStyleElement=A(),l()(_.A,b);const w=_.A&&_.A.locals?_.A.locals:void 0;var v=["National ID","Alien ID","Passport","Mandate Number","Refugee ID"],g=function(e){return e.Draft="DRAFT",e.Sent="SENT",e.Verified="VERIFIED",e}({}),C=function(e){return e.NationalID="National ID",e.SHANumber="SHA Number",e.HouseholdNumber="Household Number",e.RefugeeID="Refugee ID",e.AlienID="Alien ID",e.MandateNumber="Mandate Number",e.Cr="id",e.TemporaryDependantID="Temporary Dependant ID",e.BirthCertificate="Birth Certificate",e}({}),E=function(e){return e.Paying="Paying",e.NonPaying="Non-Paying",e}({}),x=n(62801);function S(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){S(o,r,a,i,l,"next",e)}function l(e){S(o,r,a,i,l,"throw",e)}i(void 0)}))}}function T(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function I(e,t){return k((function(){var n,r;return T(this,(function(a){switch(a.label){case 0:return[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=a.sent()).ok?[3,3]:[4,n.text()];case 2:throw r=a.sent(),new Error("Request failed with ".concat(n.status,": ").concat(r));case 3:return[2,n.json()]}}))}))()}function N(e){return k((function(){var t,n,r;return T(this,(function(a){switch(a.label){case 0:return[4,(0,x.bo)()];case 1:return t=a.sent(),n="".concat(t,"/client/search"),r={identificationNumber:e.identificationNumber,identificationType:e.identificationType,locationUuid:e.locationUuid},[2,I(n,r)]}}))}))()}var P=n(25987),D=n(84497),O={};O.styleTagTransform=y(),O.setAttributes=m(),O.insert=d().bind(null,"head"),O.domAPI=u(),O.insertStyleElement=A(),l()(D.A,O);const j=D.A&&D.A.locals?D.A.locals:void 0;var F=function(e){for(var t=e.split(""),n=0;n<e.length;n++)n%2==0&&(t[n]="*");return t.join("")},B=function(e){for(var t=e.split(""),n=0;n<e.length;n++)0!=n&&n!==e.length-1&&(t[n]="*");return t.join("")},R=n(4405),U={};U.styleTagTransform=y(),U.setAttributes=m(),U.insert=d().bind(null,"head"),U.domAPI=u(),U.insertStyleElement=A(),l()(R.A,U);const Y=R.A&&R.A.locals?R.A.locals:void 0;function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function M(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||q(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){if(e){if("string"==typeof e)return H(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(e,t):void 0}}const L=function(e){var t,n,i=e.onChange,l=e.otpLength,c=(t=(0,a.useState)(Array(l).fill("")),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(t,n)||q(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],s=c[1],d=(0,a.useRef)([]);if(!l)return o().createElement(o().Fragment,null,"OTP Length not defined");var f=function(e){d.current[e]&&d.current[e].focus()};return o().createElement("div",{className:Y.otpInputContainer,onPaste:function(e){e.preventDefault();var t=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,l);if(t){var n=M(u);t.split("").forEach((function(e,t){n[t]=e})),s(n),null==i||i(n.join("")),f(t.length-1)}}},u.map((function(e,t){return o().createElement("div",{className:Y.otpDataInputContainer},o().createElement(r.ksK,{className:Y.otpDataInput,key:t,id:"otp-".concat(t),value:e,labelText:"",hideLabel:!0,maxLength:1,inputMode:"numeric",pattern:"[0-9]*",ref:function(e){return d.current[t]=e},onChange:function(e){return function(e,t){if(/^\d?$/.test(e)){var n=M(u);n[t]=e,s(n),e&&t<l-1&&f(t+1),null==i||i(n.join(""))}}(e.target.value,t)},onKeyDown:function(e){return function(e,t){"Backspace"===e.key&&!u[t]&&t>0&&f(t-1)}(e,t)},style:{height:"4rem",width:"4rem",borderStyle:"solid grey",backgroundColor:"#e5ebf7"}}))})))};var V=n(75485),G={};G.styleTagTransform=y(),G.setAttributes=m(),G.insert=d().bind(null,"head"),G.domAPI=u(),G.insertStyleElement=A(),l()(V.A,G);const W=V.A&&V.A.locals?V.A.locals:void 0;function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const z=function(e){var t,n,r,i,l,c,u,s=e.durationInSeconds,d=(e.resetTimer,e.onTimeUp),f=(t=(0,a.useState)(s),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(t,n)||function(e,t){if(e){if("string"==typeof e)return J(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=f[0],p=f[1];return(0,a.useEffect)((function(){if(!(m<=0)){var e=setInterval((function(){p((function(e){return e-1}))}),1e3);return function(){return clearInterval(e)}}null==d||d()}),[m]),o().createElement(o().Fragment,null,o().createElement("div",{className:W.timerData},o().createElement("b",null,(l=(r=m)%60,c=(i=Math.floor(r/60))>9?i:"0".concat(i),u=l>9?l:"0".concat(l),"".concat(c,":").concat(u)))))};function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function K(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Q(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){K(o,r,a,i,l,"next",e)}function l(e){K(o,r,a,i,l,"throw",e)}i(void 0)}))}}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const ee=function(e){var t=e.requestCustomOtpDto,n=e.phoneNumber,i=e.open,l=e.onModalClose,c=e.onOtpSuccessfullVerification,u=X((0,a.useState)(""),2),s=u[0],d=u[1],f=X((0,a.useState)(g.Draft),2),m=f[0],p=f[1],A=X((0,a.useState)(!1),2),h=A[0],y=A[1],_=X((0,a.useState)(""),2),b=_[0],w=_[1],v=function(e,t,n){(0,P.showSnackbar)({kind:e,title:t,subtitle:n})};return o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:i,size:"md",onSecondarySubmit:l,onRequestClose:l,onRequestSubmit:function(){return m===g.Draft?Q((function(){var e,n,r;return Z(this,(function(a){switch(a.label){case 0:if(!t.identificationNumber)return v("error","Invalid Identification Value","Please enter a valid ID value"),[2];y(!0),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,(o=t,k((function(){var e,t,n;return T(this,(function(r){switch(r.label){case 0:return[4,(0,x.bo)()];case 1:return e=r.sent(),t="".concat(e,"/client/send-custom-otp"),n={identificationNumber:o.identificationNumber,identificationType:o.identificationType,locationUuid:o.locationUuid},[2,I(t,n)]}}))}))())];case 2:return e=a.sent(),w(e.sessionId),p(g.Sent),v("success","OTP sent successfully","A code was sent to ".concat(e.maskedPhone)),[3,5];case 3:return n=a.sent(),r=n.message||"Failed to send OTP",v("error","Error sending OTP",r),[3,5];case 4:return y(!1),[7];case 5:return[2]}var o}))}))():m===g.Sent?Q((function(){var e,n;return Z(this,(function(r){switch(r.label){case 0:if(!s.trim())return v("error","Please enter the OTP code",""),[2];y(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,(a={sessionId:b,otp:s,locationUuid:t.locationUuid},k((function(){var e,t,n;return T(this,(function(r){switch(r.label){case 0:return[4,(0,x.bo)()];case 1:return e=r.sent(),t="".concat(e,"/client/validate-custom-otp"),n={sessionId:a.sessionId,otp:a.otp,locationUuid:a.locationUuid},[2,I(t,n)]}}))}))())];case 2:return r.sent(),p(g.Verified),(0,P.showSnackbar)({kind:"success",title:"OTP Verified",subtitle:"You can now fetch data from Client Registry."}),[3,5];case 3:return e=r.sent(),n=e.message||"OTP verification failed",(0,P.showSnackbar)({kind:"error",title:"OTP Verification Failed",subtitle:n}),[3,5];case 4:return y(!1),[7];case 5:return[2]}var a}))}))():m===g.Verified?c():void 0},primaryButtonText:m===g.Draft?h?"Sending OTP...":"Send OTP":m===g.Sent?h?"Verifying OTP...":"Verify":m===g.Verified?h?"loading...":"Continue":"",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:j.modalVerificationLayout},o().createElement("div",{className:j.sectionHeader},o().createElement("h4",{className:j.sectionTitle},"One Time Password (OTP)"),o().createElement("h6",null,"(Enter one time password to proceed)")),o().createElement("div",{className:j.sectionContent},o().createElement("div",{className:j.contentHeader},m===g.Draft?o().createElement(o().Fragment,null,o().createElement("h6",null,"Send Code to Phone ",function(e){for(var t=e.split(""),n=0;n<e.length;n++)n>3&&n<e.length-3&&(t[n]="*");return t.join("")}(n),"?")):o().createElement(o().Fragment,null),m===g.Verified?o().createElement(o().Fragment,null,o().createElement("h6",null,"OTP Verification Successfull!")):o().createElement(o().Fragment,null)),o().createElement("div",{className:j.otpSection},m===g.Sent?o().createElement(o().Fragment,null,o().createElement("div",{className:j.otpForm},o().createElement(r.lRv,null,"Enter OTP"),o().createElement(L,{otpLength:5,onChange:function(e){return d(e)}})),o().createElement("div",{className:j.otpTimer},o().createElement(z,{durationInSeconds:60,resetTimer:function(){},onTimeUp:function(){g.Sent&&p(g.Draft)}}))):o().createElement(o().Fragment,null))),o().createElement("div",{className:j.sectionAction})))))};var te=n(86575),ne={};ne.styleTagTransform=y(),ne.setAttributes=m(),ne.insert=d().bind(null,"head"),ne.domAPI=u(),ne.insertStyleElement=A(),l()(te.A,ne);const re=te.A&&te.A.locals?te.A.locals:void 0;function ae(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oe=["id","other_identifications","first_name","middle_name","last_name","gender","date_of_birth","is_alive","deceased_datetime","phone","email","civil_status","place_of_birth","citizenship","country","county","sub_county","ward","village_estate","longitude","latitude","identification_type"];const ie=function(e){var t=e.client,n=(0,a.useMemo)((function(){return e=t,n={},Object.keys(e).filter((function(e){return oe.includes(e)})).forEach((function(t){if("other_identifications"===t){var r=(o=e[t],i={},o.forEach((function(e){i[e.identification_type]=e.identification_number})),i);n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ae(e,t,n[t])}))}return e}({},n,r)}else if("identification_type"===t)n[e.identification_type]=e.identification_number;else{var a=e[t];n[t]=a}var o,i})),n;var e,n}),[t]);return t&&n?o().createElement(o().Fragment,null,o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"Field"),o().createElement(r.A0N,null,"Value"))),o().createElement(r.BFY,null,Object.keys(n).map((function(e){return o().createElement(r.Hjg,null,o().createElement(r.nA6,null,e),o().createElement(r.nA6,null,n[e]))}))))):o().createElement(o().Fragment,null,o().createElement("h4",null,"No patient Data to Display"))},le=function(){return o().createElement(o().Fragment,null,o().createElement(r.zWQ,{defaultSelected:"sha",legendText:"Patient",onChange:function(e){},name:"payment-options-radio-group"},o().createElement(r.aaP,{id:"sha",labelText:"Social Health Authority",value:"sha"}),o().createElement(r.aaP,{id:"insurance",labelText:"Other Insurance",value:"other"}),o().createElement(r.aaP,{id:"cash",labelText:"Cash",value:"cash"})))},ce=function(e){var t=e.client,n=e.open,a=e.onModalClose,i=(e.onSubmit,e.onSendClientToTriage);return t?o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:n,size:"md",onSecondarySubmit:a,onRequestClose:a,onRequestSubmit:function(){window.open("https://afyayangu.go.ke/","_blank")},primaryButtonText:"Register on Afya Yangu",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:re.clientDetailsLayout},o().createElement("div",{className:re.sectionHeader},o().createElement("h4",{className:re.sectionTitle},"Patient/Payment Details")),o().createElement("div",{className:re.sectionContent},o().createElement(r.tUM,null,o().createElement(r.wbY,{contained:!0},o().createElement(r.ozo,null,"Patient Details"),o().createElement(r.ozo,null,"Payment Details")),o().createElement(r.T2N,null,o().createElement(r.KpK,null,o().createElement(ie,{client:t})),o().createElement(r.KpK,null,o().createElement(le,null))))),o().createElement("div",{className:re.actionSection},o().createElement("div",{className:re.btnContainer},o().createElement(r.$nd,{kind:"primary"},"Book Appointment")),o().createElement("div",{className:re.btnContainer},o().createElement(r.$nd,{kind:"secondary"},"Walk In Orders")),o().createElement("div",{className:re.btnContainer},o().createElement(r.$nd,{kind:"tertiary",onClick:function(){return i(t.id)}},"Send To Triage"))))))):o().createElement(o().Fragment,null,"No Client data")};function ue(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function se(e){return(t=function(){var t,n,r,a;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(o){switch(o.label){case 0:return t="".concat(P.restBaseUrl,"/patient"),n=new URLSearchParams({q:e,v:"full",includeDead:"true",limit:"10",totalCount:"true"}).toString(),[4,(0,P.openmrsFetch)("".concat(t,"?").concat(n))];case 1:return(r=o.sent()).ok?[3,3]:[4,r.text()];case 2:throw a=o.sent(),new Error("Request failed with ".concat(r.status,": ").concat(a));case 3:return[2,r.json()]}}))},function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){ue(o,r,a,i,l,"next",e)}function l(e){ue(o,r,a,i,l,"throw",e)}i(void 0)}))})();var t}var de=n(3754),fe={};fe.styleTagTransform=y(),fe.setAttributes=m(),fe.insert=d().bind(null,"head"),fe.domAPI=u(),fe.insertStyleElement=A(),l()(de.A,fe);const me=de.A&&de.A.locals?de.A.locals:void 0;function pe(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Ae(e){return(t=function(){var t,n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(a){switch(a.label){case 0:return t="".concat(P.restBaseUrl,"/location"),n="".concat(t,"/").concat(e),[4,(0,P.openmrsFetch)(n)];case 1:return[4,a.sent().json()];case 2:return[2,null!=(r=a.sent())?r:null]}}))},function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){pe(o,r,a,i,l,"next",e)}function l(e){pe(o,r,a,i,l,"throw",e)}i(void 0)}))})();var t}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ye(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function _e(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ye(o,r,a,i,l,"next",e)}function l(e){ye(o,r,a,i,l,"throw",e)}i(void 0)}))}}function be(e){return function(e){if(Array.isArray(e))return he(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?he(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function we(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function ve(e){return _e((function(){var t,n,r,a;return we(this,(function(o){switch(o.label){case 0:return t="".concat(P.restBaseUrl,"/queue"),n=new URLSearchParams({v:"custom:(uuid,display,name,description,service:(uuid,display),allowedPriorities:(uuid,display),allowedStatuses:(uuid,display),location:(uuid,display))",location:e}).toString(),[4,(0,P.openmrsFetch)("".concat(t,"?").concat(n))];case 1:return(r=o.sent()).ok?[3,3]:[4,r.text()];case 2:throw a=o.sent(),new Error("Request failed with ".concat(r.status,": ").concat(a));case 3:return[2,r.json()]}}))}))()}function ge(e){return _e((function(){var t,n,r,a,o,i,l,c,u,s;return we(this,(function(d){switch(d.label){case 0:return[4,Ae(e)];case 1:return(t=d.sent())&&(n=t.parentLocation)?[4,Ae(n.uuid)]:[2];case 2:if(r=d.sent(),o=null!==(a=r.childLocations)&&void 0!==a?a:[],l=null!==(i=o.map((function(e){return e.uuid})))&&void 0!==i?i:[],c=[],!(l.length>0))return[3,6];u=0,d.label=3;case 3:return u<l.length?[4,ve(l[u])]:[3,6];case 4:s=d.sent(),c=be(c).concat(be(s.results)),d.label=5;case 5:return u++,[3,3];case 6:return[2,c]}}))}))()}var Ce=n(75862),Ee=n(25838);function xe(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Se(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){xe(o,r,a,i,l,"next",e)}function l(e){xe(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ke(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ie(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Ne(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ie(o,r,a,i,l,"next",e)}function l(e){Ie(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Te(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function De(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const Oe=function(e){var t=e.patients,n=e.open,i=e.onModalClose,l=(e.onSubmit,e.client),c=e.onCreateAmrsPatient,u=e.onManualRegistration,s=Pe((0,a.useState)(),2),d=s[0],f=s[1],m=Pe((0,a.useState)(),2),p=m[0],A=m[1],h=Pe((0,a.useState)(),2),y=h[0],_=h[1],b=Pe((0,a.useState)(),2),w=b[0],v=b[1],g=Pe((0,a.useState)([]),2),C=g[0],x=g[1],S=Pe((0,a.useState)([]),2),k=S[0],T=S[1],I=Pe((0,a.useState)(null),2),N=I[0],D=I[1],O=Pe((0,a.useState)(null),2),j=(O[0],O[1]),F=Pe((0,a.useState)(""),2),B=F[0],R=F[1],U=Pe((0,a.useState)(),2),Y=U[0],H=U[1],M=Pe((0,a.useState)([]),2),q=(M[0],M[1]),L=Pe((0,a.useState)([]),2),V=L[0],G=L[1],W=Pe((0,a.useState)(null),2),J=W[0],z=W[1],$=Pe((0,a.useState)(null),2),K=$[0],Q=$[1],X=Pe((0,a.useState)(!1),2),Z=(X[0],X[1]),ee=(0,P.useVisitTypes)(),te=(0,P.useSession)().sessionLocation.uuid,ne=(0,a.useMemo)((function(){return ee.map((function(e){return{id:e.uuid,text:e.display}}))}),[ee]),re=(0,a.useMemo)((function(){return k.filter((function(e){return e.location.uuid===te}))}),[k,te]),ae=Object.values(E).map((function(e){return{id:e,label:e}}));if((0,a.useEffect)((function(){Ne((function(){var e,t,n;return De(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,ge(te)];case 1:return(e=r.sent()).length>0&&_(e),[3,3];case 2:return t=r.sent(),(0,P.showSnackbar)({kind:"error",title:"An error occurred while fetching service queues",subtitle:null!==(n=t.message)&&void 0!==n?n:"An error occurred while fetching service queues, please try agin"}),[3,3];case 3:return[2]}}))}))(),Ne((function(){var e;return De(this,(function(t){switch(t.label){case 0:return[4,Se((function(){var e,t,n;return ke(this,(function(r){switch(r.label){case 0:return e="".concat(P.restBaseUrl,"/billing/paymentMode"),[4,(0,P.openmrsFetch)(e)];case 1:return[4,r.sent().json()];case 2:return t=r.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()];case 1:return e=t.sent(),x(e),[2]}}))}))(),Ne((function(){var e;return De(this,(function(t){switch(t.label){case 0:return[4,Se((function(){var e,t,n;return ke(this,(function(r){switch(r.label){case 0:return e="".concat(P.restBaseUrl,"/billing/billableService"),[4,(0,P.openmrsFetch)("".concat(e,"?v=").concat("full"))];case 1:return[4,r.sent().json()];case 2:return t=r.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()];case 1:return e=t.sent(),q(e),function(e){var t=[],n=!0,r=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l=o.value;if(l.servicePrices){var c=l.servicePrices,u=!0,s=!1,d=void 0;try{for(var f,m=c[Symbol.iterator]();!(u=(f=m.next()).done);u=!0){var p=f.value;t.push(p)}}catch(e){s=!0,d=e}finally{try{u||null==m.return||m.return()}finally{if(s)throw d}}}}}catch(e){r=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw a}}G(t)}(e),[2]}}))}))(),Ne((function(){var e;return De(this,(function(t){switch(t.label){case 0:return[4,Se((function(){var e,t,n;return ke(this,(function(r){switch(r.label){case 0:return e="".concat(P.restBaseUrl,"/billing/cashPoint"),[4,(0,P.openmrsFetch)(e)];case 1:return[4,r.sent().json()];case 2:return t=r.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()];case 1:return e=t.sent(),T(e),[2]}}))}))()}),[t]),!t)return o().createElement(o().Fragment,null,"No Client data");var oe=function(e){return e.location?e.patient?!!e.visitType||(le("error","Please select a visit",""),!1):(le("error","Please select a patient",""),!1):(le("error","Missing location in create visits",""),!1)},ie=function(){var e;return{visitType:p,location:te,startDatetime:null,stopDatetime:null,patient:null!==(e=null==d?void 0:d.uuid)&&void 0!==e?e:""}},le=function(e,t,n){(0,P.showSnackbar)({kind:e,title:t,subtitle:n})};return o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:n,size:"md",onSecondarySubmit:function(){return i({success:!1})},onRequestClose:function(){return i({success:!1})},onRequestSubmit:function(){return Ne((function(){var e,t,n,r,a,o;return De(this,(function(l){switch(l.label){case 0:Z(!0),l.label=1;case 1:return l.trys.push([1,6,7,8]),[4,Ne((function(){var e,t;return De(this,(function(n){switch(n.label){case 0:return e=ie(),oe(e)?[4,(0,Ee._)(e)]:[2,!1];case 1:if(t=n.sent())return le("success","Visit has been created succesfully",""),[2,t];throw le("error","Error creating patient visit",""),new Error("Error creating patient visit")}}))}))()];case 2:return(e=l.sent())?(u=e.uuid,t={visit:{uuid:u},queueEntry:{status:{uuid:Ce.cn.WAITING_UUID},priority:{uuid:null!=B?B:Ce.i3.NORMAL_PRIORITY_UUID},queue:{uuid:w},patient:{uuid:d.uuid},startedAt:(new Date).toISOString(),sortWeight:0}},[4,(s=t,_e((function(){var e,t,n;return we(this,(function(r){switch(r.label){case 0:return e="".concat(P.restBaseUrl,"/visit-queue-entry"),[4,(0,P.openmrsFetch)(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s)})];case 1:return(t=r.sent()).ok?[3,3]:[4,t.text()];case 2:throw n=r.sent(),new Error("Request failed with ".concat(t.status,": ").concat(n));case 3:return[2,t.json()]}}))}))())]):[3,5];case 3:return(n=l.sent())&&le("success","Patient has succesfully been moved to the Triage queue",""),[4,(c={lineItems:[{billableService:K.billableService.uuid,quantity:1,price:K.price,priceName:K.name,priceUuid:K.uuid,lineItemOrder:0,paymentStatus:"PENDING"}],cashPoint:N.uuid,patient:d.uuid,status:"PENDING",payments:[]},Se((function(){var e,t,n;return ke(this,(function(r){switch(r.label){case 0:return e="".concat(P.restBaseUrl,"/billing/bill"),[4,(0,P.openmrsFetch)(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)})];case 1:return[4,r.sent().json()];case 2:return t=r.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))())];case 4:(r=l.sent())&&le("success","Bill succesfully created",""),n&&r&&i({success:!0}),l.label=5;case 5:return[3,8];case 6:return a=l.sent(),le("error",null!==(o=a.message)&&void 0!==o?o:"Error creating visit",""),[3,8];case 7:return Z(!1),[7];case 8:return[2]}var c,u,s}))}))()},primaryButtonText:"Send to Triage",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:me.clientDetailsLayout},o().createElement("div",{className:me.sectionHeader},o().createElement("h4",{className:me.sectionTitle},"Send To Triage")),t.length>0?o().createElement("div",{className:me.sectionContent},o().createElement("div",{className:me.patientSelect},o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"No"),o().createElement(r.A0N,null,"Name"),o().createElement(r.A0N,null,"Gender"),o().createElement(r.A0N,null,"Select Patient"))),o().createElement(r.BFY,null,t.map((function(e,t){return o().createElement(r.Hjg,{key:e.uuid},o().createElement(r.nA6,null,t+1),o().createElement(r.nA6,null,e.person.preferredName.display),o().createElement(r.nA6,null,e.person.gender),o().createElement(r.nA6,null,o().createElement(r.Sc0,{id:e.uuid,labelText:"",onChange:function(){f(e)}})))}))))),o().createElement("div",{className:me.formSection},o().createElement("div",{className:me.formRow},o().createElement("div",{className:me.formControl},o().createElement(r.l6P,{id:"payment-details",labelText:"Payment Details",onChange:function(e){return t=e.target.value,void H(t);var t}},o().createElement(r.ebT,{value:"",text:"Select"}),";",ae.map((function(e){return o().createElement(r.ebT,{value:e.id,text:e.label})})))))),o().createElement("div",{className:me.formSection},Y===E.Paying?o().createElement(o().Fragment,null,o().createElement("div",{className:me.formRow},o().createElement("div",{className:me.formControl},o().createElement(r.l6P,{id:"payment-method",labelText:"Payment Method",onChange:function(e){return function(e){var t=C.find((function(t){return t.uuid===e}));j(t);var n,r,a=(n=t,r=[],V.forEach((function(e){e.paymentMode&&e.paymentMode.uuid===n.uuid&&r.push(e)})),r);z(a)}(e.target.value)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",C&&C.map((function(e){return o().createElement(r.ebT,{value:e.uuid,text:e.name})})))),o().createElement("div",{className:me.formControl},o().createElement(r.l6P,{id:"billable-service",labelText:"Billable Services",onChange:function(e){return function(e){var t=V.find((function(t){return t.uuid===e}));Q(t)}(e.target.value)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",J&&J.map((function(e){return o().createElement(r.ebT,{value:e.uuid,text:"".concat(e.billableService.name,"(").concat(e.name,":").concat(e.price,")")})}))))),o().createElement("div",{className:me.formRow},o().createElement("div",{className:me.formControl},o().createElement(r.l6P,{id:"cash-point",labelText:"Cash Point",onChange:function(e){return function(e){var t=k.find((function(t){return t.uuid===e}));D(t)}(e.target.value)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",re&&re.map((function(e){return o().createElement(r.ebT,{value:e.uuid,text:e.name})})))))):o().createElement(o().Fragment,null)),o().createElement("div",{className:me.formSection},o().createElement("div",{className:me.formRow},o().createElement("div",{className:me.formControl},o().createElement(r.a32,{onChange:function(e){var t=e.selectedItem.id;A(t)},id:"visit-type-combobox",items:ne,itemToString:function(e){return e?e.text:""},titleText:"Select a Visit Type"})),o().createElement("div",{className:me.formControl},o().createElement(r.l6P,{id:"service",labelText:"Select a Queue Service",onChange:function(e){var t=e.target.value;v(t)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",y&&y.map((function(e){var t;return o().createElement(r.ebT,{value:e.uuid,text:"".concat(e.display," (").concat(null!==(t=e.location.display)&&void 0!==t?t:"",")")})}))))),o().createElement("div",{className:me.formRow},o().createElement("div",{className:me.formControl},o().createElement(r.l6P,{id:"priority",labelText:"Select Priority",onChange:function(e){return t=e.target.value,void R(t);var t}},o().createElement(r.ebT,{value:"",text:"Select"}),";",o().createElement(r.ebT,{value:Ce.i3.NORMAL_PRIORITY_UUID,text:"NORMAL"}),";",o().createElement(r.ebT,{value:Ce.i3.EMERGENCY_PRIORITY_UUID,text:"EMERGENCY"}),";"))))):o().createElement(o().Fragment,null),o().createElement("div",{className:me.actionSection},0===t.length?o().createElement(o().Fragment,null,o().createElement("div",{className:me.patientAction},o().createElement("div",{className:me.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){return c(l)}},"Automatically Register in AMRS")),o().createElement("div",{className:me.btnContainer},o().createElement(r.$nd,{kind:"secondary",onClick:u},"Manually Register")))):o().createElement(o().Fragment,null))))))};function je(e,t){return"".concat(e.first_name," ").concat(B(e.middle_name)," (").concat(e.gender,") (DOB: ").concat(e.date_of_birth,") (").concat(t,") (CR: ").concat(e.id,")")}function Fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Be(e){return function(e){if(Array.isArray(e))return Fe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Fe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fe(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Re=Be([C.Cr,C.SHANumber,C.HouseholdNumber,C.RefugeeID,C.MandateNumber,C.AlienID,C.NationalID,C.TemporaryDependantID]).concat(Be(["first_name","middle_name","last_name"]),Be(["gender","date_of_birth","is_alive","deceased_datetime"]),Be(["phone","email","civil_status","place_of_birth","citizenship"]),Be(["country","county","sub_county","ward","village_estate","longitude","latitude"]));function Ue(e){var t="";switch(e){case"Divorced":t="a899ad58-1350-11df-a1f1-0026b9348838";break;case"Married":t="a8aa76b0-1350-11df-a1f1-0026b9348838";break;case"Single":t="a899ac7c-1350-11df-a1f1-0026b9348838";break;default:t="a89ad3a4-1350-11df-a1f1-0026b9348838"}return t}function Ye(e){var t;switch(e){case C.NationalID:t="58a47054-1359-11df-a1f1-0026b9348838";break;case C.HouseholdNumber:t="bb74b20e-dcee-4f59-bdf1-2dffc3abf106";break;case C.AlienID:t="12f5b147-3403-4a73-913d-7ded9ffec094";break;case C.SHANumber:t="cf5362b2-8049-4442-b3c6-36f870e320cb";break;case C.MandateNumber:t="aae2d097-20ba-43ca-9b71-fd8296068f39";break;case C.RefugeeID:t="465e81af-8d69-47e9-9127-53a94adc75fb";break;case C.Cr:t="e88dc246-3614-4ee3-8141-1f2a83054e72";break;case C.BirthCertificate:t="7924e13b-131a-4da8-8efa-e294184a1b0d";break;case C.TemporaryDependantID:t="a3d34214-93e8-4faf-bf4d-0272eee079eb"}return t}function He(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Me(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){He(o,r,a,i,l,"next",e)}function l(e){He(o,r,a,i,l,"throw",e)}i(void 0)}))}}function qe(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}var Le=function(e,t){return Me((function(){var n,r;return qe(this,(function(a){switch(a.label){case 0:return[4,Me((function(){var e,t,n,r;return qe(this,(function(a){switch(a.label){case 0:return[4,(0,x.E$)()];case 1:return e=a.sent(),t=new AbortController,[4,(0,P.openmrsFetch)("".concat(e,"/amrs-id-generator/generateidentifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{user:1},signal:t.signal})];case 2:return[4,a.sent().json()];case 3:return n=a.sent(),[2,null!==(r=n.identifier)&&void 0!==r?r:""]}}))}))()];case 1:return n=a.sent(),r=function(e,t){var n=[];return n.push({identifierType:Ye(C.Cr),identifier:e.id,location:t}),n.push({identifierType:Ye(e.identification_type),identifier:e.identification_number,location:t}),n}(t,e),r.push({identifierType:"58a4732e-1359-11df-a1f1-0026b9348838",identifier:n,location:e,preferred:!0}),[2,r]}}))}))()};function Ve(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Ge(e,t){return(n=function(){var n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(a){switch(a.label){case 0:return n=function(e){var t={},n={},r={},a=[];Re.forEach((function(o){"first_name"===o&&(n.givenName=e.first_name),"middle_name"===o&&(n.middleName=e.middle_name),"last_name"===o&&(n.familyName=e.last_name),"gender"===o&&(t.gender="Male"===e.gender?"M":"F"),"date_of_birth"===o&&(t.birthdate=e.date_of_birth,t.birthdateEstimated=!1),"is_alive"===o&&(t.dead=0===e.is_alive),"deceased_datetime"===o&&e.deceased_datetime.length>0&&(t.deathDate=e.deceased_datetime),"country"===o&&e.country.length>0&&(r.country=e.country,r.address1=e.country),"place_of_birth"===o&&e.place_of_birth.length>0&&(r.address10=e.place_of_birth),"county"===o&&e.county.length>0&&(r.countyDistrict=e.county),"sub_county"===o&&e.sub_county.length>0&&(r.address2=e.sub_county,r.stateProvince=e.sub_county),"ward"===o&&e.sub_county.length>0&&(r.address7=e.sub_county,r.address4=e.sub_county),"village_estate"===o&&e.village_estate.length>0&&(r.cityVillage=e.village_estate),"longitude"===o&&e.longitude.length>0&&(r.longitude=e.longitude),"latitude"===o&&e.latitude.length>0&&(r.latitude=e.latitude),"place_of_birth"===o&&e.place_of_birth.length>0&&a.push({value:e.place_of_birth,attributeType:"8d8718c2-c2cc-11de-8d13-0010c6dffd0f"}),"phone"===o&&e.phone.length>0&&a.push({value:e.phone,attributeType:"72a759a8-1359-11df-a1f1-0026b9348838"}),"email"===o&&e.email.length>0&&a.push({value:e.email,attributeType:"2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa"}),"civil_status"===o&&e.civil_status.length>0&&a.push({value:Ue(e.civil_status),attributeType:"8d871f2a-c2cc-11de-8d13-0010c6dffd0f"}),"id"===o&&e.id&&a.push({value:e.id,attributeType:"e068e02b-faac-4baf-bd58-fe6e0c29a81f"}),"citizenship"===o&&e.citizenship&&a.push({value:e.citizenship,attributeType:"8d871afc-c2cc-11de-8d13-0010c6dffd0f"})}));var o=function(e){var t=[],n=e.find((function(e){return"Alternative Phone Number"===e.relationship})),r=e.find((function(e){return"Next Of Kin"===e.remarks}));return n&&"Phone"===n.contact_type&&t.push({value:n.contact_id,attributeType:"c725f524-c14a-4468-ac19-4a0e6661c930"}),r&&("Phone"===r.contact_type&&t.push({value:r.contact_id,attributeType:"a657a4f1-9c0f-444b-a1fd-445bb91dd12d"}),t.push({value:r.relationship,attributeType:"5730994e-c267-426b-87b6-c152b606973d"}),t.push({value:r.contact_name,attributeType:"72a75bec-1359-11df-a1f1-0026b9348838"})),t}(e.alternative_contacts);return a=Be(a).concat(Be(o)),Object.keys(n).length>0&&(t.names=[n]),Object.keys(r).length>0&&(t.addresses=[r]),a.length>0&&(t.attributes=a),t}(e),[4,Le(t,e)];case 1:return r=a.sent(),[4,(o={person:n,identifiers:r},Me((function(){return qe(this,(function(e){switch(e.label){case 0:return[4,(0,P.openmrsFetch)("".concat(P.restBaseUrl,"/patient"),{method:"POST",headers:{"Content-Type":"application/json"},body:o})];case 1:return[2,e.sent()]}}))}))())];case 2:return[4,a.sent().json()];case 3:return[2,a.sent()]}var o}))},function(){var e=this,t=arguments;return new Promise((function(r,a){var o=n.apply(e,t);function i(e){Ve(o,r,a,i,l,"next",e)}function l(e){Ve(o,r,a,i,l,"throw",e)}i(void 0)}))})();var n}function We(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Je(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ze(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Je(o,r,a,i,l,"next",e)}function l(e){Je(o,r,a,i,l,"throw",e)}i(void 0)}))}}function $e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return We(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?We(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const Qe=function(){var e=$e((0,a.useState)("National ID"),2),t=e[0],n=e[1],i=$e((0,a.useState)(""),2),l=i[0],c=i[1],u=$e((0,a.useState)(!1),2),s=u[0],d=u[1],f=$e((0,a.useState)(),2),m=f[0],p=f[1],A=$e((0,a.useState)(),2),h=A[0],y=A[1],_=$e((0,a.useState)([]),2),b=_[0],g=_[1],C=$e((0,a.useState)("principal"),2),E=C[0],x=C[1],S=$e((0,a.useState)(!1),2),k=S[0],T=S[1],I=$e((0,a.useState)(!1),2),D=I[0],O=I[1],j=$e((0,a.useState)(!1),2),R=j[0],U=j[1],Y=$e((0,a.useState)(),2),H=Y[0],M=Y[1],q=(0,P.useSession)().sessionLocation.uuid,L=function(e,t,n){(0,P.showSnackbar)({kind:e,title:t,subtitle:n})},V=function(){O(!1)},G=function(){window.location.href="".concat(window.spaBase,"/patient-registration")},W=function(){return"principal"===E?m:"dependants"===E?h:m},J=function(){p(null),y(null),g([]),x(null),c(""),n("National ID"),O(!1),T(!1),U(!1),x("principal")};return o().createElement(o().Fragment,null,o().createElement("div",{className:w.registryLayout},o().createElement("div",{className:w.mainContent},o().createElement("div",{className:w.registryHeader},o().createElement("h4",null,"Client Registry"),o().createElement("p",null,"Please enter identification number to begin")),o().createElement("div",{className:w.registryContent},o().createElement("div",{className:w.formRow},o().createElement("div",{className:w.formControl},o().createElement(r.msM,{id:"identifier-type-dropdown",label:"Identifier Type",titleText:"Select Identifier Type",items:v,selectedItem:t,onChange:function(e){var t=e.selectedItem;return n(t)}})),o().createElement("div",{className:w.formControl},o().createElement(r.ksK,{id:"identifier-value",labelText:"".concat(t," Value"),value:l,onChange:function(e){return c(e.target.value)},placeholder:"Enter ".concat(t.toLowerCase()," value")}))),o().createElement("div",{className:w.formRow},o().createElement("div",{className:w.formControl},o().createElement("div",{className:w.formBtn},o().createElement(r.$nd,{className:w.registrySearchBtn,kind:"primary",onClick:function(){return ze((function(){var e,n,r,a,o,i;return Ke(this,(function(c){switch(c.label){case 0:d(!0),c.label=1;case 1:return c.trys.push([1,3,4,5]),function(e){return e.identificationNumber?e.identificationType?!!e.locationUuid||(L("error","No default location selected",""),!1):(L("error","Please enter a valid identification type",""),!1):(L("error","Please enter a valid identification number",""),!1)}(e={identificationNumber:l,identificationType:t,locationUuid:q})?(M(e),[4,N(e)]):[2,!1];case 2:if(n=c.sent(),0===(r=Array.isArray(n)?n:[]).length)throw J(),new Error("No matching patient found in Client Registry.");return a=r[0],p(a),L("success","Client Data Loaded","Patient fetched successfully"),[3,5];case 3:return o=c.sent(),i=o.message||"Failed to fetch client data",J(),L("error","Fetch Failed",i),[3,5];case 4:return d(!1),[7];case 5:return[2]}}))}))()},disabled:s},s?o().createElement(r.OuH,{description:"Searching..."}):"Search"),o().createElement(r.$nd,{className:w.registrySearchBtn,kind:"secondary",onClick:G},"Emergency Registration"),m?o().createElement(o().Fragment,null):o().createElement(r.$nd,{className:w.registrySearchBtn,kind:"tertiary",onClick:function(){window.open("https://afyayangu.go.ke/","_blank")}},"Register on Afya Yangu")))),m?o().createElement("div",{className:w.formRow},o().createElement("div",{className:w.hieData},o().createElement("div",{className:w.selectionHeader},o().createElement("h5",null,"Please select one patient and request patient to share the OTP sent")),o().createElement("div",{className:w.patientSelect},o().createElement("div",{className:w.patientSelectRadio},o().createElement(r.zWQ,{defaultSelected:"principal",legendText:"Patient",onChange:function(e){x(e)},name:"radio-button-default-group"},o().createElement(r.aaP,{id:"principal",labelText:"Principal",value:"principal"}),o().createElement(r.aaP,{id:"dependants",labelText:"Dependants",value:"dependants"}))),o().createElement("div",{className:w.patientConfirmSelection},o().createElement("div",{className:w.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){T(!0)}}," ","Confirm")),o().createElement("div",{className:w.btnContainer},o().createElement(r.$nd,{kind:"secondary",onClick:J},"Cancel")))),o().createElement("div",{className:w.principalDependantSection},"principal"===E?o().createElement(o().Fragment,null,o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"Name"),o().createElement(r.A0N,null,"CR"),o().createElement(r.A0N,null,"Phone No"),o().createElement(r.A0N,null,"ID No"))),o().createElement(r.BFY,null,o().createElement(r.Hjg,null,o().createElement(r.nA6,null,m.first_name," ",B(m.middle_name)," ",B(m.last_name)),o().createElement(r.nA6,null,F(m.id)),o().createElement(r.nA6,null,F(m.phone)),o().createElement(r.nA6,null,F(m.identification_number)))))):o().createElement(o().Fragment,null),"dependants"===E?o().createElement(o().Fragment,null,o().createElement(r.zWQ,{defaultSelected:"",helperText:"",invalidText:"",legendText:"",name:"dependant-group",onChange:function(e){return function(e){var t=m.dependants;if(t.length>0){var n=t.find((function(t){return t.result[0].id===e}));n&&y(n.result[0])}}(e)}},m.dependants.map((function(e){var t=e.result[0],n=e.relationship;return o().createElement(r.aaP,{id:t.id,labelText:je(t,n),value:t.id})})))):o().createElement(o().Fragment,null),k?o().createElement(ee,{requestCustomOtpDto:H,phoneNumber:m.phone,open:k,onModalClose:function(){T(!1)},onOtpSuccessfullVerification:function(){T(!1),O(!0)}}):o().createElement(o().Fragment,null),m&&D?o().createElement(o().Fragment,null,o().createElement(ce,{client:W(),open:D,onModalClose:V,onSubmit:function(){},onSendClientToTriage:function(e){return ze((function(){var t;return Ke(this,(function(n){switch(n.label){case 0:return V(),[4,se(e)];case 1:return(t=n.sent()).totalCount>0?(L("success","".concat(t.totalCount," ").concat(t.totalCount>0?"Patients":"Patient"," found in the system with ").concat(e),""),g(t.results),U(!0)):(L("error","Patient not found in the system",""),g([]),U(!0)),[2]}}))}))()}})," "):o().createElement(o().Fragment,null),m&&R?o().createElement(o().Fragment,null,o().createElement(Oe,{client:W(),patients:b,open:R,onModalClose:function(e){U(!1),e&&e.success&&(window.location.href="".concat(window.spaBase,"/home/triage"))},onSubmit:function(){},onCreateAmrsPatient:function(){return ze((function(){var e,t,n,r,a,o,i,l,c,u,s,d;return Ke(this,(function(f){switch(f.label){case 0:if(!(e=W()))return L("error","Principal or dependant not selected",""),[2];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,Ge(e,q)];case 2:return(t=f.sent())&&(L("success","Patient created succesfully",""),g([t])),[3,4];case 3:if(n=f.sent(),a=null!==(r=n.responseBody)&&void 0!==r?r:n.message,L("error","Error Creating Patient",""),o=function(e){var t=[];if(e&&e.error)if(e.error.error){var n=e.error.error.globalErrors||null;if(n){var r=!0,a=!1,o=void 0;try{for(var i,l=n[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var c=i.value;t.push(c.message)}}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}}}else if(e.error)if(e.error.globalErrors){var u=e.error.globalErrors||null;if(u){var s=!0,d=!1,f=void 0;try{for(var m,p=u[Symbol.iterator]();!(s=(m=p.next()).done);s=!0){var A=m.value;t.push(A.message)}}catch(e){d=!0,f=e}finally{try{s||null==p.return||p.return()}finally{if(d)throw f}}}}else e.error.message&&t.push(e.error.message);else t.push(e.error.error.message||"An error occurred while creating the patient. Please try again or contact support");return t}(a),o&&o.length>0){i=!0,l=!1,c=void 0;try{for(u=o[Symbol.iterator]();!(i=(s=u.next()).done);i=!0)d=s.value,L("error",d,"")}catch(e){l=!0,c=e}finally{try{i||null==u.return||u.return()}finally{if(l)throw c}}}return[3,4];case 4:return[2]}}))}))()},onManualRegistration:function(){U(!1),G()}})):o().createElement(o().Fragment,null)))):o().createElement(o().Fragment,null)))))}},75485:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__timer-component__timerData___FgxzS{height:3rem;font-size:30px;color:#0055a5}","",{version:3,sources:["webpack://./src/shared/ui/timer/timer.component.scss"],names:[],mappings:"AAAA,uDACG,WAAA,CACA,cAAA,CACA,aAAA",sourcesContent:[".timerData{\n height: 3rem;\n font-size: 30px;\n color: #0055a5;\n}"],sourceRoot:""}]),i.locals={timerData:"-esm-dha-workflow__timer-component__timerData___FgxzS"};const l=i},84497:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__otp-verification-modal__modalVerificationLayout___MST8n{display:flex;flex-direction:column;row-gap:10px;width:100%}.-esm-dha-workflow__otp-verification-modal__sectionHeader___g62oo{display:flex;flex-direction:column;column-gap:5px;margin-top:5px;margin-bottom:5px}.-esm-dha-workflow__otp-verification-modal__otpSection___R\\+cLH{display:flex;flex-direction:row;width:100%;column-gap:15px}.-esm-dha-workflow__otp-verification-modal__otpForm___6EDu\\+{display:flex;flex-direction:column;width:60%;row-gap:20px}.-esm-dha-workflow__otp-verification-modal__otpTimer___ckBNm{display:flex;flex-direction:column;width:50%;padding-top:6%}","",{version:3,sources:["webpack://./src/registry/modal/otp-verification-modal/otp-verification-modal.scss"],names:[],mappings:"AAAA,4EACE,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CAEF,kEACE,YAAA,CACA,qBAAA,CACA,cAAA,CACA,cAAA,CACA,iBAAA,CAEF,gEACE,YAAA,CACA,kBAAA,CACA,UAAA,CACA,eAAA,CAEF,6DACE,YAAA,CACA,qBAAA,CACA,SAAA,CACA,YAAA,CAEF,6DACE,YAAA,CACA,qBAAA,CACA,SAAA,CACA,cAAA",sourcesContent:[".modalVerificationLayout {\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n}\n.sectionHeader{\n display: flex;\n flex-direction: column;\n column-gap: 5px;\n margin-top: 5px;\n margin-bottom: 5px;\n}\n.otpSection{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 15px;\n}\n.otpForm{\n display: flex;\n flex-direction: column;\n width: 60%;\n row-gap: 20px;\n}\n.otpTimer{\n display: flex;\n flex-direction: column;\n width: 50%;\n padding-top: 6%;\n}"],sourceRoot:""}]),i.locals={modalVerificationLayout:"-esm-dha-workflow__otp-verification-modal__modalVerificationLayout___MST8n",sectionHeader:"-esm-dha-workflow__otp-verification-modal__sectionHeader___g62oo",otpSection:"-esm-dha-workflow__otp-verification-modal__otpSection___R+cLH",otpForm:"-esm-dha-workflow__otp-verification-modal__otpForm___6EDu+",otpTimer:"-esm-dha-workflow__otp-verification-modal__otpTimer___ckBNm"};const l=i},86575:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__client-details-modal__clientDetailsLayout___r5WF\\+{display:flex;flex-direction:column;width:100%;row-gap:5px}.-esm-dha-workflow__client-details-modal__sectionHeader___lH-gL{display:flex;flex-direction:column;row-gap:5px;margin-top:5px;margin-bottom:10px}.-esm-dha-workflow__client-details-modal__sectionContent___QDFT7{display:flex;flex-direction:column;row-gap:5px}.-esm-dha-workflow__client-details-modal__actionSection___okVDp{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__client-details-modal__btnContainer___ETNEk{margin-top:2px;margin-bottom:2px}","",{version:3,sources:["webpack://./src/registry/modal/client-details-modal/client-details-modal.scss"],names:[],mappings:"AAAA,uEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,WAAA,CACA,cAAA,CACA,kBAAA,CAEJ,iEACI,YAAA,CACA,qBAAA,CACA,WAAA,CAEJ,gEACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEJ,+DACI,cAAA,CACA,iBAAA",sourcesContent:[".clientDetailsLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n}\n.sectionHeader{\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n margin-top: 5px;\n margin-bottom: 10px;\n}\n.sectionContent{\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n}\n.actionSection{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.btnContainer{\n margin-top: 2px;\n margin-bottom: 2px;\n}"],sourceRoot:""}]),i.locals={clientDetailsLayout:"-esm-dha-workflow__client-details-modal__clientDetailsLayout___r5WF+",sectionHeader:"-esm-dha-workflow__client-details-modal__sectionHeader___lH-gL",sectionContent:"-esm-dha-workflow__client-details-modal__sectionContent___QDFT7",actionSection:"-esm-dha-workflow__client-details-modal__actionSection___okVDp",btnContainer:"-esm-dha-workflow__client-details-modal__btnContainer___ETNEk"};const l=i}}]);
|