Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events v2 collect certificate workflow boilerplate code #360

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
72 changes: 72 additions & 0 deletions src/form/tennis-club-membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,62 @@
]
})

const TENNIS_CLUB_MEMBERSHIP_CERTIFICATE_COLLECTOR_FORM = defineForm({
label: {
id: 'event.tennis-club-membership.action.certificate.form.label',
defaultMessage: 'Tennis club membership certificate collector',
description: 'This is what this form is referred as in the system'
},
review: {
title: {
id: 'event.tennis-club-membership.action.certificate.form.review.title',
defaultMessage: 'Member certificate collector for {firstname} {surname}',
description: 'Title of the form to show in review page'
}
},
active: true,
version: {
id: '1.0.0',
label: {
id: 'event.tennis-club-membership.action.certificate.form.version.1',
defaultMessage: 'Version 1',
description: 'This is the first version of the form'
}
},
pages: [
{
id: 'collector',
title: {
id: 'event.tennis-club-membership.action.certificate.form.section.who.title',
defaultMessage: 'Who is collecting the certificate?',
description: 'This is the title of the section'
},
fields: [
{
id: 'collector.firstname',
type: 'TEXT',
required: true,
label: {
defaultMessage: "Collector's first name",
description: 'This is the label for the field',
id: 'event.tennis-club-membership.action.certificate.form.section.who.field.firstname.label'
}
},
{
id: 'collector.surname',
type: 'TEXT',
required: true,
label: {
defaultMessage: "Collector's surname",
description: 'This is the label for the field',
id: 'event.tennis-club-membership.action.certificate.form.section.who.field.surname.label'
}
}
]
}
]
})

export const tennisClubMembershipEvent = defineConfig({
id: 'TENNIS_CLUB_MEMBERSHIP',
label: {
Expand Down Expand Up @@ -341,6 +397,22 @@
),
forms: [TENNIS_CLUB_FORM]
},
{
type: 'COLLECT_CERTIFICATE',

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

View workflow job for this annotation

GitHub Actions / test

Type '"COLLECT_CERTIFICATE"' is not assignable to type '"CREATE" | "DECLARE" | "VALIDATE" | "REGISTER" | "DELETE" | "CUSTOM"'.
tareq89 marked this conversation as resolved.
Show resolved Hide resolved
label: {
defaultMessage: 'Collect certificate',
description:
'This is shown as the action name anywhere the user can trigger the action from',
id: 'event.tennis-club-membership.action.collect-certificate.label'
},
allowedWhen: defineConditional(
and(
eventHasAction('REGISTER'),
not(eventHasAction('COLLECT_CERTIFICATE'))
)
),
forms: [TENNIS_CLUB_MEMBERSHIP_CERTIFICATE_COLLECTOR_FORM]
},
{
type: 'CUSTOM',
label: {
Expand Down
Loading