Skip to content

Commit 4f5fbbd

Browse files
committed
progress with config
1 parent 1a5d200 commit 4f5fbbd

File tree

6 files changed

+60
-80
lines changed

6 files changed

+60
-80
lines changed

src/api/action-confirmation.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ The following actions currently support action confirmation:
88

99
- `ActionType.NOTIFY`
1010
- `ActionType.DECLARE`
11-
- `ActionType.VALIDATE`
1211
- `ActionType.REGISTER`
1312
- `ActionType.REJECT`
1413
- `ActionType.ARCHIVE`

src/data-seeding/roles/roles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ export const roles: Role[] = [
175175
'record.read[event=birth|death|tennis-club-membership]',
176176
'record.declare[event=birth|death|tennis-club-membership]',
177177
'record.declared.edit[event=birth|death|tennis-club-membership]',
178-
'record.declared.validate[event=birth|death|tennis-club-membership]',
179178
'record.declared.reject[event=birth|death|tennis-club-membership]',
180179
'record.declared.archive[event=birth|death|tennis-club-membership]',
181180
'record.declared.review-duplicates[event=birth|death|tennis-club-membership]',
182181
'record.registered.print-certified-copies[event=birth|death|tennis-club-membership]',
183-
'record.registered.request-correction[event=birth|death|tennis-club-membership]'
182+
'record.registered.request-correction[event=birth|death|tennis-club-membership]',
183+
'record.custom-action[event=birth,customActionType=VALIDATE_DECLARATION]'
184184
]
185185
},
186186
{
@@ -229,7 +229,7 @@ export const roles: Role[] = [
229229
'record.registered.print-certified-copies[event=birth|death|tennis-club-membership]',
230230
'record.registered.correct[event=birth|death|tennis-club-membership]',
231231
'record.unassign-others[event=birth|death|tennis-club-membership]',
232-
'record.custom-action[event=birth,customActionType=ISSUE_CERTIFIED_COPY]'
232+
'record.custom-action[event=birth,customActionType=ISSUE_CERTIFIED_COPY|VALIDATE_DECLARATION]'
233233
]
234234
},
235235
{

src/form/tennis-club-membership.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -901,15 +901,6 @@ export const tennisClubMembershipEvent = defineConfig({
901901
},
902902
review: TENNIS_CLUB_DECLARATION_REVIEW
903903
},
904-
{
905-
type: ActionType.VALIDATE,
906-
label: {
907-
defaultMessage: 'Validate',
908-
description:
909-
'This is shown as the action name anywhere the user can trigger the action from',
910-
id: 'event.tennis-club-membership.action.validate.label'
911-
}
912-
},
913904
{
914905
type: ActionType.REGISTER,
915906
label: {

src/form/v2/birth/index.ts

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import {
1818
flag,
1919
InherentFlags,
2020
not,
21-
status
21+
or,
22+
status,
23+
user
2224
} from '@opencrvs/toolkit/events'
2325
import {
2426
BIRTH_DECLARATION_FORM,
@@ -238,9 +240,57 @@ export const birthEvent = defineConfig({
238240
),
239241
field('child.dob').isBefore().now()
240242
)
243+
},
244+
{
245+
id: 'validated',
246+
operation: 'add',
247+
conditional: or(
248+
user.hasRole('REGISTRATION_AGENT'),
249+
user.hasRole('LOCAL_REGISTRAR')
250+
)
241251
}
242252
]
243253
},
254+
{
255+
type: ActionType.CUSTOM,
256+
customActionType: 'VALIDATE_DECLARATION',
257+
icon: 'Stamp',
258+
label: {
259+
defaultMessage: 'Validate declaration',
260+
description:
261+
'This is shown as the action name anywhere the user can trigger the action from',
262+
id: 'event.birth.custom.action.validate-declaration.label'
263+
},
264+
conditionals: [
265+
{
266+
type: ConditionalType.SHOW,
267+
conditional: and(status('DECLARED'), not(flag('validated')))
268+
},
269+
{
270+
type: ConditionalType.ENABLE,
271+
conditional: not(flag(InherentFlags.POTENTIAL_DUPLICATE))
272+
}
273+
],
274+
flags: [{ id: 'validated', operation: 'add' }],
275+
form: [
276+
{
277+
id: 'comments',
278+
type: 'TEXTAREA',
279+
label: {
280+
defaultMessage: 'Comments',
281+
description:
282+
'This is the label for the comments field for the validate declaration action',
283+
id: 'event.birth.custom.action.validate-declaration.field.comments.label'
284+
}
285+
}
286+
],
287+
auditHistoryLabel: {
288+
defaultMessage: 'Validated',
289+
description:
290+
'The label to show in audit history for the validate action',
291+
id: 'event.birth.custom.action.validate-declaration.audit-history-label'
292+
}
293+
},
244294
{
245295
type: ActionType.CUSTOM,
246296
customActionType: 'APPROVE_DECLARATION',
@@ -353,33 +403,6 @@ export const birthEvent = defineConfig({
353403
id: 'event.birth.action.issued.audit-history-label'
354404
}
355405
},
356-
{
357-
type: ActionType.VALIDATE,
358-
label: {
359-
defaultMessage: 'Validate',
360-
description:
361-
'This is shown as the action name anywhere the user can trigger the action from',
362-
id: 'event.birth.action.validate.label'
363-
},
364-
conditionals: [
365-
{
366-
type: ConditionalType.ENABLE,
367-
conditional: not(flag('approval-required-for-late-registration'))
368-
},
369-
{ type: ConditionalType.SHOW, conditional: not(flag('validated')) }
370-
],
371-
flags: [{ id: 'validated', operation: 'add' }],
372-
deduplication: {
373-
id: 'birth-deduplication',
374-
label: {
375-
defaultMessage: 'Detect duplicate',
376-
description:
377-
'This is shown as the action name anywhere the user can trigger the action from',
378-
id: 'event.birth.action.detect-duplicate.label'
379-
},
380-
query: dedupConfig
381-
}
382-
},
383406
{
384407
type: ActionType.REJECT,
385408
label: {
@@ -398,6 +421,7 @@ export const birthEvent = defineConfig({
398421
'This is shown as the action name anywhere the user can trigger the action from',
399422
id: 'event.birth.action.register.label'
400423
},
424+
flags: [{ id: 'validated', operation: 'remove' }],
401425
conditionals: [
402426
{
403427
type: ConditionalType.ENABLE,

src/form/v2/death/index.ts

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ import {
1212
ActionType,
1313
ConditionalType,
1414
defineConfig,
15-
field,
16-
not,
17-
flag
15+
field
1816
} from '@opencrvs/toolkit/events'
1917
import {
2018
DEATH_DECLARATION_REVIEW,
@@ -47,17 +45,6 @@ export const deathEvent = defineConfig({
4745
description:
4846
'This is a fallback title if actual title resolves to empty string'
4947
},
50-
flags: [
51-
{
52-
id: 'validated',
53-
label: {
54-
id: 'event.death.flag.validated',
55-
defaultMessage: 'Validated',
56-
description: 'Flag label for validated'
57-
},
58-
requiresAction: true
59-
}
60-
],
6148
summary: {
6249
fields: [
6350
{
@@ -206,38 +193,14 @@ export const deathEvent = defineConfig({
206193
query: dedupConfig
207194
}
208195
},
209-
{
210-
type: ActionType.VALIDATE,
211-
label: {
212-
defaultMessage: 'Validate',
213-
description:
214-
'This is shown as the action name anywhere the user can trigger the action from',
215-
id: 'event.death.action.validate.label'
216-
},
217-
conditionals: [
218-
{ type: ConditionalType.SHOW, conditional: not(flag('validated')) }
219-
],
220-
flags: [{ id: 'validated', operation: 'add' }],
221-
deduplication: {
222-
id: 'death-deduplication',
223-
label: {
224-
defaultMessage: 'Detect duplicate',
225-
description:
226-
'This is shown as the action name anywhere the user can trigger the action from',
227-
id: 'event.death.action.detect-duplicate.label'
228-
},
229-
query: dedupConfig
230-
}
231-
},
232196
{
233197
type: ActionType.REJECT,
234198
label: {
235199
defaultMessage: 'Reject',
236200
description:
237201
'This is shown as the action name anywhere the user can trigger the action from',
238202
id: 'event.death.action.reject.label'
239-
},
240-
flags: [{ id: 'validated', operation: 'remove' }]
203+
}
241204
},
242205
{
243206
type: ActionType.REGISTER,

src/translations/client.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,9 @@ event.birth.summary.informant.contact.empty,This is shown when there is no infor
886886
event.birth.summary.informant.contact.label,This is the label for the informant information,Contact,Contact
887887
event.birth.summary.informant.contact.value,This is the contact value of the informant,{informant.phoneNo} {informant.email},{informant.phoneNo} {informant.email}
888888
event.birth.title,This is the title of the summary,{child.name.firstname} {child.name.surname},{child.name.firstname} {child.name.surname}
889+
event.birth.custom.action.validate-declaration.field.comments.label,This is the label for the comments field for the validate declaration action,Comments,Commentaires
890+
event.birth.custom.action.validate-declaration.audit-history-label,The label to show in audit history for the validate action,Validated,Validé
891+
event.birth.custom.action.validate-declaration.label,This is shown as the action name anywhere the user can trigger the action from,Validate declaration,Valider la déclaration
889892
event.death.action.Read.label,This is shown as the action name anywhere the user can trigger the action from,Read,Lire
890893
event.death.action.certificate.form.cancel,This is the label for the verification cancellation button,Identity does not match,L'identité ne correspond pas
891894
event.death.action.certificate.form.cancel.confirmation.body,This is the body for the verification cancellation modal,"Please be aware that if you proceed, you will be responsible for issuing a certificate without the necessary proof of ID from the collector","Veuillez noter que si vous continuez, vous serez responsable de la délivrance d'un certificat sans la preuve d'identité nécessaire du collecteur."

0 commit comments

Comments
 (0)