@ampath/esm-dha-workflow-app 4.0.0-next.30 → 4.0.0-next.32

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.
@@ -60,13 +60,17 @@ const RegistryComponent: React.FC<RegistryComponentProps> = () => {
60
60
  const result = await fetchClientRegistryData(payload);
61
61
  const patients = Array.isArray(result) ? result : [];
62
62
 
63
- if (patients.length === 0) throw new Error('No matching patient found in Client Registry.');
63
+ if (patients.length === 0) {
64
+ handleCancel();
65
+ throw new Error('No matching patient found in Client Registry.');
66
+ }
64
67
 
65
68
  const patient = patients[0];
66
69
  setPrincipal(patient);
67
70
  showAlert('success', 'Client Data Loaded', 'Patient fetched successfully');
68
71
  } catch (err: any) {
69
72
  const errorMessage = err.message || 'Failed to fetch client data';
73
+ handleCancel();
70
74
  showAlert('error', 'Fetch Failed', errorMessage);
71
75
  } finally {
72
76
  setLoading(false);
@@ -160,9 +164,14 @@ const RegistryComponent: React.FC<RegistryComponentProps> = () => {
160
164
  }
161
165
  }
162
166
  };
163
- const createAmrsPatient = async (client: HieClient) => {
167
+ const createAmrsPatient = async () => {
168
+ const patient = getPatient();
169
+ if (!patient) {
170
+ showAlert('error', 'Principal or dependant not selected', '');
171
+ return;
172
+ }
164
173
  try {
165
- const resp = await registerHieClientInAmrs(selectedDependant, locationUuid);
174
+ const resp = await registerHieClientInAmrs(patient, locationUuid);
166
175
  if (resp) {
167
176
  showAlert('success', 'Patient created succesfully', '');
168
177
  setAmrsPatients([resp]);
@@ -188,11 +197,15 @@ const RegistryComponent: React.FC<RegistryComponentProps> = () => {
188
197
  setDisplayClientDetailsModal(false);
189
198
  setDisplayOtpModal(false);
190
199
  setDisplaytriageModal(false);
200
+ setSelectedPatient('principal');
191
201
  };
192
202
  const handleOtpSuccessfullVerification = () => {
193
203
  setDisplayOtpModal(false);
194
204
  setDisplayClientDetailsModal(true);
195
205
  };
206
+ const registerOnAfyaYangu = () => {
207
+ window.open('https://afyayangu.go.ke/', '_blank');
208
+ };
196
209
  return (
197
210
  <>
198
211
  <div className={styles.registryLayout}>
@@ -238,6 +251,9 @@ const RegistryComponent: React.FC<RegistryComponentProps> = () => {
238
251
  <Button className={styles.registrySearchBtn} kind="secondary" onClick={handleEmergencyRegistration}>
239
252
  Emergency Registration
240
253
  </Button>
254
+ <Button className={styles.registrySearchBtn} kind="tertiary" onClick={registerOnAfyaYangu}>
255
+ Register on Afya Yangu
256
+ </Button>
241
257
  </div>
242
258
  </div>
243
259
  </div>
@@ -69,10 +69,6 @@ export const navLinksConfig = [
69
69
  to: 'reports',
70
70
  title: 'Reports',
71
71
  },
72
- {
73
- to: 'bookings',
74
- title: 'Bookings',
75
- },
76
72
  {
77
73
  to: 'bookings',
78
74
  title: 'Bookings',
@@ -1,627 +0,0 @@
1
- export const hieClientRespData = [
2
- {
3
- resourceType: 'Patient',
4
- id: 'CR4098636401452-9',
5
- meta: {
6
- versionId: '1',
7
- creationTime: '2025-06-09 11:19:36.963921',
8
- lastUpdated: '2025-09-15 13:12:55.583802',
9
- source: 'http://cr-nrb.tiberbu.health',
10
- },
11
- originSystem: {
12
- system: 'SAFARICOM-CONSORTIUM-SANDBOX',
13
- record_id: '',
14
- },
15
- title: 'Mr',
16
- first_name: 'Christian',
17
- middle_name: 'Harris',
18
- last_name: 'Gray',
19
- gender: 'Female',
20
- date_of_birth: '1980-06-20',
21
- place_of_birth: 'NAIROBI',
22
- person_with_disability: 0,
23
- citizenship: 'KENYAN',
24
- kra_pin: 'A078188991V',
25
- preferred_primary_care_network: '071200000000',
26
- employment_type: 'Self-Employed',
27
- domestic_worker_type: '',
28
- civil_status: 'Divorced',
29
- identification_type: 'National ID',
30
- identification_number: '10101010',
31
- other_identifications: [
32
- {
33
- identification_number: 'SHA4098636401452-9',
34
- identification_type: 'SHA Number',
35
- },
36
- {
37
- identification_number: 'HH4098636401452-9',
38
- identification_type: 'Household Number',
39
- },
40
- ],
41
- dependants: [
42
- {
43
- date_added: '2025-06-09 11:19:36.963921',
44
- relationship: 'Child',
45
- total: 1,
46
- result: [
47
- {
48
- resourceType: 'Patient',
49
- id: 'CR0300484544546-3',
50
- meta: {
51
- versionId: '1',
52
- creationTime: '2025-07-29 10:09:49.525561',
53
- lastUpdated: '2025-07-29 10:09:49.525561',
54
- source: 'http://cr-nrb.tiberbu.health',
55
- },
56
- originSystem: {
57
- system: 'AFYANGU-00030',
58
- record_id: '',
59
- },
60
- title: '',
61
- first_name: 'hilda',
62
- middle_name: 'test',
63
- last_name: 'jmeter',
64
- gender: 'Male',
65
- date_of_birth: '2025-07-02',
66
- place_of_birth: '',
67
- person_with_disability: 0,
68
- citizenship: '',
69
- kra_pin: '',
70
- preferred_primary_care_network: '',
71
- employment_type: '',
72
- domestic_worker_type: '',
73
- civil_status: '',
74
- identification_type: 'Temporary Dependant ID',
75
- identification_number: 'CR4098636401452-9-2',
76
- other_identifications: [
77
- {
78
- identification_number: 'SHA0300484544546-3',
79
- identification_type: 'SHA Number',
80
- },
81
- {
82
- identification_number: 'CR4098636401452-9',
83
- identification_type: 'Household Number',
84
- },
85
- ],
86
- dependants: [],
87
- is_alive: 1,
88
- deceased_datetime: '',
89
- phone: '',
90
- biometrics_verified: 0,
91
- biometrics_score: 0,
92
- email: '',
93
- country: '',
94
- county: 'NAIROBI',
95
- sub_county: 'STAREHE',
96
- ward: 'STAREHE',
97
- village_estate: '',
98
- building_house_no: '',
99
- latitude: '',
100
- longitude: '',
101
- province_state_country: '',
102
- zip_code: '',
103
- identification_residence: '',
104
- employer_name: '',
105
- employer_pin: '',
106
- disability_category: '',
107
- disability_subcategory: '',
108
- disability_cause: '',
109
- in_lawful_custody: '',
110
- admission_remand_number: '',
111
- document_uploads: [],
112
- alternative_contacts: [],
113
- gross_income: 0,
114
- gross_income_currency: '',
115
- postal_address: '',
116
- estimated_contribution: 0,
117
- estimated_annual_contribution: 0,
118
- city: '',
119
- id_serial: '',
120
- learning_institution_code: '',
121
- learning_institution_name: '',
122
- grade_level: '',
123
- admission_number: '',
124
- expected_year_of_graduation: '',
125
- unconfirmed_dependants: [],
126
- is_agent: 0,
127
- agent_id: '',
128
- },
129
- ],
130
- },
131
- {
132
- date_added: '2025-06-09 11:19:36.963921',
133
- relationship: 'Child',
134
- total: 1,
135
- result: [
136
- {
137
- resourceType: 'Patient',
138
- id: 'CR4677672274543-3',
139
- meta: {
140
- versionId: '1',
141
- creationTime: '2025-08-19 10:17:36.978231',
142
- lastUpdated: '2025-08-19 10:17:36.978231',
143
- source: 'http://cr-nrb.tiberbu.health',
144
- },
145
- originSystem: {
146
- system: 'AFYANGU-00030',
147
- record_id: '',
148
- },
149
- title: '',
150
- first_name: 'filda',
151
- middle_name: 'test',
152
- last_name: 'jmeter2',
153
- gender: 'Male',
154
- date_of_birth: '2025-07-02',
155
- place_of_birth: '',
156
- person_with_disability: 0,
157
- citizenship: '',
158
- kra_pin: '',
159
- preferred_primary_care_network: '',
160
- employment_type: '',
161
- domestic_worker_type: '',
162
- civil_status: '',
163
- identification_type: 'Temporary Dependant ID',
164
- identification_number: 'CR4098636401452-9-6',
165
- other_identifications: [
166
- {
167
- identification_number: 'SHA4677672274543-3',
168
- identification_type: 'SHA Number',
169
- },
170
- {
171
- identification_number: 'CR4098636401452-9',
172
- identification_type: 'Household Number',
173
- },
174
- ],
175
- dependants: [],
176
- is_alive: 1,
177
- deceased_datetime: '',
178
- phone: '',
179
- biometrics_verified: 0,
180
- biometrics_score: 0,
181
- email: '',
182
- country: '',
183
- county: 'NAIROBI',
184
- sub_county: 'STAREHE',
185
- ward: 'STAREHE',
186
- village_estate: '',
187
- building_house_no: '',
188
- latitude: '',
189
- longitude: '',
190
- province_state_country: '',
191
- zip_code: '',
192
- identification_residence: '',
193
- employer_name: '',
194
- employer_pin: '',
195
- disability_category: '',
196
- disability_subcategory: '',
197
- disability_cause: '',
198
- in_lawful_custody: '',
199
- admission_remand_number: '',
200
- document_uploads: [],
201
- alternative_contacts: [],
202
- gross_income: 0,
203
- gross_income_currency: '',
204
- postal_address: '',
205
- estimated_contribution: 0,
206
- estimated_annual_contribution: 0,
207
- city: '',
208
- id_serial: '',
209
- learning_institution_code: '',
210
- learning_institution_name: '',
211
- grade_level: '',
212
- admission_number: '',
213
- expected_year_of_graduation: '',
214
- unconfirmed_dependants: [],
215
- is_agent: 0,
216
- agent_id: '',
217
- },
218
- ],
219
- },
220
- {
221
- date_added: '2025-06-09 11:19:36.963921',
222
- relationship: 'Child',
223
- total: 1,
224
- result: [
225
- {
226
- resourceType: 'Patient',
227
- id: 'CR7417999270872-5',
228
- meta: {
229
- versionId: '1',
230
- creationTime: '2025-09-08 14:49:27.524867',
231
- lastUpdated: '2025-09-08 14:50:37.287849',
232
- source: 'http://cr-nrb.tiberbu.health',
233
- },
234
- originSystem: {
235
- system: 'AFYANGU-00030',
236
- record_id: '',
237
- },
238
- title: '',
239
- first_name: 'OWENS',
240
- middle_name: 'CHILD',
241
- last_name: 'KEVIN',
242
- gender: 'Male',
243
- date_of_birth: '2025-09-02',
244
- place_of_birth: '',
245
- person_with_disability: 0,
246
- citizenship: '',
247
- kra_pin: '',
248
- preferred_primary_care_network: '',
249
- employment_type: '',
250
- domestic_worker_type: '',
251
- civil_status: '',
252
- identification_type: 'Birth Certificate',
253
- identification_number: '258085',
254
- other_identifications: [
255
- {
256
- identification_number: 'SHA7417999270872-5',
257
- identification_type: 'SHA Number',
258
- },
259
- {
260
- identification_number: 'CR4098636401452-9',
261
- identification_type: 'Household Number',
262
- },
263
- ],
264
- dependants: [],
265
- is_alive: 1,
266
- deceased_datetime: '',
267
- phone: '',
268
- biometrics_verified: 0,
269
- biometrics_score: 0,
270
- email: '',
271
- country: '',
272
- county: 'NAIROBI',
273
- sub_county: 'starehe',
274
- ward: 'STAREHE',
275
- village_estate: '',
276
- building_house_no: '',
277
- latitude: '',
278
- longitude: '',
279
- province_state_country: '',
280
- zip_code: '',
281
- identification_residence: '',
282
- employer_name: '',
283
- employer_pin: '',
284
- disability_category: '',
285
- disability_subcategory: '',
286
- disability_cause: '',
287
- in_lawful_custody: '',
288
- admission_remand_number: '',
289
- document_uploads: [],
290
- alternative_contacts: [],
291
- gross_income: 0,
292
- gross_income_currency: '',
293
- postal_address: '',
294
- estimated_contribution: 0,
295
- estimated_annual_contribution: 0,
296
- city: '',
297
- id_serial: '',
298
- learning_institution_code: '',
299
- learning_institution_name: '',
300
- grade_level: '',
301
- admission_number: '',
302
- expected_year_of_graduation: '',
303
- unconfirmed_dependants: [],
304
- is_agent: 0,
305
- agent_id: '',
306
- },
307
- ],
308
- },
309
- {
310
- date_added: '2025-06-09 11:19:36.963921',
311
- relationship: 'Child',
312
- total: 1,
313
- result: [
314
- {
315
- resourceType: 'Patient',
316
- id: 'CR6558518554239-3',
317
- meta: {
318
- versionId: '1',
319
- creationTime: '2025-09-08 14:53:00.542412',
320
- lastUpdated: '2025-09-08 14:53:11.055787',
321
- source: 'http://cr-nrb.tiberbu.health',
322
- },
323
- originSystem: {
324
- system: 'AFYANGU-00030',
325
- record_id: '',
326
- },
327
- title: '',
328
- first_name: 'OWENS',
329
- middle_name: 'HONH',
330
- last_name: 'ALI',
331
- gender: 'Male',
332
- date_of_birth: '2025-09-03',
333
- place_of_birth: '',
334
- person_with_disability: 0,
335
- citizenship: '',
336
- kra_pin: '',
337
- preferred_primary_care_network: '',
338
- employment_type: '',
339
- domestic_worker_type: '',
340
- civil_status: '',
341
- identification_type: 'Birth Certificate',
342
- identification_number: '8588',
343
- other_identifications: [
344
- {
345
- identification_number: 'SHA6558518554239-3',
346
- identification_type: 'SHA Number',
347
- },
348
- {
349
- identification_number: 'CR4098636401452-9',
350
- identification_type: 'Household Number',
351
- },
352
- ],
353
- dependants: [],
354
- is_alive: 1,
355
- deceased_datetime: '',
356
- phone: '',
357
- biometrics_verified: 0,
358
- biometrics_score: 0,
359
- email: '',
360
- country: '',
361
- county: 'NAIROBI',
362
- sub_county: 'starehe',
363
- ward: 'STAREHE',
364
- village_estate: '',
365
- building_house_no: '',
366
- latitude: '',
367
- longitude: '',
368
- province_state_country: '',
369
- zip_code: '',
370
- identification_residence: '',
371
- employer_name: '',
372
- employer_pin: '',
373
- disability_category: '',
374
- disability_subcategory: '',
375
- disability_cause: '',
376
- in_lawful_custody: '',
377
- admission_remand_number: '',
378
- document_uploads: [],
379
- alternative_contacts: [],
380
- gross_income: 0,
381
- gross_income_currency: '',
382
- postal_address: '',
383
- estimated_contribution: 0,
384
- estimated_annual_contribution: 0,
385
- city: '',
386
- id_serial: '',
387
- learning_institution_code: '',
388
- learning_institution_name: '',
389
- grade_level: '',
390
- admission_number: '',
391
- expected_year_of_graduation: '',
392
- unconfirmed_dependants: [],
393
- is_agent: 0,
394
- agent_id: '',
395
- },
396
- ],
397
- },
398
- {
399
- date_added: '2025-06-09 11:19:36.963921',
400
- relationship: 'Child',
401
- total: 1,
402
- result: [
403
- {
404
- resourceType: 'Patient',
405
- id: 'CR4195287270587-4',
406
- meta: {
407
- versionId: '1',
408
- creationTime: '2025-09-08 15:06:17.067875',
409
- lastUpdated: '2025-09-08 15:06:17.067875',
410
- source: 'http://cr-nrb.tiberbu.health',
411
- },
412
- originSystem: {
413
- system: 'AFYANGU-00030',
414
- record_id: '',
415
- },
416
- title: '',
417
- first_name: 'DURAN',
418
- middle_name: 'OWEN',
419
- last_name: 'JOHN',
420
- gender: 'Male',
421
- date_of_birth: '2025-09-08',
422
- place_of_birth: '',
423
- person_with_disability: 0,
424
- citizenship: '',
425
- kra_pin: '',
426
- preferred_primary_care_network: '',
427
- employment_type: '',
428
- domestic_worker_type: '',
429
- civil_status: '',
430
- identification_type: 'Birth Certificate',
431
- identification_number: '45546595948',
432
- other_identifications: [
433
- {
434
- identification_number: 'SHA4195287270587-4',
435
- identification_type: 'SHA Number',
436
- },
437
- {
438
- identification_number: 'CR4098636401452-9',
439
- identification_type: 'Household Number',
440
- },
441
- ],
442
- dependants: [],
443
- is_alive: 1,
444
- deceased_datetime: '',
445
- phone: '',
446
- biometrics_verified: 0,
447
- biometrics_score: 0,
448
- email: '',
449
- country: '',
450
- county: 'NAIROBI',
451
- sub_county: 'starehe',
452
- ward: 'STAREHE',
453
- village_estate: '',
454
- building_house_no: '',
455
- latitude: '',
456
- longitude: '',
457
- province_state_country: '',
458
- zip_code: '',
459
- identification_residence: '',
460
- employer_name: '',
461
- employer_pin: '',
462
- disability_category: '',
463
- disability_subcategory: '',
464
- disability_cause: '',
465
- in_lawful_custody: '',
466
- admission_remand_number: '',
467
- document_uploads: [],
468
- alternative_contacts: [],
469
- gross_income: 0,
470
- gross_income_currency: '',
471
- postal_address: '',
472
- estimated_contribution: 0,
473
- estimated_annual_contribution: 0,
474
- city: '',
475
- id_serial: '',
476
- learning_institution_code: '',
477
- learning_institution_name: '',
478
- grade_level: '',
479
- admission_number: '',
480
- expected_year_of_graduation: '',
481
- unconfirmed_dependants: [],
482
- is_agent: 0,
483
- agent_id: '',
484
- },
485
- ],
486
- },
487
- {
488
- date_added: '2025-06-09 11:19:36.963921',
489
- relationship: 'Child',
490
- total: 1,
491
- result: [
492
- {
493
- resourceType: 'Patient',
494
- id: 'CR2704482932736-2',
495
- meta: {
496
- versionId: '1',
497
- creationTime: '2025-09-09 11:46:36.825641',
498
- lastUpdated: '2025-09-09 11:46:36.825641',
499
- source: 'http://cr-nrb.tiberbu.health',
500
- },
501
- originSystem: {
502
- system: 'AFYANGU-00030',
503
- record_id: '',
504
- },
505
- title: '',
506
- first_name: 'CHRIS',
507
- middle_name: 'RONALDO',
508
- last_name: 'KEVIN',
509
- gender: 'Male',
510
- date_of_birth: '2025-09-02',
511
- place_of_birth: '',
512
- person_with_disability: 0,
513
- citizenship: '',
514
- kra_pin: '',
515
- preferred_primary_care_network: '',
516
- employment_type: '',
517
- domestic_worker_type: '',
518
- civil_status: '',
519
- identification_type: 'Birth Certificate',
520
- identification_number: '454545',
521
- other_identifications: [
522
- {
523
- identification_number: 'SHA2704482932736-2',
524
- identification_type: 'SHA Number',
525
- },
526
- {
527
- identification_number: 'CR4098636401452-9',
528
- identification_type: 'Household Number',
529
- },
530
- ],
531
- dependants: [],
532
- is_alive: 1,
533
- deceased_datetime: '',
534
- phone: '',
535
- biometrics_verified: 0,
536
- biometrics_score: 0,
537
- email: '',
538
- country: '',
539
- county: 'NAIROBI',
540
- sub_county: 'starehe',
541
- ward: 'STAREHE',
542
- village_estate: '',
543
- building_house_no: '',
544
- latitude: '',
545
- longitude: '',
546
- province_state_country: '',
547
- zip_code: '',
548
- identification_residence: '',
549
- employer_name: '',
550
- employer_pin: '',
551
- disability_category: '',
552
- disability_subcategory: '',
553
- disability_cause: '',
554
- in_lawful_custody: '',
555
- admission_remand_number: '',
556
- document_uploads: [],
557
- alternative_contacts: [],
558
- gross_income: 0,
559
- gross_income_currency: '',
560
- postal_address: '',
561
- estimated_contribution: 0,
562
- estimated_annual_contribution: 0,
563
- city: '',
564
- id_serial: '',
565
- learning_institution_code: '',
566
- learning_institution_name: '',
567
- grade_level: '',
568
- admission_number: '',
569
- expected_year_of_graduation: '',
570
- unconfirmed_dependants: [],
571
- is_agent: 0,
572
- agent_id: '',
573
- },
574
- ],
575
- },
576
- ],
577
- is_alive: 1,
578
- deceased_datetime: '',
579
- phone: '070003281486',
580
- biometrics_verified: 0,
581
- biometrics_score: 0,
582
- email: 'akim@coolpeeps.com',
583
- country: 'KENYA',
584
- county: 'NAIROBI',
585
- sub_county: 'starehe',
586
- ward: 'STAREHE',
587
- village_estate: 'KARIOKOR',
588
- building_house_no: 'HSE56',
589
- latitude: '',
590
- longitude: '',
591
- province_state_country: '',
592
- zip_code: '',
593
- identification_residence: '',
594
- employer_name: 'KNS',
595
- employer_pin: 'KN509990881',
596
- disability_category: '',
597
- disability_subcategory: '',
598
- disability_cause: '',
599
- in_lawful_custody: '',
600
- admission_remand_number: '',
601
- document_uploads: [],
602
- alternative_contacts: [
603
- {
604
- contact_type: 'Phone',
605
- contact_id: '+254010101010',
606
- contact_name: 'HASSAN-TEST-WEB',
607
- relationship: 'Father',
608
- remarks: 'Next Of Kin',
609
- },
610
- ],
611
- gross_income: 300000,
612
- gross_income_currency: 'KES',
613
- postal_address: '',
614
- estimated_contribution: 0,
615
- estimated_annual_contribution: 0,
616
- city: '',
617
- id_serial: '',
618
- learning_institution_code: '',
619
- learning_institution_name: '',
620
- grade_level: '',
621
- admission_number: '',
622
- expected_year_of_graduation: '',
623
- unconfirmed_dependants: [],
624
- is_agent: 0,
625
- agent_id: '',
626
- },
627
- ];