Skip to content

Commit

Permalink
add conditional rules for action visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rikukissa committed Dec 13, 2024
1 parent f17eaeb commit a6e9a20
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/form/tennis-club-membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

import { defineConfig } from '@opencrvs/toolkit/events'
import { defineConditional } from '@opencrvs/toolkit/conditionals'

Check failure on line 13 in src/form/tennis-club-membership.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module '@opencrvs/toolkit/conditionals' or its corresponding type declarations.

export const tennisClubMembershipEvent = defineConfig({
id: 'TENNIS_CLUB_MEMBERSHIP',
Expand Down Expand Up @@ -240,6 +241,31 @@ export const tennisClubMembershipEvent = defineConfig({
'This is shown as the action name anywhere the user can trigger the action from',
id: 'event.tennis-club-membership.action.declare.label'
},
allowedWhen: defineConditional({
type: 'object',
allOf: [
{
properties: {
$event: {
properties: {
actions: {
contains: {
type: 'object',
properties: {
type: {
const: 'DECLARE'
}
},
required: ['type']
}
}
}
}
}
}
]
}),

forms: [
{
label: {
Expand Down

0 comments on commit a6e9a20

Please sign in to comment.