diff --git a/package.json b/package.json index c9c64f771c..04e505a34b 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/toolkit": "1.9.0-rc.8a42cc8", + "@opencrvs/toolkit": "1.9.0-rc.1346624", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", "@types/fhir": "^0.0.30", diff --git a/src/api/workqueue/workqueueConfig.ts b/src/api/workqueue/workqueueConfig.ts index 5ac4d707f4..733442ab10 100644 --- a/src/api/workqueue/workqueueConfig.ts +++ b/src/api/workqueue/workqueueConfig.ts @@ -166,7 +166,7 @@ export const Workqueues = defineWorkqueues([ terms: ['DECLARED', 'NOTIFIED'] }, flags: { - noneOf: [InherentFlags.REJECTED] + noneOf: [InherentFlags.REJECTED, 'validated'] }, createdBy: { type: 'exact', term: user('id') } }, @@ -194,7 +194,7 @@ export const Workqueues = defineWorkqueues([ query: { status: { type: 'exact', term: EventStatus.enum.DECLARED }, flags: { - noneOf: [InherentFlags.REJECTED] + noneOf: [InherentFlags.REJECTED, 'validated'] }, updatedAtLocation: { type: 'exact', term: user('primaryOfficeId') } }, @@ -230,7 +230,7 @@ export const Workqueues = defineWorkqueues([ { status: { type: 'anyOf', - terms: ['DECLARED', 'VALIDATED'] + terms: ['DECLARED'] }, flags: { noneOf: [InherentFlags.REJECTED] @@ -341,15 +341,10 @@ export const Workqueues = defineWorkqueues([ clauses: [ { updatedBy: { type: 'exact', term: user('id') }, - status: { type: 'exact', term: 'VALIDATED' }, - flags: { - noneOf: [InherentFlags.REJECTED] - } + flags: { noneOf: [InherentFlags.REJECTED] } }, { - flags: { - anyOf: [InherentFlags.CORRECTION_REQUESTED] - }, + flags: { anyOf: [InherentFlags.CORRECTION_REQUESTED, 'validated'] }, updatedBy: { type: 'exact', term: user('id') } } ] diff --git a/src/form/v2/birth/index.ts b/src/form/v2/birth/index.ts index 0c1054cb23..59b31f42d6 100644 --- a/src/form/v2/birth/index.ts +++ b/src/form/v2/birth/index.ts @@ -58,6 +58,15 @@ export const birthEvent = defineConfig({ description: 'Flag label for approval required for late registration' }, requiresAction: true + }, + { + id: 'validated', + label: { + id: 'event.birth.flag.validated', + defaultMessage: 'Validated', + description: 'Flag label for validated' + }, + requiresAction: true } ], summary: { @@ -275,8 +284,10 @@ export const birthEvent = defineConfig({ { type: ConditionalType.ENABLE, conditional: not(flag('approval-required-for-late-registration')) - } + }, + { type: ConditionalType.SHOW, conditional: not(flag('validated')) } ], + flags: [{ id: 'validated', operation: 'add' }], deduplication: { id: 'birth-deduplication', label: { @@ -288,6 +299,16 @@ export const birthEvent = defineConfig({ query: dedupConfig } }, + { + type: ActionType.REJECT, + label: { + defaultMessage: 'Reject', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.birth.action.reject.label' + }, + flags: [{ id: 'validated', operation: 'remove' }] + }, { type: ActionType.REGISTER, label: { diff --git a/src/form/v2/death/index.ts b/src/form/v2/death/index.ts index 1880a27e7b..9d32f0e1c9 100644 --- a/src/form/v2/death/index.ts +++ b/src/form/v2/death/index.ts @@ -12,7 +12,9 @@ import { ActionType, ConditionalType, defineConfig, - field + field, + not, + flag } from '@opencrvs/toolkit/events' import { DEATH_DECLARATION_REVIEW, @@ -45,6 +47,17 @@ export const deathEvent = defineConfig({ description: 'This is a fallback title if actual title resolves to empty string' }, + flags: [ + { + id: 'validated', + label: { + id: 'event.death.flag.validated', + defaultMessage: 'Validated', + description: 'Flag label for validated' + }, + requiresAction: true + } + ], summary: { fields: [ { @@ -201,6 +214,10 @@ export const deathEvent = defineConfig({ 'This is shown as the action name anywhere the user can trigger the action from', id: 'event.death.action.validate.label' }, + conditionals: [ + { type: ConditionalType.SHOW, conditional: not(flag('validated')) } + ], + flags: [{ id: 'validated', operation: 'add' }], deduplication: { id: 'death-deduplication', label: { @@ -212,6 +229,16 @@ export const deathEvent = defineConfig({ query: dedupConfig } }, + { + type: ActionType.REJECT, + label: { + defaultMessage: 'Reject', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.death.action.reject.label' + }, + flags: [{ id: 'validated', operation: 'remove' }] + }, { type: ActionType.REGISTER, label: { diff --git a/yarn.lock b/yarn.lock index d8af21da82..a77296bb0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -834,10 +834,10 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/toolkit@1.9.0-rc.8a42cc8": - version "1.9.0-rc.8a42cc8" - resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.9.0-rc.8a42cc8.tgz#29d8299ce1feed7b2d71f6eec1c89d5fb7a0c6dc" - integrity sha512-GCVX2eIHcZdc8GlmQT+RISlJjt0eU0ftld5Nd3lLwsso7lkVNQa7sY/LdbvMZ6dcgx9sdYUr32pgeEwL8iUMYw== +"@opencrvs/toolkit@1.9.0-rc.1346624": + version "1.9.0-rc.1346624" + resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.9.0-rc.1346624.tgz#4a605be5e913452ef7890eb879b1c3c679fac6ea" + integrity sha512-Fl+n1QpySvHS8niZ8cdWzeyIoScPMi+AY/7moTjV08dj3r8OdiMVm7My4+uq4cVSeqRVNnk6jGMfTiFTq16Ihg== dependencies: "@trpc/client" "11.4.3" "@trpc/server" "11.4.3"