Skip to content

Commit f196171

Browse files
authored
Merge pull request #940 from opencrvs/death-correction-action-config
correction action config for death added
2 parents 29bd601 + a964e26 commit f196171

File tree

5 files changed

+901
-3
lines changed

5 files changed

+901
-3
lines changed
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
import {
2+
and,
3+
ConditionalType,
4+
defineActionForm,
5+
field,
6+
FieldType,
7+
not,
8+
PageTypes
9+
} from '@opencrvs/toolkit/events'
10+
import { correctionFormRequesters } from './requester'
11+
import { deathcorrectionRequesterIdentityVerify } from './requester-identity-verify'
12+
13+
export const DEATH_CORRECTION_FORM = defineActionForm({
14+
label: {
15+
id: 'v2.event.death.action.correction.form.label',
16+
defaultMessage: 'Correct record',
17+
description: 'This is the label for the death correction form'
18+
},
19+
pages: [
20+
{
21+
id: 'details',
22+
type: PageTypes.enum.FORM,
23+
title: {
24+
id: 'v2.event.death.action.correction.form.section.details.title',
25+
defaultMessage: 'Correction details',
26+
description: 'This is the title of the section'
27+
},
28+
fields: [
29+
...correctionFormRequesters,
30+
{
31+
id: 'details.divider',
32+
type: FieldType.DIVIDER,
33+
label: {
34+
id: 'v2.event.death.action.correction.form.section.details.divider.label',
35+
defaultMessage: '',
36+
description: 'This is the title of the section'
37+
},
38+
conditionals: [
39+
{
40+
type: ConditionalType.SHOW,
41+
conditional: field('requester.type').isEqualTo('SOMEONE_ELSE')
42+
}
43+
]
44+
},
45+
{
46+
id: 'reason.option',
47+
type: FieldType.SELECT,
48+
required: true,
49+
label: {
50+
id: 'v2.event.death.action.correction.form.section.reason.title',
51+
defaultMessage: 'Reason for correction',
52+
description: 'This is the title of the section'
53+
},
54+
options: [
55+
{
56+
value: 'CLERICAL_ERROR',
57+
label: {
58+
defaultMessage:
59+
'Myself or an agent made a mistake (Clerical error)',
60+
description: 'Label for the clerical error option',
61+
id: 'v2.event.death.action.correction.reason.option.clericalError.label'
62+
}
63+
},
64+
{
65+
value: 'MATERIAL_ERROR',
66+
label: {
67+
defaultMessage:
68+
'Informant provided incorrect information (Material error)',
69+
description: 'Label for the material error option',
70+
id: 'v2.event.death.action.correction.reason.option.materialError.label'
71+
}
72+
},
73+
{
74+
value: 'MATERIAL_OMISSION',
75+
label: {
76+
defaultMessage:
77+
'Informant did not provide this information (Material omission)',
78+
description: 'Label for the material omission option',
79+
id: 'v2.event.death.action.correction.reason.option.materialOmission.label'
80+
}
81+
},
82+
{
83+
value: 'JUDICIAL_ORDER',
84+
label: {
85+
defaultMessage:
86+
'Requested to do so by the court (Judicial order)',
87+
description: 'Label for the judicial order option',
88+
id: 'v2.event.death.action.correction.reason.option.judicialOrder.label'
89+
}
90+
},
91+
{
92+
value: 'OTHER',
93+
label: {
94+
defaultMessage: 'Other',
95+
description: 'Label for the other option',
96+
id: 'v2.event.death.action.correction.reason.option.other.label'
97+
}
98+
}
99+
]
100+
},
101+
{
102+
id: 'reason.other',
103+
type: FieldType.TEXT,
104+
required: true,
105+
label: {
106+
defaultMessage: 'Specify reason',
107+
description: 'Label for the reason',
108+
id: 'v2.event.death.action.correction.reason.other.label'
109+
},
110+
conditionals: [
111+
{
112+
type: ConditionalType.SHOW,
113+
conditional: field('reason.option').isEqualTo('OTHER')
114+
}
115+
]
116+
}
117+
]
118+
},
119+
{
120+
id: 'requester.identity.verify',
121+
type: PageTypes.enum.VERIFICATION,
122+
title: {
123+
id: 'v2.event.death.action.correction.form.section.requester.identity.verify.title',
124+
defaultMessage: 'Verify ID',
125+
description: 'This is the title of the section'
126+
},
127+
conditional: and(
128+
not(field('requester.type').isEqualTo('ANOTHER_AGENT')),
129+
not(field('requester.type').isEqualTo('ME'))
130+
),
131+
fields: deathcorrectionRequesterIdentityVerify,
132+
actions: {
133+
verify: {
134+
label: {
135+
defaultMessage: 'Verified',
136+
description: 'This is the label for the verification button',
137+
id: 'v2.event.death.action.correction.form.verify'
138+
}
139+
},
140+
cancel: {
141+
label: {
142+
defaultMessage: 'Identity does not match',
143+
description:
144+
'This is the label for the verification cancellation button',
145+
id: 'v2.event.death.action.correction.form.cancel'
146+
},
147+
confirmation: {
148+
title: {
149+
defaultMessage: 'Correct without proof of ID?',
150+
description:
151+
'This is the title for the verification cancellation modal',
152+
id: 'v2.event.death.action.correction.form.cancel.confirmation.title'
153+
},
154+
body: {
155+
defaultMessage:
156+
'Please be aware that if you proceed, you will be responsible for making a change to this record without the necessary proof of identification',
157+
description:
158+
'This is the body for the verification cancellation modal',
159+
id: 'v2.event.death.action.correction.form.cancel.confirmation.body'
160+
}
161+
}
162+
}
163+
}
164+
},
165+
{
166+
id: 'documents',
167+
type: PageTypes.enum.FORM,
168+
title: {
169+
id: 'v2.event.death.action.correction.form.section.supporting-documents.title',
170+
defaultMessage: 'Upload supporting documents',
171+
description: 'This is the title of the section'
172+
},
173+
fields: [
174+
{
175+
id: 'documents.supportingDocs',
176+
type: FieldType.FILE_WITH_OPTIONS,
177+
// @TODO: this should be required, but currently the required functionality is not working correctly for these types of fields
178+
// required: true,
179+
label: {
180+
defaultMessage: 'Supporting documents',
181+
description: 'Label for the supporting documents field',
182+
id: 'v2.event.death.action.correction.documents.supportingDocs.label'
183+
},
184+
options: [
185+
{
186+
value: 'AFFIDAVIT',
187+
label: {
188+
defaultMessage: 'Affidavit',
189+
description: 'Label for the affidavit option',
190+
id: 'v2.event.death.action.correction.documents.supportingDocs.affidavit.label'
191+
}
192+
},
193+
{
194+
value: 'COURT_DOCUMENT',
195+
label: {
196+
defaultMessage: 'Court Document',
197+
description: 'Label for the court document option',
198+
id: 'v2.event.death.action.correction.documents.supportingDocs.courtDocument.label'
199+
}
200+
},
201+
{
202+
value: 'OTHER',
203+
label: {
204+
defaultMessage: 'Other',
205+
description: 'Label for the other option',
206+
id: 'v2.event.death.action.correction.documents.supportingDocs.other.label'
207+
}
208+
}
209+
]
210+
}
211+
]
212+
},
213+
{
214+
id: 'fees',
215+
type: PageTypes.enum.FORM,
216+
title: {
217+
id: 'v2.event.death.action.correction.form.section.fees.title',
218+
defaultMessage: 'Collect fees',
219+
description: 'This is the title of the section'
220+
},
221+
fields: [
222+
{
223+
id: 'fees.amount',
224+
type: FieldType.NUMBER,
225+
required: true,
226+
label: {
227+
defaultMessage: 'Fee total',
228+
description: 'Label for the amount field',
229+
id: 'v2.event.death.action.correction.fees.amount.label'
230+
},
231+
configuration: {
232+
min: 0,
233+
prefix: {
234+
defaultMessage: '$',
235+
description: 'Prefix for the amount field',
236+
id: 'v2.event.death.action.correction.fees.amount.prefix'
237+
}
238+
}
239+
}
240+
]
241+
}
242+
]
243+
})
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
*
6+
* OpenCRVS is also distributed under the terms of the Civil Registration
7+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
8+
*
9+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
10+
*/
11+
12+
import { conditionals } from '@countryconfig/form/common/custom-validation-conditionals/custom-conditionals'
13+
import {
14+
and,
15+
ConditionalType,
16+
field,
17+
FieldConfig,
18+
FieldType,
19+
not,
20+
or
21+
} from '@opencrvs/toolkit/events'
22+
23+
export const deathcorrectionRequesterIdentityVerify: FieldConfig[] = [
24+
{
25+
id: 'requester.identity.verify.data',
26+
type: FieldType.DATA,
27+
conditionals: [
28+
{
29+
type: ConditionalType.SHOW,
30+
conditional: or(
31+
field('requester.type').isEqualTo('SPOUSE'),
32+
and(
33+
field('requester.type').isEqualTo('INFORMANT'),
34+
field('informant.relation').isEqualTo('SPOUSE')
35+
)
36+
)
37+
}
38+
],
39+
label: {
40+
defaultMessage: '',
41+
description: 'Title for the data section',
42+
id: 'v2.event.death.action.correction.form.section.verifyIdentity.data.label'
43+
},
44+
configuration: {
45+
data: [
46+
{ fieldId: 'spouse.idType' },
47+
{ fieldId: 'spouse.nid' },
48+
{ fieldId: 'spouse.passport' },
49+
{ fieldId: 'spouse.brn' },
50+
{ fieldId: 'spouse.name' },
51+
{ fieldId: 'spouse.dob' },
52+
{ fieldId: 'spouse.nationality' }
53+
]
54+
}
55+
},
56+
{
57+
id: 'requester.identity.verify.data',
58+
type: FieldType.DATA,
59+
conditionals: [
60+
{
61+
type: ConditionalType.SHOW,
62+
conditional: and(
63+
field('requester.type').isEqualTo('INFORMANT'),
64+
not(field('informant.relation').isEqualTo('SPOUSE'))
65+
)
66+
}
67+
],
68+
label: {
69+
defaultMessage: '',
70+
description: 'Title for the data section',
71+
id: 'v2.event.death.action.correction.form.section.verifyIdentity.data.label'
72+
},
73+
configuration: {
74+
data: [
75+
{ fieldId: 'informant.idType' },
76+
{ fieldId: 'informant.nid' },
77+
{ fieldId: 'informant.passport' },
78+
{ fieldId: 'informant.brn' },
79+
{ fieldId: 'informant.name' },
80+
{ fieldId: 'informant.dob' },
81+
{ fieldId: 'informant.nationality' }
82+
]
83+
}
84+
}
85+
]

0 commit comments

Comments
 (0)