Skip to content

Commit b929533

Browse files
Nil20Nil20
andauthored
feat: add new workqueue and user role config (#1169)
* feat: add new workqueue and user role config * fix: add new translations to csv * fix: sort translation * feat: add conditional for approval action * fix: change new workqueue icon * chore: add new flag removal action for custom action * fix: amend custom action modal field * fix: amend workqueue message * chore: add demo user with new user role in ibombo * update toolkit * fix: update custom action label * chore: remove custom action scope permission from registrar * update toolkit(#14af0a6) * fix translation * update toolkit(#1f87ee1) * chore: give new permission to new user * chore: update toolkit(#74b7aa0) * chore: update custom action icon to stamp --------- Co-authored-by: Nil20 <[email protected]>
1 parent 5dddf62 commit b929533

File tree

7 files changed

+67
-23
lines changed

7 files changed

+67
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@hapi/boom": "^9.1.1",
6464
"@hapi/hapi": "^20.0.1",
6565
"@hapi/inert": "^6.0.3",
66-
"@opencrvs/toolkit": "1.9.0-rc.dda3c71",
66+
"@opencrvs/toolkit": "1.9.0-rc.74b7aa0",
6767
"@types/chalk": "^2.2.0",
6868
"@types/csv2json": "^1.4.0",
6969
"@types/fhir": "^0.0.30",

src/api/workqueue/workqueueConfig.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,5 +418,26 @@ export const Workqueues = defineWorkqueues([
418418
value: event.field('updatedAt')
419419
}
420420
]
421+
},
422+
{
423+
slug: 'late-registration-approval-required',
424+
icon: 'FileSearch',
425+
name: {
426+
id: 'workqueues.requiresApproval.title',
427+
defaultMessage: 'Pending approval',
428+
description: 'Title of Pending approval workqueue'
429+
},
430+
query: {
431+
flags: {
432+
anyOf: ['approval-required-for-late-registration']
433+
},
434+
updatedAtLocation: { type: 'exact', term: user('primaryOfficeId') }
435+
},
436+
actions: [
437+
{
438+
type: 'DEFAULT',
439+
conditionals: []
440+
}
441+
]
421442
}
422443
])

src/data-seeding/employees/source/default-employees.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CRVS_OFFICE_JWMRGwDBXK,Kalusha,Bwalya,HOSPITAL_CLERK,+260911111111,k.bwalya,kalu
33
CRVS_OFFICE_JWMRGwDBXK,Felix,Katongo,REGISTRATION_AGENT,+260922222222,f.katongo,[email protected],test
44
CRVS_OFFICE_JWMRGwDBXK,Kennedy,Mweene,LOCAL_REGISTRAR,+260933333333,k.mweene,[email protected],test
55
CRVS_OFFICE_JWMRGwDBXK,Emmanuel,Mayuka,LOCAL_SYSTEM_ADMIN,+260921681112,e.mayuka,[email protected],test
6+
CRVS_OFFICE_JWMRGwDBXK,Mitchell,Owen,PROVINCIAL_REGISTRAR,+260915151516,m.owen,[email protected],test
67
CRVS_OFFICE_2OKicPQMNI,Jonathan,Campbell,NATIONAL_SYSTEM_ADMIN,+260921111111,j.campbell,[email protected],test
78
CRVS_OFFICE_okQp4uKCz0,Patrick,Gondwe,COMMUNITY_LEADER,+260912121212,p.gondwe,[email protected],test
89
CRVS_OFFICE_okQp4uKCz0,Joshua,Mutale,REGISTRATION_AGENT,+260923232323,j.mutale,[email protected],test

