Skip to content

Commit 5949fcd

Browse files
Nil20Nil20
andauthored
Configure ISSUE_CERTIFIED_COPY custom action (#1180)
* feat: add printInAdvance option as collector in print flow * feat: add new action and workqueue configuration * chore: add missing translations --------- Co-authored-by: Nil20 <[email protected]>
2 parents b929533 + 91bf5cc commit 5949fcd

File tree

5 files changed

+162
-11
lines changed

5 files changed

+162
-11
lines changed

src/api/workqueue/workqueueConfig.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,32 @@ export const Workqueues = defineWorkqueues([
125125
description: 'Empty message for recent workqueue'
126126
}
127127
},
128+
{
129+
slug: 'pending-certification',
130+
icon: 'Printer',
131+
name: {
132+
id: 'workqueues.pendingCertification.title',
133+
defaultMessage: 'Pending Certification',
134+
description: 'Title of pending certification workqueue'
135+
},
136+
query: {
137+
flags: {
138+
anyOf: ['pending-certified-copy-issuance']
139+
},
140+
updatedAtLocation: { type: 'exact', term: user('primaryOfficeId') }
141+
},
142+
actions: [
143+
{
144+
type: 'DEFAULT',
145+
conditionals: []
146+
}
147+
],
148+
emptyMessage: {
149+
id: 'workqueues.pendingCertification.emptyMessage',
150+
defaultMessage: 'No pending certification records',
151+
description: 'Empty message for pending certification workqueue'
152+
}
153+
},
128154
{
129155
slug: 'requires-completion',
130156
icon: 'File',

src/data-seeding/roles/roles.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export const roles: Role[] = [
211211
'search[event=birth,access=all]',
212212
'search[event=death,access=all]',
213213
'search[event=tennis-club-membership,access=all]',
214-
'workqueue[id=assigned-to-you|recent|requires-completion|requires-updates-office|in-review-all|in-external-validation|ready-to-print|ready-to-issue]',
214+
'workqueue[id=assigned-to-you|recent|requires-completion|requires-updates-office|in-review-all|in-external-validation|ready-to-print|ready-to-issue|pending-certification]',
215215
'record.create[event=birth|death|tennis-club-membership]',
216216
'record.read[event=birth|death|tennis-club-membership]',
217217
'record.declare[event=birth|death|tennis-club-membership]',
@@ -221,7 +221,8 @@ export const roles: Role[] = [
221221
'record.register[event=birth|death|tennis-club-membership]',
222222
'record.registered.print-certified-copies[event=birth|death|tennis-club-membership]',
223223
'record.registered.correct[event=birth|death|tennis-club-membership]',
224-
'record.unassign-others[event=birth|death|tennis-club-membership]'
224+
'record.unassign-others[event=birth|death|tennis-club-membership]',
225+
'record.custom-action[event=birth,customActionType=ISSUE_CERTIFIED_COPY]'
225226
]
226227
},
227228
{

src/form/v2/birth/forms/printForm/collectors.ts

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,36 @@ const fatherMotherBothDoesNotExist = (informantType: InformantTypeKey) => {
6464
}
6565
}
6666

67+
const printInAdvanceOption = {
68+
label: {
69+
id: 'event.birth.action.certificate.form.section.requester.printInAdvance.label',
70+
defaultMessage: 'Print in advance of issuance',
71+
description: 'This is the label for the print-in-advance of issuance field'
72+
},
73+
value: 'PRINT_IN_ADVANCE'
74+
}
75+
6776
const getFieldConfigForInformant = (informantType: InformantTypeKey) => {
6877
return [
6978
{
7079
...commonConfigs,
7180
conditionals: [onlyMotherExist(informantType)],
72-
options: [getInformantOption(informantType), motherOption, otherOption]
81+
options: [
82+
getInformantOption(informantType),
83+
motherOption,
84+
otherOption,
85+
printInAdvanceOption
86+
]
7387
},
7488
{
7589
...commonConfigs,
7690
conditionals: [onlyFatherExist(informantType)],
77-
options: [getInformantOption(informantType), fatherOption, otherOption]
91+
options: [
92+
getInformantOption(informantType),
93+
fatherOption,
94+
otherOption,
95+
printInAdvanceOption
96+
]
7897
},
7998
{
8099
...commonConfigs,
@@ -83,13 +102,18 @@ const getFieldConfigForInformant = (informantType: InformantTypeKey) => {
83102
getInformantOption(informantType),
84103
fatherOption,
85104
motherOption,
86-
otherOption
105+
otherOption,
106+
printInAdvanceOption
87107
]
88108
},
89109
{
90110
...commonConfigs,
91111
conditionals: [fatherMotherBothDoesNotExist(informantType)],
92-
options: [getInformantOption(informantType), otherOption]
112+
options: [
113+
getInformantOption(informantType),
114+
otherOption,
115+
printInAdvanceOption
116+
]
93117
}
94118
]
95119
}
@@ -154,29 +178,39 @@ export const printCertificateCollectors: FieldConfig[] = [
154178
{
155179
...commonConfigs,
156180
conditionals: [onlyMotherExist(InformantType.MOTHER)],
157-
options: [getInformantOption(InformantType.MOTHER), otherOption]
181+
options: [
182+
getInformantOption(InformantType.MOTHER),
183+
otherOption,
184+
printInAdvanceOption
185+
]
158186
},
159187
{
160188
...commonConfigs,
161189
conditionals: [fatherMotherBothExist(InformantType.MOTHER)],
162190
options: [
163191
getInformantOption(InformantType.MOTHER),
164192
fatherOption,
165-
otherOption
193+
otherOption,
194+
printInAdvanceOption
166195
]
167196
},
168197
{
169198
...commonConfigs,
170199
conditionals: [onlyFatherExist(InformantType.FATHER)],
171-
options: [getInformantOption(InformantType.FATHER), otherOption]
200+
options: [
201+
getInformantOption(InformantType.FATHER),
202+
otherOption,
203+
printInAdvanceOption
204+
]
172205
},
173206
{
174207
...commonConfigs,
175208
conditionals: [fatherMotherBothExist(InformantType.FATHER)],
176209
options: [
177210
getInformantOption(InformantType.FATHER),
178211
motherOption,
179-
otherOption
212+
otherOption,
213+
printInAdvanceOption
180214
]
181215
},
182216
...getFieldConfigForInformant(InformantType.OTHER),

src/form/v2/birth/index.ts

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ import {
1414
ConditionalType,
1515
defineConfig,
1616
field,
17+
FieldType,
1718
flag,
1819
InherentFlags,
19-
not
20+
not,
21+
status
2022
} from '@opencrvs/toolkit/events'
2123
import {
2224
BIRTH_DECLARATION_FORM,
@@ -68,6 +70,15 @@ export const birthEvent = defineConfig({
6870
description: 'Flag label for validated'
6971
},
7072
requiresAction: true
73+
},
74+
{
75+
id: 'pending-certified-copy-issuance',
76+
label: {
77+
id: 'event.birth.flag.pending-certified-copy-issuance',
78+
defaultMessage: 'Pending certified copy issuance',
79+
description: 'Flag label for pending certified copy issuance'
80+
},
81+
requiresAction: true
7182
}
7283
],
7384
summary: {
@@ -278,6 +289,70 @@ export const birthEvent = defineConfig({
278289
id: 'event.birth.action.approve.confirmationText'
279290
}
280291
},
292+
{
293+
type: ActionType.CUSTOM,
294+
customActionType: 'ISSUE_CERTIFIED_COPY',
295+
icon: 'Handshake',
296+
label: {
297+
defaultMessage: 'Issue certified copy',
298+
description:
299+
'This is shown as the action name anywhere the user can trigger the action from',
300+
id: 'event.birth.action.issue-certified-copy.label'
301+
},
302+
form: [
303+
{
304+
id: 'collector',
305+
type: FieldType.SELECT,
306+
label: {
307+
defaultMessage: 'Collector',
308+
description: 'Label for collector field',
309+
id: 'event.birth.custom.action.approve.field.collector.label'
310+
},
311+
required: true,
312+
options: [
313+
{
314+
label: {
315+
defaultMessage: 'Mother',
316+
id: 'form.field.label.app.whoContDet.mother',
317+
description: 'Label for mother'
318+
},
319+
value: 'MOTHER'
320+
},
321+
{
322+
label: {
323+
defaultMessage: 'Father',
324+
id: 'form.field.label.informantRelation.father',
325+
description: 'Label for father'
326+
},
327+
value: 'FATHER'
328+
},
329+
{
330+
label: {
331+
defaultMessage: 'Someone else',
332+
id: 'form.field.label.informantRelation.others',
333+
description: 'Label for someone else'
334+
},
335+
value: 'SOMEONE_ELSE'
336+
}
337+
]
338+
}
339+
],
340+
flags: [{ id: 'pending-certified-copy-issuance', operation: 'remove' }],
341+
conditionals: [
342+
{
343+
type: ConditionalType.SHOW,
344+
conditional: and(
345+
flag('pending-certified-copy-issuance'),
346+
status('REGISTERED')
347+
)
348+
}
349+
],
350+
auditHistoryLabel: {
351+
defaultMessage: 'Issued',
352+
description: 'The label to show in audit history for the issued action',
353+
id: 'event.birth.action.issued.audit-history-label'
354+
}
355+
},
281356
{
282357
type: ActionType.VALIDATE,
283358
label: {
@@ -348,6 +423,15 @@ export const birthEvent = defineConfig({
348423
'This is shown as the action name anywhere the user can trigger the action from',
349424
id: 'event.birth.action.collect-certificate.label'
350425
},
426+
flags: [
427+
{
428+
id: 'pending-certified-copy-issuance',
429+
operation: 'add',
430+
conditional: field('collector.requesterId').isEqualTo(
431+
'PRINT_IN_ADVANCE'
432+
)
433+
}
434+
],
351435
printForm: BIRTH_CERTIFICATE_COLLECTOR_FORM
352436
},
353437
{

src/translations/client.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,12 @@ event.death.action.form.section.brn.label,Field for entering Birth Registration
10171017
event.death.action.form.section.collector.other.field.name.label,This is the label for the name field of OTHER collector,Collector's name,Nom du collecteur
10181018
event.death.action.form.section.drivingLicenseDetails.label,Field for entering Driving License details,Drivers License,Permis de conduire
10191019
event.death.action.form.section.idNumberOther.label,Field for entering ID Number if Other is selected,ID Number,Numéro d'identité
1020+
workqueues.pendingCertification.title,Title of pending certification workqueue,Pending Certification,En attente de certification
1021+
workqueues.pendingCertification.emptyMessage,Empty message for pending certification workqueue,No pending certification records,Aucun dossier de certification en attente
1022+
event.birth.action.certificate.form.section.requester.printInAdvance.label,This is the label for the print-in-advance of issuance field,Print in advance of issuance,Imprimer avant la délivrance
1023+
event.birth.flag.pending-certified-copy-issuance,Flag label for pending certified copy issuance,Pending certified copy issuance,En attente de la délivrance d'une copie certifiée conforme
1024+
event.birth.custom.action.approve.field.collector.label,Label for collector field,Collector,le collectionneur
1025+
event.birth.action.issued.audit-history-label,The label to show in audit history for the issued action,Issued,Émis
10201026
event.death.action.form.section.idType.alienNumber.label,Option for selecting Alien Number as the ID type,Alien Number,Numéro d'étranger
10211027
event.death.action.form.section.idType.brn.label,Option for selecting Birth Registration Number as the ID type,Birth Registration Number,Numéro d'enregistrement de naissance
10221028
event.death.action.form.section.idType.drivingLicense.label,Option for selecting Driving License as the ID type,Drivers License,Permis de conduire

0 commit comments

Comments
 (0)