@@ -4,16 +4,18 @@ import { type ClientRegistryPatient, type RegistryPatient } from './verification
4
4
import counties from './assets/counties.json' ;
5
5
import { type FormValues } from '../patient-registration/patient-registration.types' ;
6
6
import { capitalize } from 'lodash-es' ;
7
+ import { IdentifierInput } from '../patient-registration/input/custom-input/identifier/identifier-input.component' ;
7
8
8
9
export function handleClientRegistryResponse (
9
10
clientResponse : ClientRegistryPatient ,
10
11
props : FormikProps < FormValues > ,
11
12
searchTerm : string ,
13
+ identifierType : string ,
12
14
) {
13
15
if ( clientResponse ?. clientExists === false ) {
14
- const nupiIdentifiers = {
15
- [ 'nationalId ' ] : {
16
- initialValue : searchTerm ,
16
+ const allNupiIdentifiers = {
17
+ [ 'national-id ' ] : {
18
+ initialValue : '' ,
17
19
identifierUuid : undefined ,
18
20
selectedSource : { uuid : '' , name : '' } ,
19
21
preferred : false ,
@@ -22,7 +24,35 @@ export function handleClientRegistryResponse(
22
24
identifierName : 'National ID' ,
23
25
identifierValue : searchTerm ,
24
26
} ,
27
+
28
+ [ 'birth-certificate' ] : {
29
+ initialValue : '' ,
30
+ identifierUuid : undefined ,
31
+ selectedSource : { uuid : '' , name : '' } ,
32
+ preferred : false ,
33
+ required : false ,
34
+ identifierTypeUuid : '68449e5a-8829-44dd-bfef-c9c8cf2cb9b2' ,
35
+ identifierName : 'Birth Certificate Number' ,
36
+ identifierValue : searchTerm ,
37
+ } ,
38
+
39
+ [ 'passport' ] : {
40
+ initialValue : '' ,
41
+ identifierUuid : undefined ,
42
+ selectedSource : { uuid : '' , name : '' } ,
43
+ preferred : false ,
44
+ required : false ,
45
+ identifierTypeUuid : 'be9beef6-aacc-4e1f-ac4e-5babeaa1e303' ,
46
+ identifierName : 'Passport Number' ,
47
+ identifierValue : searchTerm ,
48
+ } ,
25
49
} ;
50
+
51
+ // Select only the relevant identifier
52
+ const nupiIdentifiers = {
53
+ [ identifierType ] : allNupiIdentifiers [ identifierType ] ,
54
+ } ;
55
+
26
56
const dispose = showModal ( 'empty-client-registry-modal' , {
27
57
onConfirm : ( ) => {
28
58
props . setValues ( { ...props . values , identifiers : { ...props . values . identifiers , ...nupiIdentifiers } } ) ;
0 commit comments