diff --git a/.agents/skills/badge-printer-emulator/SKILL.md b/.agents/skills/badge-printer-emulator/SKILL.md new file mode 100644 index 0000000000..6d86cae6a6 --- /dev/null +++ b/.agents/skills/badge-printer-emulator/SKILL.md @@ -0,0 +1,40 @@ +--- +name: badge-printer-emulator +description: Emulate a Brother QL-820NWB AirPrint label printer with macOS's ippeveprinter and print badges to it from Safari in the iOS Simulator, to see exactly what a real badge printer receives. Use when changing badge layout, print CSS or door and kiosk printing. +--- + +# Badge printer emulator + +Check-in vendors most often recommend the Brother QL-820NWB, and it's the model they support for iPads (AirPrint). `brother-ql820nwb.conf` reproduces its AirPrint attributes from a real Brother QL dump: URF raster only, 300 dpi 8-bit grey, black only, Brother DK label sizes with the 62 × 100 mm DK-1202 badge label loaded. + +## Run it + +Use bash (zsh doesn't split arguments) and run it in the background: + +```bash +S=; mkdir -p "$S/spool" "$S/out" +ippeveprinter -vvv -k -d "$S/spool" -p 8631 -r _universal -a .agents/skills/badge-printer-emulator/brother-ql820nwb.conf "Brother QL-820NWB" > "$S/printer.log" 2>&1 +``` + +The iOS Simulator finds it over Bonjour. Stop it by killing the process. + +## Print to it + +1. On a booted iPad simulator, open a check-in list with badge printing on in Safari (`https://localhost:8443/check-in/`). +2. Scan by typing the ticket code followed by Return (USB scanner mode), then tap Print my badge (kiosk) or Print badge (attendee sheet). +3. In the print sheet pick Brother QL-820NWB and paper 62 x 100 mm, then Print. +4. Decode the job: `python3 -I .agents/skills/badge-printer-emulator/urf2png.py "$S/spool/-.urf" "$S/out/badge"`. It prints the page size and writes `-gray.png` (what iOS sent) and `-thermal.png` (dithered to dots, as the print head prints it). + +## What to check + +- The page is 62.0 × 100.0 mm and nothing is cropped (Safari's own margins, `getIosPrintScale`). +- The footer shows only the site origin, never `/check-in/…`. +- With This printer only prints black on, ribbons are solid black with readable white text. +- QR modules are at least 3 dots wide if the QR code has to scan. + +## Gotchas + +- `-a` can't be combined with `-f`, `-M` or `-m`; everything lives in the conf file. +- Jobs fail with "Unsupported media-col collection value" unless `media-size-supported` lists the size iOS sends. +- iOS caches printers by name. After stopping the emulator, cancel the retrying job on the iPad. +- Desktop Chrome kiosk printing needs the emulator as a macOS printer (`lpadmin -p BadgeEmulator -E -v ipp://localhost:8631/ipp/print -m everywhere`). That changes system settings, so ask before running it. diff --git a/.agents/skills/badge-printer-emulator/brother-ql820nwb.conf b/.agents/skills/badge-printer-emulator/brother-ql820nwb.conf new file mode 100644 index 0000000000..92bb149957 --- /dev/null +++ b/.agents/skills/badge-printer-emulator/brother-ql820nwb.conf @@ -0,0 +1,131 @@ +ATTR text printer-make-and-model "Brother QL-820NWB (emulated)" +ATTR mimeMediaType document-format-supported application/octet-stream,image/urf +ATTR mimeMediaType document-format-default application/octet-stream +ATTR keyword urf-supported V1.3,W8,CP1,IS1,MT1-8-11,OB10,PQ4-5,RS300,FN3-11-60-63 +ATTR boolean color-supported false +ATTR keyword print-color-mode-supported monochrome,auto,auto-monochrome +ATTR keyword print-color-mode-default auto +ATTR keyword output-mode-supported monochrome,auto,auto-monochrome +ATTR resolution printer-resolution-supported 300dpi +ATTR resolution printer-resolution-default 300dpi +ATTR keyword sides-supported one-sided +ATTR keyword media-type-supported labels,roll +ATTR keyword media-source-supported main +ATTR keyword media-col-supported media-type,media-size,media-top-margin,media-left-margin,media-right-margin,media-bottom-margin,media-source +ATTR keyword media-supported om_brother-label-62x100mm_62x100mm,om_brother-label-29x90mm_29x90mm,om_brother-label-38x90mm_38x90mm,om_brother-label-62x29mm_62x29mm,om_brother-label-60x86mm_60x86mm,om_brother-label-58x58mm_58x58mm,roll_min_12x12.7mm,roll_max_62x1000mm +ATTR keyword media-default om_brother-label-62x100mm_62x100mm +ATTR keyword media-ready om_brother-label-62x100mm_62x100mm +ATTR integer media-bottom-margin-supported 303,154,288,202,262 +ATTR integer media-top-margin-supported 303,154,288,202,262 +ATTR integer media-left-margin-supported 154,303,288,202 +ATTR integer media-right-margin-supported 154,303,288,202 +ATTR collection media-size-supported { + MEMBER integer x-dimension 6200 + MEMBER integer y-dimension 10000 +},{ + MEMBER integer x-dimension 2900 + MEMBER integer y-dimension 9000 +},{ + MEMBER integer x-dimension 3800 + MEMBER integer y-dimension 9000 +},{ + MEMBER integer x-dimension 6200 + MEMBER integer y-dimension 2900 +},{ + MEMBER integer x-dimension 6000 + MEMBER integer y-dimension 8600 +},{ + MEMBER integer x-dimension 5800 + MEMBER integer y-dimension 5800 +} +ATTR collection media-col-database { + MEMBER collection media-size { + MEMBER integer x-dimension 6200 + MEMBER integer y-dimension 10000 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +},{ + MEMBER collection media-size { + MEMBER integer x-dimension 2900 + MEMBER integer y-dimension 9000 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +},{ + MEMBER collection media-size { + MEMBER integer x-dimension 3800 + MEMBER integer y-dimension 9000 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +},{ + MEMBER collection media-size { + MEMBER integer x-dimension 6200 + MEMBER integer y-dimension 2900 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +},{ + MEMBER collection media-size { + MEMBER integer x-dimension 6000 + MEMBER integer y-dimension 8600 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +},{ + MEMBER collection media-size { + MEMBER integer x-dimension 5800 + MEMBER integer y-dimension 5800 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +} +ATTR collection media-col-default { + MEMBER collection media-size { + MEMBER integer x-dimension 6200 + MEMBER integer y-dimension 10000 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +} +ATTR collection media-col-ready { + MEMBER collection media-size { + MEMBER integer x-dimension 6200 + MEMBER integer y-dimension 10000 + } + MEMBER integer media-bottom-margin 303 + MEMBER integer media-left-margin 154 + MEMBER integer media-right-margin 154 + MEMBER integer media-top-margin 303 + MEMBER keyword media-type labels + MEMBER keyword media-source main +} diff --git a/.agents/skills/badge-printer-emulator/urf2png.py b/.agents/skills/badge-printer-emulator/urf2png.py new file mode 100644 index 0000000000..00faba4187 --- /dev/null +++ b/.agents/skills/badge-printer-emulator/urf2png.py @@ -0,0 +1,61 @@ +import sys, struct, zlib + +def decode_urf(data): + assert data[:8] == b'UNIRAST\x00', data[:8] + pages = struct.unpack('>I', data[8:12])[0] + pos, out = 12, [] + for _ in range(pages): + bpp, cs, duplex, quality = data[pos], data[pos+1], data[pos+2], data[pos+3] + width, height, dpi = struct.unpack('>III', data[pos+12:pos+24]) + pos += 32 + bytes_pp = bpp // 8 + white = b'\xff' * bytes_pp + rows = [] + while len(rows) < height: + repeat = data[pos] + 1; pos += 1 + line = bytearray() + while len(line) < width * bytes_pp: + n = data[pos]; pos += 1 + if n == 0x80: + line += white * (width - len(line) // bytes_pp) + elif n < 0x80: + line += data[pos:pos+bytes_pp] * (n + 1); pos += bytes_pp + else: + count = 257 - n + line += data[pos:pos+count*bytes_pp]; pos += count*bytes_pp + rows.extend([bytes(line)] * repeat) + out.append((width, height, dpi, bpp, rows[:height])) + return out + +def to_gray(row, bpp): + if bpp == 8: + return row + step = bpp // 8 + return bytes((row[i]*299 + row[i+1]*587 + row[i+2]*114)//1000 for i in range(0, len(row), step)) + +def dither(rows, width): + buf = [list(r) for r in rows] + for y in range(len(buf)): + r = buf[y] + for x in range(width): + old = r[x]; new = 255 if old >= 128 else 0; r[x] = new; err = old - new + if x + 1 < width: r[x+1] += err * 7 // 16 + if y + 1 < len(buf): + n = buf[y+1] + if x > 0: n[x-1] += err * 3 // 16 + n[x] += err * 5 // 16 + if x + 1 < width: n[x+1] += err // 16 + return [bytes(max(0, min(255, v)) for v in r) for r in buf] + +def write_png(path, width, rows): + raw = b''.join(b'\x00' + r for r in rows) + def chunk(t, d): return struct.pack('>I', len(d)) + t + d + struct.pack('>I', zlib.crc32(t + d) & 0xffffffff) + png = b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', struct.pack('>IIBBBBB', width, len(rows), 8, 0, 0, 0, 0)) + chunk(b'IDAT', zlib.compress(raw, 9)) + chunk(b'IEND', b'') + open(path, 'wb').write(png) + +src, prefix = sys.argv[1], sys.argv[2] +for i, (w, h, dpi, bpp, rows) in enumerate(decode_urf(open(src, 'rb').read())): + gray = [to_gray(r, bpp) for r in rows] + write_png(f'{prefix}-p{i+1}-gray.png', w, gray) + write_png(f'{prefix}-p{i+1}-thermal.png', w, dither(gray, w)) + print(f'page {i+1}: {w}x{h}px @ {dpi}dpi = {w*25.4/dpi:.1f} x {h*25.4/dpi:.1f} mm, {bpp}bpp') diff --git a/.claude/rules/features/badges.md b/.claude/rules/features/badges.md new file mode 100644 index 0000000000..08632195d1 --- /dev/null +++ b/.claude/rules/features/badges.md @@ -0,0 +1,35 @@ +--- +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, or the QR value: `public_id` is replaced on every email change and accepted transfer) 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. The only search on a kiosk is the ticket lookup (`kiosk_lookup_enabled`, on by default): an exact, case-insensitive email and last name match, scoped like a scan, returning only `public_id`, first name and ticket title, with its own `kiosk-ticket-lookup` throttle. The kiosk then checks the ticket in through the normal scan path. +- 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. `FitText` fits every line from a render in one batch (reset all, read all, write all per step); fitting one element at a time forces a layout per line and froze a 1,000-badge print page for 20 s. +- Badges print through the browser (`window.print()` with an `@page` size). Door printing goes through `printBadgeSheets`, which swaps the address to `/` for the call, because iOS Safari prints the page URL in the margins and the check-in URL is a bearer link. E2E specs stub `window.print` with `stubBrowserPrinting`, which records the printed path and whether the call came from a click. +- iPad and iPhone (`printsOnlyFromATap`) block `print()` outside a tap and fire `afterprint` while the print sheet is still open. There `useBadgePrinter` prepares the badge first (attendee sheet open, kiosk check-in, setup modal open), prints synchronously from the tap and marks it printed at that moment; auto-print is off and the kiosk shows Print my badge and Print again. Never call `print()` after an `await` on that path. The badge-only print layout stays on while a badge is prepared, because iOS re-renders the live page when the printer or paper changes in its sheet. +- iOS Safari ignores `@page` size and margins, keeps its own (12.7 mm sides and top, about 21 mm bottom for the URL/date footer), and evaluates print media queries against the screen. So on those devices `BadgePrintSheets` zooms the pages by `getIosPrintScale` to fit inside those margins; without it badges on badge-sized paper are cropped. +- `blackInkOnly` (per device) prints accent, ribbon and text as pure black and white and images in greyscale. The most common badge printer (Brother QL-820NWB over AirPrint) prints black only, so colour ribbons dither to unreadable grey without it. +- Kiosk staff controls (Set up, scanner mode) appear only after pressing and holding the list name. The kiosk keeps the screen awake and starts touch devices on the camera unless the device already chose a scanner. +- Device setup instructions live only in `DeviceSetupGuide` (the staffed Badge printing modal and the kiosk's Set up modal), with a copyable Chrome command per platform. Facts it relies on, checked in Chromium source: `--kiosk-printing` confirms print preview automatically and prints to the destination last used in that Chrome profile with its last settings (not the OS default printer unless the `PrintPreviewUseSystemDefaultPrinter` policy is set), so staff print one test badge first; if that destination was Save as PDF, badges save silently to Downloads. Switches only apply when Chrome starts, so the guide has staff quit Chrome first. The `SilentPrintingEnabled` policy (Chrome 144+) is the managed-device equivalent. `--kiosk` is only full screen (⌘Q or Alt+F4 still exit); iPads lock to the page with Guided Access. +- Public check-in routes skip the shared `throttle:api` bucket and use their own per-IP allowance, because every door device at a venue shares one IP (`CheckInRateLimitTest`). +- 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. +- Check print CSS changes against an emulated Brother QL-820NWB with the `badge-printer-emulator` skill. diff --git a/.claude/skills/badge-printer-emulator/SKILL.md b/.claude/skills/badge-printer-emulator/SKILL.md new file mode 100644 index 0000000000..dd29d5a338 --- /dev/null +++ b/.claude/skills/badge-printer-emulator/SKILL.md @@ -0,0 +1,6 @@ +--- +name: badge-printer-emulator +description: Emulate a Brother QL-820NWB AirPrint label printer with macOS's ippeveprinter and print badges to it from Safari in the iOS Simulator, to see exactly what a real badge printer receives. Use when changing badge layout, print CSS or door and kiosk printing. +--- + +Read `.agents/skills/badge-printer-emulator/SKILL.md` and follow it. diff --git a/AGENTS.md b/AGENTS.md index 1413bf33c8..6cf00a872f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -116,6 +116,7 @@ Feature rules live in `.claude/rules/`; Claude Code loads each file automaticall | Reserved seating | `.claude/rules/ee/seating.md` | | Audience (CRM) | `.claude/rules/ee/crm.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` | | Registration questions | `.claude/rules/features/questions.md` | @@ -123,7 +124,7 @@ Feature rules live in `.claude/rules/`; Claude Code loads each file automaticall | Frontend UI patterns | `.claude/rules/frontend/ui.md` | | E2E specs | `.claude/rules/e2e.md` | -Procedures are skills in `.agents/skills/`: `translations`, `api-smoke-test`, `e2e-dev-stack`. +Procedures are skills in `.agents/skills/`: `translations`, `api-smoke-test`, `e2e-dev-stack`, `badge-printer-emulator`. ## Maintaining these docs diff --git a/backend/app/DomainObjects/AttendeeDomainObject.php b/backend/app/DomainObjects/AttendeeDomainObject.php index e5ee8114af..0e6e1a8f2a 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 HiEvents\Services\Domain\TicketResale\DTO\TicketResaleStateDTO; use HiEvents\Services\Domain\TicketResale\DTO\TicketResaleSummaryDTO; use HiEvents\Services\Domain\TicketTransfer\DTO\TicketTransferStateDTO; @@ -142,6 +143,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 794f81ba0e..2ea97383e3 100644 --- a/backend/app/DomainObjects/EventSettingDomainObject.php +++ b/backend/app/DomainObjects/EventSettingDomainObject.php @@ -2,10 +2,18 @@ namespace HiEvents\DomainObjects; +use HiEvents\DomainObjects\Enums\EventFeature; use HiEvents\Helper\StringHelper; 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 60b657d31d..192ba2f47e 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'; final public const TRANSFERRED_AT = 'transferred_at'; protected int $id; @@ -56,6 +58,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; protected ?string $transferred_at = null; public function toArray(): array @@ -83,6 +87,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, 'transferred_at' => $this->transferred_at ?? null, ]; } @@ -329,6 +335,28 @@ 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; + } + public function setTransferredAt(?string $transferred_at): self { $this->transferred_at = $transferred_at; diff --git a/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php b/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php index 984d752462..059aad2c68 100644 --- a/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php +++ b/backend/app/DomainObjects/Generated/CheckInListDomainObjectAbstract.php @@ -25,6 +25,9 @@ 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'; + final public const KIOSK_LOOKUP_ENABLED = 'kiosk_lookup_enabled'; protected int $id; protected int $event_id; @@ -41,6 +44,9 @@ 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; + protected bool $kiosk_lookup_enabled = true; public function toArray(): array { @@ -60,6 +66,9 @@ 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, + 'kiosk_lookup_enabled' => $this->kiosk_lookup_enabled ?? null, ]; } @@ -227,4 +236,37 @@ 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; + } + + public function setKioskLookupEnabled(bool $kiosk_lookup_enabled): self + { + $this->kiosk_lookup_enabled = $kiosk_lookup_enabled; + return $this; + } + + public function getKioskLookupEnabled(): bool + { + return $this->kiosk_lookup_enabled; + } } diff --git a/backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php b/backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php index 547a52d250..b93982a506 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'; + final public const PHONE_COLLECTION = 'phone_collection'; final public const SHOW_SMS_OPT_IN = 'show_sms_opt_in'; @@ -282,6 +286,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; + protected string $phone_collection = 'OFF'; protected bool $show_sms_opt_in = false; @@ -359,6 +367,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, 'phone_collection' => $this->phone_collection ?? null, 'show_sms_opt_in' => $this->show_sms_opt_in ?? null, 'allow_ticket_transfer' => $this->allow_ticket_transfer ?? null, @@ -1150,6 +1160,30 @@ 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; + } + public function setPhoneCollection(string $phone_collection): self { $this->phone_collection = $phone_collection; 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..802a24733a 100644 --- a/backend/app/Http/Actions/CheckInLists/CreateCheckInListAction.php +++ b/backend/app/Http/Actions/CheckInLists/CreateCheckInListAction.php @@ -35,6 +35,9 @@ 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, + kioskLookupEnabled: $request->validated('kiosk_lookup_enabled') ?? true, ) ); } catch (UnrecognizedProductIdException $exception) { diff --git a/backend/app/Http/Actions/CheckInLists/Public/LookupKioskTicketsPublicAction.php b/backend/app/Http/Actions/CheckInLists/Public/LookupKioskTicketsPublicAction.php new file mode 100644 index 0000000000..be43a6e091 --- /dev/null +++ b/backend/app/Http/Actions/CheckInLists/Public/LookupKioskTicketsPublicAction.php @@ -0,0 +1,42 @@ +handler->handle(new LookupKioskTicketsPublicDTO( + checkInListShortId: $checkInListShortId, + email: $request->validated('email'), + lastName: $request->validated('last_name'), + )); + } catch (CannotCheckInException $exception) { + return $this->errorResponse( + message: $exception->getMessage(), + statusCode: Response::HTTP_FORBIDDEN, + ); + } + + return $this->resourceResponse( + resource: KioskTicketPublicResource::class, + data: $tickets, + ); + } +} diff --git a/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php b/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php index 5db8972201..fc2f54619c 100644 --- a/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php +++ b/backend/app/Http/Actions/CheckInLists/UpdateCheckInListAction.php @@ -36,6 +36,9 @@ 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'), + kioskLookupEnabled: $request->validated('kiosk_lookup_enabled'), ) ); } 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/LookupKioskTicketsRequest.php b/backend/app/Http/Request/CheckInList/LookupKioskTicketsRequest.php new file mode 100644 index 0000000000..6368b5bf5b --- /dev/null +++ b/backend/app/Http/Request/CheckInList/LookupKioskTicketsRequest.php @@ -0,0 +1,18 @@ + ['required', 'string', 'email', 'max:255'], + 'last_name' => ['required', 'string', 'max:100'], + ]; + } +} diff --git a/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php b/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php index 979fa24715..76f9e17ffa 100644 --- a/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php +++ b/backend/app/Http/Request/CheckInList/UpsertCheckInListRequest.php @@ -28,6 +28,9 @@ 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'], + 'kiosk_lookup_enabled' => ['nullable', 'boolean'], ]; } diff --git a/backend/app/Http/Request/EventSettings/UpdateEventSettingsRequest.php b/backend/app/Http/Request/EventSettings/UpdateEventSettingsRequest.php index 635ae95276..3429f82828 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; @@ -79,7 +80,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))], @@ -89,7 +89,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\-]*$/'], @@ -101,7 +100,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'], @@ -110,18 +108,14 @@ 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'], 'phone_collection' => [Rule::in(PhoneCollection::valuesArray())], 'show_sms_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], @@ -131,7 +125,6 @@ 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'], 'allow_ticket_transfer' => ['boolean'], 'ticket_transfer_cutoff_minutes' => ['integer', 'min:0', 'max:525600'], @@ -139,13 +132,14 @@ public function rules(): array 'allow_ticket_resale' => ['boolean'], 'ticket_resale_cutoff_minutes' => ['integer', 'min:0', 'max:525600'], - // 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())], ]; } @@ -163,22 +157,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 findKioskTicketMatches( + int $eventId, + string $email, + string $lastName, + array $productIds, + ?int $eventOccurrenceId, + ): Collection { + $where = [ + AttendeeDomainObjectAbstract::EVENT_ID => $eventId, + [AttendeeDomainObjectAbstract::STATUS, 'in', [AttendeeStatus::ACTIVE->name, AttendeeStatus::AWAITING_PAYMENT->name]], + static fn (Builder $query) => $query + ->whereRaw('lower(trim(email)) = ?', [mb_strtolower(trim($email))]) + ->whereRaw('lower(trim(last_name)) = ?', [mb_strtolower(trim($lastName))]), + ]; + + if ($productIds !== []) { + $where[] = [AttendeeDomainObjectAbstract::PRODUCT_ID, 'in', $productIds]; + } + + if ($eventOccurrenceId !== null) { + $where[AttendeeDomainObjectAbstract::EVENT_OCCURRENCE_ID] = $eventOccurrenceId; + } + + return $this + ->loadRelation(new Relationship(ProductDomainObject::class, name: 'product')) + ->findWhere( + where: $where, + orderAndDirections: [new OrderAndDirection(AttendeeDomainObjectAbstract::ID)], + limit: self::KIOSK_TICKET_MATCH_LIMIT, + ); + } + + 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 21834861d6..e148ccccbf 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,22 @@ public function findByEventIdForExport(int $eventId, ?int $eventOccurrenceId = n public function getAttendeesByCheckInShortId(string $shortId, QueryParamsDTO $params): Paginator; + public function findForBadges(BadgeAttendeeQueryDTO $query): LengthAwarePaginator; + + /** + * @param int[] $productIds + * @return Collection + */ + public function findKioskTicketMatches( + int $eventId, + string $email, + string $lastName, + array $productIds, + ?int $eventOccurrenceId, + ): Collection; + + public function getBadgeStats(int $eventId, bool $includeAwaitingPayment, ?int $eventOccurrenceId = null): BadgeStatsDTO; + /** * @return Collection */ 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 7fc6d1740b..ae02376a50 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..dd23ce72c3 100644 --- a/backend/app/Resources/CheckInList/CheckInListResource.php +++ b/backend/app/Resources/CheckInList/CheckInListResource.php @@ -28,6 +28,9 @@ 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(), + 'kiosk_lookup_enabled' => $this->getKioskLookupEnabled(), $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..3ea84293ac 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,12 @@ 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(), + 'kiosk_lookup_enabled' => $this->getKioskMode() && $this->getKioskLookupEnabled(), + $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/CheckInList/KioskTicketPublicResource.php b/backend/app/Resources/CheckInList/KioskTicketPublicResource.php new file mode 100644 index 0000000000..6738b957b0 --- /dev/null +++ b/backend/app/Resources/CheckInList/KioskTicketPublicResource.php @@ -0,0 +1,23 @@ + $this->getPublicId(), + 'first_name' => $this->getFirstName(), + 'product_title' => $this->getProduct()?->getTitle(), + ]; + } +} diff --git a/backend/app/Resources/Event/EventSettingsResource.php b/backend/app/Resources/Event/EventSettingsResource.php index 5e4c76bfa7..e202fda7de 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,23 +65,18 @@ public function toArray($request): array 'invoice_notes' => $this->getInvoiceNotes(), 'invoice_payment_terms_days' => $this->getInvoicePaymentTermsDays(), - // Marketing settings 'show_marketing_opt_in' => $this->getShowMarketingOptIn(), /** @var 'OFF'|'OPTIONAL'|'REQUIRED' */ 'phone_collection' => $this->getPhoneCollection(), 'show_sms_opt_in' => $this->getShowSmsOptIn(), - // 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(), 'allow_ticket_transfer' => $this->getAllowTicketTransfer(), 'ticket_transfer_cutoff_minutes' => $this->getTicketTransferCutoffMinutes(), @@ -92,13 +84,14 @@ public function toArray($request): array 'allow_ticket_resale' => $this->getAllowTicketResale(), 'ticket_resale_cutoff_minutes' => $this->getTicketResaleCutoffMinutes(), - // 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 7cdacf7635..a126aa17c6 100644 --- a/backend/app/Services/Application/Handlers/Attendee/EditAttendeeHandler.php +++ b/backend/app/Services/Application/Handlers/Attendee/EditAttendeeHandler.php @@ -18,6 +18,7 @@ use HiEvents\Repository\Interfaces\ProductRepositoryInterface; use HiEvents\Services\Application\Handlers\Attendee\DTO\EditAttendeeDTO; use HiEvents\Services\Domain\Attendee\OrganizerAttendeeIdentityChangeService; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\Product\AvailableProductQuantitiesFetchService; use HiEvents\Services\Domain\Product\ProductQuantityUpdateService; use HiEvents\Services\Domain\TicketResale\TicketResaleClosureService; @@ -42,6 +43,7 @@ public function __construct( private readonly OrganizerAttendeeIdentityChangeService $identityChangeService, private readonly TicketResaleClosureService $resaleClosureService, private readonly TransactionLockService $transactionLockService, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -59,7 +61,10 @@ public function handle(EditAttendeeDTO $editAttendeeDTO): AttendeeDomainObject $this->adjustProductQuantities($attendee, $editAttendeeDTO); - $updatedAttendee = $this->updateAttendee($editAttendeeDTO, $attendee); + $updatedAttendee = $this->badgeReprintService->flagIfBadgeDetailsChanged( + before: $attendee, + after: $this->updateAttendee($editAttendeeDTO, $attendee), + ); $this->identityChangeService->record($attendee, $updatedAttendee); diff --git a/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php b/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php index 97fd340e7e..51b2ea37c2 100644 --- a/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php +++ b/backend/app/Services/Application/Handlers/Attendee/PartialEditAttendeeHandler.php @@ -21,6 +21,7 @@ use HiEvents\Repository\Interfaces\TicketResaleListingRepositoryInterface; use HiEvents\Services\Application\Handlers\Attendee\DTO\PartialEditAttendeeDTO; use HiEvents\Services\Domain\Attendee\OrganizerAttendeeIdentityChangeService; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\EventOccurrence\OccurrencePurchaseEligibilityService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsCancellationService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsReactivationService; @@ -55,6 +56,7 @@ public function __construct( private readonly OrganizerAttendeeIdentityChangeService $identityChangeService, private readonly TicketResaleClosureService $resaleClosureService, private readonly TicketResaleListingRepositoryInterface $resaleListingRepository, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -122,7 +124,7 @@ private function updateAttendee(PartialEditAttendeeDTO $data, ?string $status): ); } - return $updatedAttendee; + 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..ff9d429378 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/CreateCheckInListHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/CreateCheckInListHandler.php @@ -27,7 +27,10 @@ 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) + ->setKioskLookupEnabled($listData->kioskLookupEnabled ?? true); 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..2c2f9d5164 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/DTO/UpsertCheckInListDTO.php +++ b/backend/app/Services/Application/Handlers/CheckInList/DTO/UpsertCheckInListDTO.php @@ -18,5 +18,8 @@ public function __construct( public bool $publicShowAttendeeNotes = false, public bool $publicShowQuestionAnswers = false, public bool $publicShowOrderDetails = false, + public ?bool $badgePrintingEnabled = null, + public ?bool $kioskMode = null, + public ?bool $kioskLookupEnabled = null, ) {} } diff --git a/backend/app/Services/Application/Handlers/CheckInList/Public/DTO/LookupKioskTicketsPublicDTO.php b/backend/app/Services/Application/Handlers/CheckInList/Public/DTO/LookupKioskTicketsPublicDTO.php new file mode 100644 index 0000000000..a2cac6996d --- /dev/null +++ b/backend/app/Services/Application/Handlers/CheckInList/Public/DTO/LookupKioskTicketsPublicDTO.php @@ -0,0 +1,16 @@ +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/Public/LookupKioskTicketsPublicHandler.php b/backend/app/Services/Application/Handlers/CheckInList/Public/LookupKioskTicketsPublicHandler.php new file mode 100644 index 0000000000..012c64599e --- /dev/null +++ b/backend/app/Services/Application/Handlers/CheckInList/Public/LookupKioskTicketsPublicHandler.php @@ -0,0 +1,54 @@ + + * + * @throws ResourceNotFoundException + * @throws CannotCheckInException + */ + public function handle(LookupKioskTicketsPublicDTO $dto): Collection + { + /** @var CheckInListDomainObject|null $checkInList */ + $checkInList = $this->checkInListRepository + ->loadRelation(ProductDomainObject::class) + ->findFirstWhere([CheckInListDomainObjectAbstract::SHORT_ID => $dto->checkInListShortId]); + + if ($checkInList === null || ! $checkInList->getKioskMode() || ! $checkInList->getKioskLookupEnabled()) { + throw new ResourceNotFoundException(__('Check-in list not found')); + } + + $this->checkInListActivityValidator->assertActive($checkInList); + + return $this->attendeeRepository->findKioskTicketMatches( + eventId: $checkInList->getEventId(), + email: $dto->email, + lastName: $dto->lastName, + productIds: $checkInList->getProducts()?->map(fn (ProductDomainObject $product) => $product->getId())->all() ?? [], + eventOccurrenceId: $checkInList->getEventOccurrenceId(), + ); + } +} diff --git a/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php b/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php index 2bae7c72af..09f6ad3e26 100644 --- a/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php +++ b/backend/app/Services/Application/Handlers/CheckInList/UpdateCheckInlistHandler.php @@ -32,7 +32,10 @@ public function handle(UpsertCheckInListDTO $data): CheckInListDomainObject return $this->updateCheckInlistService->updateCheckInlist( checkInList: $checkInList, - productIds: $data->productIds + productIds: $data->productIds, + badgePrintingEnabled: $data->badgePrintingEnabled, + kioskMode: $data->kioskMode, + kioskLookupEnabled: $data->kioskLookupEnabled, ); } } diff --git a/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php b/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php index 6db612e9fc..182ce4d0a9 100644 --- a/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php +++ b/backend/app/Services/Application/Handlers/EventSettings/DTO/UpdateEventSettingsDTO.php @@ -16,7 +16,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, @@ -47,7 +46,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, @@ -56,7 +54,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, @@ -68,25 +65,19 @@ 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, public readonly PhoneCollection $phone_collection = PhoneCollection::OFF, public readonly bool $show_sms_opt_in = false, - // 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, public readonly bool $allow_ticket_transfer = true, public readonly int $ticket_transfer_cutoff_minutes = 0, @@ -94,15 +85,15 @@ public function __construct( public readonly bool $allow_ticket_resale = false, public readonly int $ticket_resale_cutoff_minutes = 120, - // 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( @@ -137,11 +128,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, @@ -153,7 +142,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, @@ -163,18 +151,14 @@ public static function createWithDefaults( 'enabled' => true, ], - // Marketing defaults show_marketing_opt_in: true, phone_collection: PhoneCollection::OFF, show_sms_opt_in: false, - // 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', @@ -182,7 +166,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 3ae3e2495b..dc7a88f5b9 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,23 +112,18 @@ 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(), 'phone_collection' => $eventSettingsDTO->settings['phone_collection'] ?? $existingSettings->getPhoneCollection(), 'show_sms_opt_in' => $eventSettingsDTO->settings['show_sms_opt_in'] ?? $existingSettings->getShowSmsOptIn(), - // 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(), @@ -138,7 +131,6 @@ 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(), 'allow_ticket_transfer' => $eventSettingsDTO->settings['allow_ticket_transfer'] ?? $existingSettings->getAllowTicketTransfer(), 'ticket_transfer_cutoff_minutes' => $eventSettingsDTO->settings['ticket_transfer_cutoff_minutes'] ?? $existingSettings->getTicketTransferCutoffMinutes(), @@ -148,13 +140,13 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe 'allow_ticket_resale' => $eventSettingsDTO->settings['allow_ticket_resale'] ?? $existingSettings->getAllowTicketResale(), 'ticket_resale_cutoff_minutes' => $eventSettingsDTO->settings['ticket_resale_cutoff_minutes'] ?? $existingSettings->getTicketResaleCutoffMinutes(), - // 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 0ec6bbeb3a..e67f2fefd1 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,27 +86,21 @@ 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, 'phone_collection' => $settings->phone_collection->value, 'show_sms_opt_in' => $settings->show_sms_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, 'allow_ticket_transfer' => $settings->allow_ticket_transfer, 'ticket_transfer_cutoff_minutes' => $settings->ticket_transfer_cutoff_minutes, @@ -116,13 +108,15 @@ public function handle(UpdateEventSettingsDTO $settings): EventSettingDomainObje 'allow_ticket_resale' => $settings->allow_ticket_resale, 'ticket_resale_cutoff_minutes' => $settings->ticket_resale_cutoff_minutes, - // 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..808edc0109 --- /dev/null +++ b/backend/app/Services/Domain/Badge/BadgeReprintService.php @@ -0,0 +1,88 @@ +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() + || $before->getPublicId() !== $after->getPublicId(); + + 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..af8f8504be 100644 --- a/backend/app/Services/Domain/CheckInList/CreateCheckInListService.php +++ b/backend/app/Services/Domain/CheckInList/CreateCheckInListService.php @@ -46,6 +46,9 @@ 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(), + CheckInListDomainObjectAbstract::KIOSK_LOOKUP_ENABLED => $checkInList->getKioskLookupEnabled(), ]); $this->checkInListProductAssociationService->addCheckInListToProducts( diff --git a/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php b/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php index 1a8d5c0c11..70a533799a 100644 --- a/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php +++ b/backend/app/Services/Domain/CheckInList/UpdateCheckInListService.php @@ -26,9 +26,14 @@ 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, + ?bool $kioskLookupEnabled = null, + ): CheckInListDomainObject { + return $this->databaseManager->transaction(function () use ($checkInList, $productIds, $badgePrintingEnabled, $kioskMode, $kioskLookupEnabled) { $existingCheckInList = $this->checkInListRepository->findFirstWhere([ CheckInListDomainObjectAbstract::ID => $checkInList->getId(), CheckInListDomainObjectAbstract::EVENT_ID => $checkInList->getEventId(), @@ -56,6 +61,9 @@ 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(), + CheckInListDomainObjectAbstract::KIOSK_LOOKUP_ENABLED => $kioskLookupEnabled ?? $existingCheckInList->getKioskLookupEnabled(), ], where: [ CheckInListDomainObjectAbstract::ID => $checkInList->getId(), diff --git a/backend/app/Services/Domain/Event/DuplicateEventService.php b/backend/app/Services/Domain/Event/DuplicateEventService.php index dfe009f8c2..4ed1441dc8 100644 --- a/backend/app/Services/Domain/Event/DuplicateEventService.php +++ b/backend/app/Services/Domain/Event/DuplicateEventService.php @@ -47,6 +47,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; @@ -87,6 +88,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, ) {} @@ -196,6 +198,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) { @@ -571,6 +579,9 @@ private function cloneCheckInLists( ->setPublicShowAttendeeNotes($checkInList->getPublicShowAttendeeNotes()) ->setPublicShowQuestionAnswers($checkInList->getPublicShowQuestionAnswers()) ->setPublicShowOrderDetails($checkInList->getPublicShowOrderDetails()) + ->setBadgePrintingEnabled($checkInList->getBadgePrintingEnabled()) + ->setKioskMode($checkInList->getKioskMode()) + ->setKioskLookupEnabled($checkInList->getKioskLookupEnabled()) ->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 743eb532cb..78d0dbbfc9 100644 --- a/backend/app/Services/Domain/SelfService/SelfServiceEditAttendeeService.php +++ b/backend/app/Services/Domain/SelfService/SelfServiceEditAttendeeService.php @@ -10,6 +10,7 @@ use HiEvents\Repository\Interfaces\TicketResaleListingRepositoryInterface; use HiEvents\Services\Domain\Attendee\AttendeeCredentialRotationService; use HiEvents\Services\Domain\Attendee\AttendeeDetailsChangeNotificationService; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\SelfService\DTO\EditAttendeeResultDTO; use HiEvents\Services\Domain\TicketTransfer\TicketTransferInitiationService; use HiEvents\Services\Infrastructure\DomainEvents\DomainEventDispatcherService; @@ -26,6 +27,7 @@ public function __construct( private readonly DomainEventDispatcherService $domainEventDispatcherService, private readonly TicketTransferInitiationService $transferInitiationService, private readonly TicketResaleListingRepositoryInterface $listingRepository, + private readonly BadgeReprintService $badgeReprintService, ) {} /** @@ -85,6 +87,8 @@ public function editAttendee( where: ['id' => $attendee->getId()] ); + $this->badgeReprintService->flagForReprint([$attendee->getId()]); + if ($emailChanged) { $this->transferInitiationService->cancelForHolderChange($attendee->getId()); } diff --git a/backend/app/Services/Domain/TicketTransfer/TicketTransferClaimService.php b/backend/app/Services/Domain/TicketTransfer/TicketTransferClaimService.php index 45688cd382..1baf619a28 100644 --- a/backend/app/Services/Domain/TicketTransfer/TicketTransferClaimService.php +++ b/backend/app/Services/Domain/TicketTransfer/TicketTransferClaimService.php @@ -16,6 +16,7 @@ use HiEvents\Repository\Interfaces\TicketTransferRepositoryInterface; use HiEvents\Services\Domain\Attendee\AttendeeCredentialRotationService; use HiEvents\Services\Domain\Attendee\SendAttendeeTicketService; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\SelfService\OrderAuditLogService; use HiEvents\Services\Domain\SelfService\TicketControlService; use HiEvents\Services\Domain\TicketTransfer\DTO\TicketTransferContextDTO; @@ -40,6 +41,7 @@ public function __construct( private readonly TicketControlService $ticketControlService, private readonly DomainEventDispatcherService $domainEventDispatcherService, private readonly DatabaseManager $databaseManager, + private readonly BadgeReprintService $badgeReprintService, ) {} public static function hashToken(string $token): string @@ -103,6 +105,8 @@ public function accept( [AttendeeDomainObjectAbstract::ID => $context->attendee->getId()], ); + $this->badgeReprintService->flagForReprint([$context->attendee->getId()]); + $this->answerService->replaceAnswers($context->attendee, $questions); $this->ticketTransferRepository->updateWhere( 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/database/migrations/2026_10_30_000000_add_kiosk_lookup_to_check_in_lists.php b/backend/database/migrations/2026_10_30_000000_add_kiosk_lookup_to_check_in_lists.php new file mode 100644 index 0000000000..ebe7fb7e5d --- /dev/null +++ b/backend/database/migrations/2026_10_30_000000_add_kiosk_lookup_to_check_in_lists.php @@ -0,0 +1,22 @@ +boolean('kiosk_lookup_enabled')->default(true); + }); + } + + public function down(): void + { + Schema::table('check_in_lists', function (Blueprint $table) { + $table->dropColumn('kiosk_lookup_enabled'); + }); + } +}; 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/cs.json b/backend/lang/cs.json index 75879a5844..f8afb0e714 100644 --- a/backend/lang/cs.json +++ b/backend/lang/cs.json @@ -1470,6 +1470,19 @@ "This answer means you are not eligible to register for this event.": "S touto odpovědí nesplňujete podmínky pro registraci na tuto událost.", "This would create a loop of follow-up questions.": "Tím by vznikla smyčka navazujících otázek.", "You cannot delete this question because its follow-up questions have answers. You can hide the question instead.": "Tuto otázku nelze smazat, protože její navazující otázky již mají odpovědi. Místo toho ji můžete skrýt.", + "Attendee IDs must be a comma-separated list of numbers.": "ID účastníků musí být čísla oddělená čárkami.", + "Choose a question for this line.": "Vyberte otázku pro tento řádek.", + "Choose one of this event's questions for this line.": "Vyberte pro tento řádek jednu z otázek této akce.", + "Choose one of this event's tickets for this ribbon.": "Vyberte pro tento pruh jednu ze vstupenek této akce.", + "Each attendee can only be listed once.": "Každý účastník může být uveden jen jednou.", + "Each ticket can only have one ribbon.": "Každá vstupenka může mít jen jeden pruh.", + "Enter a height for your custom size.": "Zadejte výšku vlastní velikosti.", + "Enter a width for your custom size.": "Zadejte šířku vlastní velikosti.", + "Enter the text for this line.": "Zadejte text tohoto řádku.", + "One or more attendees could not be found for this event.": "Jednoho nebo více účastníků se v této akci nepodařilo najít.", + "Please enter a 6-digit hex colour, for example #1f2937.": "Zadejte prosím šestimístnou hexadecimální barvu, například #1f2937.", + "Product IDs must be a comma-separated list of numbers.": "ID produktů musí být čísla oddělená čárkami.", + "This check-in list is a self check-in kiosk, so attendee lists are not available on it.": "Tento seznam odbavení je kiosek pro samoobslužné odbavení, proto na něm nejsou k dispozici seznamy účastníků.", "Not found in this account.": "V tomto účtu nenalezeno.", "Too many requests. Wait a minute and try again.": "Příliš mnoho požadavků. Počkejte minutu a zkuste to znovu.", "Hi.Events could not complete the request (HTTP :status).": "Hi.Events nemohl požadavek dokončit (HTTP :status).", diff --git a/backend/lang/de.json b/backend/lang/de.json index c07fc07bd6..8da6e5a4d1 100644 --- a/backend/lang/de.json +++ b/backend/lang/de.json @@ -1264,6 +1264,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "„:option“ wird von der Folgefrage „:question“ verwendet. Benennen Sie die Option um, statt sie zu entfernen, oder passen Sie zuerst die Folgefrage an.", "A question cannot depend on itself.": "Eine Frage kann nicht von sich selbst abhängen.", "At least one answer must let people register.": "Mindestens eine Antwort muss eine Anmeldung ermöglichen.", diff --git a/backend/lang/el.json b/backend/lang/el.json index 13c7dc8d2b..9d2578b516 100644 --- a/backend/lang/el.json +++ b/backend/lang/el.json @@ -1264,6 +1264,19 @@ "Order placed: payment needed": "Η παραγγελία υποβλήθηκε: απαιτείται πληρωμή", "How to pay": "Πώς να πληρώσετε", "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 αυτοεξυπηρέτησης, οπότε οι λίστες συμμετεχόντων δεν είναι διαθέσιμες σε αυτή.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "Η επιλογή «:option» χρησιμοποιείται από την επακόλουθη ερώτηση «:question». Μετονομάστε την επιλογή αντί να την αφαιρέσετε ή ενημερώστε πρώτα την επακόλουθη ερώτηση.", "A question cannot depend on itself.": "Μια ερώτηση δεν μπορεί να εξαρτάται από τον εαυτό της.", "At least one answer must let people register.": "Τουλάχιστον μία απάντηση πρέπει να επιτρέπει την εγγραφή.", diff --git a/backend/lang/es.json b/backend/lang/es.json index e62f3fcf30..da14046025 100644 --- a/backend/lang/es.json +++ b/backend/lang/es.json @@ -1304,6 +1304,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "«:option» la usa la pregunta de seguimiento «:question». Cambia el nombre de la opción en lugar de eliminarla, o actualiza primero la pregunta de seguimiento.", "A question cannot depend on itself.": "Una pregunta no puede depender de sí misma.", "At least one answer must let people register.": "Al menos una respuesta debe permitir el registro.", diff --git a/backend/lang/fi.json b/backend/lang/fi.json index ca396351a8..f25d2a9f5b 100644 --- a/backend/lang/fi.json +++ b/backend/lang/fi.json @@ -1452,6 +1452,19 @@ "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", + "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ä.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "Jatkokysymys ”:question” käyttää vaihtoehtoa ”:option”. Nimeä vaihtoehto uudelleen sen poistamisen sijaan tai muokkaa ensin jatkokysymystä.", "A question cannot depend on itself.": "Kysymys ei voi riippua itsestään.", "At least one answer must let people register.": "Vähintään yhden vastauksen on sallittava rekisteröityminen.", diff --git a/backend/lang/fr.json b/backend/lang/fr.json index 872091a48b..c820b3c6fa 100644 --- a/backend/lang/fr.json +++ b/backend/lang/fr.json @@ -1264,6 +1264,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "« :option » est utilisée par la question de suivi « :question ». Renommez l'option au lieu de la supprimer, ou modifiez d'abord la question de suivi.", "A question cannot depend on itself.": "Une question ne peut pas dépendre d'elle-même.", "At least one answer must let people register.": "Au moins une réponse doit permettre de s'inscrire.", diff --git a/backend/lang/hu.json b/backend/lang/hu.json index e4fe70f436..7eb1aa85e1 100644 --- a/backend/lang/hu.json +++ b/backend/lang/hu.json @@ -1269,6 +1269,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "A(z) „:option” lehetőséget a(z) „:question” kapcsolódó kérdés használja. Törlés helyett nevezze át, vagy előbb módosítsa a kapcsolódó kérdést.", "A question cannot depend on itself.": "Egy kérdés nem függhet saját magától.", "At least one answer must let people register.": "Legalább egy válasznak lehetővé kell tennie a regisztrációt.", diff --git a/backend/lang/it.json b/backend/lang/it.json index bc83ea81d4..e6acfb2d25 100644 --- a/backend/lang/it.json +++ b/backend/lang/it.json @@ -1265,6 +1265,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "\":option\" è usata dalla domanda di approfondimento \":question\". Rinomina l'opzione invece di rimuoverla, oppure aggiorna prima la domanda di approfondimento.", "A question cannot depend on itself.": "Una domanda non può dipendere da sé stessa.", "At least one answer must let people register.": "Almeno una risposta deve consentire la registrazione.", diff --git a/backend/lang/ja.json b/backend/lang/ja.json index 66ffef0012..928a35fce8 100644 --- a/backend/lang/ja.json +++ b/backend/lang/ja.json @@ -1452,6 +1452,19 @@ "Order placed: payment needed": "注文完了: お支払いが必要です", "How to pay": "お支払い方法", "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.": "このチェックインリストはセルフチェックイン端末用のため、参加者リストは利用できません。", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "「:option」はフォローアップの質問「:question」で使用されています。削除する代わりに名前を変更するか、先にフォローアップの質問を更新してください。", "A question cannot depend on itself.": "質問は自分自身に依存できません。", "At least one answer must let people register.": "少なくとも1つの回答で登録できるようにする必要があります。", diff --git a/backend/lang/ko.json b/backend/lang/ko.json index 008026bffe..50779a8b83 100644 --- a/backend/lang/ko.json +++ b/backend/lang/ko.json @@ -1453,6 +1453,19 @@ "Order placed: payment needed": "주문 완료: 결제가 필요합니다", "How to pay": "결제 방법", "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.": "이 체크인 목록은 셀프 체크인 키오스크용이므로 참가자 목록을 사용할 수 없습니다.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "\":option\" 옵션은 후속 질문 \":question\"에서 사용 중입니다. 삭제하는 대신 이름을 바꾸거나 먼저 후속 질문을 수정하세요.", "A question cannot depend on itself.": "질문은 자기 자신에 의존할 수 없습니다.", "At least one answer must let people register.": "하나 이상의 답변은 등록을 허용해야 합니다.", diff --git a/backend/lang/nl.json b/backend/lang/nl.json index abc3c6a33d..0699f356da 100644 --- a/backend/lang/nl.json +++ b/backend/lang/nl.json @@ -1264,6 +1264,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "‘:option’ wordt gebruikt door de vervolgvraag ‘:question’. Hernoem de optie in plaats van haar te verwijderen, of pas eerst de vervolgvraag aan.", "A question cannot depend on itself.": "Een vraag kan niet van zichzelf afhangen.", "At least one answer must let people register.": "Ten minste één antwoord moet registratie toestaan.", diff --git a/backend/lang/pl.json b/backend/lang/pl.json index 1c4778dad4..cbdbf47441 100644 --- a/backend/lang/pl.json +++ b/backend/lang/pl.json @@ -1452,6 +1452,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "„:option” jest używana przez pytanie uzupełniające „:question”. Zmień nazwę opcji zamiast ją usuwać albo najpierw zaktualizuj pytanie uzupełniające.", "A question cannot depend on itself.": "Pytanie nie może zależeć od samego siebie.", "At least one answer must let people register.": "Co najmniej jedna odpowiedź musi umożliwiać rejestrację.", diff --git a/backend/lang/pt-br.json b/backend/lang/pt-br.json index df28ff967a..8051712718 100644 --- a/backend/lang/pt-br.json +++ b/backend/lang/pt-br.json @@ -1264,6 +1264,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "“:option” é usada pela pergunta de acompanhamento “:question”. Renomeie a opção em vez de removê-la ou atualize primeiro a pergunta de acompanhamento.", "A question cannot depend on itself.": "Uma pergunta não pode depender de si mesma.", "At least one answer must let people register.": "Pelo menos uma resposta precisa permitir a inscrição.", diff --git a/backend/lang/pt.json b/backend/lang/pt.json index b43e944aa0..9fa87394a8 100644 --- a/backend/lang/pt.json +++ b/backend/lang/pt.json @@ -1264,6 +1264,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "«:option» é usada pela pergunta de seguimento «:question». Mude o nome da opção em vez de a remover, ou atualize primeiro a pergunta de seguimento.", "A question cannot depend on itself.": "Uma pergunta não pode depender de si própria.", "At least one answer must let people register.": "Pelo menos uma resposta tem de permitir o registo.", diff --git a/backend/lang/ru.json b/backend/lang/ru.json index e90791582f..feffc12814 100644 --- a/backend/lang/ru.json +++ b/backend/lang/ru.json @@ -1206,6 +1206,19 @@ "Order placed: payment needed": "Заказ оформлен: требуется оплата", "How to pay": "Как оплатить", "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.": "Этот список регистрации работает как киоск самостоятельной регистрации, поэтому списки участников в нём недоступны.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "«:option» используется уточняющим вопросом «:question». Переименуйте вариант вместо удаления или сначала измените уточняющий вопрос.", "A question cannot depend on itself.": "Вопрос не может зависеть от самого себя.", "At least one answer must let people register.": "Хотя бы один ответ должен позволять зарегистрироваться.", diff --git a/backend/lang/se.json b/backend/lang/se.json index 368e5a8adf..64b33139c9 100644 --- a/backend/lang/se.json +++ b/backend/lang/se.json @@ -1264,6 +1264,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "”:option” används av följdfrågan ”:question”. Byt namn på alternativet i stället för att ta bort det, eller uppdatera följdfrågan först.", "A question cannot depend on itself.": "En fråga kan inte bero på sig själv.", "At least one answer must let people register.": "Minst ett svar måste tillåta registrering.", diff --git a/backend/lang/sk.json b/backend/lang/sk.json index 16102c9c15..9135485416 100644 --- a/backend/lang/sk.json +++ b/backend/lang/sk.json @@ -1264,6 +1264,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "„:option“ používa doplňujúca otázka „:question“. Možnosť premenujte namiesto odstránenia alebo najprv upravte doplňujúcu otázku.", "A question cannot depend on itself.": "Otázka nemôže závisieť sama od seba.", "At least one answer must let people register.": "Aspoň jedna odpoveď musí umožniť registráciu.", diff --git a/backend/lang/tr.json b/backend/lang/tr.json index 75a536d590..3d174f955d 100644 --- a/backend/lang/tr.json +++ b/backend/lang/tr.json @@ -1279,6 +1279,19 @@ "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", + "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.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "\":option\" seçeneği \":question\" takip sorusu tarafından kullanılıyor. Seçeneği kaldırmak yerine yeniden adlandırın veya önce takip sorusunu güncelleyin.", "A question cannot depend on itself.": "Bir soru kendisine bağlı olamaz.", "At least one answer must let people register.": "En az bir yanıt kayıt olmaya izin vermelidir.", diff --git a/backend/lang/vi.json b/backend/lang/vi.json index d99d3b72b8..b3d2a6283d 100644 --- a/backend/lang/vi.json +++ b/backend/lang/vi.json @@ -1264,6 +1264,19 @@ "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", + "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ự.", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "\":option\" đang được câu hỏi tiếp theo \":question\" sử dụng. Hãy đổi tên lựa chọn thay vì xóa, hoặc cập nhật câu hỏi tiếp theo trước.", "A question cannot depend on itself.": "Một câu hỏi không thể phụ thuộc vào chính nó.", "At least one answer must let people register.": "Phải có ít nhất một câu trả lời cho phép đăng ký.", diff --git a/backend/lang/zh-cn.json b/backend/lang/zh-cn.json index 88e56ab1c6..ffb7d23850 100644 --- a/backend/lang/zh-cn.json +++ b/backend/lang/zh-cn.json @@ -1264,6 +1264,19 @@ "Order placed: payment needed": "订单已提交:需要付款", "How to pay": "如何付款", "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.": "此签到列表为自助签到机模式,无法查看参与者列表。", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "后续问题“:question”正在使用“:option”。请重命名该选项而不是删除它,或先更新后续问题。", "A question cannot depend on itself.": "问题不能依赖于自身。", "At least one answer must let people register.": "至少要有一个答案允许报名。", diff --git a/backend/lang/zh-hk.json b/backend/lang/zh-hk.json index c9698d7e08..18b000d44e 100644 --- a/backend/lang/zh-hk.json +++ b/backend/lang/zh-hk.json @@ -1264,6 +1264,19 @@ "Order placed: payment needed": "訂單已提交:需要付款", "How to pay": "如何付款", "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.": "此簽到列表為自助簽到機模式,無法查看參加者名單。", "\":option\" is used by the follow-up question \":question\". Rename the option instead of removing it, or update the follow-up first.": "後續問題「:question」正在使用「:option」。請重新命名該選項而不是刪除,或先更新後續問題。", "A question cannot depend on itself.": "問題不能依賴自身。", "At least one answer must let people register.": "最少要有一個答案容許登記。", diff --git a/backend/resources/api-reference/openapi.json b/backend/resources/api-reference/openapi.json index 65b5cdd880..786d57d3a9 100644 --- a/backend/resources/api-reference/openapi.json +++ b/backend/resources/api-reference/openapi.json @@ -1744,12 +1744,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": [ { @@ -1766,21 +1842,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": [ @@ -1793,16 +1869,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": [ @@ -1812,9 +1890,6 @@ } } }, - "401": { - "$ref": "#/components/responses/AuthenticationException" - }, "404": { "description": "The requested resource was not found.", "content": { @@ -1834,12 +1909,14 @@ } } } - }, + } + }, + "/events/{eventId}/badges": { "get": { - "operationId": "actions.getBoxOfficesAction", - "summary": "Get Box Offices", + "operationId": "badges.getBadgesAction", + "summary": "Get Badges", "tags": [ - "Box Office" + "Badges" ], "parameters": [ { @@ -1851,68 +1928,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": { @@ -1921,7 +2040,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/BoxOfficeResource" + "$ref": "#/components/schemas/BadgeResource" } }, "links": { @@ -2053,6 +2172,9 @@ "401": { "$ref": "#/components/responses/AuthenticationException" }, + "422": { + "$ref": "#/components/responses/ValidationException" + }, "403": { "description": "The authenticated user is not allowed to perform this action.", "content": { @@ -2092,12 +2214,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": [ { @@ -2109,24 +2231,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": [ @@ -2136,6 +2260,9 @@ } } }, + "422": { + "$ref": "#/components/responses/ValidationException" + }, "401": { "$ref": "#/components/responses/AuthenticationException" }, @@ -2176,12 +2303,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": [ { @@ -2191,14 +2320,6 @@ "schema": { "type": "integer" } - }, - { - "name": "boxOfficeId", - "in": "path", - "required": true, - "schema": { - "type": "integer" - } } ], "requestBody": { @@ -2206,21 +2327,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": [ @@ -2233,16 +2362,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": [ @@ -2252,9 +2383,6 @@ } } }, - "401": { - "$ref": "#/components/responses/AuthenticationException" - }, "404": { "description": "The requested resource was not found.", "content": { @@ -2274,36 +2402,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": { @@ -3722,6 +4596,24 @@ } } } + }, + "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": [] @@ -3810,15 +4702,242 @@ } } } + }, + "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": { + "get": { + "operationId": "public.getCheckInListAttendeesPublicAction", + "summary": "Get Check In List Attendees (public)", + "tags": [ + "Check In Lists / Public" + ], + "parameters": [ + { + "name": "checkInListShortId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Array of `AttendeeWithCheckInPublicResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AttendeeWithCheckInPublicResource" + } + } + }, + "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": [] + } + }, + "/public/check-in-lists/{shortId}/attendees/{attendeePublicId}": { + "get": { + "operationId": "public.getCheckInListAttendeePublicAction", + "summary": "Get Check In List Attendee (public)", + "tags": [ + "Check In Lists / Public" + ], + "parameters": [ + { + "name": "shortId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "attendeePublicId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "`AttendeeWithCheckInPublicResource`", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AttendeeWithCheckInPublicResource" + } + }, + "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": [] } }, - "/public/check-in-lists/{checkInListShortId}/attendees": { + "/public/check-in-lists/{checkInListShortId}/attendees/{attendeePublicId}/detail": { "get": { - "operationId": "public.getCheckInListAttendeesPublicAction", - "summary": "Get Check In List Attendees (public)", + "operationId": "public.getCheckInListAttendeeDetailPublicAction", + "summary": "Get Check In List Attendee Detail (public)", "tags": [ "Check In Lists / Public" ], @@ -3830,21 +4949,26 @@ "schema": { "type": "string" } + }, + { + "name": "attendeePublicId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } } ], "responses": { "200": { - "description": "Array of `AttendeeWithCheckInPublicResource`", + "description": "`AttendeeDetailPublicResource`", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AttendeeWithCheckInPublicResource" - } + "$ref": "#/components/schemas/AttendeeDetailPublicResource" } }, "required": [ @@ -3894,29 +5018,39 @@ } } } + }, + "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/{shortId}/attendees/{attendeePublicId}": { - "get": { - "operationId": "public.getCheckInListAttendeePublicAction", - "summary": "Get Check In List Attendee (public)", + "/public/check-in-lists/{checkInListUuid}/check-ins": { + "post": { + "operationId": "public.createAttendeeCheckInPublicAction", + "summary": "Create Attendee Check In (public)", "tags": [ "Check In Lists / Public" ], "parameters": [ { - "name": "shortId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "attendeePublicId", + "name": "checkInListUuid", "in": "path", "required": true, "schema": { @@ -3924,16 +5058,29 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAttendeeCheckInPublicRequest" + } + } + } + }, "responses": { "200": { - "description": "`AttendeeWithCheckInPublicResource`", + "description": "Array of `AttendeeCheckInPublicResource`", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/AttendeeWithCheckInPublicResource" + "type": "array", + "items": { + "$ref": "#/components/schemas/AttendeeCheckInPublicResource" + } } }, "required": [ @@ -3943,7 +5090,7 @@ } } }, - "403": { + "409": { "description": "", "content": { "application/json": { @@ -3966,6 +5113,9 @@ } } }, + "422": { + "$ref": "#/components/responses/ValidationException" + }, "404": { "description": "The requested resource was not found.", "content": { @@ -3983,15 +5133,33 @@ } } } + }, + "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}/detail": { - "get": { - "operationId": "public.getCheckInListAttendeeDetailPublicAction", - "summary": "Get Check In List Attendee Detail (public)", + "/public/check-in-lists/{checkInListShortId}/check-ins/{checkInShortId}": { + "delete": { + "operationId": "public.deleteAttendeeCheckInPublicAction", + "summary": "Delete Attendee Check In (public)", "tags": [ "Check In Lists / Public" ], @@ -4005,7 +5173,7 @@ } }, { - "name": "attendeePublicId", + "name": "checkInShortId", "in": "path", "required": true, "schema": { @@ -4014,26 +5182,34 @@ } ], "responses": { - "200": { - "description": "`AttendeeDetailPublicResource`", + "204": { + "description": "No content" + }, + "409": { + "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { - "data": { - "$ref": "#/components/schemas/AttendeeDetailPublicResource" + "message": { + "type": "string" + }, + "errors": { + "type": "array", + "items": {} } }, "required": [ - "data" + "message", + "errors" ] } } } }, - "403": { - "description": "", + "404": { + "description": "The requested resource was not found.", "content": { "application/json": { "schema": { @@ -4041,22 +5217,17 @@ "properties": { "message": { "type": "string" - }, - "errors": { - "type": "array", - "items": {} } }, "required": [ - "message", - "errors" + "message" ] } } } }, - "404": { - "description": "The requested resource was not found.", + "429": { + "description": "Too many requests. Retry once the rate limit window resets.", "content": { "application/json": { "schema": { @@ -4077,16 +5248,16 @@ "security": [] } }, - "/public/check-in-lists/{checkInListUuid}/check-ins": { + "/public/check-in-lists/{checkInListShortId}/kiosk/ticket-lookup": { "post": { - "operationId": "public.createAttendeeCheckInPublicAction", - "summary": "Create Attendee Check In (public)", + "operationId": "public.lookupKioskTicketsPublicAction", + "summary": "Lookup Kiosk Tickets (public)", "tags": [ "Check In Lists / Public" ], "parameters": [ { - "name": "checkInListUuid", + "name": "checkInListShortId", "in": "path", "required": true, "schema": { @@ -4099,14 +5270,14 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateAttendeeCheckInPublicRequest" + "$ref": "#/components/schemas/LookupKioskTicketsRequest" } } } }, "responses": { "200": { - "description": "Array of `AttendeeCheckInPublicResource`", + "description": "Array of `KioskTicketPublicResource`", "content": { "application/json": { "schema": { @@ -4115,7 +5286,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/AttendeeCheckInPublicResource" + "$ref": "#/components/schemas/KioskTicketPublicResource" } } }, @@ -4126,7 +5297,7 @@ } } }, - "409": { + "403": { "description": "", "content": { "application/json": { @@ -4169,65 +5340,9 @@ } } } - } - }, - "security": [] - } - }, - "/public/check-in-lists/{checkInListShortId}/check-ins/{checkInShortId}": { - "delete": { - "operationId": "public.deleteAttendeeCheckInPublicAction", - "summary": "Delete Attendee Check In (public)", - "tags": [ - "Check In Lists / Public" - ], - "parameters": [ - { - "name": "checkInListShortId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } }, - { - "name": "checkInShortId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "204": { - "description": "No content" - }, - "409": { - "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.", + "429": { + "description": "Too many requests. Retry once the rate limit window resets.", "content": { "application/json": { "schema": { @@ -29456,6 +30571,15 @@ "public_show_order_details": { "type": "boolean" }, + "badge_printing_enabled": { + "type": "boolean" + }, + "kiosk_mode": { + "type": "boolean" + }, + "kiosk_lookup_enabled": { + "type": "boolean" + }, "is_expired": { "type": "boolean" }, @@ -29495,7 +30619,10 @@ "checked_in_attendees", "public_show_attendee_notes", "public_show_question_answers", - "public_show_order_details" + "public_show_order_details", + "badge_printing_enabled", + "kiosk_mode", + "kiosk_lookup_enabled" ] }, "attendee": { @@ -29569,6 +30696,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": [ { @@ -29674,6 +30818,9 @@ "seat_label", "locale", "notes", + "badge_printed_at", + "badge_print_count", + "badge_print_status", "created_at", "updated_at" ] @@ -29715,6 +30862,17 @@ "null" ] }, + "badge_print_count": { + "type": "integer" + }, + "badge_print_status": { + "type": "string", + "enum": [ + "NOT_PRINTED", + "PRINTED", + "NEEDS_REPRINT" + ] + }, "product_id": { "type": "integer" }, @@ -29932,6 +31090,8 @@ "last_name", "status", "seat_label", + "badge_print_count", + "badge_print_status", "product_id", "product_title", "event_occurrence", @@ -30015,6 +31175,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": [ { @@ -30120,6 +31297,9 @@ "seat_label", "locale", "notes", + "badge_printed_at", + "badge_print_count", + "badge_print_status", "created_at", "updated_at" ], @@ -30407,6 +31587,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": { @@ -30984,6 +32557,15 @@ "public_show_order_details": { "type": "boolean" }, + "badge_printing_enabled": { + "type": "boolean" + }, + "kiosk_mode": { + "type": "boolean" + }, + "kiosk_lookup_enabled": { + "type": "boolean" + }, "is_expired": { "type": "boolean" }, @@ -31023,7 +32605,10 @@ "checked_in_attendees", "public_show_attendee_notes", "public_show_question_answers", - "public_show_order_details" + "public_show_order_details", + "badge_printing_enabled", + "kiosk_mode", + "kiosk_lookup_enabled" ], "title": "CheckInListResource" }, @@ -31161,6 +32746,161 @@ "public_show_order_details": { "type": "boolean" }, + "badge_printing_enabled": { + "type": "boolean" + }, + "kiosk_mode": { + "type": "boolean" + }, + "kiosk_lookup_enabled": { + "type": "string" + }, + "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" }, @@ -31217,7 +32957,10 @@ "checked_in_attendees", "public_show_attendee_notes", "public_show_question_answers", - "public_show_order_details" + "public_show_order_details", + "badge_printing_enabled", + "kiosk_mode", + "kiosk_lookup_enabled" ], "title": "CheckInListResourcePublic" }, @@ -31523,7 +33266,10 @@ "EVENT_COVER", "TICKET_LOGO", "EVENT_GALLERY", - "EVENT_SPONSOR_LOGO" + "EVENT_SPONSOR_LOGO", + "BADGE_LOGO", + "BADGE_ARTWORK", + "BADGE_SPONSORS" ] } }, @@ -31833,6 +33579,9 @@ "TICKET_LOGO", "EVENT_GALLERY", "EVENT_SPONSOR_LOGO", + "BADGE_LOGO", + "BADGE_ARTWORK", + "BADGE_SPONSORS", "ORGANIZER_LOGO", "ORGANIZER_COVER", "ORGANIZER_GALLERY", @@ -33492,7 +35241,6 @@ "type": "string" }, "ticket_design_settings": { - "description": "Ticket design settings", "anyOf": [ { "type": "null" @@ -33510,7 +35258,6 @@ ] }, "payment_providers": { - "description": "Payment settings", "anyOf": [ { "type": "null" @@ -33549,8 +35296,7 @@ "type": "integer" }, "enable_invoicing": { - "type": "boolean", - "description": "Invoice settings" + "type": "boolean" }, "invoice_label": { "type": [ @@ -33601,8 +35347,7 @@ ] }, "show_marketing_opt_in": { - "type": "boolean", - "description": "Marketing settings" + "type": "boolean" }, "phone_collection": { "type": "string", @@ -33616,15 +35361,12 @@ "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" @@ -33659,8 +35401,7 @@ ] }, "allow_attendee_self_edit": { - "type": "boolean", - "description": "Self-service settings" + "type": "boolean" }, "allow_ticket_transfer": { "type": "boolean" @@ -33681,21 +35422,26 @@ "type": "integer" }, "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": [ @@ -33758,7 +35504,8 @@ "show_available_occurrence_capacity", "hide_sold_out_occurrences", "waitlist_auto_process", - "waitlist_offer_timeout_minutes" + "waitlist_offer_timeout_minutes", + "enabled_features" ], "title": "EventSettingsResource" }, @@ -34814,6 +36561,29 @@ "type": "string", "title": "JsonResource" }, + "KioskTicketPublicResource": { + "type": "object", + "properties": { + "public_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "product_title": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "public_id", + "first_name", + "product_title" + ], + "title": "KioskTicketPublicResource" + }, "LineupBillingTier": { "type": "string", "enum": [ @@ -35049,6 +36819,25 @@ ], "title": "LocationResource" }, + "LookupKioskTicketsRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "maxLength": 255 + }, + "last_name": { + "type": "string", + "maxLength": 100 + } + }, + "required": [ + "email", + "last_name" + ], + "title": "LookupKioskTicketsRequest" + }, "LookupTicketResourcePublic": { "type": "object", "properties": { @@ -35098,6 +36887,23 @@ ], "title": "LookupTicketResourcePublic" }, + "MarkBadgesPrintedRequest": { + "type": "object", + "properties": { + "attendee_ids": { + "type": "array", + "items": { + "type": "integer" + }, + "minItems": 1, + "maxItems": 1000 + } + }, + "required": [ + "attendee_ids" + ], + "title": "MarkBadgesPrintedRequest" + }, "MeResource": { "type": "object", "properties": { @@ -41175,7 +42981,6 @@ }, "payment_providers": { "type": "array", - "description": "Payment settings", "items": { "type": "string", "enum": [ @@ -41208,8 +43013,7 @@ "maximum": 720 }, "enable_invoicing": { - "type": "boolean", - "description": "Invoice settings" + "type": "boolean" }, "invoice_label": { "type": [ @@ -41270,7 +43074,6 @@ }, "ticket_design_settings": { "type": "object", - "description": "Ticket design settings", "properties": { "accent_color": { "type": [ @@ -41323,8 +43126,7 @@ } }, "show_marketing_opt_in": { - "type": "boolean", - "description": "Marketing settings" + "type": "boolean" }, "phone_collection": { "type": "string", @@ -41338,16 +43140,13 @@ "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": [ @@ -41565,8 +43364,7 @@ "maxItems": 41 }, "allow_attendee_self_edit": { - "type": "boolean", - "description": "Self-service settings" + "type": "boolean" }, "allow_ticket_transfer": { "type": "boolean" @@ -41593,15 +43391,13 @@ "maximum": 525600 }, "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": [ @@ -41610,6 +43406,15 @@ ], "minimum": 1, "maximum": 10080 + }, + "enabled_features": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "BADGES" + ] + } } }, "title": "UpdateEventSettingsRequest" @@ -41714,6 +43519,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": { @@ -41886,6 +43937,24 @@ "boolean", "null" ] + }, + "badge_printing_enabled": { + "type": [ + "boolean", + "null" + ] + }, + "kiosk_mode": { + "type": [ + "boolean", + "null" + ] + }, + "kiosk_lookup_enabled": { + "type": [ + "boolean", + "null" + ] } }, "required": [ diff --git a/backend/routes/api.php b/backend/routes/api.php index ca4e8ad98e..baf3eb7f81 100644 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -265,6 +265,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; @@ -281,6 +288,7 @@ use HiEvents\Http\Actions\CheckInLists\Public\GetCheckInListAttendeesPublicAction; use HiEvents\Http\Actions\CheckInLists\Public\GetCheckInListPublicAction; use HiEvents\Http\Actions\CheckInLists\Public\GetCheckInListStatsPublicAction; +use HiEvents\Http\Actions\CheckInLists\Public\LookupKioskTicketsPublicAction; use HiEvents\Http\Actions\CheckInLists\UpdateCheckInListAction; use HiEvents\Http\Actions\Common\GetColorThemesAction; use HiEvents\Http\Actions\Common\Webhooks\HandleEmailDeliveryWebhookPublicAction; @@ -910,6 +918,11 @@ 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); $router->get('/events/{event_id}/resale-listings', GetTicketResaleListingsAction::class); $router->post('/events/{event_id}/resale-listings/{listing_id}/close', CloseTicketResaleListingAction::class); $router->post('/events/{event_id}/resale-listings/{listing_id}/retry-refund', RetryTicketResaleRefundAction::class); @@ -1284,13 +1297,21 @@ function (Router $router): void { }); // Check-In - $router->get('/check-in-lists/{check_in_list_short_id}', GetCheckInListPublicAction::class); - $router->get('/check-in-lists/{check_in_list_short_id}/stats', GetCheckInListStatsPublicAction::class); - $router->get('/check-in-lists/{check_in_list_short_id}/attendees', GetCheckInListAttendeesPublicAction::class); - $router->get('/check-in-lists/{check_in_list_short_id}/attendees/{attendee_public_id}', GetCheckInListAttendeePublicAction::class); - $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->withoutMiddleware(ThrottleRequests::class.':api') + ->middleware('throttle:1200,1,public-check-in') + ->group(function (Router $router): void { + $router->get('/check-in-lists/{check_in_list_short_id}', GetCheckInListPublicAction::class); + $router->get('/check-in-lists/{check_in_list_short_id}/stats', GetCheckInListStatsPublicAction::class); + $router->get('/check-in-lists/{check_in_list_short_id}/attendees', GetCheckInListAttendeesPublicAction::class); + $router->get('/check-in-lists/{check_in_list_short_id}/attendees/{attendee_public_id}', GetCheckInListAttendeePublicAction::class); + $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); + $router->post('/check-in-lists/{check_in_list_short_id}/attendees/{attendee_public_id}/badge/printed', MarkCheckInListAttendeeBadgePrintedPublicAction::class); + $router->post('/check-in-lists/{check_in_list_short_id}/kiosk/ticket-lookup', LookupKioskTicketsPublicAction::class) + ->middleware('throttle:30,1,kiosk-ticket-lookup'); + }); // 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/Http/Actions/CheckInLists/Public/LookupKioskTicketsPublicTest.php b/backend/tests/Feature/Http/Actions/CheckInLists/Public/LookupKioskTicketsPublicTest.php new file mode 100644 index 0000000000..93f937f154 --- /dev/null +++ b/backend/tests/Feature/Http/Actions/CheckInLists/Public/LookupKioskTicketsPublicTest.php @@ -0,0 +1,173 @@ +createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $attendee = $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId, 'Speaker'), 'Ada', 'Lovelace'); + $listShortId = $this->createKioskList($eventId); + + $this->lookup($listShortId, ' ADA@example.test ', 'lovelace ') + ->assertOk() + ->assertJsonCount(1, 'data') + ->assertJsonPath('data.0.public_id', $attendee['public_id']) + ->assertJsonPath('data.0.first_name', 'Ada') + ->assertJsonPath('data.0.product_title', 'Speaker') + ->assertJsonMissingPath('data.0.email') + ->assertJsonMissingPath('data.0.last_name'); + } + + public function test_a_wrong_last_name_finds_nothing(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $listShortId = $this->createKioskList($eventId); + + $this->lookup($listShortId, 'ada@example.test', 'Byron')->assertOk()->assertJsonCount(0, 'data'); + } + + public function test_only_this_lists_tickets_and_live_attendees_are_found(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $speakerId = $this->createTicketProduct($eventId, 'Speaker'); + $generalId = $this->createTicketProduct($eventId, 'General'); + $speaker = $this->createBadgeAttendee($eventId, $speakerId, 'Ada', 'Lovelace'); + $this->createBadgeAttendee($eventId, $generalId, 'Ada', 'Lovelace'); + $this->createBadgeAttendee($eventId, $speakerId, 'Ada', 'Lovelace', 'CANCELLED'); + $otherEventId = $this->createBadgeEvent($accountId); + $this->createBadgeAttendee($otherEventId, $this->createTicketProduct($otherEventId), 'Ada', 'Lovelace'); + $listShortId = $this->createKioskList($eventId); + 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'), + ]); + + $this->lookup($listShortId, 'ada@example.test', 'Lovelace') + ->assertOk() + ->assertJsonCount(1, 'data') + ->assertJsonPath('data.0.public_id', $speaker['public_id']); + } + + public function test_lookup_is_refused_on_staffed_lists_and_when_switched_off(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $this->createBadgeAttendee($eventId, $this->createTicketProduct($eventId), 'Ada', 'Lovelace'); + $staffedList = $this->createKioskList($eventId, kiosk: false); + $lookupOffList = $this->createKioskList($eventId, lookupEnabled: false); + + $this->lookup($staffedList, 'ada@example.test', 'Lovelace')->assertNotFound(); + $this->lookup($lookupOffList, 'ada@example.test', 'Lovelace')->assertNotFound(); + $this->getJson("/public/check-in-lists/$lookupOffList")->assertOk()->assertJsonPath('data.kiosk_lookup_enabled', false); + $this->getJson("/public/check-in-lists/$staffedList")->assertOk()->assertJsonPath('data.kiosk_lookup_enabled', false); + } + + public function test_expired_kiosk_lists_refuse_lookups(): void + { + [, $accountId] = $this->createAccountOwner(); + $eventId = $this->createBadgeEvent($accountId); + $listShortId = $this->createKioskList($eventId); + DB::table('check_in_lists')->where('short_id', $listShortId)->update(['expires_at' => now()->subDay()]); + + $this->lookup($listShortId, 'ada@example.test', 'Lovelace')->assertForbidden(); + } + + public function test_an_email_and_last_name_are_required(): void + { + [, $accountId] = $this->createAccountOwner(); + $listShortId = $this->createKioskList($this->createBadgeEvent($accountId)); + + $this->postJson("/public/check-in-lists/$listShortId/kiosk/ticket-lookup", ['email' => 'not-an-email']) + ->assertUnprocessable() + ->assertJsonValidationErrors(['email', 'last_name']); + } + + public function test_lookups_are_rate_limited_separately_from_scanning(): void + { + [, $accountId] = $this->createAccountOwner(); + $listShortId = $this->createKioskList($this->createBadgeEvent($accountId)); + $statuses = []; + + for ($attempt = 0; $attempt < 31; $attempt++) { + $statuses[] = $this->lookup($listShortId, "guess$attempt@example.test", 'Lovelace')->status(); + } + + $this->assertNotContains(429, array_slice($statuses, 0, 30)); + $this->assertSame(429, $statuses[30]); + $this->assertNotSame(429, $this->getJson("/public/check-in-lists/$listShortId")->status()); + } + + public function test_the_lookup_setting_is_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' => 'Kiosk', + 'kiosk_mode' => true, + ], $headers) + ->assertOk() + ->assertJsonPath('data.kiosk_lookup_enabled', true) + ->json('data.id'); + + $this->putJson("/events/$eventId/check-in-lists/$listId", [ + 'name' => 'Kiosk', + 'kiosk_mode' => true, + 'kiosk_lookup_enabled' => false, + ], $headers) + ->assertOk() + ->assertJsonPath('data.kiosk_lookup_enabled', false); + + $this->putJson("/events/$eventId/check-in-lists/$listId", ['name' => 'Kiosk'], $headers) + ->assertOk() + ->assertJsonPath('data.kiosk_lookup_enabled', false); + } + + private function lookup(string $listShortId, string $email, string $lastName): TestResponse + { + return $this->postJson("/public/check-in-lists/$listShortId/kiosk/ticket-lookup", [ + 'email' => $email, + 'last_name' => $lastName, + ]); + } + + private function createKioskList(int $eventId, bool $kiosk = true, bool $lookupEnabled = true): string + { + $shortId = 'cil_'.uniqid(); + DB::table('check_in_lists')->insert([ + 'short_id' => $shortId, + 'name' => 'Kiosk', + 'event_id' => $eventId, + 'kiosk_mode' => $kiosk, + 'kiosk_lookup_enabled' => $lookupEnabled, + 'created_at' => now(), + 'updated_at' => now(), + ]); + + return $shortId; + } +} diff --git a/backend/tests/Feature/Http/Actions/TicketTransfer/TicketTransferTest.php b/backend/tests/Feature/Http/Actions/TicketTransfer/TicketTransferTest.php index fb4f8ca146..ff90f151b5 100644 --- a/backend/tests/Feature/Http/Actions/TicketTransfer/TicketTransferTest.php +++ b/backend/tests/Feature/Http/Actions/TicketTransfer/TicketTransferTest.php @@ -270,6 +270,18 @@ public function test_accepting_gives_the_recipient_the_only_working_ticket(): vo $this->accept('tt_accept')->assertStatus(ResponseCodes::HTTP_CONFLICT); } + public function test_accepting_flags_a_printed_badge_for_reprint_because_its_qr_code_stops_working(): void + { + DB::table('attendees')->where('id', $this->attendee['id'])->update(['badge_printed_at' => now(), 'badge_print_count' => 1]); + $this->insertTransfer('tt_badge'); + + $this->accept('tt_badge')->assertOk(); + + $current = DB::table('attendees')->where('id', $this->attendee['id'])->first(); + $this->assertNull($current->badge_printed_at); + $this->assertSame(1, $current->badge_print_count); + } + public function test_accepting_emails_the_new_holder_the_sender_and_the_buyer_and_tells_integrations(): void { $this->insertTransfer('tt_mails', senderEmail: self::GUEST_EMAIL); diff --git a/backend/tests/Feature/Http/CheckInRateLimitTest.php b/backend/tests/Feature/Http/CheckInRateLimitTest.php new file mode 100644 index 0000000000..62f10df1d7 --- /dev/null +++ b/backend/tests/Feature/Http/CheckInRateLimitTest.php @@ -0,0 +1,53 @@ + 180]); + } + + public function test_a_busy_door_behind_one_venue_ip_is_not_held_to_the_shared_api_allowance(): void + { + $statuses = []; + + for ($scan = 0; $scan < 50; $scan++) { + $statuses[] = $this->postJson(self::CHECK_IN_LIST.'/check-ins')->status(); + $statuses[] = $this->getJson(self::CHECK_IN_LIST)->status(); + $statuses[] = $this->getJson(self::CHECK_IN_LIST."/attendees/A-SCAN{$scan}/badge")->status(); + $statuses[] = $this->postJson(self::CHECK_IN_LIST."/attendees/A-SCAN{$scan}/badge/printed")->status(); + } + + $this->assertNotContains(429, $statuses); + } + + public function test_check_in_traffic_does_not_use_up_the_shared_allowance(): void + { + for ($attempt = 0; $attempt < 200; $attempt++) { + $this->getJson(self::CHECK_IN_LIST.'/stats'); + } + + $this->assertNotSame(429, $this->getJson('/public/events/1')->status()); + } + + public function test_check_in_traffic_still_has_its_own_cap(): void + { + for ($attempt = 0; $attempt < 1200; $attempt++) { + $this->getJson(self::CHECK_IN_LIST.'/stats'); + } + + $this->assertSame(429, $this->getJson(self::CHECK_IN_LIST)->status()); + } +} 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 1f41634b71..f8f3a781d1 100644 --- a/backend/tests/Unit/Services/Application/Handlers/Attendee/EditAttendeeHandlerTest.php +++ b/backend/tests/Unit/Services/Application/Handlers/Attendee/EditAttendeeHandlerTest.php @@ -16,6 +16,7 @@ use HiEvents\Services\Application\Handlers\Attendee\DTO\EditAttendeeDTO; use HiEvents\Services\Application\Handlers\Attendee\EditAttendeeHandler; use HiEvents\Services\Domain\Attendee\OrganizerAttendeeIdentityChangeService; +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; @@ -61,6 +62,8 @@ class EditAttendeeHandlerTest extends TestCase private TransactionLockService|MockInterface $transactionLockService; + private MockInterface|BadgeReprintService $badgeReprintService; + protected function setUp(): void { parent::setUp(); @@ -86,6 +89,9 @@ protected function setUp(): void $this->transactionLockService = Mockery::mock(TransactionLockService::class); $this->transactionLockService->shouldReceive('lockEvent')->with(self::EVENT_ID)->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, @@ -97,6 +103,7 @@ protected function setUp(): void $this->identityChangeService(), $this->resaleClosureService, $this->transactionLockService, + $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 9445e85ebe..18606ef917 100644 --- a/backend/tests/Unit/Services/Application/Handlers/Attendee/PartialEditAttendeeHandlerTest.php +++ b/backend/tests/Unit/Services/Application/Handlers/Attendee/PartialEditAttendeeHandlerTest.php @@ -17,6 +17,7 @@ use HiEvents\Services\Application\Handlers\Attendee\DTO\PartialEditAttendeeDTO; use HiEvents\Services\Application\Handlers\Attendee\PartialEditAttendeeHandler; use HiEvents\Services\Domain\Attendee\OrganizerAttendeeIdentityChangeService; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\EventOccurrence\OccurrencePurchaseEligibilityService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsCancellationService; use HiEvents\Services\Domain\EventStatistics\EventStatisticsReactivationService; @@ -81,6 +82,8 @@ class PartialEditAttendeeHandlerTest extends TestCase private TicketResaleListingRepositoryInterface|MockInterface $resaleListingRepository; + private MockInterface|BadgeReprintService $badgeReprintService; + protected function setUp(): void { parent::setUp(); @@ -115,6 +118,9 @@ protected function setUp(): void $this->resaleListingRepository = Mockery::mock(TicketResaleListingRepositoryInterface::class); $this->resaleListingRepository->shouldReceive('countWhere')->andReturn(0)->byDefault(); + $this->badgeReprintService = Mockery::mock(BadgeReprintService::class); + $this->badgeReprintService->shouldReceive('flagIfBadgeDetailsChanged')->andReturnUsing(fn ($before, $after) => $after)->byDefault(); + $this->handler = new PartialEditAttendeeHandler( $this->attendeeRepository, $this->orderRepository, @@ -132,6 +138,7 @@ protected function setUp(): void $this->identityChangeService(), $this->resaleClosureService, $this->resaleListingRepository, + $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/Application/Handlers/CheckInList/Public/LookupKioskTicketsPublicHandlerTest.php b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/LookupKioskTicketsPublicHandlerTest.php new file mode 100644 index 0000000000..45c9664463 --- /dev/null +++ b/backend/tests/Unit/Services/Application/Handlers/CheckInList/Public/LookupKioskTicketsPublicHandlerTest.php @@ -0,0 +1,104 @@ +checkInListRepository = m::mock(CheckInListRepositoryInterface::class); + $this->checkInListRepository->shouldReceive('loadRelation')->andReturnSelf(); + $this->attendeeRepository = m::mock(AttendeeRepositoryInterface::class); + + $this->handler = new LookupKioskTicketsPublicHandler( + $this->checkInListRepository, + $this->attendeeRepository, + new CheckInListActivityValidator, + ); + } + + public function test_matches_are_scoped_to_the_lists_tickets_and_date(): void + { + $list = (new CheckInListDomainObject) + ->setEventId(7) + ->setEventOccurrenceId(42) + ->setKioskMode(true) + ->setKioskLookupEnabled(true) + ->setProducts(collect([(new ProductDomainObject)->setId(3), (new ProductDomainObject)->setId(5)])); + $this->checkInListRepository->shouldReceive('findFirstWhere')->once()->andReturn($list); + + $this->attendeeRepository + ->shouldReceive('findKioskTicketMatches') + ->once() + ->with(7, 'ada@example.test', 'Lovelace', [3, 5], 42) + ->andReturn(collect()); + + $this->assertCount(0, $this->handler->handle($this->dto())); + } + + public function test_staffed_lists_do_not_offer_a_lookup(): void + { + $this->checkInListRepository->shouldReceive('findFirstWhere')->once()->andReturn( + (new CheckInListDomainObject)->setEventId(7)->setKioskMode(false)->setKioskLookupEnabled(true), + ); + $this->attendeeRepository->shouldNotReceive('findKioskTicketMatches'); + + $this->expectException(ResourceNotFoundException::class); + $this->handler->handle($this->dto()); + } + + public function test_kiosks_with_the_lookup_switched_off_do_not_offer_it(): void + { + $this->checkInListRepository->shouldReceive('findFirstWhere')->once()->andReturn( + (new CheckInListDomainObject)->setEventId(7)->setKioskMode(true)->setKioskLookupEnabled(false), + ); + $this->attendeeRepository->shouldNotReceive('findKioskTicketMatches'); + + $this->expectException(ResourceNotFoundException::class); + $this->handler->handle($this->dto()); + } + + public function test_expired_kiosks_refuse_lookups(): void + { + $this->checkInListRepository->shouldReceive('findFirstWhere')->once()->andReturn( + (new CheckInListDomainObject) + ->setEventId(7) + ->setKioskMode(true) + ->setKioskLookupEnabled(true) + ->setExpiresAt(now()->subDay()->toDateTimeString()), + ); + $this->attendeeRepository->shouldNotReceive('findKioskTicketMatches'); + + $this->expectException(CannotCheckInException::class); + $this->handler->handle($this->dto()); + } + + private function dto(): LookupKioskTicketsPublicDTO + { + return new LookupKioskTicketsPublicDTO( + checkInListShortId: 'cil_kiosk', + email: 'ada@example.test', + lastName: 'Lovelace', + ); + } +} 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..17362966aa --- /dev/null +++ b/backend/tests/Unit/Services/Domain/Badge/BadgeReprintServiceTest.php @@ -0,0 +1,166 @@ +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_a_printed_badge_whose_qr_value_was_replaced_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('Ada')->setPublicId('A-NEW'), + ); + + $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') + ->setPublicId('A-ADA') + ->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 525cc95a99..6dee668a59 100644 --- a/backend/tests/Unit/Services/Domain/SelfService/SelfServiceEditAttendeeServiceTest.php +++ b/backend/tests/Unit/Services/Domain/SelfService/SelfServiceEditAttendeeServiceTest.php @@ -8,6 +8,7 @@ use HiEvents\Services\Domain\Attendee\AttendeeCredentialRotationService; use HiEvents\Services\Domain\Attendee\AttendeeDetailsChangeNotificationService; use HiEvents\Services\Domain\Attendee\DTO\AttendeeCredentialsDTO; +use HiEvents\Services\Domain\Badge\BadgeReprintService; use HiEvents\Services\Domain\SelfService\OrderAuditLogService; use HiEvents\Services\Domain\SelfService\SelfServiceEditAttendeeService; use HiEvents\Services\Domain\TicketTransfer\TicketTransferInitiationService; @@ -40,6 +41,8 @@ class SelfServiceEditAttendeeServiceTest extends TestCase private MockInterface|TicketResaleListingRepositoryInterface $listingRepository; + private MockInterface|BadgeReprintService $badgeReprintService; + protected function setUp(): void { parent::setUp(); @@ -53,6 +56,8 @@ protected function setUp(): void $this->transferInitiationService->shouldNotReceive('cancelForHolderChange')->byDefault(); $this->listingRepository = Mockery::mock(TicketResaleListingRepositoryInterface::class); $this->listingRepository->shouldReceive('countWhere')->andReturn(0)->byDefault(); + $this->badgeReprintService = Mockery::mock(BadgeReprintService::class); + $this->badgeReprintService->shouldReceive('flagForReprint')->byDefault(); $this->service = new SelfServiceEditAttendeeService( $this->attendeeRepository, @@ -62,6 +67,7 @@ protected function setUp(): void $this->domainEventDispatcherService, $this->transferInitiationService, $this->listingRepository, + $this->badgeReprintService, ); } @@ -69,6 +75,7 @@ public function test_a_name_edit_keeps_the_ticket_credentials_and_tells_integrat { $attendee = $this->attendee(); + $this->badgeReprintService->shouldReceive('flagForReprint')->once()->with([self::ATTENDEE_ID]); $this->credentialRotationService->shouldNotReceive('issueFor'); $this->attendeeRepository->shouldReceive('updateWhere')->once() ->with(['first_name' => 'Jane', 'last_name' => 'Smith'], ['id' => self::ATTENDEE_ID]); @@ -102,6 +109,7 @@ public function test_an_email_change_replaces_the_ticket_link_and_the_qr_value() $attendee = $this->attendee(); $this->transferInitiationService->shouldReceive('cancelForHolderChange')->once()->with(self::ATTENDEE_ID); + $this->badgeReprintService->shouldReceive('flagForReprint')->once()->with([self::ATTENDEE_ID]); $this->credentialRotationService->shouldReceive('issueFor')->once()->with(self::EVENT_ID) ->andReturn(new AttendeeCredentialsDTO(short_id: 'a_new', public_id: 'A-NEW')); @@ -139,6 +147,7 @@ public function test_nothing_happens_when_no_field_changes(): void $this->changeNotificationService->shouldNotReceive('notify'); $this->orderAuditLogService->shouldNotReceive('logAttendeeUpdate'); $this->domainEventDispatcherService->shouldNotReceive('dispatch'); + $this->badgeReprintService->shouldNotReceive('flagForReprint'); $result = $this->service->editAttendee($this->attendee(), 'John', 'Doe', 'old@example.com', '192.168.1.1', 'Mozilla/5.0'); diff --git a/e2e/api/api-client.ts b/e2e/api/api-client.ts index 4d2ab2aff5..1679494694 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, @@ -288,6 +290,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`, { @@ -556,6 +562,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 5c13c1b8b1..7a4979c201 100644 --- a/e2e/api/types.ts +++ b/e2e/api/types.ts @@ -172,6 +172,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 { @@ -183,6 +185,34 @@ export interface CheckInList { id: number; short_id: string; name: string; + badge_printing_enabled?: boolean; + kiosk_mode?: boolean; + kiosk_lookup_enabled?: 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 { @@ -254,6 +284,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; @@ -323,6 +354,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..d500b0b1e0 --- /dev/null +++ b/e2e/pages/badges.page.ts @@ -0,0 +1,166 @@ +import type { BrowserContext, Locator, Page } from '@playwright/test'; + +export interface BadgePrintContext { + path: string; + trigger: string | null; + scale: number; + ink: string | null; +} + +declare global { + interface Window { + __badgePrintCalls?: number; + __badgePrintedPageSides?: string[][]; + __badgePrintContexts?: BadgePrintContext[]; + } +} + +export async function stubBrowserPrinting(context: BrowserContext): Promise { + await context.addInitScript(() => { + window.__badgePrintCalls = 0; + window.__badgePrintedPageSides = []; + window.__badgePrintContexts = []; + 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 ?? '')); + window.__badgePrintContexts?.push({ + path: window.location.pathname, + trigger: window.event?.type ?? null, + scale: Number(document.querySelector('[data-testid="badge-print-sheets"]')?.getAttribute('data-print-scale') ?? 1), + ink: document.querySelector('[data-badge-print-root] [data-testid="badge"]')?.getAttribute('data-ink') ?? null, + }); + 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 const lastPrintContext = (page: Page): Promise => page.evaluate( + () => window.__badgePrintContexts?.at(-1) ?? null, +); + +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..5119acdd4d 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,37 @@ 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'); + } + + async toggleKioskLookup(dialog: Locator): Promise { + await this.openRowAndToggle(dialog, 'kiosk', 'check-in-list-kiosk-lookup-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..7f64fa56dc 100644 --- a/e2e/pages/check-in.page.ts +++ b/e2e/pages/check-in.page.ts @@ -43,4 +43,68 @@ 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 enableBlackInkOnly(): Promise { + await this.page.getByTestId('check-in-badge-printer-button').click(); + await this.page.getByTestId('check-in-black-ink-switch').click({ force: true }); + await this.page.getByRole('button', { name: 'Done' }).click(); + } + + async openPrinterSettings(): Promise { + await this.page.getByTestId('check-in-badge-printer-button').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'); + } + + kioskStaffControls(): Locator { + return this.page.getByTestId('kiosk-staff-controls'); + } + + async holdKioskListName(): Promise { + const box = await this.page.getByTestId('kiosk-staff-controls-trigger').boundingBox(); + if (!box) { + throw new Error('Kiosk list name is not visible'); + } + await this.page.mouse.move(box.x + box.width / 2, box.y + box.height / 2); + await this.page.mouse.down(); + await this.page.waitForTimeout(1_000); + await this.page.mouse.up(); + } } 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..46805be50c --- /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..77a06c8eb1 --- /dev/null +++ b/e2e/tests/badges/check-in-badges.spec.ts @@ -0,0 +1,257 @@ +import { devices, type APIRequestContext } from '@playwright/test'; +import { test, expect } from '../../fixtures'; +import { CheckInPage } from '../../pages/check-in.page'; +import { lastPrintContext, 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); + expect((await lastPrintContext(page))?.path).toBe('/'); + + 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('the setup guide gives this computer the Chrome command for silent printing', async ({ page, api, publicApi, account }) => { + const { list } = await seedBadgeList(api, publicApi, account.organizerId); + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await checkIn.openPrinterSettings(); + const pageUrl = `${new URL(page.url()).origin}/check-in/${list.short_id}`; + + const command = page.getByTestId('device-setup-command'); + await page.getByTestId('device-setup-platform').getByText('Mac', { exact: true }).click(); + await expect(command).toHaveText(`open -a "Google Chrome" --args --kiosk-printing '${pageUrl}'`); + + await page.getByTestId('device-setup-platform').getByText('Windows', { exact: true }).click(); + await expect(command).toHaveText(`chrome --kiosk-printing "${pageUrl}"`); + }); + + test('a black-only label printer prints every colour as solid black', async ({ page, api, publicApi, account }) => { + await stubBrowserPrinting(page.context()); + const { order, list } = await seedBadgeList(api, publicApi, account.organizerId); + + 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 lastPrintContext(page))?.ink).toBeNull(); + await page.keyboard.press('Escape'); + + await checkIn.enableBlackInkOnly(); + await checkIn.openAttendee(order.attendees[0].publicId); + await checkIn.printBadgeButton().click(); + await expect.poll(() => printCalls(page)).toBe(2); + expect((await lastPrintContext(page))?.ink).toBe('black'); + }); + + 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 expect(page.getByTestId('kiosk-setup-button')).toHaveCount(0); + + await checkIn.holdKioskListName(); + await expect(checkIn.kioskStaffControls()).toBeVisible(); + await page.getByTestId('kiosk-setup-button').click(); + await expect(page.getByTestId('device-setup-command')).toContainText('--kiosk-printing --kiosk'); + await expect(page.getByTestId('device-setup-command')).toContainText(`/check-in/${list.short_id}`); + await page.getByRole('button', { name: 'Done' }).click(); + + 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.'); + expect((await lastPrintContext(page))?.scale).toBe(1); + + 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); + }); +}); + +test.describe('badge printing at check-in on an iPad', () => { + const iPad = devices['iPad Pro 11']; + test.use({ userAgent: iPad.userAgent, viewport: iPad.viewport, hasTouch: true }); + + test('staff print from a tap because the iPad blocks automatic printing', 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.openPrinterSettings(); + await expect(page.getByText('Each badge then takes two taps', { exact: false })).toBeVisible(); + await expect(page.getByTestId('check-in-auto-print-switch')).toHaveCount(0); + await page.getByRole('button', { name: 'Done' }).click(); + + await checkIn.openSearchTab(); + await checkIn.search(order.buyerLastName); + await checkIn.openAttendee(attendee.publicId); + await checkIn.printBadgeButton().click(); + + await expect(checkIn.badgePrintNote()).toHaveText('Badge printed once'); + expect(await printCalls(page)).toBe(1); + expect(await lastPrintContext(page)).toMatchObject({ path: '/', trigger: 'click' }); + + const attendees = await api.listAttendees(event.eventId); + expect(attendees.find((record) => record.public_id === attendee.publicId)?.badge_print_count).toBe(1); + }); + + test('kiosk attendees tap to print their badge', async ({ page, api, publicApi, account }) => { + await stubBrowserPrinting(page.context()); + const { event, order, list } = await seedBadgeList(api, publicApi, account.organizerId, { kiosk: true }); + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await expect(page.getByTestId('kiosk-scan-mode-button')).toHaveCount(0); + await checkIn.holdKioskListName(); + await expect(page.getByTestId('kiosk-scan-mode-button')).toHaveText('Use a USB scanner'); + await page.getByTestId('kiosk-scan-mode-button').click(); + await checkIn.scanWithUsbScanner(order.attendees[0].publicId); + + await expect(page.getByTestId('kiosk-result-success')).toContainText('Welcome, Casey!'); + await expect(page.getByTestId('kiosk-print-status')).toHaveText('Tap Print my badge, then Print.'); + expect(await printCalls(page)).toBe(0); + + await page.getByTestId('kiosk-print-badge-button').click(); + + await expect(page.getByTestId('kiosk-print-status')).toHaveText('Your badge is ready. Collect it from the printer.'); + expect(await printCalls(page)).toBe(1); + const printed = await lastPrintContext(page); + expect(printed).toMatchObject({ path: '/', trigger: 'click' }); + expect(printed?.scale).toBeGreaterThan(0.4); + expect(printed?.scale).toBeLessThan(1); + + await page.getByTestId('kiosk-print-again-button').click(); + expect(await printCalls(page)).toBe(2); + expect(await lastPrintContext(page)).toMatchObject({ path: '/', trigger: 'click' }); + await expect.poll(async () => (await api.getBadgeStats(event.eventId)).printed).toBe(1); + }); +}); diff --git a/e2e/tests/check-in/kiosk-ticket-lookup.spec.ts b/e2e/tests/check-in/kiosk-ticket-lookup.spec.ts new file mode 100644 index 0000000000..61a0745d2b --- /dev/null +++ b/e2e/tests/check-in/kiosk-ticket-lookup.spec.ts @@ -0,0 +1,74 @@ +import type { APIRequestContext, Page } from '@playwright/test'; +import { test, expect } from '../../fixtures'; +import { CheckInPage } from '../../pages/check-in.page'; +import { createCompletedOrder, createLiveEventWithFreeTicket } from '../../api/factory'; +import type { ApiClient } from '../../api/api-client'; +import { uniqueName, uniqueShort } from '../../utils/unique'; + +async function seedKiosk( + api: ApiClient, + publicApi: APIRequestContext, + organizerId: number, + options: { tickets?: number; lookupEnabled?: boolean } = {}, +) { + const event = await createLiveEventWithFreeTicket(api, organizerId); + const order = await createCompletedOrder(publicApi, event, { + quantity: options.tickets ?? 1, + buyerFirstName: 'Casey', + buyerLastName: uniqueShort('Lee').replace(' ', ''), + }); + const list = await api.createCheckInList(event.eventId, { + name: uniqueName('Self check-in'), + kiosk_mode: true, + kiosk_lookup_enabled: options.lookupEnabled ?? true, + }); + return { order, list }; +} + +async function findTicket(page: Page, email: string, lastName: string): Promise { + await page.getByLabel('Email address').fill(email); + await page.getByLabel('Last name').fill(lastName); + await page.getByTestId('kiosk-lookup-submit').click(); +} + +test.describe('kiosk ticket lookup', () => { + test('an attendee without their QR code checks in with their email and last name', async ({ page, api, publicApi, account }) => { + const { order, list } = await seedKiosk(api, publicApi, account.organizerId); + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await page.getByTestId('kiosk-find-ticket-button').click(); + + await findTicket(page, order.buyerEmail, 'Nobody'); + await expect(page.getByText("We couldn't find a ticket with those details.", { exact: false })).toBeVisible(); + + await findTicket(page, order.buyerEmail.toUpperCase(), order.buyerLastName.toLowerCase()); + + await expect(page.getByTestId('kiosk-result-success')).toContainText('Welcome, Casey!'); + }); + + test('an attendee with several tickets chooses theirs', async ({ page, api, publicApi, account }) => { + const { order, list } = await seedKiosk(api, publicApi, account.organizerId, { tickets: 2 }); + + const checkIn = new CheckInPage(page); + await checkIn.goto(list.short_id); + await page.getByTestId('kiosk-find-ticket-button').click(); + await findTicket(page, order.buyerEmail, order.buyerLastName); + + await expect(page.getByText('Which ticket is yours?')).toBeVisible(); + await expect(page.getByTestId('kiosk-lookup-match')).toHaveCount(2); + await page.getByTestId('kiosk-lookup-match').first().click(); + + await expect(page.getByTestId('kiosk-result-success')).toContainText('Welcome, Casey!'); + }); + + test('kiosks with the lookup switched off only take QR codes', async ({ page, api, publicApi, account }) => { + const { list } = await seedKiosk(api, publicApi, account.organizerId, { lookupEnabled: false }); + + 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.getByTestId('kiosk-find-ticket-button')).toHaveCount(0); + }); +}); diff --git a/e2e/tests/management/check-in-lists.spec.ts b/e2e/tests/management/check-in-lists.spec.ts index d7168395b3..d72c8c07e1 100644 --- a/e2e/tests/management/check-in-lists.spec.ts +++ b/e2e/tests/management/check-in-lists.spec.ts @@ -16,4 +16,46 @@ 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); + }); + + test('an organizer turns off the kiosk ticket lookup', async ({ authedPage, api, account }) => { + const event = await createDraftEventWithTicket(api, account.organizerId); + const name = uniqueShort('Self check-in'); + + const checkInLists = new CheckInListPage(authedPage); + await checkInLists.goto(event.eventId); + await checkInLists.createList(name, { kiosk: true }); + + await checkInLists.openRowAction(name, 'Edit Check-In List'); + const dialog = authedPage.getByRole('dialog'); + await checkInLists.toggleKioskLookup(dialog); + await checkInLists.submitEdit(); + + await checkInLists.openRowAction(name, 'Edit Check-In List'); + await dialog.getByTestId('check-in-list-ledger-kiosk').click(); + await expect(dialog.getByTestId('check-in-list-kiosk-switch')).toBeChecked(); + await expect(dialog.getByTestId('check-in-list-kiosk-lookup-switch')).not.toBeChecked(); + }); }); 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..4d17ceb4b0 100644 --- a/frontend/src/api/check-in.client.ts +++ b/frontend/src/api/check-in.client.ts @@ -2,11 +2,14 @@ import {publicApi} from "./public-client"; import { Attendee, AttendeeDetailPublic, + Badge, CheckInList, CheckInListStats, GenericDataResponse, GenericPaginatedResponse, - IdParam, PublicCheckIn, + IdParam, + KioskTicket, + PublicCheckIn, QueryFilters, } from "../types"; import {queryParamsHelper} from "../utilites/queryParamsHelper"; @@ -44,6 +47,18 @@ 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; + }, + findKioskTickets: async (checkInListShortId: IdParam, details: { email: string; last_name: string }) => { + const response = await publicApi.post>(`/check-in-lists/${checkInListShortId}/kiosk/ticket-lookup`, details); + 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/index.tsx b/frontend/src/components/common/AttendeeTable/index.tsx index f5652cdfe3..3f62a6eef2 100644 --- a/frontend/src/components/common/AttendeeTable/index.tsx +++ b/frontend/src/components/common/AttendeeTable/index.tsx @@ -7,6 +7,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 {showSuccess} from "../../../utilites/notifications.tsx"; @@ -97,6 +98,9 @@ export const AttendeeTable = ({attendees, openCreateModal, compact, embedded, is orderModal.open(); }; + const badgesEnabled = useEventFeature(eventId, 'BADGES'); + const hasPrintedBadges = badgesEnabled && attendees.some((attendee) => (attendee.badge_print_count ?? 0) > 0); + const openAttendee = (attendee: Attendee) => handleModalClick(attendee, viewModalOpen); const hasSeats = attendees.some(attendee => attendee.seat_label); const hasOccurrences = event?.type === EventType.RECURRING && attendees.some(attendee => attendee.event_occurrence); @@ -323,6 +327,20 @@ export const AttendeeTable = ({attendees, openCreateModal, compact, embedded, is ) : , }, + hasPrintedBadges && { + id: 'badge', + header: t`Badge`, + cell: ({row: {original: attendee}}: CellContext) => { + 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`}; + }, + }, { id: 'actions', header: () => {t`Actions`}, @@ -340,7 +358,7 @@ export const AttendeeTable = ({attendees, openCreateModal, compact, embedded, is return allColumns.filter(Boolean) as TanStackTableColumn[]; }, - [emailPopoverId, event, hasCheckInLists, relevantCheckInLists, occurrenceId, hasSeats, hasOccurrences, compact, sort?.sortBy, sort?.sortDirection] + [emailPopoverId, event, hasCheckInLists, relevantCheckInLists, occurrenceId, hasSeats, hasOccurrences, hasPrintedBadges, compact, sort?.sortBy, sort?.sortDirection] ); if (attendees.length === 0) { diff --git a/frontend/src/components/common/CheckInListTable/index.tsx b/frontend/src/components/common/CheckInListTable/index.tsx index ae75cc4a39..74ed4baed5 100644 --- a/frontend/src/components/common/CheckInListTable/index.tsx +++ b/frontend/src/components/common/CheckInListTable/index.tsx @@ -5,6 +5,7 @@ import {IconCopy, IconPencil, IconPlus, IconQrcode, IconTrash} from "@tabler/ico 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"; @@ -39,6 +40,7 @@ export const CheckInListTable = ({checkInLists, openCreateModal, event, isRefres 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: 62em)'); @@ -81,7 +83,13 @@ export const CheckInListTable = ({checkInLists, openCreateModal, event, isRefres {list.name} )} - trailing={list.is_system_default && {t`Default`}} + trailing={( + <> + {list.is_system_default && {t`Default`}} + {badgesEnabled && list.badge_printing_enabled && {t`Prints badges`}} + {list.kiosk_mode && {t`Kiosk`}} + + )} /> ), }, @@ -224,7 +232,7 @@ export const CheckInListTable = ({checkInLists, openCreateModal, event, isRefres return true; }); }, - [eventId, isRecurring, event?.timezone, isMobile] + [eventId, isRecurring, event?.timezone, isMobile, badgesEnabled] ); if (checkInLists.length === 0) { 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 57551429aa..4f097d10e6 100644 --- a/frontend/src/components/forms/ProductForm/LedgerRow.tsx +++ b/frontend/src/components/common/Ledger/index.tsx @@ -2,42 +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' - | 'after-purchase'; +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 ( -
+