From de94b6e78036918be88cd108055231fc1c69ea0d Mon Sep 17 00:00:00 2001 From: Dave Earley Date: Thu, 29 Oct 2026 20:39:23 +0000 Subject: [PATCH 1/3] Add name badge printing - Badge designer: six templates, logo/artwork/sponsor images, fonts and colours, lines bound to registration questions, ticket colour ribbons, sizes from labels and ID cards to A6/4x6, A4/Letter sheets with cutting guides, and two-sided or fold-over backs. - Batch printing with printed/needs-reprint tracking; name, ticket, seat and badge-answer changes flag a reprint. Print actions on attendee and order menus, and a badge column on the attendee table. - Printing at check-in: print or reprint from the attendee sheet, auto-print on check-in, per-device label size and back printing, and a print queue. Check-in lists gain badge printing and a self check-in kiosk mode. - Badges are an opt-in per-event feature under Event Settings > Features (event_settings.enabled_features); off hides badge UI and door printing. - The check-in list form now uses expandable rows shared with the product form (common/Ledger). --- .claude/rules/features/badges.md | 27 + AGENTS.md | 1 + .../DomainObjects/AttendeeDomainObject.php | 12 + .../DomainObjects/CheckInListDomainObject.php | 21 + .../app/DomainObjects/Enums/BadgeBackMode.php | 12 + .../DomainObjects/Enums/BadgeFieldSource.php | 16 + .../app/DomainObjects/Enums/BadgeSheet.php | 12 + backend/app/DomainObjects/Enums/BadgeSize.php | 18 + .../app/DomainObjects/Enums/BadgeTemplate.php | 15 + .../app/DomainObjects/Enums/BadgeTextSize.php | 13 + .../app/DomainObjects/Enums/EventFeature.php | 10 + backend/app/DomainObjects/Enums/ImageType.php | 20 +- .../EventSettingDomainObject.php | 9 + .../AttendeeDomainObjectAbstract.php | 28 + .../CheckInListDomainObjectAbstract.php | 28 + .../EventSettingDomainObjectAbstract.php | 34 + .../DomainObjects/Status/BadgePrintStatus.php | 14 + .../InvalidBadgeDesignException.php | 20 + .../Actions/Badges/GetBadgeDesignAction.php | 28 + .../Actions/Badges/GetBadgeStatsAction.php | 35 + .../Http/Actions/Badges/GetBadgesAction.php | 43 + .../Badges/MarkBadgesPrintedAction.php | 39 + ...etCheckInListAttendeeBadgePublicAction.php | 36 + ...InListAttendeeBadgePrintedPublicAction.php | 36 + .../Badges/UpsertBadgeDesignAction.php | 41 + .../CheckInLists/CreateCheckInListAction.php | 2 + .../CheckInLists/UpdateCheckInListAction.php | 2 + .../Http/Request/Badge/GetBadgesRequest.php | 49 + .../Badge/MarkBadgesPrintedRequest.php | 34 + .../Badge/UpsertBadgeDesignRequest.php | 102 + .../CheckInList/UpsertCheckInListRequest.php | 2 + .../UpdateEventSettingsRequest.php | 18 +- backend/app/Models/EventSetting.php | 2 + .../Repository/DTO/BadgeAttendeeQueryDTO.php | 44 + backend/app/Repository/DTO/BadgeStatsDTO.php | 17 + .../Eloquent/AttendeeRepository.php | 98 + .../AttendeeRepositoryInterface.php | 6 + .../Attendee/AttendeeDetailPublicResource.php | 3 + .../Resources/Attendee/AttendeeResource.php | 4 + .../Badge/BadgeDesignLayoutResource.php | 47 + .../Resources/Badge/BadgeDesignResource.php | 38 + backend/app/Resources/Badge/BadgeResource.php | 47 + .../Resources/Badge/BadgeStatsResource.php | 25 + .../CheckInList/CheckInListResource.php | 2 + .../CheckInList/CheckInListResourcePublic.php | 6 + .../Resources/Event/EventSettingsResource.php | 13 +- .../Handlers/Attendee/EditAttendeeHandler.php | 7 +- .../Attendee/PartialEditAttendeeHandler.php | 6 +- .../Badge/DTO/BadgeDesignResultDTO.php | 16 + .../Handlers/Badge/DTO/GetBadgesDTO.php | 26 + .../Handlers/Badge/GetBadgeDesignHandler.php | 23 + .../Handlers/Badge/GetBadgeStatsHandler.php | 26 + .../Handlers/Badge/GetBadgesHandler.php | 47 + .../Badge/MarkBadgesPrintedHandler.php | 37 + ...tCheckInListAttendeeBadgePublicHandler.php | 36 + ...nListAttendeeBadgePrintedPublicHandler.php | 33 + .../Badge/UpsertBadgeDesignHandler.php | 28 + .../CheckInList/CreateCheckInListHandler.php | 4 +- .../CheckInList/DTO/UpsertCheckInListDTO.php | 2 + ...CheckInListAttendeeDetailPublicHandler.php | 4 + .../GetCheckInListAttendeePublicHandler.php | 15 +- .../GetCheckInListAttendeesPublicHandler.php | 2 +- .../Public/GetCheckInListPublicHandler.php | 10 + .../CheckInList/UpdateCheckInlistHandler.php | 4 +- .../DTO/UpdateEventSettingsDTO.php | 21 +- .../PartialUpdateEventSettingsHandler.php | 12 +- .../UpdateEventSettingsHandler.php | 14 +- .../Handlers/Images/CreateImageHandler.php | 4 +- .../Domain/Badge/BadgeDataService.php | 209 ++ .../Domain/Badge/BadgeDesignCloneService.php | 92 + .../Domain/Badge/BadgeDesignService.php | 264 +++ .../Domain/Badge/BadgeEligibilityService.php | 26 + .../Domain/Badge/BadgeReprintService.php | 87 + .../Badge/CheckInListBadgeAccessService.php | 96 + .../Services/Domain/Badge/DTO/BadgeDTO.php | 33 + .../Domain/Badge/DTO/BadgeDesignDTO.php | 66 + .../Domain/Badge/DTO/BadgeLineDTO.php | 19 + .../Domain/Badge/DTO/BadgeRibbonDTO.php | 16 + .../CheckInListActivityValidator.php | 10 + .../CheckInList/CreateCheckInListService.php | 2 + .../CheckInList/UpdateCheckInListService.php | 12 +- .../Domain/Event/DuplicateEventService.php | 10 + .../Question/EditQuestionAnswerService.php | 9 + .../SelfServiceEditAttendeeService.php | 6 + .../2026_10_29_000000_add_badge_printing.php | 40 + ...add_enabled_features_to_event_settings.php | 22 + .../Eloquent/SeatClaimRepository.php | 13 +- .../SeatClaimRepositoryInterface.php | 3 +- .../Domain/AttendeeSeatMoveService.php | 7 +- .../Domain/EventSeatMapLayoutUpdater.php | 6 +- backend/lang/de.json | 15 +- backend/lang/el.json | 15 +- backend/lang/es.json | 15 +- backend/lang/fi.json | 15 +- backend/lang/fr.json | 15 +- backend/lang/hu.json | 15 +- backend/lang/it.json | 15 +- backend/lang/ja.json | 15 +- backend/lang/ko.json | 15 +- backend/lang/nl.json | 15 +- backend/lang/pl.json | 15 +- backend/lang/pt-br.json | 15 +- backend/lang/pt.json | 15 +- backend/lang/ru.json | 15 +- backend/lang/se.json | 15 +- backend/lang/sk.json | 15 +- backend/lang/tr.json | 15 +- backend/lang/vi.json | 15 +- backend/lang/zh-cn.json | 15 +- backend/lang/zh-hk.json | 15 +- backend/resources/api-reference/openapi.json | 2032 +++++++++++++++-- backend/routes/api.php | 17 + .../tests/Concerns/CreatesBadgeFixtures.php | 146 ++ .../Http/Actions/Badges/BadgesTest.php | 331 +++ .../Badges/CheckInListBadgePublicTest.php | 170 ++ .../SeatMap/EventSeatMapClaimGuardsTest.php | 4 + .../Attendee/EditAttendeeHandlerTest.php | 7 + .../PartialEditAttendeeHandlerTest.php | 7 + ...kInListAttendeeDetailPublicHandlerTest.php | 1 + ...etCheckInListAttendeePublicHandlerTest.php | 10 +- ...tCheckInListAttendeesPublicHandlerTest.php | 1 + .../Domain/Badge/BadgeDataServiceTest.php | 221 ++ .../Domain/Badge/BadgeDesignServiceTest.php | 246 ++ .../Domain/Badge/BadgeReprintServiceTest.php | 151 ++ .../SeatMap/AttendeeSeatMoveServiceTest.php | 58 + .../SelfServiceEditAttendeeServiceTest.php | 10 +- e2e/api/api-client.ts | 33 + e2e/api/types.ts | 32 + e2e/pages/badges.page.ts | 147 ++ e2e/pages/check-in-list.page.ts | 22 +- e2e/pages/check-in.page.ts | 39 + e2e/tests/badges/badge-designer.spec.ts | 89 + e2e/tests/badges/badge-feature.spec.ts | 25 + e2e/tests/badges/badge-printing.spec.ts | 182 ++ e2e/tests/badges/check-in-badges.spec.ts | 149 ++ e2e/tests/management/check-in-lists.spec.ts | 23 + frontend/src/api/badge.client.ts | 50 + frontend/src/api/check-in.client.ts | 9 + .../AttendeeTable/AttendeeTable.module.scss | 18 + .../components/common/AttendeeTable/index.tsx | 33 +- .../common/CheckInListTable/index.tsx | 8 + .../DesignerShell/DesignerShell.module.scss | 6 + .../components/common/DesignerShell/index.tsx | 37 +- .../common/Ledger/Ledger.module.scss | 87 + .../LedgerRow.tsx => common/Ledger/index.tsx} | 39 +- .../NameBadge/BadgePrintPortal.module.scss | 23 + .../common/NameBadge/BadgePrintPortal.tsx | 69 + .../NameBadge/BadgePrintSheets.module.scss | 29 + .../common/NameBadge/BadgePrintSheets.tsx | 101 + .../components/common/NameBadge/FitBody.tsx | 57 + .../components/common/NameBadge/FitText.tsx | 79 + .../NameBadge/FoldOverBadge.module.scss | 43 + .../common/NameBadge/FoldOverBadge.tsx | 31 + .../common/NameBadge/NameBadge.module.scss | 504 ++++ .../NameBadge/ScaledNameBadge.module.scss | 23 + .../common/NameBadge/ScaledNameBadge.tsx | 47 + .../src/components/common/NameBadge/index.tsx | 305 +++ .../CheckInListForm.module.scss | 88 +- .../forms/CheckInListForm/index.tsx | 286 ++- .../forms/ProductForm/ProductForm.module.scss | 86 - .../components/forms/ProductForm/index.tsx | 17 +- .../forms/ProductForm/ledgerSummaries.ts | 15 +- .../CheckIn/AttendeeDetailSheet.module.scss | 16 + .../layouts/CheckIn/AttendeeDetailSheet.tsx | 56 +- .../layouts/CheckIn/BadgePrinterSettings.tsx | 74 + .../layouts/CheckIn/CheckIn.module.scss | 15 + .../layouts/CheckIn/CheckInModals.tsx | 5 + .../layouts/CheckIn/KioskCheckIn.module.scss | 205 ++ .../layouts/CheckIn/KioskCheckIn.tsx | 186 ++ .../src/components/layouts/CheckIn/index.tsx | 50 +- .../src/components/layouts/Event/index.tsx | 4 + .../modals/CreateCheckInListModal/index.tsx | 2 + .../modals/EditCheckInListModal/index.tsx | 4 + .../PrintBadgesModal.module.scss | 80 + .../modals/PrintBadgesModal/index.tsx | 198 ++ .../event/Badges/BadgeDesigner.module.scss | 208 ++ .../routes/event/Badges/BadgeLinesEditor.tsx | 200 ++ .../event/Badges/BadgePrint.module.scss | 118 + .../routes/event/Badges/BadgePrint.tsx | 285 +++ .../event/Badges/BadgeRibbonsEditor.tsx | 64 + .../routes/event/Badges/TemplatePicker.tsx | 66 + .../components/routes/event/Badges/index.tsx | 620 +++++ .../routes/event/Badges/sampleBadge.ts | 83 + .../FeatureSettings.module.scss | 44 + .../Sections/FeatureSettings/index.tsx | 75 + .../routes/event/Settings/index.tsx | 8 + .../src/components/routes/event/attendees.tsx | 27 +- frontend/src/hooks/useAttendeeActions.tsx | 13 +- frontend/src/hooks/useBadgePrinter.ts | 167 ++ frontend/src/hooks/useBadgesPrintedSync.ts | 45 + frontend/src/hooks/useCheckInController.tsx | 62 +- frontend/src/hooks/useEventFeature.ts | 8 + frontend/src/hooks/useOrderActions.tsx | 12 + frontend/src/locales/de.js | 2 +- frontend/src/locales/de.po | 1660 +++++++++++--- frontend/src/locales/el.js | 2 +- frontend/src/locales/el.po | 1660 +++++++++++--- frontend/src/locales/en.js | 2 +- frontend/src/locales/en.po | 1660 +++++++++++--- frontend/src/locales/es.js | 2 +- frontend/src/locales/es.po | 1660 +++++++++++--- frontend/src/locales/fi.js | 2 +- frontend/src/locales/fi.po | 1660 +++++++++++--- frontend/src/locales/fr.js | 2 +- frontend/src/locales/fr.po | 1660 +++++++++++--- frontend/src/locales/hu.js | 2 +- frontend/src/locales/hu.po | 1660 +++++++++++--- frontend/src/locales/it.js | 2 +- frontend/src/locales/it.po | 1660 +++++++++++--- frontend/src/locales/ja.js | 2 +- frontend/src/locales/ja.po | 1660 +++++++++++--- frontend/src/locales/ko.js | 2 +- frontend/src/locales/ko.po | 1660 +++++++++++--- frontend/src/locales/nl.js | 2 +- frontend/src/locales/nl.po | 1660 +++++++++++--- frontend/src/locales/pl.js | 2 +- frontend/src/locales/pl.po | 1660 +++++++++++--- frontend/src/locales/pt-br.js | 2 +- frontend/src/locales/pt-br.po | 1660 +++++++++++--- frontend/src/locales/pt.js | 2 +- frontend/src/locales/pt.po | 1660 +++++++++++--- frontend/src/locales/ru.js | 2 +- frontend/src/locales/ru.po | 1660 +++++++++++--- frontend/src/locales/se.js | 2 +- frontend/src/locales/se.po | 1660 +++++++++++--- frontend/src/locales/sk.js | 2 +- frontend/src/locales/sk.po | 1660 +++++++++++--- frontend/src/locales/tr.js | 2 +- frontend/src/locales/tr.po | 1660 +++++++++++--- frontend/src/locales/vi.js | 2 +- frontend/src/locales/vi.po | 1660 +++++++++++--- frontend/src/locales/zh-cn.js | 2 +- frontend/src/locales/zh-cn.po | 1660 +++++++++++--- frontend/src/locales/zh-hk.js | 2 +- frontend/src/locales/zh-hk.po | 1660 +++++++++++--- frontend/src/mutations/useCreateQuestion.ts | 13 + .../src/mutations/useMarkBadgesPrinted.ts | 16 + .../src/mutations/useUpdateBadgeDesign.ts | 17 + frontend/src/queries/useGetBadgeDesign.ts | 16 + frontend/src/queries/useGetBadgeStats.ts | 16 + frontend/src/queries/useGetBadges.ts | 14 + frontend/src/router.tsx | 15 + frontend/src/types.ts | 129 +- frontend/src/utilites/badgePrinting.ts | 47 + frontend/src/utilites/badges.ts | 319 +++ 245 files changed, 39007 insertions(+), 8594 deletions(-) create mode 100644 .claude/rules/features/badges.md create mode 100644 backend/app/DomainObjects/Enums/BadgeBackMode.php create mode 100644 backend/app/DomainObjects/Enums/BadgeFieldSource.php create mode 100644 backend/app/DomainObjects/Enums/BadgeSheet.php create mode 100644 backend/app/DomainObjects/Enums/BadgeSize.php create mode 100644 backend/app/DomainObjects/Enums/BadgeTemplate.php create mode 100644 backend/app/DomainObjects/Enums/BadgeTextSize.php create mode 100644 backend/app/DomainObjects/Enums/EventFeature.php create mode 100644 backend/app/DomainObjects/Status/BadgePrintStatus.php create mode 100644 backend/app/Exceptions/InvalidBadgeDesignException.php create mode 100644 backend/app/Http/Actions/Badges/GetBadgeDesignAction.php create mode 100644 backend/app/Http/Actions/Badges/GetBadgeStatsAction.php create mode 100644 backend/app/Http/Actions/Badges/GetBadgesAction.php create mode 100644 backend/app/Http/Actions/Badges/MarkBadgesPrintedAction.php create mode 100644 backend/app/Http/Actions/Badges/Public/GetCheckInListAttendeeBadgePublicAction.php create mode 100644 backend/app/Http/Actions/Badges/Public/MarkCheckInListAttendeeBadgePrintedPublicAction.php create mode 100644 backend/app/Http/Actions/Badges/UpsertBadgeDesignAction.php create mode 100644 backend/app/Http/Request/Badge/GetBadgesRequest.php create mode 100644 backend/app/Http/Request/Badge/MarkBadgesPrintedRequest.php create mode 100644 backend/app/Http/Request/Badge/UpsertBadgeDesignRequest.php create mode 100644 backend/app/Repository/DTO/BadgeAttendeeQueryDTO.php create mode 100644 backend/app/Repository/DTO/BadgeStatsDTO.php create mode 100644 backend/app/Resources/Badge/BadgeDesignLayoutResource.php create mode 100644 backend/app/Resources/Badge/BadgeDesignResource.php create mode 100644 backend/app/Resources/Badge/BadgeResource.php create mode 100644 backend/app/Resources/Badge/BadgeStatsResource.php create mode 100644 backend/app/Services/Application/Handlers/Badge/DTO/BadgeDesignResultDTO.php create mode 100644 backend/app/Services/Application/Handlers/Badge/DTO/GetBadgesDTO.php create mode 100644 backend/app/Services/Application/Handlers/Badge/GetBadgeDesignHandler.php create mode 100644 backend/app/Services/Application/Handlers/Badge/GetBadgeStatsHandler.php create mode 100644 backend/app/Services/Application/Handlers/Badge/GetBadgesHandler.php create mode 100644 backend/app/Services/Application/Handlers/Badge/MarkBadgesPrintedHandler.php create mode 100644 backend/app/Services/Application/Handlers/Badge/Public/GetCheckInListAttendeeBadgePublicHandler.php create mode 100644 backend/app/Services/Application/Handlers/Badge/Public/MarkCheckInListAttendeeBadgePrintedPublicHandler.php create mode 100644 backend/app/Services/Application/Handlers/Badge/UpsertBadgeDesignHandler.php create mode 100644 backend/app/Services/Domain/Badge/BadgeDataService.php create mode 100644 backend/app/Services/Domain/Badge/BadgeDesignCloneService.php create mode 100644 backend/app/Services/Domain/Badge/BadgeDesignService.php create mode 100644 backend/app/Services/Domain/Badge/BadgeEligibilityService.php create mode 100644 backend/app/Services/Domain/Badge/BadgeReprintService.php create mode 100644 backend/app/Services/Domain/Badge/CheckInListBadgeAccessService.php create mode 100644 backend/app/Services/Domain/Badge/DTO/BadgeDTO.php create mode 100644 backend/app/Services/Domain/Badge/DTO/BadgeDesignDTO.php create mode 100644 backend/app/Services/Domain/Badge/DTO/BadgeLineDTO.php create mode 100644 backend/app/Services/Domain/Badge/DTO/BadgeRibbonDTO.php create mode 100644 backend/database/migrations/2026_10_29_000000_add_badge_printing.php create mode 100644 backend/database/migrations/2026_10_29_000001_add_enabled_features_to_event_settings.php create mode 100644 backend/tests/Concerns/CreatesBadgeFixtures.php create mode 100644 backend/tests/Feature/Http/Actions/Badges/BadgesTest.php create mode 100644 backend/tests/Feature/Http/Actions/Badges/CheckInListBadgePublicTest.php create mode 100644 backend/tests/Unit/Services/Domain/Badge/BadgeDataServiceTest.php create mode 100644 backend/tests/Unit/Services/Domain/Badge/BadgeDesignServiceTest.php create mode 100644 backend/tests/Unit/Services/Domain/Badge/BadgeReprintServiceTest.php create mode 100644 backend/tests/Unit/Services/Domain/SeatMap/AttendeeSeatMoveServiceTest.php create mode 100644 e2e/pages/badges.page.ts create mode 100644 e2e/tests/badges/badge-designer.spec.ts create mode 100644 e2e/tests/badges/badge-feature.spec.ts create mode 100644 e2e/tests/badges/badge-printing.spec.ts create mode 100644 e2e/tests/badges/check-in-badges.spec.ts create mode 100644 frontend/src/api/badge.client.ts create mode 100644 frontend/src/components/common/Ledger/Ledger.module.scss rename frontend/src/components/{forms/ProductForm/LedgerRow.tsx => common/Ledger/index.tsx} (64%) create mode 100644 frontend/src/components/common/NameBadge/BadgePrintPortal.module.scss create mode 100644 frontend/src/components/common/NameBadge/BadgePrintPortal.tsx create mode 100644 frontend/src/components/common/NameBadge/BadgePrintSheets.module.scss create mode 100644 frontend/src/components/common/NameBadge/BadgePrintSheets.tsx create mode 100644 frontend/src/components/common/NameBadge/FitBody.tsx create mode 100644 frontend/src/components/common/NameBadge/FitText.tsx create mode 100644 frontend/src/components/common/NameBadge/FoldOverBadge.module.scss create mode 100644 frontend/src/components/common/NameBadge/FoldOverBadge.tsx create mode 100644 frontend/src/components/common/NameBadge/NameBadge.module.scss create mode 100644 frontend/src/components/common/NameBadge/ScaledNameBadge.module.scss create mode 100644 frontend/src/components/common/NameBadge/ScaledNameBadge.tsx create mode 100644 frontend/src/components/common/NameBadge/index.tsx create mode 100644 frontend/src/components/layouts/CheckIn/BadgePrinterSettings.tsx create mode 100644 frontend/src/components/layouts/CheckIn/KioskCheckIn.module.scss create mode 100644 frontend/src/components/layouts/CheckIn/KioskCheckIn.tsx create mode 100644 frontend/src/components/modals/PrintBadgesModal/PrintBadgesModal.module.scss create mode 100644 frontend/src/components/modals/PrintBadgesModal/index.tsx create mode 100644 frontend/src/components/routes/event/Badges/BadgeDesigner.module.scss create mode 100644 frontend/src/components/routes/event/Badges/BadgeLinesEditor.tsx create mode 100644 frontend/src/components/routes/event/Badges/BadgePrint.module.scss create mode 100644 frontend/src/components/routes/event/Badges/BadgePrint.tsx create mode 100644 frontend/src/components/routes/event/Badges/BadgeRibbonsEditor.tsx create mode 100644 frontend/src/components/routes/event/Badges/TemplatePicker.tsx create mode 100644 frontend/src/components/routes/event/Badges/index.tsx create mode 100644 frontend/src/components/routes/event/Badges/sampleBadge.ts create mode 100644 frontend/src/components/routes/event/Settings/Sections/FeatureSettings/FeatureSettings.module.scss create mode 100644 frontend/src/components/routes/event/Settings/Sections/FeatureSettings/index.tsx create mode 100644 frontend/src/hooks/useBadgePrinter.ts create mode 100644 frontend/src/hooks/useBadgesPrintedSync.ts create mode 100644 frontend/src/hooks/useEventFeature.ts create mode 100644 frontend/src/mutations/useCreateQuestion.ts create mode 100644 frontend/src/mutations/useMarkBadgesPrinted.ts create mode 100644 frontend/src/mutations/useUpdateBadgeDesign.ts create mode 100644 frontend/src/queries/useGetBadgeDesign.ts create mode 100644 frontend/src/queries/useGetBadgeStats.ts create mode 100644 frontend/src/queries/useGetBadges.ts create mode 100644 frontend/src/utilites/badgePrinting.ts create mode 100644 frontend/src/utilites/badges.ts diff --git a/.claude/rules/features/badges.md b/.claude/rules/features/badges.md new file mode 100644 index 0000000000..10cd1ec098 --- /dev/null +++ b/.claude/rules/features/badges.md @@ -0,0 +1,27 @@ +--- +paths: + - "backend/app/**/Badge/**" + - "backend/app/**/*Badge*.php" + - "backend/tests/**/Badges/**" + - "frontend/src/components/common/NameBadge/**" + - "frontend/src/components/routes/event/Badges/**" + - "frontend/src/components/modals/PrintBadgesModal/**" + - "frontend/src/components/layouts/CheckIn/**" + - "frontend/src/hooks/useBadgePrinter.ts" + - "frontend/src/hooks/useCheckInController.tsx" + - "frontend/src/utilites/badge*.ts" + - "e2e/tests/badges/**" +--- + +# Name badges + +- `BadgeDataService` resolves every badge line (names, ticket type, question answers) on the server. The frontend only renders `Badge` payloads; never resolve answers in the browser. The designer preview uses `buildSampleBadge` sample data, not real attendees. +- The design lives in `event_settings.badge_design_settings`; `null` means "use defaults", which `BadgeDesignService` builds from the event (currency picks A4 or Letter, brand colour and font come from the ticket and homepage designs, company/job title/pronoun questions are bound by title). +- Print status is derived (`AttendeeDomainObject::getBadgePrintStatus`) from `badge_print_count` and `badge_printed_at`. Anything that changes what is printed (name, ticket, seat, an answer on the badge) clears `badge_printed_at` through `BadgeReprintService`; don't add jobs or sweepers that write it. +- Question and ticket ids inside the design are validated against the event on save and remapped by `BadgeDesignCloneService` when an event is duplicated. +- Badges are an opt-in event feature: `EventFeature::BADGES` in `event_settings.enabled_features` (Event Settings → Features), off by default. Off hides every badge control in the UI and switches off door printing (`CheckInListDomainObject::isBadgePrintingActive`); the staff badge endpoints stay available. Seating and box office deliberately stay out of this switch: they show whenever their licence and Cloud flag allow. +- Door printing goes through the public check-in list endpoints and only works on lists with `badge_printing_enabled`; the public layout (`BadgeDesignLayoutResource`) leaves out question and ticket ids. Kiosk lists refuse the attendee list and detail endpoints so attendees can't browse each other. +- Backs print one of three ways (`getDesignBackPrinting`): duplex pages mirror each row for a long-edge flip, fold-over units (`fold_over`) put the back beside a portrait badge or below a landscape one turned 180°, or no back. Door devices choose their own back mode in `useBadgePrinter` settings, defaulting to the design's fold-over or front only. +- Badges render at physical size (`mm` plus container query units) and text shrinks to fit with `FitText`; `FitBody` scales a template's main area down when the lines are taller than the space left. Print through the browser (`window.print()` with an `@page` size); E2E specs stub `window.print` with `stubBrowserPrinting`. +- A door badge includes the answers bound to the design even when the list hides question answers from unauthenticated staff: the organizer chose to print them. +- Door printing queues jobs in `useBadgePrinter`; never replace the job being printed. diff --git a/AGENTS.md b/AGENTS.md index 9fbec27952..7f0e07d45c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -113,6 +113,7 @@ Feature rules live in `.claude/rules/`; Claude Code loads each file automaticall | Enterprise SSO | `.claude/rules/ee/enterprise-sso.md` | | Reserved seating | `.claude/rules/ee/seating.md` | | Lineup & schedule | `.claude/rules/features/lineup.md` | +| Name badges | `.claude/rules/features/badges.md` | | Homepage sections | `.claude/rules/features/homepage-sections.md` | | Embeddable widget | `.claude/rules/features/widget.md` | | Frontend UI patterns | `.claude/rules/frontend/ui.md` | diff --git a/backend/app/DomainObjects/AttendeeDomainObject.php b/backend/app/DomainObjects/AttendeeDomainObject.php index 8c69522427..66f395adaa 100644 --- a/backend/app/DomainObjects/AttendeeDomainObject.php +++ b/backend/app/DomainObjects/AttendeeDomainObject.php @@ -5,6 +5,7 @@ use HiEvents\DomainObjects\Interfaces\IsFilterable; use HiEvents\DomainObjects\Interfaces\IsSortable; use HiEvents\DomainObjects\SortingAndFiltering\AllowedSorts; +use HiEvents\DomainObjects\Status\BadgePrintStatus; use Illuminate\Support\Collection; class AttendeeDomainObject extends Generated\AttendeeDomainObjectAbstract implements IsSortable, IsFilterable @@ -92,6 +93,17 @@ public function getFullName(): string return $this->first_name.' '.$this->last_name; } + public function getBadgePrintStatus(): BadgePrintStatus + { + if ($this->getBadgePrintCount() === 0) { + return BadgePrintStatus::NOT_PRINTED; + } + + return $this->getBadgePrintedAt() === null + ? BadgePrintStatus::NEEDS_REPRINT + : BadgePrintStatus::PRINTED; + } + public function getProduct(): ?ProductDomainObject { return $this->product; diff --git a/backend/app/DomainObjects/CheckInListDomainObject.php b/backend/app/DomainObjects/CheckInListDomainObject.php index 70cfccaf21..bae655f333 100644 --- a/backend/app/DomainObjects/CheckInListDomainObject.php +++ b/backend/app/DomainObjects/CheckInListDomainObject.php @@ -3,8 +3,10 @@ namespace HiEvents\DomainObjects; use Carbon\Carbon; +use HiEvents\DomainObjects\Enums\EventFeature; use HiEvents\DomainObjects\Interfaces\IsSortable; use HiEvents\DomainObjects\SortingAndFiltering\AllowedSorts; +use HiEvents\Services\Domain\Badge\DTO\BadgeDesignDTO; use Illuminate\Support\Collection; class CheckInListDomainObject extends Generated\CheckInListDomainObjectAbstract implements IsSortable @@ -21,6 +23,13 @@ class CheckInListDomainObject extends Generated\CheckInListDomainObjectAbstract private ?string $timezone = null; + private ?BadgeDesignDTO $badgeDesign = null; + + public function isBadgePrintingActive(EventSettingDomainObject $eventSettings): bool + { + return $this->getBadgePrintingEnabled() && $eventSettings->isFeatureEnabled(EventFeature::BADGES); + } + public static function getDefaultSort(): string { return static::CREATED_AT; @@ -125,6 +134,18 @@ public function setCheckedInCount(?int $checkedInCount): static return $this; } + public function getBadgeDesign(): ?BadgeDesignDTO + { + return $this->badgeDesign; + } + + public function setBadgeDesign(?BadgeDesignDTO $badgeDesign): static + { + $this->badgeDesign = $badgeDesign; + + return $this; + } + public function getTotalAttendeesCount(): ?int { return $this->totalAttendeesCount; diff --git a/backend/app/DomainObjects/Enums/BadgeBackMode.php b/backend/app/DomainObjects/Enums/BadgeBackMode.php new file mode 100644 index 0000000000..04172c5269 --- /dev/null +++ b/backend/app/DomainObjects/Enums/BadgeBackMode.php @@ -0,0 +1,12 @@ +name => [200, 200], self::EVENT_GALLERY->name => [400, 300], self::EVENT_SPONSOR_LOGO->name => [80, 40], + self::BADGE_LOGO->name => [100, 40], + self::BADGE_ARTWORK->name => [600, 300], + self::BADGE_SPONSORS->name => [600, 60], self::ORGANIZER_GALLERY->name => [400, 300], self::ORGANIZER_SPONSOR_LOGO->name => [80, 40], ]; diff --git a/backend/app/DomainObjects/EventSettingDomainObject.php b/backend/app/DomainObjects/EventSettingDomainObject.php index c48207c9d0..5f9dad078d 100644 --- a/backend/app/DomainObjects/EventSettingDomainObject.php +++ b/backend/app/DomainObjects/EventSettingDomainObject.php @@ -2,8 +2,17 @@ namespace HiEvents\DomainObjects; +use HiEvents\DomainObjects\Enums\EventFeature; + class EventSettingDomainObject extends Generated\EventSettingDomainObjectAbstract { + public function isFeatureEnabled(EventFeature $feature): bool + { + $features = $this->getEnabledFeatures(); + + return is_array($features) && in_array($feature->value, $features, true); + } + /** * @todo This should not be here. */ diff --git a/backend/app/DomainObjects/Generated/AttendeeDomainObjectAbstract.php b/backend/app/DomainObjects/Generated/AttendeeDomainObjectAbstract.php index 3e68b86ea1..50cf955a13 100644 --- a/backend/app/DomainObjects/Generated/AttendeeDomainObjectAbstract.php +++ b/backend/app/DomainObjects/Generated/AttendeeDomainObjectAbstract.php @@ -32,6 +32,8 @@ abstract class AttendeeDomainObjectAbstract extends \HiEvents\DomainObjects\Abst final public const NOTES = 'notes'; final public const SEAT_UID = 'seat_uid'; final public const SEAT_LABEL = 'seat_label'; + final public const BADGE_PRINTED_AT = 'badge_printed_at'; + final public const BADGE_PRINT_COUNT = 'badge_print_count'; protected int $id; protected int $order_id; @@ -55,6 +57,8 @@ abstract class AttendeeDomainObjectAbstract extends \HiEvents\DomainObjects\Abst protected ?string $notes = null; protected ?string $seat_uid = null; protected ?string $seat_label = null; + protected ?string $badge_printed_at = null; + protected int $badge_print_count = 0; public function toArray(): array { @@ -81,6 +85,8 @@ public function toArray(): array 'notes' => $this->notes ?? null, 'seat_uid' => $this->seat_uid ?? null, 'seat_label' => $this->seat_label ?? null, + 'badge_printed_at' => $this->badge_printed_at ?? null, + 'badge_print_count' => $this->badge_print_count ?? null, ]; } @@ -325,4 +331,26 @@ public function getSeatLabel(): ?string { return $this->seat_label; } + + public function setBadgePrintedAt(?string $badge_printed_at): self + { + $this->badge_printed_at = $badge_printed_at; + return $this; + } + + public function getBadgePrintedAt(): ?string + { + return $this->badge_printed_at; + } + + public function setBadgePrintCount(int $badge_print_count): self + { + $this->badge_print_count = $badge_print_count; + return $this; + } + + public function getBadgePrintCount(): int + { + return $this->badge_print_count; + } } diff --git a/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php b/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php index 984d752462..7c47fae70a 100644 --- a/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php +++ b/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php @@ -25,6 +25,8 @@ abstract class CheckInListDomainObjectAbstract extends \HiEvents\DomainObjects\A final public const PUBLIC_SHOW_QUESTION_ANSWERS = 'public_show_question_answers'; final public const PUBLIC_SHOW_ORDER_DETAILS = 'public_show_order_details'; final public const IS_SYSTEM_DEFAULT = 'is_system_default'; + final public const BADGE_PRINTING_ENABLED = 'badge_printing_enabled'; + final public const KIOSK_MODE = 'kiosk_mode'; protected int $id; protected int $event_id; @@ -41,6 +43,8 @@ abstract class CheckInListDomainObjectAbstract extends \HiEvents\DomainObjects\A protected bool $public_show_question_answers = false; protected bool $public_show_order_details = false; protected bool $is_system_default = false; + protected bool $badge_printing_enabled = false; + protected bool $kiosk_mode = false; public function toArray(): array { @@ -60,6 +64,8 @@ public function toArray(): array 'public_show_question_answers' => $this->public_show_question_answers ?? null, 'public_show_order_details' => $this->public_show_order_details ?? null, 'is_system_default' => $this->is_system_default ?? null, + 'badge_printing_enabled' => $this->badge_printing_enabled ?? null, + 'kiosk_mode' => $this->kiosk_mode ?? null, ]; } @@ -227,4 +233,26 @@ public function getIsSystemDefault(): bool { return $this->is_system_default; } + + public function setBadgePrintingEnabled(bool $badge_printing_enabled): self + { + $this->badge_printing_enabled = $badge_printing_enabled; + return $this; + } + + public function getBadgePrintingEnabled(): bool + { + return $this->badge_printing_enabled; + } + + public function setKioskMode(bool $kiosk_mode): self + { + $this->kiosk_mode = $kiosk_mode; + return $this; + } + + public function getKioskMode(): bool + { + return $this->kiosk_mode; + } } diff --git a/backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php b/backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php index 487084ccbd..6350f75ea1 100644 --- a/backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php +++ b/backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php @@ -143,6 +143,10 @@ abstract class EventSettingDomainObjectAbstract extends AbstractDomainObject final public const PAYMENT_LINK_EXPIRY_HOURS = 'payment_link_expiry_hours'; + final public const BADGE_DESIGN_SETTINGS = 'badge_design_settings'; + + final public const ENABLED_FEATURES = 'enabled_features'; + protected int $id; protected int $event_id; @@ -273,6 +277,10 @@ abstract class EventSettingDomainObjectAbstract extends AbstractDomainObject protected int $payment_link_expiry_hours = 72; + protected array|string|null $badge_design_settings = null; + + protected array|string|null $enabled_features = null; + public function toArray(): array { return [ @@ -341,6 +349,8 @@ public function toArray(): array 'offline_payment_order_reference_enabled' => $this->offline_payment_order_reference_enabled ?? null, 'payment_links_enabled' => $this->payment_links_enabled ?? null, 'payment_link_expiry_hours' => $this->payment_link_expiry_hours ?? null, + 'badge_design_settings' => $this->badge_design_settings ?? null, + 'enabled_features' => $this->enabled_features ?? null, ]; } @@ -1124,4 +1134,28 @@ public function getPaymentLinkExpiryHours(): int { return $this->payment_link_expiry_hours; } + + public function setBadgeDesignSettings(array|string|null $badge_design_settings): self + { + $this->badge_design_settings = $badge_design_settings; + + return $this; + } + + public function getBadgeDesignSettings(): array|string|null + { + return $this->badge_design_settings; + } + + public function setEnabledFeatures(array|string|null $enabled_features): self + { + $this->enabled_features = $enabled_features; + + return $this; + } + + public function getEnabledFeatures(): array|string|null + { + return $this->enabled_features; + } } diff --git a/backend/app/DomainObjects/Status/BadgePrintStatus.php b/backend/app/DomainObjects/Status/BadgePrintStatus.php new file mode 100644 index 0000000000..ff374b27db --- /dev/null +++ b/backend/app/DomainObjects/Status/BadgePrintStatus.php @@ -0,0 +1,14 @@ +field; + } +} diff --git a/backend/app/Http/Actions/Badges/GetBadgeDesignAction.php b/backend/app/Http/Actions/Badges/GetBadgeDesignAction.php new file mode 100644 index 0000000000..4e74419fde --- /dev/null +++ b/backend/app/Http/Actions/Badges/GetBadgeDesignAction.php @@ -0,0 +1,28 @@ +isActionAuthorized($eventId, EventDomainObject::class); + + return $this->resourceResponse( + resource: BadgeDesignResource::class, + data: $this->handler->handle($eventId), + ); + } +} diff --git a/backend/app/Http/Actions/Badges/GetBadgeStatsAction.php b/backend/app/Http/Actions/Badges/GetBadgeStatsAction.php new file mode 100644 index 0000000000..252faaac3d --- /dev/null +++ b/backend/app/Http/Actions/Badges/GetBadgeStatsAction.php @@ -0,0 +1,35 @@ +isActionAuthorized($eventId, EventDomainObject::class); + + $request->validate([ + 'event_occurrence_id' => ['nullable', 'integer'], + ]); + + $occurrenceId = $request->query('event_occurrence_id'); + + return $this->resourceResponse( + resource: BadgeStatsResource::class, + data: $this->handler->handle($eventId, $occurrenceId === null ? null : (int) $occurrenceId), + ); + } +} diff --git a/backend/app/Http/Actions/Badges/GetBadgesAction.php b/backend/app/Http/Actions/Badges/GetBadgesAction.php new file mode 100644 index 0000000000..e41de94a74 --- /dev/null +++ b/backend/app/Http/Actions/Badges/GetBadgesAction.php @@ -0,0 +1,43 @@ +isActionAuthorized($eventId, EventDomainObject::class); + + $badges = $this->handler->handle(new GetBadgesDTO( + event_id: $eventId, + attendee_ids: $request->idList('attendee_ids'), + order_id: $request->validated('order_id') === null ? null : (int) $request->validated('order_id'), + product_ids: $request->idList('product_ids'), + event_occurrence_id: $request->validated('event_occurrence_id') === null ? null : (int) $request->validated('event_occurrence_id'), + only_unprinted: $request->boolean('only_unprinted'), + sort_by: $request->validated('sort_by') ?? BadgeAttendeeQueryDTO::SORT_LAST_NAME, + page: (int) ($request->validated('page') ?? 1), + per_page: (int) ($request->validated('per_page') ?? 100), + )); + + return $this->resourceResponse( + resource: BadgeResource::class, + data: $badges, + ); + } +} diff --git a/backend/app/Http/Actions/Badges/MarkBadgesPrintedAction.php b/backend/app/Http/Actions/Badges/MarkBadgesPrintedAction.php new file mode 100644 index 0000000000..7239e8326c --- /dev/null +++ b/backend/app/Http/Actions/Badges/MarkBadgesPrintedAction.php @@ -0,0 +1,39 @@ +isActionAuthorized($eventId, EventDomainObject::class); + + try { + $updated = $this->handler->handle( + eventId: $eventId, + attendeeIds: array_map('intval', $request->validated('attendee_ids')), + ); + } catch (ResourceNotFoundException $exception) { + throw ValidationException::withMessages(['attendee_ids' => $exception->getMessage()]); + } + + return $this->jsonResponse(['updated' => $updated], wrapInData: true); + } +} diff --git a/backend/app/Http/Actions/Badges/Public/GetCheckInListAttendeeBadgePublicAction.php b/backend/app/Http/Actions/Badges/Public/GetCheckInListAttendeeBadgePublicAction.php new file mode 100644 index 0000000000..6eda6c5db7 --- /dev/null +++ b/backend/app/Http/Actions/Badges/Public/GetCheckInListAttendeeBadgePublicAction.php @@ -0,0 +1,36 @@ +handler->handle($checkInListShortId, $attendeePublicId); + } catch (CannotCheckInException $exception) { + return $this->errorResponse( + message: $exception->getMessage(), + statusCode: Response::HTTP_FORBIDDEN, + ); + } + + return $this->resourceResponse( + resource: BadgeResource::class, + data: $badge, + ); + } +} diff --git a/backend/app/Http/Actions/Badges/Public/MarkCheckInListAttendeeBadgePrintedPublicAction.php b/backend/app/Http/Actions/Badges/Public/MarkCheckInListAttendeeBadgePrintedPublicAction.php new file mode 100644 index 0000000000..1b18959b3f --- /dev/null +++ b/backend/app/Http/Actions/Badges/Public/MarkCheckInListAttendeeBadgePrintedPublicAction.php @@ -0,0 +1,36 @@ +handler->handle($checkInListShortId, $attendeePublicId); + } catch (CannotCheckInException $exception) { + return $this->errorResponse( + message: $exception->getMessage(), + statusCode: Response::HTTP_FORBIDDEN, + ); + } + + return $this->resourceResponse( + resource: BadgeResource::class, + data: $badge, + ); + } +} diff --git a/backend/app/Http/Actions/Badges/UpsertBadgeDesignAction.php b/backend/app/Http/Actions/Badges/UpsertBadgeDesignAction.php new file mode 100644 index 0000000000..a348a319a5 --- /dev/null +++ b/backend/app/Http/Actions/Badges/UpsertBadgeDesignAction.php @@ -0,0 +1,41 @@ +isActionAuthorized($eventId, EventDomainObject::class); + + try { + $result = $this->handler->handle($eventId, BadgeDesignDTO::from($request->validated())); + } catch (InvalidBadgeDesignException $exception) { + throw ValidationException::withMessages([$exception->getField() => $exception->getMessage()]); + } + + return $this->resourceResponse( + resource: BadgeDesignResource::class, + data: $result, + ); + } +} diff --git a/backend/app/Http/Actions/CheckInLists/CreateCheckInListAction.php b/backend/app/Http/Actions/CheckInLists/CreateCheckInListAction.php index b6d1a779ae..bd69af36fe 100644 --- a/backend/app/Http/Actions/CheckInLists/CreateCheckInListAction.php +++ b/backend/app/Http/Actions/CheckInLists/CreateCheckInListAction.php @@ -35,6 +35,8 @@ public function __invoke(UpsertCheckInListRequest $request, int $eventId): JsonR publicShowAttendeeNotes: $request->validated('public_show_attendee_notes') ?? false, publicShowQuestionAnswers: $request->validated('public_show_question_answers') ?? false, publicShowOrderDetails: $request->validated('public_show_order_details') ?? false, + badgePrintingEnabled: $request->validated('badge_printing_enabled') ?? false, + kioskMode: $request->validated('kiosk_mode') ?? false, ) ); } catch (UnrecognizedProductIdException $exception) { diff --git a/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php b/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php index 5db8972201..182106547e 100644 --- a/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php +++ b/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php @@ -36,6 +36,8 @@ public function __invoke(UpsertCheckInListRequest $request, int $eventId, int $c publicShowAttendeeNotes: $request->validated('public_show_attendee_notes') ?? false, publicShowQuestionAnswers: $request->validated('public_show_question_answers') ?? false, publicShowOrderDetails: $request->validated('public_show_order_details') ?? false, + badgePrintingEnabled: $request->validated('badge_printing_enabled'), + kioskMode: $request->validated('kiosk_mode'), ) ); } catch (UnrecognizedProductIdException $exception) { diff --git a/backend/app/Http/Request/Badge/GetBadgesRequest.php b/backend/app/Http/Request/Badge/GetBadgesRequest.php new file mode 100644 index 0000000000..a542acea56 --- /dev/null +++ b/backend/app/Http/Request/Badge/GetBadgesRequest.php @@ -0,0 +1,49 @@ + ['nullable', 'string', 'max:2400', self::ID_LIST], + 'product_ids' => ['nullable', 'string', 'max:2400', self::ID_LIST], + 'order_id' => ['nullable', 'integer'], + 'event_occurrence_id' => ['nullable', 'integer'], + 'only_unprinted' => ['nullable', Rule::in(['true', 'false', '1', '0'])], + 'sort_by' => ['nullable', Rule::in(BadgeAttendeeQueryDTO::SORTS)], + 'page' => ['nullable', 'integer', 'min:1'], + 'per_page' => ['nullable', 'integer', 'min:1', 'max:'.BadgeAttendeeQueryDTO::MAX_PER_PAGE], + ]; + } + + /** + * @return int[]|null + */ + public function idList(string $key): ?array + { + $value = $this->validated($key); + if ($value === null || $value === '') { + return null; + } + + return array_values(array_unique(array_map('intval', explode(',', $value)))); + } + + public function messages(): array + { + return [ + 'attendee_ids.regex' => __('Attendee IDs must be a comma-separated list of numbers.'), + 'product_ids.regex' => __('Product IDs must be a comma-separated list of numbers.'), + ]; + } +} diff --git a/backend/app/Http/Request/Badge/MarkBadgesPrintedRequest.php b/backend/app/Http/Request/Badge/MarkBadgesPrintedRequest.php new file mode 100644 index 0000000000..987918d59c --- /dev/null +++ b/backend/app/Http/Request/Badge/MarkBadgesPrintedRequest.php @@ -0,0 +1,34 @@ + ['required', 'array', 'min:1', 'max:'.BadgeAttendeeQueryDTO::MAX_PER_PAGE], + 'attendee_ids.*' => ['required', 'integer'], + ]; + } + + public function withValidator(Validator $validator): void + { + $validator->after(function (Validator $validator) { + if ($validator->errors()->isNotEmpty()) { + return; + } + + $ids = $this->input('attendee_ids'); + if (is_array($ids) && count($ids) !== count(array_unique($ids))) { + $validator->errors()->add('attendee_ids', __('Each attendee can only be listed once.')); + } + }); + } +} diff --git a/backend/app/Http/Request/Badge/UpsertBadgeDesignRequest.php b/backend/app/Http/Request/Badge/UpsertBadgeDesignRequest.php new file mode 100644 index 0000000000..b66fe0e11a --- /dev/null +++ b/backend/app/Http/Request/Badge/UpsertBadgeDesignRequest.php @@ -0,0 +1,102 @@ + ['required', Rule::in(BadgeTemplate::valuesArray())], + 'size' => ['required', Rule::in(BadgeSize::valuesArray())], + 'custom_width_mm' => ['nullable', 'integer', 'min:40', 'max:220', 'required_if:size,'.BadgeSize::CUSTOM->value], + 'custom_height_mm' => ['nullable', 'integer', 'min:40', 'max:220', 'required_if:size,'.BadgeSize::CUSTOM->value], + 'sheet' => ['required', Rule::in(BadgeSheet::valuesArray())], + 'accent_color' => ['required', 'string', self::HEX_COLOR], + 'background_color' => ['nullable', 'string', self::HEX_COLOR], + 'text_color' => ['nullable', 'string', self::HEX_COLOR], + 'font_family' => ['required', Rule::in(HomepageFontFamily::valuesArray())], + 'text_align' => ['nullable', Rule::in(self::TEXT_ALIGNMENTS)], + 'uppercase_names' => ['required', 'boolean'], + 'lines' => ['required', 'array', 'min:1', 'max:'.self::MAX_LINES], + 'lines.*.source' => ['required', Rule::in(BadgeFieldSource::valuesArray())], + 'lines.*.size' => ['required', Rule::in(BadgeTextSize::valuesArray())], + 'lines.*.question_id' => ['nullable', 'integer', 'required_if:lines.*.source,'.BadgeFieldSource::QUESTION->value], + 'lines.*.text' => ['nullable', 'string', 'max:80', 'required_if:lines.*.source,'.BadgeFieldSource::CUSTOM_TEXT->value], + 'show_logo' => ['required', 'boolean'], + 'show_qr' => ['required', 'boolean'], + 'show_ribbon' => ['required', 'boolean'], + 'show_seat' => ['required', 'boolean'], + 'show_event_name' => ['required', 'boolean'], + 'show_sponsors' => ['required', 'boolean'], + 'footer_text' => ['nullable', 'string', 'max:120'], + 'ribbons' => ['present', 'array', 'max:'.self::MAX_RIBBONS], + 'ribbons.*.product_id' => ['required', 'integer'], + 'ribbons.*.label' => ['nullable', 'string', 'max:40'], + 'ribbons.*.color' => ['required', 'string', self::HEX_COLOR], + 'back_mode' => ['required', Rule::in(BadgeBackMode::valuesArray())], + 'back_text' => ['nullable', 'string', 'max:600'], + 'fold_over' => ['sometimes', 'boolean'], + ]; + } + + public function withValidator(Validator $validator): void + { + $validator->after(function (Validator $validator) { + $ribbons = $this->input('ribbons'); + if (! is_array($ribbons)) { + return; + } + + $seen = []; + foreach ($ribbons as $index => $ribbon) { + $productId = is_array($ribbon) ? ($ribbon['product_id'] ?? null) : null; + if (! is_scalar($productId) || (! is_int($productId) && ! ctype_digit((string) $productId))) { + continue; + } + + if (isset($seen[(int) $productId])) { + $validator->errors()->add("ribbons.$index.product_id", __('Each ticket can only have one ribbon.')); + } + $seen[(int) $productId] = true; + } + }); + } + + public function messages(): array + { + $colorMessage = __('Please enter a 6-digit hex colour, for example #1f2937.'); + + return [ + 'accent_color.regex' => $colorMessage, + 'background_color.regex' => $colorMessage, + 'text_color.regex' => $colorMessage, + 'ribbons.*.color.regex' => $colorMessage, + 'lines.*.question_id.required_if' => __('Choose a question for this line.'), + 'lines.*.text.required_if' => __('Enter the text for this line.'), + 'custom_width_mm.required_if' => __('Enter a width for your custom size.'), + 'custom_height_mm.required_if' => __('Enter a height for your custom size.'), + ]; + } +} diff --git a/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php b/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php index 979fa24715..98bea751d2 100644 --- a/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php +++ b/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php @@ -28,6 +28,8 @@ public function rules(): array 'public_show_attendee_notes' => ['nullable', 'boolean'], 'public_show_question_answers' => ['nullable', 'boolean'], 'public_show_order_details' => ['nullable', 'boolean'], + 'badge_printing_enabled' => ['nullable', 'boolean'], + 'kiosk_mode' => ['nullable', 'boolean'], ]; } diff --git a/backend/app/Http/Request/EventSettings/UpdateEventSettingsRequest.php b/backend/app/Http/Request/EventSettings/UpdateEventSettingsRequest.php index 24c6d23391..9fbddf98fe 100644 --- a/backend/app/Http/Request/EventSettings/UpdateEventSettingsRequest.php +++ b/backend/app/Http/Request/EventSettings/UpdateEventSettingsRequest.php @@ -3,6 +3,7 @@ namespace HiEvents\Http\Request\EventSettings; use HiEvents\DomainObjects\Enums\AttendeeDetailsCollectionMethod; +use HiEvents\DomainObjects\Enums\EventFeature; use HiEvents\DomainObjects\Enums\HomepageBackgroundType; use HiEvents\DomainObjects\Enums\HomepageFontFamily; use HiEvents\DomainObjects\Enums\HomepageLayout; @@ -72,7 +73,6 @@ public function rules(): array 'price_display_mode' => [Rule::in(PriceDisplayMode::valuesArray())], - // Payment settings 'payment_providers' => ['array'], 'payment_providers.*' => ['string', Rule::in(PaymentProviders::valuesArray())], 'offline_payment_instructions' => ['string', 'nullable', Rule::requiredIf(fn () => in_array(PaymentProviders::OFFLINE->name, $this->input('payment_providers', []), true))], @@ -82,7 +82,6 @@ public function rules(): array 'payment_links_enabled' => ['boolean'], 'payment_link_expiry_hours' => ['integer', 'min:1', 'max:720'], - // Invoice settings 'enable_invoicing' => ['boolean'], 'invoice_label' => ['nullable', 'string', 'max:50'], 'invoice_prefix' => ['nullable', 'string', 'max:10', 'regex:/^[A-Za-z0-9\-]*$/'], @@ -94,7 +93,6 @@ public function rules(): array 'invoice_notes' => ['nullable', 'string'], 'invoice_payment_terms_days' => ['nullable', 'integer', 'gte:0', 'lte:1000'], - // Ticket design settings 'ticket_design_settings' => ['nullable', 'array'], 'ticket_design_settings.accent_color' => ['nullable', 'string', ...RulesHelper::HEX_COLOR], 'ticket_design_settings.logo_image_id' => ['nullable', 'integer'], @@ -103,16 +101,12 @@ public function rules(): array 'ticket_design_settings.date_display_mode' => ['nullable', 'string', Rule::in(TicketDateDisplayMode::valuesArray())], 'ticket_design_settings.enabled' => ['boolean'], - // Marketing settings 'show_marketing_opt_in' => ['boolean'], - // Attendee detail copy control 'allow_copy_details_to_all_attendees' => ['boolean'], - // Platform fee settings 'pass_platform_fee_to_buyer' => ['boolean'], - // Homepage theme settings 'homepage_theme_settings' => ['nullable', 'array'], 'homepage_theme_settings.accent' => ['nullable', 'string', ...RulesHelper::HEX_COLOR], 'homepage_theme_settings.background' => ['nullable', 'string', ...RulesHelper::HEX_COLOR], @@ -122,16 +116,16 @@ public function rules(): array 'homepage_theme_settings.layout' => ['nullable', 'string', Rule::in(HomepageLayout::valuesArray())], ...HomepageSectionRules::rules(HomepageSectionType::eventValues()), - // Self-service settings 'allow_attendee_self_edit' => ['boolean'], - // Occurrence display 'show_available_occurrence_capacity' => ['boolean'], 'hide_sold_out_occurrences' => ['boolean'], - // Waitlist settings 'waitlist_auto_process' => ['boolean'], 'waitlist_offer_timeout_minutes' => ['nullable', 'integer', 'min:1', 'max:10080'], + + 'enabled_features' => ['sometimes', 'array'], + 'enabled_features.*' => ['string', Rule::in(EventFeature::valuesArray())], ]; } @@ -149,22 +143,18 @@ public function messages(): array 'homepage_product_widget_text_color' => $colorMessage, 'price_display_mode.in' => 'The price display mode must be either inclusive or exclusive.', - // Payment messages 'payment_providers.*.in' => __('Invalid payment provider selected.'), 'offline_payment_instructions.required' => __('Payment instructions are required when offline payments are enabled.'), - // Invoice messages 'invoice_prefix.regex' => __('The invoice prefix may only contain letters, numbers, and hyphens.'), 'organization_name.required_if' => __('The organization name is required when invoicing is enabled.'), 'organization_address.required_if' => __('The organization address is required when invoicing is enabled.'), 'invoice_start_number.min' => __('The invoice start number must be at least 1.'), - // Ticket design messages 'ticket_design_settings.accent_color' => $colorMessage, 'ticket_design_settings.footer_text.max' => __('The footer text may not be greater than 500 characters.'), 'ticket_design_settings.layout_type.in' => __('The layout type must be default or modern.'), - // Homepage theme settings messages 'homepage_theme_settings.accent' => $colorMessage, 'homepage_theme_settings.background' => $colorMessage, 'homepage_theme_settings.mode.in' => __('The mode must be light or dark.'), diff --git a/backend/app/Models/EventSetting.php b/backend/app/Models/EventSetting.php index 0839bfa285..c214a760fb 100644 --- a/backend/app/Models/EventSetting.php +++ b/backend/app/Models/EventSetting.php @@ -15,6 +15,8 @@ protected function getCastMap(): array 'ticket_design_settings' => 'array', 'homepage_theme_settings' => 'array', 'homepage_sections' => 'array', + 'badge_design_settings' => 'array', + 'enabled_features' => 'array', ]; } } diff --git a/backend/app/Repository/DTO/BadgeAttendeeQueryDTO.php b/backend/app/Repository/DTO/BadgeAttendeeQueryDTO.php new file mode 100644 index 0000000000..1258fd20a7 --- /dev/null +++ b/backend/app/Repository/DTO/BadgeAttendeeQueryDTO.php @@ -0,0 +1,44 @@ +model = $this->badgeEligibleQuery($this->model, $query->event_id, $query->include_awaiting_payment) + ->select('attendees.*'); + + if ($query->attendee_ids !== null) { + $this->model = $this->model->whereIn('attendees.id', $query->attendee_ids); + } + + if ($query->order_id !== null) { + $this->model = $this->model->where('attendees.order_id', $query->order_id); + } + + if ($query->product_ids !== null && $query->product_ids !== []) { + $this->model = $this->model->whereIn('attendees.product_id', $query->product_ids); + } + + if ($query->event_occurrence_id !== null) { + $this->model = $this->model->where('attendees.event_occurrence_id', $query->event_occurrence_id); + } + + if ($query->only_unprinted) { + $this->model = $this->model->whereNull('attendees.badge_printed_at'); + } + + $this->model = match ($query->sort_by) { + BadgeAttendeeQueryDTO::SORT_FIRST_NAME => $this->model + ->orderByRaw('lower(attendees.first_name) asc nulls last, lower(attendees.last_name) asc nulls last'), + BadgeAttendeeQueryDTO::SORT_PRODUCT => $this->model + ->leftJoin('products', 'products.id', '=', 'attendees.product_id') + ->orderBy('products.title') + ->orderByRaw('lower(attendees.last_name) asc nulls last, lower(attendees.first_name) asc nulls last'), + BadgeAttendeeQueryDTO::SORT_CREATED_AT => $this->model, + default => $this->model + ->orderByRaw('lower(attendees.last_name) asc nulls last, lower(attendees.first_name) asc nulls last'), + }; + + $this->model = $this->model->orderBy('attendees.id'); + + $this->loadRelation(new Relationship(ProductDomainObject::class, name: 'product')); + $this->loadRelation(new Relationship(EventOccurrenceDomainObject::class, name: 'event_occurrence')); + $this->setMaxPerPage(BadgeAttendeeQueryDTO::MAX_PER_PAGE); + + return $this->paginateWhere( + where: [], + limit: $query->per_page, + page: $query->page, + ); + } + + public function getBadgeStats(int $eventId, bool $includeAwaitingPayment, ?int $eventOccurrenceId = null): BadgeStatsDTO + { + return $this->runQuery(function () use ($eventId, $includeAwaitingPayment, $eventOccurrenceId) { + $query = $this->badgeEligibleQuery(Attendee::query(), $eventId, $includeAwaitingPayment); + + if ($eventOccurrenceId !== null) { + $query->where('attendees.event_occurrence_id', $eventOccurrenceId); + } + + $row = $query->selectRaw(' + COUNT(*) AS total, + COUNT(*) FILTER (WHERE attendees.badge_printed_at IS NOT NULL) AS printed, + COUNT(*) FILTER (WHERE attendees.badge_print_count = 0) AS not_printed, + COUNT(*) FILTER (WHERE attendees.badge_print_count > 0 AND attendees.badge_printed_at IS NULL) AS needs_reprint + ')->first(); + + return new BadgeStatsDTO( + total: (int) $row->total, + printed: (int) $row->printed, + not_printed: (int) $row->not_printed, + needs_reprint: (int) $row->needs_reprint, + ); + }); + } + + private function badgeEligibleQuery(Builder|Model $query, int $eventId, bool $includeAwaitingPayment): Builder + { + $attendeeStatuses = [AttendeeStatus::ACTIVE->name]; + $orderStatuses = [OrderStatus::COMPLETED->name]; + + if ($includeAwaitingPayment) { + $attendeeStatuses[] = AttendeeStatus::AWAITING_PAYMENT->name; + $orderStatuses[] = OrderStatus::AWAITING_OFFLINE_PAYMENT->name; + } + + return $query + ->join('orders', 'orders.id', '=', 'attendees.order_id') + ->where('attendees.event_id', $eventId) + ->whereNull('attendees.deleted_at') + ->whereNull('orders.deleted_at') + ->whereIn('attendees.status', $attendeeStatuses) + ->whereIn('orders.status', $orderStatuses); + } + public function getSoldQuantitiesByPriceForOccurrence(int $occurrenceId): array { return $this->runQuery(fn () => $this->soldAttendeesQuery() diff --git a/backend/app/Repository/Interfaces/AttendeeRepositoryInterface.php b/backend/app/Repository/Interfaces/AttendeeRepositoryInterface.php index 262cb8df38..01a935ccc5 100644 --- a/backend/app/Repository/Interfaces/AttendeeRepositoryInterface.php +++ b/backend/app/Repository/Interfaces/AttendeeRepositoryInterface.php @@ -4,6 +4,8 @@ use HiEvents\DomainObjects\AttendeeDomainObject; use HiEvents\Http\DTO\QueryParamsDTO; +use HiEvents\Repository\DTO\BadgeAttendeeQueryDTO; +use HiEvents\Repository\DTO\BadgeStatsDTO; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -19,6 +21,10 @@ public function findByEventIdForExport(int $eventId, ?int $eventOccurrenceId = n public function getAttendeesByCheckInShortId(string $shortId, QueryParamsDTO $params): Paginator; + public function findForBadges(BadgeAttendeeQueryDTO $query): LengthAwarePaginator; + + public function getBadgeStats(int $eventId, bool $includeAwaitingPayment, ?int $eventOccurrenceId = null): BadgeStatsDTO; + /** * @return array product_price_id => quantity */ diff --git a/backend/app/Resources/Attendee/AttendeeDetailPublicResource.php b/backend/app/Resources/Attendee/AttendeeDetailPublicResource.php index e1aa8682b3..ee67fd883e 100644 --- a/backend/app/Resources/Attendee/AttendeeDetailPublicResource.php +++ b/backend/app/Resources/Attendee/AttendeeDetailPublicResource.php @@ -30,6 +30,9 @@ public function toArray(Request $request): array 'last_name' => $attendee->getLastName(), 'status' => $attendee->getStatus(), 'seat_label' => $attendee->getSeatLabel(), + 'badge_print_count' => $attendee->getBadgePrintCount(), + /** @var 'NOT_PRINTED'|'PRINTED'|'NEEDS_REPRINT' */ + 'badge_print_status' => $attendee->getBadgePrintStatus()->value, 'product_id' => $attendee->getProductId(), 'product_title' => $product?->getTitle(), 'event_occurrence' => $occurrence diff --git a/backend/app/Resources/Attendee/AttendeeResource.php b/backend/app/Resources/Attendee/AttendeeResource.php index 74ff95da63..9b78bfce5f 100644 --- a/backend/app/Resources/Attendee/AttendeeResource.php +++ b/backend/app/Resources/Attendee/AttendeeResource.php @@ -37,6 +37,10 @@ public function toArray(Request $request): array 'seat_label' => $this->getSeatLabel(), 'locale' => $this->getLocale(), 'notes' => $this->getNotes(), + 'badge_printed_at' => $this->getBadgePrintedAt(), + 'badge_print_count' => $this->getBadgePrintCount(), + /** @var 'NOT_PRINTED'|'PRINTED'|'NEEDS_REPRINT' */ + 'badge_print_status' => $this->getBadgePrintStatus()->value, 'event_occurrence' => $this->when( ! is_null($this->getEventOccurrence()), fn () => new EventOccurrenceResource($this->getEventOccurrence()), diff --git a/backend/app/Resources/Badge/BadgeDesignLayoutResource.php b/backend/app/Resources/Badge/BadgeDesignLayoutResource.php new file mode 100644 index 0000000000..917234f3af --- /dev/null +++ b/backend/app/Resources/Badge/BadgeDesignLayoutResource.php @@ -0,0 +1,47 @@ + $this->template->value, + /** @var 'A6_PORTRAIT'|'A7_PORTRAIT'|'IN_4X3_LANDSCAPE'|'IN_3X4_PORTRAIT'|'IN_4X6_PORTRAIT'|'CR80_PORTRAIT'|'CR80_LANDSCAPE'|'LABEL_62X100'|'CUSTOM' */ + 'size' => $this->size->value, + 'custom_width_mm' => $this->custom_width_mm, + 'custom_height_mm' => $this->custom_height_mm, + /** @var 'A4'|'LETTER'|'NONE' */ + 'sheet' => $this->sheet->value, + 'accent_color' => $this->accent_color, + 'background_color' => $this->background_color, + 'text_color' => $this->text_color, + 'font_family' => $this->font_family, + /** @var 'LEFT'|'CENTER'|null */ + 'text_align' => $this->text_align, + 'uppercase_names' => $this->uppercase_names, + 'show_logo' => $this->show_logo, + 'show_qr' => $this->show_qr, + 'show_ribbon' => $this->show_ribbon, + 'show_seat' => $this->show_seat, + 'show_event_name' => $this->show_event_name, + 'show_sponsors' => $this->show_sponsors, + 'footer_text' => $this->footer_text, + /** @var 'NONE'|'SAME'|'INFO' */ + 'back_mode' => $this->back_mode->value, + 'back_text' => $this->back_text, + 'fold_over' => $this->fold_over, + ]; + } +} diff --git a/backend/app/Resources/Badge/BadgeDesignResource.php b/backend/app/Resources/Badge/BadgeDesignResource.php new file mode 100644 index 0000000000..f383e8f0ef --- /dev/null +++ b/backend/app/Resources/Badge/BadgeDesignResource.php @@ -0,0 +1,38 @@ +design))->toArray($request), + 'lines' => collect($this->design->lines)->map(fn (BadgeLineDTO $line) => [ + /** @var 'FIRST_NAME'|'LAST_NAME'|'FULL_NAME'|'TICKET_TYPE'|'QUESTION'|'OCCURRENCE_DATE'|'CUSTOM_TEXT' */ + 'source' => $line->source->value, + /** @var 'XL'|'L'|'M'|'S' */ + 'size' => $line->size->value, + 'question_id' => $line->question_id, + 'text' => $line->text, + ])->values()->all(), + 'ribbons' => collect($this->design->ribbons)->map(fn (BadgeRibbonDTO $ribbon) => [ + 'product_id' => $ribbon->product_id, + 'label' => $ribbon->label, + 'color' => $ribbon->color, + ])->values()->all(), + 'is_customized' => $this->is_customized, + ]; + } +} diff --git a/backend/app/Resources/Badge/BadgeResource.php b/backend/app/Resources/Badge/BadgeResource.php new file mode 100644 index 0000000000..3a75e464c6 --- /dev/null +++ b/backend/app/Resources/Badge/BadgeResource.php @@ -0,0 +1,47 @@ + $this->attendee_id, + 'attendee_public_id' => $this->attendee_public_id, + 'order_id' => $this->order_id, + 'product_id' => $this->product_id, + 'event_occurrence_id' => $this->event_occurrence_id, + /** @var 'ACTIVE'|'AWAITING_PAYMENT'|'CANCELLED' */ + 'status' => $this->status, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'lines' => collect($this->lines)->map(fn (BadgeLineDTO $line) => [ + /** @var 'FIRST_NAME'|'LAST_NAME'|'FULL_NAME'|'TICKET_TYPE'|'QUESTION'|'OCCURRENCE_DATE'|'CUSTOM_TEXT' */ + 'source' => $line->source->value, + /** @var 'XL'|'L'|'M'|'S' */ + 'size' => $line->size->value, + 'text' => $line->text, + ])->values()->all(), + 'ribbon' => $this->ribbon === null ? null : [ + 'label' => $this->ribbon->label, + 'color' => $this->ribbon->color, + ], + 'seat_label' => $this->seat_label, + 'badge_printed_at' => $this->badge_printed_at, + 'badge_print_count' => $this->badge_print_count, + /** @var 'NOT_PRINTED'|'PRINTED'|'NEEDS_REPRINT' */ + 'print_status' => $this->print_status->value, + ]; + } +} diff --git a/backend/app/Resources/Badge/BadgeStatsResource.php b/backend/app/Resources/Badge/BadgeStatsResource.php new file mode 100644 index 0000000000..902f6ad224 --- /dev/null +++ b/backend/app/Resources/Badge/BadgeStatsResource.php @@ -0,0 +1,25 @@ + $this->total, + 'printed' => $this->printed, + 'not_printed' => $this->not_printed, + 'needs_reprint' => $this->needs_reprint, + ]; + } +} diff --git a/backend/app/Resources/CheckInList/CheckInListResource.php b/backend/app/Resources/CheckInList/CheckInListResource.php index 9688b9c10d..7908265b12 100644 --- a/backend/app/Resources/CheckInList/CheckInListResource.php +++ b/backend/app/Resources/CheckInList/CheckInListResource.php @@ -28,6 +28,8 @@ public function toArray($request): array 'public_show_attendee_notes' => $this->getPublicShowAttendeeNotes(), 'public_show_question_answers' => $this->getPublicShowQuestionAnswers(), 'public_show_order_details' => $this->getPublicShowOrderDetails(), + 'badge_printing_enabled' => $this->getBadgePrintingEnabled(), + 'kiosk_mode' => $this->getKioskMode(), $this->mergeWhen($this->getEvent() !== null, fn () => [ 'is_expired' => $this->isExpired($this->getEvent()->getTimezone()), 'is_active' => $this->isActivated($this->getEvent()->getTimezone()), diff --git a/backend/app/Resources/CheckInList/CheckInListResourcePublic.php b/backend/app/Resources/CheckInList/CheckInListResourcePublic.php index b1f0b7a063..7e99a46ada 100644 --- a/backend/app/Resources/CheckInList/CheckInListResourcePublic.php +++ b/backend/app/Resources/CheckInList/CheckInListResourcePublic.php @@ -4,6 +4,7 @@ use HiEvents\DomainObjects\CheckInListDomainObject; use HiEvents\DomainObjects\EventOccurrenceDomainObject; +use HiEvents\Resources\Badge\BadgeDesignLayoutResource; use HiEvents\Resources\Event\EventResourcePublic; use HiEvents\Resources\EventOccurrence\EventOccurrenceResourcePublic; use HiEvents\Resources\Product\ProductMinimalResourcePublic; @@ -33,6 +34,11 @@ public function toArray($request): array 'public_show_attendee_notes' => $this->getPublicShowAttendeeNotes(), 'public_show_question_answers' => $this->getPublicShowQuestionAnswers(), 'public_show_order_details' => $this->getPublicShowOrderDetails(), + 'badge_printing_enabled' => $this->getBadgeDesign() !== null, + 'kiosk_mode' => $this->getKioskMode(), + $this->mergeWhen($this->getBadgeDesign() !== null, fn () => [ + 'badge_design' => (new BadgeDesignLayoutResource($this->getBadgeDesign()))->toArray($request), + ]), $this->mergeWhen($this->getEvent() !== null, fn () => [ 'is_expired' => $this->isExpired($this->getEvent()->getTimezone()), 'is_active' => $this->isActivated($this->getEvent()->getTimezone()), diff --git a/backend/app/Resources/Event/EventSettingsResource.php b/backend/app/Resources/Event/EventSettingsResource.php index 2fc5bfe76a..480cb7c83a 100644 --- a/backend/app/Resources/Event/EventSettingsResource.php +++ b/backend/app/Resources/Event/EventSettingsResource.php @@ -44,10 +44,8 @@ public function toArray($request): array 'price_display_mode' => $this->getPriceDisplayMode(), - // Ticket design settings 'ticket_design_settings' => $this->getTicketDesignSettings(), - // Payment settings 'payment_providers' => $this->getPaymentProviders(), 'offline_payment_instructions' => $this->getOfflinePaymentInstructions(), 'allow_orders_awaiting_offline_payment_to_check_in' => $this->getAllowOrdersAwaitingOfflinePaymentToCheckIn(), @@ -56,7 +54,6 @@ public function toArray($request): array 'payment_links_enabled' => $this->getPaymentLinksEnabled(), 'payment_link_expiry_hours' => $this->getPaymentLinkExpiryHours(), - // Invoice settings 'enable_invoicing' => $this->getEnableInvoicing(), 'invoice_label' => $this->getInvoiceLabel(), 'invoice_prefix' => $this->getInvoicePrefix(), @@ -68,29 +65,25 @@ public function toArray($request): array 'invoice_notes' => $this->getInvoiceNotes(), 'invoice_payment_terms_days' => $this->getInvoicePaymentTermsDays(), - // Marketing settings 'show_marketing_opt_in' => $this->getShowMarketingOptIn(), - // Attendee detail copy control 'allow_copy_details_to_all_attendees' => $this->getAllowCopyDetailsToAllAttendees(), - // Platform fee settings 'pass_platform_fee_to_buyer' => $this->getPassPlatformFeeToBuyer(), - // Homepage theme settings 'homepage_theme_settings' => $this->getHomepageThemeSettings(), 'homepage_sections' => $this->getHomepageSections(), - // Self-service settings 'allow_attendee_self_edit' => $this->getAllowAttendeeSelfEdit(), - // Occurrence display 'show_available_occurrence_capacity' => $this->getShowAvailableOccurrenceCapacity(), 'hide_sold_out_occurrences' => $this->getHideSoldOutOccurrences(), - // Waitlist settings 'waitlist_auto_process' => $this->getWaitlistAutoProcess(), 'waitlist_offer_timeout_minutes' => $this->getWaitlistOfferTimeoutMinutes(), + + /** @var array<'BADGES'> */ + 'enabled_features' => $this->getEnabledFeatures() ?? [], ]; } } diff --git a/backend/app/Services/Application/Handlers/Attendee/EditAttendeeHandler.php b/backend/app/Services/Application/Handlers/Attendee/EditAttendeeHandler.php index b12fce088f..96091f31b9 100644 --- a/backend/app/Services/Application/Handlers/Attendee/EditAttendeeHandler.php +++ b/backend/app/Services/Application/Handlers/Attendee/EditAttendeeHandler.php @@ -16,6 +16,7 @@ use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface; use HiEvents\Repository\Interfaces\ProductRepositoryInterface; use HiEvents\Services\Application\Handlers\Attendee\DTO\EditAttendeeDTO; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\Product\AvailableProductQuantitiesFetchService; use HiEvents\Services\Domain\Product\ProductQuantityUpdateService; use HiEvents\Services\Infrastructure\DomainEvents\DomainEventDispatcherService; @@ -35,6 +36,7 @@ public function __construct( private readonly DomainEventDispatcherService $domainEventDispatcherService, private readonly AvailableProductQuantitiesFetchService $availableProductQuantitiesFetchService, private readonly SeatClaimService $seatClaimService, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -50,7 +52,10 @@ public function handle(EditAttendeeDTO $editAttendeeDTO): AttendeeDomainObject $this->adjustProductQuantities($attendee, $editAttendeeDTO); - $updatedAttendee = $this->updateAttendee($editAttendeeDTO); + $updatedAttendee = $this->badgeReprintService->flagIfBadgeDetailsChanged( + before: $attendee, + after: $this->updateAttendee($editAttendeeDTO), + ); $this->domainEventDispatcherService->dispatch( new AttendeeEvent( diff --git a/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php b/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php index caa61e33d2..c5aae6d326 100644 --- a/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php +++ b/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php @@ -16,6 +16,7 @@ use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface; use HiEvents\Repository\Interfaces\OrderRepositoryInterface; use HiEvents\Services\Application\Handlers\Attendee\DTO\PartialEditAttendeeDTO; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\EventOccurrence\OccurrencePurchaseEligibilityService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsCancellationService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsReactivationService; @@ -46,6 +47,7 @@ public function __construct( private readonly SeatingEventLockService $seatingEventLock, private readonly OccurrencePurchaseEligibilityService $occurrenceEligibilityService, private readonly AvailableProductQuantitiesFetchService $availableProductQuantitiesFetchService, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -85,7 +87,7 @@ private function updateAttendee(PartialEditAttendeeDTO $data, ?string $status): $this->cancel($attendee); } - return $this->attendeeRepository->updateByIdWhere( + $updatedAttendee = $this->attendeeRepository->updateByIdWhere( id: $data->attendee_id, attributes: [ 'status' => $status ?? $attendee->getStatus(), @@ -96,6 +98,8 @@ private function updateAttendee(PartialEditAttendeeDTO $data, ?string $status): where: [ 'event_id' => $data->event_id, ]); + + return $this->badgeReprintService->flagIfBadgeDetailsChanged($attendee, $updatedAttendee); } /** diff --git a/backend/app/Services/Application/Handlers/Badge/DTO/BadgeDesignResultDTO.php b/backend/app/Services/Application/Handlers/Badge/DTO/BadgeDesignResultDTO.php new file mode 100644 index 0000000000..2ff099669d --- /dev/null +++ b/backend/app/Services/Application/Handlers/Badge/DTO/BadgeDesignResultDTO.php @@ -0,0 +1,16 @@ +badgeDesignService->getDesign($eventId), + is_customized: $this->badgeDesignService->isCustomized($eventId), + ); + } +} diff --git a/backend/app/Services/Application/Handlers/Badge/GetBadgeStatsHandler.php b/backend/app/Services/Application/Handlers/Badge/GetBadgeStatsHandler.php new file mode 100644 index 0000000000..60d22593e0 --- /dev/null +++ b/backend/app/Services/Application/Handlers/Badge/GetBadgeStatsHandler.php @@ -0,0 +1,26 @@ +attendeeRepository->getBadgeStats( + eventId: $eventId, + includeAwaitingPayment: $this->badgeEligibilityService->includesAwaitingPayment($eventId), + eventOccurrenceId: $eventOccurrenceId, + ); + } +} diff --git a/backend/app/Services/Application/Handlers/Badge/GetBadgesHandler.php b/backend/app/Services/Application/Handlers/Badge/GetBadgesHandler.php new file mode 100644 index 0000000000..9e977a0848 --- /dev/null +++ b/backend/app/Services/Application/Handlers/Badge/GetBadgesHandler.php @@ -0,0 +1,47 @@ +attendeeRepository->findForBadges(new BadgeAttendeeQueryDTO( + event_id: $dto->event_id, + include_awaiting_payment: $this->badgeEligibilityService->includesAwaitingPayment($dto->event_id), + attendee_ids: $dto->attendee_ids, + order_id: $dto->order_id, + product_ids: $dto->product_ids, + event_occurrence_id: $dto->event_occurrence_id, + only_unprinted: $dto->only_unprinted, + sort_by: $dto->sort_by, + page: $dto->page, + per_page: $dto->per_page, + )); + + $badges = $this->badgeDataService->buildBadges( + eventId: $dto->event_id, + attendees: $attendees->getCollection(), + design: $this->badgeDesignService->getDesign($dto->event_id), + ); + + return $attendees->setCollection($badges); + } +} diff --git a/backend/app/Services/Application/Handlers/Badge/MarkBadgesPrintedHandler.php b/backend/app/Services/Application/Handlers/Badge/MarkBadgesPrintedHandler.php new file mode 100644 index 0000000000..61f25eba4a --- /dev/null +++ b/backend/app/Services/Application/Handlers/Badge/MarkBadgesPrintedHandler.php @@ -0,0 +1,37 @@ +attendeeRepository->countWhere([ + AttendeeDomainObjectAbstract::EVENT_ID => $eventId, + [AttendeeDomainObjectAbstract::ID, 'in', $attendeeIds], + ]); + + if ($matched !== count($attendeeIds)) { + throw new ResourceNotFoundException(__('One or more attendees could not be found for this event.')); + } + + return $this->badgeReprintService->markPrinted($eventId, $attendeeIds); + } +} diff --git a/backend/app/Services/Application/Handlers/Badge/Public/GetCheckInListAttendeeBadgePublicHandler.php b/backend/app/Services/Application/Handlers/Badge/Public/GetCheckInListAttendeeBadgePublicHandler.php new file mode 100644 index 0000000000..a3f6bcd442 --- /dev/null +++ b/backend/app/Services/Application/Handlers/Badge/Public/GetCheckInListAttendeeBadgePublicHandler.php @@ -0,0 +1,36 @@ +checkInListBadgeAccessService->findPrintableAttendee($checkInListShortId, $attendeePublicId); + + return $this->badgeDataService->buildBadges( + eventId: $attendee->getEventId(), + attendees: collect([$attendee]), + design: $this->badgeDesignService->getDesign($attendee->getEventId()), + )->first(); + } +} diff --git a/backend/app/Services/Application/Handlers/Badge/Public/MarkCheckInListAttendeeBadgePrintedPublicHandler.php b/backend/app/Services/Application/Handlers/Badge/Public/MarkCheckInListAttendeeBadgePrintedPublicHandler.php new file mode 100644 index 0000000000..13dee53822 --- /dev/null +++ b/backend/app/Services/Application/Handlers/Badge/Public/MarkCheckInListAttendeeBadgePrintedPublicHandler.php @@ -0,0 +1,33 @@ +checkInListBadgeAccessService->findPrintableAttendee($checkInListShortId, $attendeePublicId); + + $this->badgeReprintService->markPrinted($attendee->getEventId(), [$attendee->getId()]); + + return $this->getBadgeHandler->handle($checkInListShortId, $attendeePublicId); + } +} diff --git a/backend/app/Services/Application/Handlers/Badge/UpsertBadgeDesignHandler.php b/backend/app/Services/Application/Handlers/Badge/UpsertBadgeDesignHandler.php new file mode 100644 index 0000000000..a3d0337e49 --- /dev/null +++ b/backend/app/Services/Application/Handlers/Badge/UpsertBadgeDesignHandler.php @@ -0,0 +1,28 @@ +badgeDesignService->save($eventId, $design), + is_customized: true, + ); + } +} diff --git a/backend/app/Services/Application/Handlers/CheckInList/CreateCheckInListHandler.php b/backend/app/Services/Application/Handlers/CheckInList/CreateCheckInListHandler.php index b8dcc460e9..c55cca8840 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/CreateCheckInListHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/CreateCheckInListHandler.php @@ -27,7 +27,9 @@ public function handle(UpsertCheckInListDTO $listData): CheckInListDomainObject ->setEventOccurrenceId($listData->eventOccurrenceId) ->setPublicShowAttendeeNotes($listData->publicShowAttendeeNotes) ->setPublicShowQuestionAnswers($listData->publicShowQuestionAnswers) - ->setPublicShowOrderDetails($listData->publicShowOrderDetails); + ->setPublicShowOrderDetails($listData->publicShowOrderDetails) + ->setBadgePrintingEnabled($listData->badgePrintingEnabled ?? false) + ->setKioskMode($listData->kioskMode ?? false); return $this->createCheckInListService->createCheckInList( checkInList: $checkInList, diff --git a/backend/app/Services/Application/Handlers/CheckInList/DTO/UpsertCheckInListDTO.php b/backend/app/Services/Application/Handlers/CheckInList/DTO/UpsertCheckInListDTO.php index 4976041b50..deaf9bb347 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/DTO/UpsertCheckInListDTO.php +++ b/backend/app/Services/Application/Handlers/CheckInList/DTO/UpsertCheckInListDTO.php @@ -18,5 +18,7 @@ public function __construct( public bool $publicShowAttendeeNotes = false, public bool $publicShowQuestionAnswers = false, public bool $publicShowOrderDetails = false, + public ?bool $badgePrintingEnabled = null, + public ?bool $kioskMode = null, ) {} } diff --git a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandler.php b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandler.php index 26db54ea54..b3c281a670 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandler.php @@ -64,6 +64,10 @@ public function handle(string $shortId, string $attendeePublicId, ?int $staffAcc $currentListCheckIns = $this->filterCheckInsForList($attendee->getCheckIns(), $checkInList->getId()); $isStaff = $this->hasStaffAccess($checkInList, $staffAccountId); + if (! $isStaff) { + $this->checkInListActivityValidator->assertAttendeeListsAvailable($checkInList); + } + return new PublicAttendeeDetailDTO( attendee: $attendee, currentListCheckIns: $currentListCheckIns, diff --git a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandler.php b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandler.php index e487d8bb39..d4254e388a 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandler.php @@ -2,6 +2,7 @@ namespace HiEvents\Services\Application\Handlers\CheckInList\Public; +use HiEvents\DomainObjects\AttendeeCheckInDomainObject; use HiEvents\DomainObjects\AttendeeDomainObject; use HiEvents\DomainObjects\CheckInListDomainObject; use HiEvents\DomainObjects\EventDomainObject; @@ -40,10 +41,12 @@ public function handle(string $shortId, string $attendeePublicId): AttendeeDomai $this->checkInListActivityValidator->assertActive($checkInList); - $attendee = $this->attendeeRepository->findFirstWhere([ - 'public_id' => $attendeePublicId, - 'event_id' => $checkInList->getEventId(), - ]); + $attendee = $this->attendeeRepository + ->loadRelation(new Relationship(AttendeeCheckInDomainObject::class, name: 'check_ins')) + ->findFirstWhere([ + 'public_id' => $attendeePublicId, + 'event_id' => $checkInList->getEventId(), + ]); if (! $attendee) { throw new ResourceNotFoundException(__('Attendee not found')); @@ -51,7 +54,9 @@ public function handle(string $shortId, string $attendeePublicId): AttendeeDomai $this->verifyAttendeeBelongsToCheckInList($checkInList, $attendee); - return $attendee; + return $attendee->setCheckIn( + $attendee->getCheckIns()?->first(fn (AttendeeCheckInDomainObject $checkIn) => $checkIn->getCheckInListId() === $checkInList->getId()), + ); } private function verifyAttendeeBelongsToCheckInList( diff --git a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandler.php b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandler.php index 8e3c160146..10271864a2 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandler.php @@ -42,12 +42,12 @@ public function handle(string $shortId, QueryParamsDTO $queryParams): Paginator } $this->checkInListActivityValidator->assertActive($checkInList); + $this->checkInListActivityValidator->assertAttendeeListsAvailable($checkInList); $queryParams = $this->applyCheckInListOccurrenceScope($checkInList, $queryParams); $attendees = $this->attendeeRepository->getAttendeesByCheckInShortId($shortId, $queryParams); - // Set the check-in for each attendee $attendees->getCollection()->transform(function (AttendeeDomainObject $attendee) use ($checkInList) { $attendee->setCheckIn($attendee->getCheckIns()?->first(fn ($checkIn) => $checkIn->getCheckInListId() === $checkInList->getId())); diff --git a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListPublicHandler.php b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListPublicHandler.php index 3c73a7e5ae..b0bcd166e5 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListPublicHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/Public/GetCheckInListPublicHandler.php @@ -6,15 +6,18 @@ use HiEvents\DomainObjects\EventDomainObject; use HiEvents\DomainObjects\EventOccurrenceDomainObject; use HiEvents\DomainObjects\EventSettingDomainObject; +use HiEvents\DomainObjects\ImageDomainObject; use HiEvents\DomainObjects\ProductDomainObject; use HiEvents\Repository\Eloquent\Value\Relationship; use HiEvents\Repository\Interfaces\CheckInListRepositoryInterface; +use HiEvents\Services\Domain\Badge\BadgeDesignService; use Symfony\Component\Routing\Exception\ResourceNotFoundException; class GetCheckInListPublicHandler { public function __construct( private readonly CheckInListRepositoryInterface $checkInListRepository, + private readonly BadgeDesignService $badgeDesignService, ) {} public function handle(string $shortId): CheckInListDomainObject @@ -23,6 +26,7 @@ public function handle(string $shortId): CheckInListDomainObject ->loadRelation((new Relationship(domainObject: EventDomainObject::class, nested: [ new Relationship(domainObject: EventSettingDomainObject::class, name: 'event_settings'), new Relationship(domainObject: EventOccurrenceDomainObject::class, name: 'event_occurrences'), + new Relationship(domainObject: ImageDomainObject::class, name: 'images'), ], name: 'event'))) ->loadRelation(ProductDomainObject::class) ->loadRelation(new Relationship(EventOccurrenceDomainObject::class, name: 'event_occurrence')) @@ -37,6 +41,12 @@ public function handle(string $shortId): CheckInListDomainObject $attendeeCheckInCount = $this->checkInListRepository->getCheckedInAttendeeCountById($checkInList->getId()); $checkInList->setCheckedInCount($attendeeCheckInCount->checkedInCount ?? 0); + + $eventSettings = $checkInList->getEvent()?->getEventSettings(); + if ($eventSettings !== null && $checkInList->isBadgePrintingActive($eventSettings)) { + $checkInList->setBadgeDesign($this->badgeDesignService->getDesign($checkInList->getEventId())); + } + $checkInList->setTotalAttendeesCount($attendeeCheckInCount->totalAttendeesCount ?? 0); return $checkInList; diff --git a/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php b/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php index 2bae7c72af..ffb6029c2d 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php @@ -32,7 +32,9 @@ public function handle(UpsertCheckInListDTO $data): CheckInListDomainObject return $this->updateCheckInlistService->updateCheckInlist( checkInList: $checkInList, - productIds: $data->productIds + productIds: $data->productIds, + badgePrintingEnabled: $data->badgePrintingEnabled, + kioskMode: $data->kioskMode, ); } } diff --git a/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php b/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php index 13796fbf99..d3a429ad77 100644 --- a/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php +++ b/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php @@ -15,7 +15,6 @@ class UpdateEventSettingsDTO extends BaseDTO public function __construct( public readonly int $account_id, - // event settings public readonly int $event_id, public readonly ?string $post_checkout_message, public readonly ?string $pre_checkout_message, @@ -46,7 +45,6 @@ public function __construct( public readonly ?PriceDisplayMode $price_display_mode = PriceDisplayMode::INCLUSIVE, - // Payment settings public readonly array $payment_providers = [], public readonly ?string $offline_payment_instructions = null, public readonly bool $allow_orders_awaiting_offline_payment_to_check_in = false, @@ -55,7 +53,6 @@ public function __construct( public readonly bool $payment_links_enabled = false, public readonly int $payment_link_expiry_hours = 72, - // Invoice settings public readonly bool $enable_invoicing = false, public readonly ?string $invoice_label = null, public readonly ?string $invoice_prefix = null, @@ -67,34 +64,28 @@ public function __construct( public readonly ?string $invoice_notes = null, public readonly ?int $invoice_payment_terms_days = null, - // Ticket design settings public readonly ?array $ticket_design_settings = null, - // Marketing settings public readonly bool $show_marketing_opt_in = true, - // Attendee detail copy control public readonly bool $allow_copy_details_to_all_attendees = true, - // Platform fee settings public readonly bool $pass_platform_fee_to_buyer = false, - // Homepage theme settings public readonly ?array $homepage_theme_settings = null, public readonly ?array $homepage_sections = null, - // Self-service settings public readonly bool $allow_attendee_self_edit = false, - // Occurrence display public readonly bool $show_available_occurrence_capacity = false, public readonly bool $hide_sold_out_occurrences = false, - // Waitlist settings public readonly ?bool $waitlist_auto_process = null, public readonly ?int $waitlist_offer_timeout_minutes = null, public readonly ?string $get_tickets_button_text = null, + + public readonly ?array $enabled_features = null, ) {} public static function createWithDefaults( @@ -129,11 +120,9 @@ public static function createWithDefaults( notify_organizer_of_new_orders: null, price_display_mode: PriceDisplayMode::INCLUSIVE, - // Payment defaults payment_providers: [PaymentProviders::STRIPE->value], offline_payment_instructions: null, - // Invoice defaults enable_invoicing: false, invoice_label: __('Invoice'), invoice_prefix: null, @@ -145,7 +134,6 @@ public static function createWithDefaults( invoice_notes: null, invoice_payment_terms_days: null, - // Ticket design defaults ticket_design_settings: [ 'accent_color' => '#333333', 'logo_image_id' => null, @@ -155,16 +143,12 @@ public static function createWithDefaults( 'enabled' => true, ], - // Marketing defaults show_marketing_opt_in: true, - // Attendee detail copy control default allow_copy_details_to_all_attendees: true, - // Platform fee defaults pass_platform_fee_to_buyer: false, - // Homepage theme defaults (simplified 2-color + mode system) homepage_theme_settings: [ 'accent' => '#7c3aed', 'background' => '#f5f3ff', @@ -172,7 +156,6 @@ public static function createWithDefaults( 'background_type' => 'COLOR', ], - // Self-service defaults allow_attendee_self_edit: false, ); } diff --git a/backend/app/Services/Application/Handlers/EventSettings/PartialUpdateEventSettingsHandler.php b/backend/app/Services/Application/Handlers/EventSettings/PartialUpdateEventSettingsHandler.php index c6559a21bf..23c9577f13 100644 --- a/backend/app/Services/Application/Handlers/EventSettings/PartialUpdateEventSettingsHandler.php +++ b/backend/app/Services/Application/Handlers/EventSettings/PartialUpdateEventSettingsHandler.php @@ -72,7 +72,6 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe 'notify_organizer_of_new_orders' => $eventSettingsDTO->settings['notify_organizer_of_new_orders'] ?? $existingSettings->getNotifyOrganizerOfNewOrders(), 'price_display_mode' => $eventSettingsDTO->settings['price_display_mode'] ?? $existingSettings->getPriceDisplayMode(), - // Payment settings 'payment_providers' => $eventSettingsDTO->settings['payment_providers'] ?? $existingSettings->getPaymentProviders(), 'offline_payment_instructions' => array_key_exists('offline_payment_instructions', $eventSettingsDTO->settings) ? $eventSettingsDTO->settings['offline_payment_instructions'] @@ -88,7 +87,6 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe 'payment_link_expiry_hours' => $eventSettingsDTO->settings['payment_link_expiry_hours'] ?? $existingSettings->getPaymentLinkExpiryHours(), - // Invoice settings 'enable_invoicing' => $eventSettingsDTO->settings['enable_invoicing'] ?? $existingSettings->getEnableInvoicing(), 'invoice_label' => array_key_exists('invoice_label', $eventSettingsDTO->settings) ? $eventSettingsDTO->settings['invoice_label'] @@ -114,21 +112,16 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe ? $eventSettingsDTO->settings['invoice_payment_terms_days'] : $existingSettings->getInvoicePaymentTermsDays(), - // Ticket design settings 'ticket_design_settings' => array_key_exists('ticket_design_settings', $eventSettingsDTO->settings) ? $eventSettingsDTO->settings['ticket_design_settings'] : $existingSettings->getTicketDesignSettings(), - // Marketing settings 'show_marketing_opt_in' => $eventSettingsDTO->settings['show_marketing_opt_in'] ?? $existingSettings->getShowMarketingOptIn(), - // Attendee detail copy control 'allow_copy_details_to_all_attendees' => $eventSettingsDTO->settings['allow_copy_details_to_all_attendees'] ?? $existingSettings->getAllowCopyDetailsToAllAttendees(), - // Platform fee settings 'pass_platform_fee_to_buyer' => $eventSettingsDTO->settings['pass_platform_fee_to_buyer'] ?? $existingSettings->getPassPlatformFeeToBuyer(), - // Homepage theme settings 'homepage_theme_settings' => array_key_exists('homepage_theme_settings', $eventSettingsDTO->settings) ? $eventSettingsDTO->settings['homepage_theme_settings'] : $existingSettings->getHomepageThemeSettings(), @@ -136,16 +129,15 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe ? $eventSettingsDTO->settings['homepage_sections'] : $existingSettings->getHomepageSections(), - // Self-service settings 'allow_attendee_self_edit' => $eventSettingsDTO->settings['allow_attendee_self_edit'] ?? $existingSettings->getAllowAttendeeSelfEdit(), - // Occurrence display 'show_available_occurrence_capacity' => $eventSettingsDTO->settings['show_available_occurrence_capacity'] ?? $existingSettings->getShowAvailableOccurrenceCapacity(), 'hide_sold_out_occurrences' => $eventSettingsDTO->settings['hide_sold_out_occurrences'] ?? $existingSettings->getHideSoldOutOccurrences(), - // Waitlist settings 'waitlist_auto_process' => $eventSettingsDTO->settings['waitlist_auto_process'] ?? $existingSettings->getWaitlistAutoProcess(), 'waitlist_offer_timeout_minutes' => $eventSettingsDTO->settings['waitlist_offer_timeout_minutes'] ?? $existingSettings->getWaitlistOfferTimeoutMinutes(), + + 'enabled_features' => $eventSettingsDTO->settings['enabled_features'] ?? $existingSettings->getEnabledFeatures() ?? [], ]), ); } diff --git a/backend/app/Services/Application/Handlers/EventSettings/UpdateEventSettingsHandler.php b/backend/app/Services/Application/Handlers/EventSettings/UpdateEventSettingsHandler.php index 2553492a0b..6b2f2b17c3 100644 --- a/backend/app/Services/Application/Handlers/EventSettings/UpdateEventSettingsHandler.php +++ b/backend/app/Services/Application/Handlers/EventSettings/UpdateEventSettingsHandler.php @@ -67,7 +67,6 @@ public function handle(UpdateEventSettingsDTO $settings): EventSettingDomainObje 'notify_organizer_of_new_orders' => $settings->notify_organizer_of_new_orders, 'price_display_mode' => $settings->price_display_mode->name, - // Payment settings 'payment_providers' => $settings->payment_providers, 'offline_payment_instructions' => $this->purifier->purify($settings->offline_payment_instructions), 'allow_orders_awaiting_offline_payment_to_check_in' => $settings->allow_orders_awaiting_offline_payment_to_check_in, @@ -76,7 +75,6 @@ public function handle(UpdateEventSettingsDTO $settings): EventSettingDomainObje 'payment_links_enabled' => $settings->payment_links_enabled, 'payment_link_expiry_hours' => $settings->payment_link_expiry_hours, - // Invoice settings 'enable_invoicing' => $settings->enable_invoicing, 'invoice_label' => trim($settings->invoice_label), 'invoice_prefix' => trim($settings->invoice_prefix), @@ -88,34 +86,30 @@ public function handle(UpdateEventSettingsDTO $settings): EventSettingDomainObje 'invoice_notes' => $this->purifier->purify($settings->invoice_notes), 'invoice_payment_terms_days' => $settings->invoice_payment_terms_days, - // Ticket design settings 'ticket_design_settings' => $settings->ticket_design_settings, - // Marketing settings 'show_marketing_opt_in' => $settings->show_marketing_opt_in, - // Attendee detail copy control 'allow_copy_details_to_all_attendees' => $settings->allow_copy_details_to_all_attendees, - // Platform fee settings 'pass_platform_fee_to_buyer' => $settings->pass_platform_fee_to_buyer, - // Homepage theme settings 'homepage_theme_settings' => $settings->homepage_theme_settings, 'homepage_sections' => $settings->homepage_sections === null ? null : $this->homepageSectionsSanitizer->sanitizeForEvent($settings->homepage_sections, $settings->event_id), - // Self-service settings 'allow_attendee_self_edit' => $settings->allow_attendee_self_edit, - // Occurrence display 'show_available_occurrence_capacity' => $settings->show_available_occurrence_capacity, 'hide_sold_out_occurrences' => $settings->hide_sold_out_occurrences, - // Waitlist settings 'waitlist_auto_process' => $settings->waitlist_auto_process, 'waitlist_offer_timeout_minutes' => $settings->waitlist_offer_timeout_minutes, + + ...($settings->enabled_features === null ? [] : [ + 'enabled_features' => array_values(array_unique($settings->enabled_features)), + ]), ], where: [ 'event_id' => $settings->event_id, diff --git a/backend/app/Services/Application/Handlers/Images/CreateImageHandler.php b/backend/app/Services/Application/Handlers/Images/CreateImageHandler.php index 52f4cd9e5e..274c3646c5 100644 --- a/backend/app/Services/Application/Handlers/Images/CreateImageHandler.php +++ b/backend/app/Services/Application/Handlers/Images/CreateImageHandler.php @@ -26,6 +26,9 @@ class CreateImageHandler ImageType::ORGANIZER_COVER, ImageType::EVENT_COVER, ImageType::TICKET_LOGO, + ImageType::BADGE_LOGO, + ImageType::BADGE_ARTWORK, + ImageType::BADGE_SPONSORS, ]; public function __construct( @@ -42,7 +45,6 @@ public function __construct( public function handle(CreateImageDTO $imageData): ImageDomainObject { if ($imageData->isGeneric()) { - // For generic images, we associate them with the user return $this->imageUploadService->upload( image: $imageData->image, entityId: $imageData->userId, diff --git a/backend/app/Services/Domain/Badge/BadgeDataService.php b/backend/app/Services/Domain/Badge/BadgeDataService.php new file mode 100644 index 0000000000..f42fa15431 --- /dev/null +++ b/backend/app/Services/Domain/Badge/BadgeDataService.php @@ -0,0 +1,209 @@ + $attendees + * @return Collection + */ + public function buildBadges(int $eventId, Collection $attendees, BadgeDesignDTO $design): Collection + { + if ($attendees->isEmpty()) { + return collect(); + } + + $questions = $this->loadQuestions($eventId, $design); + $answers = $this->loadAnswers($attendees, $questions); + + return $attendees->map(fn (AttendeeDomainObject $attendee) => new BadgeDTO( + attendee_id: $attendee->getId(), + attendee_public_id: $attendee->getPublicId(), + order_id: $attendee->getOrderId(), + product_id: $attendee->getProductId(), + event_occurrence_id: $attendee->getEventOccurrenceId(), + status: $attendee->getStatus(), + first_name: $attendee->getFirstName(), + last_name: $attendee->getLastName(), + lines: $this->resolveLines($attendee, $design, $questions, $answers), + ribbon: $this->resolveRibbon($attendee, $design), + seat_label: $design->show_seat ? $attendee->getSeatLabel() : null, + badge_printed_at: $attendee->getBadgePrintedAt(), + badge_print_count: $attendee->getBadgePrintCount(), + print_status: $attendee->getBadgePrintStatus(), + ))->values(); + } + + /** + * @param Collection $questions + * @param Collection $answers + * @return BadgeLineDTO[] + */ + private function resolveLines( + AttendeeDomainObject $attendee, + BadgeDesignDTO $design, + Collection $questions, + Collection $answers, + ): array { + $lines = []; + + foreach ($design->lines as $line) { + $text = $this->resolveText($attendee, $line, $questions, $answers); + + if (($text === null || trim($text) === '') && ! in_array($line->source, self::NAME_SOURCES, true)) { + continue; + } + + $lines[] = new BadgeLineDTO( + source: $line->source, + size: $line->size, + question_id: $line->question_id, + text: trim((string) $text), + ); + } + + return $lines; + } + + /** + * @param Collection $questions + * @param Collection $answers + */ + private function resolveText( + AttendeeDomainObject $attendee, + BadgeLineDTO $line, + Collection $questions, + Collection $answers, + ): ?string { + return match ($line->source) { + BadgeFieldSource::FIRST_NAME => $attendee->getFirstName(), + BadgeFieldSource::LAST_NAME => $attendee->getLastName(), + BadgeFieldSource::FULL_NAME => trim($attendee->getFirstName().' '.$attendee->getLastName()), + BadgeFieldSource::TICKET_TYPE => $attendee->getProduct()?->getTitle(), + BadgeFieldSource::OCCURRENCE_DATE => $attendee->getEventOccurrence()?->getStartDate(), + BadgeFieldSource::CUSTOM_TEXT => $line->text, + BadgeFieldSource::QUESTION => $this->resolveAnswer($attendee, $line->question_id, $questions, $answers), + }; + } + + /** + * @param Collection $questions + * @param Collection $answers + */ + private function resolveAnswer( + AttendeeDomainObject $attendee, + ?int $questionId, + Collection $questions, + Collection $answers, + ): ?string { + /** @var QuestionDomainObject|null $question */ + $question = $questions->get($questionId); + if ($question === null) { + return null; + } + + $isOrderQuestion = $question->getBelongsTo() === QuestionBelongsTo::ORDER->name; + + /** @var QuestionAnswerDomainObject|null $answer */ + $answer = $answers->get($isOrderQuestion + ? self::answerKey($questionId, 'order', $attendee->getOrderId()) + : self::answerKey($questionId, 'attendee', $attendee->getId())); + + if ($answer === null || $answer->getAnswer() === null) { + return null; + } + + return $this->questionAnswerFormatter->getAnswerAsText( + $answer->getAnswer(), + QuestionTypeEnum::fromName($question->getType()), + ); + } + + private function resolveRibbon(AttendeeDomainObject $attendee, BadgeDesignDTO $design): ?BadgeRibbonDTO + { + if (! $design->show_ribbon) { + return null; + } + + $configured = $design->ribbonForProduct($attendee->getProductId()); + $label = $configured?->label ?: $attendee->getProduct()?->getTitle(); + + return new BadgeRibbonDTO( + product_id: $attendee->getProductId(), + label: $label, + color: $configured?->color ?? $design->accent_color, + ); + } + + /** + * @return Collection + */ + private function loadQuestions(int $eventId, BadgeDesignDTO $design): Collection + { + $questionIds = $design->questionIds(); + if ($questionIds === []) { + return collect(); + } + + return $this->questionRepository + ->findWhereIn(QuestionDomainObjectAbstract::ID, $questionIds, [QuestionDomainObjectAbstract::EVENT_ID => $eventId]) + ->keyBy(fn (QuestionDomainObject $question) => $question->getId()); + } + + /** + * @param Collection $attendees + * @param Collection $questions + * @return Collection + */ + private function loadAnswers(Collection $attendees, Collection $questions): Collection + { + if ($questions->isEmpty()) { + return collect(); + } + + return $this->questionAnswerRepository->findWhereIn( + QuestionAnswerDomainObjectAbstract::ORDER_ID, + $attendees->map(fn (AttendeeDomainObject $attendee) => $attendee->getOrderId())->unique()->values()->all(), + [[QuestionAnswerDomainObjectAbstract::QUESTION_ID, 'in', $questions->keys()->all()]], + )->keyBy(fn (QuestionAnswerDomainObject $answer) => $answer->getAttendeeId() === null + ? self::answerKey($answer->getQuestionId(), 'order', $answer->getOrderId()) + : self::answerKey($answer->getQuestionId(), 'attendee', $answer->getAttendeeId())); + } + + private static function answerKey(int $questionId, string $scope, int $id): string + { + return $questionId.':'.$scope.':'.$id; + } +} diff --git a/backend/app/Services/Domain/Badge/BadgeDesignCloneService.php b/backend/app/Services/Domain/Badge/BadgeDesignCloneService.php new file mode 100644 index 0000000000..d405fcf479 --- /dev/null +++ b/backend/app/Services/Domain/Badge/BadgeDesignCloneService.php @@ -0,0 +1,92 @@ + $oldToNewQuestionMap + * @param array $oldToNewProductMap + */ + public function clone( + EventDomainObject $sourceEvent, + int $newEventId, + array $oldToNewQuestionMap, + array $oldToNewProductMap, + ): void { + $this->cloneImages($sourceEvent, $newEventId); + + /** @var EventSettingDomainObject|null $settings */ + $settings = $this->eventSettingsRepository->findFirstWhere([EventSettingDomainObjectAbstract::EVENT_ID => $newEventId]); + $design = $settings?->getBadgeDesignSettings(); + + if (! is_array($design) || $design === []) { + return; + } + + $design['lines'] = array_values(array_filter(array_map( + function (array $line) use ($oldToNewQuestionMap): ?array { + if (($line['source'] ?? null) !== BadgeFieldSource::QUESTION->value) { + return $line; + } + + $newQuestionId = $oldToNewQuestionMap[(int) ($line['question_id'] ?? 0)] ?? null; + + return $newQuestionId === null ? null : [...$line, 'question_id' => $newQuestionId]; + }, + $design['lines'] ?? [], + ))); + + $design['ribbons'] = array_values(array_filter(array_map( + function (array $ribbon) use ($oldToNewProductMap): ?array { + $newProductId = $oldToNewProductMap[(int) ($ribbon['product_id'] ?? 0)] ?? null; + + return $newProductId === null ? null : [...$ribbon, 'product_id' => $newProductId]; + }, + $design['ribbons'] ?? [], + ))); + + $this->eventSettingsRepository->updateFromArray($settings->getId(), [ + EventSettingDomainObjectAbstract::BADGE_DESIGN_SETTINGS => $design['lines'] === [] ? null : $design, + ]); + } + + private function cloneImages(EventDomainObject $sourceEvent, int $newEventId): void + { + $badgeImageTypes = array_map(fn (ImageType $type) => $type->name, ImageType::badgeImageTypes()); + + ($sourceEvent->getImages() ?? collect()) + ->filter(fn (ImageDomainObject $image) => in_array($image->getType(), $badgeImageTypes, true)) + ->each(fn (ImageDomainObject $image) => $this->imageRepository->create([ + 'account_id' => $image->getAccountId(), + 'entity_id' => $newEventId, + 'entity_type' => EventDomainObject::class, + 'type' => $image->getType(), + 'disk' => $image->getDisk(), + 'path' => $image->getPath(), + 'filename' => $image->getFilename(), + 'size' => $image->getSize(), + 'mime_type' => $image->getMimeType(), + 'width' => $image->getWidth(), + 'height' => $image->getHeight(), + 'avg_colour' => $image->getAvgColour(), + 'lqip_base64' => $image->getLqipBase64(), + ])); + } +} diff --git a/backend/app/Services/Domain/Badge/BadgeDesignService.php b/backend/app/Services/Domain/Badge/BadgeDesignService.php new file mode 100644 index 0000000000..4afcab8147 --- /dev/null +++ b/backend/app/Services/Domain/Badge/BadgeDesignService.php @@ -0,0 +1,264 @@ +findSettings($eventId); + $defaults = $this->buildDefaults($this->eventRepository->findById($eventId), $settings); + $stored = $settings->getBadgeDesignSettings(); + + if (empty($stored)) { + return $defaults; + } + + return BadgeDesignDTO::from(array_replace($defaults->toArray(), $stored)); + } + + public function isCustomized(int $eventId): bool + { + return ! empty($this->findSettings($eventId)->getBadgeDesignSettings()); + } + + /** + * @throws InvalidBadgeDesignException + */ + public function save(int $eventId, BadgeDesignDTO $design): BadgeDesignDTO + { + $design->lines = array_map(fn (BadgeLineDTO $line) => new BadgeLineDTO( + source: $line->source, + size: $line->size, + question_id: $line->source === BadgeFieldSource::QUESTION ? $line->question_id : null, + text: $line->source === BadgeFieldSource::CUSTOM_TEXT ? $line->text : null, + ), array_values($design->lines)); + + if ($design->size !== BadgeSize::CUSTOM) { + $design->custom_width_mm = null; + $design->custom_height_mm = null; + } + + if ($design->back_mode === BadgeBackMode::NONE) { + $design->fold_over = false; + } + + $this->assertQuestionsBelongToEvent($eventId, $design); + $this->assertRibbonProductsBelongToEvent($eventId, $design); + + $this->eventSettingsRepository->updateFromArray( + id: $this->findSettings($eventId)->getId(), + attributes: [EventSettingDomainObjectAbstract::BADGE_DESIGN_SETTINGS => $design->toArray()], + ); + + return $design; + } + + /** + * @return Collection + */ + public function getBindableQuestions(int $eventId): Collection + { + return $this->questionRepository + ->findWhere([QuestionDomainObjectAbstract::EVENT_ID => $eventId]) + ->filter(fn (QuestionDomainObject $question) => $question->getType() !== QuestionTypeEnum::ADDRESS->name) + ->sortBy(fn (QuestionDomainObject $question) => $question->getOrder()) + ->values(); + } + + private function buildDefaults(EventDomainObject $event, EventSettingDomainObject $settings): BadgeDesignDTO + { + $usesLetter = in_array(strtoupper((string) $event->getCurrency()), self::LETTER_CURRENCIES, true); + + return new BadgeDesignDTO( + template: BadgeTemplate::CLASSIC, + size: $usesLetter ? BadgeSize::IN_4X3_LANDSCAPE : BadgeSize::A6_PORTRAIT, + custom_width_mm: null, + custom_height_mm: null, + sheet: $usesLetter ? BadgeSheet::LETTER : BadgeSheet::A4, + accent_color: $this->defaultAccent($settings), + background_color: null, + text_color: null, + font_family: $this->defaultFont($settings), + text_align: null, + uppercase_names: false, + lines: $this->defaultLines($event->getId()), + show_logo: true, + show_qr: true, + show_ribbon: true, + show_seat: true, + show_event_name: true, + show_sponsors: true, + footer_text: null, + ribbons: [], + back_mode: BadgeBackMode::NONE, + back_text: null, + fold_over: false, + ); + } + + /** + * @return BadgeLineDTO[] + */ + private function defaultLines(int $eventId): array + { + $lines = [ + new BadgeLineDTO(source: BadgeFieldSource::FIRST_NAME, size: BadgeTextSize::XL), + new BadgeLineDTO(source: BadgeFieldSource::LAST_NAME, size: BadgeTextSize::L), + ]; + + $questions = $this->getBindableQuestions($eventId) + ->filter(fn (QuestionDomainObject $question) => ! $question->getIsHidden()); + + foreach ([[self::COMPANY_PATTERN, BadgeTextSize::M], [self::JOB_TITLE_PATTERN, BadgeTextSize::S], [self::PRONOUNS_PATTERN, BadgeTextSize::S]] as [$pattern, $size]) { + $question = $questions->first(fn (QuestionDomainObject $question) => preg_match($pattern, $question->getTitle()) === 1); + + if ($question !== null) { + $lines[] = new BadgeLineDTO(source: BadgeFieldSource::QUESTION, size: $size, question_id: $question->getId()); + $questions = $questions->reject(fn (QuestionDomainObject $candidate) => $candidate->getId() === $question->getId()); + } + } + + return $lines; + } + + private function defaultAccent(EventSettingDomainObject $settings): string + { + $ticketAccent = $this->toSixDigitHex($settings->getTicketDesignSettings()['accent_color'] ?? null); + if ($ticketAccent !== null && $ticketAccent !== self::UNSET_TICKET_ACCENT) { + return $ticketAccent; + } + + return $this->toSixDigitHex($settings->getHomepageThemeSettings()['accent'] ?? null) ?? self::FALLBACK_ACCENT; + } + + private function toSixDigitHex(mixed $color): ?string + { + if (! is_string($color)) { + return null; + } + + $color = strtolower(trim($color)); + + if (preg_match('/^#([0-9a-f])([0-9a-f])([0-9a-f])[0-9a-f]?$/', $color, $short) === 1) { + return '#'.$short[1].$short[1].$short[2].$short[2].$short[3].$short[3]; + } + + return preg_match('/^#[0-9a-f]{6}([0-9a-f]{2})?$/', $color) === 1 ? substr($color, 0, 7) : null; + } + + private function defaultFont(EventSettingDomainObject $settings): string + { + $font = $settings->getHomepageThemeSettings()['font_family'] ?? null; + + return HomepageFontFamily::tryFrom((string) $font)?->value ?? HomepageFontFamily::Inter->value; + } + + private function findSettings(int $eventId): EventSettingDomainObject + { + /** @var EventSettingDomainObject */ + return $this->eventSettingsRepository->findFirstWhere([ + EventSettingDomainObjectAbstract::EVENT_ID => $eventId, + ]); + } + + /** + * @throws InvalidBadgeDesignException + */ + private function assertQuestionsBelongToEvent(int $eventId, BadgeDesignDTO $design): void + { + $questionIds = $design->questionIds(); + if ($questionIds === []) { + return; + } + + $validIds = $this->questionRepository + ->findWhereIn(QuestionDomainObjectAbstract::ID, $questionIds, [QuestionDomainObjectAbstract::EVENT_ID => $eventId]) + ->filter(fn (QuestionDomainObject $question) => $question->getType() !== QuestionTypeEnum::ADDRESS->name) + ->map(fn (QuestionDomainObject $question) => $question->getId()) + ->all(); + + foreach ($design->lines as $index => $line) { + if ($line->source === BadgeFieldSource::QUESTION && ! in_array($line->question_id, $validIds, true)) { + throw new InvalidBadgeDesignException( + "lines.$index.question_id", + __('Choose one of this event\'s questions for this line.'), + ); + } + } + } + + /** + * @throws InvalidBadgeDesignException + */ + private function assertRibbonProductsBelongToEvent(int $eventId, BadgeDesignDTO $design): void + { + $productIds = collect($design->ribbons)->map(fn (BadgeRibbonDTO $ribbon) => $ribbon->product_id)->all(); + if ($productIds === []) { + return; + } + + $validIds = $this->productRepository + ->findWhereIn(ProductDomainObjectAbstract::ID, $productIds, [ + ProductDomainObjectAbstract::EVENT_ID => $eventId, + ProductDomainObjectAbstract::PRODUCT_TYPE => ProductType::TICKET->name, + ]) + ->map(fn ($product) => $product->getId()) + ->all(); + + foreach ($design->ribbons as $index => $ribbon) { + if (! in_array($ribbon->product_id, $validIds, true)) { + throw new InvalidBadgeDesignException( + "ribbons.$index.product_id", + __('Choose one of this event\'s tickets for this ribbon.'), + ); + } + } + } +} diff --git a/backend/app/Services/Domain/Badge/BadgeEligibilityService.php b/backend/app/Services/Domain/Badge/BadgeEligibilityService.php new file mode 100644 index 0000000000..f23764c1dc --- /dev/null +++ b/backend/app/Services/Domain/Badge/BadgeEligibilityService.php @@ -0,0 +1,26 @@ +eventSettingsRepository->findFirstWhere([ + EventSettingDomainObjectAbstract::EVENT_ID => $eventId, + ]); + + return (bool) $settings?->getAllowOrdersAwaitingOfflinePaymentToCheckIn(); + } +} diff --git a/backend/app/Services/Domain/Badge/BadgeReprintService.php b/backend/app/Services/Domain/Badge/BadgeReprintService.php new file mode 100644 index 0000000000..d335444193 --- /dev/null +++ b/backend/app/Services/Domain/Badge/BadgeReprintService.php @@ -0,0 +1,87 @@ +attendeeRepository->incrementEach( + columns: [AttendeeDomainObjectAbstract::BADGE_PRINT_COUNT => 1], + additionalUpdates: [AttendeeDomainObjectAbstract::BADGE_PRINTED_AT => Carbon::now()], + where: [ + AttendeeDomainObjectAbstract::EVENT_ID => $eventId, + [AttendeeDomainObjectAbstract::ID, 'in', $attendeeIds], + ], + ); + } + + /** + * @param int[] $attendeeIds + */ + public function flagForReprint(array $attendeeIds): void + { + if ($attendeeIds === []) { + return; + } + + $this->attendeeRepository->updateWhere( + attributes: [AttendeeDomainObjectAbstract::BADGE_PRINTED_AT => null], + where: [ + [AttendeeDomainObjectAbstract::ID, 'in', $attendeeIds], + [AttendeeDomainObjectAbstract::BADGE_PRINTED_AT, 'not null', null], + ], + ); + } + + public function flagIfBadgeDetailsChanged(AttendeeDomainObject $before, AttendeeDomainObject $after): AttendeeDomainObject + { + $changed = $before->getFirstName() !== $after->getFirstName() + || $before->getLastName() !== $after->getLastName() + || $before->getProductId() !== $after->getProductId() + || $before->getSeatLabel() !== $after->getSeatLabel(); + + if (! $changed || $after->getBadgePrintedAt() === null) { + return $after; + } + + $this->flagForReprint([$after->getId()]); + + return $after->setBadgePrintedAt(null); + } + + public function flagForAnswerChange(int $eventId, int $questionId, int $orderId, ?int $attendeeId): void + { + if (! in_array($questionId, $this->badgeDesignService->getDesign($eventId)->questionIds(), true)) { + return; + } + + $attendeeIds = $attendeeId !== null + ? [$attendeeId] + : $this->attendeeRepository + ->findWhere([AttendeeDomainObjectAbstract::ORDER_ID => $orderId]) + ->map(fn (AttendeeDomainObject $attendee) => $attendee->getId()) + ->all(); + + $this->flagForReprint($attendeeIds); + } +} diff --git a/backend/app/Services/Domain/Badge/CheckInListBadgeAccessService.php b/backend/app/Services/Domain/Badge/CheckInListBadgeAccessService.php new file mode 100644 index 0000000000..16f78a49f4 --- /dev/null +++ b/backend/app/Services/Domain/Badge/CheckInListBadgeAccessService.php @@ -0,0 +1,96 @@ +checkInListRepository + ->loadRelation(ProductDomainObject::class) + ->findFirstWhere([CheckInListDomainObjectAbstract::SHORT_ID => $checkInListShortId]); + + if ($checkInList === null) { + throw new ResourceNotFoundException(__('Check-in list not found')); + } + + /** @var EventSettingDomainObject|null $eventSettings */ + $eventSettings = $this->eventSettingsRepository->findFirstWhere([ + EventSettingDomainObjectAbstract::EVENT_ID => $checkInList->getEventId(), + ]); + + if ($eventSettings === null || ! $checkInList->isBadgePrintingActive($eventSettings)) { + throw new ResourceNotFoundException(__('Check-in list not found')); + } + + $this->checkInListActivityValidator->assertActive($checkInList); + + /** @var AttendeeDomainObject|null $attendee */ + $attendee = $this->attendeeRepository + ->loadRelation(new Relationship(ProductDomainObject::class, name: 'product')) + ->loadRelation(new Relationship(EventOccurrenceDomainObject::class, name: 'event_occurrence')) + ->findFirstWhere([ + AttendeeDomainObjectAbstract::PUBLIC_ID => $attendeePublicId, + AttendeeDomainObjectAbstract::EVENT_ID => $checkInList->getEventId(), + ]); + + if ($attendee === null || ! $this->isPrintableFromList($checkInList, $attendee)) { + throw new ResourceNotFoundException(__('Attendee not found')); + } + + return $attendee; + } + + private function isPrintableFromList(CheckInListDomainObject $checkInList, AttendeeDomainObject $attendee): bool + { + $allowedProductIds = $checkInList->getProducts()?->map(fn ($product) => $product->getId())->all() ?? []; + + if ($allowedProductIds !== [] && ! in_array($attendee->getProductId(), $allowedProductIds, true)) { + return false; + } + + if ($checkInList->getEventOccurrenceId() !== null + && $attendee->getEventOccurrenceId() !== $checkInList->getEventOccurrenceId()) { + return false; + } + + if ($attendee->getStatus() === AttendeeStatus::ACTIVE->name) { + return true; + } + + return $attendee->getStatus() === AttendeeStatus::AWAITING_PAYMENT->name + && $this->badgeEligibilityService->includesAwaitingPayment($checkInList->getEventId()); + } +} diff --git a/backend/app/Services/Domain/Badge/DTO/BadgeDTO.php b/backend/app/Services/Domain/Badge/DTO/BadgeDTO.php new file mode 100644 index 0000000000..429807e91e --- /dev/null +++ b/backend/app/Services/Domain/Badge/DTO/BadgeDTO.php @@ -0,0 +1,33 @@ +lines) + ->filter(fn (BadgeLineDTO $line) => $line->source === BadgeFieldSource::QUESTION && $line->question_id !== null) + ->map(fn (BadgeLineDTO $line) => $line->question_id) + ->unique() + ->values() + ->all(); + } + + public function ribbonForProduct(int $productId): ?BadgeRibbonDTO + { + return collect($this->ribbons)->first(fn (BadgeRibbonDTO $ribbon) => $ribbon->product_id === $productId); + } +} diff --git a/backend/app/Services/Domain/Badge/DTO/BadgeLineDTO.php b/backend/app/Services/Domain/Badge/DTO/BadgeLineDTO.php new file mode 100644 index 0000000000..b85e9ede73 --- /dev/null +++ b/backend/app/Services/Domain/Badge/DTO/BadgeLineDTO.php @@ -0,0 +1,19 @@ +getKioskMode()) { + throw new CannotCheckInException(__('This check-in list is a self check-in kiosk, so attendee lists are not available on it.')); + } + } } diff --git a/backend/app/Services/Domain/CheckInList/CreateCheckInListService.php b/backend/app/Services/Domain/CheckInList/CreateCheckInListService.php index 9fb58720de..d073880933 100644 --- a/backend/app/Services/Domain/CheckInList/CreateCheckInListService.php +++ b/backend/app/Services/Domain/CheckInList/CreateCheckInListService.php @@ -46,6 +46,8 @@ public function createCheckInList(CheckInListDomainObject $checkInList, array $p CheckInListDomainObjectAbstract::PUBLIC_SHOW_ATTENDEE_NOTES => $checkInList->getPublicShowAttendeeNotes(), CheckInListDomainObjectAbstract::PUBLIC_SHOW_QUESTION_ANSWERS => $checkInList->getPublicShowQuestionAnswers(), CheckInListDomainObjectAbstract::PUBLIC_SHOW_ORDER_DETAILS => $checkInList->getPublicShowOrderDetails(), + CheckInListDomainObjectAbstract::BADGE_PRINTING_ENABLED => $checkInList->getBadgePrintingEnabled(), + CheckInListDomainObjectAbstract::KIOSK_MODE => $checkInList->getKioskMode(), ]); $this->checkInListProductAssociationService->addCheckInListToProducts( diff --git a/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php b/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php index 1a8d5c0c11..e25a9fe3e4 100644 --- a/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php +++ b/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php @@ -26,9 +26,13 @@ public function __construct( * @throws UnrecognizedProductIdException * @throws ResourceNotFoundException */ - public function updateCheckInList(CheckInListDomainObject $checkInList, array $productIds): CheckInListDomainObject - { - return $this->databaseManager->transaction(function () use ($checkInList, $productIds) { + public function updateCheckInList( + CheckInListDomainObject $checkInList, + array $productIds, + ?bool $badgePrintingEnabled = null, + ?bool $kioskMode = null, + ): CheckInListDomainObject { + return $this->databaseManager->transaction(function () use ($checkInList, $productIds, $badgePrintingEnabled, $kioskMode) { $existingCheckInList = $this->checkInListRepository->findFirstWhere([ CheckInListDomainObjectAbstract::ID => $checkInList->getId(), CheckInListDomainObjectAbstract::EVENT_ID => $checkInList->getEventId(), @@ -56,6 +60,8 @@ public function updateCheckInList(CheckInListDomainObject $checkInList, array $p CheckInListDomainObjectAbstract::PUBLIC_SHOW_ATTENDEE_NOTES => $checkInList->getPublicShowAttendeeNotes(), CheckInListDomainObjectAbstract::PUBLIC_SHOW_QUESTION_ANSWERS => $checkInList->getPublicShowQuestionAnswers(), CheckInListDomainObjectAbstract::PUBLIC_SHOW_ORDER_DETAILS => $checkInList->getPublicShowOrderDetails(), + CheckInListDomainObjectAbstract::BADGE_PRINTING_ENABLED => $badgePrintingEnabled ?? $existingCheckInList->getBadgePrintingEnabled(), + CheckInListDomainObjectAbstract::KIOSK_MODE => $kioskMode ?? $existingCheckInList->getKioskMode(), ], where: [ CheckInListDomainObjectAbstract::ID => $checkInList->getId(), diff --git a/backend/app/Services/Domain/Event/DuplicateEventService.php b/backend/app/Services/Domain/Event/DuplicateEventService.php index 10fca14dab..71ebe0fd1c 100644 --- a/backend/app/Services/Domain/Event/DuplicateEventService.php +++ b/backend/app/Services/Domain/Event/DuplicateEventService.php @@ -46,6 +46,7 @@ use HiEvents\Repository\Interfaces\ProductPriceOccurrenceOverrideRepositoryInterface; use HiEvents\Repository\Interfaces\ProductRepositoryInterface; use HiEvents\Repository\Interfaces\QuestionRepositoryInterface; +use HiEvents\Services\Domain\Badge\BadgeDesignCloneService; use HiEvents\Services\Domain\CapacityAssignment\CreateCapacityAssignmentService; use HiEvents\Services\Domain\CheckInList\CreateCheckInListService; use HiEvents\Services\Domain\CreateWebhookService; @@ -86,6 +87,7 @@ public function __construct( private readonly FeatureFlagService $featureFlagService, private readonly EventLineupCloneService $eventLineupCloneService, private readonly HomepageSectionImageCloneService $homepageSectionImageCloneService, + private readonly BadgeDesignCloneService $badgeDesignCloneService, private readonly QuestionRepositoryInterface $questionRepository, private readonly EmailTemplateRepositoryInterface $emailTemplateRepository, ) {} @@ -194,6 +196,12 @@ public function duplicateEvent( if ($duplicateSettings) { $this->homepageSectionImageCloneService->clone($event, $newEvent->getId()); + $this->badgeDesignCloneService->clone( + sourceEvent: $event, + newEventId: $newEvent->getId(), + oldToNewQuestionMap: $oldToNewQuestionMap, + oldToNewProductMap: $oldProductToNewProductMap, + ); } if ($duplicateWebhooks) { @@ -550,6 +558,8 @@ private function cloneCheckInLists( ->setPublicShowAttendeeNotes($checkInList->getPublicShowAttendeeNotes()) ->setPublicShowQuestionAnswers($checkInList->getPublicShowQuestionAnswers()) ->setPublicShowOrderDetails($checkInList->getPublicShowOrderDetails()) + ->setBadgePrintingEnabled($checkInList->getBadgePrintingEnabled()) + ->setKioskMode($checkInList->getKioskMode()) ->setEventId($newEventId), productIds: $checkInList->getProducts() ?->map(fn ($product) => $oldProductToNewProductMap[$product->getId()])?->toArray() ?? [], diff --git a/backend/app/Services/Domain/Question/EditQuestionAnswerService.php b/backend/app/Services/Domain/Question/EditQuestionAnswerService.php index 4083ad2f49..be7071b44e 100644 --- a/backend/app/Services/Domain/Question/EditQuestionAnswerService.php +++ b/backend/app/Services/Domain/Question/EditQuestionAnswerService.php @@ -6,6 +6,7 @@ use HiEvents\DomainObjects\QuestionDomainObject; use HiEvents\Repository\Eloquent\Value\Relationship; use HiEvents\Repository\Interfaces\QuestionAnswerRepositoryInterface; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\Question\Exception\InvalidAnswerException; use Psr\Log\LoggerInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; @@ -15,6 +16,7 @@ class EditQuestionAnswerService public function __construct( private readonly QuestionAnswerRepositoryInterface $questionAnswerRepository, private readonly LoggerInterface $logger, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -60,5 +62,12 @@ public function editQuestionAnswer(int $eventId, int $questionAnswerId, null|str 'order_id' => $order->getId(), ], ); + + $this->badgeReprintService->flagForAnswerChange( + eventId: $eventId, + questionId: $question->getId(), + orderId: $order->getId(), + attendeeId: $questionAnswer->getAttendeeId(), + ); } } diff --git a/backend/app/Services/Domain/SelfService/SelfServiceEditAttendeeService.php b/backend/app/Services/Domain/SelfService/SelfServiceEditAttendeeService.php index 6955bbedb6..cc2deed64c 100644 --- a/backend/app/Services/Domain/SelfService/SelfServiceEditAttendeeService.php +++ b/backend/app/Services/Domain/SelfService/SelfServiceEditAttendeeService.php @@ -16,6 +16,7 @@ use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface; use HiEvents\Repository\Interfaces\EventRepositoryInterface; use HiEvents\Services\Domain\Attendee\SendAttendeeTicketService; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\SelfService\DTO\EditAttendeeResultDTO; use Illuminate\Support\Facades\Mail; @@ -26,6 +27,7 @@ public function __construct( private readonly EventRepositoryInterface $eventRepository, private readonly OrderAuditLogService $orderAuditLogService, private readonly SendAttendeeTicketService $sendAttendeeTicketService, + private readonly BadgeReprintService $badgeReprintService, ) {} public function editAttendee( @@ -80,6 +82,10 @@ public function editAttendee( where: ['id' => $attendee->getId()] ); + if (isset($updateData['first_name']) || isset($updateData['last_name'])) { + $this->badgeReprintService->flagForReprint([$attendee->getId()]); + } + $event = $this->loadEventWithRelations($attendee->getEventId()); if ($emailChanged) { diff --git a/backend/database/migrations/2026_10_29_000000_add_badge_printing.php b/backend/database/migrations/2026_10_29_000000_add_badge_printing.php new file mode 100644 index 0000000000..e6eddac29b --- /dev/null +++ b/backend/database/migrations/2026_10_29_000000_add_badge_printing.php @@ -0,0 +1,40 @@ +jsonb('badge_design_settings')->nullable(); + }); + + Schema::table('attendees', function (Blueprint $table) { + $table->timestamp('badge_printed_at')->nullable(); + $table->unsignedInteger('badge_print_count')->default(0); + }); + + Schema::table('check_in_lists', function (Blueprint $table) { + $table->boolean('badge_printing_enabled')->default(false); + $table->boolean('kiosk_mode')->default(false); + }); + } + + public function down(): void + { + Schema::table('event_settings', function (Blueprint $table) { + $table->dropColumn('badge_design_settings'); + }); + + Schema::table('attendees', function (Blueprint $table) { + $table->dropColumn(['badge_printed_at', 'badge_print_count']); + }); + + Schema::table('check_in_lists', function (Blueprint $table) { + $table->dropColumn(['badge_printing_enabled', 'kiosk_mode']); + }); + } +}; diff --git a/backend/database/migrations/2026_10_29_000001_add_enabled_features_to_event_settings.php b/backend/database/migrations/2026_10_29_000001_add_enabled_features_to_event_settings.php new file mode 100644 index 0000000000..3231e1d2a8 --- /dev/null +++ b/backend/database/migrations/2026_10_29_000001_add_enabled_features_to_event_settings.php @@ -0,0 +1,22 @@ +jsonb('enabled_features')->nullable(); + }); + } + + public function down(): void + { + Schema::table('event_settings', function (Blueprint $table) { + $table->dropColumn('enabled_features'); + }); + } +}; diff --git a/backend/ee/Seating/Repository/Eloquent/SeatClaimRepository.php b/backend/ee/Seating/Repository/Eloquent/SeatClaimRepository.php index cae3a7e901..70fe51e18a 100644 --- a/backend/ee/Seating/Repository/Eloquent/SeatClaimRepository.php +++ b/backend/ee/Seating/Repository/Eloquent/SeatClaimRepository.php @@ -260,13 +260,13 @@ public function deleteClaimsWithoutLiveOrderForEvent(int $eventId): void )); } - public function relabel(int $eventId, array $labelsBySeatUid): void + public function relabel(int $eventId, array $labelsBySeatUid): array { if ($labelsBySeatUid === []) { - return; + return []; } - $this->runQuery(function () use ($eventId, $labelsBySeatUid) { + return $this->runQuery(function () use ($eventId, $labelsBySeatUid) { $incoming = json_encode( array_map( static fn (string $seatUid, string $label) => ['seat_uid' => $seatUid, 'seat_label' => $label], @@ -286,15 +286,18 @@ public function relabel(int $eventId, array $labelsBySeatUid): void [now(), $incoming, ...$scope], ); - DB::update( + $relabelled = DB::select( 'UPDATE attendees SET seat_label = seat_claims.seat_label, updated_at = ? FROM seat_claims, jsonb_to_recordset(?::jsonb) AS incoming(seat_uid varchar, seat_label varchar) WHERE attendees.id = seat_claims.attendee_id AND seat_claims.seat_uid = incoming.seat_uid AND seat_claims.event_id = ? - AND seat_claims.event_occurrence_id = ANY(?::bigint[])', + AND seat_claims.event_occurrence_id = ANY(?::bigint[]) + RETURNING attendees.id', [now(), $incoming, ...$scope], ); + + return array_map(static fn (object $row) => (int) $row->id, $relabelled); }); } diff --git a/backend/ee/Seating/Repository/Interfaces/SeatClaimRepositoryInterface.php b/backend/ee/Seating/Repository/Interfaces/SeatClaimRepositoryInterface.php index 55b014dccd..72604d4649 100644 --- a/backend/ee/Seating/Repository/Interfaces/SeatClaimRepositoryInterface.php +++ b/backend/ee/Seating/Repository/Interfaces/SeatClaimRepositoryInterface.php @@ -95,6 +95,7 @@ public function liveClaimsWithStatusSql(): string; /** * @param array $labelsBySeatUid + * @return int[] ids of the attendees whose seat label changed */ - public function relabel(int $eventId, array $labelsBySeatUid): void; + public function relabel(int $eventId, array $labelsBySeatUid): array; } diff --git a/backend/ee/Seating/Services/Domain/AttendeeSeatMoveService.php b/backend/ee/Seating/Services/Domain/AttendeeSeatMoveService.php index 41ec6c0b8b..a6744cbfa3 100644 --- a/backend/ee/Seating/Services/Domain/AttendeeSeatMoveService.php +++ b/backend/ee/Seating/Services/Domain/AttendeeSeatMoveService.php @@ -8,6 +8,7 @@ use HiEvents\Enterprise\Seating\Exceptions\SeatSelectionInvalidException; use HiEvents\Enterprise\Seating\Exceptions\SeatsUnavailableException; use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\SelfService\OrderAuditLogService; use HiEvents\Services\Infrastructure\DomainEvents\DomainEventDispatcherService; use HiEvents\Services\Infrastructure\DomainEvents\Enums\DomainEventType; @@ -24,6 +25,7 @@ public function __construct( private readonly DomainEventDispatcherService $domainEventDispatcherService, private readonly EventSeatMapLookupService $eventSeatMapLookup, private readonly DatabaseManager $databaseManager, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -47,7 +49,10 @@ public function move( enforceSelectionRules: ! $isOrganizer, ); - $moved = $this->attendeeRepository->findById($attendee->getId()); + $moved = $this->badgeReprintService->flagIfBadgeDetailsChanged( + before: $attendee, + after: $this->attendeeRepository->findById($attendee->getId()), + ); $previousBand = $attendee->getSeatUid() === null ? null diff --git a/backend/ee/Seating/Services/Domain/EventSeatMapLayoutUpdater.php b/backend/ee/Seating/Services/Domain/EventSeatMapLayoutUpdater.php index 04ed422208..cc3cfc1312 100644 --- a/backend/ee/Seating/Services/Domain/EventSeatMapLayoutUpdater.php +++ b/backend/ee/Seating/Services/Domain/EventSeatMapLayoutUpdater.php @@ -10,6 +10,7 @@ use HiEvents\Enterprise\Seating\Exceptions\SeatMapRelabelRequiresConfirmationException; use HiEvents\Enterprise\Seating\Repository\Interfaces\EventSeatMapRepositoryInterface; use HiEvents\Enterprise\Seating\Repository\Interfaces\SeatClaimRepositoryInterface; +use HiEvents\Services\Domain\Badge\BadgeReprintService; class EventSeatMapLayoutUpdater { @@ -18,6 +19,7 @@ public function __construct( private readonly SeatClaimRepositoryInterface $seatClaimRepository, private readonly EventSeatMapGuard $guard, private readonly EventSeatMapLookupService $eventSeatMapLookup, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -49,7 +51,9 @@ public function replaceLayout( ...$extraAttributes, ]); - $this->seatClaimRepository->relabel($eventSeatMap->getEventId(), $this->guard->relabelledSeats($liveSeats, $incoming)); + $this->badgeReprintService->flagForReprint( + $this->seatClaimRepository->relabel($eventSeatMap->getEventId(), $this->guard->relabelledSeats($liveSeats, $incoming)), + ); $this->seatClaimRepository->deleteDeadClaimsForRemovedSeats( $eventSeatMap->getEventId(), diff --git a/backend/lang/de.json b/backend/lang/de.json index 450ed9686b..8a43235cfb 100644 --- a/backend/lang/de.json +++ b/backend/lang/de.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Die Referenz, die Käufer bei Offline-Zahlungen verwenden sollen. Leer, wenn die Bestellreferenz nicht als Zahlungsreferenz verwendet wird.", "Order placed: payment needed": "Bestellung aufgegeben: Zahlung erforderlich", "How to pay": "So bezahlen Sie", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Die Zahlung war erfolgreich, aber die Bestellung wurde bereits mit späterer Bezahlung aufgegeben. Bestellung: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Die Zahlung war erfolgreich, aber die Bestellung wurde bereits mit späterer Bezahlung aufgegeben. Bestellung: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Teilnehmer-IDs müssen eine durch Kommas getrennte Liste von Zahlen sein.", + "Choose a question for this line.": "Wählen Sie eine Frage für diese Zeile.", + "Choose one of this event's questions for this line.": "Wählen Sie eine der Fragen dieser Veranstaltung für diese Zeile.", + "Choose one of this event's tickets for this ribbon.": "Wählen Sie eines der Tickets dieser Veranstaltung für diesen Farbstreifen.", + "Each attendee can only be listed once.": "Jeder Teilnehmer darf nur einmal aufgeführt werden.", + "Each ticket can only have one ribbon.": "Jedes Ticket kann nur einen Farbstreifen haben.", + "Enter a height for your custom size.": "Geben Sie eine Höhe für Ihre eigene Größe ein.", + "Enter a width for your custom size.": "Geben Sie eine Breite für Ihre eigene Größe ein.", + "Enter the text for this line.": "Geben Sie den Text für diese Zeile ein.", + "One or more attendees could not be found for this event.": "Ein oder mehrere Teilnehmer wurden für diese Veranstaltung nicht gefunden.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Bitte geben Sie eine 6-stellige Hex-Farbe ein, zum Beispiel #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Produkt-IDs müssen eine durch Kommas getrennte Liste von Zahlen sein.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Diese Check-in-Liste ist ein Self-Check-in-Kiosk, daher sind dort keine Teilnehmerlisten verfügbar." } diff --git a/backend/lang/el.json b/backend/lang/el.json index 47ec5be929..50e15937cb 100644 --- a/backend/lang/el.json +++ b/backend/lang/el.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Η αιτιολογία που πρέπει να χρησιμοποιούν οι αγοραστές στις πληρωμές εκτός σύνδεσης. Κενή όταν ο κωδικός παραγγελίας δεν χρησιμοποιείται ως αιτιολογία πληρωμής.", "Order placed: payment needed": "Η παραγγελία υποβλήθηκε: απαιτείται πληρωμή", "How to pay": "Πώς να πληρώσετε", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Η πληρωμή ολοκληρώθηκε, αλλά η παραγγελία είχε ήδη υποβληθεί για πληρωμή αργότερα. Παραγγελία: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Η πληρωμή ολοκληρώθηκε, αλλά η παραγγελία είχε ήδη υποβληθεί για πληρωμή αργότερα. Παραγγελία: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Τα αναγνωριστικά συμμετεχόντων πρέπει να είναι λίστα αριθμών χωρισμένων με κόμμα.", + "Choose a question for this line.": "Επιλέξτε μια ερώτηση για αυτή τη γραμμή.", + "Choose one of this event's questions for this line.": "Επιλέξτε μία από τις ερωτήσεις αυτής της εκδήλωσης για αυτή τη γραμμή.", + "Choose one of this event's tickets for this ribbon.": "Επιλέξτε ένα από τα εισιτήρια αυτής της εκδήλωσης για αυτή τη λωρίδα.", + "Each attendee can only be listed once.": "Κάθε συμμετέχων μπορεί να αναφέρεται μόνο μία φορά.", + "Each ticket can only have one ribbon.": "Κάθε εισιτήριο μπορεί να έχει μόνο μία λωρίδα.", + "Enter a height for your custom size.": "Εισαγάγετε ύψος για το προσαρμοσμένο μέγεθος.", + "Enter a width for your custom size.": "Εισαγάγετε πλάτος για το προσαρμοσμένο μέγεθος.", + "Enter the text for this line.": "Εισαγάγετε το κείμενο για αυτή τη γραμμή.", + "One or more attendees could not be found for this event.": "Ένας ή περισσότεροι συμμετέχοντες δεν βρέθηκαν σε αυτή την εκδήλωση.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Παρακαλώ εισαγάγετε έναν εξαψήφιο κωδικό χρώματος hex, για παράδειγμα #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Τα αναγνωριστικά προϊόντων πρέπει να είναι λίστα αριθμών χωρισμένων με κόμμα.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Αυτή η λίστα check-in είναι kiosk check-in αυτοεξυπηρέτησης, οπότε οι λίστες συμμετεχόντων δεν είναι διαθέσιμες σε αυτή." } diff --git a/backend/lang/es.json b/backend/lang/es.json index 7509f24863..95ee362c7a 100644 --- a/backend/lang/es.json +++ b/backend/lang/es.json @@ -1291,5 +1291,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "La referencia que los compradores deben usar al pagar fuera de línea. Vacía cuando la referencia del pedido no se usa como referencia de pago.", "Order placed: payment needed": "Pedido realizado: pago pendiente", "How to pay": "Cómo pagar", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "El pago se realizó correctamente, pero el pedido ya se había realizado para pagar más tarde. Pedido: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "El pago se realizó correctamente, pero el pedido ya se había realizado para pagar más tarde. Pedido: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Los ID de asistentes deben ser una lista de números separados por comas.", + "Choose a question for this line.": "Elige una pregunta para esta línea.", + "Choose one of this event's questions for this line.": "Elige una de las preguntas de este evento para esta línea.", + "Choose one of this event's tickets for this ribbon.": "Elige una de las entradas de este evento para esta franja.", + "Each attendee can only be listed once.": "Cada asistente solo puede aparecer una vez.", + "Each ticket can only have one ribbon.": "Cada entrada solo puede tener una franja.", + "Enter a height for your custom size.": "Introduce una altura para tu tamaño personalizado.", + "Enter a width for your custom size.": "Introduce un ancho para tu tamaño personalizado.", + "Enter the text for this line.": "Introduce el texto de esta línea.", + "One or more attendees could not be found for this event.": "No se encontraron uno o más asistentes en este evento.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Introduce un color hexadecimal de 6 dígitos, por ejemplo #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Los ID de productos deben ser una lista de números separados por comas.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Esta lista de check-in es un quiosco de check-in autónomo, por lo que no ofrece listas de asistentes." } diff --git a/backend/lang/fi.json b/backend/lang/fi.json index 05edcb1aac..46ff207a59 100644 --- a/backend/lang/fi.json +++ b/backend/lang/fi.json @@ -1439,5 +1439,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Viite, jota ostajien tulee käyttää offline-maksuissa. Tyhjä, kun tilausviitettä ei käytetä maksuviitteenä.", "Order placed: payment needed": "Tilaus tehty: maksu tarvitaan", "How to pay": "Näin maksat", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Maksu onnistui, mutta tilaus oli jo tehty myöhemmin maksettavaksi. Tilaus: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Maksu onnistui, mutta tilaus oli jo tehty myöhemmin maksettavaksi. Tilaus: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Osallistujien ID-tunnusten on oltava pilkuilla eroteltuja numeroita.", + "Choose a question for this line.": "Valitse kysymys tälle riville.", + "Choose one of this event's questions for this line.": "Valitse tälle riville jokin tämän tapahtuman kysymyksistä.", + "Choose one of this event's tickets for this ribbon.": "Valitse tälle merkinnälle jokin tämän tapahtuman lipuista.", + "Each attendee can only be listed once.": "Kukin osallistuja voi olla luettelossa vain kerran.", + "Each ticket can only have one ribbon.": "Kullakin lipulla voi olla vain yksi merkintä.", + "Enter a height for your custom size.": "Anna mukautetun koon korkeus.", + "Enter a width for your custom size.": "Anna mukautetun koon leveys.", + "Enter the text for this line.": "Kirjoita tämän rivin teksti.", + "One or more attendees could not be found for this event.": "Yhtä tai useampaa osallistujaa ei löytynyt tästä tapahtumasta.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Anna 6-merkkinen hex-värikoodi, esimerkiksi #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Tuotteiden ID-tunnusten on oltava pilkuilla eroteltuja numeroita.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Tämä sisäänkirjauslista on itsepalvelukioski, joten osallistujalistat eivät ole siinä käytettävissä." } diff --git a/backend/lang/fr.json b/backend/lang/fr.json index cce659bde5..c314f85373 100644 --- a/backend/lang/fr.json +++ b/backend/lang/fr.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "La référence que les acheteurs doivent utiliser pour un paiement hors ligne. Vide lorsque la référence de commande n'est pas utilisée comme référence de paiement.", "Order placed: payment needed": "Commande passée : paiement requis", "How to pay": "Comment payer", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Le paiement a réussi, mais la commande avait déjà été passée avec paiement ultérieur. Commande : :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Le paiement a réussi, mais la commande avait déjà été passée avec paiement ultérieur. Commande : :id", + "Attendee IDs must be a comma-separated list of numbers.": "Les identifiants des participants doivent être une liste de nombres séparés par des virgules.", + "Choose a question for this line.": "Choisissez une question pour cette ligne.", + "Choose one of this event's questions for this line.": "Choisissez l'une des questions de cet événement pour cette ligne.", + "Choose one of this event's tickets for this ribbon.": "Choisissez l'un des billets de cet événement pour ce bandeau.", + "Each attendee can only be listed once.": "Chaque participant ne peut figurer qu'une seule fois.", + "Each ticket can only have one ribbon.": "Chaque billet ne peut avoir qu'un seul bandeau.", + "Enter a height for your custom size.": "Saisissez une hauteur pour votre taille personnalisée.", + "Enter a width for your custom size.": "Saisissez une largeur pour votre taille personnalisée.", + "Enter the text for this line.": "Saisissez le texte de cette ligne.", + "One or more attendees could not be found for this event.": "Un ou plusieurs participants sont introuvables pour cet événement.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Veuillez saisir une couleur hexadécimale à 6 chiffres, par exemple #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Les identifiants des produits doivent être une liste de nombres séparés par des virgules.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Cette liste d'enregistrement est une borne libre-service : les listes de participants n'y sont donc pas disponibles." } diff --git a/backend/lang/hu.json b/backend/lang/hu.json index 39cb4b604b..75ac064f74 100644 --- a/backend/lang/hu.json +++ b/backend/lang/hu.json @@ -1256,5 +1256,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "A közlemény, amelyet a vásárlóknak offline fizetéskor használniuk kell. Üres, ha a rendelési azonosító nem szolgál közleményként.", "Order placed: payment needed": "Rendelés leadva: fizetés szükséges", "How to pay": "Így fizethet", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "A fizetés sikeres volt, de a rendelést már későbbi fizetéssel leadták. Rendelés: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "A fizetés sikeres volt, de a rendelést már későbbi fizetéssel leadták. Rendelés: :id", + "Attendee IDs must be a comma-separated list of numbers.": "A résztvevőazonosítóknak vesszővel elválasztott számoknak kell lenniük.", + "Choose a question for this line.": "Válasszon kérdést ehhez a sorhoz.", + "Choose one of this event's questions for this line.": "Válassza ki az esemény egyik kérdését ehhez a sorhoz.", + "Choose one of this event's tickets for this ribbon.": "Válassza ki az esemény egyik jegyét ehhez a címkéhez.", + "Each attendee can only be listed once.": "Minden résztvevő csak egyszer szerepelhet.", + "Each ticket can only have one ribbon.": "Minden jegynek csak egy címkéje lehet.", + "Enter a height for your custom size.": "Adja meg az egyéni méret magasságát.", + "Enter a width for your custom size.": "Adja meg az egyéni méret szélességét.", + "Enter the text for this line.": "Adja meg ennek a sornak a szövegét.", + "One or more attendees could not be found for this event.": "Egy vagy több résztvevő nem található ennél az eseménynél.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Kérjük, adjon meg egy 6 jegyű hexadecimális színkódot, például #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "A termékazonosítóknak vesszővel elválasztott számoknak kell lenniük.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Ez a beléptetési lista önkiszolgáló beléptető kioszk, ezért a résztvevőlisták nem érhetők el rajta." } diff --git a/backend/lang/it.json b/backend/lang/it.json index fc2a35b420..fc2ef0dd84 100644 --- a/backend/lang/it.json +++ b/backend/lang/it.json @@ -1252,5 +1252,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Il riferimento che gli acquirenti devono usare per i pagamenti offline. Vuoto quando il riferimento dell'ordine non viene usato come riferimento di pagamento.", "Order placed: payment needed": "Ordine effettuato: pagamento richiesto", "How to pay": "Come pagare", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Il pagamento è andato a buon fine, ma l'ordine era già stato effettuato con pagamento successivo. Ordine: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Il pagamento è andato a buon fine, ma l'ordine era già stato effettuato con pagamento successivo. Ordine: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Gli ID dei partecipanti devono essere un elenco di numeri separati da virgole.", + "Choose a question for this line.": "Scegli una domanda per questa riga.", + "Choose one of this event's questions for this line.": "Scegli una delle domande di questo evento per questa riga.", + "Choose one of this event's tickets for this ribbon.": "Scegli uno dei biglietti di questo evento per questa fascia.", + "Each attendee can only be listed once.": "Ogni partecipante può essere elencato una sola volta.", + "Each ticket can only have one ribbon.": "Ogni biglietto può avere una sola fascia.", + "Enter a height for your custom size.": "Inserisci un'altezza per la dimensione personalizzata.", + "Enter a width for your custom size.": "Inserisci una larghezza per la dimensione personalizzata.", + "Enter the text for this line.": "Inserisci il testo per questa riga.", + "One or more attendees could not be found for this event.": "Uno o più partecipanti non sono stati trovati per questo evento.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Inserisci un colore esadecimale di 6 cifre, ad esempio #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Gli ID dei prodotti devono essere un elenco di numeri separati da virgole.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Questa lista di check-in è un totem self check-in, quindi gli elenchi dei partecipanti non sono disponibili." } diff --git a/backend/lang/ja.json b/backend/lang/ja.json index 4b11c5df2d..7b58b78caf 100644 --- a/backend/lang/ja.json +++ b/backend/lang/ja.json @@ -1439,5 +1439,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "オフライン支払い時に購入者が使用する参照番号。注文番号を支払い参照番号として使用しない場合は空になります。", "Order placed: payment needed": "注文完了: お支払いが必要です", "How to pay": "お支払い方法", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "支払いは完了しましたが、注文はすでに後払いで確定していました。注文: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "支払いは完了しましたが、注文はすでに後払いで確定していました。注文: :id", + "Attendee IDs must be a comma-separated list of numbers.": "参加者IDは、カンマ区切りの数値で指定してください。", + "Choose a question for this line.": "この行に表示する質問を選択してください。", + "Choose one of this event's questions for this line.": "この行には、このイベントの質問から選択してください。", + "Choose one of this event's tickets for this ribbon.": "このカラーラベルには、このイベントのチケットを選択してください。", + "Each attendee can only be listed once.": "各参加者は1回のみ指定できます。", + "Each ticket can only have one ribbon.": "各チケットに設定できるカラーラベルは1つだけです。", + "Enter a height for your custom size.": "カスタムサイズの高さを入力してください。", + "Enter a width for your custom size.": "カスタムサイズの幅を入力してください。", + "Enter the text for this line.": "この行のテキストを入力してください。", + "One or more attendees could not be found for this event.": "このイベントで見つからない参加者が含まれています。", + "Please enter a 6-digit hex colour, for example #1f2937.": "6桁の16進カラーコードを入力してください(例:#1f2937)。", + "Product IDs must be a comma-separated list of numbers.": "商品IDは、カンマ区切りの数値で指定してください。", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "このチェックインリストはセルフチェックイン端末用のため、参加者リストは利用できません。" } diff --git a/backend/lang/ko.json b/backend/lang/ko.json index 2e0124a4e4..7930a41619 100644 --- a/backend/lang/ko.json +++ b/backend/lang/ko.json @@ -1440,5 +1440,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "구매자가 오프라인 결제 시 사용해야 하는 참조 번호입니다. 주문 번호를 결제 참조 번호로 사용하지 않으면 비어 있습니다.", "Order placed: payment needed": "주문 완료: 결제가 필요합니다", "How to pay": "결제 방법", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "결제가 완료되었지만 주문이 이미 나중에 결제로 접수되었습니다. 주문: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "결제가 완료되었지만 주문이 이미 나중에 결제로 접수되었습니다. 주문: :id", + "Attendee IDs must be a comma-separated list of numbers.": "참가자 ID는 쉼표로 구분된 숫자 목록이어야 합니다.", + "Choose a question for this line.": "이 줄에 표시할 질문을 선택해 주세요.", + "Choose one of this event's questions for this line.": "이 줄에 표시할 질문을 이 이벤트의 질문 중에서 선택해 주세요.", + "Choose one of this event's tickets for this ribbon.": "이 색상 라벨에 사용할 티켓을 이 이벤트의 티켓 중에서 선택해 주세요.", + "Each attendee can only be listed once.": "각 참가자는 한 번만 지정할 수 있습니다.", + "Each ticket can only have one ribbon.": "각 티켓에는 색상 라벨을 하나만 지정할 수 있습니다.", + "Enter a height for your custom size.": "사용자 지정 크기의 높이를 입력해 주세요.", + "Enter a width for your custom size.": "사용자 지정 크기의 너비를 입력해 주세요.", + "Enter the text for this line.": "이 줄에 표시할 텍스트를 입력해 주세요.", + "One or more attendees could not be found for this event.": "이 이벤트에서 찾을 수 없는 참가자가 있습니다.", + "Please enter a 6-digit hex colour, for example #1f2937.": "6자리 HEX 색상 코드를 입력해 주세요(예: #1f2937).", + "Product IDs must be a comma-separated list of numbers.": "상품 ID는 쉼표로 구분된 숫자 목록이어야 합니다.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "이 체크인 목록은 셀프 체크인 키오스크용이므로 참가자 목록을 사용할 수 없습니다." } diff --git a/backend/lang/nl.json b/backend/lang/nl.json index 604b369832..cb74f31ce2 100644 --- a/backend/lang/nl.json +++ b/backend/lang/nl.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "De referentie die kopers moeten gebruiken bij offline betalen. Leeg wanneer de bestelreferentie niet als betalingsreferentie wordt gebruikt.", "Order placed: payment needed": "Bestelling geplaatst: betaling nodig", "How to pay": "Zo betaal je", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "De betaling is gelukt, maar de bestelling was al geplaatst om later te betalen. Bestelling: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "De betaling is gelukt, maar de bestelling was al geplaatst om later te betalen. Bestelling: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Deelnemer-ID's moeten een door komma's gescheiden lijst met getallen zijn.", + "Choose a question for this line.": "Kies een vraag voor deze regel.", + "Choose one of this event's questions for this line.": "Kies een van de vragen van dit evenement voor deze regel.", + "Choose one of this event's tickets for this ribbon.": "Kies een van de tickets van dit evenement voor deze kleurband.", + "Each attendee can only be listed once.": "Elke deelnemer mag maar één keer voorkomen.", + "Each ticket can only have one ribbon.": "Elk ticket kan maar één kleurband hebben.", + "Enter a height for your custom size.": "Voer een hoogte in voor je aangepaste formaat.", + "Enter a width for your custom size.": "Voer een breedte in voor je aangepaste formaat.", + "Enter the text for this line.": "Voer de tekst voor deze regel in.", + "One or more attendees could not be found for this event.": "Een of meer deelnemers zijn niet gevonden voor dit evenement.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Voer een 6-cijferige hexkleur in, bijvoorbeeld #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Product-ID's moeten een door komma's gescheiden lijst met getallen zijn.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Deze inchecklijst is een kiosk voor zelf inchecken, dus deelnemerslijsten zijn hier niet beschikbaar." } diff --git a/backend/lang/pl.json b/backend/lang/pl.json index a95c4b1665..12cc0ba331 100644 --- a/backend/lang/pl.json +++ b/backend/lang/pl.json @@ -1439,5 +1439,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Tytuł, którego kupujący powinni użyć przy płatności offline. Pusty, gdy numer zamówienia nie jest używany jako tytuł płatności.", "Order placed: payment needed": "Zamówienie złożone: wymagana płatność", "How to pay": "Jak zapłacić", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Płatność się powiodła, ale zamówienie zostało już złożone z płatnością później. Zamówienie: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Płatność się powiodła, ale zamówienie zostało już złożone z płatnością później. Zamówienie: :id", + "Attendee IDs must be a comma-separated list of numbers.": "ID uczestników muszą być listą liczb oddzielonych przecinkami.", + "Choose a question for this line.": "Wybierz pytanie dla tego wiersza.", + "Choose one of this event's questions for this line.": "Wybierz jedno z pytań tego wydarzenia dla tego wiersza.", + "Choose one of this event's tickets for this ribbon.": "Wybierz jeden z biletów tego wydarzenia dla tego paska koloru.", + "Each attendee can only be listed once.": "Każdy uczestnik może wystąpić tylko raz.", + "Each ticket can only have one ribbon.": "Każdy bilet może mieć tylko jeden pasek koloru.", + "Enter a height for your custom size.": "Podaj wysokość dla własnego rozmiaru.", + "Enter a width for your custom size.": "Podaj szerokość dla własnego rozmiaru.", + "Enter the text for this line.": "Wpisz tekst dla tego wiersza.", + "One or more attendees could not be found for this event.": "Nie znaleziono co najmniej jednego uczestnika w tym wydarzeniu.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Wpisz 6-cyfrowy kolor w formacie hex, np. #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "ID produktów muszą być listą liczb oddzielonych przecinkami.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Ta lista weryfikacyjna działa jako kiosk samoobsługowy, więc listy uczestników nie są w niej dostępne." } diff --git a/backend/lang/pt-br.json b/backend/lang/pt-br.json index 238f933ffe..20610ba2f5 100644 --- a/backend/lang/pt-br.json +++ b/backend/lang/pt-br.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "A referência que os compradores devem usar ao pagar offline. Vazia quando a referência do pedido não é usada como referência de pagamento.", "Order placed: payment needed": "Pedido feito: pagamento necessário", "How to pay": "Como pagar", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "O pagamento foi aprovado, mas o pedido já tinha sido feito para pagar depois. Pedido: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "O pagamento foi aprovado, mas o pedido já tinha sido feito para pagar depois. Pedido: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Os IDs de participantes devem ser uma lista de números separados por vírgula.", + "Choose a question for this line.": "Escolha uma pergunta para esta linha.", + "Choose one of this event's questions for this line.": "Escolha uma das perguntas deste evento para esta linha.", + "Choose one of this event's tickets for this ribbon.": "Escolha um dos ingressos deste evento para esta faixa.", + "Each attendee can only be listed once.": "Cada participante só pode aparecer uma vez.", + "Each ticket can only have one ribbon.": "Cada ingresso só pode ter uma faixa.", + "Enter a height for your custom size.": "Informe uma altura para o tamanho personalizado.", + "Enter a width for your custom size.": "Informe uma largura para o tamanho personalizado.", + "Enter the text for this line.": "Informe o texto desta linha.", + "One or more attendees could not be found for this event.": "Um ou mais participantes não foram encontrados neste evento.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Informe uma cor hexadecimal de 6 dígitos, por exemplo #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Os IDs de produtos devem ser uma lista de números separados por vírgula.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Esta lista de check-in é um totem de autoatendimento, então as listas de participantes não ficam disponíveis nela." } diff --git a/backend/lang/pt.json b/backend/lang/pt.json index 5f4877e05b..8c2cb1f390 100644 --- a/backend/lang/pt.json +++ b/backend/lang/pt.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "A referência que os compradores devem usar ao pagar offline. Vazia quando a referência da encomenda não é usada como referência de pagamento.", "Order placed: payment needed": "Encomenda feita: pagamento necessário", "How to pay": "Como pagar", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "O pagamento foi efetuado, mas a encomenda já tinha sido feita para pagar mais tarde. Encomenda: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "O pagamento foi efetuado, mas a encomenda já tinha sido feita para pagar mais tarde. Encomenda: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Os IDs de participantes têm de ser uma lista de números separados por vírgulas.", + "Choose a question for this line.": "Escolha uma pergunta para esta linha.", + "Choose one of this event's questions for this line.": "Escolha uma das perguntas deste evento para esta linha.", + "Choose one of this event's tickets for this ribbon.": "Escolha um dos bilhetes deste evento para esta faixa.", + "Each attendee can only be listed once.": "Cada participante só pode aparecer uma vez.", + "Each ticket can only have one ribbon.": "Cada bilhete só pode ter uma faixa.", + "Enter a height for your custom size.": "Introduza uma altura para o tamanho personalizado.", + "Enter a width for your custom size.": "Introduza uma largura para o tamanho personalizado.", + "Enter the text for this line.": "Introduza o texto para esta linha.", + "One or more attendees could not be found for this event.": "Um ou mais participantes não foram encontrados neste evento.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Introduza uma cor hexadecimal de 6 dígitos, por exemplo #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Os IDs de produtos têm de ser uma lista de números separados por vírgulas.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Esta lista de check-in é um quiosque de check-in autónomo, por isso as listas de participantes não estão disponíveis." } diff --git a/backend/lang/ru.json b/backend/lang/ru.json index c65e1929f7..976ece46d7 100644 --- a/backend/lang/ru.json +++ b/backend/lang/ru.json @@ -1193,5 +1193,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Назначение платежа, которое покупатели должны указывать при офлайн-оплате. Пусто, если номер заказа не используется как назначение платежа.", "Order placed: payment needed": "Заказ оформлен: требуется оплата", "How to pay": "Как оплатить", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Платёж прошёл успешно, но заказ уже был оформлен с оплатой позже. Заказ: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Платёж прошёл успешно, но заказ уже был оформлен с оплатой позже. Заказ: :id", + "Attendee IDs must be a comma-separated list of numbers.": "ID участников должны быть списком чисел через запятую.", + "Choose a question for this line.": "Выберите вопрос для этой строки.", + "Choose one of this event's questions for this line.": "Выберите для этой строки один из вопросов этого мероприятия.", + "Choose one of this event's tickets for this ribbon.": "Выберите для этой полосы один из билетов этого мероприятия.", + "Each attendee can only be listed once.": "Каждого участника можно указать только один раз.", + "Each ticket can only have one ribbon.": "У каждого билета может быть только одна полоса.", + "Enter a height for your custom size.": "Укажите высоту для своего размера.", + "Enter a width for your custom size.": "Укажите ширину для своего размера.", + "Enter the text for this line.": "Введите текст для этой строки.", + "One or more attendees could not be found for this event.": "Не удалось найти одного или нескольких участников этого мероприятия.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Пожалуйста, введите 6-значный hex-код цвета, например #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "ID товаров должны быть списком чисел через запятую.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Этот список регистрации работает как киоск самостоятельной регистрации, поэтому списки участников в нём недоступны." } diff --git a/backend/lang/se.json b/backend/lang/se.json index b9f487aa5c..8a92e9b063 100644 --- a/backend/lang/se.json +++ b/backend/lang/se.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Referensen som köpare ska använda vid offlinebetalning. Tom när orderreferensen inte används som betalningsreferens.", "Order placed: payment needed": "Order lagd: betalning krävs", "How to pay": "Så betalar du", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Betalningen lyckades, men ordern hade redan lagts med betalning senare. Order: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Betalningen lyckades, men ordern hade redan lagts med betalning senare. Order: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Deltagar-ID:n måste vara en kommaseparerad lista med siffror.", + "Choose a question for this line.": "Välj en fråga för den här raden.", + "Choose one of this event's questions for this line.": "Välj en av evenemangets frågor för den här raden.", + "Choose one of this event's tickets for this ribbon.": "Välj en av evenemangets biljetter för den här etiketten.", + "Each attendee can only be listed once.": "Varje deltagare får bara anges en gång.", + "Each ticket can only have one ribbon.": "Varje biljett kan bara ha en etikett.", + "Enter a height for your custom size.": "Ange en höjd för din anpassade storlek.", + "Enter a width for your custom size.": "Ange en bredd för din anpassade storlek.", + "Enter the text for this line.": "Ange texten för den här raden.", + "One or more attendees could not be found for this event.": "En eller flera deltagare kunde inte hittas för det här evenemanget.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Ange en sexsiffrig hex-färgkod, till exempel #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Produkt-ID:n måste vara en kommaseparerad lista med siffror.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Den här incheckningslistan är en kiosk för självincheckning, så deltagarlistor är inte tillgängliga i den." } diff --git a/backend/lang/sk.json b/backend/lang/sk.json index 7c4173ad80..ad4f811cad 100644 --- a/backend/lang/sk.json +++ b/backend/lang/sk.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Referencia, ktorú majú kupujúci použiť pri offline platbe. Prázdna, ak sa číslo objednávky nepoužíva ako referencia platby.", "Order placed: payment needed": "Objednávka odoslaná: potrebná platba", "How to pay": "Ako zaplatiť", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Platba prebehla úspešne, ale objednávka už bola odoslaná s platbou neskôr. Objednávka: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Platba prebehla úspešne, ale objednávka už bola odoslaná s platbou neskôr. Objednávka: :id", + "Attendee IDs must be a comma-separated list of numbers.": "ID účastníkov musia byť zoznam čísel oddelených čiarkami.", + "Choose a question for this line.": "Vyberte otázku pre tento riadok.", + "Choose one of this event's questions for this line.": "Vyberte pre tento riadok jednu z otázok tejto udalosti.", + "Choose one of this event's tickets for this ribbon.": "Vyberte pre toto označenie jeden z lístkov tejto udalosti.", + "Each attendee can only be listed once.": "Každý účastník môže byť uvedený iba raz.", + "Each ticket can only have one ribbon.": "Každý lístok môže mať iba jedno označenie.", + "Enter a height for your custom size.": "Zadajte výšku vlastnej veľkosti.", + "Enter a width for your custom size.": "Zadajte šírku vlastnej veľkosti.", + "Enter the text for this line.": "Zadajte text pre tento riadok.", + "One or more attendees could not be found for this event.": "Jeden alebo viacerí účastníci sa pre túto udalosť nenašli.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Zadajte 6-miestny hex kód farby, napríklad #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "ID produktov musia byť zoznam čísel oddelených čiarkami.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Tento zoznam odbavenia je kiosk na samoobslužné odbavenie, preto na ňom nie sú dostupné zoznamy účastníkov." } diff --git a/backend/lang/tr.json b/backend/lang/tr.json index b74c5f6e4a..81e24579bb 100644 --- a/backend/lang/tr.json +++ b/backend/lang/tr.json @@ -1266,5 +1266,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Alıcıların çevrimdışı ödeme yaparken kullanması gereken referans. Sipariş referansı ödeme referansı olarak kullanılmadığında boştur.", "Order placed: payment needed": "Sipariş verildi: ödeme gerekli", "How to pay": "Nasıl ödenir", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Ödeme başarılı oldu ancak sipariş zaten sonra ödenmek üzere verilmişti. Sipariş: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Ödeme başarılı oldu ancak sipariş zaten sonra ödenmek üzere verilmişti. Sipariş: :id", + "Attendee IDs must be a comma-separated list of numbers.": "Katılımcı kimlikleri, virgülle ayrılmış sayılardan oluşan bir liste olmalıdır.", + "Choose a question for this line.": "Bu satır için bir soru seçin.", + "Choose one of this event's questions for this line.": "Bu satır için bu etkinliğin sorularından birini seçin.", + "Choose one of this event's tickets for this ribbon.": "Bu şerit için bu etkinliğin biletlerinden birini seçin.", + "Each attendee can only be listed once.": "Her katılımcı yalnızca bir kez listelenebilir.", + "Each ticket can only have one ribbon.": "Her biletin yalnızca bir şeridi olabilir.", + "Enter a height for your custom size.": "Özel boyutunuz için bir yükseklik girin.", + "Enter a width for your custom size.": "Özel boyutunuz için bir genişlik girin.", + "Enter the text for this line.": "Bu satırın metnini girin.", + "One or more attendees could not be found for this event.": "Bu etkinlikte bir veya daha fazla katılımcı bulunamadı.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Lütfen 6 haneli bir hex renk kodu girin, örneğin #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "Ürün kimlikleri, virgülle ayrılmış sayılardan oluşan bir liste olmalıdır.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Bu check-in listesi bir kendi kendine check-in kioskudur, bu nedenle katılımcı listeleri burada kullanılamaz." } diff --git a/backend/lang/vi.json b/backend/lang/vi.json index 7872dc9fa0..5a802f2baa 100644 --- a/backend/lang/vi.json +++ b/backend/lang/vi.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "Mã người mua cần dùng khi thanh toán ngoại tuyến. Để trống khi mã đơn hàng không được dùng làm nội dung thanh toán.", "Order placed: payment needed": "Đã đặt hàng: cần thanh toán", "How to pay": "Cách thanh toán", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "Thanh toán thành công, nhưng đơn hàng đã được đặt để thanh toán sau. Đơn hàng: :id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "Thanh toán thành công, nhưng đơn hàng đã được đặt để thanh toán sau. Đơn hàng: :id", + "Attendee IDs must be a comma-separated list of numbers.": "ID người tham dự phải là danh sách số phân tách bằng dấu phẩy.", + "Choose a question for this line.": "Chọn một câu hỏi cho dòng này.", + "Choose one of this event's questions for this line.": "Chọn một trong các câu hỏi của sự kiện này cho dòng này.", + "Choose one of this event's tickets for this ribbon.": "Chọn một trong các vé của sự kiện này cho dải màu này.", + "Each attendee can only be listed once.": "Mỗi người tham dự chỉ được liệt kê một lần.", + "Each ticket can only have one ribbon.": "Mỗi vé chỉ được có một dải màu.", + "Enter a height for your custom size.": "Nhập chiều cao cho kích thước tùy chỉnh.", + "Enter a width for your custom size.": "Nhập chiều rộng cho kích thước tùy chỉnh.", + "Enter the text for this line.": "Nhập nội dung cho dòng này.", + "One or more attendees could not be found for this event.": "Không tìm thấy một hoặc nhiều người tham dự trong sự kiện này.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Vui lòng nhập mã màu hex gồm 6 chữ số, ví dụ #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "ID sản phẩm phải là danh sách số phân tách bằng dấu phẩy.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Danh sách check-in này là kiosk tự check-in nên không thể xem danh sách người tham dự." } diff --git a/backend/lang/zh-cn.json b/backend/lang/zh-cn.json index 79d3938c50..6957e68977 100644 --- a/backend/lang/zh-cn.json +++ b/backend/lang/zh-cn.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "买家线下付款时应使用的参考号。不使用订单编号作为付款备注时为空。", "Order placed: payment needed": "订单已提交:需要付款", "How to pay": "如何付款", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "付款成功,但订单已以稍后付款的方式提交。订单::id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "付款成功,但订单已以稍后付款的方式提交。订单::id", + "Attendee IDs must be a comma-separated list of numbers.": "参与者 ID 必须是以逗号分隔的数字列表。", + "Choose a question for this line.": "请为此行选择一个问题。", + "Choose one of this event's questions for this line.": "请为此行选择本活动中的一个问题。", + "Choose one of this event's tickets for this ribbon.": "请为此颜色标签选择本活动的一种门票。", + "Each attendee can only be listed once.": "每位参与者只能列出一次。", + "Each ticket can only have one ribbon.": "每种门票只能设置一个颜色标签。", + "Enter a height for your custom size.": "请输入自定义尺寸的高度。", + "Enter a width for your custom size.": "请输入自定义尺寸的宽度。", + "Enter the text for this line.": "请输入此行的文字。", + "One or more attendees could not be found for this event.": "此活动中找不到一位或多位参与者。", + "Please enter a 6-digit hex colour, for example #1f2937.": "请输入 6 位十六进制颜色代码,例如 #1f2937。", + "Product IDs must be a comma-separated list of numbers.": "产品 ID 必须是以逗号分隔的数字列表。", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "此签到列表为自助签到机模式,无法查看参与者列表。" } diff --git a/backend/lang/zh-hk.json b/backend/lang/zh-hk.json index a4674d78a0..b4f8fd8d00 100644 --- a/backend/lang/zh-hk.json +++ b/backend/lang/zh-hk.json @@ -1251,5 +1251,18 @@ "The reference buyers should use when paying offline. Empty when the order reference is not used as the payment reference.": "買家線下付款時應使用的參考編號。不使用訂單編號作為付款參考編號時為空白。", "Order placed: payment needed": "訂單已提交:需要付款", "How to pay": "如何付款", - "Payment was successful, but the order had already been placed to pay later. Order: :id": "付款成功,但訂單已以稍後付款方式提交。訂單::id" + "Payment was successful, but the order had already been placed to pay later. Order: :id": "付款成功,但訂單已以稍後付款方式提交。訂單::id", + "Attendee IDs must be a comma-separated list of numbers.": "參加者 ID 必須是以逗號分隔的數字列表。", + "Choose a question for this line.": "請為此行選擇一個問題。", + "Choose one of this event's questions for this line.": "請為此行選擇本活動的其中一個問題。", + "Choose one of this event's tickets for this ribbon.": "請為此顏色標籤選擇本活動的一種門票。", + "Each attendee can only be listed once.": "每位參加者只能列出一次。", + "Each ticket can only have one ribbon.": "每種門票只能設定一個顏色標籤。", + "Enter a height for your custom size.": "請輸入自訂尺寸的高度。", + "Enter a width for your custom size.": "請輸入自訂尺寸的寬度。", + "Enter the text for this line.": "請輸入此行的文字。", + "One or more attendees could not be found for this event.": "此活動中找不到一位或多位參加者。", + "Please enter a 6-digit hex colour, for example #1f2937.": "請輸入 6 位十六進制顏色代碼,例如 #1f2937。", + "Product IDs must be a comma-separated list of numbers.": "產品 ID 必須是以逗號分隔的數字列表。", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "此簽到列表為自助簽到機模式,無法查看參加者名單。" } diff --git a/backend/resources/api-reference/openapi.json b/backend/resources/api-reference/openapi.json index 0cd877e312..10e6eee07f 100644 --- a/backend/resources/api-reference/openapi.json +++ b/backend/resources/api-reference/openapi.json @@ -1655,12 +1655,88 @@ "security": [] } }, - "/events/{eventId}/box-offices": { - "post": { - "operationId": "actions.createBoxOfficeAction", - "summary": "Create Box Office", + "/events/{eventId}/badge-design": { + "get": { + "operationId": "badges.getBadgeDesignAction", + "summary": "Get Badge Design", "tags": [ - "Box Office" + "Badges" + ], + "parameters": [ + { + "name": "eventId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "`BadgeDesignResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/BadgeDesignResource" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "$ref": "#/components/responses/AuthenticationException" + }, + "403": { + "description": "The authenticated user is not allowed to perform this action.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + }, + "404": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + } + }, + "put": { + "operationId": "badges.upsertBadgeDesignAction", + "summary": "Upsert Badge Design", + "tags": [ + "Badges" ], "parameters": [ { @@ -1677,21 +1753,21 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpsertBoxOfficeRequest" + "$ref": "#/components/schemas/UpsertBadgeDesignRequest" } } } }, "responses": { - "201": { - "description": "`BoxOfficeWithPinResource`", + "200": { + "description": "`BadgeDesignResource`", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/BoxOfficeWithPinResource" + "$ref": "#/components/schemas/BadgeDesignResource" } }, "required": [ @@ -1704,16 +1780,18 @@ "422": { "$ref": "#/components/responses/ValidationException" }, + "401": { + "$ref": "#/components/responses/AuthenticationException" + }, "403": { - "description": "Access denied", + "description": "The authenticated user is not allowed to perform this action.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { - "type": "string", - "description": "Error overview." + "type": "string" } }, "required": [ @@ -1723,9 +1801,6 @@ } } }, - "401": { - "$ref": "#/components/responses/AuthenticationException" - }, "404": { "description": "The requested resource was not found.", "content": { @@ -1745,12 +1820,14 @@ } } } - }, + } + }, + "/events/{eventId}/badges": { "get": { - "operationId": "actions.getBoxOfficesAction", - "summary": "Get Box Offices", + "operationId": "badges.getBadgesAction", + "summary": "Get Badges", "tags": [ - "Box Office" + "Badges" ], "parameters": [ { @@ -1762,68 +1839,110 @@ } }, { - "name": "page", + "name": "attendee_ids", "in": "query", "schema": { - "type": "integer", - "default": 1 + "type": [ + "string", + "null" + ], + "pattern": "^\\d+(,\\d+)*$", + "maxLength": 2400 } }, { - "name": "per_page", + "name": "product_ids", "in": "query", "schema": { - "type": "integer", - "default": 25 + "type": [ + "string", + "null" + ], + "pattern": "^\\d+(,\\d+)*$", + "maxLength": 2400 } }, { - "name": "sort_by", + "name": "order_id", "in": "query", - "description": "Sortable fields are listed in the response `meta.allowed_sorts`.", "schema": { - "type": "string" + "type": [ + "integer", + "null" + ] } }, { - "name": "sort_direction", + "name": "event_occurrence_id", "in": "query", "schema": { - "type": "string", + "type": [ + "integer", + "null" + ] + } + }, + { + "name": "only_unprinted", + "in": "query", + "schema": { + "type": [ + "string", + "null" + ], "enum": [ - "asc", - "desc" + "true", + "false", + "1", + "0", + null ] } }, { - "name": "query", + "name": "sort_by", "in": "query", - "description": "Search term used to filter the results.", "schema": { - "type": "string" + "type": [ + "string", + "null" + ], + "enum": [ + "last_name", + "first_name", + "product", + "created_at", + null + ] } }, { - "name": "filter_fields", + "name": "page", "in": "query", - "description": "Filters in the form `filter_fields[field][operator]=value`. Filterable fields are listed in the response `meta.allowed_filter_fields`.", - "style": "deepObject", "schema": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - }, - "explode": true + "type": [ + "integer", + "null" + ], + "minimum": 1 + } + }, + { + "name": "per_page", + "in": "query", + "schema": { + "type": [ + "integer", + "null" + ], + "minimum": 1, + "maximum": 1000 + } } ], "responses": { "200": { - "description": "Paginated set of `BoxOfficeResource`", + "description": "Paginated set of `BadgeResource`", "content": { "application/json": { "schema": { @@ -1832,7 +1951,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/BoxOfficeResource" + "$ref": "#/components/schemas/BadgeResource" } }, "links": { @@ -1964,6 +2083,9 @@ "401": { "$ref": "#/components/responses/AuthenticationException" }, + "422": { + "$ref": "#/components/responses/ValidationException" + }, "403": { "description": "The authenticated user is not allowed to perform this action.", "content": { @@ -2003,12 +2125,12 @@ } } }, - "/events/{eventId}/box-offices/{boxOfficeId}": { + "/events/{eventId}/badges/stats": { "get": { - "operationId": "actions.getBoxOfficeAction", - "summary": "Get Box Office", + "operationId": "badges.getBadgeStatsAction", + "summary": "Get Badge Stats", "tags": [ - "Box Office" + "Badges" ], "parameters": [ { @@ -2020,24 +2142,26 @@ } }, { - "name": "boxOfficeId", - "in": "path", - "required": true, + "name": "event_occurrence_id", + "in": "query", "schema": { - "type": "integer" + "type": [ + "integer", + "null" + ] } } ], "responses": { "200": { - "description": "`BoxOfficeResource`", + "description": "`BadgeStatsResource`", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/BoxOfficeResource" + "$ref": "#/components/schemas/BadgeStatsResource" } }, "required": [ @@ -2047,6 +2171,9 @@ } } }, + "422": { + "$ref": "#/components/responses/ValidationException" + }, "401": { "$ref": "#/components/responses/AuthenticationException" }, @@ -2087,12 +2214,14 @@ } } } - }, - "put": { - "operationId": "actions.updateBoxOfficeAction", - "summary": "Update Box Office", + } + }, + "/events/{eventId}/badges/printed": { + "post": { + "operationId": "badges.markBadgesPrintedAction", + "summary": "Mark Badges Printed", "tags": [ - "Box Office" + "Badges" ], "parameters": [ { @@ -2102,14 +2231,6 @@ "schema": { "type": "integer" } - }, - { - "name": "boxOfficeId", - "in": "path", - "required": true, - "schema": { - "type": "integer" - } } ], "requestBody": { @@ -2117,21 +2238,29 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpsertBoxOfficeRequest" + "$ref": "#/components/schemas/MarkBadgesPrintedRequest" } } } }, "responses": { "200": { - "description": "`BoxOfficeResource`", + "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/BoxOfficeResource" + "type": "object", + "properties": { + "updated": { + "type": "integer" + } + }, + "required": [ + "updated" + ] } }, "required": [ @@ -2144,16 +2273,18 @@ "422": { "$ref": "#/components/responses/ValidationException" }, + "401": { + "$ref": "#/components/responses/AuthenticationException" + }, "403": { - "description": "Access denied", + "description": "The authenticated user is not allowed to perform this action.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { - "type": "string", - "description": "Error overview." + "type": "string" } }, "required": [ @@ -2163,9 +2294,6 @@ } } }, - "401": { - "$ref": "#/components/responses/AuthenticationException" - }, "404": { "description": "The requested resource was not found.", "content": { @@ -2185,36 +2313,782 @@ } } } - }, - "delete": { - "operationId": "actions.deleteBoxOfficeAction", - "summary": "Delete Box Office", + } + }, + "/public/check-in-lists/{checkInListShortId}/attendees/{attendeePublicId}/badge": { + "get": { + "operationId": "public.getCheckInListAttendeeBadgePublicAction", + "summary": "Get Check In List Attendee Badge (public)", "tags": [ - "Box Office" + "Badges / Public" ], "parameters": [ { - "name": "eventId", + "name": "checkInListShortId", "in": "path", "required": true, "schema": { - "type": "integer" + "type": "string" } }, { - "name": "boxOfficeId", + "name": "attendeePublicId", "in": "path", "required": true, "schema": { - "type": "integer" + "type": "string" } } ], "responses": { - "204": { - "description": "No content" + "200": { + "description": "`BadgeResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/BadgeResource" + } + }, + "required": [ + "data" + ] + } + } + } }, - "409": { + "403": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "errors": { + "type": "array", + "items": {} + } + }, + "required": [ + "message", + "errors" + ] + } + } + } + }, + "404": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + }, + "429": { + "description": "Too many requests. Retry once the rate limit window resets.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + }, + "security": [] + } + }, + "/public/check-in-lists/{checkInListShortId}/attendees/{attendeePublicId}/badge/printed": { + "post": { + "operationId": "public.markCheckInListAttendeeBadgePrintedPublicAction", + "summary": "Mark Check In List Attendee Badge Printed (public)", + "tags": [ + "Badges / Public" + ], + "parameters": [ + { + "name": "checkInListShortId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "attendeePublicId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "`BadgeResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/BadgeResource" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "403": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "errors": { + "type": "array", + "items": {} + } + }, + "required": [ + "message", + "errors" + ] + } + } + } + }, + "404": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + }, + "429": { + "description": "Too many requests. Retry once the rate limit window resets.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + }, + "security": [] + } + }, + "/events/{eventId}/box-offices": { + "post": { + "operationId": "actions.createBoxOfficeAction", + "summary": "Create Box Office", + "tags": [ + "Box Office" + ], + "parameters": [ + { + "name": "eventId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpsertBoxOfficeRequest" + } + } + } + }, + "responses": { + "201": { + "description": "`BoxOfficeWithPinResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/BoxOfficeWithPinResource" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "422": { + "$ref": "#/components/responses/ValidationException" + }, + "403": { + "description": "Access denied", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "Error overview." + } + }, + "required": [ + "message" + ] + } + } + } + }, + "401": { + "$ref": "#/components/responses/AuthenticationException" + }, + "404": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + } + }, + "get": { + "operationId": "actions.getBoxOfficesAction", + "summary": "Get Box Offices", + "tags": [ + "Box Office" + ], + "parameters": [ + { + "name": "eventId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "per_page", + "in": "query", + "schema": { + "type": "integer", + "default": 25 + } + }, + { + "name": "sort_by", + "in": "query", + "description": "Sortable fields are listed in the response `meta.allowed_sorts`.", + "schema": { + "type": "string" + } + }, + { + "name": "sort_direction", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "asc", + "desc" + ] + } + }, + { + "name": "query", + "in": "query", + "description": "Search term used to filter the results.", + "schema": { + "type": "string" + } + }, + { + "name": "filter_fields", + "in": "query", + "description": "Filters in the form `filter_fields[field][operator]=value`. Filterable fields are listed in the response `meta.allowed_filter_fields`.", + "style": "deepObject", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "explode": true + } + ], + "responses": { + "200": { + "description": "Paginated set of `BoxOfficeResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BoxOfficeResource" + } + }, + "links": { + "type": "object", + "properties": { + "first": { + "type": [ + "string", + "null" + ] + }, + "last": { + "type": [ + "string", + "null" + ] + }, + "prev": { + "type": [ + "string", + "null" + ] + }, + "next": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "first", + "last", + "prev", + "next" + ] + }, + "meta": { + "type": "object", + "properties": { + "current_page": { + "type": "integer", + "minimum": 1 + }, + "from": { + "type": [ + "integer", + "null" + ], + "minimum": 1 + }, + "last_page": { + "type": "integer", + "minimum": 1 + }, + "links": { + "type": "array", + "description": "Generated paginator links.", + "items": { + "type": "object", + "properties": { + "url": { + "type": [ + "string", + "null" + ] + }, + "label": { + "type": "string" + }, + "active": { + "type": "boolean" + } + }, + "required": [ + "url", + "label", + "active" + ] + } + }, + "path": { + "type": [ + "string", + "null" + ], + "description": "Base path for paginator generated URLs." + }, + "per_page": { + "type": "integer", + "description": "Number of items shown per page.", + "minimum": 0 + }, + "to": { + "type": [ + "integer", + "null" + ], + "description": "Number of the last item in the slice.", + "minimum": 1 + }, + "total": { + "type": "integer", + "description": "Total number of items being paginated.", + "minimum": 0 + } + }, + "required": [ + "current_page", + "from", + "last_page", + "links", + "path", + "per_page", + "to", + "total" + ] + } + }, + "required": [ + "data", + "links", + "meta" + ] + } + } + } + }, + "401": { + "$ref": "#/components/responses/AuthenticationException" + }, + "403": { + "description": "The authenticated user is not allowed to perform this action.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + }, + "404": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + } + } + }, + "/events/{eventId}/box-offices/{boxOfficeId}": { + "get": { + "operationId": "actions.getBoxOfficeAction", + "summary": "Get Box Office", + "tags": [ + "Box Office" + ], + "parameters": [ + { + "name": "eventId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "boxOfficeId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "`BoxOfficeResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/BoxOfficeResource" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "$ref": "#/components/responses/AuthenticationException" + }, + "403": { + "description": "The authenticated user is not allowed to perform this action.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + }, + "404": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + } + }, + "put": { + "operationId": "actions.updateBoxOfficeAction", + "summary": "Update Box Office", + "tags": [ + "Box Office" + ], + "parameters": [ + { + "name": "eventId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "boxOfficeId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpsertBoxOfficeRequest" + } + } + } + }, + "responses": { + "200": { + "description": "`BoxOfficeResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/BoxOfficeResource" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "422": { + "$ref": "#/components/responses/ValidationException" + }, + "403": { + "description": "Access denied", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "Error overview." + } + }, + "required": [ + "message" + ] + } + } + } + }, + "401": { + "$ref": "#/components/responses/AuthenticationException" + }, + "404": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + } + }, + "delete": { + "operationId": "actions.deleteBoxOfficeAction", + "summary": "Delete Box Office", + "tags": [ + "Box Office" + ], + "parameters": [ + { + "name": "eventId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "boxOfficeId", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "204": { + "description": "No content" + }, + "409": { "description": "", "content": { "application/json": { @@ -26143,6 +27017,12 @@ "public_show_order_details": { "type": "boolean" }, + "badge_printing_enabled": { + "type": "boolean" + }, + "kiosk_mode": { + "type": "boolean" + }, "is_expired": { "type": "boolean" }, @@ -26182,7 +27062,9 @@ "checked_in_attendees", "public_show_attendee_notes", "public_show_question_answers", - "public_show_order_details" + "public_show_order_details", + "badge_printing_enabled", + "kiosk_mode" ] }, "attendee": { @@ -26256,6 +27138,23 @@ "null" ] }, + "badge_printed_at": { + "type": [ + "string", + "null" + ] + }, + "badge_print_count": { + "type": "integer" + }, + "badge_print_status": { + "type": "string", + "enum": [ + "NOT_PRINTED", + "PRINTED", + "NEEDS_REPRINT" + ] + }, "event_occurrence": { "anyOf": [ { @@ -26328,6 +27227,9 @@ "seat_label", "locale", "notes", + "badge_printed_at", + "badge_print_count", + "badge_print_status", "created_at", "updated_at" ] @@ -26369,6 +27271,17 @@ "null" ] }, + "badge_print_count": { + "type": "integer" + }, + "badge_print_status": { + "type": "string", + "enum": [ + "NOT_PRINTED", + "PRINTED", + "NEEDS_REPRINT" + ] + }, "product_id": { "type": "integer" }, @@ -26586,6 +27499,8 @@ "last_name", "status", "seat_label", + "badge_print_count", + "badge_print_status", "product_id", "product_title", "event_occurrence", @@ -26669,6 +27584,23 @@ "null" ] }, + "badge_printed_at": { + "type": [ + "string", + "null" + ] + }, + "badge_print_count": { + "type": "integer" + }, + "badge_print_status": { + "type": "string", + "enum": [ + "NOT_PRINTED", + "PRINTED", + "NEEDS_REPRINT" + ] + }, "event_occurrence": { "anyOf": [ { @@ -26741,6 +27673,9 @@ "seat_label", "locale", "notes", + "badge_printed_at", + "badge_print_count", + "badge_print_status", "created_at", "updated_at" ], @@ -26989,6 +27924,399 @@ ], "title": "AttendeeWithCheckInPublicResource" }, + "BadgeDesignResource": { + "type": "object", + "properties": { + "template": { + "type": "string", + "enum": [ + "CLASSIC", + "BANNER", + "MINIMAL", + "BOLD", + "SIDEBAR", + "ARTWORK" + ] + }, + "size": { + "type": "string", + "enum": [ + "A6_PORTRAIT", + "A7_PORTRAIT", + "IN_4X3_LANDSCAPE", + "IN_3X4_PORTRAIT", + "IN_4X6_PORTRAIT", + "CR80_PORTRAIT", + "CR80_LANDSCAPE", + "LABEL_62X100", + "CUSTOM" + ] + }, + "custom_width_mm": { + "type": [ + "integer", + "null" + ] + }, + "custom_height_mm": { + "type": [ + "integer", + "null" + ] + }, + "sheet": { + "type": "string", + "enum": [ + "A4", + "LETTER", + "NONE" + ] + }, + "accent_color": { + "type": "string" + }, + "background_color": { + "type": [ + "string", + "null" + ] + }, + "text_color": { + "type": [ + "string", + "null" + ] + }, + "font_family": { + "type": "string" + }, + "text_align": { + "type": [ + "string", + "null" + ], + "enum": [ + "LEFT", + "CENTER", + null + ] + }, + "uppercase_names": { + "type": "boolean" + }, + "show_logo": { + "type": "boolean" + }, + "show_qr": { + "type": "boolean" + }, + "show_ribbon": { + "type": "boolean" + }, + "show_seat": { + "type": "boolean" + }, + "show_event_name": { + "type": "boolean" + }, + "show_sponsors": { + "type": "boolean" + }, + "footer_text": { + "type": [ + "string", + "null" + ] + }, + "back_mode": { + "type": "string", + "enum": [ + "NONE", + "SAME", + "INFO" + ] + }, + "back_text": { + "type": [ + "string", + "null" + ] + }, + "fold_over": { + "type": "boolean" + }, + "lines": { + "type": "array", + "items": { + "type": "object", + "properties": { + "source": { + "type": "string", + "enum": [ + "FIRST_NAME", + "LAST_NAME", + "FULL_NAME", + "TICKET_TYPE", + "QUESTION", + "OCCURRENCE_DATE", + "CUSTOM_TEXT" + ] + }, + "size": { + "type": "string", + "enum": [ + "XL", + "L", + "M", + "S" + ] + }, + "question_id": { + "type": [ + "integer", + "null" + ] + }, + "text": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "source", + "size", + "question_id", + "text" + ] + } + }, + "ribbons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "product_id": { + "type": "integer" + }, + "label": { + "type": [ + "string", + "null" + ] + }, + "color": { + "type": "string" + } + }, + "required": [ + "product_id", + "label", + "color" + ] + } + }, + "is_customized": { + "type": "boolean" + } + }, + "required": [ + "template", + "size", + "custom_width_mm", + "custom_height_mm", + "sheet", + "accent_color", + "background_color", + "text_color", + "font_family", + "text_align", + "uppercase_names", + "show_logo", + "show_qr", + "show_ribbon", + "show_seat", + "show_event_name", + "show_sponsors", + "footer_text", + "back_mode", + "back_text", + "fold_over", + "lines", + "ribbons", + "is_customized" + ], + "title": "BadgeDesignResource" + }, + "BadgeResource": { + "type": "object", + "properties": { + "attendee_id": { + "type": "integer" + }, + "attendee_public_id": { + "type": "string" + }, + "order_id": { + "type": "integer" + }, + "product_id": { + "type": "integer" + }, + "event_occurrence_id": { + "type": [ + "integer", + "null" + ] + }, + "status": { + "type": "string", + "enum": [ + "ACTIVE", + "AWAITING_PAYMENT", + "CANCELLED" + ] + }, + "first_name": { + "type": [ + "string", + "null" + ] + }, + "last_name": { + "type": [ + "string", + "null" + ] + }, + "lines": { + "type": "array", + "items": { + "type": "object", + "properties": { + "source": { + "type": "string", + "enum": [ + "FIRST_NAME", + "LAST_NAME", + "FULL_NAME", + "TICKET_TYPE", + "QUESTION", + "OCCURRENCE_DATE", + "CUSTOM_TEXT" + ] + }, + "size": { + "type": "string", + "enum": [ + "XL", + "L", + "M", + "S" + ] + }, + "text": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "source", + "size", + "text" + ] + } + }, + "ribbon": { + "type": [ + "object", + "null" + ], + "properties": { + "label": { + "type": [ + "string", + "null" + ] + }, + "color": { + "type": "string" + } + }, + "required": [ + "label", + "color" + ] + }, + "seat_label": { + "type": [ + "string", + "null" + ] + }, + "badge_printed_at": { + "type": [ + "string", + "null" + ] + }, + "badge_print_count": { + "type": "integer" + }, + "print_status": { + "type": "string", + "enum": [ + "NOT_PRINTED", + "PRINTED", + "NEEDS_REPRINT" + ] + } + }, + "required": [ + "attendee_id", + "attendee_public_id", + "order_id", + "product_id", + "event_occurrence_id", + "status", + "first_name", + "last_name", + "lines", + "ribbon", + "seat_label", + "badge_printed_at", + "badge_print_count", + "print_status" + ], + "title": "BadgeResource" + }, + "BadgeStatsResource": { + "type": "object", + "properties": { + "total": { + "type": "integer" + }, + "printed": { + "type": "integer" + }, + "not_printed": { + "type": "integer" + }, + "needs_reprint": { + "type": "integer" + } + }, + "required": [ + "total", + "printed", + "not_printed", + "needs_reprint" + ], + "title": "BadgeStatsResource" + }, "BoxOfficeResource": { "type": "object", "properties": { @@ -27566,6 +28894,12 @@ "public_show_order_details": { "type": "boolean" }, + "badge_printing_enabled": { + "type": "boolean" + }, + "kiosk_mode": { + "type": "boolean" + }, "is_expired": { "type": "boolean" }, @@ -27605,7 +28939,9 @@ "checked_in_attendees", "public_show_attendee_notes", "public_show_question_answers", - "public_show_order_details" + "public_show_order_details", + "badge_printing_enabled", + "kiosk_mode" ], "title": "CheckInListResource" }, @@ -27743,6 +29079,158 @@ "public_show_order_details": { "type": "boolean" }, + "badge_printing_enabled": { + "type": "boolean" + }, + "kiosk_mode": { + "type": "boolean" + }, + "badge_design": { + "type": "object", + "properties": { + "template": { + "type": "string", + "enum": [ + "CLASSIC", + "BANNER", + "MINIMAL", + "BOLD", + "SIDEBAR", + "ARTWORK" + ] + }, + "size": { + "type": "string", + "enum": [ + "A6_PORTRAIT", + "A7_PORTRAIT", + "IN_4X3_LANDSCAPE", + "IN_3X4_PORTRAIT", + "IN_4X6_PORTRAIT", + "CR80_PORTRAIT", + "CR80_LANDSCAPE", + "LABEL_62X100", + "CUSTOM" + ] + }, + "custom_width_mm": { + "type": [ + "integer", + "null" + ] + }, + "custom_height_mm": { + "type": [ + "integer", + "null" + ] + }, + "sheet": { + "type": "string", + "enum": [ + "A4", + "LETTER", + "NONE" + ] + }, + "accent_color": { + "type": "string" + }, + "background_color": { + "type": [ + "string", + "null" + ] + }, + "text_color": { + "type": [ + "string", + "null" + ] + }, + "font_family": { + "type": "string" + }, + "text_align": { + "type": [ + "string", + "null" + ], + "enum": [ + "LEFT", + "CENTER", + null + ] + }, + "uppercase_names": { + "type": "boolean" + }, + "show_logo": { + "type": "boolean" + }, + "show_qr": { + "type": "boolean" + }, + "show_ribbon": { + "type": "boolean" + }, + "show_seat": { + "type": "boolean" + }, + "show_event_name": { + "type": "boolean" + }, + "show_sponsors": { + "type": "boolean" + }, + "footer_text": { + "type": [ + "string", + "null" + ] + }, + "back_mode": { + "type": "string", + "enum": [ + "NONE", + "SAME", + "INFO" + ] + }, + "back_text": { + "type": [ + "string", + "null" + ] + }, + "fold_over": { + "type": "boolean" + } + }, + "required": [ + "template", + "size", + "custom_width_mm", + "custom_height_mm", + "sheet", + "accent_color", + "background_color", + "text_color", + "font_family", + "text_align", + "uppercase_names", + "show_logo", + "show_qr", + "show_ribbon", + "show_seat", + "show_event_name", + "show_sponsors", + "footer_text", + "back_mode", + "back_text", + "fold_over" + ] + }, "is_expired": { "type": "boolean" }, @@ -27799,7 +29287,9 @@ "checked_in_attendees", "public_show_attendee_notes", "public_show_question_answers", - "public_show_order_details" + "public_show_order_details", + "badge_printing_enabled", + "kiosk_mode" ], "title": "CheckInListResourcePublic" }, @@ -28082,7 +29572,10 @@ "EVENT_COVER", "TICKET_LOGO", "EVENT_GALLERY", - "EVENT_SPONSOR_LOGO" + "EVENT_SPONSOR_LOGO", + "BADGE_LOGO", + "BADGE_ARTWORK", + "BADGE_SPONSORS" ] } }, @@ -28392,6 +29885,9 @@ "TICKET_LOGO", "EVENT_GALLERY", "EVENT_SPONSOR_LOGO", + "BADGE_LOGO", + "BADGE_ARTWORK", + "BADGE_SPONSORS", "ORGANIZER_LOGO", "ORGANIZER_COVER", "ORGANIZER_GALLERY", @@ -30041,7 +31537,6 @@ "type": "string" }, "ticket_design_settings": { - "description": "Ticket design settings", "anyOf": [ { "type": "null" @@ -30059,7 +31554,6 @@ ] }, "payment_providers": { - "description": "Payment settings", "anyOf": [ { "type": "null" @@ -30098,8 +31592,7 @@ "type": "integer" }, "enable_invoicing": { - "type": "boolean", - "description": "Invoice settings" + "type": "boolean" }, "invoice_label": { "type": [ @@ -30150,19 +31643,15 @@ ] }, "show_marketing_opt_in": { - "type": "boolean", - "description": "Marketing settings" + "type": "boolean" }, "allow_copy_details_to_all_attendees": { - "type": "boolean", - "description": "Attendee detail copy control" + "type": "boolean" }, "pass_platform_fee_to_buyer": { - "type": "boolean", - "description": "Platform fee settings" + "type": "boolean" }, "homepage_theme_settings": { - "description": "Homepage theme settings", "anyOf": [ { "type": "null" @@ -30197,25 +31686,29 @@ ] }, "allow_attendee_self_edit": { - "type": "boolean", - "description": "Self-service settings" + "type": "boolean" }, "show_available_occurrence_capacity": { - "type": "boolean", - "description": "Occurrence display" + "type": "boolean" }, "hide_sold_out_occurrences": { "type": "boolean" }, "waitlist_auto_process": { - "type": "boolean", - "description": "Waitlist settings" + "type": "boolean" }, "waitlist_offer_timeout_minutes": { "type": [ "integer", "null" ] + }, + "enabled_features": { + "type": "array", + "items": { + "type": "string", + "const": "BADGES" + } } }, "required": [ @@ -30271,7 +31764,8 @@ "show_available_occurrence_capacity", "hide_sold_out_occurrences", "waitlist_auto_process", - "waitlist_offer_timeout_minutes" + "waitlist_offer_timeout_minutes", + "enabled_features" ], "title": "EventSettingsResource" }, @@ -31478,6 +32972,23 @@ ], "title": "LocationResource" }, + "MarkBadgesPrintedRequest": { + "type": "object", + "properties": { + "attendee_ids": { + "type": "array", + "items": { + "type": "integer" + }, + "minItems": 1, + "maxItems": 1000 + } + }, + "required": [ + "attendee_ids" + ], + "title": "MarkBadgesPrintedRequest" + }, "MeResource": { "type": "object", "properties": { @@ -36642,7 +38153,6 @@ }, "payment_providers": { "type": "array", - "description": "Payment settings", "items": { "type": "string", "enum": [ @@ -36675,8 +38185,7 @@ "maximum": 720 }, "enable_invoicing": { - "type": "boolean", - "description": "Invoice settings" + "type": "boolean" }, "invoice_label": { "type": [ @@ -36737,7 +38246,6 @@ }, "ticket_design_settings": { "type": "object", - "description": "Ticket design settings", "properties": { "accent_color": { "type": [ @@ -36790,20 +38298,16 @@ } }, "show_marketing_opt_in": { - "type": "boolean", - "description": "Marketing settings" + "type": "boolean" }, "allow_copy_details_to_all_attendees": { - "type": "boolean", - "description": "Attendee detail copy control" + "type": "boolean" }, "pass_platform_fee_to_buyer": { - "type": "boolean", - "description": "Platform fee settings" + "type": "boolean" }, "homepage_theme_settings": { "type": "object", - "description": "Homepage theme settings", "properties": { "accent": { "type": [ @@ -37021,19 +38525,16 @@ "maxItems": 41 }, "allow_attendee_self_edit": { - "type": "boolean", - "description": "Self-service settings" + "type": "boolean" }, "show_available_occurrence_capacity": { - "type": "boolean", - "description": "Occurrence display" + "type": "boolean" }, "hide_sold_out_occurrences": { "type": "boolean" }, "waitlist_auto_process": { - "type": "boolean", - "description": "Waitlist settings" + "type": "boolean" }, "waitlist_offer_timeout_minutes": { "type": [ @@ -37042,6 +38543,15 @@ ], "minimum": 1, "maximum": 10080 + }, + "enabled_features": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "BADGES" + ] + } } }, "title": "UpdateEventSettingsRequest" @@ -37146,6 +38656,252 @@ ], "title": "UpdateProductVisibilityRequest" }, + "UpsertBadgeDesignRequest": { + "type": "object", + "properties": { + "template": { + "type": "string", + "enum": [ + "CLASSIC", + "BANNER", + "MINIMAL", + "BOLD", + "SIDEBAR", + "ARTWORK" + ] + }, + "size": { + "type": "string", + "enum": [ + "A6_PORTRAIT", + "A7_PORTRAIT", + "IN_4X3_LANDSCAPE", + "IN_3X4_PORTRAIT", + "IN_4X6_PORTRAIT", + "CR80_PORTRAIT", + "CR80_LANDSCAPE", + "LABEL_62X100", + "CUSTOM" + ] + }, + "custom_width_mm": { + "type": [ + "integer", + "null" + ], + "minimum": 40, + "maximum": 220 + }, + "custom_height_mm": { + "type": [ + "integer", + "null" + ], + "minimum": 40, + "maximum": 220 + }, + "sheet": { + "type": "string", + "enum": [ + "A4", + "LETTER", + "NONE" + ] + }, + "accent_color": { + "type": "string", + "pattern": "^#[0-9a-fA-F]{6}$" + }, + "background_color": { + "type": [ + "string", + "null" + ], + "pattern": "^#[0-9a-fA-F]{6}$" + }, + "text_color": { + "type": [ + "string", + "null" + ], + "pattern": "^#[0-9a-fA-F]{6}$" + }, + "font_family": { + "type": "string", + "enum": [ + "Outfit", + "Inter", + "Roboto", + "Open Sans", + "Poppins", + "Montserrat", + "Lato", + "Nunito", + "Raleway", + "DM Sans", + "Plus Jakarta Sans", + "Work Sans", + "Space Grotesk", + "Manrope", + "Oswald", + "Bebas Neue", + "Playfair Display", + "Merriweather", + "Lora" + ] + }, + "text_align": { + "type": [ + "string", + "null" + ], + "enum": [ + "LEFT", + "CENTER", + null + ] + }, + "uppercase_names": { + "type": "boolean" + }, + "lines": { + "type": "array", + "items": { + "type": "object", + "properties": { + "source": { + "type": "string", + "enum": [ + "FIRST_NAME", + "LAST_NAME", + "FULL_NAME", + "TICKET_TYPE", + "QUESTION", + "OCCURRENCE_DATE", + "CUSTOM_TEXT" + ] + }, + "size": { + "type": "string", + "enum": [ + "XL", + "L", + "M", + "S" + ] + }, + "question_id": { + "type": [ + "integer", + "null" + ] + }, + "text": { + "type": [ + "string", + "null" + ], + "maxLength": 80 + } + }, + "required": [ + "source", + "size" + ] + }, + "minItems": 1, + "maxItems": 5 + }, + "show_logo": { + "type": "boolean" + }, + "show_qr": { + "type": "boolean" + }, + "show_ribbon": { + "type": "boolean" + }, + "show_seat": { + "type": "boolean" + }, + "show_event_name": { + "type": "boolean" + }, + "show_sponsors": { + "type": "boolean" + }, + "footer_text": { + "type": [ + "string", + "null" + ], + "maxLength": 120 + }, + "ribbons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "product_id": { + "type": "integer" + }, + "label": { + "type": [ + "string", + "null" + ], + "maxLength": 40 + }, + "color": { + "type": "string", + "pattern": "^#[0-9a-fA-F]{6}$" + } + }, + "required": [ + "product_id", + "color" + ] + }, + "maxItems": 100 + }, + "back_mode": { + "type": "string", + "enum": [ + "NONE", + "SAME", + "INFO" + ] + }, + "back_text": { + "type": [ + "string", + "null" + ], + "maxLength": 600 + }, + "fold_over": { + "type": "boolean" + } + }, + "required": [ + "template", + "size", + "sheet", + "accent_color", + "font_family", + "uppercase_names", + "lines", + "show_logo", + "show_qr", + "show_ribbon", + "show_seat", + "show_event_name", + "show_sponsors", + "ribbons", + "back_mode" + ], + "title": "UpsertBadgeDesignRequest" + }, "UpsertBoxOfficeRequest": { "type": "object", "properties": { @@ -37318,6 +39074,18 @@ "boolean", "null" ] + }, + "badge_printing_enabled": { + "type": [ + "boolean", + "null" + ] + }, + "kiosk_mode": { + "type": [ + "boolean", + "null" + ] } }, "required": [ diff --git a/backend/routes/api.php b/backend/routes/api.php index 7849bc25bb..10b70ec87e 100644 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -171,6 +171,13 @@ use HiEvents\Http\Actions\Auth\Sso\StartSsoReauthAction; use HiEvents\Http\Actions\Auth\TwoFactorLoginAction; use HiEvents\Http\Actions\Auth\ValidateResetPasswordTokenAction; +use HiEvents\Http\Actions\Badges\GetBadgeDesignAction; +use HiEvents\Http\Actions\Badges\GetBadgesAction; +use HiEvents\Http\Actions\Badges\GetBadgeStatsAction; +use HiEvents\Http\Actions\Badges\MarkBadgesPrintedAction; +use HiEvents\Http\Actions\Badges\Public\GetCheckInListAttendeeBadgePublicAction; +use HiEvents\Http\Actions\Badges\Public\MarkCheckInListAttendeeBadgePrintedPublicAction; +use HiEvents\Http\Actions\Badges\UpsertBadgeDesignAction; use HiEvents\Http\Actions\CapacityAssignments\CreateCapacityAssignmentAction; use HiEvents\Http\Actions\CapacityAssignments\DeleteCapacityAssignmentAction; use HiEvents\Http\Actions\CapacityAssignments\GetCapacityAssignmentAction; @@ -673,6 +680,12 @@ function (Router $router): void { $router->post('/events/{event_id}/attendees/{attendee_public_id}/resend-ticket', ResendAttendeeTicketAction::class); $router->post('/events/{event_id}/attendees/{attendee_public_id}/check_in', CheckInAttendeeAction::class); + $router->get('/events/{event_id}/badge-design', GetBadgeDesignAction::class); + $router->put('/events/{event_id}/badge-design', UpsertBadgeDesignAction::class); + $router->get('/events/{event_id}/badges', GetBadgesAction::class); + $router->get('/events/{event_id}/badges/stats', GetBadgeStatsAction::class); + $router->post('/events/{event_id}/badges/printed', MarkBadgesPrintedAction::class); + // Orders $router->get('/events/{event_id}/orders', GetOrdersAction::class); $router->get('/events/{event_id}/orders/{order_id}', GetOrderAction::class); @@ -1017,6 +1030,10 @@ function (Router $router): void { $router->get('/check-in-lists/{check_in_list_short_id}/attendees/{attendee_public_id}/detail', GetCheckInListAttendeeDetailPublicAction::class); $router->post('/check-in-lists/{check_in_list_short_id}/check-ins', CreateAttendeeCheckInPublicAction::class); $router->delete('/check-in-lists/{check_in_list_short_id}/check-ins/{check_in_short_id}', DeleteAttendeeCheckInPublicAction::class); + $router->get('/check-in-lists/{check_in_list_short_id}/attendees/{attendee_public_id}/badge', GetCheckInListAttendeeBadgePublicAction::class) + ->middleware('throttle:120,1,public-check-in-badge'); + $router->post('/check-in-lists/{check_in_list_short_id}/attendees/{attendee_public_id}/badge/printed', MarkCheckInListAttendeeBadgePrintedPublicAction::class) + ->middleware('throttle:120,1,public-check-in-badge-printed'); // Color themes $router->get('/color-themes', GetColorThemesAction::class); diff --git a/backend/tests/Concerns/CreatesBadgeFixtures.php b/backend/tests/Concerns/CreatesBadgeFixtures.php new file mode 100644 index 0000000000..aafd15da46 --- /dev/null +++ b/backend/tests/Concerns/CreatesBadgeFixtures.php @@ -0,0 +1,146 @@ +createEvent($accountId, $this->createOrganizer($accountId)); + DB::table('events')->where('id', $eventId)->update(['currency' => $currency]); + DB::table('event_settings')->insert([ + 'event_id' => $eventId, + 'enabled_features' => json_encode($badgesEnabled ? ['BADGES'] : []), + 'created_at' => now(), + 'updated_at' => now(), + ]); + + return $eventId; + } + + protected function createTicketProduct(int $eventId, string $title = 'General Admission'): int + { + return DB::table('products')->insertGetId([ + 'title' => $title, + 'event_id' => $eventId, + 'order' => 1, + 'product_type' => 'TICKET', + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + + protected function createQuestion(int $eventId, string $title, string $belongsTo = 'PRODUCT', string $type = 'SINGLE_LINE_TEXT'): int + { + return DB::table('questions')->insertGetId([ + 'event_id' => $eventId, + 'title' => $title, + 'type' => $type, + 'belongs_to' => $belongsTo, + 'required' => false, + 'order' => 1, + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + + /** + * @return array{id: int, public_id: string, order_id: int} + */ + protected function createBadgeAttendee( + int $eventId, + int $productId, + string $firstName, + string $lastName, + string $status = 'ACTIVE', + string $orderStatus = 'COMPLETED', + ?int $orderId = null, + ): array { + $priceId = DB::table('product_prices')->where('product_id', $productId)->value('id') + ?? DB::table('product_prices')->insertGetId([ + 'product_id' => $productId, + 'price' => 0, + 'created_at' => now(), + 'updated_at' => now(), + ]); + + $orderId ??= DB::table('orders')->insertGetId([ + 'short_id' => 'ord_'.uniqid(), + 'event_id' => $eventId, + 'currency' => 'EUR', + 'status' => $orderStatus, + 'public_id' => 'PUB_'.uniqid(), + 'first_name' => $firstName, + 'last_name' => $lastName, + 'email' => 'buyer@example.test', + 'created_at' => now(), + 'updated_at' => now(), + ]); + + $publicId = 'A-'.strtoupper(substr(uniqid(), -7)).random_int(10, 99); + $id = DB::table('attendees')->insertGetId([ + 'short_id' => 'att_'.uniqid(), + 'email' => strtolower($firstName).'@example.test', + 'first_name' => $firstName, + 'last_name' => $lastName, + 'order_id' => $orderId, + 'product_id' => $productId, + 'product_price_id' => $priceId, + 'event_id' => $eventId, + 'public_id' => $publicId, + 'status' => $status, + 'created_at' => now(), + 'updated_at' => now(), + ]); + + return ['id' => $id, 'public_id' => $publicId, 'order_id' => $orderId]; + } + + protected function answerQuestion(int $questionId, int $orderId, ?int $attendeeId, string|array $answer, ?int $productId = null): void + { + DB::table('question_answers')->insert([ + 'question_id' => $questionId, + 'order_id' => $orderId, + 'attendee_id' => $attendeeId, + 'product_id' => $productId, + 'answer' => json_encode($answer), + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + + protected function badgeDesignPayload(array $overrides = []): array + { + return array_replace([ + 'template' => 'CLASSIC', + 'size' => 'A6_PORTRAIT', + 'custom_width_mm' => null, + 'custom_height_mm' => null, + 'sheet' => 'A4', + 'accent_color' => '#1d4ed8', + 'background_color' => null, + 'text_color' => null, + 'font_family' => 'Inter', + 'text_align' => null, + 'uppercase_names' => false, + 'lines' => [ + ['source' => 'FIRST_NAME', 'size' => 'XL'], + ['source' => 'LAST_NAME', 'size' => 'L'], + ], + 'show_logo' => true, + 'show_qr' => true, + 'show_ribbon' => true, + 'show_seat' => true, + 'show_event_name' => true, + 'show_sponsors' => true, + 'footer_text' => null, + 'ribbons' => [], + 'back_mode' => 'NONE', + 'back_text' => null, + ], $overrides); + } +} diff --git a/backend/tests/Feature/Http/Actions/Badges/BadgesTest.php b/backend/tests/Feature/Http/Actions/Badges/BadgesTest.php new file mode 100644 index 0000000000..c193ae5f22 --- /dev/null +++ b/backend/tests/Feature/Http/Actions/Badges/BadgesTest.php @@ -0,0 +1,331 @@ +createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId, 'USD'); + $companyId = $this->createQuestion($eventId, 'Company name'); + $jobTitleId = $this->createQuestion($eventId, 'Job title'); + $this->createQuestion($eventId, 'Dietary requirements'); + + $design = $this->getJson("/events/$eventId/badge-design", $this->headersFor($owner, $accountId)) + ->assertOk() + ->json('data'); + + $this->assertFalse($design['is_customized']); + $this->assertSame('IN_4X3_LANDSCAPE', $design['size']); + $this->assertSame('LETTER', $design['sheet']); + $this->assertSame( + [['FIRST_NAME', null], ['LAST_NAME', null], ['QUESTION', $companyId], ['QUESTION', $jobTitleId]], + array_map(fn (array $line) => [$line['source'], $line['question_id']], $design['lines']), + ); + } + + public function test_badges_are_switched_on_per_event_from_event_settings(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId, badgesEnabled: false); + DB::table('event_settings')->where('event_id', $eventId)->update(['payment_providers' => json_encode(['STRIPE'])]); + $headers = $this->headersFor($owner, $accountId); + + $this->getJson("/events/$eventId/settings", $headers)->assertOk()->assertJsonPath('data.enabled_features', []); + + $this->patchJson("/events/$eventId/settings", ['enabled_features' => ['BADGES', 'BADGES']], $headers)->assertOk(); + $this->patchJson("/events/$eventId/settings", ['waitlist_auto_process' => false], $headers)->assertOk(); + $this->getJson("/events/$eventId/settings", $headers)->assertOk()->assertJsonPath('data.enabled_features', ['BADGES']); + + $this->patchJson("/events/$eventId/settings", ['enabled_features' => ['SPACESHIPS']], $headers) + ->assertUnprocessable() + ->assertJsonValidationErrors('enabled_features.0'); + + $this->patchJson("/events/$eventId/settings", ['enabled_features' => []], $headers)->assertOk(); + $this->getJson("/events/$eventId/settings", $headers)->assertOk()->assertJsonPath('data.enabled_features', []); + } + + public function test_a_design_is_saved_and_returned(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $productId = $this->createTicketProduct($eventId, 'Speaker'); + $questionId = $this->createQuestion($eventId, 'Company'); + $headers = $this->headersFor($owner, $accountId); + + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload([ + 'template' => 'BANNER', + 'lines' => [ + ['source' => 'FULL_NAME', 'size' => 'XL', 'text' => 'ignored'], + ['source' => 'QUESTION', 'size' => 'M', 'question_id' => $questionId], + ['source' => 'CUSTOM_TEXT', 'size' => 'S', 'text' => 'Ask me about Hi.Events'], + ], + 'ribbons' => [['product_id' => $productId, 'label' => 'SPEAKER', 'color' => '#b91c1c']], + 'back_mode' => 'SAME', + 'fold_over' => true, + ]), $headers)->assertOk(); + + $design = $this->getJson("/events/$eventId/badge-design", $headers)->assertOk()->json('data'); + + $this->assertTrue($design['is_customized']); + $this->assertSame('BANNER', $design['template']); + $this->assertSame('SAME', $design['back_mode']); + $this->assertTrue($design['fold_over']); + $this->assertNull($design['lines'][0]['text']); + $this->assertSame($questionId, $design['lines'][1]['question_id']); + $this->assertSame('Ask me about Hi.Events', $design['lines'][2]['text']); + $this->assertSame([['product_id' => $productId, 'label' => 'SPEAKER', 'color' => '#b91c1c']], $design['ribbons']); + } + + public function test_a_design_cannot_reference_another_events_question_or_ticket(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $otherEventId = $this->createBadgeEvent($accountId); + $headers = $this->headersFor($owner, $accountId); + + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload([ + 'lines' => [['source' => 'QUESTION', 'size' => 'M', 'question_id' => $this->createQuestion($otherEventId, 'Company')]], + ]), $headers)->assertStatus(422)->assertJsonValidationErrors(['lines.0.question_id']); + + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload([ + 'ribbons' => [['product_id' => $this->createTicketProduct($otherEventId), 'label' => null, 'color' => '#000000']], + ]), $headers)->assertStatus(422)->assertJsonValidationErrors(['ribbons.0.product_id']); + + $this->assertNull(DB::table('event_settings')->where('event_id', $eventId)->value('badge_design_settings')); + } + + public function test_design_validation_rejects_bad_colours_and_duplicate_ribbons(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $productId = $this->createTicketProduct($eventId); + + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload([ + 'accent_color' => 'red;}body{display:none', + 'size' => 'CUSTOM', + 'ribbons' => [ + ['product_id' => $productId, 'label' => null, 'color' => '#000000'], + ['product_id' => $productId, 'label' => null, 'color' => '#ffffff'], + ], + ]), $this->headersFor($owner, $accountId)) + ->assertStatus(422) + ->assertJsonValidationErrors(['accent_color', 'custom_width_mm', 'custom_height_mm', 'ribbons.1.product_id']); + } + + public function test_read_only_members_can_view_but_not_change_badges(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $attendee = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $viewer = $this->addAccountUser($accountId, Role::VIEWER); + $headers = $this->headersFor($viewer, $accountId); + + $this->getJson("/events/$eventId/badge-design", $headers)->assertOk(); + $this->getJson("/events/$eventId/badges", $headers)->assertOk(); + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload(), $headers)->assertForbidden(); + $this->postJson("/events/$eventId/badges/printed", ['attendee_ids' => [$attendee['id']]], $headers)->assertForbidden(); + } + + public function test_badges_resolve_answers_ribbons_and_skip_ineligible_attendees(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $speakerId = $this->createTicketProduct($eventId, 'Speaker pass'); + $generalId = $this->createTicketProduct($eventId, 'General'); + $companyId = $this->createQuestion($eventId, 'Company'); + $teamId = $this->createQuestion($eventId, 'Team', 'ORDER'); + $ada = $this->createBadgeAttendee($eventId, $speakerId, 'Ada', 'Lovelace'); + $grace = $this->createBadgeAttendee($eventId, $generalId, 'Grace', 'Hopper'); + $this->createBadgeAttendee($eventId, $generalId, 'Cancelled', 'Person', 'CANCELLED'); + $this->createBadgeAttendee($eventId, $generalId, 'Unpaid', 'Person', 'AWAITING_PAYMENT', 'AWAITING_OFFLINE_PAYMENT'); + $this->answerQuestion($companyId, $ada['order_id'], $ada['id'], 'Analytical Engines', $speakerId); + $this->answerQuestion($teamId, $grace['order_id'], null, ['Navy', 'Compilers']); + $headers = $this->headersFor($owner, $accountId); + + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload([ + 'lines' => [ + ['source' => 'FIRST_NAME', 'size' => 'XL'], + ['source' => 'QUESTION', 'size' => 'M', 'question_id' => $companyId], + ['source' => 'QUESTION', 'size' => 'S', 'question_id' => $teamId], + ], + 'ribbons' => [['product_id' => $speakerId, 'label' => 'SPEAKER', 'color' => '#b91c1c']], + ]), $headers)->assertOk(); + + $badges = $this->getJson("/events/$eventId/badges?sort_by=first_name", $headers)->assertOk()->json('data'); + + $this->assertSame(['Ada', 'Grace'], array_column($badges, 'first_name')); + $this->assertSame([['FIRST_NAME', 'Ada'], ['QUESTION', 'Analytical Engines']], array_map(fn ($line) => [$line['source'], $line['text']], $badges[0]['lines'])); + $this->assertSame(['label' => 'SPEAKER', 'color' => '#b91c1c'], $badges[0]['ribbon']); + $this->assertSame([['FIRST_NAME', 'Grace'], ['QUESTION', 'Navy, Compilers']], array_map(fn ($line) => [$line['source'], $line['text']], $badges[1]['lines'])); + $this->assertSame(['label' => 'General', 'color' => '#1d4ed8'], $badges[1]['ribbon']); + } + + public function test_attendees_awaiting_offline_payment_are_included_when_they_can_check_in(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Unpaid', 'Person', 'AWAITING_PAYMENT', 'AWAITING_OFFLINE_PAYMENT'); + DB::table('event_settings')->where('event_id', $eventId)->update(['allow_orders_awaiting_offline_payment_to_check_in' => true]); + + $this->getJson("/events/$eventId/badges", $this->headersFor($owner, $accountId)) + ->assertOk() + ->assertJsonPath('data.0.first_name', 'Unpaid'); + } + + public function test_badges_filter_by_ids_order_ticket_and_print_status(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $speakerId = $this->createTicketProduct($eventId, 'Speaker'); + $generalId = $this->createTicketProduct($eventId, 'General'); + $ada = $this->createBadgeAttendee($eventId, $speakerId, 'Ada', 'Lovelace'); + $grace = $this->createBadgeAttendee($eventId, $generalId, 'Grace', 'Hopper'); + $alan = $this->createBadgeAttendee($eventId, $generalId, 'Alan', 'Turing', orderId: $grace['order_id']); + $foreign = $this->createBadgeAttendee($this->createBadgeEvent($accountId), $speakerId, 'Not', 'Mine'); + DB::table('attendees')->where('id', $ada['id'])->update(['badge_printed_at' => now(), 'badge_print_count' => 1]); + $headers = $this->headersFor($owner, $accountId); + + $names = fn (string $query) => array_column($this->getJson("/events/$eventId/badges?$query", $headers)->assertOk()->json('data'), 'first_name'); + + $this->assertSame(['Grace', 'Alan'], $names('attendee_ids='.$grace['id'].','.$alan['id'].','.$foreign['id'].'&sort_by=created_at')); + $this->assertSame(['Grace', 'Alan'], $names('order_id='.$grace['order_id'].'&sort_by=created_at')); + $this->assertSame(['Ada'], $names("product_ids=$speakerId")); + $this->assertSame(['Grace', 'Alan'], $names('only_unprinted=true&sort_by=created_at')); + $this->assertSame(['Grace', 'Ada', 'Alan'], $names('sort_by=last_name')); + } + + public function test_marking_badges_printed_updates_stats_and_name_changes_flag_a_reprint(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $productId = $this->createTicketProduct($eventId); + $ada = $this->createBadgeAttendee($eventId, $productId, 'Ada', 'Lovelace'); + $grace = $this->createBadgeAttendee($eventId, $productId, 'Grace', 'Hopper'); + $headers = $this->headersFor($owner, $accountId); + + $this->postJson("/events/$eventId/badges/printed", ['attendee_ids' => [$ada['id'], $grace['id']]], $headers) + ->assertOk() + ->assertJsonPath('data.updated', 2); + $this->postJson("/events/$eventId/badges/printed", ['attendee_ids' => [$ada['id']]], $headers)->assertOk(); + + $this->getJson("/events/$eventId/badges/stats", $headers) + ->assertOk() + ->assertJsonPath('data', ['total' => 2, 'printed' => 2, 'not_printed' => 0, 'needs_reprint' => 0]); + $this->assertSame(2, DB::table('attendees')->where('id', $ada['id'])->value('badge_print_count')); + + $this->patchJson("/events/$eventId/attendees/{$ada['id']}", ['first_name' => 'Augusta'], $headers) + ->assertOk() + ->assertJsonPath('data.badge_print_status', 'NEEDS_REPRINT'); + + $this->getJson("/events/$eventId/badges/stats", $headers) + ->assertJsonPath('data', ['total' => 2, 'printed' => 1, 'not_printed' => 0, 'needs_reprint' => 1]); + } + + public function test_marking_another_events_attendee_printed_is_rejected_before_any_write(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $mine = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $otherEventId = $this->createBadgeEvent($accountId); + $foreign = $this->createBadgeAttendee($otherEventId, $this->createTicketProduct($otherEventId), 'Not', 'Mine'); + + $this->postJson("/events/$eventId/badges/printed", ['attendee_ids' => [$mine['id'], $foreign['id']]], $this->headersFor($owner, $accountId)) + ->assertStatus(422) + ->assertJsonValidationErrors(['attendee_ids']); + + $this->assertSame(0, DB::table('attendees')->whereIn('id', [$mine['id'], $foreign['id']])->sum('badge_print_count')); + } + + public function test_marking_printed_rejects_duplicate_ids(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $ada = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + + $this->postJson("/events/$eventId/badges/printed", ['attendee_ids' => [$ada['id'], $ada['id']]], $this->headersFor($owner, $accountId)) + ->assertStatus(422) + ->assertJsonValidationErrors(['attendee_ids']); + $this->postJson("/events/$eventId/badges/printed", ['attendee_ids' => [[1], [2]]], $this->headersFor($owner, $accountId)) + ->assertStatus(422) + ->assertJsonValidationErrors(['attendee_ids.0']); + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload([ + 'ribbons' => [['product_id' => [1], 'label' => null, 'color' => '#000000']], + ]), $this->headersFor($owner, $accountId)) + ->assertStatus(422) + ->assertJsonValidationErrors(['ribbons.0.product_id']); + } + + public function test_editing_an_answer_on_the_badge_flags_a_reprint(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $productId = $this->createTicketProduct($eventId); + $companyId = $this->createQuestion($eventId, 'Company'); + $ada = $this->createBadgeAttendee($eventId, $productId, 'Ada', 'Lovelace'); + $this->answerQuestion($companyId, $ada['order_id'], $ada['id'], 'Analytical Engines', $productId); + DB::table('attendees')->where('id', $ada['id'])->update(['badge_printed_at' => now(), 'badge_print_count' => 1]); + $answerId = DB::table('question_answers')->where('question_id', $companyId)->value('id'); + + $this->putJson("/events/$eventId/questions/$companyId/answers/$answerId", ['answer' => 'Difference Engines'], $this->headersFor($owner, $accountId)) + ->assertSuccessful(); + + $this->assertNull(DB::table('attendees')->where('id', $ada['id'])->value('badge_printed_at')); + } + + public function test_duplicating_an_event_carries_the_badge_design_onto_the_new_ids(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $productId = $this->createTicketProduct($eventId, 'Speaker'); + DB::table('products')->where('id', $productId)->update([ + 'product_category_id' => DB::table('product_categories')->insertGetId([ + 'event_id' => $eventId, + 'name' => 'Tickets', + 'order' => 1, + 'created_at' => now(), + 'updated_at' => now(), + ]), + ]); + DB::table('product_prices')->insert(['product_id' => $productId, 'price' => 0, 'created_at' => now(), 'updated_at' => now()]); + $companyId = $this->createQuestion($eventId, 'Company'); + DB::table('product_questions')->insert(['product_id' => $productId, 'question_id' => $companyId]); + $headers = $this->headersFor($owner, $accountId); + $this->putJson("/events/$eventId/badge-design", $this->badgeDesignPayload([ + 'lines' => [['source' => 'FIRST_NAME', 'size' => 'XL'], ['source' => 'QUESTION', 'size' => 'M', 'question_id' => $companyId]], + 'ribbons' => [['product_id' => $productId, 'label' => 'SPEAKER', 'color' => '#b91c1c']], + ]), $headers)->assertOk(); + + $newEventId = $this->postJson("/events/$eventId/duplicate", [ + 'title' => 'Copy', + 'start_date' => now()->addMonth()->format('Y-m-d H:i'), + 'duplicate_products' => true, + 'duplicate_questions' => true, + 'duplicate_settings' => true, + 'duplicate_promo_codes' => false, + 'duplicate_capacity_assignments' => false, + 'duplicate_check_in_lists' => false, + 'duplicate_event_cover_image' => false, + 'duplicate_ticket_logo' => false, + 'duplicate_webhooks' => false, + 'duplicate_affiliates' => false, + ], $headers)->assertSuccessful()->json('data.id'); + + $design = $this->getJson("/events/$newEventId/badge-design", $headers)->assertOk()->json('data'); + $newQuestionId = DB::table('questions')->where('event_id', $newEventId)->value('id'); + $newProductId = DB::table('products')->where('event_id', $newEventId)->where('title', 'Speaker')->value('id'); + + $this->assertSame($newQuestionId, $design['lines'][1]['question_id']); + $this->assertSame($newProductId, $design['ribbons'][0]['product_id']); + } +} diff --git a/backend/tests/Feature/Http/Actions/Badges/CheckInListBadgePublicTest.php b/backend/tests/Feature/Http/Actions/Badges/CheckInListBadgePublicTest.php new file mode 100644 index 0000000000..7964b01c8b --- /dev/null +++ b/backend/tests/Feature/Http/Actions/Badges/CheckInListBadgePublicTest.php @@ -0,0 +1,170 @@ +createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $productId = $this->createTicketProduct($eventId, 'Speaker'); + $attendee = $this->createBadgeAttendee($eventId, $productId, 'Ada', 'Lovelace'); + $listShortId = $this->createList($eventId, badgePrinting: true); + + $this->getJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge") + ->assertOk() + ->assertJsonPath('data.lines.0.text', 'Ada') + ->assertJsonPath('data.ribbon.label', 'Speaker') + ->assertJsonPath('data.print_status', 'NOT_PRINTED'); + + $this->postJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge/printed") + ->assertOk() + ->assertJsonPath('data.print_status', 'PRINTED') + ->assertJsonPath('data.badge_print_count', 1); + } + + public function test_the_public_list_carries_the_badge_layout_only_when_printing_is_enabled(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $printingList = $this->createList($eventId, badgePrinting: true); + $plainList = $this->createList($eventId); + + $layout = $this->getJson("/public/check-in-lists/$printingList")->assertOk()->json('data.badge_design'); + + $this->assertSame('CLASSIC', $layout['template']); + $this->assertFalse($layout['fold_over']); + $this->assertArrayNotHasKey('lines', $layout); + $this->assertArrayNotHasKey('ribbons', $layout); + $this->getJson("/public/check-in-lists/$plainList")->assertOk()->assertJsonMissingPath('data.badge_design'); + } + + public function test_badges_are_not_available_on_lists_without_badge_printing(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $attendee = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $listShortId = $this->createList($eventId); + + $this->getJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge")->assertNotFound(); + $this->postJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge/printed")->assertNotFound(); + $this->assertSame(0, DB::table('attendees')->where('id', $attendee['id'])->value('badge_print_count')); + } + + public function test_turning_badges_off_for_the_event_stops_door_printing(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId, badgesEnabled: false); + $attendee = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $listShortId = $this->createList($eventId, badgePrinting: true); + + $this->getJson("/public/check-in-lists/$listShortId") + ->assertOk() + ->assertJsonPath('data.badge_printing_enabled', false) + ->assertJsonMissingPath('data.badge_design'); + $this->getJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge")->assertNotFound(); + $this->postJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge/printed")->assertNotFound(); + } + + public function test_badges_are_scoped_to_the_lists_tickets_and_event(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $speakerId = $this->createTicketProduct($eventId, 'Speaker'); + $generalId = $this->createTicketProduct($eventId, 'General'); + $general = $this->createBadgeAttendee($eventId, $generalId, 'Grace', 'Hopper'); + $cancelled = $this->createBadgeAttendee($eventId, $speakerId, 'Gone', 'Away', 'CANCELLED'); + $otherEventId = $this->createBadgeEvent($accountId); + $foreign = $this->createBadgeAttendee($otherEventId, $this->createTicketProduct($otherEventId), 'Not', 'Mine'); + $listShortId = $this->createList($eventId, badgePrinting: true); + DB::table('product_check_in_lists')->insert([ + 'product_id' => $speakerId, + 'check_in_list_id' => DB::table('check_in_lists')->where('short_id', $listShortId)->value('id'), + ]); + + foreach ([$general, $cancelled, $foreign] as $attendee) { + $this->getJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge")->assertNotFound(); + } + } + + public function test_expired_lists_refuse_badges(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $attendee = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $listShortId = $this->createList($eventId, badgePrinting: true); + DB::table('check_in_lists')->where('short_id', $listShortId)->update(['expires_at' => now()->subDay()]); + + $this->getJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/badge")->assertForbidden(); + } + + public function test_kiosk_lists_hide_the_attendee_list_but_still_find_scanned_attendees(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $attendee = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $listShortId = $this->createList($eventId, badgePrinting: true, kiosk: true); + + $this->getJson("/public/check-in-lists/$listShortId/attendees")->assertForbidden(); + $this->getJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}/detail")->assertForbidden(); + $this->getJson("/public/check-in-lists/$listShortId/attendees/{$attendee['public_id']}") + ->assertOk() + ->assertJsonPath('data.first_name', 'Ada'); + $this->getJson("/public/check-in-lists/$listShortId")->assertOk()->assertJsonPath('data.kiosk_mode', true); + } + + public function test_badge_printing_and_kiosk_mode_are_saved_on_check_in_lists(): void + { + [$owner, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $headers = $this->headersFor($owner, $accountId); + + $listId = $this->postJson("/events/$eventId/check-in-lists", [ + 'name' => 'Registration desk', + 'badge_printing_enabled' => true, + 'kiosk_mode' => true, + ], $headers) + ->assertOk() + ->assertJsonPath('data.badge_printing_enabled', true) + ->assertJsonPath('data.kiosk_mode', true) + ->json('data.id'); + + $this->putJson("/events/$eventId/check-in-lists/$listId", ['name' => 'Front door'], $headers) + ->assertOk() + ->assertJsonPath('data.badge_printing_enabled', true) + ->assertJsonPath('data.kiosk_mode', true); + + $this->putJson("/events/$eventId/check-in-lists/$listId", [ + 'name' => 'Registration desk', + 'badge_printing_enabled' => true, + 'kiosk_mode' => false, + ], $headers) + ->assertOk() + ->assertJsonPath('data.kiosk_mode', false); + } + + private function createList(int $eventId, bool $badgePrinting = false, bool $kiosk = false): string + { + $shortId = 'cil_'.uniqid(); + DB::table('check_in_lists')->insert([ + 'short_id' => $shortId, + 'name' => 'Door', + 'event_id' => $eventId, + 'badge_printing_enabled' => $badgePrinting, + 'kiosk_mode' => $kiosk, + 'created_at' => now(), + 'updated_at' => now(), + ]); + + return $shortId; + } +} diff --git a/backend/tests/Feature/SeatMap/EventSeatMapClaimGuardsTest.php b/backend/tests/Feature/SeatMap/EventSeatMapClaimGuardsTest.php index d570587df7..7907274845 100644 --- a/backend/tests/Feature/SeatMap/EventSeatMapClaimGuardsTest.php +++ b/backend/tests/Feature/SeatMap/EventSeatMapClaimGuardsTest.php @@ -51,6 +51,8 @@ public function test_renaming_an_area_relabels_tens_of_thousands_of_sold_seats() $pastClaim = DB::table('seat_claims')->where('event_occurrence_id', $pastOccurrenceId)->first(); $upcomingAttendeeId = $this->insertAttendeeFor($upcomingClaim); $pastAttendeeId = $this->insertAttendeeFor($pastClaim); + DB::table('attendees')->whereIn('id', [$upcomingAttendeeId, $pastAttendeeId]) + ->update(['badge_printed_at' => now(), 'badge_print_count' => 1]); $renamed = $layout; $renamed['areas'][0]['name'] = 'Floor'; @@ -63,6 +65,8 @@ public function test_renaming_an_area_relabels_tens_of_thousands_of_sold_seats() $this->assertSame(0, DB::table('seat_claims')->where('event_occurrence_id', '!=', $pastOccurrenceId)->where('seat_label', 'like', 'Stalls%')->count()); $this->assertStringStartsWith('Floor · ', DB::table('attendees')->where('id', $upcomingAttendeeId)->value('seat_label')); $this->assertStringStartsWith('Stalls · ', DB::table('attendees')->where('id', $pastAttendeeId)->value('seat_label')); + $this->assertNull(DB::table('attendees')->where('id', $upcomingAttendeeId)->value('badge_printed_at')); + $this->assertNotNull(DB::table('attendees')->where('id', $pastAttendeeId)->value('badge_printed_at')); } public function test_a_zone_cannot_shrink_below_the_busiest_upcoming_date(): void diff --git a/backend/tests/Unit/Services/Application/Handlers/Attendee/EditAttendeeHandlerTest.php b/backend/tests/Unit/Services/Application/Handlers/Attendee/EditAttendeeHandlerTest.php index f67f7f14cd..cc2def6561 100644 --- a/backend/tests/Unit/Services/Application/Handlers/Attendee/EditAttendeeHandlerTest.php +++ b/backend/tests/Unit/Services/Application/Handlers/Attendee/EditAttendeeHandlerTest.php @@ -13,6 +13,7 @@ use HiEvents\Repository\Interfaces\ProductRepositoryInterface; use HiEvents\Services\Application\Handlers\Attendee\DTO\EditAttendeeDTO; use HiEvents\Services\Application\Handlers\Attendee\EditAttendeeHandler; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\Product\AvailableProductQuantitiesFetchService; use HiEvents\Services\Domain\Product\DTO\AvailableProductQuantitiesDTO; use HiEvents\Services\Domain\Product\DTO\AvailableProductQuantitiesResponseDTO; @@ -52,6 +53,8 @@ class EditAttendeeHandlerTest extends TestCase private SeatClaimService|MockInterface $seatClaimService; + private MockInterface|BadgeReprintService $badgeReprintService; + protected function setUp(): void { parent::setUp(); @@ -71,6 +74,9 @@ protected function setUp(): void $this->seatClaimService->shouldReceive('changeProductForAttendee')->andReturn(false)->byDefault(); $this->seatClaimService->shouldReceive('releaseForAttendee')->byDefault(); + $this->badgeReprintService = Mockery::mock(BadgeReprintService::class); + $this->badgeReprintService->shouldReceive('flagIfBadgeDetailsChanged')->andReturnUsing(fn ($before, $after) => $after)->byDefault(); + $this->handler = new EditAttendeeHandler( $this->attendeeRepository, $this->productRepository, @@ -79,6 +85,7 @@ protected function setUp(): void $this->domainEventDispatcherService, $this->availableProductQuantitiesFetchService, $this->seatClaimService, + $this->badgeReprintService, ); } diff --git a/backend/tests/Unit/Services/Application/Handlers/Attendee/PartialEditAttendeeHandlerTest.php b/backend/tests/Unit/Services/Application/Handlers/Attendee/PartialEditAttendeeHandlerTest.php index 3a931cf153..86a54d104c 100644 --- a/backend/tests/Unit/Services/Application/Handlers/Attendee/PartialEditAttendeeHandlerTest.php +++ b/backend/tests/Unit/Services/Application/Handlers/Attendee/PartialEditAttendeeHandlerTest.php @@ -14,6 +14,7 @@ use HiEvents\Repository\Interfaces\OrderRepositoryInterface; use HiEvents\Services\Application\Handlers\Attendee\DTO\PartialEditAttendeeDTO; use HiEvents\Services\Application\Handlers\Attendee\PartialEditAttendeeHandler; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\EventOccurrence\OccurrencePurchaseEligibilityService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsCancellationService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsReactivationService; @@ -73,6 +74,8 @@ class PartialEditAttendeeHandlerTest extends TestCase private AvailableProductQuantitiesFetchService|MockInterface $availableProductQuantitiesFetchService; + private MockInterface|BadgeReprintService $badgeReprintService; + protected function setUp(): void { parent::setUp(); @@ -101,6 +104,9 @@ protected function setUp(): void $this->occurrenceEligibilityService = Mockery::mock(OccurrencePurchaseEligibilityService::class); $this->availableProductQuantitiesFetchService = Mockery::mock(AvailableProductQuantitiesFetchService::class); + $this->badgeReprintService = Mockery::mock(BadgeReprintService::class); + $this->badgeReprintService->shouldReceive('flagIfBadgeDetailsChanged')->andReturnUsing(fn ($before, $after) => $after)->byDefault(); + $this->handler = new PartialEditAttendeeHandler( $this->attendeeRepository, $this->orderRepository, @@ -115,6 +121,7 @@ protected function setUp(): void $this->seatingEventLock, $this->occurrenceEligibilityService, $this->availableProductQuantitiesFetchService, + $this->badgeReprintService, ); } diff --git a/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandlerTest.php b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandlerTest.php index 8da352b72d..fbaea6ad1f 100644 --- a/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandlerTest.php +++ b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeeDetailPublicHandlerTest.php @@ -159,6 +159,7 @@ private function buildList( $checkInList->shouldReceive('getEventId')->andReturn($eventId); $checkInList->shouldReceive('getEvent')->andReturn($event); $checkInList->shouldReceive('getExpiresAt')->andReturn(null); + $checkInList->shouldReceive('getKioskMode')->andReturn(false); $checkInList->shouldReceive('getActivatesAt')->andReturn(null); $checkInList->shouldReceive('getProducts')->andReturn(new Collection); $checkInList->shouldReceive('getEventOccurrenceId')->andReturn(null); diff --git a/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandlerTest.php b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandlerTest.php index 78b5e9fde6..0a71a68801 100644 --- a/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandlerTest.php +++ b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeePublicHandlerTest.php @@ -2,6 +2,7 @@ namespace Tests\Unit\Services\Application\Handlers\CheckInList\Public; +use HiEvents\DomainObjects\AttendeeCheckInDomainObject; use HiEvents\DomainObjects\AttendeeDomainObject; use HiEvents\DomainObjects\CheckInListDomainObject; use HiEvents\Exceptions\CannotCheckInException; @@ -94,16 +95,19 @@ public function test_handle_throws_cannot_check_in_if_list_not_active_yet(): voi $this->handler->handle('short-id', 'attendee-public-id'); } - public function test_handle_returns_attendee_successfully(): void + public function test_handle_returns_attendee_with_their_check_in_for_this_list(): void { $checkInList = m::mock(CheckInListDomainObject::class); $checkInList->shouldReceive('getExpiresAt')->once()->andReturn(null); $checkInList->shouldReceive('getActivatesAt')->once()->andReturn(null); $checkInList->shouldReceive('getEventId')->once()->andReturn(123); + $checkInList->shouldReceive('getId')->andReturn(9); $checkInList->shouldReceive('getProducts')->once()->andReturn(new Collection); $checkInList->shouldReceive('getEventOccurrenceId')->once()->andReturn(null); - $attendee = m::mock(AttendeeDomainObject::class); + $otherListCheckIn = (new AttendeeCheckInDomainObject)->setId(1)->setCheckInListId(8); + $thisListCheckIn = (new AttendeeCheckInDomainObject)->setId(2)->setCheckInListId(9); + $attendee = (new AttendeeDomainObject)->setId(5)->setCheckIns(new Collection([$otherListCheckIn, $thisListCheckIn])); $this->checkInListRepository ->shouldReceive('loadRelation') @@ -115,6 +119,7 @@ public function test_handle_returns_attendee_successfully(): void ->once() ->andReturn($checkInList); + $this->attendeeRepository->shouldReceive('loadRelation')->once()->andReturnSelf(); $this->attendeeRepository ->shouldReceive('findFirstWhere') ->once() @@ -127,5 +132,6 @@ public function test_handle_returns_attendee_successfully(): void $result = $this->handler->handle('short-id', 'attendee-public-id'); $this->assertSame($attendee, $result); + $this->assertSame($thisListCheckIn, $result->getCheckIn()); } } diff --git a/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandlerTest.php b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandlerTest.php index 3610d69e29..bffcbb6a4a 100644 --- a/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandlerTest.php +++ b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/GetCheckInListAttendeesPublicHandlerTest.php @@ -42,6 +42,7 @@ private function buildCheckInList(?int $occurrenceId): CheckInListDomainObject $list->shouldReceive('getId')->andReturn(1); $list->shouldReceive('getEventOccurrenceId')->andReturn($occurrenceId); $list->shouldReceive('getExpiresAt')->andReturn(null); + $list->shouldReceive('getKioskMode')->andReturn(false); $list->shouldReceive('getActivatesAt')->andReturn(null); return $list; diff --git a/backend/tests/Unit/Services/Domain/Badge/BadgeDataServiceTest.php b/backend/tests/Unit/Services/Domain/Badge/BadgeDataServiceTest.php new file mode 100644 index 0000000000..acd331bb40 --- /dev/null +++ b/backend/tests/Unit/Services/Domain/Badge/BadgeDataServiceTest.php @@ -0,0 +1,221 @@ +questionRepository = Mockery::mock(QuestionRepositoryInterface::class); + $this->questionAnswerRepository = Mockery::mock(QuestionAnswerRepositoryInterface::class); + + $this->service = new BadgeDataService( + $this->questionRepository, + $this->questionAnswerRepository, + new QuestionAnswerFormatter, + ); + } + + public function test_name_ticket_date_and_custom_lines_resolve_without_touching_questions(): void + { + $design = $this->design(lines: [ + new BadgeLineDTO(BadgeFieldSource::FULL_NAME, BadgeTextSize::XL), + new BadgeLineDTO(BadgeFieldSource::TICKET_TYPE, BadgeTextSize::M), + new BadgeLineDTO(BadgeFieldSource::OCCURRENCE_DATE, BadgeTextSize::S), + new BadgeLineDTO(BadgeFieldSource::CUSTOM_TEXT, BadgeTextSize::S, text: 'Ask me anything'), + ]); + + $this->questionRepository->shouldNotReceive('findWhereIn'); + $this->questionAnswerRepository->shouldNotReceive('findWhereIn'); + + $badge = $this->service->buildBadges(self::EVENT_ID, collect([$this->attendee()]), $design)->first(); + + $this->assertSame( + ['Ada Lovelace', 'Speaker pass', '2027-03-04 09:00:00', 'Ask me anything'], + array_map(fn (BadgeLineDTO $line) => $line->text, $badge->lines), + ); + } + + public function test_attendee_and_order_answers_resolve_by_question_scope_and_empty_lines_are_dropped(): void + { + $design = $this->design(lines: [ + new BadgeLineDTO(BadgeFieldSource::FIRST_NAME, BadgeTextSize::XL), + new BadgeLineDTO(BadgeFieldSource::QUESTION, BadgeTextSize::M, question_id: 1), + new BadgeLineDTO(BadgeFieldSource::QUESTION, BadgeTextSize::S, question_id: 2), + new BadgeLineDTO(BadgeFieldSource::QUESTION, BadgeTextSize::S, question_id: 3), + ]); + + $this->questionRepository->shouldReceive('findWhereIn')->once()->andReturn(collect([ + $this->question(1, 'PRODUCT', 'SINGLE_LINE_TEXT'), + $this->question(2, 'ORDER', 'MULTI_SELECT_DROPDOWN'), + $this->question(3, 'PRODUCT', 'SINGLE_LINE_TEXT'), + ])); + $this->questionAnswerRepository->shouldReceive('findWhereIn') + ->once() + ->with('order_id', [50], [['question_id', 'in', [1, 2, 3]]]) + ->andReturn(collect([ + $this->answer(1, 50, 99, 'Someone else'), + $this->answer(1, 50, 11, 'Analytical Engines'), + $this->answer(2, 50, null, ['Navy', 'Compilers']), + $this->answer(3, 50, 11, ' '), + ])); + + $badge = $this->service->buildBadges(self::EVENT_ID, collect([$this->attendee()]), $design)->first(); + + $this->assertSame( + [['FIRST_NAME', 'Ada'], ['QUESTION', 'Analytical Engines'], ['QUESTION', 'Navy, Compilers']], + array_map(fn (BadgeLineDTO $line) => [$line->source->value, $line->text], $badge->lines), + ); + } + + public function test_a_blank_name_line_is_kept_for_handwriting(): void + { + $badge = $this->service->buildBadges( + self::EVENT_ID, + collect([$this->attendee(firstName: '')]), + $this->design(lines: [new BadgeLineDTO(BadgeFieldSource::FIRST_NAME, BadgeTextSize::XL)]), + )->first(); + + $this->assertCount(1, $badge->lines); + $this->assertSame('', $badge->lines[0]->text); + } + + public function test_ribbons_use_the_configured_label_or_fall_back_to_the_ticket_and_accent(): void + { + $configured = $this->design(ribbons: [new BadgeRibbonDTO(product_id: 3, label: 'SPEAKER', color: '#b91c1c')]); + $unlabelled = $this->design(ribbons: [new BadgeRibbonDTO(product_id: 3, label: null, color: '#b91c1c')]); + + $this->assertEquals( + new BadgeRibbonDTO(product_id: 3, label: 'SPEAKER', color: '#b91c1c'), + $this->service->buildBadges(self::EVENT_ID, collect([$this->attendee()]), $configured)->first()->ribbon, + ); + $this->assertEquals( + new BadgeRibbonDTO(product_id: 3, label: 'Speaker pass', color: '#b91c1c'), + $this->service->buildBadges(self::EVENT_ID, collect([$this->attendee()]), $unlabelled)->first()->ribbon, + ); + $this->assertEquals( + new BadgeRibbonDTO(product_id: 3, label: 'Speaker pass', color: '#123456'), + $this->service->buildBadges(self::EVENT_ID, collect([$this->attendee()]), $this->design())->first()->ribbon, + ); + } + + public function test_hidden_ribbon_and_seat_are_left_off(): void + { + $design = $this->design(); + $design->show_ribbon = false; + $design->show_seat = false; + + $badge = $this->service->buildBadges(self::EVENT_ID, collect([$this->attendee()]), $design)->first(); + + $this->assertNull($badge->ribbon); + $this->assertNull($badge->seat_label); + } + + public function test_print_tracking_is_carried_onto_the_badge(): void + { + $attendee = $this->attendee()->setBadgePrintCount(2)->setBadgePrintedAt(null); + + $badge = $this->service->buildBadges(self::EVENT_ID, collect([$attendee]), $this->design())->first(); + + $this->assertSame(2, $badge->badge_print_count); + $this->assertSame(BadgePrintStatus::NEEDS_REPRINT, $badge->print_status); + } + + private function attendee(string $firstName = 'Ada'): AttendeeDomainObject + { + $attendee = (new AttendeeDomainObject) + ->setId(11) + ->setPublicId('A-ADA') + ->setOrderId(50) + ->setProductId(3) + ->setEventId(self::EVENT_ID) + ->setStatus('ACTIVE') + ->setFirstName($firstName) + ->setLastName('Lovelace') + ->setSeatLabel('Row A · 4'); + + $attendee->setProduct((new ProductDomainObject)->setId(3)->setTitle('Speaker pass')); + $attendee->setEventOccurrence((new EventOccurrenceDomainObject)->setId(5)->setStartDate('2027-03-04 09:00:00')); + + return $attendee; + } + + private function question(int $id, string $belongsTo, string $type): QuestionDomainObject + { + return (new QuestionDomainObject)->setId($id)->setBelongsTo($belongsTo)->setType($type)->setTitle('Q'.$id); + } + + private function answer(int $questionId, int $orderId, ?int $attendeeId, string|array $answer): QuestionAnswerDomainObject + { + return (new QuestionAnswerDomainObject) + ->setQuestionId($questionId) + ->setOrderId($orderId) + ->setAttendeeId($attendeeId) + ->setAnswer($answer); + } + + /** + * @param BadgeLineDTO[]|null $lines + * @param BadgeRibbonDTO[] $ribbons + */ + private function design(?array $lines = null, array $ribbons = []): BadgeDesignDTO + { + return new BadgeDesignDTO( + template: BadgeTemplate::CLASSIC, + size: BadgeSize::A6_PORTRAIT, + custom_width_mm: null, + custom_height_mm: null, + sheet: BadgeSheet::A4, + accent_color: '#123456', + background_color: null, + text_color: null, + font_family: 'Inter', + text_align: null, + uppercase_names: false, + lines: $lines ?? [new BadgeLineDTO(BadgeFieldSource::FIRST_NAME, BadgeTextSize::XL)], + show_logo: true, + show_qr: true, + show_ribbon: true, + show_seat: true, + show_event_name: true, + show_sponsors: true, + footer_text: null, + ribbons: $ribbons, + back_mode: BadgeBackMode::NONE, + back_text: null, + ); + } +} diff --git a/backend/tests/Unit/Services/Domain/Badge/BadgeDesignServiceTest.php b/backend/tests/Unit/Services/Domain/Badge/BadgeDesignServiceTest.php new file mode 100644 index 0000000000..7aba105454 --- /dev/null +++ b/backend/tests/Unit/Services/Domain/Badge/BadgeDesignServiceTest.php @@ -0,0 +1,246 @@ +eventRepository = Mockery::mock(EventRepositoryInterface::class); + $this->eventSettingsRepository = Mockery::mock(EventSettingsRepositoryInterface::class); + $this->questionRepository = Mockery::mock(QuestionRepositoryInterface::class); + $this->productRepository = Mockery::mock(ProductRepositoryInterface::class); + + $this->service = new BadgeDesignService( + $this->eventRepository, + $this->eventSettingsRepository, + $this->questionRepository, + $this->productRepository, + ); + } + + public function test_defaults_follow_the_events_currency_brand_and_questions(): void + { + $this->givenEvent('USD', (new EventSettingDomainObject) + ->setId(1) + ->setTicketDesignSettings(['accent_color' => '#333333']) + ->setHomepageThemeSettings(['accent' => '#0f766e', 'font_family' => 'Poppins'])); + $this->givenQuestions([ + $this->question(1, 'What is your job title?'), + $this->question(2, 'Organisation', hidden: true), + $this->question(3, 'Company / employer'), + $this->question(4, 'Pronouns'), + ]); + + $design = $this->service->getDesign(self::EVENT_ID); + + $this->assertSame(BadgeSize::IN_4X3_LANDSCAPE, $design->size); + $this->assertSame(BadgeSheet::LETTER, $design->sheet); + $this->assertSame('#0f766e', $design->accent_color); + $this->assertSame('Poppins', $design->font_family); + $this->assertSame([3, 1, 4], $design->questionIds()); + } + + public function test_metric_events_default_to_a6_on_a4_with_the_ticket_accent(): void + { + $this->givenEvent('EUR', (new EventSettingDomainObject)->setId(1)->setTicketDesignSettings(['accent_color' => '#2563ebff'])); + $this->givenQuestions([]); + + $design = $this->service->getDesign(self::EVENT_ID); + + $this->assertSame(BadgeSize::A6_PORTRAIT, $design->size); + $this->assertSame(BadgeSheet::A4, $design->sheet); + $this->assertSame('#2563eb', $design->accent_color); + $this->assertSame('Inter', $design->font_family); + } + + public function test_short_and_invalid_accent_colours_become_six_digit_hex(): void + { + $this->givenEvent('EUR', (new EventSettingDomainObject)->setId(1) + ->setTicketDesignSettings(['accent_color' => 'x#abc']) + ->setHomepageThemeSettings(['accent' => '#0F8'])); + $this->givenQuestions([]); + + $this->assertSame('#00ff88', $this->service->getDesign(self::EVENT_ID)->accent_color); + } + + public function test_a_saved_design_overrides_the_defaults(): void + { + $this->givenEvent('EUR', (new EventSettingDomainObject)->setId(1)->setBadgeDesignSettings([ + 'template' => 'BOLD', + 'lines' => [['source' => 'FULL_NAME', 'size' => 'XL']], + ])); + $this->givenQuestions([$this->question(3, 'Company')]); + + $design = $this->service->getDesign(self::EVENT_ID); + + $this->assertSame(BadgeTemplate::BOLD, $design->template); + $this->assertSame([BadgeFieldSource::FULL_NAME], array_map(fn ($line) => $line->source, $design->lines)); + $this->assertSame(BadgeSize::A6_PORTRAIT, $design->size); + } + + public function test_saving_strips_values_that_do_not_belong_to_a_line_or_size(): void + { + $this->eventSettingsRepository->shouldReceive('findFirstWhere')->andReturn((new EventSettingDomainObject)->setId(1)); + $this->eventSettingsRepository->shouldReceive('updateFromArray') + ->once() + ->withArgs(function (int $id, array $attributes) { + $saved = $attributes['badge_design_settings']; + + return $id === 1 + && $saved['custom_width_mm'] === null + && $saved['lines'][0]['text'] === null + && $saved['lines'][0]['question_id'] === null + && $saved['lines'][1]['text'] === 'Volunteer'; + }); + + $this->service->save(self::EVENT_ID, BadgeDesignDTO::from($this->payload([ + 'custom_width_mm' => 90, + 'lines' => [ + ['source' => 'FIRST_NAME', 'size' => 'XL', 'text' => 'stray', 'question_id' => 5], + ['source' => 'CUSTOM_TEXT', 'size' => 'S', 'text' => 'Volunteer'], + ], + ]))); + } + + public function test_fold_over_is_dropped_for_single_sided_badges(): void + { + $this->eventSettingsRepository->shouldReceive('findFirstWhere')->andReturn((new EventSettingDomainObject)->setId(1)); + $this->eventSettingsRepository->shouldReceive('updateFromArray') + ->once() + ->withArgs(fn (int $id, array $attributes) => $attributes['badge_design_settings']['fold_over'] === false); + + $this->service->save(self::EVENT_ID, BadgeDesignDTO::from($this->payload(['fold_over' => true]))); + } + + public function test_fold_over_is_kept_for_double_sided_badges(): void + { + $this->eventSettingsRepository->shouldReceive('findFirstWhere')->andReturn((new EventSettingDomainObject)->setId(1)); + $this->eventSettingsRepository->shouldReceive('updateFromArray') + ->once() + ->withArgs(fn (int $id, array $attributes) => $attributes['badge_design_settings']['fold_over'] === true); + + $saved = $this->service->save(self::EVENT_ID, BadgeDesignDTO::from($this->payload([ + 'back_mode' => 'INFO', + 'fold_over' => true, + ]))); + + $this->assertTrue($saved->fold_over); + } + + public function test_saving_rejects_a_question_from_another_event(): void + { + $this->questionRepository->shouldReceive('findWhereIn')->andReturn(collect()); + $this->eventSettingsRepository->shouldNotReceive('updateFromArray'); + + $this->expectException(InvalidBadgeDesignException::class); + + $this->service->save(self::EVENT_ID, BadgeDesignDTO::from($this->payload([ + 'lines' => [['source' => 'QUESTION', 'size' => 'M', 'question_id' => 99]], + ]))); + } + + public function test_saving_rejects_a_ribbon_for_a_product_outside_the_event(): void + { + $this->productRepository->shouldReceive('findWhereIn')->andReturn(collect([(new ProductDomainObject)->setId(5)])); + $this->eventSettingsRepository->shouldNotReceive('updateFromArray'); + + try { + $this->service->save(self::EVENT_ID, BadgeDesignDTO::from($this->payload([ + 'ribbons' => [ + ['product_id' => 5, 'label' => null, 'color' => '#000000'], + ['product_id' => 6, 'label' => null, 'color' => '#000000'], + ], + ]))); + $this->fail('Expected the foreign ribbon to be rejected'); + } catch (InvalidBadgeDesignException $exception) { + $this->assertSame('ribbons.1.product_id', $exception->getField()); + } + } + + private function givenEvent(string $currency, EventSettingDomainObject $settings): void + { + $this->eventRepository->shouldReceive('findById')->with(self::EVENT_ID) + ->andReturn((new EventDomainObject)->setId(self::EVENT_ID)->setCurrency($currency)); + $this->eventSettingsRepository->shouldReceive('findFirstWhere')->andReturn($settings); + } + + /** + * @param QuestionDomainObject[] $questions + */ + private function givenQuestions(array $questions): void + { + $this->questionRepository->shouldReceive('findWhere')->andReturn(collect($questions)); + } + + private function question(int $id, string $title, bool $hidden = false): QuestionDomainObject + { + return (new QuestionDomainObject) + ->setId($id) + ->setTitle($title) + ->setType('SINGLE_LINE_TEXT') + ->setIsHidden($hidden) + ->setOrder($id); + } + + private function payload(array $overrides = []): array + { + return array_replace([ + 'template' => 'CLASSIC', + 'size' => 'A6_PORTRAIT', + 'custom_width_mm' => null, + 'custom_height_mm' => null, + 'sheet' => 'A4', + 'accent_color' => '#1d4ed8', + 'background_color' => null, + 'text_color' => null, + 'font_family' => 'Inter', + 'text_align' => null, + 'uppercase_names' => false, + 'lines' => [['source' => 'FIRST_NAME', 'size' => 'XL']], + 'show_logo' => true, + 'show_qr' => true, + 'show_ribbon' => true, + 'show_seat' => true, + 'show_event_name' => true, + 'show_sponsors' => true, + 'footer_text' => null, + 'ribbons' => [], + 'back_mode' => 'NONE', + 'back_text' => null, + ], $overrides); + } +} diff --git a/backend/tests/Unit/Services/Domain/Badge/BadgeReprintServiceTest.php b/backend/tests/Unit/Services/Domain/Badge/BadgeReprintServiceTest.php new file mode 100644 index 0000000000..d5da5694d9 --- /dev/null +++ b/backend/tests/Unit/Services/Domain/Badge/BadgeReprintServiceTest.php @@ -0,0 +1,151 @@ +attendeeRepository = Mockery::mock(AttendeeRepositoryInterface::class); + $this->badgeDesignService = Mockery::mock(BadgeDesignService::class); + + $this->service = new BadgeReprintService($this->attendeeRepository, $this->badgeDesignService); + } + + public function test_marking_printed_increments_the_count_for_the_events_attendees(): void + { + $this->attendeeRepository->shouldReceive('incrementEach') + ->once() + ->withArgs(fn (array $columns, array $updates, array $where) => $columns === ['badge_print_count' => 1] + && array_key_exists('badge_printed_at', $updates) + && $where === ['event_id' => 4, ['id', 'in', [1, 2]]]) + ->andReturn(2); + + $this->assertSame(2, $this->service->markPrinted(4, [1, 2])); + } + + public function test_marking_nothing_printed_skips_the_query(): void + { + $this->attendeeRepository->shouldNotReceive('incrementEach'); + + $this->assertSame(0, $this->service->markPrinted(4, [])); + } + + public function test_a_printed_badge_whose_name_changed_needs_a_reprint(): void + { + $this->attendeeRepository->shouldReceive('updateWhere') + ->once() + ->with(['badge_printed_at' => null], [['id', 'in', [9]], ['badge_printed_at', 'not null', null]]); + + $after = $this->service->flagIfBadgeDetailsChanged( + $this->printedAttendee('Ada'), + $this->printedAttendee('Augusta'), + ); + + $this->assertSame(BadgePrintStatus::NEEDS_REPRINT, $after->getBadgePrintStatus()); + } + + public function test_unchanged_or_unprinted_badges_are_left_alone(): void + { + $this->attendeeRepository->shouldNotReceive('updateWhere'); + + $unchanged = $this->service->flagIfBadgeDetailsChanged($this->printedAttendee('Ada'), $this->printedAttendee('Ada')); + $neverPrinted = $this->service->flagIfBadgeDetailsChanged( + $this->printedAttendee('Ada')->setBadgePrintedAt(null)->setBadgePrintCount(0), + $this->printedAttendee('Augusta')->setBadgePrintedAt(null)->setBadgePrintCount(0), + ); + + $this->assertSame(BadgePrintStatus::PRINTED, $unchanged->getBadgePrintStatus()); + $this->assertSame(BadgePrintStatus::NOT_PRINTED, $neverPrinted->getBadgePrintStatus()); + } + + public function test_an_order_answer_on_the_badge_flags_every_attendee_on_the_order(): void + { + $this->badgeDesignService->shouldReceive('getDesign')->with(4)->andReturn($this->designWithQuestion(30)); + $this->attendeeRepository->shouldReceive('findWhere') + ->with(['order_id' => 70]) + ->andReturn(collect([(new AttendeeDomainObject)->setId(1), (new AttendeeDomainObject)->setId(2)])); + $this->attendeeRepository->shouldReceive('updateWhere') + ->once() + ->with(['badge_printed_at' => null], [['id', 'in', [1, 2]], ['badge_printed_at', 'not null', null]]); + + $this->service->flagForAnswerChange(eventId: 4, questionId: 30, orderId: 70, attendeeId: null); + } + + public function test_an_answer_that_is_not_on_the_badge_changes_nothing(): void + { + $this->badgeDesignService->shouldReceive('getDesign')->with(4)->andReturn($this->designWithQuestion(30)); + $this->attendeeRepository->shouldNotReceive('findWhere'); + $this->attendeeRepository->shouldNotReceive('updateWhere'); + + $this->service->flagForAnswerChange(eventId: 4, questionId: 31, orderId: 70, attendeeId: 1); + } + + private function printedAttendee(string $firstName): AttendeeDomainObject + { + return (new AttendeeDomainObject) + ->setId(9) + ->setFirstName($firstName) + ->setLastName('Lovelace') + ->setProductId(3) + ->setSeatLabel(null) + ->setBadgePrintCount(1) + ->setBadgePrintedAt('2027-01-01 10:00:00'); + } + + private function designWithQuestion(int $questionId): BadgeDesignDTO + { + return new BadgeDesignDTO( + template: BadgeTemplate::CLASSIC, + size: BadgeSize::A6_PORTRAIT, + custom_width_mm: null, + custom_height_mm: null, + sheet: BadgeSheet::A4, + accent_color: '#123456', + background_color: null, + text_color: null, + font_family: 'Inter', + text_align: null, + uppercase_names: false, + lines: [ + new BadgeLineDTO(BadgeFieldSource::FIRST_NAME, BadgeTextSize::XL), + new BadgeLineDTO(BadgeFieldSource::QUESTION, BadgeTextSize::M, question_id: $questionId), + ], + show_logo: true, + show_qr: true, + show_ribbon: true, + show_seat: true, + show_event_name: true, + show_sponsors: true, + footer_text: null, + ribbons: [], + back_mode: BadgeBackMode::NONE, + back_text: null, + ); + } +} diff --git a/backend/tests/Unit/Services/Domain/SeatMap/AttendeeSeatMoveServiceTest.php b/backend/tests/Unit/Services/Domain/SeatMap/AttendeeSeatMoveServiceTest.php new file mode 100644 index 0000000000..53930c4ca4 --- /dev/null +++ b/backend/tests/Unit/Services/Domain/SeatMap/AttendeeSeatMoveServiceTest.php @@ -0,0 +1,58 @@ +setId(7)->setEventId(3)->setSeatUid('seat-a')->setSeatLabel('Row A · 1'); + $after = (new AttendeeDomainObject)->setId(7)->setEventId(3)->setSeatUid('seat-b')->setSeatLabel('Row B · 4'); + $flagged = (new AttendeeDomainObject)->setId(7)->setEventId(3)->setSeatUid('seat-b')->setSeatLabel('Row B · 4'); + + $seatClaimService = Mockery::mock(SeatClaimService::class); + $seatClaimService->shouldReceive('move')->once(); + + $attendeeRepository = Mockery::mock(AttendeeRepositoryInterface::class); + $attendeeRepository->shouldReceive('findById')->with(7)->andReturn($after); + + $lookup = Mockery::mock(EventSeatMapLookupService::class); + $lookup->shouldReceive('bandOf')->andReturn('stalls'); + + $auditLog = Mockery::mock(OrderAuditLogService::class); + $auditLog->shouldReceive('logAttendeeUpdate')->once(); + + $dispatcher = Mockery::mock(DomainEventDispatcherService::class); + $dispatcher->shouldReceive('dispatch')->once(); + + $databaseManager = Mockery::mock(DatabaseManager::class); + $databaseManager->shouldReceive('transaction')->andReturnUsing(fn (callable $callback) => $callback()); + + $reprintService = Mockery::mock(BadgeReprintService::class); + $reprintService->shouldReceive('flagIfBadgeDetailsChanged')->once()->with($before, $after)->andReturn($flagged); + + $service = new AttendeeSeatMoveService( + $seatClaimService, + $attendeeRepository, + $auditLog, + $dispatcher, + $lookup, + $databaseManager, + $reprintService, + ); + + $this->assertSame($flagged, $service->move($before, 'seat-b', false, '127.0.0.1', null)); + } +} diff --git a/backend/tests/Unit/Services/Domain/SelfService/SelfServiceEditAttendeeServiceTest.php b/backend/tests/Unit/Services/Domain/SelfService/SelfServiceEditAttendeeServiceTest.php index a596a1dcd9..a9b1007dbf 100644 --- a/backend/tests/Unit/Services/Domain/SelfService/SelfServiceEditAttendeeServiceTest.php +++ b/backend/tests/Unit/Services/Domain/SelfService/SelfServiceEditAttendeeServiceTest.php @@ -12,6 +12,7 @@ use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface; use HiEvents\Repository\Interfaces\EventRepositoryInterface; use HiEvents\Services\Domain\Attendee\SendAttendeeTicketService; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\SelfService\OrderAuditLogService; use HiEvents\Services\Domain\SelfService\SelfServiceEditAttendeeService; use Illuminate\Support\Facades\Mail; @@ -31,6 +32,8 @@ class SelfServiceEditAttendeeServiceTest extends TestCase private MockInterface|SendAttendeeTicketService $sendAttendeeTicketService; + private MockInterface|BadgeReprintService $badgeReprintService; + protected function setUp(): void { parent::setUp(); @@ -41,17 +44,21 @@ protected function setUp(): void $this->eventRepository = Mockery::mock(EventRepositoryInterface::class); $this->orderAuditLogService = Mockery::mock(OrderAuditLogService::class); $this->sendAttendeeTicketService = Mockery::mock(SendAttendeeTicketService::class); + $this->badgeReprintService = Mockery::mock(BadgeReprintService::class); + $this->badgeReprintService->shouldReceive('flagForReprint')->byDefault(); $this->service = new SelfServiceEditAttendeeService( $this->attendeeRepository, $this->eventRepository, $this->orderAuditLogService, - $this->sendAttendeeTicketService + $this->sendAttendeeTicketService, + $this->badgeReprintService, ); } public function test_successful_edit_updates_attendee_fields(): void { + $this->badgeReprintService->shouldReceive('flagForReprint')->once()->with([456]); $attendee = Mockery::mock(AttendeeDomainObject::class); $attendee->shouldReceive('getId')->andReturn(456); $attendee->shouldReceive('getEventId')->andReturn(789); @@ -234,6 +241,7 @@ public function test_no_update_when_no_fields_change(): void $this->attendeeRepository->shouldReceive('updateWhere')->never(); $this->orderAuditLogService->shouldReceive('logAttendeeUpdate')->never(); + $this->badgeReprintService->shouldReceive('flagForReprint')->never(); $result = $this->service->editAttendee( attendee: $attendee, diff --git a/e2e/api/api-client.ts b/e2e/api/api-client.ts index 4869f3e665..19774dd89d 100644 --- a/e2e/api/api-client.ts +++ b/e2e/api/api-client.ts @@ -1,5 +1,7 @@ import type { APIRequestContext, APIResponse } from '@playwright/test'; import type { + BadgeDesign, + BadgeStats, Affiliate, AttendeeRecord, BoxOffice, @@ -267,6 +269,10 @@ export class ApiClient { return check(this.request.patch(`events/${eventId}/settings`, { headers: jsonHeaders, data: settings })); } + enableBadges(eventId: number): Promise { + return this.updateEventSettings(eventId, { enabled_features: ['BADGES'] }); + } + createPromoCode(eventId: number, payload: CreatePromoCodePayload): Promise { return unwrap( this.request.post(`events/${eventId}/promo-codes`, { @@ -535,6 +541,33 @@ export class ApiClient { return attendee.id; } + renameAttendee(eventId: number, attendeeId: number, firstName: string): Promise { + return check( + this.request.patch(`events/${eventId}/attendees/${attendeeId}`, { headers: jsonHeaders, data: { first_name: firstName } }), + ); + } + + getBadgeDesign(eventId: number): Promise { + return unwrap(this.request.get(`events/${eventId}/badge-design`, { headers: jsonHeaders })); + } + + async updateBadgeDesign(eventId: number, patch: Partial): Promise { + const { is_customized: _ignored, ...current } = await this.getBadgeDesign(eventId); + return unwrap( + this.request.put(`events/${eventId}/badge-design`, { headers: jsonHeaders, data: { ...current, ...patch } }), + ); + } + + getBadgeStats(eventId: number): Promise { + return unwrap(this.request.get(`events/${eventId}/badges/stats`, { headers: jsonHeaders })); + } + + markBadgesPrinted(eventId: number, attendeeIds: number[]): Promise { + return check( + this.request.post(`events/${eventId}/badges/printed`, { headers: jsonHeaders, data: { attendee_ids: attendeeIds } }), + ); + } + updateAttendeeStatus(eventId: number, attendeeId: number, status: 'ACTIVE' | 'CANCELLED'): Promise { return check( this.request.patch(`events/${eventId}/attendees/${attendeeId}`, { headers: jsonHeaders, data: { status } }), diff --git a/e2e/api/types.ts b/e2e/api/types.ts index ec386e07e1..c2a94a9b2c 100644 --- a/e2e/api/types.ts +++ b/e2e/api/types.ts @@ -171,6 +171,8 @@ export interface AttendeeRecord { order_id: number; product_id: number; seat_label?: string | null; + badge_print_count?: number; + badge_print_status?: 'NOT_PRINTED' | 'PRINTED' | 'NEEDS_REPRINT'; } export interface PromoCode { @@ -182,6 +184,33 @@ export interface CheckInList { id: number; short_id: string; name: string; + badge_printing_enabled?: boolean; + kiosk_mode?: boolean; +} + +export interface BadgeDesignLine { + source: 'FIRST_NAME' | 'LAST_NAME' | 'FULL_NAME' | 'TICKET_TYPE' | 'QUESTION' | 'OCCURRENCE_DATE' | 'CUSTOM_TEXT'; + size: 'XL' | 'L' | 'M' | 'S'; + question_id?: number | null; + text?: string | null; +} + +export interface BadgeDesign { + template: string; + size: string; + sheet: string; + accent_color: string; + lines: BadgeDesignLine[]; + ribbons: { product_id: number; label: string | null; color: string }[]; + is_customized: boolean; + [key: string]: unknown; +} + +export interface BadgeStats { + total: number; + printed: number; + not_printed: number; + needs_reprint: number; } export interface Occurrence { @@ -253,6 +282,7 @@ export type AttendeeDetailsCollection = 'PER_TICKET' | 'PER_ORDER'; export interface EventSettings { payment_providers?: string[]; + enabled_features?: string[]; offline_payment_instructions?: string | null; waitlist_enabled?: boolean; attendee_details_collection_method?: AttendeeDetailsCollection; @@ -318,6 +348,8 @@ export interface CreateCheckInListPayload { activates_at?: string; product_ids?: number[]; event_occurrence_id?: number; + badge_printing_enabled?: boolean; + kiosk_mode?: boolean; } export interface CreateAttendeePayload { diff --git a/e2e/pages/badges.page.ts b/e2e/pages/badges.page.ts new file mode 100644 index 0000000000..be79beed74 --- /dev/null +++ b/e2e/pages/badges.page.ts @@ -0,0 +1,147 @@ +import type { BrowserContext, Locator, Page } from '@playwright/test'; + +declare global { + interface Window { + __badgePrintCalls?: number; + __badgePrintedPageSides?: string[][]; + } +} + +export async function stubBrowserPrinting(context: BrowserContext): Promise { + await context.addInitScript(() => { + window.__badgePrintCalls = 0; + window.__badgePrintedPageSides = []; + window.print = () => { + window.__badgePrintCalls = (window.__badgePrintCalls ?? 0) + 1; + const pages = Array.from(document.querySelectorAll('[data-testid="badge-print-page"]')); + window.__badgePrintedPageSides?.push(pages.map((page) => page.dataset.side ?? '')); + setTimeout(() => window.dispatchEvent(new Event('afterprint')), 50); + }; + }); +} + +export const printCalls = (page: Page): Promise => page.evaluate(() => window.__badgePrintCalls ?? 0); + +export const lastPrintedPageSides = (page: Page): Promise => page.evaluate( + () => window.__badgePrintedPageSides?.at(-1) ?? [], +); + +export class BadgeDesignerPage { + constructor(private readonly page: Page) {} + + async goto(eventId: number): Promise { + await this.page.goto(`/manage/event/${eventId}/badges`); + await this.page.waitForLoadState('networkidle'); + } + + templateOption(template: 'classic' | 'banner' | 'minimal' | 'bold' | 'sidebar' | 'artwork'): Locator { + return this.page.getByTestId(`badge-template-${template}`); + } + + get preview(): Locator { + return this.page.getByTestId('badge-designer-preview').getByTestId('badge'); + } + + lineSource(index: number): Locator { + return this.page.getByTestId(`badge-line-${index}-source`); + } + + get addLineButton(): Locator { + return this.page.getByTestId('badge-add-line-button'); + } + + get addCompanyQuestionsButton(): Locator { + return this.page.getByTestId('badge-add-company-questions-button'); + } + + ribbonLabelInput(productTitle: string): Locator { + return this.page.getByLabel(`Badge label for ${productTitle}`); + } + + get saveButton(): Locator { + return this.page.getByTestId('designer-save-button'); + } + + get savedStatus(): Locator { + return this.page.getByText('All changes saved'); + } + + get printBadgesButton(): Locator { + return this.page.getByTestId('badge-designer-print-button'); + } + + get paperSummary(): Locator { + return this.page.getByTestId('badge-paper-summary'); + } + + async chooseBackMode(option: string): Promise { + await this.page.getByTestId('badge-back-mode-select').click(); + await this.page.getByRole('option', { name: option, exact: true }).click(); + } + + async chooseBackPrinting(option: 'Two-sided printer' | 'Fold-over'): Promise { + await this.page.getByTestId('badge-back-printing-control').getByText(option, { exact: true }).click(); + } + + async chooseLineSource(index: number, option: string): Promise { + await this.lineSource(index).click(); + await this.page.getByRole('option', { name: option, exact: true }).click(); + } +} + +export class PrintBadgesModal { + constructor(private readonly page: Page) {} + + get dialog(): Locator { + return this.page.getByRole('dialog', { name: 'Print badges' }); + } + + get summary(): Locator { + return this.page.getByTestId('print-badges-summary'); + } + + async chooseEveryone(): Promise { + await this.dialog.getByText('Everyone', { exact: true }).click(); + } + + get openPreviewButton(): Locator { + return this.page.getByTestId('print-badges-open-preview-button'); + } +} + +export class BadgePrintPage { + constructor(private readonly page: Page) {} + + async goto(eventId: number, query = ''): Promise { + await this.page.goto(`/manage/event/${eventId}/badges/print${query ? `?${query}` : ''}`); + await this.page.waitForLoadState('networkidle'); + } + + get badges(): Locator { + return this.page.getByTestId('badge-print-sheets').getByTestId('badge'); + } + + get summary(): Locator { + return this.page.getByTestId('badge-print-summary'); + } + + get pages(): Locator { + return this.page.getByTestId('badge-print-page'); + } + + get backNotice(): Locator { + return this.page.getByTestId('badge-print-back-notice'); + } + + get printButton(): Locator { + return this.page.getByTestId('badge-print-button'); + } + + get confirmBar(): Locator { + return this.page.getByTestId('badge-print-confirm'); + } + + get markPrintedButton(): Locator { + return this.page.getByTestId('badge-mark-printed-button'); + } +} diff --git a/e2e/pages/check-in-list.page.ts b/e2e/pages/check-in-list.page.ts index aaa9cb0a51..d961ad4a8b 100644 --- a/e2e/pages/check-in-list.page.ts +++ b/e2e/pages/check-in-list.page.ts @@ -1,4 +1,4 @@ -import type { Locator, Page } from '@playwright/test'; +import { expect, type Locator, type Page } from '@playwright/test'; export class CheckInListPage { constructor(private readonly page: Page) {} @@ -8,15 +8,33 @@ export class CheckInListPage { await this.page.waitForLoadState('networkidle'); } - async createList(name: string): Promise { + async createList(name: string, options: { badgePrinting?: boolean; kiosk?: boolean } = {}): Promise { await this.page.getByTestId('checkin-list-create-button').click(); await this.page.getByLabel(/^Name/).fill(name); + if (options.badgePrinting) { + await this.openRowAndToggle(this.page.getByRole('dialog'), 'badges', 'check-in-list-badge-printing-switch'); + } + if (options.kiosk) { + await this.toggleKiosk(this.page.getByRole('dialog')); + } await this.page.getByTestId('checkin-list-submit-button').click(); await this.page.getByRole('heading', { name: 'Check-In List Created' }).waitFor(); await this.page.getByRole('button', { name: 'Done' }).click(); } + async toggleKiosk(dialog: Locator): Promise { + await this.openRowAndToggle(dialog, 'kiosk', 'check-in-list-kiosk-switch'); + } + + private async openRowAndToggle(dialog: Locator, row: string, switchTestId: string): Promise { + await dialog.getByTestId(`check-in-list-ledger-${row}`).click(); + const toggle = dialog.getByTestId(switchTestId); + const wasChecked = await toggle.isChecked(); + await toggle.locator('xpath=ancestor::div[contains(@class, "mantine-Switch-root")]').locator('.mantine-Switch-track').click(); + await expect(toggle).toBeChecked({ checked: !wasChecked }); + } + row(name: string): Locator { return this.page.getByRole('row').filter({ hasText: name }); } diff --git a/e2e/pages/check-in.page.ts b/e2e/pages/check-in.page.ts index 67b948583b..ab29258429 100644 --- a/e2e/pages/check-in.page.ts +++ b/e2e/pages/check-in.page.ts @@ -43,4 +43,43 @@ export class CheckInPage { progressChip(): Locator { return this.page.getByLabel('Check-in progress'); } + + async openAttendee(publicId: string): Promise { + await this.attendeeRow(publicId).getByText(publicId).click(); + } + + printBadgeButton(): Locator { + return this.page.getByTestId('check-in-print-badge-button'); + } + + badgePrintNote(): Locator { + return this.page.getByTestId('check-in-badge-print-note'); + } + + async enableAutoPrint(): Promise { + await this.page.getByTestId('check-in-badge-printer-button').click(); + await this.page.getByTestId('check-in-auto-print-switch').click({ force: true }); + await this.page.getByRole('button', { name: 'Done' }).click(); + } + + async chooseBackPrinting(option: 'Front only' | 'Two-sided printer' | 'Fold-over'): Promise { + await this.page.getByTestId('check-in-badge-printer-button').click(); + await this.page.getByTestId('check-in-back-printing-select').click(); + await this.page.getByRole('option', { name: option, exact: true }).click(); + await this.page.getByRole('button', { name: 'Done' }).click(); + } + + async scanWithUsbScanner(publicId: string): Promise { + await this.page.evaluate(async (code) => { + for (const key of code) { + window.dispatchEvent(new KeyboardEvent('keypress', { key })); + await new Promise((resolve) => setTimeout(resolve, 10)); + } + window.dispatchEvent(new KeyboardEvent('keypress', { key: 'Enter' })); + }, publicId); + } + + kiosk(): Locator { + return this.page.getByTestId('kiosk'); + } } diff --git a/e2e/tests/badges/badge-designer.spec.ts b/e2e/tests/badges/badge-designer.spec.ts new file mode 100644 index 0000000000..3fd430fdab --- /dev/null +++ b/e2e/tests/badges/badge-designer.spec.ts @@ -0,0 +1,89 @@ +import { test, expect } from '../../fixtures'; +import { BadgeDesignerPage } from '../../pages/badges.page'; +import { createLiveEventWithFreeTicket } from '../../api/factory'; + +test.describe('badge designer', () => { + test('an organizer picks a template, labels a ticket and saves the design', { tag: '@smoke' }, async ({ authedPage, api, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + await api.createQuestion(event.eventId, { + title: 'Company', + type: 'SINGLE_LINE_TEXT', + belongs_to: 'PRODUCT', + product_ids: [event.productId], + required: false, + is_hidden: false, + }); + + const designer = new BadgeDesignerPage(authedPage); + await designer.goto(event.eventId); + + await expect(designer.lineSource(0)).toHaveValue('First name'); + await expect(designer.lineSource(2)).toHaveValue('Company'); + await expect(designer.preview).toContainText('Northwind Labs'); + + await designer.templateOption('bold').click(); + await designer.ribbonLabelInput(event.productTitle).fill('SPEAKER'); + await expect(designer.preview).toContainText('SPEAKER'); + await designer.saveButton.click(); + await expect(designer.savedStatus).toBeVisible(); + + await authedPage.reload(); + await authedPage.waitForLoadState('networkidle'); + await expect(designer.templateOption('bold')).toHaveAttribute('aria-checked', 'true'); + + const design = await api.getBadgeDesign(event.eventId); + expect(design.template).toBe('BOLD'); + expect(design.ribbons).toEqual([expect.objectContaining({ product_id: event.productId, label: 'SPEAKER' })]); + }); + + test('collecting company and job title adds checkout questions and badge lines', async ({ authedPage, api, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + + const designer = new BadgeDesignerPage(authedPage); + await designer.goto(event.eventId); + await designer.addCompanyQuestionsButton.click(); + + await expect(designer.lineSource(2)).toHaveValue('Company'); + await expect(designer.lineSource(3)).toHaveValue('Job title'); + await expect(designer.preview).toContainText('Head of Partnerships'); + await expect(designer.addCompanyQuestionsButton).toBeHidden(); + + await designer.saveButton.click(); + await expect(designer.savedStatus).toBeVisible(); + + const design = await api.getBadgeDesign(event.eventId); + expect(design.lines.filter((line) => line.source === 'QUESTION')).toHaveLength(2); + }); + + test('a custom text line can be added and shows on the preview', async ({ authedPage, api, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + + const designer = new BadgeDesignerPage(authedPage); + await designer.goto(event.eventId); + await designer.addLineButton.click(); + await authedPage.getByTestId('badge-line-2-text').fill('Ask me about volunteering'); + + await expect(designer.preview).toContainText('Ask me about volunteering'); + }); + + test('an organizer switches a two-sided design to fold-over', async ({ authedPage, api, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + + const designer = new BadgeDesignerPage(authedPage); + await designer.goto(event.eventId); + await designer.chooseBackMode('Same on both sides'); + await designer.chooseBackPrinting('Fold-over'); + + await expect(designer.paperSummary).toHaveText('2 fold-over badges per sheet (2 × 1). Cut along the guides, then fold each one in half.'); + await designer.saveButton.click(); + await expect(designer.savedStatus).toBeVisible(); + + const design = await api.getBadgeDesign(event.eventId); + expect(design.back_mode).toBe('SAME'); + expect(design.fold_over).toBe(true); + }); +}); diff --git a/e2e/tests/badges/badge-feature.spec.ts b/e2e/tests/badges/badge-feature.spec.ts new file mode 100644 index 0000000000..e3c425dee2 --- /dev/null +++ b/e2e/tests/badges/badge-feature.spec.ts @@ -0,0 +1,25 @@ +import { test, expect } from '../../fixtures'; +import { createLiveEventWithFreeTicket } from '../../api/factory'; + +test.describe('name badges feature switch', () => { + test('badges stay out of the way until an organizer turns them on for the event', async ({ authedPage, api, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + const badgesLink = authedPage.getByRole('link', { name: 'Badges', exact: true }); + + await authedPage.goto(`/manage/event/${event.eventId}/attendees`); + await authedPage.waitForLoadState('networkidle'); + await expect(authedPage.getByTestId('attendees-print-badges-button')).toHaveCount(0); + await expect(badgesLink).toHaveCount(0); + + await authedPage.goto(`/manage/event/${event.eventId}/settings#features`); + await authedPage.waitForLoadState('networkidle'); + await authedPage.getByTestId('event-feature-badges-switch').click({ force: true }); + await expect(authedPage.getByText('Name badges turned on')).toBeVisible(); + expect((await api.getEventSettings(event.eventId)).enabled_features).toEqual(['BADGES']); + + await expect(badgesLink).toBeVisible(); + await authedPage.goto(`/manage/event/${event.eventId}/attendees`); + await authedPage.waitForLoadState('networkidle'); + await expect(authedPage.getByTestId('attendees-print-badges-button')).toBeVisible(); + }); +}); diff --git a/e2e/tests/badges/badge-printing.spec.ts b/e2e/tests/badges/badge-printing.spec.ts new file mode 100644 index 0000000000..35d8ddfd7b --- /dev/null +++ b/e2e/tests/badges/badge-printing.spec.ts @@ -0,0 +1,182 @@ +import type { APIRequestContext } from '@playwright/test'; +import { test, expect } from '../../fixtures'; +import { BadgePrintPage, lastPrintedPageSides, PrintBadgesModal, printCalls, stubBrowserPrinting } from '../../pages/badges.page'; +import { AttendeePage } from '../../pages/attendee.page'; +import { createCompletedOrder, createLiveEventWithFreeTicket, type SeededEvent } from '../../api/factory'; +import type { ApiClient } from '../../api/api-client'; +import { uniqueShort } from '../../utils/unique'; + +async function seedNamedAttendees(api: ApiClient, publicApi: APIRequestContext, event: SeededEvent, firstNames: string[]) { + const order = await createCompletedOrder(publicApi, event, { + quantity: firstNames.length, + buyerFirstName: firstNames[0], + buyerLastName: uniqueShort('Duplex').replace(' ', ''), + }); + for (const [index, attendee] of order.attendees.entries()) { + if (index > 0) { + await api.renameAttendee(event.eventId, await api.findAttendeeIdByPublicId(event.eventId, attendee.publicId), firstNames[index]); + } + } +} + +test.describe('badge printing', () => { + test('an organizer prints everyone not printed yet and marks the batch as printed', { tag: '@smoke' }, async ({ authedPage, api, publicApi, account }) => { + await stubBrowserPrinting(authedPage.context()); + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + const company = await api.createQuestion(event.eventId, { + title: 'Company', + type: 'SINGLE_LINE_TEXT', + belongs_to: 'PRODUCT', + product_ids: [event.productId], + required: false, + is_hidden: false, + }); + const lastName = uniqueShort('Lovelace').replace(' ', ''); + await createCompletedOrder(publicApi, event, { + quantity: 2, + buyerFirstName: 'Ada', + buyerLastName: lastName, + attendeeQuestions: [{ question_id: company.id, response: { answer: 'Analytical Engines' } }], + }); + + await authedPage.goto(`/manage/event/${event.eventId}/attendees`); + await authedPage.getByTestId('attendees-print-badges-button').click(); + + const modal = new PrintBadgesModal(authedPage); + await expect(modal.summary).toContainText('2 badges'); + const popupPromise = authedPage.waitForEvent('popup'); + await modal.openPreviewButton.click(); + const popup = await popupPromise; + await popup.waitForLoadState('networkidle'); + + const printPage = new BadgePrintPage(popup); + await expect(printPage.badges).toHaveCount(2); + await expect(printPage.badges.first()).toContainText('Ada'); + await expect(printPage.badges.first()).toContainText('Analytical Engines'); + await expect(printPage.summary).toContainText('2 badges'); + + await expect(printPage.printButton).toBeEnabled(); + await printPage.printButton.click(); + await expect(printPage.confirmBar).toBeVisible(); + expect(await printCalls(popup)).toBe(1); + await printPage.markPrintedButton.click(); + await expect(popup.getByText('Marked as printed. You can close this tab.')).toBeVisible(); + + expect(await api.getBadgeStats(event.eventId)).toEqual({ total: 2, printed: 2, not_printed: 0, needs_reprint: 0 }); + }); + + test('renaming an attendee after printing puts their badge back in the queue', async ({ authedPage, api, publicApi, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + const order = await createCompletedOrder(publicApi, event, { quantity: 2, buyerFirstName: 'Grace', buyerLastName: 'Hopper' }); + const attendeeIds = await Promise.all(order.attendees.map((attendee) => api.findAttendeeIdByPublicId(event.eventId, attendee.publicId))); + await api.markBadgesPrinted(event.eventId, attendeeIds); + await api.renameAttendee(event.eventId, attendeeIds[0], 'Amazing'); + + await authedPage.goto(`/manage/event/${event.eventId}/attendees`); + await authedPage.waitForLoadState('networkidle'); + + await expect(authedPage.getByRole('row').filter({ hasText: 'Amazing' }).getByText('Needs reprint')).toBeVisible(); + await expect(authedPage.getByRole('row').filter({ hasText: order.attendees[1].publicId }).getByText('Printed', { exact: true })).toBeVisible(); + + await authedPage.getByTestId('attendees-print-badges-button').click(); + const modal = new PrintBadgesModal(authedPage); + await expect(modal.dialog.getByText('Not printed yet (1)')).toBeVisible(); + await expect(modal.summary).toContainText('1 badge'); + }); + + test('a single attendee badge is printed from the attendee menu', async ({ authedPage, api, publicApi, account }) => { + await stubBrowserPrinting(authedPage.context()); + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + const order = await createCompletedOrder(publicApi, event, { quantity: 2, buyerFirstName: 'Katherine', buyerLastName: 'Johnson' }); + + const attendees = new AttendeePage(authedPage); + await attendees.goto(event.eventId); + const popupPromise = authedPage.waitForEvent('popup'); + await attendees.openRowAction(order.attendees[0].publicId, 'Print badge'); + const popup = await popupPromise; + await popup.waitForLoadState('networkidle'); + + const printPage = new BadgePrintPage(popup); + await expect(printPage.badges).toHaveCount(1); + await expect(printPage.badges.first()).toContainText('Katherine'); + }); + + test('a test print fills a sheet with sample badges', async ({ authedPage, api, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + await api.updateBadgeDesign(event.eventId, { size: 'A6_PORTRAIT', sheet: 'A4' }); + + const printPage = new BadgePrintPage(authedPage); + await printPage.goto(event.eventId, 'sample=1'); + + await expect(authedPage.getByRole('heading', { name: 'Test print' })).toBeVisible(); + await expect(printPage.badges).toHaveCount(4); + }); + + test('two-sided sheets print each back directly behind its front', async ({ authedPage, api, publicApi, account }) => { + await stubBrowserPrinting(authedPage.context()); + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + await api.updateBadgeDesign(event.eventId, { size: 'A6_PORTRAIT', sheet: 'A4', back_mode: 'SAME', fold_over: false }); + await seedNamedAttendees(api, publicApi, event, ['Alpha', 'Bravo', 'Charlie']); + + const printPage = new BadgePrintPage(authedPage); + await printPage.goto(event.eventId, 'sort_by=first_name'); + + await expect(printPage.summary).toContainText('3 badges · 2 pages'); + await expect(printPage.backNotice).toContainText('flip on the long edge'); + await expect(printPage.pages.nth(0)).toHaveAttribute('data-side', 'front'); + await expect(printPage.pages.nth(1)).toHaveAttribute('data-side', 'back'); + + const fronts = printPage.pages.nth(0).locator(':scope > *'); + const backs = printPage.pages.nth(1).locator(':scope > *'); + await expect(fronts.nth(0)).toContainText('Alpha'); + await expect(fronts.nth(1)).toContainText('Bravo'); + await expect(fronts.nth(2)).toContainText('Charlie'); + await expect(backs.nth(0)).toContainText('Bravo'); + await expect(backs.nth(1)).toContainText('Alpha'); + await expect(backs.nth(2)).toBeEmpty(); + await expect(backs.nth(3)).toContainText('Charlie'); + + await expect(printPage.printButton).toBeEnabled(); + await printPage.printButton.click(); + expect(await lastPrintedPageSides(authedPage)).toEqual(['front', 'back']); + }); + + test('fold-over badges print front and back together on one side of the paper', async ({ authedPage, api, publicApi, account }) => { + await stubBrowserPrinting(authedPage.context()); + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + await api.updateBadgeDesign(event.eventId, { + size: 'IN_4X3_LANDSCAPE', + sheet: 'LETTER', + back_mode: 'INFO', + back_text: 'Wi-Fi: Hall B', + fold_over: true, + }); + await seedNamedAttendees(api, publicApi, event, ['Alpha', 'Bravo', 'Charlie']); + + const printPage = new BadgePrintPage(authedPage); + await printPage.goto(event.eventId, 'sort_by=first_name'); + + await expect(printPage.summary).toContainText('3 badges · 2 pages'); + await expect(printPage.backNotice).toContainText('Fold-over'); + await expect(printPage.pages).toHaveCount(2); + await expect(printPage.pages.nth(0)).toHaveAttribute('data-side', 'fold'); + + const units = authedPage.getByTestId('badge-fold-over'); + await expect(units).toHaveCount(3); + await expect(units.first()).toHaveAttribute('data-fold', 'STACKED'); + await expect(units.first().locator('[data-panel="front"]')).toContainText('Alpha'); + await expect(units.first().locator('[data-panel="back"]')).toContainText('Wi-Fi: Hall B'); + const box = await units.first().boundingBox(); + expect(box && box.height / box.width).toBeCloseTo(1.5, 2); + + await expect(printPage.printButton).toBeEnabled(); + await printPage.printButton.click(); + expect(await lastPrintedPageSides(authedPage)).toEqual(['fold', 'fold']); + }); +}); diff --git a/e2e/tests/badges/check-in-badges.spec.ts b/e2e/tests/badges/check-in-badges.spec.ts new file mode 100644 index 0000000000..ab6c577479 --- /dev/null +++ b/e2e/tests/badges/check-in-badges.spec.ts @@ -0,0 +1,149 @@ +import type { APIRequestContext } from '@playwright/test'; +import { test, expect } from '../../fixtures'; +import { CheckInPage } from '../../pages/check-in.page'; +import { lastPrintedPageSides, printCalls, stubBrowserPrinting } from '../../pages/badges.page'; +import { createCompletedOrder, createLiveEventWithFreeTicket } from '../../api/factory'; +import type { ApiClient } from '../../api/api-client'; +import { uniqueName, uniqueShort } from '../../utils/unique'; + +async function seedBadgeList( + api: ApiClient, + publicApi: APIRequestContext, + organizerId: number, + options: { kiosk?: boolean } = {}, +) { + const event = await createLiveEventWithFreeTicket(api, organizerId); + await api.enableBadges(event.eventId); + const order = await createCompletedOrder(publicApi, event, { + quantity: 2, + buyerFirstName: 'Casey', + buyerLastName: uniqueShort('Lee').replace(' ', ''), + }); + const list = await api.createCheckInList(event.eventId, { + name: uniqueName('Registration desk'), + badge_printing_enabled: true, + kiosk_mode: options.kiosk ?? false, + }); + return { event, order, list }; +} + +test.describe('badge printing at check-in', () => { + test('door staff print a badge from the attendee sheet', { tag: '@smoke' }, async ({ page, api, publicApi, account }) => { + await stubBrowserPrinting(page.context()); + const { event, order, list } = await seedBadgeList(api, publicApi, account.organizerId); + const attendee = order.attendees[0]; + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await checkIn.openSearchTab(); + await checkIn.search(order.buyerLastName); + await checkIn.openAttendee(attendee.publicId); + + await expect(checkIn.printBadgeButton()).toHaveText('Print badge'); + await checkIn.printBadgeButton().click(); + + await expect(checkIn.badgePrintNote()).toHaveText('Badge printed once'); + await expect(checkIn.printBadgeButton()).toHaveText('Reprint badge'); + expect(await printCalls(page)).toBe(1); + + const attendees = await api.listAttendees(event.eventId); + expect(attendees.find((record) => record.public_id === attendee.publicId)?.badge_print_count).toBe(1); + }); + + test('badges print automatically when auto-print is on', async ({ page, api, publicApi, account }) => { + await stubBrowserPrinting(page.context()); + const { event, order, list } = await seedBadgeList(api, publicApi, account.organizerId); + const attendee = order.attendees[0]; + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await checkIn.enableAutoPrint(); + await checkIn.openSearchTab(); + await checkIn.search(order.buyerLastName); + await checkIn.checkInButton(attendee.publicId).click(); + await expect(checkIn.checkOutButton(attendee.publicId)).toBeVisible(); + + await expect.poll(() => printCalls(page)).toBe(1); + await expect.poll(async () => (await api.getBadgeStats(event.eventId)).printed).toBe(1); + }); + + test('door printing follows a fold-over design', async ({ page, api, publicApi, account }) => { + await stubBrowserPrinting(page.context()); + const { event, order, list } = await seedBadgeList(api, publicApi, account.organizerId); + await api.updateBadgeDesign(event.eventId, { back_mode: 'SAME', fold_over: true }); + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await checkIn.openSearchTab(); + await checkIn.search(order.buyerLastName); + await checkIn.openAttendee(order.attendees[0].publicId); + await checkIn.printBadgeButton().click(); + + await expect.poll(() => printCalls(page)).toBe(1); + expect(await lastPrintedPageSides(page)).toEqual(['fold']); + }); + + test('the back prints at the door only on a device set up for two-sided printing', async ({ page, api, publicApi, account }) => { + await stubBrowserPrinting(page.context()); + const { event, order, list } = await seedBadgeList(api, publicApi, account.organizerId); + await api.updateBadgeDesign(event.eventId, { back_mode: 'SAME', fold_over: false }); + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await checkIn.openSearchTab(); + await checkIn.search(order.buyerLastName); + await checkIn.openAttendee(order.attendees[0].publicId); + await checkIn.printBadgeButton().click(); + await expect.poll(() => printCalls(page)).toBe(1); + expect(await lastPrintedPageSides(page)).toEqual(['front']); + await page.keyboard.press('Escape'); + + await checkIn.chooseBackPrinting('Two-sided printer'); + await checkIn.openAttendee(order.attendees[0].publicId); + await expect(checkIn.printBadgeButton()).toHaveText('Reprint badge'); + await checkIn.printBadgeButton().click(); + await expect.poll(() => printCalls(page)).toBe(2); + expect(await lastPrintedPageSides(page)).toEqual(['front', 'back']); + }); + + test('lists without badge printing show no print controls', async ({ page, api, publicApi, account }) => { + const event = await createLiveEventWithFreeTicket(api, account.organizerId); + const order = await createCompletedOrder(publicApi, event, { buyerLastName: uniqueShort('Plain').replace(' ', '') }); + const list = await api.createCheckInList(event.eventId, { name: uniqueName('Side door') }); + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await checkIn.openSearchTab(); + await checkIn.search(order.buyerLastName); + await checkIn.openAttendee(order.attendees[0].publicId); + + await expect(page.getByRole('button', { name: /^Check in$/ }).last()).toBeVisible(); + await expect(checkIn.printBadgeButton()).toHaveCount(0); + await expect(page.getByTestId('check-in-badge-printer-button')).toHaveCount(0); + }); + + test('attendees check themselves in at a kiosk and their badge prints', async ({ page, api, publicApi, account }) => { + await stubBrowserPrinting(page.context()); + const { order, list } = await seedBadgeList(api, publicApi, account.organizerId, { kiosk: true }); + const attendee = order.attendees[0]; + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await expect(checkIn.kiosk()).toContainText('Scan your ticket to check in'); + await expect(page.getByRole('navigation', { name: 'Check-in navigation' })).toHaveCount(0); + + await checkIn.scanWithUsbScanner(attendee.publicId); + + await expect(page.getByTestId('kiosk-result-success')).toContainText('Welcome, Casey!'); + await expect.poll(() => printCalls(page)).toBe(1); + await expect(page.getByTestId('kiosk-print-status')).toHaveText('Your badge is ready. Collect it from the printer.'); + + await page.getByTestId('kiosk-next-button').click(); + await expect(checkIn.kiosk()).toContainText('Scan your ticket to check in'); + await page.waitForTimeout(3_100); + await checkIn.scanWithUsbScanner(attendee.publicId); + + await expect(page.getByTestId('kiosk-result-duplicate')).toContainText("You're already checked in, Casey"); + expect(await printCalls(page)).toBe(1); + }); +}); diff --git a/e2e/tests/management/check-in-lists.spec.ts b/e2e/tests/management/check-in-lists.spec.ts index d7168395b3..6bf5d43af6 100644 --- a/e2e/tests/management/check-in-lists.spec.ts +++ b/e2e/tests/management/check-in-lists.spec.ts @@ -16,4 +16,27 @@ test.describe('check-in lists', () => { await expect(row).toBeVisible(); await expect(row.getByText('Active')).toBeVisible(); }); + + test('an organizer turns on badge printing and kiosk mode for a list', async ({ authedPage, api, account }) => { + const event = await createDraftEventWithTicket(api, account.organizerId); + await api.enableBadges(event.eventId); + const name = uniqueShort('Registration'); + + const checkInLists = new CheckInListPage(authedPage); + await checkInLists.goto(event.eventId); + await checkInLists.createList(name, { badgePrinting: true, kiosk: true }); + + const row = checkInLists.row(name); + await expect(row.getByText('Prints badges')).toBeVisible(); + await expect(row.getByText('Kiosk')).toBeVisible(); + + await checkInLists.openRowAction(name, 'Edit Check-In List'); + const dialog = authedPage.getByRole('dialog'); + await expect(dialog.getByTestId('check-in-list-ledger-kiosk')).toContainText('On'); + await checkInLists.toggleKiosk(dialog); + await checkInLists.submitEdit(); + + await expect(row.getByText('Prints badges')).toBeVisible(); + await expect(row.getByText('Kiosk')).toHaveCount(0); + }); }); diff --git a/frontend/src/api/badge.client.ts b/frontend/src/api/badge.client.ts new file mode 100644 index 0000000000..2b5fd627c7 --- /dev/null +++ b/frontend/src/api/badge.client.ts @@ -0,0 +1,50 @@ +import {api} from "./client"; +import { + Badge, + BadgeDesign, + BadgeQuery, + BadgeStats, + GenericDataResponse, + GenericPaginatedResponse, + IdParam, +} from "../types"; + +export const buildBadgeQueryString = (query: BadgeQuery): string => { + const params = new URLSearchParams(); + if (query.attendee_ids?.length) params.set('attendee_ids', query.attendee_ids.join(',')); + if (query.product_ids?.length) params.set('product_ids', query.product_ids.join(',')); + if (query.order_id) params.set('order_id', String(query.order_id)); + if (query.event_occurrence_id) params.set('event_occurrence_id', String(query.event_occurrence_id)); + if (query.only_unprinted) params.set('only_unprinted', '1'); + if (query.sort_by) params.set('sort_by', query.sort_by); + if (query.page) params.set('page', String(query.page)); + if (query.per_page) params.set('per_page', String(query.per_page)); + const qs = params.toString(); + return qs ? `?${qs}` : ''; +}; + +export const badgeClient = { + getDesign: async (eventId: IdParam) => { + const response = await api.get>(`events/${eventId}/badge-design`); + return response.data; + }, + updateDesign: async (eventId: IdParam, design: BadgeDesign) => { + const response = await api.put>(`events/${eventId}/badge-design`, design); + return response.data; + }, + getBadges: async (eventId: IdParam, query: BadgeQuery) => { + const response = await api.get>(`events/${eventId}/badges` + buildBadgeQueryString(query)); + return response.data; + }, + getStats: async (eventId: IdParam, eventOccurrenceId?: IdParam | null) => { + const qs = eventOccurrenceId ? `?event_occurrence_id=${eventOccurrenceId}` : ''; + const response = await api.get>(`events/${eventId}/badges/stats${qs}`); + return response.data; + }, + markPrinted: async (eventId: IdParam, attendeeIds: IdParam[]) => { + const response = await api.post>(`events/${eventId}/badges/printed`, { + attendee_ids: attendeeIds, + }); + return response.data; + }, +}; diff --git a/frontend/src/api/check-in.client.ts b/frontend/src/api/check-in.client.ts index a74b55c66b..2a06a36120 100644 --- a/frontend/src/api/check-in.client.ts +++ b/frontend/src/api/check-in.client.ts @@ -2,6 +2,7 @@ import {publicApi} from "./public-client"; import { Attendee, AttendeeDetailPublic, + Badge, CheckInList, CheckInListStats, GenericDataResponse, @@ -44,6 +45,14 @@ export const publicCheckInClient = { }); return response.data; }, + getAttendeeBadge: async (checkInListShortId: IdParam, attendeePublicId: IdParam) => { + const response = await publicApi.get>(`/check-in-lists/${checkInListShortId}/attendees/${attendeePublicId}/badge`); + return response.data; + }, + markAttendeeBadgePrinted: async (checkInListShortId: IdParam, attendeePublicId: IdParam) => { + const response = await publicApi.post>(`/check-in-lists/${checkInListShortId}/attendees/${attendeePublicId}/badge/printed`); + return response.data; + }, deleteCheckIn: async (checkInListShortId: IdParam, checkInShortId: IdParam) => { const response = await publicApi.delete>(`/check-in-lists/${checkInListShortId}/check-ins/${checkInShortId}`); return response.data; diff --git a/frontend/src/components/common/AttendeeTable/AttendeeTable.module.scss b/frontend/src/components/common/AttendeeTable/AttendeeTable.module.scss index 4f0ab790fa..ac93a9b78a 100644 --- a/frontend/src/components/common/AttendeeTable/AttendeeTable.module.scss +++ b/frontend/src/components/common/AttendeeTable/AttendeeTable.module.scss @@ -180,3 +180,21 @@ align-items: center; justify-content: flex-end; } + +.badgeStatus { + display: inline-flex; + align-items: center; + gap: 4px; + font-size: 0.8125rem; + white-space: nowrap; + color: var(--mantine-color-gray-6); + + &[data-status="PRINTED"] { + color: var(--mantine-color-teal-7); + } + + &[data-status="NEEDS_REPRINT"] { + color: var(--mantine-color-orange-7); + font-weight: 500; + } +} diff --git a/frontend/src/components/common/AttendeeTable/index.tsx b/frontend/src/components/common/AttendeeTable/index.tsx index e710cf787d..10da3f9ea7 100644 --- a/frontend/src/components/common/AttendeeTable/index.tsx +++ b/frontend/src/components/common/AttendeeTable/index.tsx @@ -17,6 +17,7 @@ import {useClipboard, useDisclosure} from "@mantine/hooks"; import {useMemo, useState} from "react"; import {NoResultsSplash} from "../NoResultsSplash"; import {useParams} from "react-router"; +import {useEventFeature} from "../../../hooks/useEventFeature.ts"; import {useGetEvent} from "../../../queries/useGetEvent.ts"; import {useGetEventCheckInLists} from "../../../queries/useGetCheckInLists.ts"; import Truncate from "../Truncate"; @@ -100,6 +101,9 @@ export const AttendeeTable = ({attendees, openCreateModal, compact, occurrenceId orderModal.open(); }; + const badgesEnabled = useEventFeature(eventId, 'BADGES'); + const hasPrintedBadges = badgesEnabled && attendees.some((attendee) => (attendee.badge_print_count ?? 0) > 0); + const columns = useMemo[]>( () => { const allColumns: TanStackTableColumn[] = [ @@ -326,6 +330,30 @@ export const AttendeeTable = ({attendees, openCreateModal, compact, occurrenceId cellStyle: {textAlign: 'center'}, }, }, + { + id: 'badge', + header: t`Badge`, + enableHiding: true, + cell: (info: CellContext) => { + const attendee = info.row.original; + const count = attendee.badge_print_count ?? 0; + if (count === 0) { + return {t`Not printed`}; + } + if (attendee.badge_print_status === 'NEEDS_REPRINT') { + return {t`Needs reprint`}; + } + return ( + + + {count > 1 ? t`Printed ×${count}` : t`Printed`} + + ); + }, + meta: { + headerStyle: {minWidth: 110}, + }, + }, { id: 'actions', header: '', @@ -349,10 +377,13 @@ export const AttendeeTable = ({attendees, openCreateModal, compact, occurrenceId if (column.id === 'checkIn' && !hasCheckInLists) { return false; } + if (column.id === 'badge' && !hasPrintedBadges) { + return false; + } return true; }); }, - [emailPopoverId, event, hasCheckInLists, relevantCheckInLists, occurrenceId] + [emailPopoverId, event, hasCheckInLists, relevantCheckInLists, occurrenceId, hasPrintedBadges] ); if (attendees.length === 0) { diff --git a/frontend/src/components/common/CheckInListTable/index.tsx b/frontend/src/components/common/CheckInListTable/index.tsx index abcf7b35a2..0d50c8fae4 100644 --- a/frontend/src/components/common/CheckInListTable/index.tsx +++ b/frontend/src/components/common/CheckInListTable/index.tsx @@ -15,6 +15,7 @@ import { import {useMemo, useState} from "react"; import {useDisclosure, useMediaQuery} from "@mantine/hooks"; import {useParams} from "react-router"; +import {useEventFeature} from "../../../hooks/useEventFeature.ts"; import {t, Trans} from "@lingui/macro"; import {NoResultsSplash} from "../NoResultsSplash"; import {EditCheckInListModal} from "../../modals/EditCheckInListModal"; @@ -47,6 +48,7 @@ export const CheckInListTable = ({checkInLists, openCreateModal, event}: CheckIn const [selectedCheckInListId, setSelectedCheckInListId] = useState(); const deleteMutation = useDeleteCheckInList(); const {eventId} = useParams(); + const badgesEnabled = useEventFeature(eventId, 'BADGES'); const isRecurring = event?.type === EventType.RECURRING; const isMobile = useMediaQuery('(max-width: 768px)'); @@ -86,6 +88,12 @@ export const CheckInListTable = ({checkInLists, openCreateModal, event}: CheckIn {list.is_system_default && ( {t`Default`} )} + {badgesEnabled && list.badge_printing_enabled && ( + {t`Prints badges`} + )} + {list.kiosk_mode && ( + {t`Kiosk`} + )}
{coversAllTickets diff --git a/frontend/src/components/common/DesignerShell/DesignerShell.module.scss b/frontend/src/components/common/DesignerShell/DesignerShell.module.scss index 1c6cca3f82..9a5774e316 100644 --- a/frontend/src/components/common/DesignerShell/DesignerShell.module.scss +++ b/frontend/src/components/common/DesignerShell/DesignerShell.module.scss @@ -151,13 +151,19 @@ $narrow-gutter: max(var(--hi-spacing-lg), calc((100% - 560px) / 2)); display: flex; align-items: center; justify-content: space-between; + gap: var(--hi-spacing-sm); padding: var(--hi-spacing-xs) var(--hi-spacing-md); border-bottom: 1px solid var(--mantine-color-gray-2); background: #ffffff; } .previewLabel { + flex-shrink: 0; letter-spacing: 0.04em; + + @include mixins.respond-below(sm) { + display: none; + } } .previewStage { diff --git a/frontend/src/components/common/DesignerShell/index.tsx b/frontend/src/components/common/DesignerShell/index.tsx index b248dbf425..78f5f2978e 100644 --- a/frontend/src/components/common/DesignerShell/index.tsx +++ b/frontend/src/components/common/DesignerShell/index.tsx @@ -1,4 +1,5 @@ import {ReactNode, useState} from "react"; +import {WriteAccess} from "../WriteAccess"; import {Button, SegmentedControl, Text, Tooltip, VisuallyHidden} from "@mantine/core"; import {IconDeviceDesktop, IconDeviceMobile} from "@tabler/icons-react"; import {t} from "@lingui/macro"; @@ -148,27 +149,29 @@ export const DesignerShell = ({ {hasUnsavedChanges ? t`Unsaved changes` : t`All changes saved`} - {hasUnsavedChanges && ( + + {hasUnsavedChanges && ( + + )} - )} - + )} /> diff --git a/frontend/src/components/common/Ledger/Ledger.module.scss b/frontend/src/components/common/Ledger/Ledger.module.scss new file mode 100644 index 0000000000..43dbd600f6 --- /dev/null +++ b/frontend/src/components/common/Ledger/Ledger.module.scss @@ -0,0 +1,87 @@ +@use "../../../styles/mixins"; + +.ledger { + margin-bottom: var(--hi-spacing-lg); +} + +.ledgerHeading { + font-size: 0.6875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--hi-color-gray-dark); + padding-bottom: var(--hi-spacing-md); +} + +.ledgerRow { + border-top: 1px solid var(--hi-color-border); + + &:last-child { + border-bottom: 1px solid var(--hi-color-border); + } +} + +.ledgerRowButton { + display: flex; + align-items: center; + gap: var(--hi-spacing-md); + width: 100%; + min-height: 44px; + padding: var(--hi-spacing-md) var(--hi-spacing-sm); + border: none; + background: none; + font: inherit; + text-align: left; + cursor: pointer; + border-radius: var(--hi-radius-sm); + + &:hover { + background-color: var(--hi-color-gray); + } + + &:focus-visible { + outline: 2px solid var(--mantine-color-primary-4); + outline-offset: -2px; + } +} + +.ledgerRowIcon { + display: inline-flex; + flex-shrink: 0; + color: var(--hi-primary); +} + +.ledgerRowLabel { + font-weight: 600; + font-size: var(--mantine-font-size-sm); + flex-shrink: 0; +} + +.ledgerRowSummary { + flex: 1; + min-width: 0; + text-align: right; + font-size: var(--mantine-font-size-xs); + color: var(--hi-color-gray-dark); + @include mixins.ellipsis(); + + &.emphasized { + color: var(--hi-primary); + font-weight: 600; + } +} + +.ledgerRowChevron { + flex-shrink: 0; + margin-inline-start: auto; + color: var(--hi-color-text-tertiary); + transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1); + + &.open { + transform: rotate(180deg); + } +} + +.ledgerRowContent { + padding: var(--hi-spacing-md) var(--hi-spacing-sm) var(--hi-spacing-lg); +} diff --git a/frontend/src/components/forms/ProductForm/LedgerRow.tsx b/frontend/src/components/common/Ledger/index.tsx similarity index 64% rename from frontend/src/components/forms/ProductForm/LedgerRow.tsx rename to frontend/src/components/common/Ledger/index.tsx index 0bf232ea0d..4f097d10e6 100644 --- a/frontend/src/components/forms/ProductForm/LedgerRow.tsx +++ b/frontend/src/components/common/Ledger/index.tsx @@ -2,41 +2,42 @@ import {ReactNode} from "react"; import {Collapse} from "@mantine/core"; import {IconChevronDown} from "@tabler/icons-react"; import classNames from "classnames"; -import {RowSummary} from "./ledgerSummaries.ts"; -import classes from "./ProductForm.module.scss"; +import classes from "./Ledger.module.scss"; -export type LedgerRowId = - | 'description' - | 'sale-window' - | 'event-page' - | 'waitlist' - | 'taxes' - | 'order-limits' - | 'addons' - | 'highlight' - | 'access'; +export interface RowSummary { + text: string; + emphasized: boolean; +} + +export const Ledger = ({heading, children}: { heading: string; children: ReactNode }) => ( +
+
{heading}
+ {children} +
+); -interface LedgerRowProps { - id: LedgerRowId; +interface LedgerRowProps { + idPrefix: string; + id: T; icon: ReactNode; label: string; summary: RowSummary; opened: boolean; - onToggle: (id: LedgerRowId) => void; + onToggle: (id: T) => void; children: ReactNode; } -export const LedgerRow = ({id, icon, label, summary, opened, onToggle, children}: LedgerRowProps) => { - const contentId = `product-ledger-content-${id}`; +export const LedgerRow = ({idPrefix, id, icon, label, summary, opened, onToggle, children}: LedgerRowProps) => { + const contentId = `${idPrefix}-content-${id}`; return ( -
+