src/data-seeding/roles/roles.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ 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]',
225-
'record.custom-action[event=birth,customActionType=Approve]'
224+
'record.unassign-others[event=birth|death|tennis-club-membership]'
226225
]
227226
},
228227
{
@@ -253,8 +252,8 @@ export const roles: Role[] = [
253252
},
254253
scopes: [
255254
SCOPES.USER_CREATE,
256-
'user.create[role=FIELD_AGENT|POLICE_OFFICER|HOSPITAL_CLERK|HEALTHCARE_WORKER|COMMUNITY_LEADER|REGISTRATION_AGENT|LOCAL_REGISTRAR|NATIONAL_REGISTRAR|LOCAL_SYSTEM_ADMIN|NATIONAL_SYSTEM_ADMIN|PERFORMANCE_MANAGER]',
257-
'user.edit[role=FIELD_AGENT|POLICE_OFFICER|HOSPITAL_CLERK|HEALTHCARE_WORKER|COMMUNITY_LEADER|REGISTRATION_AGENT|LOCAL_REGISTRAR|NATIONAL_REGISTRAR|LOCAL_SYSTEM_ADMIN|NATIONAL_SYSTEM_ADMIN|PERFORMANCE_MANAGER]',
255+
'user.create[role=FIELD_AGENT|POLICE_OFFICER|HOSPITAL_CLERK|HEALTHCARE_WORKER|COMMUNITY_LEADER|REGISTRATION_AGENT|LOCAL_REGISTRAR|NATIONAL_REGISTRAR|LOCAL_SYSTEM_ADMIN|NATIONAL_SYSTEM_ADMIN|PERFORMANCE_MANAGER|PROVINCIAL_REGISTRAR]',
256+
'user.edit[role=FIELD_AGENT|POLICE_OFFICER|HOSPITAL_CLERK|HEALTHCARE_WORKER|COMMUNITY_LEADER|REGISTRATION_AGENT|LOCAL_REGISTRAR|NATIONAL_REGISTRAR|LOCAL_SYSTEM_ADMIN|NATIONAL_SYSTEM_ADMIN|PERFORMANCE_MANAGER|PROVINCIAL_REGISTRAR]',
258257
SCOPES.USER_READ,
259258
SCOPES.USER_UPDATE,
260259
SCOPES.ORGANISATION_READ_LOCATIONS,
@@ -326,5 +325,20 @@ export const roles: Role[] = [
326325
'record.registered.correct[event=birth|death|tennis-club-membership]',
327326
'record.unassign-others[event=birth|death|tennis-club-membership]'
328327
]
328+
},
329+
{
330+
id: 'PROVINCIAL_REGISTRAR',
331+
label: {
332+
defaultMessage: 'Provincial Registrar',
333+
description: 'Name for user role Provincial Registrar',
334+
id: 'userRole.provincialRegistrar'
335+
},
336+
scopes: [
337+
'record.read[event=birth|death|tennis-club-membership]',
338+
'record.custom-action[event=birth,customActionType=APPROVE_DECLARATION]',
339+
'workqueue[id=late-registration-approval-required|recent]',
340+
'search[event=birth,access=all]',
341+
'record.unassign-others[event=birth]'
342+
]
329343
}
330344
]

src/form/v2/birth/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
defineConfig,
1616
field,
1717
flag,
18+
InherentFlags,
1819
not
1920
} from '@opencrvs/toolkit/events'
2021
import {
@@ -231,10 +232,10 @@ export const birthEvent = defineConfig({
231232
},
232233
{
233234
type: ActionType.CUSTOM,
234-
customActionType: 'Approve',
235-
icon: 'Globe',
235+
customActionType: 'APPROVE_DECLARATION',
236+
icon: 'Stamp',
236237
label: {
237-
defaultMessage: 'Approve',
238+
defaultMessage: 'Approve declaration',
238239
description:
239240
'This is shown as the action name anywhere the user can trigger the action from',
240241
id: 'event.birth.action.approve.label'
@@ -243,21 +244,25 @@ export const birthEvent = defineConfig({
243244
{
244245
id: 'notes',
245246
type: 'TEXTAREA',
246-
required: true,
247247
label: {
248-
defaultMessage: 'Notes',
248+
defaultMessage: 'Comments',
249249
description: 'This is the label for the field for a custom action',
250250
id: 'event.birth.custom.action.approve.field.notes.label'
251251
}
252252
}
253253
],
254254
flags: [
255+
{ id: InherentFlags.REJECTED, operation: 'remove' },
255256
{ id: 'approval-required-for-late-registration', operation: 'remove' }
256257
],
257258
conditionals: [
258259
{
259260
type: ConditionalType.SHOW,
260261
conditional: flag('approval-required-for-late-registration')
262+
},
263+
{
264+
type: ConditionalType.ENABLE,
265+
conditional: not(flag(InherentFlags.POTENTIAL_DUPLICATE))
261266
}
262267
],
263268
auditHistoryLabel: {

0 commit comments

Comments
 (0)