Skip to content

Commit

Permalink
events v2 collect certificate workflow boilerplate code
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq89 committed Jan 10, 2025
1 parent 1ccc283 commit 3ee7277
Showing 1 changed file with 72 additions and 0 deletions.
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_FORM = defineForm({
]
})

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 @@ export const tennisClubMembershipEvent = defineConfig({
),
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"'.
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

0 comments on commit 3ee7277

Please sign in to comment.