Skip to content

Commit 709215b

Browse files
authored
Merge pull request #1181 from opencrvs/ocrvs-11271
feat: add escalate custom action
2 parents f08389c + 3e414fa commit 709215b

File tree

6 files changed

+238
-10
lines changed

6 files changed

+238
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"@hapi/boom": "^9.1.1",
6565
"@hapi/hapi": "^20.0.1",
6666
"@hapi/inert": "^6.0.3",
67-
"@opencrvs/toolkit": "1.9.2-rc.5ad83cd",
67+
"@opencrvs/toolkit": "1.9.2-rc.1191623",
6868
"@types/chalk": "^2.2.0",
6969
"@types/csv2json": "^1.4.0",
7070
"@types/fhir": "^0.0.30",

src/api/workqueue/workqueueConfig.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,47 @@ export const Workqueues = defineWorkqueues([
178178
description: 'Empty message for notifications workqueue'
179179
}
180180
},
181+
{
182+
slug: 'pending-feedback-registrar-general',
183+
icon: 'ChatText',
184+
name: {
185+
id: 'workqueues.reviewRequested.title',
186+
defaultMessage: 'Review requested',
187+
description: 'Title of review requested workqueue'
188+
},
189+
query: {
190+
flags: {
191+
anyOf: ['escalated-to-registrar-general']
192+
}
193+
},
194+
actions: [
195+
{
196+
type: 'DEFAULT',
197+
conditionals: []
198+
}
199+
]
200+
},
201+
{
202+
slug: 'pending-feedback-provincinal-registrar',
203+
icon: 'ChatText',
204+
name: {
205+
id: 'workqueues.reviewRequested.title',
206+
defaultMessage: 'Review requested',
207+
description: 'Title of review requested workqueue'
208+
},
209+
query: {
210+
flags: {
211+
anyOf: ['escalated-to-provincial-registrar']
212+
},
213+
updatedAtLocation: { type: 'exact', term: user('primaryOfficeId') }
214+
},
215+
actions: [
216+
{
217+
type: 'DEFAULT',
218+
conditionals: []
219+
}
220+
]
221+
},
181222
{
182223
slug: 'sent-for-review',
183224
icon: 'FileSearch',

src/data-seeding/roles/roles.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export const roles: Role[] = [
222222
'record.registered.print-certified-copies[event=birth|death|tennis-club-membership]',
223223
'record.registered.correct[event=birth|death|tennis-club-membership]',
224224
'record.unassign-others[event=birth|death|tennis-club-membership]',
225-
'record.custom-action[event=birth,customActionType=ISSUE_CERTIFIED_COPY]'
225+
'record.custom-action[event=birth,customActionType=ESCALATE|ISSUE_CERTIFIED_COPY]'
226226
]
227227
},
228228
{
@@ -314,7 +314,7 @@ export const roles: Role[] = [
314314
'search[event=birth,access=all]',
315315
'search[event=death,access=all]',
316316
'search[event=tennis-club-membership,access=all]',
317-
'workqueue[id=assigned-to-you|recent|requires-completion|requires-updates-office|in-review-all|in-external-validation|ready-to-print|ready-to-issue]',
317+
'workqueue[id=assigned-to-you|recent|requires-completion|requires-updates-office|in-review-all|in-external-validation|ready-to-print|ready-to-issue|pending-feedback-registrar-general]',
318318
'record.create[event=birth|death|tennis-club-membership]',
319319
'record.read[event=birth|death|tennis-club-membership]',
320320
'record.declare[event=birth|death|tennis-club-membership]',
@@ -324,6 +324,7 @@ export const roles: Role[] = [
324324
'record.register[event=birth|death|tennis-club-membership]',
325325
'record.registered.print-certified-copies[event=birth|death|tennis-club-membership]',
326326
'record.registered.correct[event=birth|death|tennis-club-membership]',
327+
'record.custom-action[event=birth,customActionType=REGISTRAR_GENERAL_FEEDBACK]',
327328
'record.unassign-others[event=birth|death|tennis-club-membership]'
328329
]
329330
},
@@ -336,8 +337,8 @@ export const roles: Role[] = [
336337
},
337338
scopes: [
338339
'record.read[event=birth|death|tennis-club-membership]',
339-
'record.custom-action[event=birth,customActionType=APPROVE_DECLARATION]',
340-
'workqueue[id=late-registration-approval-required|recent]',
340+
'record.custom-action[event=birth,customActionType=APPROVE_DECLARATION|PROVINCIAL_REGISTER_FEEDBACK]',
341+
'workqueue[id=late-registration-approval-required|recent|pending-feedback-provincinal-registrar]',
341342
'search[event=birth,access=all]',
342343
'record.unassign-others[event=birth]'
343344
]

src/form/v2/birth/index.ts

Lines changed: 184 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {
1818
flag,
1919
InherentFlags,
2020
not,
21-
status
21+
status,
22+
or
2223
} from '@opencrvs/toolkit/events'
2324
import {
2425
BIRTH_DECLARATION_FORM,
@@ -62,6 +63,24 @@ export const birthEvent = defineConfig({
6263
},
6364
requiresAction: true
6465
},
66+
{
67+
id: 'escalated-to-provincial-registrar',
68+
label: {
69+
id: 'event.birth.flag.escalated-to-provincial-registrar',
70+
defaultMessage: 'Escalated to Provincial Registrar',
71+
description: 'Flag label for escalated to provincial registrar'
72+
},
73+
requiresAction: true
74+
},
75+
{
76+
id: 'escalated-to-registrar-general',
77+
label: {
78+
id: 'event.birth.flag.escalated-to-registrar-general',
79+
defaultMessage: 'Escalated to Registrar General',
80+
description: 'Flag label for escalated to registrar general'
81+
},
82+
requiresAction: true
83+
},
6584
{
6685
id: 'validated',
6786
label: {
@@ -353,6 +372,170 @@ export const birthEvent = defineConfig({
353372
id: 'event.birth.action.issued.audit-history-label'
354373
}
355374
},
375+
{
376+
type: ActionType.CUSTOM,
377+
customActionType: 'ESCALATE',
378+
icon: 'FileArrowUp',
379+
label: {
380+
defaultMessage: 'Escalate',
381+
description:
382+
'This is shown when the escalate action can be triggered from the action from',
383+
id: 'event.birth.action.escalate.label'
384+
},
385+
conditionals: [
386+
{
387+
type: ConditionalType.SHOW,
388+
conditional: not(
389+
or(
390+
flag('escalated-to-provincial-registrar'),
391+
flag('escalated-to-registrar-general')
392+
)
393+
)
394+
}
395+
],
396+
form: [
397+
{
398+
id: 'escalate-to',
399+
type: FieldType.SELECT,
400+
required: true,
401+
label: {
402+
defaultMessage: 'Escalate to',
403+
description: 'This is the label for escalate to field',
404+
id: 'event.birth.custom.action.escalate.field.escalate-to.label'
405+
},
406+
options: [
407+
{
408+
label: {
409+
id: 'event.birth.custom.action.escalate.field.escalate-to.option.officer-in-charge.label',
410+
defaultMessage: 'My state provincial registrar',
411+
description:
412+
'Option label for provincial registrar in escalate to field'
413+
},
414+
value: 'PROVINCIAL_REGISTRAR'
415+
},
416+
{
417+
label: {
418+
id: 'event.birth.custom.action.escalate.field.escalate-to.option.registrar-general.label',
419+
defaultMessage: 'Registrar General',
420+
description:
421+
'Option label for registrar general in escalate to field'
422+
},
423+
value: 'REGISTRAR_GENERAL'
424+
}
425+
]
426+
},
427+
{
428+
id: 'reason',
429+
type: FieldType.TEXTAREA,
430+
required: true,
431+
label: {
432+
defaultMessage: 'Reason',
433+
description: 'This is the label for reason field',
434+
id: 'form.field.label.reasonNotApplying'
435+
}
436+
}
437+
],
438+
flags: [
439+
{
440+
id: 'escalated-to-provincial-registrar',
441+
operation: 'add',
442+
conditional: field('escalate-to').isEqualTo('PROVINCIAL_REGISTRAR')
443+
},
444+
{
445+
id: 'escalated-to-registrar-general',
446+
operation: 'add',
447+
conditional: field('escalate-to').isEqualTo('REGISTRAR_GENERAL')
448+
}
449+
],
450+
auditHistoryLabel: {
451+
defaultMessage: 'Escalated',
452+
description:
453+
'The label to show in audit history for the escalate action',
454+
id: 'event.birth.action.escalate.audit-history-label'
455+
}
456+
},
457+
{
458+
type: ActionType.CUSTOM,
459+
customActionType: 'PROVINCIAL_REGISTER_FEEDBACK',
460+
icon: 'ChatText',
461+
label: {
462+
defaultMessage: 'Provincial registrar feedback',
463+
description:
464+
'This is shown when the provincial registrar feedback can be triggered from the action from',
465+
id: 'event.birth.action.provincial-registrar-feedback.label'
466+
},
467+
form: [
468+
{
469+
id: 'notes',
470+
type: 'TEXTAREA',
471+
required: true,
472+
label: {
473+
defaultMessage: 'Comments',
474+
description: 'This is the label for the field for a custom action',
475+
id: 'event.birth.custom.action.approve.field.notes.label'
476+
}
477+
}
478+
],
479+
flags: [
480+
{
481+
id: 'escalated-to-provincial-registrar',
482+
operation: 'remove'
483+
}
484+
],
485+
conditionals: [
486+
{
487+
type: ConditionalType.SHOW,
488+
conditional: flag('escalated-to-provincial-registrar')
489+
}
490+
],
491+
auditHistoryLabel: {
492+
defaultMessage: 'Escalation feedback',
493+
description:
494+
'The label to show in audit history for the registrar feedback sent action',
495+
id: 'event.birth.action.registrar-feedback.audit-history-label'
496+
}
497+
},
498+
{
499+
type: ActionType.CUSTOM,
500+
customActionType: 'REGISTRAR_GENERAL_FEEDBACK',
501+
icon: 'ChatText',
502+
label: {
503+
defaultMessage: 'Registrar general feedback',
504+
description:
505+
'This is shown when the registrar general feedback can be triggered from the action from',
506+
id: 'event.birth.action.registrar-general-feedback.label'
507+
},
508+
form: [
509+
{
510+
id: 'notes',
511+
type: 'TEXTAREA',
512+
required: true,
513+
label: {
514+
defaultMessage: 'Comments',
515+
description: 'This is the label for the field for a custom action',
516+
id: 'event.birth.custom.action.approve.field.notes.label'
517+
}
518+
}
519+
],
520+
flags: [
521+
{
522+
id: 'escalated-to-registrar-general',
523+
operation: 'remove'
524+
}
525+
],
526+
conditionals: [
527+
{
528+
type: ConditionalType.SHOW,
529+
conditional: flag('escalated-to-registrar-general')
530+
}
531+
],
532+
auditHistoryLabel: {
533+
defaultMessage: 'Escalation feedback',
534+
description:
535+
'The label to show in audit history for the registrar feedback sent action',
536+
id: 'event.birth.action.registrar-feedback.audit-history-label'
537+
}
538+
},
356539
{
357540
type: ActionType.VALIDATE,
358541
label: {

src/translations/client.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,9 @@ event.birth.action.delete.label,Label for delete button in dropdown menu,Delete,
865865
event.birth.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
866866
event.birth.action.issued.audit-history-label,The label to show in audit history for the issued action,Issued,Émis
867867
event.birth.action.mark-as-duplicate.label,Label for review potential duplicate button in dropdown menu,Review,Revoir
868+
event.birth.action.provincial-registrar-feedback.label,This is shown when the provincial registrar feedback can be triggered from the action from,Provincial registrar feedback,Retour du registraire provincial
868869
event.birth.action.register.label,Label for review record button in dropdown menu,Register,Enregistrer
870+
event.birth.action.registrar-general-feedback.label,This is shown when the registrar general feedback can be triggered from the action from,Registrar general feedback,Retour du registraire général
869871
event.birth.action.reject.label,This is the label for the reject action,Reject,Rejeter
870872
event.birth.action.request-correction.label,This is shown as the action name anywhere the user can trigger the action from,Correct record,Enregistrement correct
871873
event.birth.action.validate.label,This is shown as the action name anywhere the user can trigger the action from,Validate,Valider
@@ -2299,6 +2301,7 @@ workqueues.outbox.title,Title of outbox workqueue,Outbox,Boîte d'envoi
22992301
workqueues.pendingCertification.emptyMessage,Empty message for pending certification workqueue,No pending certification records,Aucun dossier de certification en attente
23002302
workqueues.pendingCertification.title,Title of pending certification workqueue,Pending Certification,En attente de certification
23012303
workqueues.requiresApproval.title,Title of pending approval workqueue,Pending approval,En attente d'approbation
2304+
workqueues.reviewRequested.title,Title of review requested workqueue,Review requested,Révision demandée
23022305
wq.noRecords.CREATED,No records messages for empty draft tab,No records in progress,Aucun enregistrement en cours
23032306
wq.noRecords.DECLARED,No records messages for ready for review tab,No records ready for review,Aucun document prêt à être examiné
23042307
wq.noRecords.REGISTERED,No records messages for ready to print tab,No records ready to print,Aucun document prêt à être imprimé

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,10 @@
834834
dependencies:
835835
"@octokit/openapi-types" "^18.0.0"
836836

837-
"@opencrvs/[email protected].5ad83cd":
838-
version "1.9.2-rc.5ad83cd"
839-
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.9.2-rc.5ad83cd.tgz#aa56b8057cf03f01a12f25e401ea1d17212e7e45"
840-
integrity sha512-xUFWBXMnSgSyxIlBrpLW/uYsNbFgstBNLX017Tw7RZ4JZwWwmTr0a2TGhoiOC16Z3KGrNeuZTCbah/P6m9IpCQ==
837+
"@opencrvs/[email protected].1191623":
838+
version "1.9.2-rc.1191623"
839+
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.9.2-rc.1191623.tgz#f0ab53507ebb2e4cdcab27b2f1837242683ffee9"
840+
integrity sha512-JoKQ0LZM0+u0RwMwuA74BMuc25WyeiNjjHl02L+LmnNuEMkD0BhlykbYp2AQiExgTa620Lh/PSPLh3bga7TAqg==
841841
dependencies:
842842
"@trpc/client" "11.4.3"
843843
"@trpc/server" "11.4.3"

0 commit comments

Comments
 (0)