Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/api/workqueue/workqueueConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,32 @@ export const Workqueues = defineWorkqueues([
description: 'Empty message for recent workqueue'
}
},
{
slug: 'pending-certification',
icon: 'Printer',
name: {
id: 'workqueues.pendingCertification.title',
defaultMessage: 'Pending Certification',
description: 'Title of pending certification workqueue'
},
query: {
flags: {
anyOf: ['pending-certified-copy-issuance']
},
updatedAtLocation: { type: 'exact', term: user('primaryOfficeId') }
},
actions: [
{
type: 'DEFAULT',
conditionals: []
}
],
emptyMessage: {
id: 'workqueues.pendingCertification.emptyMessage',
defaultMessage: 'No pending certification records',
description: 'Empty message for pending certification workqueue'
}
},
{
slug: 'requires-completion',
icon: 'File',
Expand Down
5 changes: 3 additions & 2 deletions src/data-seeding/roles/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const roles: Role[] = [
'search[event=birth,access=all]',
'search[event=death,access=all]',
'search[event=tennis-club-membership,access=all]',
'workqueue[id=assigned-to-you|recent|requires-completion|requires-updates-office|in-review-all|in-external-validation|ready-to-print|ready-to-issue]',
'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]',
'record.create[event=birth|death|tennis-club-membership]',
'record.read[event=birth|death|tennis-club-membership]',
'record.declare[event=birth|death|tennis-club-membership]',
Expand All @@ -221,7 +221,8 @@ export const roles: Role[] = [
'record.register[event=birth|death|tennis-club-membership]',
'record.registered.print-certified-copies[event=birth|death|tennis-club-membership]',
'record.registered.correct[event=birth|death|tennis-club-membership]',
'record.unassign-others[event=birth|death|tennis-club-membership]'
'record.unassign-others[event=birth|death|tennis-club-membership]',
'record.custom-action[event=birth,customActionType=ISSUE_CERTIFIED_COPY]'
]
},
{
Expand Down
50 changes: 42 additions & 8 deletions src/form/v2/birth/forms/printForm/collectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,36 @@ const fatherMotherBothDoesNotExist = (informantType: InformantTypeKey) => {
}
}

const printInAdvanceOption = {
label: {
id: 'event.birth.action.certificate.form.section.requester.printInAdvance.label',
defaultMessage: 'Print in advance of issuance',
description: 'This is the label for the print-in-advance of issuance field'
},
value: 'PRINT_IN_ADVANCE'
}

const getFieldConfigForInformant = (informantType: InformantTypeKey) => {
return [
{
...commonConfigs,
conditionals: [onlyMotherExist(informantType)],
options: [getInformantOption(informantType), motherOption, otherOption]
options: [
getInformantOption(informantType),
motherOption,
otherOption,
printInAdvanceOption
]
},
{
...commonConfigs,
conditionals: [onlyFatherExist(informantType)],
options: [getInformantOption(informantType), fatherOption, otherOption]
options: [
getInformantOption(informantType),
fatherOption,
otherOption,
printInAdvanceOption
]
},
{
...commonConfigs,
Expand All @@ -83,13 +102,18 @@ const getFieldConfigForInformant = (informantType: InformantTypeKey) => {
getInformantOption(informantType),
fatherOption,
motherOption,
otherOption
otherOption,
printInAdvanceOption
]
},
{
...commonConfigs,
conditionals: [fatherMotherBothDoesNotExist(informantType)],
options: [getInformantOption(informantType), otherOption]
options: [
getInformantOption(informantType),
otherOption,
printInAdvanceOption
]
}
]
}
Expand Down Expand Up @@ -154,29 +178,39 @@ export const printCertificateCollectors: FieldConfig[] = [
{
...commonConfigs,
conditionals: [onlyMotherExist(InformantType.MOTHER)],
options: [getInformantOption(InformantType.MOTHER), otherOption]
options: [
getInformantOption(InformantType.MOTHER),
otherOption,
printInAdvanceOption
]
},
{
...commonConfigs,
conditionals: [fatherMotherBothExist(InformantType.MOTHER)],
options: [
getInformantOption(InformantType.MOTHER),
fatherOption,
otherOption
otherOption,
printInAdvanceOption
]
},
{
...commonConfigs,
conditionals: [onlyFatherExist(InformantType.FATHER)],
options: [getInformantOption(InformantType.FATHER), otherOption]
options: [
getInformantOption(InformantType.FATHER),
otherOption,
printInAdvanceOption
]
},
{
...commonConfigs,
conditionals: [fatherMotherBothExist(InformantType.FATHER)],
options: [
getInformantOption(InformantType.FATHER),
motherOption,
otherOption
otherOption,
printInAdvanceOption
]
},
...getFieldConfigForInformant(InformantType.OTHER),
Expand Down
86 changes: 85 additions & 1 deletion src/form/v2/birth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import {
ConditionalType,
defineConfig,
field,
FieldType,
flag,
InherentFlags,
not
not,
status
} from '@opencrvs/toolkit/events'
import {
BIRTH_DECLARATION_FORM,
Expand Down Expand Up @@ -68,6 +70,15 @@ export const birthEvent = defineConfig({
description: 'Flag label for validated'
},
requiresAction: true
},
{
id: 'pending-certified-copy-issuance',
label: {
id: 'event.birth.flag.pending-certified-copy-issuance',
defaultMessage: 'Pending certified copy issuance',
description: 'Flag label for pending certified copy issuance'
},
requiresAction: true
}
],
summary: {
Expand Down Expand Up @@ -278,6 +289,70 @@ export const birthEvent = defineConfig({
id: 'event.birth.action.approve.confirmationText'
}
},
{
type: ActionType.CUSTOM,
customActionType: 'ISSUE_CERTIFIED_COPY',
icon: 'Handshake',
label: {
defaultMessage: 'Issue certified copy',
description:
'This is shown as the action name anywhere the user can trigger the action from',
id: 'event.birth.action.issue-certified-copy.label'
},
form: [
{
id: 'collector',
type: FieldType.SELECT,
label: {
defaultMessage: 'Collector',
description: 'Label for collector field',
id: 'event.birth.custom.action.approve.field.collector.label'
},
required: true,
options: [
{
label: {
defaultMessage: 'Mother',
id: 'form.field.label.app.whoContDet.mother',
description: 'Label for mother'
},
value: 'MOTHER'
},
{
label: {
defaultMessage: 'Father',
id: 'form.field.label.informantRelation.father',
description: 'Label for father'
},
value: 'FATHER'
},
{
label: {
defaultMessage: 'Someone else',
id: 'form.field.label.informantRelation.others',
description: 'Label for someone else'
},
Comment on lines +313 to +334
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

translations of these labels are already in client.csv

value: 'SOMEONE_ELSE'
}
]
}
],
flags: [{ id: 'pending-certified-copy-issuance', operation: 'remove' }],
conditionals: [
{
type: ConditionalType.SHOW,
conditional: and(
flag('pending-certified-copy-issuance'),
status('REGISTERED')
)
}
],
auditHistoryLabel: {
defaultMessage: 'Issued',
description: 'The label to show in audit history for the issued action',
id: 'event.birth.action.issued.audit-history-label'
}
},
{
type: ActionType.VALIDATE,
label: {
Expand Down Expand Up @@ -348,6 +423,15 @@ export const birthEvent = defineConfig({
'This is shown as the action name anywhere the user can trigger the action from',
id: 'event.birth.action.collect-certificate.label'
},
flags: [
{
id: 'pending-certified-copy-issuance',
operation: 'add',
conditional: field('collector.requesterId').isEqualTo(
'PRINT_IN_ADVANCE'
)
}
],
printForm: BIRTH_CERTIFICATE_COLLECTOR_FORM
},
{
Expand Down
Loading