Compare commits

...
Author SHA1 Message Date
ngqile 86fa02cd7b Merge pull request 'docs: blueprint marks event ticketing done' (#91) from docs-blueprint-tickets-done into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 10:32:34 +00:00
ngqileandClaude Opus 5.5 341191b42a docs: blueprint marks event ticketing done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 18:32:27 +08:00
ngqile 08b152fb66 Merge pull request 'docs(openspec): archive add-event-tickets' (#90) from archive-add-event-tickets into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 10:32:01 +00:00
ngqileandClaude Opus 5.5 e1902074ba docs(openspec): archive add-event-tickets and sync its specs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 18:31:53 +08:00
ngqile 96ab8e6f5b Merge pull request 'feat(tickets): ticket QR codes, attendee naming and consent, door and venue check-in (add-event-tickets)' (#89) from add-event-tickets into main
CI / build-and-publish (push) Failing after 1s
2026-12-04 10:31:31 +00:00
ngqileandClaude Opus 5.5 7866427b2e docs(tickets): release note for ticket QR codes and check-in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 18:31:05 +08:00
ngqileandClaude Opus 5.5 5831d7e15b feat(tickets): order detail shows each ticket's attendee and check-in; no resend once checked in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 18:30:35 +08:00
ngqileandClaude Opus 5.5 5c2cb605b9 fix(leads): label ticket leads; event leads list no longer crashes on source TICKET
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 18:30:35 +08:00
ngqileandClaude Opus 5.5 02aa19a686 fix(tickets): staff scans skip the public ticket limit; order lookups for naming are rate-limited
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:56:55 +08:00
ngqileandClaude Opus 5.5 051fca9a13 feat(tickets): order page tickets and naming, resend ticket, ticket counts and show-your-ticket check-in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:46:18 +08:00
ngqileandClaude Opus 5.5 2b8b3d92bc feat(tickets): ticket page /t/<code> with public and staff views, proxies and labels
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:38:07 +08:00
ngqileandClaude Opus 5.5 031ec8449e feat(tickets): staff ticket view, door check-in, resend ticket and ticketed venue check-in results
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:25:40 +08:00
ngqileandClaude Opus 5.5 8f3818414d feat(tickets): public ticket page API, QR PNG, attendee naming and consent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:19:56 +08:00
ngqileandClaude Opus 5.5 6215eb5d8c feat(tickets): door check-in, self check-in on ticketed events, no walk-ins and ticket counts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:13:58 +08:00
ngqileandClaude Opus 5.5 cc81dc0fa5 feat(tickets): attendee naming, attendee consent, ticket emails and resend ticket
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:05:24 +08:00
ngqileandClaude Opus 5.5 1d6b265fd2 feat(tickets): ticket codes on payment, ticket state and lookup by code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 17:00:21 +08:00
ngqileandClaude Opus 5.5 d56d0c3450 feat(tickets): attendee columns and codes for paid tickets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:56:47 +08:00
ngqileandClaude Opus 5.5 a64ba1ad63 docs(openspec): propose add-event-tickets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:55:19 +08:00
ngqile da5b76069c Merge pull request 'fix(portal): Co-Lite tab icon instead of babyboo's' (#88) from fix-tab-icon into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 08:47:33 +00:00
ngqileandClaude Opus 5.5 09dab5a40b fix(portal): Co-Lite tab icon instead of babyboo's
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:47:24 +08:00
ngqile 7c1b986289 Merge pull request 'docs: add Co-Lite blueprint page' (#87) from docs-co-lite-blueprint into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 08:40:50 +00:00
ngqileandClaude Opus 5.5 17126c92e3 docs: add Co-Lite blueprint page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:40:42 +08:00
ngqile 43b01c84bf Merge pull request 'chore(openspec): archive add-event-ticket-orders' (#86) from archive-add-event-ticket-orders into main
CI / build-and-publish (push) Failing after 1s
2026-12-04 08:40:11 +00:00
ngqileandClaude Opus 5.5 58d764a175 chore(openspec): archive add-event-ticket-orders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:40:02 +08:00
ngqile 2d95dc203c Merge pull request 'feat(tickets): event ticket orders (add-event-ticket-orders)' (#85) from add-event-ticket-orders into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 08:39:28 +00:00
ngqileandClaude Opus 5.5 86f5fd73cb docs(tickets): release note for event ticket orders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:39:11 +08:00
ngqileandClaude Opus 5.5 e850b09cb6 feat(tickets): TICKETS page block, editor picker and public order page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:26:11 +08:00
ngqileandClaude Opus 5.5 5a51be1c11 feat(tickets): event Tickets section, orders list and order detail
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 16:08:08 +08:00
ngqileandClaude Opus 5.5 d25641e139 feat(tickets): public ticket request, order page and gateway paths
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 15:53:54 +08:00
ngqileandClaude Opus 5.5 a18ca0db71 feat(tickets): admin ticket settings, types and order endpoints
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 15:48:29 +08:00
ngqileandClaude Opus 5.5 763a295234 feat(tickets): TICKETS page block validation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 15:42:08 +08:00
ngqileandClaude Opus 5.5 687f054acf feat(tickets): staff order actions, order emails and hold expiry job
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 15:39:28 +08:00
ngqileandClaude Opus 5.5 6dca31510e feat(tickets): ticket order request with seat locking, capacity and buyer lead
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 15:31:05 +08:00
ngqileandClaude Opus 5.5 b8a1873266 feat(tickets): ticket settings, ticket types and order tables
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 15:23:16 +08:00
ngqileandClaude Opus 5.5 896ee3bcc5 docs: propose add-event-ticket-orders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 14:58:59 +08:00
ngqileandClaude Opus 5.5 58dc27dbc4 docs: ticketing design answers attendee consent, walk-ins and invites
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 14:49:24 +08:00
ngqileandClaude Opus 5.5 cf0f9d0b6e docs: event ticketing design (draft)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 14:43:50 +08:00
ngqile 3597adb94c Merge pull request 'fix(pages): end the page at a closing footer, with no blank strip below' (#84) from fix-footer-flush-bottom into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 06:02:08 +00:00
ngqileandClaude Opus 5.5 1d71b9122c fix(pages): end the page at a closing footer, with no blank strip below
The page's main area kept its bottom padding after a footer block,
leaving a light strip under the dark footer. A page whose last block
is a footer now has no bottom padding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 14:02:00 +08:00
ngqile de8ff61fe0 Merge pull request 'docs: archive add-hero-fits-screen' (#83) from archive-hero-fits-screen into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 04:45:20 +00:00
ngqileandClaude Opus 5.5 12296ac203 docs: archive add-hero-fits-screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 12:45:13 +08:00
ngqile 6164263208 Merge pull request 'fix(pages): fit the top bar, hero and trust strip on one desktop screen' (#82) from add-hero-fits-screen into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 04:45:06 +00:00
ngqileandClaude Opus 5.5 405dab55dd fix(pages): fit the top bar, hero and trust strip on one desktop screen
A trust strip band uses less padding, the full-width hero less padding, and the
landing-page form tighter gaps with the consent in small text. Controls keep
their 44 px height. On the INS page at 1920x1080 the trust strip now ends at
937 px instead of 1077 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 12:44:55 +08:00
ngqile b6f5fb441e Merge pull request 'docs: archive add-landing-page-polish' (#81) from archive-landing-page-polish into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 04:28:36 +00:00
ngqileandClaude Opus 5.5 cc2d1c794e docs: archive add-landing-page-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 12:28:28 +08:00
ngqile c21a31e10f Merge pull request 'feat(pages): a top bar section, section labels and serif headings' (#80) from add-landing-page-polish into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 04:28:21 +00:00
ngqileandClaude Opus 5.5 e4ad18a8a3 feat(pages): a top bar section, section labels and serif headings
Landing pages gain a Top bar section (the company logo and an optional button,
kept at the top of the window, first section only), a short label above the
headings of five section types, and serif section headings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 12:28:09 +08:00
ngqile 2a69826e66 Merge pull request 'docs: archive add-landing-thanks-and-footer' (#79) from archive-landing-thanks-and-footer into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 03:45:57 +00:00
ngqileandClaude Opus 5.5 92412cb300 docs: archive add-landing-thanks-and-footer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-04 11:45:49 +08:00
ngqile 35e9b796f7 Merge pull request 'feat(pages): a footer section with contact links, and a thank-you text on landing forms' (#78) from add-landing-thanks-and-footer into main
CI / build-and-publish (push) Failing after 0s
2026-12-04 03:45:38 +00:00
181 changed files with 13368 additions and 96 deletions

No files matched your search

+240
View File
@@ -0,0 +1,240 @@
<title>Co-Lite Blueprint</title>
<meta name="claude:viewport-fit-sides" content="cover">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@500;700&display=swap">
<style>
/* Layout: one reading column on a faint drafting grid; sections read top to bottom as now, next, later. */
:root {
--bg: #f4f7fb; --panel: #ffffff; --fg: #142235; --muted: #5a6b80; --line: #d3dce8;
--grid: rgba(30, 90, 160, .06); --accent: #1d5fa8; --accent-soft: #e3edf9;
--done: #1f7a4d; --done-soft: #e2f3ea; --now: #b26a00; --now-soft: #fbefd9; --owed: #a33b2b; --owed-soft: #f8e4e0;
--f-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
--f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
--f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
--bg: #0d1724; --panel: #13202f; --fg: #e3ebf5; --muted: #93a4b8; --line: #263649;
--grid: rgba(120, 170, 230, .06); --accent: #7fb2ec; --accent-soft: #1a2d44;
--done: #6fcf9b; --done-soft: #15301f; --now: #f0b65a; --now-soft: #33260f; --owed: #f08b7a; --owed-soft: #3a1c17; color-scheme: dark } }
:root[data-theme="dark"] {
--bg: #0d1724; --panel: #13202f; --fg: #e3ebf5; --muted: #93a4b8; --line: #263649;
--grid: rgba(120, 170, 230, .06); --accent: #7fb2ec; --accent-soft: #1a2d44;
--done: #6fcf9b; --done-soft: #15301f; --now: #f0b65a; --now-soft: #33260f; --owed: #f08b7a; --owed-soft: #3a1c17; color-scheme: dark }
* { box-sizing: border-box }
body {
background: var(--bg);
background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
background-size: 24px 24px;
color: var(--fg); font: 15px/1.6 var(--f-body);
padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
padding-block: 40px 64px;
}
.wrap { max-width: 980px; margin: 0 auto; display: grid; gap: 48px }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.2 }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -.01em }
h2 { font-size: 1.45rem }
h3 { font-size: 1.05rem }
p { margin: 0; max-width: 68ch }
.eyebrow { font: 500 .75rem var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent) }
.muted { color: var(--muted) }
section { display: grid; gap: 18px }
.sheet { font: .78rem var(--f-mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 20px; border-top: 1px solid var(--line); padding-top: 10px }
/* header */
header { display: grid; gap: 14px }
.lede { font-size: 1.08rem }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 6px }
.fact { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 12px 14px; min-width: 0 }
.fact b { display: block; font: 600 1.5rem var(--f-display); font-variant-numeric: tabular-nums }
.fact span { font-size: .85rem; color: var(--muted) }
/* status chips */
.chip { display: inline-block; font: 500 .7rem var(--f-mono); letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; white-space: nowrap }
.chip.done { background: var(--done-soft); color: var(--done) }
.chip.now { background: var(--now-soft); color: var(--now) }
.chip.owed { background: var(--owed-soft); color: var(--owed) }
.chip.later { background: var(--accent-soft); color: var(--accent) }
/* architecture */
.arch { display: grid; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px }
.tier { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: center }
.tier > .label { font: 500 .75rem var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em }
.boxes { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0 }
.box { border: 1px solid var(--line); border-radius: 5px; padding: 6px 10px; font-size: .85rem; background: var(--bg) }
.box code { font: .78rem var(--f-mono); color: var(--accent) }
.box.new { border-style: dashed; border-color: var(--now); }
.down { text-align: center; color: var(--muted); font: .8rem var(--f-mono) }
@media (max-width: 560px) { .tier { grid-template-columns: 1fr; gap: 6px } }
/* shipped grid */
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 8px; align-content: start; min-width: 0 }
.group ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: .92rem }
/* owed list */
.owed-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none }
.owed-list li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--owed); border-radius: 6px; padding: 10px 14px }
/* roadmap */
.road { display: grid; gap: 0; position: relative }
.stage { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding-bottom: 22px; position: relative }
.stage::before { content: ""; position: absolute; left: 27px; top: 44px; bottom: 0; width: 2px; background: var(--line) }
.stage:last-child::before { display: none }
.num { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font: 700 1.3rem var(--f-display); background: var(--panel); border: 2px solid var(--line); color: var(--muted); font-variant-numeric: tabular-nums }
.stage.current .num { border-color: var(--now); color: var(--now) }
.stage-body { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 10px; min-width: 0 }
.stage.current .stage-body { border-color: var(--now) }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px }
.stage-body ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: .92rem }
.changes { display: grid; gap: 6px }
.change { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; font-size: .9rem }
.change code { font: .8rem var(--f-mono); color: var(--accent) }
/* tables */
.tbl { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px }
table { border-collapse: collapse; width: 100%; font-size: .9rem; min-width: 560px }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top }
th { font: 500 .72rem var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted) }
tr:last-child td { border-bottom: 0 }
.decisions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px }
.decision { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 4px; min-width: 0 }
.decision .when { font: .72rem var(--f-mono); color: var(--muted) }
</style>
<div class="wrap">
<header>
<span class="eyebrow">Product blueprint · revision 4 December 2026</span>
<h1>Co-Lite Blueprint</h1>
<p class="lede">Co-Lite starts as an event CRM for INS and CV: it captures leads at events and from landing pages, and sales follows them up. It is growing into an event hosting platform with tickets, merch and membership, and will later open to any company as self-serve SaaS. <strong>Leads stay at the centre at every stage.</strong> Free events feed sales, and paid events feed sales too.</p>
<div class="facts">
<div class="fact"><b>40</b><span>changes shipped and archived</span></div>
<div class="fact"><b>27</b><span>capabilities with live specs</span></div>
<div class="fact"><b>2</b><span>companies at go-live (INS, CV)</span></div>
<div class="fact"><b>15 Jan 2027</b><span>go-live deadline</span></div>
</div>
</header>
<section>
<span class="eyebrow">How it fits together</span>
<h2>Platform architecture</h2>
<p class="muted">Spring Boot services cloned from the Solvway platform, with the MLM modules (bonus, stockist, inventory, tree) dropped. A rebuilt Next.js portal serves both staff screens and public visitor pages.</p>
<div class="arch">
<div class="tier"><span class="label">Visitors</span><div class="boxes">
<span class="box">Landing pages <code>/p/</code></span><span class="box">QR sign-up <code>/r/</code></span><span class="box">Invites <code>/i/</code></span><span class="box">Check-in <code>/c/</code></span><span class="box">Orders <code>/o/</code></span><span class="box">Tickets <code>/t/</code></span>
</div></div>
<div class="tier"><span class="label">Staff</span><div class="boxes">
<span class="box">Admin portal (Next.js): events, leads, dashboard, pages, WhatsApp, users, roles, audit</span>
</div></div>
<div class="down">▼ HTTPS</div>
<div class="tier"><span class="label">Edge</span><div class="boxes"><span class="box">api-gateway: JWT, public path list, request log</span><span class="box">mobile-api: <code>/api/admin/**</code> and <code>/api/public/**</code>, rate limits</span></div></div>
<div class="down">▼ internal</div>
<div class="tier"><span class="label">Services</span><div class="boxes">
<span class="box">counter: events, leads, pages, check-in<span class="new"></span></span><span class="box">system: companies, users, roles, labels</span><span class="box">auth</span><span class="box">email</span><span class="box">whatsapp</span><span class="box">log</span><span class="box">member (kept for later)</span>
</div></div>
<div class="tier"><span class="label">Data</span><div class="boxes"><span class="box">MySQL, one schema per service, every new table carries <code>company_id</code></span><span class="box">Redis: sessions, rate limits</span></div></div>
<div class="tier"><span class="label">Runs on</span><div class="boxes"><span class="box">Docker Compose locally</span><span class="box">Kubernetes manifests (kustomize base + prod overlay)</span></div></div>
</div>
</section>
<section>
<span class="eyebrow">Built</span>
<h2>What is shipped <span class="chip done">done</span></h2>
<div class="groups">
<div class="group"><h3>Foundation and operations</h3><ul>
<li>Repository, local stack, seed data</li><li>Release CI and image packaging</li><li>Kubernetes manifests</li><li>Gateway request logging without bodies</li></ul></div>
<div class="group"><h3>Admin, access and security</h3><ul>
<li>Users, roles, permission modules</li><li>Login security, lockout, temporary passwords</li><li>Company scoping: INS and CV see only their own data</li><li>Audit log, email log</li></ul></div>
<div class="group"><h3>Events and leads</h3><ul>
<li>Events with teams, interests</li><li>Staff lead capture, listings, export</li><li>Lead dashboard, follow-up notifications</li><li>QR self-registration with personal codes</li><li>Invitations, capacity and invite cap</li><li>Venue check-in and attendance numbers</li></ul></div>
<div class="group"><h3>Landing pages</h3><ul>
<li>Visual on-page editor, drafts, templates</li><li>Hero, sections, features, steps, trust, FAQ, CTA</li><li>Sign-up forms with UTM tracking</li><li>Custom HTML, image upload, anchors</li><li>Top bar, footer, thank-you text, contact links</li><li>INS hotel-technology page built natively</li></ul></div>
<div class="group"><h3>Ticket orders</h3><ul>
<li>Tickets switch, payment instructions, hold days per event</li><li>Ticket types with price, quantity, sales end</li><li>Tickets page section; seats locked per order</li><li>Order page and order emails; holds expire</li><li>Staff orders: mark paid, cancel order or ticket, resend</li><li>Buyer becomes an event lead</li></ul></div>
<div class="group"><h3>Tickets and check-in</h3><ul>
<li>QR ticket page per seat, public and staff views</li><li>Buyer names attendees; renaming replaces the link</li><li>Attendee consent makes a Ticket lead</li><li>Door check-in by scan; venue self check-in for ticket holders</li><li>Resend ticket; ticket counts on the Guests card</li></ul></div>
<div class="group"><h3>Messaging and language</h3><ul>
<li>WhatsApp inbox</li><li>Simplified Chinese interface</li><li>Message catalogue filter</li></ul></div>
</div>
</section>
<section>
<span class="eyebrow">Before 15 January 2027</span>
<h2>Still owed for go-live <span class="chip owed">open</span></h2>
<ul class="owed-list">
<li><span class="chip owed">deploy</span><span>Kubernetes dry run on the real cluster, then the first apply.</span></li>
<li><span class="chip owed">verify</span><span>WhatsApp end-to-end check once the business account is linked.</span></li>
<li><span class="chip owed">legal</span><span>PDPA owner to confirm the shortened privacy notice on the landing form.</span></li>
<li><span class="chip owed">content</span><span>Rebuild the INS landing page on the real server; it exists only in the local database today.</span></li>
</ul>
</section>
<section>
<span class="eyebrow">Where it is going</span>
<h2>Roadmap</h2>
<p class="muted">Order agreed with the owner on 4 December 2026. Each stage is brainstormed and approved as its own design before it is built.</p>
<div class="road">
<div class="stage current"><div class="num">1</div><div class="stage-body">
<div class="stage-head"><h3>Event ticketing</h3><span class="chip done">done</span></div>
<p>Paid events sell tickets; free events keep today's lead flow. Buyers pay outside Co-Lite for now, by bank transfer or a payment link, and staff mark the order paid.</p>
<div class="changes">
<div class="change"><code>add-event-ticket-orders</code><span class="chip done">done</span><span class="muted">Ticket types, Tickets page block, orders with seat locking, holds that expire, order page and emails, staff order screens, buyer becomes a lead.</span></div>
<div class="change"><code>add-event-tickets</code><span class="chip done">done</span><span class="muted">QR ticket per seat, buyer names attendees later, attendee consent, check-in at the door, invites count as free tickets.</span></div>
</div>
</div></div>
<div class="stage"><div class="num">2</div><div class="stage-body">
<div class="stage-head"><h3>Merch collected at events</h3><span class="chip later">planned</span></div>
<ul><li>Products with variants (size, colour) and a stock count</li><li>Sold alongside tickets in the same order</li><li>Handed over at check-in</li></ul>
</div></div>
<div class="stage"><div class="num">3</div><div class="stage-body">
<div class="stage-head"><h3>Merch shop with manual shipping</h3><span class="chip later">planned</span></div>
<ul><li>Standalone shop, not tied to an event</li><li>Delivery address on the order; staff ship and mark it shipped</li><li>No courier integration at first</li></ul>
</div></div>
<div class="stage"><div class="num">4</div><div class="stage-body">
<div class="stage-head"><h3>Membership</h3><span class="chip later">planned</span></div>
<ul><li>Member accounts: profile, My tickets, events attended. Tickets already held are claimed by mobile or email.</li><li>Member-only events, early access and member prices on tickets and merch</li><li>Points earned at check-in and on paid tickets, spent as discounts; tiers later</li><li>Referrals through invite links, one level only</li><li>Leads from free events invited to join; likely built on the kept customer portal</li></ul>
</div></div>
<div class="stage"><div class="num">5</div><div class="stage-body">
<div class="stage-head"><h3>Self-serve SaaS</h3><span class="chip later">planned</span></div>
<ul><li>Companies sign up themselves on a Free or Premium plan</li><li>No admin needs to create the company by hand</li><li>Built on the company scoping already in place</li></ul>
</div></div>
</div>
</section>
<section>
<span class="eyebrow">At any stage</span>
<h2>Upgrades that wait for a trigger</h2>
<div class="tbl"><table>
<thead><tr><th>Upgrade</th><th>Trigger</th><th>What it changes</th></tr></thead>
<tbody>
<tr><td>Payment gateway (FPX, card)</td><td>A gateway account is chosen</td><td>Adds "pay now" to the same order; holds shrink from days to minutes</td></tr>
<tr><td>Faster seat updates</td><td>An event with thousands rushing at once</td><td>Single conditional update instead of the event lock; CAPTCHA, cached pages, a load test</td></tr>
<tr><td>Launch-day protection</td><td>Concert-size launches</td><td>Virtual waiting room, queued orders, member-only sales, ticketing as its own service</td></tr>
<tr><td>Receipts, invoices, SST</td><td>When payment moves inside Co-Lite</td><td>Issued from the order instead of outside the system</td></tr>
</tbody>
</table></div>
</section>
<section>
<span class="eyebrow">Settled</span>
<h2>Decisions that shape the build</h2>
<div class="decisions">
<div class="decision"><span class="when">foundation</span><h3>Leads are their own table</h3><p class="muted">Not a status on members. Every route in (QR, invite, page, ticket) creates or reuses a lead.</p></div>
<div class="decision"><span class="when">30 Nov 2026</span><h3>Every new table has a company</h3><p class="muted">So INS and CV stay apart now, and SaaS later is a sign-up flow, not a rebuild.</p></div>
<div class="decision"><span class="when">4 Dec 2026</span><h3>One order for every kind of item</h3><p class="muted">Order lines carry a kind: ticket now, merch pickup and shipping later, one checkout like a fan-platform shop.</p></div>
<div class="decision"><span class="when">4 Dec 2026</span><h3>Attendees consent themselves</h3><p class="muted">A buyer's partner can attend without joining; they become a lead only after ticking the consent.</p></div>
<div class="decision"><span class="when">4 Dec 2026</span><h3>No walk-ins on paid events</h3><p class="muted">Venue check-in admits ticket holders and registered invited guests only.</p></div>
<div class="decision"><span class="when">4 Dec 2026</span><h3>No inventory service</h3><p class="muted">Seats and later merch stock are counted in the counter service with one locked, all-or-nothing write.</p></div>
</div>
</section>
<div class="sheet"><span>Source: openspec/specs, openspec/changes/archive, docs/superpowers/specs/2026-12-04-event-ticketing-design.md</span><span>Status as of 4 December 2026</span></div>
</div>
+33
View File
@@ -474,4 +474,37 @@ A form stops taking sign-ups when its event is disabled, its end date has passed
**Release add-landing-thanks-and-footer (SQL, in its OpenSpec change folder):** deploy services-counter and the portal together, then run `sql/01-thanks-footer-labels.sql` (labels only). Landing pages gain a Footer section (1 to 4 columns, a legal line, contact links) and a thank-you text on the Form block and on a hero with a form. Full-width heroes get a lighter shade. Deploy the counter first: an older counter refuses pages that use the new fields. Rollback: the previous images; pages saved with a Footer or thank-you text then fail to save until the release is back.
**Release add-landing-page-polish (SQL, in its OpenSpec change folder):** deploy services-counter first, then the portal, then run `sql/01-polish-labels.sql` (labels only). Landing pages gain a Top bar section (the company logo and an optional button, kept at the top of the window, first section only) and an optional small label above the headings of Feature cards, Steps, Image with text, FAQ and Call to action. Section headings on every landing page, CV included, now use the serif typeface. Rollback: the previous images; pages saved with a top bar or labels then fail to save until the release is back.
**New portal dependencies:** `@tiptap/react`, `@tiptap/pm`, `@tiptap/starter-kit` and `@tiptap/extension-text-align` (the editor, loaded only on the editor screens), and `sanitize-html` (cleans page text on the server before it reaches a visitor). The image build installs them from `package-lock.json`; nothing to do by hand.
## 13. Event tickets
Staff sell tickets for an event from its **Tickets** card; buyers request them on a landing page's **Tickets** section and pay outside Co-Lite (for example by bank transfer). Staff mark an order paid when the money arrives.
1. **Module.** Grant `BO_EVENT_TICKETS` (with `BO_EVENTS`) to the roles that manage ticket settings and orders.
2. **Set up an event.** On the event, switch **Sell tickets** on, write the payment instructions (the bank account and what reference to use) and the hold days (how long an unpaid order keeps its seats), then add ticket types with price, quantity and an optional sales end date. A price of RM 0 makes a free ticket: its order is confirmed at once.
3. **Sell on a page.** Add a **Tickets** section to a landing page and pick the event; only events with tickets switched on are offered. A buyer chooses up to 10 tickets, gives name, email and consent, and gets an order reference, the payment instructions and a link to the order page `/o/<token>`. The buyer also becomes an event lead (source Ticket).
4. **Orders.** **View orders** on the Tickets card lists an event's orders by status. An order's page marks it paid (with an optional payment reference), cancels it or one ticket (freeing the seat), and resends the latest email. An expired order can still be marked paid while seats remain.
5. **Holds.** services-counter expires unpaid orders past their hold every 10 minutes (`tickets.expiry.cron`, Malaysia time) and emails the buyer. The update is conditional, so several services-counter replicas may run the job.
6. **Limits.** At most 10 tickets per order and 3 unpaid orders per email per event; requests share the landing-page rate limits, and the order page allows 120 loads per device.
**Release add-event-ticket-orders (SQL, in its OpenSpec change folder):** run `sql/01-event-ticket-orders.sql` (adds the ticket columns to `event` and creates `ticket_type`, `shop_order`, `shop_order_line` and `ticket`; DDL) and `sql/02-event-tickets-module.sql` (the `BO_EVENT_TICKETS` module; no role gets it) before the new images go live: the new services-counter reads the new `event` columns on every event query. Then deploy services-counter, mobile-api, api-gateway (opens the public ticket paths) and the portal, then run `sql/03-ticket-labels.sql` (labels only; same rule as `05-page-labels.sql`). Order emails go through the email service like the other emails. Rollback: the previous images, then `sql/99-rollback.sql`, which drops every order and ticket, so export the orders first.
Known limit: a page whose Tickets event has ended, been disabled or had tickets switched off cannot be saved until the Tickets section is removed or points at another event.
## 14. Ticket QR codes and check-in
Every ticket on a Paid order (free orders included) has its own link `/t/<code>` with a QR code. The order-paid email carries each ticket's QR and link, and a link to the order page where the buyer names the attendees.
1. **Naming attendees.** On the order page `/o/<token>` the buyer names each ticket (name, and a mobile number or email) and ticks that they have permission to share the details. Naming or renaming gives the ticket a new link, so the old one stops working, and emails the ticket to the attendee when an email is given. A checked-in or cancelled ticket cannot be renamed.
2. **Attendee consent.** A named attendee can tick "Keep me updated" on their ticket page, or at the door. That makes them an event lead with source Ticket under the company's current privacy notice.
3. **Door check-in.** Door staff sign in to the portal on their phone once, with `BO_EVENTS`. Scanning a ticket's QR then opens the staff view: a large Valid, Already checked in, or Not valid banner and a **Check in** button. An unnamed ticket asks for the attendee's name and a mobile number or email first. Staff of another company, and visitors who are not signed in, see the public ticket page instead. Check-in is only possible on the event's days.
4. **Venue self check-in.** On an event that sells tickets, the venue QR (`/c/...`) checks in a paid ticket whose attendee matches the mobile number or email entered (for an unnamed ticket, the buyer's), or a registered invited guest. Anyone else is asked to show their ticket at the entrance; there is no walk-in form.
5. **Order detail.** Each ticket row shows its attendee and check-in time. **Resend ticket** sends a valid ticket again, to its attendee's email when named, otherwise to the buyer (`BO_EVENT_TICKETS`, audited).
6. **Attendance numbers.** The event's Guests card adds tickets awaiting payment, tickets paid and tickets checked in.
7. **Limits.** The public ticket page allows 120 loads per device. Naming and consent allow 60 submissions per device per event, and naming also counts towards the order page's 120 loads.
**Release add-event-tickets (SQL, in its OpenSpec change folder):** run `sql/01-ticket-attendees.sql` before the new services-counter starts. It adds three `ticket` columns and two keys, and gives every active ticket on an order that is already Paid its code. It is additive, and the old images ignore the new columns. Then deploy services-counter, mobile-api (adds `com.google.zxing:core` for the QR image), api-gateway (opens the public ticket paths) and the portal. Then run `sql/02-ticket-labels.sql` (labels only). Rollback: the previous images, then `sql/99-rollback.sql`.
This release also fixes the event leads list, which failed to load for any event with a ticket buyer lead (source Ticket had no label).
@@ -0,0 +1,237 @@
# Event Ticketing: Design
Date: 2026-12-04. Status: owner questions answered 2026-12-04; awaiting approval.
## Intent
Co-Lite is growing from an event lead-capture tool into an event hosting platform. The owner's roadmap (2026-12-04) is:
1. Ticketing (this design).
2. Merch collected at events.
3. Merch sold as a standalone shop, with manual shipping.
4. Membership, with member prices, points and a member portal.
5. Self-serve SaaS sign-up with Free and Premium plans.
Some events are free and some are paid. Free events keep today's lead flow unchanged. Paid events sell tickets. **Leads stay the core.** Every ticket buyer, and every attendee they name, becomes a lead on the event, so sales can follow up after a paid event as well as a free one.
There is no payment gateway yet. Buyers pay outside Co-Lite, by bank transfer or the company's own payment link. Staff mark an order paid when the money arrives.
## Goals
- An organiser turns tickets on for an event. The organiser defines ticket types, each with a name, price, quantity and sales end date, and writes the payment instructions.
- A visitor requests tickets on a landing page through a new **Tickets** block. A request can hold up to 10 tickets across one or more types. The visitor gets an order with a private link.
- The order holds the seats for a set number of days (default 3, set per event) while it awaits payment, then expires on its own.
- Staff see each event's orders. They can mark an order paid, cancel an order, or cancel a single ticket.
- When an order is paid, each ticket gets its own QR code.
- The buyer can name an attendee for each ticket through the order link, and swap attendees until a ticket is checked in.
- Each named attendee gets their ticket by email.
- Tickets that are not named go to the buyer.
- At the door, staff open the ticket QR and check it in. An unpaid or cancelled ticket is clearly refused. For a ticket with no name, staff enter the attendee's name and contact details at check-in.
- The buyer becomes an event lead. Each named attendee also becomes an event lead.
## Non-goals (this build)
- **Payment gateway, online payment and refunds in Co-Lite.** Money moves outside. Only the order's status changes.
- **Receipts, invoices and SST.** The company issues these outside Co-Lite.
- **Merch products, stock and shipping.** The order model is shaped for them (see Data), but none is built.
- **Member accounts.** A buyer needs no login. Tickets belong to the person's mobile or email, so a future member account can claim them.
- **Seat maps, discount codes, waiting lists and ticket transfer between buyers.**
- **Currencies other than MYR.**
## Anti-goals (a failure even if it works)
- **Free events behave differently.** Events without tickets must keep every current registration, invite and check-in path unchanged.
- **Overselling.** More seats are held than a ticket type's quantity allows.
- **The order link leaks.** It shows the buyer's or attendees' details to anyone except the holder of that link.
- **Someone walks into a paid event without a paid ticket** through the self check-in walk-in form.
## Constraints
- **Stack and layering:**
- Events, leads, check-in and pages live in `solvway-services-counter`.
- Admin and public JSON endpoints go through `solvway-mobile-api`.
- Screens and public pages are in `solvway-admin-portal`.
- Emails go through `solvway-services-email`.
- **Company scoping:** every new table carries `company_id`, and all reads and writes are scoped as in `company-scoping`.
- **Rules shared with QR registration:** lead matching, normalisation, consent and the privacy notice follow the `qr-registration` rules.
- **Abuse limits:** public endpoints reuse the QR page's abuse limits.
- **Translations:** labels are in English and zh-CN, as in `ui-translations`.
- **Database changes:** DDL goes in the OpenSpec change folder.
## Approaches
1. **Built into Co-Lite (chosen).** Ticket tables sit on the event, a new Tickets block sits in the page builder, and the event gets a Tickets tab. Leads, check-in, capacity, emails and company scoping are all reused. A gateway later adds "pay now" to the same order.
2. **A separate ticketing service.** It would be cleaner to split out for SaaS, but it duplicates events, leads and check-in, and wiring it in costs much more before it brings any benefit.
3. **An outside platform** such as Eventbrite or Ticket2u. It's fastest, and payment is included. But the buyer data lives elsewhere, which works against becoming an event platform.
The owner chose approach 1.
## Decisions (owner)
- Payment happens outside Co-Lite for now, and staff mark orders paid.
- Visitors request tickets on the event page. Staff do not issue them.
- One request can hold several tickets. The buyer names the attendees later.
- The order can hold any kind of item, ready for merch. Merch will be both collected at events and shipped (shipping is manual, with no courier integration), in later builds.
- Ticket buyers become leads.
## Design
### Turning tickets on
- An event gets a **Tickets** switch, which is off by default. While it is off, the event behaves exactly as today.
- While it is on, the event has:
- **Ticket types.** Each has a name (up to 80 characters), a price in MYR (0 or more, stored in sen), a quantity (at least 1), an optional sales end date (default: the event's end date), a sort order and an enabled flag.
- **Payment instructions.** Free text up to 1,000 characters, shown on the thank-you page, the order page and the order email. Phone numbers, emails and links in it work, as in landing-page contact links.
- **Hold days.** 1 to 14, default 3.
- **Changing ticket types:**
- A ticket type with any orders cannot be deleted, only disabled.
- Its quantity cannot drop below the seats already held.
- A price change applies only to new orders, because each order line keeps its own price.
### Seats
- Seats are held by tickets in orders that are **Awaiting payment** or **Paid**, unless that ticket was cancelled.
- A type's seats left = its quantity minus its held seats.
- A request is refused if any type would go below 0. The check and the insert run in one transaction, with the event's ticket types locked, so two requests cannot take the last seat.
- **Event capacity:** when set, held tickets count toward it together with today's registered guests and walk-ins. Before the event days, a request that would go over capacity is refused, matching "Capacity before the event". Ticket types still cap sales at all times.
### Tickets block (page builder)
- **New block type TICKETS:**
- Its fields are the event, an optional heading and text, plus the standard Look, anchor and eyebrow.
- Only enabled, not-ended events of the page's company with Tickets on can be picked, matching the FORM block's event rules.
- **What the block shows:**
- Each enabled type, with its name, price as `RM 150.00` or `Free`, and either seats left or "Sold out" / "Sales ended".
- Next to each type, a quantity picker from 0 to 10. The total across types is at most 10.
- The buyer's fields:
- name (required);
- email (required, because the order link and tickets go there);
- mobile (optional);
- company (optional);
- the privacy notice consent (required).
- **Closed state:** the block shows that ticket sales are closed when:
- the event is disabled or has ended;
- Tickets is off;
- the company has no privacy notice.
- **Submit:**
1. Create the order.
2. Show the thank-you page: the order reference, the lines and total, the payment instructions, the hold expiry date and time, and a "View your order" link.
3. Email the same content to the buyer.
**Free orders:** if every line is free (order total RM 0), the order is **Paid** at once and tickets are issued straight away. This gives organisers free events with tickets, for example to control entry.
### Orders and order page
- **Order states:**
- Awaiting payment;
- Paid;
- Cancelled (by staff);
- Expired (hold ran out).
- **Order reference:** a short one, such as `T-7K3M9Q`, for bank transfer references. It is separate from the unguessable link token.
- **Order page** `/o/<token>`:
- It is public, open to anyone with the link.
- It shows the event, lines, total, status, the payment instructions while awaiting payment, and the hold expiry.
- **Once paid:** it lists the tickets with each attendee's name, a ticket link per ticket, and a form to name or rename each attendee (name, plus mobile or email). Each ticket and each attendee save stands alone.
- **Naming or renaming an attendee:**
- It issues a **new ticket code**, so the old QR stops working.
- It emails the new attendee their ticket.
- It is refused once that ticket is checked in.
- **What it never shows:** any details beyond what the buyer entered, and nothing about other orders.
- **Expiry:** a scheduled job in services-counter expires Awaiting-payment orders past their hold time and emails the buyer. Staff may mark an expired order paid only if its seats are still available, in which case it becomes Paid.
### Tickets and the door
- Each ticket has an unguessable code with the link `/t/<code>`. The ticket email holds the QR image of that link.
- **Ticket page, public view:**
- It shows the event name, dates, location, ticket type, the attendee's first name and the QR image.
- It shows the ticket's state, but for an unpaid, cancelled or expired ticket it shows "This ticket is not valid" instead of the QR.
- **Ticket page, staff view:**
- Who gets it: someone signed in to the admin portal on the same site, with `BO_EVENTS` for that event's company.
- For a valid ticket on an event day, it adds a large state banner and a **Check in** button.
- For an unnamed ticket, it shows name and mobile-or-email fields first.
- **Checking in:**
- It marks the ticket checked in.
- When the attendee has consented, it captures or links them as an event lead, using the QR registration matching, and marks that event lead attended.
- **Refusals:** a second check-in shows "Already checked in at <time>". Unpaid, cancelled or expired tickets show a red refusal banner.
- **Venue self check-in** (`/c/<token>`) on a ticketed event (owner decision 2026-12-04):
- A mobile or email that matches either of these checks them in:
- the attendee of a Paid ticket that is not yet checked in (if several match, the oldest);
- a registered invited guest.
- Anything else shows "Please show your ticket at the entrance" instead of the walk-in form.
- **Invited guests on ticketed events (owner decision 2026-12-04):** a registered invite counts as a free ticket. It holds a seat toward the event's capacity but not toward any ticket type. The guest checks in as today, through their invite link or the venue check-in. Invite links stay available while Tickets is on.
### Leads
- **Buyer:**
- When an order is created, the buyer is matched as in QR registration and becomes an event lead with the new source **TICKET**, no salesperson and the consent recorded.
- A buyer already captured at the event changes nothing, as in QR registration.
- Their notes record the order reference.
- **Named attendee (owner decision 2026-12-04):** an attendee does **not** become a lead until they consent themselves. No member account is needed.
- When naming attendees, the buyer ticks "I have permission to share these details so their ticket can be sent". Without it, the save is refused.
- Until consent is given, the attendee's details are used only to deliver and check the ticket. They appear on the ticket and the order, never in event leads, lead lists, exports or the dashboard.
- The attendee's ticket page and ticket email offer an optional "Keep me updated about <company> events", with the company's privacy notice. Ticking it records the consent time and notice version, and makes them an event lead with source TICKET, matched as in QR registration.
- At check-in, the staff view shows the same optional tick, so the attendee can consent on the spot.
- An attendee who never ticks it can still attend. Their ticket is checked in, but no lead is created.
- **Unnamed ticket:** at check-in, staff enter the person's name and contact details. That person becomes an event lead only if they tick the consent there.
### Staff screens
- **New permission `BO_EVENT_TICKETS`.** It gives access to the event's **Tickets** tab:
- the Tickets switch, ticket types, payment instructions and hold days;
- an **Orders** list for the event: reference, buyer, lines, total, status and created time, with a status filter and a search by reference, name, email or mobile;
- an **Order detail** page with these actions:
- **Mark paid**, with an optional payment reference of up to 100 characters. It records who marked it and when, then issues and emails the tickets.
- **Cancel order.**
- **Cancel ticket.**
- **Resend order email** and **Resend ticket.**
- Every action is written to the admin audit log.
- **Event attendance numbers:** they gain tickets awaiting payment, paid and checked in.
- **Super admins:** they see all companies, as today.
### Emails
All emails are sent through `solvway-services-email` and are in the company's language:
- **Order received:** lines, total, payment instructions, hold expiry and the order link.
- **Order paid:** the tickets. Each unnamed ticket comes as its own QR image and link, and a "Name your attendees" link points to the order page.
- **Ticket:** sent to a named attendee, with the QR image and link.
- **Order expired** and **Order cancelled.**
### Data (shaped for merch)
- `ticket_type` (company_id, event_id, name, price_sen, quantity, sales_end_date, sort, enabled).
- Event gains `tickets_enabled`, `payment_instructions` and `hold_days`.
- `shop_order`:
- company_id, event_id (nullable, for a future standalone shop), reference, token;
- buyer name, email, mobile and company;
- lead_id;
- status, total_sen, hold_until, paid_at, paid_by, payment_ref, cancelled_at, cancelled_by;
- consent time, privacy notice version, page address and UTM values.
- `shop_order_line`:
- order_id, kind, item_id, name snapshot, unit_price_sen, quantity.
- `kind` is `TICKET` now. `PICKUP` and `SHIP` are reserved for merch and are not built.
- `ticket`:
- company_id, event_id, order_line_id, code;
- attendee name, mobile and email;
- event_lead_id;
- status (ACTIVE or CANCELLED), checked_in_at, checked_in_by.
### Abuse limits
- Order requests and order-page views use the QR page's per-IP limits.
- At most **3 Awaiting-payment orders per email per event**, so nobody can hold every seat. A 4th request gets "You already have orders awaiting payment for this event."
## What's left to the builder
- Endpoint paths, DTO shapes and screen layouts, following the existing event and page-builder patterns.
- Email wording, and the zh-CN labels.
- The order reference alphabet and length. It must be unambiguous and unique per company.
- How the staff view of `/t/<code>` detects the staff session, without exposing anything when it is absent.
- Splitting the build into OpenSpec changes. Suggested:
1. ticket types and orders, with the staff side;
2. the Tickets block and order page;
3. tickets, emails and check-in at the door.
## Open questions (owner)
None. All three were answered on 2026-12-04: attendees consent themselves, there are no walk-ins on paid events, and a registered invite counts as a free ticket.
+108
View File
@@ -523,3 +523,111 @@ ALTER TABLE `notification`
-- add-page-drafts-and-templates: a published page's unpublished draft
USE `service-counter`;
ALTER TABLE `cms_page` ADD COLUMN `draft` json NULL COMMENT 'Unpublished changes of a published page: slug, title, metaDescription, hideHeader, blocks' AFTER `blocks`;
-- add-event-ticket-orders/sql/01-event-ticket-orders.sql
USE `service-counter`;
ALTER TABLE `event`
ADD COLUMN `tickets_enabled` tinyint(1) NOT NULL DEFAULT 0,
ADD COLUMN `payment_instructions` varchar(1000) NULL,
ADD COLUMN `hold_days` int NOT NULL DEFAULT 3;
CREATE TABLE IF NOT EXISTS `ticket_type` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`name` varchar(80) NOT NULL,
`price_sen` int NOT NULL,
`quantity` int NOT NULL,
`sales_end_date` date NULL,
`sort` int NOT NULL DEFAULT 0,
`enabled` tinyint(1) NOT NULL DEFAULT 1,
`created_by` varchar(255) NULL,
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP,
`updated_by` varchar(255) NULL,
`updated_at` datetime NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ticket_type_name` (`event_uuid`, `name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `shop_order` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint NOT NULL,
`event_uuid` bigint NULL COMMENT 'Null is reserved for a later standalone shop',
`reference` varchar(12) NOT NULL,
`token` varchar(32) NOT NULL,
`buyer_name` varchar(100) NOT NULL,
`buyer_email` varchar(254) NOT NULL,
`buyer_mobile_e164` varchar(20) NULL,
`buyer_company` varchar(150) NULL,
`lead_uuid` bigint NULL,
`event_lead_uuid` bigint NULL,
`status` varchar(20) NOT NULL COMMENT 'AWAITING, PAID, CANCELLED, EXPIRED',
`total_sen` int NOT NULL,
`hold_until` datetime NULL,
`paid_at` datetime NULL,
`paid_by` varchar(255) NULL,
`payment_ref` varchar(100) NULL,
`cancelled_at` datetime NULL,
`cancelled_by` varchar(255) NULL,
`expired_at` datetime NULL,
`consent_at` datetime NULL,
`consent_notice_id` bigint NULL,
`page_path` varchar(200) NULL,
`utm_source` varchar(100) NULL,
`utm_medium` varchar(100) NULL,
`utm_campaign` varchar(100) NULL,
`last_email` varchar(20) NULL COMMENT 'RECEIVED, PAID, EXPIRED, CANCELLED',
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_shop_order_reference` (`company_id`, `reference`),
UNIQUE KEY `uk_shop_order_token` (`token`),
KEY `idx_shop_order_event_status` (`event_uuid`, `status`),
KEY `idx_shop_order_hold` (`status`, `hold_until`),
KEY `idx_shop_order_buyer` (`event_uuid`, `buyer_email`, `status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `shop_order_line` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint NOT NULL,
`kind` varchar(10) NOT NULL COMMENT 'TICKET; PICKUP and SHIP reserved for merch',
`item_id` bigint NOT NULL COMMENT 'ticket_type.id for TICKET',
`name` varchar(80) NOT NULL,
`unit_price_sen` int NOT NULL,
`quantity` int NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_shop_order_line_order` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `ticket` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`order_id` bigint NOT NULL,
`order_line_id` bigint NOT NULL,
`ticket_type_id` bigint NOT NULL,
`code` varchar(32) NULL COMMENT 'QR code, issued by add-event-tickets',
`attendee_name` varchar(100) NULL,
`attendee_mobile_e164` varchar(20) NULL,
`attendee_email` varchar(254) NULL,
`event_lead_uuid` bigint NULL,
`status` varchar(10) NOT NULL DEFAULT 'ACTIVE' COMMENT 'ACTIVE, CANCELLED',
`cancelled_at` datetime NULL,
`cancelled_by` varchar(255) NULL,
`checked_in_at` datetime NULL,
`checked_in_by` varchar(255) NULL,
`attendee_named_at` datetime NULL,
`attendee_consent_at` datetime NULL,
`attendee_notice_id` bigint NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ticket_code` (`code`),
KEY `idx_ticket_type_status` (`ticket_type_id`, `status`),
KEY `idx_ticket_order` (`order_id`),
KEY `idx_ticket_event_mobile` (`event_uuid`, `attendee_mobile_e164`),
KEY `idx_ticket_event_email` (`event_uuid`, `attendee_email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- add-event-ticket-orders/sql/02-event-tickets-module.sql
USE `service-system`;
INSERT INTO `module` (`id`, `name`, `desc`, `area`, `type`, `parent`, `url`, `icon_name`) VALUES
(41160000, 'BO_EVENT_TICKETS', 'Event tickets', 'BO', 'M', 40000000, NULL, NULL);
+314
View File
@@ -695,6 +695,8 @@ INSERT INTO message (code, content, area) SELECT 'LeadSourceInvite', JSON_OBJECT
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '邀请') WHERE LOWER(code) = LOWER('LeadSourceInvite') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'LeadSourceWeb', JSON_OBJECT('en_US', 'Web page', 'zh_CN', '网页'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadSourceWeb') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '网页') WHERE LOWER(code) = LOWER('LeadSourceWeb') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'LeadSourceTicket', JSON_OBJECT('en_US', 'Ticket', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'LeadWebPage', JSON_OBJECT('en_US', 'Web page: {path}', 'zh_CN', '网页:{path}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadWebPage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '网页:{path}') WHERE LOWER(code) = LOWER('LeadWebPage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'LeadCampaign', JSON_OBJECT('en_US', 'Campaign: {tags}', 'zh_CN', '推广活动:{tags}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadCampaign') AND area = 'A');
@@ -1743,6 +1745,12 @@ INSERT INTO message (code, content, area) SELECT 'PagesAddColumn', JSON_OBJECT('
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '添加栏') WHERE LOWER(code) = LOWER('PagesAddColumn') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesFooterLegal', JSON_OBJECT('en_US', 'Legal line', 'zh_CN', '版权声明'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesFooterLegal') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '版权声明') WHERE LOWER(code) = LOWER('PagesFooterLegal') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesBlockTopBar', JSON_OBJECT('en_US', 'Top bar', 'zh_CN', '顶栏'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesBlockTopBar') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '顶栏') WHERE LOWER(code) = LOWER('PagesBlockTopBar') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesEyebrow', JSON_OBJECT('en_US', 'Label', 'zh_CN', '小标签'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesEyebrow') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '小标签') WHERE LOWER(code) = LOWER('PagesEyebrow') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTopBarFirst', JSON_OBJECT('en_US', 'The top bar must be the first section.', 'zh_CN', '顶栏必须是第一个区块。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTopBarFirst') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '顶栏必须是第一个区块。') WHERE LOWER(code) = LOWER('PagesTopBarFirst') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesUploadImage', JSON_OBJECT('en_US', 'Upload image', 'zh_CN', '上传图片'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUploadImage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '上传图片') WHERE LOWER(code) = LOWER('PagesUploadImage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesUploadImageHint', JSON_OBJECT('en_US', 'PNG, JPEG or WebP up to 2 MB. Paste the link into your HTML, for example in an img tag''s src.', 'zh_CN', 'PNG、JPEG 或 WebP,最大 2 MB。将链接粘贴到您的 HTML 中,例如 img 标签的 src。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUploadImageHint') AND area = 'A');
@@ -1841,4 +1849,310 @@ INSERT INTO message (code, content, area) SELECT 'CompAccentHint', JSON_OBJECT('
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '用于本公司网页的按钮。留空则使用默认蓝色。') WHERE LOWER(code) = LOWER('CompAccentHint') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'CompBrandingSaveFailed', JSON_OBJECT('en_US', 'Could not save the branding.', 'zh_CN', '无法保存品牌设置。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('CompBrandingSaveFailed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无法保存品牌设置。') WHERE LOWER(code) = LOWER('CompBrandingSaveFailed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'GuestHeldTickets', JSON_OBJECT('en_US', 'Held tickets', 'zh_CN', '已占门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestHeldTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已占门票') WHERE LOWER(code) = LOWER('GuestHeldTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTicketsClosed', JSON_OBJECT('en_US', 'Choose an event that is selling tickets.', 'zh_CN', '请选择正在售票的活动。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTicketsClosed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请选择正在售票的活动。') WHERE LOWER(code) = LOWER('PagesTicketsClosed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTitle', JSON_OBJECT('en_US', 'Tickets', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('TktTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktViewOrders', JSON_OBJECT('en_US', 'View orders', 'zh_CN', '查看订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktViewOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '查看订单') WHERE LOWER(code) = LOWER('TktViewOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktLoadFailed', JSON_OBJECT('en_US', 'Could not load the tickets.', 'zh_CN', '无法加载门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktLoadFailed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无法加载门票。') WHERE LOWER(code) = LOWER('TktLoadFailed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveFailed', JSON_OBJECT('en_US', 'Could not save. Try again.', 'zh_CN', '无法保存,请重试。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveFailed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无法保存,请重试。') WHERE LOWER(code) = LOWER('TktSaveFailed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSettingsSaved', JSON_OBJECT('en_US', 'Ticket settings saved.', 'zh_CN', '门票设置已保存。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSettingsSaved') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票设置已保存。') WHERE LOWER(code) = LOWER('TktSettingsSaved') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSellTickets', JSON_OBJECT('en_US', 'Sell tickets', 'zh_CN', '售卖门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSellTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '售卖门票') WHERE LOWER(code) = LOWER('TktSellTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaymentInstructions', JSON_OBJECT('en_US', 'Payment instructions', 'zh_CN', '付款说明'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaymentInstructions') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款说明') WHERE LOWER(code) = LOWER('TktPaymentInstructions') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaymentInstructionsHelp', JSON_OBJECT('en_US', 'Shown to buyers after they request tickets, e.g. the bank account and what reference to use.', 'zh_CN', '买家申请门票后显示,例如银行账户及付款备注。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaymentInstructionsHelp') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '买家申请门票后显示,例如银行账户及付款备注。') WHERE LOWER(code) = LOWER('TktPaymentInstructionsHelp') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktHoldDays', JSON_OBJECT('en_US', 'Hold days', 'zh_CN', '保留天数'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktHoldDays') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保留天数') WHERE LOWER(code) = LOWER('TktHoldDays') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveSettings', JSON_OBJECT('en_US', 'Save ticket settings', 'zh_CN', '保存门票设置'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveSettings') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存门票设置') WHERE LOWER(code) = LOWER('TktSaveSettings') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPrice', JSON_OBJECT('en_US', 'Price', 'zh_CN', '价格'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPrice') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '价格') WHERE LOWER(code) = LOWER('TktPrice') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPriceRm', JSON_OBJECT('en_US', 'Price (RM)', 'zh_CN', '价格(RM)'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPriceRm') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '价格(RM)') WHERE LOWER(code) = LOWER('TktPriceRm') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktQuantity', JSON_OBJECT('en_US', 'Quantity', 'zh_CN', '数量'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktQuantity') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '数量') WHERE LOWER(code) = LOWER('TktQuantity') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktLeft', JSON_OBJECT('en_US', 'Left', 'zh_CN', '剩余'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktLeft') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '剩余') WHERE LOWER(code) = LOWER('TktLeft') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesEnd', JSON_OBJECT('en_US', 'Sales end', 'zh_CN', '停售日期'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesEnd') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '停售日期') WHERE LOWER(code) = LOWER('TktSalesEnd') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesEndHelp', JSON_OBJECT('en_US', 'An empty sales end date means sales end with the event.', 'zh_CN', '停售日期留空表示随活动结束而停售。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesEndHelp') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '停售日期留空表示随活动结束而停售。') WHERE LOWER(code) = LOWER('TktSalesEndHelp') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNoTypes', JSON_OBJECT('en_US', 'No ticket types yet.', 'zh_CN', '尚无门票类型。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNoTypes') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚无门票类型。') WHERE LOWER(code) = LOWER('TktNoTypes') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktFree', JSON_OBJECT('en_US', 'Free', 'zh_CN', '免费'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktFree') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '免费') WHERE LOWER(code) = LOWER('TktFree') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDisable', JSON_OBJECT('en_US', 'Disable', 'zh_CN', '停用'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDisable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '停用') WHERE LOWER(code) = LOWER('TktDisable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktEnable', JSON_OBJECT('en_US', 'Enable', 'zh_CN', '启用'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktEnable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '启用') WHERE LOWER(code) = LOWER('TktEnable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDelete', JSON_OBJECT('en_US', 'Delete', 'zh_CN', '删除'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDelete') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '删除') WHERE LOWER(code) = LOWER('TktDelete') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTypeName', JSON_OBJECT('en_US', 'Ticket name', 'zh_CN', '门票名称'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTypeName') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票名称') WHERE LOWER(code) = LOWER('TktTypeName') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAddType', JSON_OBJECT('en_US', 'Add ticket type', 'zh_CN', '添加门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAddType') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '添加门票类型') WHERE LOWER(code) = LOWER('TktAddType') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveType', JSON_OBJECT('en_US', 'Save ticket type', 'zh_CN', '保存门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveType') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存门票类型') WHERE LOWER(code) = LOWER('TktSaveType') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDeleteTitle', JSON_OBJECT('en_US', 'Delete ticket type', 'zh_CN', '删除门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDeleteTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '删除门票类型') WHERE LOWER(code) = LOWER('TktDeleteTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDeleteMessage', JSON_OBJECT('en_US', 'Delete {name}? This cannot be undone.', 'zh_CN', '删除 {name}?此操作无法撤销。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDeleteMessage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '删除 {name}?此操作无法撤销。') WHERE LOWER(code) = LOWER('TktDeleteMessage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrInstructionsRequired', JSON_OBJECT('en_US', 'Enter the payment instructions before turning tickets on.', 'zh_CN', '开启售票前请填写付款说明。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrInstructionsRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '开启售票前请填写付款说明。') WHERE LOWER(code) = LOWER('TktErrInstructionsRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrInstructionsTooLong', JSON_OBJECT('en_US', 'Payment instructions can be at most 1000 characters.', 'zh_CN', '付款说明最多 1000 个字符。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrInstructionsTooLong') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款说明最多 1000 个字符。') WHERE LOWER(code) = LOWER('TktErrInstructionsTooLong') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrHoldDays', JSON_OBJECT('en_US', 'Hold days must be from 1 to 14.', 'zh_CN', '保留天数须为 1 至 14。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrHoldDays') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保留天数须为 1 至 14。') WHERE LOWER(code) = LOWER('TktErrHoldDays') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrName', JSON_OBJECT('en_US', 'Enter a name of 1 to 80 characters.', 'zh_CN', '请输入 1 至 80 个字符的名称。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrName') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入 1 至 80 个字符的名称。') WHERE LOWER(code) = LOWER('TktErrName') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrNameTaken', JSON_OBJECT('en_US', 'This event already has a ticket type with this name.', 'zh_CN', '本活动已有同名门票类型。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrNameTaken') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '本活动已有同名门票类型。') WHERE LOWER(code) = LOWER('TktErrNameTaken') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrPrice', JSON_OBJECT('en_US', 'Enter a price from 0.00 to 99999.99.', 'zh_CN', '请输入 0.00 至 99999.99 的价格。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrPrice') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入 0.00 至 99999.99 的价格。') WHERE LOWER(code) = LOWER('TktErrPrice') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrQuantity', JSON_OBJECT('en_US', 'Enter a quantity of at least 1.', 'zh_CN', '数量至少为 1。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrQuantity') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '数量至少为 1。') WHERE LOWER(code) = LOWER('TktErrQuantity') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrQuantityBelowHeld', JSON_OBJECT('en_US', 'The quantity cannot be below the seats already held.', 'zh_CN', '数量不能低于已占座位。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrQuantityBelowHeld') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '数量不能低于已占座位。') WHERE LOWER(code) = LOWER('TktErrQuantityBelowHeld') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrDate', JSON_OBJECT('en_US', 'Enter a valid date.', 'zh_CN', '请输入有效日期。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrDate') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入有效日期。') WHERE LOWER(code) = LOWER('TktErrDate') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrTypeHasOrders', JSON_OBJECT('en_US', 'This ticket type has orders. Disable it instead.', 'zh_CN', '此门票类型已有订单,请改为停用。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrTypeHasOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票类型已有订单,请改为停用。') WHERE LOWER(code) = LOWER('TktErrTypeHasOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrNotPayable', JSON_OBJECT('en_US', 'Only an order awaiting payment or expired can be marked paid.', 'zh_CN', '只有待付款或已过期的订单可标记为已付款。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrNotPayable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '只有待付款或已过期的订单可标记为已付款。') WHERE LOWER(code) = LOWER('TktErrNotPayable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrSeatsGone', JSON_OBJECT('en_US', 'The seats of this expired order were taken. It cannot be marked paid.', 'zh_CN', '此过期订单的座位已被占用,无法标记为已付款。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrSeatsGone') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此过期订单的座位已被占用,无法标记为已付款。') WHERE LOWER(code) = LOWER('TktErrSeatsGone') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrPaymentRef', JSON_OBJECT('en_US', 'The payment reference can be at most 100 characters.', 'zh_CN', '付款参考最多 100 个字符。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrPaymentRef') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款参考最多 100 个字符。') WHERE LOWER(code) = LOWER('TktErrPaymentRef') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrNotCancellable', JSON_OBJECT('en_US', 'Only an order awaiting payment or paid can be cancelled.', 'zh_CN', '只有待付款或已付款的订单可取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrNotCancellable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '只有待付款或已付款的订单可取消。') WHERE LOWER(code) = LOWER('TktErrNotCancellable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrLastTicket', JSON_OBJECT('en_US', 'This is the order''s last ticket. Cancel the order instead.', 'zh_CN', '这是订单的最后一张门票,请改为取消订单。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrLastTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '这是订单的最后一张门票,请改为取消订单。') WHERE LOWER(code) = LOWER('TktErrLastTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusAWAITING', JSON_OBJECT('en_US', 'Awaiting payment', 'zh_CN', '待付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusAWAITING') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '待付款') WHERE LOWER(code) = LOWER('TktStatusAWAITING') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusPAID', JSON_OBJECT('en_US', 'Paid', 'zh_CN', '已付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusPAID') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已付款') WHERE LOWER(code) = LOWER('TktStatusPAID') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusCANCELLED', JSON_OBJECT('en_US', 'Cancelled', 'zh_CN', '已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusCANCELLED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已取消') WHERE LOWER(code) = LOWER('TktStatusCANCELLED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusEXPIRED', JSON_OBJECT('en_US', 'Expired', 'zh_CN', '已过期'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusEXPIRED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已过期') WHERE LOWER(code) = LOWER('TktStatusEXPIRED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrdersTitle', JSON_OBJECT('en_US', 'Ticket orders', 'zh_CN', '门票订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrdersTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票订单') WHERE LOWER(code) = LOWER('TktOrdersTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktBackToEvent', JSON_OBJECT('en_US', 'Back to event', 'zh_CN', '返回活动'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktBackToEvent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '返回活动') WHERE LOWER(code) = LOWER('TktBackToEvent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderState', JSON_OBJECT('en_US', 'Order state', 'zh_CN', '订单状态'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderState') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单状态') WHERE LOWER(code) = LOWER('TktOrderState') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSearchOrders', JSON_OBJECT('en_US', 'Search orders', 'zh_CN', '搜索订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSearchOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '搜索订单') WHERE LOWER(code) = LOWER('TktSearchOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSearchOrdersHint', JSON_OBJECT('en_US', 'Reference, name, email or mobile', 'zh_CN', '编号、姓名、电邮或手机'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSearchOrdersHint') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '编号、姓名、电邮或手机') WHERE LOWER(code) = LOWER('TktSearchOrdersHint') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReference', JSON_OBJECT('en_US', 'Reference', 'zh_CN', '编号'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReference') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '编号') WHERE LOWER(code) = LOWER('TktReference') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktBuyer', JSON_OBJECT('en_US', 'Buyer', 'zh_CN', '买家'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktBuyer') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '买家') WHERE LOWER(code) = LOWER('TktBuyer') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTickets', JSON_OBJECT('en_US', 'Tickets', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('TktTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTotal', JSON_OBJECT('en_US', 'Total', 'zh_CN', '总额'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTotal') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '总额') WHERE LOWER(code) = LOWER('TktTotal') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesEnded', JSON_OBJECT('en_US', 'Sales ended', 'zh_CN', '已停售'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesEnded') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已停售') WHERE LOWER(code) = LOWER('TktSalesEnded') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSeatsLeft', JSON_OBJECT('en_US', '{count} left', 'zh_CN', '剩余 {count} 张'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSeatsLeft') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '剩余 {count} 张') WHERE LOWER(code) = LOWER('TktSeatsLeft') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSoldOut', JSON_OBJECT('en_US', 'Sold out', 'zh_CN', '已售罄'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSoldOut') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已售罄') WHERE LOWER(code) = LOWER('TktSoldOut') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktRemoveOne', JSON_OBJECT('en_US', 'Remove one {name}', 'zh_CN', '减少一张 {name}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktRemoveOne') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '减少一张 {name}') WHERE LOWER(code) = LOWER('TktRemoveOne') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAddOne', JSON_OBJECT('en_US', 'Add one {name}', 'zh_CN', '增加一张 {name}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAddOne') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '增加一张 {name}') WHERE LOWER(code) = LOWER('TktAddOne') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPreviewNote', JSON_OBJECT('en_US', 'Visitors choose tickets and fill in their details here.', 'zh_CN', '访客在此选择门票并填写资料。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPreviewNote') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '访客在此选择门票并填写资料。') WHERE LOWER(code) = LOWER('TktPreviewNote') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesClosed', JSON_OBJECT('en_US', 'Ticket sales are closed.', 'zh_CN', '门票销售已结束。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesClosed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票销售已结束。') WHERE LOWER(code) = LOWER('TktSalesClosed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktChooseTickets', JSON_OBJECT('en_US', 'Choose at least one ticket.', 'zh_CN', '请至少选择一张门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktChooseTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请至少选择一张门票。') WHERE LOWER(code) = LOWER('TktChooseTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktEmailRequired', JSON_OBJECT('en_US', 'Enter your email.', 'zh_CN', '请输入电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktEmailRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入电子邮件。') WHERE LOWER(code) = LOWER('TktEmailRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktConsentRequired', JSON_OBJECT('en_US', 'Tick the box to agree to the privacy notice.', 'zh_CN', '请勾选以同意隐私声明。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请勾选以同意隐私声明。') WHERE LOWER(code) = LOWER('TktConsentRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktMax', JSON_OBJECT('en_US', 'Up to 10 tickets per order.', 'zh_CN', '每笔订单最多 10 张门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktMax') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '每笔订单最多 10 张门票。') WHERE LOWER(code) = LOWER('TktMax') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktRequest', JSON_OBJECT('en_US', 'Request tickets', 'zh_CN', '申请门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktRequest') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '申请门票') WHERE LOWER(code) = LOWER('TktRequest') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktThanksPlain', JSON_OBJECT('en_US', 'Thank you. Your request for {event} is in.', 'zh_CN', '谢谢,您对 {event} 的申请已收到。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktThanksPlain') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '谢谢,您对 {event} 的申请已收到。') WHERE LOWER(code) = LOWER('TktThanksPlain') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktThanksPaid', JSON_OBJECT('en_US', 'Your order {reference} is confirmed.', 'zh_CN', '您的订单 {reference} 已确认。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktThanksPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '您的订单 {reference} 已确认。') WHERE LOWER(code) = LOWER('TktThanksPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktThanks', JSON_OBJECT('en_US', 'We have your order {reference}. It is held until you pay.', 'zh_CN', '我们已收到您的订单 {reference},付款前为您保留。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktThanks') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '我们已收到您的订单 {reference},付款前为您保留。') WHERE LOWER(code) = LOWER('TktThanks') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktViewOrder', JSON_OBJECT('en_US', 'View your order', 'zh_CN', '查看订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktViewOrder') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '查看订单') WHERE LOWER(code) = LOWER('TktViewOrder') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktHowToPay', JSON_OBJECT('en_US', 'How to pay', 'zh_CN', '付款方式'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktHowToPay') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款方式') WHERE LOWER(code) = LOWER('TktHowToPay') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPayBy', JSON_OBJECT('en_US', 'Pay by {when}', 'zh_CN', '请于 {when} 前付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPayBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请于 {when} 前付款') WHERE LOWER(code) = LOWER('TktPayBy') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicOrder', JSON_OBJECT('en_US', 'Order {reference}', 'zh_CN', '订单 {reference}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicOrder') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单 {reference}') WHERE LOWER(code) = LOWER('TktPublicOrder') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicAwaiting', JSON_OBJECT('en_US', 'Awaiting payment', 'zh_CN', '等待付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicAwaiting') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '等待付款') WHERE LOWER(code) = LOWER('TktPublicAwaiting') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicPaid', JSON_OBJECT('en_US', 'Paid. Your order is confirmed.', 'zh_CN', '已付款,订单已确认。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已付款,订单已确认。') WHERE LOWER(code) = LOWER('TktPublicPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicCancelled', JSON_OBJECT('en_US', 'This order was cancelled.', 'zh_CN', '此订单已取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicCancelled') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此订单已取消。') WHERE LOWER(code) = LOWER('TktPublicCancelled') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicExpired', JSON_OBJECT('en_US', 'This order expired before payment arrived.', 'zh_CN', '此订单在收到付款前已过期。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicExpired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此订单在收到付款前已过期。') WHERE LOWER(code) = LOWER('TktPublicExpired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderInvalid', JSON_OBJECT('en_US', 'This order link is not valid.', 'zh_CN', '此订单链接无效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderInvalid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此订单链接无效。') WHERE LOWER(code) = LOWER('TktOrderInvalid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketInvalid', JSON_OBJECT('en_US', 'This ticket link is not valid.', 'zh_CN', '此门票链接无效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketInvalid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票链接无效。') WHERE LOWER(code) = LOWER('TktTicketInvalid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketFor', JSON_OBJECT('en_US', 'Ticket for {name}', 'zh_CN', '{name} 的门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketFor') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '{name} 的门票') WHERE LOWER(code) = LOWER('TktTicketFor') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktQrAlt', JSON_OBJECT('en_US', 'Ticket QR code', 'zh_CN', '门票二维码'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktQrAlt') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票二维码') WHERE LOWER(code) = LOWER('TktQrAlt') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktShowQr', JSON_OBJECT('en_US', 'Show this QR code at the entrance.', 'zh_CN', '请在入口出示此二维码。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktShowQr') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请在入口出示此二维码。') WHERE LOWER(code) = LOWER('TktShowQr') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCheckedInAt', JSON_OBJECT('en_US', 'Checked in at {when}', 'zh_CN', '已于 {when} 签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckedInAt') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已于 {when} 签到') WHERE LOWER(code) = LOWER('TktCheckedInAt') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotValid', JSON_OBJECT('en_US', 'This ticket is not valid', 'zh_CN', '此门票无效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotValid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票无效') WHERE LOWER(code) = LOWER('TktNotValid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonAWAITING', JSON_OBJECT('en_US', 'awaiting payment', 'zh_CN', '等待付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonAWAITING') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '等待付款') WHERE LOWER(code) = LOWER('TktReasonAWAITING') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonORDER_CANCELLED', JSON_OBJECT('en_US', 'order cancelled', 'zh_CN', '订单已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonORDER_CANCELLED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已取消') WHERE LOWER(code) = LOWER('TktReasonORDER_CANCELLED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonORDER_EXPIRED', JSON_OBJECT('en_US', 'order expired', 'zh_CN', '订单已过期'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonORDER_EXPIRED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已过期') WHERE LOWER(code) = LOWER('TktReasonORDER_EXPIRED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonTICKET_CANCELLED', JSON_OBJECT('en_US', 'ticket cancelled', 'zh_CN', '门票已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonTICKET_CANCELLED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已取消') WHERE LOWER(code) = LOWER('TktReasonTICKET_CANCELLED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktKeepUpdated', JSON_OBJECT('en_US', 'Keep me updated about {company} events', 'zh_CN', '向我发送 {company} 的活动资讯'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktKeepUpdated') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '向我发送 {company} 的活动资讯') WHERE LOWER(code) = LOWER('TktKeepUpdated') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktConsentSave', JSON_OBJECT('en_US', 'Save', 'zh_CN', '保存'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentSave') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存') WHERE LOWER(code) = LOWER('TktConsentSave') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktConsentDone', JSON_OBJECT('en_US', 'Thank you. We will keep you updated.', 'zh_CN', '谢谢,我们会向您发送最新资讯。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentDone') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '谢谢,我们会向您发送最新资讯。') WHERE LOWER(code) = LOWER('TktConsentDone') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStaffView', JSON_OBJECT('en_US', 'Staff check-in', 'zh_CN', '工作人员签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStaffView') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '工作人员签到') WHERE LOWER(code) = LOWER('TktStaffView') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStaffValid', JSON_OBJECT('en_US', 'Valid', 'zh_CN', '有效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStaffValid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '有效') WHERE LOWER(code) = LOWER('TktStaffValid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAlreadyCheckedIn', JSON_OBJECT('en_US', 'Already checked in at {when}', 'zh_CN', '已于 {when} 签到过'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAlreadyCheckedIn') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已于 {when} 签到过') WHERE LOWER(code) = LOWER('TktAlreadyCheckedIn') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotValidReason', JSON_OBJECT('en_US', 'Not valid: {reason}', 'zh_CN', '无效:{reason}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotValidReason') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无效:{reason}') WHERE LOWER(code) = LOWER('TktNotValidReason') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotEventDay', JSON_OBJECT('en_US', 'Check-in is only open on the event days.', 'zh_CN', '仅在活动日开放签到。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotEventDay') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '仅在活动日开放签到。') WHERE LOWER(code) = LOWER('TktNotEventDay') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCheckIn', JSON_OBJECT('en_US', 'Check in', 'zh_CN', '签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckIn') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '签到') WHERE LOWER(code) = LOWER('TktCheckIn') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCheckedInNow', JSON_OBJECT('en_US', 'Checked in.', 'zh_CN', '签到成功。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckedInNow') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '签到成功。') WHERE LOWER(code) = LOWER('TktCheckedInNow') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktUnnamed', JSON_OBJECT('en_US', 'No attendee named yet', 'zh_CN', '尚未填写参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktUnnamed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚未填写参加者') WHERE LOWER(code) = LOWER('TktUnnamed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAttendeeName', JSON_OBJECT('en_US', 'Attendee name', 'zh_CN', '参加者姓名'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeName') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '参加者姓名') WHERE LOWER(code) = LOWER('TktAttendeeName') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktContactRequired', JSON_OBJECT('en_US', 'Enter a mobile number or an email.', 'zh_CN', '请输入手机号码或电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktContactRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入手机号码或电子邮件。') WHERE LOWER(code) = LOWER('TktContactRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'ChkShowTicket', JSON_OBJECT('en_US', 'Please show your ticket at the entrance.', 'zh_CN', '请在入口出示您的门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('ChkShowTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请在入口出示您的门票。') WHERE LOWER(code) = LOWER('ChkShowTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'GuestTicketsAwaiting', JSON_OBJECT('en_US', 'Tickets awaiting payment', 'zh_CN', '待付款门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsAwaiting') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '待付款门票') WHERE LOWER(code) = LOWER('GuestTicketsAwaiting') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'GuestTicketsPaid', JSON_OBJECT('en_US', 'Tickets paid', 'zh_CN', '已付款门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已付款门票') WHERE LOWER(code) = LOWER('GuestTicketsPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'GuestTicketsCheckedIn', JSON_OBJECT('en_US', 'Tickets checked in', 'zh_CN', '已签到门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsCheckedIn') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已签到门票') WHERE LOWER(code) = LOWER('GuestTicketsCheckedIn') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrTicketNotValid', JSON_OBJECT('en_US', 'This ticket is not valid, so it cannot be sent.', 'zh_CN', '此门票无效,无法发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrTicketNotValid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票无效,无法发送。') WHERE LOWER(code) = LOWER('TktErrTicketNotValid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktResendTicket', JSON_OBJECT('en_US', 'Resend ticket', 'zh_CN', '重新发送门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktResendTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '重新发送门票') WHERE LOWER(code) = LOWER('TktResendTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketSent', JSON_OBJECT('en_US', 'Ticket sent.', 'zh_CN', '门票已发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketSent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已发送。') WHERE LOWER(code) = LOWER('TktTicketSent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktYourTickets', JSON_OBJECT('en_US', 'Your tickets', 'zh_CN', '您的门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktYourTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '您的门票') WHERE LOWER(code) = LOWER('TktYourTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNameAttendeesHelp', JSON_OBJECT('en_US', 'Name each attendee so their ticket can be emailed to them, or share each ticket''s link.', 'zh_CN', '填写每位参加者,以便通过电子邮件将门票发送给他们,或分享每张门票的链接。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNameAttendeesHelp') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '填写每位参加者,以便通过电子邮件将门票发送给他们,或分享每张门票的链接。') WHERE LOWER(code) = LOWER('TktNameAttendeesHelp') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAttendeeSaved', JSON_OBJECT('en_US', 'Saved. The ticket has a new link; the old one no longer works.', 'zh_CN', '已保存。门票已有新链接,旧链接已失效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeSaved') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已保存。门票已有新链接,旧链接已失效。') WHERE LOWER(code) = LOWER('TktAttendeeSaved') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotNamed', JSON_OBJECT('en_US', 'Not named yet', 'zh_CN', '尚未填写'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotNamed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚未填写') WHERE LOWER(code) = LOWER('TktNotNamed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOpenTicket', JSON_OBJECT('en_US', 'Open ticket', 'zh_CN', '打开门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOpenTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '打开门票') WHERE LOWER(code) = LOWER('TktOpenTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCopyLink', JSON_OBJECT('en_US', 'Copy link', 'zh_CN', '复制链接'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCopyLink') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '复制链接') WHERE LOWER(code) = LOWER('TktCopyLink') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktLinkCopied', JSON_OBJECT('en_US', 'Link copied.', 'zh_CN', '链接已复制。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktLinkCopied') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '链接已复制。') WHERE LOWER(code) = LOWER('TktLinkCopied') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNameAttendee', JSON_OBJECT('en_US', 'Name attendee', 'zh_CN', '填写参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNameAttendee') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '填写参加者') WHERE LOWER(code) = LOWER('TktNameAttendee') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktChangeAttendee', JSON_OBJECT('en_US', 'Change attendee', 'zh_CN', '更改参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktChangeAttendee') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '更改参加者') WHERE LOWER(code) = LOWER('TktChangeAttendee') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAttendeeRequired', JSON_OBJECT('en_US', 'Enter the attendee''s name and a mobile number or an email.', 'zh_CN', '请输入参加者姓名,以及手机号码或电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入参加者姓名,以及手机号码或电子邮件。') WHERE LOWER(code) = LOWER('TktAttendeeRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPermissionRequired', JSON_OBJECT('en_US', 'Tick the box to confirm you have permission.', 'zh_CN', '请勾选以确认您已获得许可。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPermissionRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请勾选以确认您已获得许可。') WHERE LOWER(code) = LOWER('TktPermissionRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPermission', JSON_OBJECT('en_US', 'I have permission to share these details so their ticket can be sent', 'zh_CN', '我已获得许可分享这些资料,以便发送其门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPermission') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '我已获得许可分享这些资料,以便发送其门票') WHERE LOWER(code) = LOWER('TktPermission') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktRenameWarning', JSON_OBJECT('en_US', 'Saving gives this ticket a new link and QR code. The old ones stop working.', 'zh_CN', '保存后此门票将获得新的链接和二维码,旧的将失效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktRenameWarning') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存后此门票将获得新的链接和二维码,旧的将失效。') WHERE LOWER(code) = LOWER('TktRenameWarning') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveAttendee', JSON_OBJECT('en_US', 'Save attendee', 'zh_CN', '保存参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存参加者') WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesBlockTickets', JSON_OBJECT('en_US', 'Tickets', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesBlockTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('PagesBlockTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTicketsEvent', JSON_OBJECT('en_US', 'Event selling tickets', 'zh_CN', '售票活动'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTicketsEvent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '售票活动') WHERE LOWER(code) = LOWER('PagesTicketsEvent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesChooseTicketsEvent', JSON_OBJECT('en_US', 'Choose an event with tickets on', 'zh_CN', '选择已开启售票的活动'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesChooseTicketsEvent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '选择已开启售票的活动') WHERE LOWER(code) = LOWER('PagesChooseTicketsEvent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTicketsEventHint', JSON_OBJECT('en_US', 'Only events with tickets switched on are listed.', 'zh_CN', '仅列出已开启售票的活动。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTicketsEventHint') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '仅列出已开启售票的活动。') WHERE LOWER(code) = LOWER('PagesTicketsEventHint') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCreated', JSON_OBJECT('en_US', 'Created', 'zh_CN', '创建时间'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCreated') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '创建时间') WHERE LOWER(code) = LOWER('TktCreated') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNoOrders', JSON_OBJECT('en_US', 'No orders yet.', 'zh_CN', '尚无订单。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNoOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚无订单。') WHERE LOWER(code) = LOWER('TktNoOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderTitle', JSON_OBJECT('en_US', 'Ticket order', 'zh_CN', '门票订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票订单') WHERE LOWER(code) = LOWER('TktOrderTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderNamed', JSON_OBJECT('en_US', 'Order {reference}', 'zh_CN', '订单 {reference}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderNamed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单 {reference}') WHERE LOWER(code) = LOWER('TktOrderNamed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderNotFound', JSON_OBJECT('en_US', 'Order not found.', 'zh_CN', '找不到订单。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderNotFound') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '找不到订单。') WHERE LOWER(code) = LOWER('TktOrderNotFound') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktBackToOrders', JSON_OBJECT('en_US', 'Back to orders', 'zh_CN', '返回订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktBackToOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '返回订单') WHERE LOWER(code) = LOWER('TktBackToOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktActionFailed', JSON_OBJECT('en_US', 'The action failed. Try again.', 'zh_CN', '操作失败,请重试。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktActionFailed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '操作失败,请重试。') WHERE LOWER(code) = LOWER('TktActionFailed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktHoldUntil', JSON_OBJECT('en_US', 'Held until', 'zh_CN', '保留至'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktHoldUntil') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保留至') WHERE LOWER(code) = LOWER('TktHoldUntil') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaymentRef', JSON_OBJECT('en_US', 'Payment reference', 'zh_CN', '付款参考'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaymentRef') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款参考') WHERE LOWER(code) = LOWER('TktPaymentRef') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaidBy', JSON_OBJECT('en_US', 'Marked paid by', 'zh_CN', '标记付款者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaidBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '标记付款者') WHERE LOWER(code) = LOWER('TktPaidBy') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelledBy', JSON_OBJECT('en_US', 'Cancelled by', 'zh_CN', '取消者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelledBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消者') WHERE LOWER(code) = LOWER('TktCancelledBy') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktExpiredAt', JSON_OBJECT('en_US', 'Expired', 'zh_CN', '过期时间'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktExpiredAt') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '过期时间') WHERE LOWER(code) = LOWER('TktExpiredAt') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktResend', JSON_OBJECT('en_US', 'Resend email', 'zh_CN', '重新发送电邮'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktResend') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '重新发送电邮') WHERE LOWER(code) = LOWER('TktResend') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktEmailResent', JSON_OBJECT('en_US', 'Email sent again.', 'zh_CN', '电邮已重新发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktEmailResent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '电邮已重新发送。') WHERE LOWER(code) = LOWER('TktEmailResent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktMarkPaid', JSON_OBJECT('en_US', 'Mark paid', 'zh_CN', '标记为已付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktMarkPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '标记为已付款') WHERE LOWER(code) = LOWER('TktMarkPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktMarkedPaid', JSON_OBJECT('en_US', 'Order marked paid.', 'zh_CN', '订单已标记为已付款。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktMarkedPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已标记为已付款。') WHERE LOWER(code) = LOWER('TktMarkedPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelOrder', JSON_OBJECT('en_US', 'Cancel order', 'zh_CN', '取消订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelOrder') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消订单') WHERE LOWER(code) = LOWER('TktCancelOrder') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelOrderMessage', JSON_OBJECT('en_US', 'Cancel this order and free its seats? The buyer gets an email.', 'zh_CN', '取消此订单并释放座位?买家将收到电邮。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelOrderMessage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消此订单并释放座位?买家将收到电邮。') WHERE LOWER(code) = LOWER('TktCancelOrderMessage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderCancelled', JSON_OBJECT('en_US', 'Order cancelled.', 'zh_CN', '订单已取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderCancelled') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已取消。') WHERE LOWER(code) = LOWER('TktOrderCancelled') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelTicket', JSON_OBJECT('en_US', 'Cancel ticket', 'zh_CN', '取消门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消门票') WHERE LOWER(code) = LOWER('TktCancelTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelTicketMessage', JSON_OBJECT('en_US', 'Cancel this ticket, free its seat and lower the order total?', 'zh_CN', '取消此门票、释放座位并降低订单总额?'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelTicketMessage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消此门票、释放座位并降低订单总额?') WHERE LOWER(code) = LOWER('TktCancelTicketMessage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketCancelled', JSON_OBJECT('en_US', 'Ticket cancelled.', 'zh_CN', '门票已取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketCancelled') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已取消。') WHERE LOWER(code) = LOWER('TktTicketCancelled') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketType', JSON_OBJECT('en_US', 'Ticket type', 'zh_CN', '门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketType') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票类型') WHERE LOWER(code) = LOWER('TktTicketType') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketActive', JSON_OBJECT('en_US', 'Active', 'zh_CN', '有效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketActive') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '有效') WHERE LOWER(code) = LOWER('TktTicketActive') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketCancelledBy', JSON_OBJECT('en_US', 'Cancelled by {by}, {at}', 'zh_CN', '{by} 于 {at} 取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketCancelledBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '{by} 于 {at} 取消') WHERE LOWER(code) = LOWER('TktTicketCancelledBy') AND area = 'A';
UPDATE catalog_meta SET version = version + 1, updated_at = NOW() WHERE id = 1;
@@ -0,0 +1,211 @@
# Design
Product design: `docs/superpowers/specs/2026-12-04-event-ticketing-design.md` (approved 2026-12-04). This file holds the technical contracts for change 1 of 2.
## Context
- Events, event leads, QR registration, landing pages (`cms_page`) and the capacity count (`EventHeadcountService`) live in `solvway-services-counter`.
- `solvway-mobile-api` is the only door for the portal:
- admin endpoints are `/api/admin/**`, gated by module and scoped by company through `loadEvent`;
- public endpoints are `/api/public/**`, rate-limited in Redis through `PublicRegistrationService.limit`.
- The landing page FORM block is the model for TICKETS:
- `PublicPageService.page` enriches a block with `form` or `closed`;
- `PublicPageService.submit` checks the honeypot, applies `reg:submit:<event>:<ip>`, and posts to the counter.
- The api-gateway opens only listed public counter paths.
- The legacy Tastefully tables `orders`/`orders_details` exist and are unused. New tables use other names so the two are never confused.
## Goals / Non-Goals
**Goals:**
- Ticket settings and types.
- The TICKETS block.
- Orders with seat locking.
- The order page.
- Order emails.
- The expiry job.
- Staff order screens.
- The buyer as an event lead.
- Held tickets in the capacity count.
**Non-Goals (change 2, `add-event-tickets`):**
- Ticket QR codes and the `/t/` page.
- Naming attendees and consent.
- Ticket emails.
- Door and self check-in for tickets.
- Invites counted as free tickets.
- Ticket numbers in attendance.
The `ticket` row and its `code` column are created now, so change 2 adds no table.
## Decisions
### 1. Data (SQL in `sql/`)
`01-event-ticket-orders.sql` (service-counter, additive):
- **`event`** gains:
- `tickets_enabled` bit NOT NULL DEFAULT 0;
- `payment_instructions` varchar(1000) NULL;
- `hold_days` int NOT NULL DEFAULT 3.
- **`ticket_type`:**
- Columns: id, company_id, event_uuid, name varchar(80), price_sen int, quantity int, sales_end_date date NULL, sort int, enabled bit, plus the created and updated fields.
- Unique key `(event_uuid, name)`.
- **`shop_order`:**
- Columns:
- id, company_id, event_uuid NULL (null is reserved for a later standalone shop);
- reference varchar(12), token varchar(32);
- buyer_name varchar(100), buyer_email varchar(254), buyer_mobile_e164 varchar(20) NULL, buyer_company varchar(150) NULL;
- lead_id, event_lead_id;
- status varchar(20), total_sen int, hold_until datetime;
- paid_at, paid_by, payment_ref varchar(100), cancelled_at, cancelled_by, expired_at;
- consent_at, consent_notice_id, page_path, utm_source, utm_medium, utm_campaign;
- last_email varchar(20), created_at.
- Unique keys `(company_id, reference)` and `(token)`.
- Indexes `(event_uuid, status)`, `(status, hold_until)` and `(event_uuid, buyer_email, status)`.
- **`shop_order_line`:**
- Columns: id, order_id, kind varchar(10) (`TICKET`; `PICKUP` and `SHIP` are reserved), item_id (the ticket_type id), name varchar(80), unit_price_sen, quantity.
- **`ticket`:**
- Columns: id, company_id, event_uuid, order_id, order_line_id, ticket_type_id, code varchar(32) NULL, attendee_name, attendee_mobile_e164, attendee_email, event_lead_id, status varchar(10) (`ACTIVE` or `CANCELLED`), cancelled_at, cancelled_by, checked_in_at, checked_in_by.
- Index `(ticket_type_id, status)`.
- `code` and the attendee and check-in columns stay null until change 2.
`02-event-tickets-module.sql` (service-system) inserts `(41160000, 'BO_EVENT_TICKETS', 'Event tickets', 'BO', 'M', 40000000, NULL, NULL)`. No role gets it by default.
Both files are mirrored in `local/seed/03-colite.sql`. `99-rollback.sql` drops the new tables and columns, and the module.
**Money** is integer sen everywhere; the portal formats it as `RM 1,234.00`. **References** are `T-` plus 6 characters from `23456789ABCDEFGHJKMNPQRSTUVWXYZ`, retried on a unique-key clash. **Tokens** are 22 URL-safe base64 characters from `SecureRandom`, the same shape as invite tokens.
### 2. Seat locking
`TicketOrderService.request` runs in one transaction:
1. Load the event `FOR UPDATE` (`@Lock(PESSIMISTIC_WRITE)`). Every request for the event is serialised there. A request takes milliseconds, and per-event volume is low.
2. Check the event:
- the event is open;
- each type is enabled and within its sales end date;
- the awaiting-payment count for the email is below 3.
3. Compute held seats per type with one grouped count over `ticket` joined to `shop_order` where the ticket is `ACTIVE` and the order is `AWAITING` or `PAID`.
4. Check each type's seats, then the event capacity before the event days. Registered guests plus walk-ins come from `EventHeadcountService`; held tickets come from the same count.
5. Insert the order, its lines and its tickets.
Staff "mark paid" on an Expired order, and a type's quantity edit, take the same event lock.
`EventHeadcountService` gains `heldTickets`, and the invite registration's capacity check adds it (the MODIFIED requirement).
- *Rejected:* optimistic version counters per type. There would be more retry code, for no benefit at this volume.
- *Rejected:* a stored seats-left column. It can drift, while a count is always right.
### 3. services-counter endpoints
All take JSON. `companyId` is always concrete and is set by mobile-api.
- **Settings:**
- `POST /counter/ticketType/settings {companyId, eventUuid, ticketsEnabled, paymentInstructions, holdDays, doneBy}`. It returns 400 `PAYMENT_INSTRUCTIONS_REQUIRED`, `PAYMENT_INSTRUCTIONS_TOO_LONG` or `HOLD_DAYS_INVALID`.
- `event/save` keeps the stored ticket settings on every edit, and starts a new event with tickets off. This is so a mobile-api event edit, which round-trips the whole event, can never reset them.
- **Ticket types:**
- `POST /counter/ticketType/list {companyId, eventUuid}` returns `[{id, name, priceSen, quantity, salesEndDate, sort, enabled, held, left}]`.
- `POST /counter/ticketType/save {companyId, eventUuid, id?, name, priceSen, quantity, salesEndDate, sort, enabled, doneBy}` returns 409 `QUANTITY_BELOW_HELD` or `NAME_TAKEN`.
- `POST /counter/ticketType/delete {companyId, eventUuid, id, doneBy}` returns 409 `TYPE_HAS_ORDERS`.
- **Public request:**
- `POST /counter/ticketOrder/request {companyId, eventUuid, lines:[{ticketTypeId, quantity}], buyerName, buyerEmail, buyerMobileE164, buyerCompany, consentNoticeId, consentAt, pagePath, utmSource, utmMedium, utmCampaign}`.
- It returns `{reference, token, status, totalSen, holdUntil, lines, paymentInstructions}`.
- It returns 409 with one of these codes:
- `TICKETS_CLOSED`;
- `TYPE_UNAVAILABLE {ticketTypeId, name, left}`;
- `EVENT_FULL {left}`;
- `TOO_MANY_AWAITING`;
- `BAD_QUANTITY`.
- After the insert, it captures the buyer with `RegistrationService.register`, using source `TICKET`, no salesperson, the page path and UTM, and an `orderReference` that is written to the notes when the event lead already existed. It then stores `lead_id` and `event_lead_id` on the order.
- A total of 0 sets the order `PAID` with `paid_by = 'system'`.
- **Public order page:**
- `GET /counter/ticketOrder/byToken/{token}` returns `{companyId, eventUuid, reference, status, buyerName, totalSen, holdUntil, createdAt, lines}`, or 404.
- **Staff:**
- `POST /counter/ticketOrder/list {companyId, eventUuid, status?, q?, page, size≤50}` returns a page of `{id, reference, buyerName, buyerEmail, tickets, totalSen, status, createdAt}`, newest first.
- `POST /counter/ticketOrder/get {companyId, orderId}` returns the full order with lines, tickets, buyer, payment and state history fields.
- `POST /counter/ticketOrder/markPaid {companyId, orderId, paymentRef, doneBy}` returns 409 `NOT_PAYABLE` or `SEATS_GONE`.
- `POST /counter/ticketOrder/cancel {companyId, orderId, doneBy}` returns 409 `NOT_CANCELLABLE`.
- `POST /counter/ticketOrder/cancelTicket {companyId, orderId, ticketId, doneBy}` returns 409 `LAST_TICKET` or `NOT_CANCELLABLE`.
- `POST /counter/ticketOrder/resend {companyId, orderId}`.
- **Expiry job:**
- `TicketOrderExpiryJob` runs `@Scheduled(cron = "${tickets.expiry.cron:0 */10 * * * *}")`, which is within the spec's 15 minutes.
- It moves `AWAITING` orders with `hold_until < now` to `EXPIRED` in batches of 100. Each order is a conditional update `WHERE status='AWAITING'`, so it never races with mark paid.
- It queues the expired email.
### 4. Order emails (services-counter)
- **Sender:** `TicketOrderMailer` sends the emails after commit (`TransactionSynchronization.afterCommit`, as `StaffNotifier` does) through the existing counter `EmailService.send`, which goes to services-email. They are recorded in Emails, with `companyId` set to the event's company.
- **Content:**
- Every user value is HTML-escaped.
- The text is English, then Bahasa Malaysia, as the invite email is.
- The link is `<app.admin-portal-base-url>/o/<token>`. This is a new counter setting. Only the local profile has a default (`http://localhost:3001`); elsewhere it is required.
- **Record:** `last_email` records the latest kind (`RECEIVED`, `PAID`, `EXPIRED` or `CANCELLED`), so resend sends that kind again.
- **Failures:** they are logged with the order id only, and never roll back the order.
### 5. Landing page block (services-counter and mobile-api)
- **`CmsBlockValidator` TICKETS:**
- `eventUuid` is required, belongs to the company, and is enabled, not ended and `tickets_enabled`.
- `heading` is at most 120 characters, `text` at most 1000.
- `eyebrow`, `look` and `anchor` are allowed.
- Every other field is refused with `PagesUnusedField`.
- **`PublicPageService.page`:** for a TICKETS block it adds `tickets: {eventName, startDate, endDate, location, notice, types:[{id, name, priceSen, left, state: ON_SALE|SOLD_OUT|ENDED}]}` when the event accepts requests, else `closed: true`.
- **`POST /api/public/pages/{company}/{slug}/tickets/{block}`:**
- It follows `submit`: the same `page:load` and `reg:submit:<event>:<ip>` limits, the honeypot, and consent from the company's current notice.
- It normalises the inputs with the `PublicRegistrationService` helpers, then posts to counter `ticketOrder/request`.
- On the honeypot it returns a fake success without a token, and the portal shows the thank-you without a link.
- **`GET /api/public/orders/{token}`:**
- It checks the token shape first, then applies `ord:load:<ip>` at 120 per 10 minutes.
- It returns the order with the event's name, dates and location, and the payment instructions only while `AWAITING`. Otherwise it gives 404 `ORDER_INVALID`.
- **Public types:**
- `GET /counter/ticketType/onSale/{eventUuid}` returns only `{ticketsOpen, paymentInstructions, types:[{id, name, priceSen, left, state}]}` for enabled types.
- mobile-api's public calls run without a user token, so they pass through the api-gateway's public path list, as `registration/register` and `cmsPage/findPublished` do.
- The staff `ticketType/list`, which needs a company, stays closed.
- **Gateway:** open these anchored pairs in `JWTAuthFilter`:
- `POST /counter/ticketOrder/request`;
- `GET /counter/ticketOrder/byToken/[A-Za-z0-9_-]{22}`;
- `GET /counter/ticketType/onSale/\d{1,19}`.
### 6. mobile-api admin
- **Endpoints,** gated by `BO_EVENT_TICKETS`, with the company scope from `loadEvent` and `@Audited`:
- `GET` and `PUT /api/admin/events/{uuid}/tickets/settings`;
- `GET`, `POST`, `PUT` and `DELETE /api/admin/events/{uuid}/ticket-types[/{id}]`;
- `GET /api/admin/events/{uuid}/orders?status&q&page`;
- `GET /api/admin/events/{uuid}/orders/{orderId}`;
- `POST /api/admin/events/{uuid}/orders/{orderId}/paid {paymentRef}`;
- `POST .../cancel`, `POST .../tickets/{ticketId}/cancel` and `POST .../resend`.
- **Scoping:** the order is fetched with `companyId` and must belong to `{uuid}`, else 404.
- **Event GET:** it gains `ticketsEnabled` for every reader, so the portal knows when to show the section.
### 7. Portal
- **Event page:**
- A **Tickets** section shows when the user has `BO_EVENT_TICKETS`. It holds the settings form, the ticket types table (with add, edit and disable or delete), and a link to the orders.
- Orders are at `/events/[uuid]/orders`, a listing with a filter and search, and `/events/[uuid]/orders/[orderId]`, the detail page with its actions and confirm dialogs.
- `ROUTE_MODULES` maps both pages to `BO_EVENT_TICKETS`.
- **TICKETS block:**
- It is rendered in `CmsBlocks.tsx` as `TicketsBlock`, with types, quantity steppers, the running total, the buyer fields and the consent. It reuses the `RegistrationForm` field and consent pieces, plus a thank-you state.
- The editors add it to `BLOCK_TYPES`, `emptyBlock` and `BlockFields`, with an event picker limited to events with tickets on, using `ticketsEnabled` from the events list.
- The canvas shows the real types through the preview data.
- **Order page:** `/o/[token]` is public in `routeGuard`, sharing the pattern for `/r/`, `/i/` and `/c/`. Its proxy is `app/api/public/orders/[token]`, which forwards the last X-Forwarded-For hop as the other proxies do.
- **Labels** in `defaultMessages.ts` and `zh_CN.seed.json`, plus `sql/03-*-labels.sql` cut from `npm run i18n:sql`.
## Risks / Trade-offs
- **Event row lock under a rush.** Requests for one event are serialised. That is fine at the expected volume (hundreds per minute). The upgrade path was agreed with the owner on 2026-12-04:
1. A conditional single-statement seat update (`... WHERE held + n <= quantity`), with no event lock.
2. Then a Redis seat counter backed by the database, a CDN-cached event page, a CAPTCHA and a load test.
3. At concert scale: a virtual waiting room, queued order allocation, member-only sales, and ticketing as its own service.
Seats are counted from `ticket` rows on one table, so step 1 is a local change.
- **Seat hoarding.** One email can hold up to 30 seats (3 orders × 10) for the hold days, and many emails can hold more. This is mitigated by the IP limit, the honeypot and staff cancel. A CAPTCHA is deferred.
- **Emails in English and BM only,** matching invites. The zh-CN email text is deferred with the rest of the email localisation.
- **Expired orders may still be paid.** Staff can rescue them only while their seats are free. This is refused clearly otherwise.
## Migration Plan
1. Run `sql/01` and `sql/02` before the new images go live. Only new tables and defaulted columns are added, so the running images are unaffected.
2. Set `app.admin-portal-base-url` on services-counter.
3. Deploy services-counter, mobile-api, api-gateway and admin-portal together.
4. A super admin grants Event tickets to the right roles.
5. Rollback: deploy the previous images; `99-rollback.sql` only if the data should go too.
@@ -0,0 +1,70 @@
# Proposal
## Why
Co-Lite is growing from an event lead-capture tool into an event hosting platform. Some events are free and some are paid. Paid events need tickets: an organiser sets ticket types and prices, and visitors request tickets on the event's landing page. There is no payment gateway yet. Buyers pay outside Co-Lite and staff mark the order paid. Every buyer still becomes a lead on the event, so paid events feed the sales pipeline just as free ones do.
The product design was approved on 2026-12-04: `docs/superpowers/specs/2026-12-04-event-ticketing-design.md`. This is the first of two changes. It covers the order side. The second change, `add-event-tickets`, covers QR tickets, naming attendees, consent and check-in at the door.
## What Changes
- **Event ticket settings:**
- Events gain a Tickets switch, which is off by default. While it is off, the event behaves exactly as today.
- Ticketed events also gain payment instructions and hold days (1 to 14, default 3).
- **Ticket types per event:** each has a name, a price in MYR (0 or more), a quantity, an optional sales end date, a sort order and an enabled flag.
- A type with orders cannot be deleted, only disabled.
- A type's quantity cannot drop below the seats it already holds.
- **New landing-page block TICKETS:**
- It shows the event's ticket types with price and seats left.
- It takes quantities, up to 10 per order, and the buyer's details with the privacy consent.
- It creates an order and shows a thank-you with the payment instructions and the order link.
- **Orders:**
- An order holds lines, one per ticket type, and one ticket row per seat. The line has a `kind` column, `TICKET` for now, so merch can be added later.
- Order states: Awaiting payment, Paid, Cancelled and Expired. Orders that total RM 0 are Paid at once.
- Seats are locked so ticket types never oversell. Held tickets count toward event capacity before the event days.
- At most 3 orders per email per event may await payment at once.
- **Order page:** a public page at `/o/<token>` shows the order's status, lines, total, payment instructions and hold expiry.
- **Expiry job:** a scheduled job expires unpaid orders after the hold and frees their seats.
- **Emails:** order received, order paid, order expired and order cancelled. "Order paid" confirms payment only; the tickets come with change 2.
- **Staff Tickets section on the event, under the new permission `BO_EVENT_TICKETS`:**
- the ticket settings and ticket types;
- an orders list and an order detail page, with these actions: mark paid (with an optional payment reference), cancel order, cancel ticket, and resend email.
- Every action is audited.
- **Buyer as a lead:** the buyer becomes an event lead with the new source `TICKET`, matched as in QR registration.
- **Capacity:** "Capacity before the event" now also counts held tickets.
## Capabilities
### New Capabilities
- `event-ticketing`: ticket types, ticket orders, the order page, order emails, hold expiry and the staff order screens.
### Modified Capabilities
- `landing-pages`: new TICKETS block.
- `event-invitations`: "Capacity before the event" counts held tickets.
- `event-attendance`: walk-ins leave out ticket buyers; the numbers show held tickets, and the total includes them.
## Impact
- **SQL:**
- service-counter: new tables `ticket_type`, `shop_order`, `shop_order_line` and `ticket`; new event columns `tickets_enabled`, `payment_instructions` and `hold_days`.
- service-system: new module `BO_EVENT_TICKETS`.
- **solvway-services-counter:**
- ticket entities and services;
- order creation with seat locking;
- the expiry job;
- `CmsBlockValidator` (TICKETS);
- the capacity count in `EventHeadcountService` and the invite registration.
- **solvway-mobile-api:**
- admin ticket endpoints;
- public TICKETS submit and order page endpoints, with their limits;
- order emails;
- public page data for TICKETS.
- **solvway-api-gateway:** open the new public counter paths.
- **solvway-admin-portal:**
- the Tickets section on the event, plus the order list and detail pages;
- the TICKETS block in the renderer and both editors;
- the `/o/[token]` page and its proxy;
- labels in English and zh-CN.
- **No new dependencies.**
@@ -0,0 +1,17 @@
## MODIFIED Requirements
### Requirement: Event attendance numbers
The event page SHALL show invited guests (against the cap), registered guests, attended event leads, walk-ins (event leads linked to no guest and not created by a ticket order), held tickets (only when the event sells tickets), and a total of registered plus walk-ins plus held tickets (against capacity). The numbers SHALL agree with the guest list and event leads listing, and a total above capacity SHALL be shown.
#### Scenario: Numbers
- **GIVEN** `KL Expo` has capacity 100, cap 50, 40 guests of whom 30 registered and 20 attended, plus 15 walk-ins of whom 15 attended
- **WHEN** an admin opens the event page
- **THEN** the event page shows invited 40 of 50, registered 30, attended 35, walk-ins 15, total 45 of 100
#### Scenario: Ticket buyers are not walk-ins
- **GIVEN** `KL Hotel Tech Day` has 2 walk-ins, and a buyer whose order holds 3 tickets
- **WHEN** an admin opens the event page
- **THEN** the page shows walk-ins 2, held tickets 3, total 5
@@ -0,0 +1,23 @@
## MODIFIED Requirements
### Requirement: Capacity before the event
When an event has a capacity, invite registrations and ticket requests SHALL be refused before the event days once registered guests plus walk-in event leads plus held tickets would exceed it; an invite shows "This event is full". On the event days (Malaysia, start through end date) nothing SHALL be refused for capacity, though ticket types keep their own seats. Staff capture SHALL never be refused for capacity.
#### Scenario: Full before the event
- **GIVEN** `KL Expo` starts next week, has capacity 2, and two registered guests
- **WHEN** a third guest submits their invite
- **THEN** the page says the event is full and nothing is saved
#### Scenario: Not refused on the day
- **GIVEN** the same event on its first day
- **WHEN** the third guest submits their invite
- **THEN** they are registered
#### Scenario: Held tickets fill the event
- **GIVEN** `KL Expo` starts next week, has capacity 10, one registered guest and 9 held tickets
- **WHEN** another guest submits their invite
- **THEN** the page says the event is full and nothing is saved
@@ -0,0 +1,248 @@
## ADDED Requirements
### Requirement: Ticket Settings On An Event
An event SHALL have a Tickets switch that is off by default, payment instructions of up to 1000 characters, and hold days from 1 to 14 that default to 3. Only users with `BO_EVENT_TICKETS` SHALL change them. While the switch is off, the event SHALL behave as it did before this change, and no ticket order SHALL be accepted for it. Turning the switch on SHALL require payment instructions.
#### Scenario: Turn tickets on
- **WHEN** a user with `BO_EVENT_TICKETS` turns Tickets on for `KL Hotel Tech Day` with payment instructions `Maybank 5140 1234 5678, ref your order number` and hold days 3
- **THEN** the event shows Tickets on with those instructions and 3 hold days
#### Scenario: Instructions required
- **WHEN** a user turns Tickets on with empty payment instructions
- **THEN** the save is refused on the payment instructions field and nothing changes
#### Scenario: Hold days out of range
- **WHEN** a user saves hold days 15
- **THEN** the save is refused on the hold days field
#### Scenario: Without the permission
- **GIVEN** a user has `BO_EVENTS` but not `BO_EVENT_TICKETS`
- **WHEN** they open the event
- **THEN** they do not see the Tickets section
### Requirement: Ticket Types
A ticketed event SHALL have zero or more ticket types. Each type SHALL have a name of 1 to 80 characters unique within the event, a price in MYR from 0.00 to 99999.99 in whole sen, a quantity of at least 1, an optional sales end date (empty means the event's end date), a sort order and an enabled flag.
#### Scenario: Add types
- **WHEN** staff add `Early bird` at RM 150.00 quantity 20 and `General` at RM 250.00 quantity 100
- **THEN** both types are listed in sort order with their prices and 20 and 100 seats left
### Requirement: Ticket Type Changes
A type with any order SHALL NOT be deleted, only disabled. A type's quantity SHALL NOT be set below the seats it holds. A price change SHALL apply only to orders made after it.
#### Scenario: Type with orders cannot be deleted
- **GIVEN** `Early bird` has an order
- **WHEN** staff delete it
- **THEN** the delete is refused with "This ticket type has orders. Disable it instead."
#### Scenario: Quantity below held seats
- **GIVEN** `Early bird` holds 12 seats
- **WHEN** staff set its quantity to 10
- **THEN** the save is refused on the quantity field
#### Scenario: Price change keeps old orders
- **GIVEN** an order holds 2 `General` tickets at RM 250.00
- **WHEN** staff change `General` to RM 280.00
- **THEN** that order still totals RM 500.00
### Requirement: Seats Held
A ticket SHALL hold a seat while its order is Awaiting payment or Paid and the ticket is not cancelled. A type's seats left SHALL be its quantity minus the seats it holds. Requests SHALL never cause a type to hold more seats than its quantity, including when requests arrive at the same moment. When the event has a capacity, a request made before the event days SHALL be refused if held tickets plus registered guests plus walk-in event leads would exceed it.
#### Scenario: Last seat taken once
- **GIVEN** `VIP` has 1 seat left
- **WHEN** two visitors request 1 `VIP` ticket at the same moment
- **THEN** one order is created and the other request is told `VIP` has only 0 left
#### Scenario: Expired order frees seats
- **GIVEN** an Awaiting-payment order holds 3 `General` tickets
- **WHEN** it expires
- **THEN** `General` shows 3 more seats left
#### Scenario: Event capacity
- **GIVEN** `KL Hotel Tech Day` starts next week with capacity 50, 45 held tickets and 3 registered guests
- **WHEN** a visitor requests 3 tickets
- **THEN** the request is refused with "Only 2 places are left for this event"
### Requirement: Ticket Request
A ticket request SHALL carry a quantity per ticket type from 0 to 10 with a total from 1 to 10, the buyer's name and email (both required), an optional mobile and company, and the privacy notice consent (required). Inputs SHALL be normalised and limited as in staff capture. An accepted request SHALL create one order with a line per type keeping its name and price at the time, one ticket per seat, an order reference unique within the company, and an unguessable link token.
#### Scenario: Request two types
- **WHEN** a visitor requests 2 `General` and 1 `VIP` as `Aisyah`, `aisyah@example.test`, and ticks the consent
- **THEN** an order with 3 tickets totalling RM 1000.00 is Awaiting payment
- **AND** the thank-you shows its reference, lines, total, payment instructions, hold expiry and a "View your order" link
#### Scenario: Missing email or consent
- **WHEN** a visitor submits without an email, or without ticking the consent
- **THEN** nothing is saved and the error shows under that field
### Requirement: Ticket Request Refusals
A request SHALL be refused, saving nothing, when a requested type is disabled, past its sales end date or short of seats, naming the type and its seats left. A request SHALL be accepted only while the event has Tickets on, is enabled, has not passed its end date in Malaysia time, and its company has a privacy notice.
#### Scenario: Over ten
- **WHEN** a visitor requests 11 tickets
- **THEN** the request is refused and nothing is saved
#### Scenario: Sales ended for a type
- **GIVEN** `Early bird` sales ended yesterday
- **WHEN** a visitor requests 1 `Early bird`
- **THEN** the request is refused naming `Early bird`
#### Scenario: Tickets turned off
- **GIVEN** staff turned Tickets off for `KL Hotel Tech Day`
- **WHEN** a visitor submits a request
- **THEN** the request is refused and nothing is saved
### Requirement: Free Orders
An order whose total is RM 0.00 SHALL be Paid when it is created, without staff action. Its thank-you page and email SHALL say the order is confirmed and SHALL NOT show payment instructions.
#### Scenario: Free ticket type
- **GIVEN** `Community pass` is priced RM 0.00
- **WHEN** a visitor requests 2 `Community pass`
- **THEN** the order is Paid at once and the thank-you says it is confirmed
### Requirement: Awaiting-Payment Limit Per Buyer
An email SHALL have at most 3 orders Awaiting payment per event. A further request SHALL be refused with "You already have orders awaiting payment for this event." and nothing SHALL be saved.
#### Scenario: Fourth unpaid order
- **GIVEN** `aisyah@example.test` has 3 orders Awaiting payment for `KL Hotel Tech Day`
- **WHEN** she requests another ticket
- **THEN** the request is refused with that message
### Requirement: Order States
An order SHALL be in one of four states:
- **Awaiting payment.**
- **Paid.**
- **Cancelled.**
- **Expired.**
An order Awaiting payment SHALL hold its seats until its hold expiry, which is the creation time plus the event's hold days at the time of the request. After the hold expiry it SHALL become Expired within 15 minutes. Paid, Cancelled and Expired orders SHALL never expire.
#### Scenario: Hold runs out
- **GIVEN** an order made on 1 December at 10:00 with 3 hold days is still Awaiting payment
- **WHEN** it is 4 December 10:15
- **THEN** the order is Expired and its seats are free
### Requirement: Buyer Becomes An Event Lead
An accepted request SHALL match the buyer to a lead with the QR registration rules, including the existing-lead notes, and create the buyer's event lead with source TICKET, no salesperson, the consent time and notice version, and the page address and UTM values as for a FORM block. A buyer already captured at the event SHALL change nothing on that event lead except a note naming the order reference. These event leads SHALL appear in every lead listing, export and the dashboard.
#### Scenario: New buyer
- **WHEN** `Aisyah`, unknown to INS, requests tickets
- **THEN** staff see `Aisyah` in the event's leads with source Ticket, NEW and OPEN
#### Scenario: Buyer already captured
- **GIVEN** `Aisyah` registered at `KL Hotel Tech Day` through the QR code
- **WHEN** she requests tickets
- **THEN** her event lead keeps source QR, and its notes name the order reference
### Requirement: Order Page
The order link `/o/<token>` SHALL show:
- the event's name, dates and location;
- the order reference, lines, total, state and creation time;
- while Awaiting payment, the payment instructions and hold expiry.
It SHALL show the buyer's name but no other personal details. An unknown token SHALL show "This order link is not valid." The page SHALL be limited to 120 loads per IP per 10 minutes.
#### Scenario: Unpaid order page
- **GIVEN** order `T-7K3M9Q` is Awaiting payment
- **WHEN** the buyer opens its link
- **THEN** the page shows the lines, total, payment instructions and hold expiry
#### Scenario: Unknown link
- **WHEN** a visitor opens `/o/` with an unknown token
- **THEN** the page says the order link is not valid and shows nothing else
### Requirement: Order Emails
The buyer SHALL get an email when their order is created (lines, total, payment instructions, hold expiry and order link), becomes Paid (a confirmation with lines, total and order link), Expires, or is Cancelled by staff. Each email SHALL be recorded in Emails. A failed send SHALL NOT undo the order change, and staff SHALL be able to resend the latest email of an order.
#### Scenario: Order received email
- **WHEN** `Aisyah` requests tickets
- **THEN** she receives an email with the order reference, payment instructions, hold expiry and order link
#### Scenario: Paid email
- **WHEN** staff mark her order Paid
- **THEN** she receives a confirmation email
### Requirement: Staff Order Screens
The event's Tickets section SHALL list the event's orders with reference, buyer name, email, ticket count, total, state and creation time, newest first in pages of 50, filterable by state and searchable by reference, name, email or mobile. The order detail SHALL show the lines, tickets, buyer details, payment reference, and who changed the state and when. A user without `BO_EVENT_TICKETS` SHALL NOT see or reach these screens.
#### Scenario: Company separation
- **WHEN** INS staff open an order of a CV event by its address
- **THEN** they get not found
### Requirement: Staff Order Actions
Users with `BO_EVENT_TICKETS` SHALL be able to mark an order paid with an optional payment reference of up to 100 characters (when Awaiting payment, or Expired with all its seats still available), cancel an order that is Awaiting payment or Paid (freeing its seats), cancel one ticket of such an order that has another uncancelled ticket (freeing the seat and lowering the total), and resend the latest order email. Each action SHALL be written to the admin audit log.
#### Scenario: Mark paid with reference
- **GIVEN** order `T-7K3M9Q` is Awaiting payment
- **WHEN** staff mark it paid with reference `MBB 0412 883`
- **THEN** the order is Paid with that reference, their name and the time
- **AND** the audit log records the action
#### Scenario: Expired order after its seats were taken
- **GIVEN** order `T-7K3M9Q` expired, and its `VIP` seat was then taken by another order
- **WHEN** staff mark it paid
- **THEN** the action is refused with "Not enough seats left to confirm this order" and the order stays Expired
#### Scenario: Cancel one ticket
- **GIVEN** a Paid order holds 3 `General` tickets at RM 250.00
- **WHEN** staff cancel one ticket
- **THEN** the order holds 2 tickets, totals RM 500.00, and `General` has one more seat left
### Requirement: Ticket Request Abuse Limits
Ticket requests SHALL follow the QR registration limits: at most 60 requests per client IP per event in 10 minutes, answered above the limit with "Too many registrations from this device. Try again later." A request that fills the hidden honeypot field SHALL get the normal thank-you page and save nothing.
#### Scenario: Too many requests
- **WHEN** one IP submits 61 ticket requests for an event within 10 minutes
- **THEN** the 61st is refused with "Too many registrations from this device. Try again later."
#### Scenario: Honeypot filled
- **WHEN** a request fills the hidden honeypot field
- **THEN** the thank-you page shows and no order is saved
@@ -0,0 +1,31 @@
## ADDED Requirements
### Requirement: Tickets Block
A page MAY hold TICKETS blocks. The page SHALL show each enabled ticket type of the block's event in sort order with its name, its price as `RM 150.00` or `Free`, and its seats left or "Sold out" or "Sales ended", a quantity picker per type with an order total of at most 10, the running total, the buyer's fields and the privacy consent. When the event no longer accepts requests, the block SHALL say ticket sales are closed and the rest of the page SHALL still show.
#### Scenario: Visitor sees ticket types
- **GIVEN** a published page with a TICKETS block for `KL Hotel Tech Day`, whose types are `Early bird` RM 150.00 with 12 left, `General` RM 250.00 with 80 left, and `VIP` RM 500.00 sold out
- **WHEN** a visitor opens the page
- **THEN** the block lists the three types with their prices, shows "Sold out" for `VIP`, and offers no quantity for `VIP`
#### Scenario: Sales closed
- **GIVEN** the event of a TICKETS block ended yesterday
- **WHEN** a visitor opens the page
- **THEN** the block says ticket sales are closed and the other blocks still show
### Requirement: Tickets Block Fields
A TICKETS block SHALL name one event of the page's company that is enabled, not ended and has Tickets on when saved. It MAY have a heading (120 characters), text (1000 characters), a section label, a look and a link name. The server SHALL refuse any other field. Both editors SHALL offer the block and pick its event from the company's events that qualify.
#### Scenario: Event without tickets
- **WHEN** staff save a TICKETS block for an event whose Tickets switch is off
- **THEN** the save is refused on that block's event field
#### Scenario: Add a tickets block in the editor
- **WHEN** staff add a Tickets section in the on-page editor and pick `KL Hotel Tech Day`
- **THEN** the canvas shows that event's ticket types
@@ -0,0 +1,99 @@
-- Co-Lite change add-event-ticket-orders: ticket settings, ticket types, orders and tickets (design decision 1).
-- Target: `service-counter`. Additive only. Run before the new images go live. Needs a user that may alter tables.
-- Money is integer sen. `shop_order` / `shop_order_line` stay apart from the legacy Tastefully `orders` tables.
USE `service-counter`;
ALTER TABLE `event`
ADD COLUMN `tickets_enabled` tinyint(1) NOT NULL DEFAULT 0,
ADD COLUMN `payment_instructions` varchar(1000) NULL,
ADD COLUMN `hold_days` int NOT NULL DEFAULT 3;
CREATE TABLE IF NOT EXISTS `ticket_type` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`name` varchar(80) NOT NULL,
`price_sen` int NOT NULL,
`quantity` int NOT NULL,
`sales_end_date` date NULL,
`sort` int NOT NULL DEFAULT 0,
`enabled` tinyint(1) NOT NULL DEFAULT 1,
`created_by` varchar(255) NULL,
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP,
`updated_by` varchar(255) NULL,
`updated_at` datetime NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ticket_type_name` (`event_uuid`, `name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `shop_order` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint NOT NULL,
`event_uuid` bigint NULL COMMENT 'Null is reserved for a later standalone shop',
`reference` varchar(12) NOT NULL,
`token` varchar(32) NOT NULL,
`buyer_name` varchar(100) NOT NULL,
`buyer_email` varchar(254) NOT NULL,
`buyer_mobile_e164` varchar(20) NULL,
`buyer_company` varchar(150) NULL,
`lead_uuid` bigint NULL,
`event_lead_uuid` bigint NULL,
`status` varchar(20) NOT NULL COMMENT 'AWAITING, PAID, CANCELLED, EXPIRED',
`total_sen` int NOT NULL,
`hold_until` datetime NULL,
`paid_at` datetime NULL,
`paid_by` varchar(255) NULL,
`payment_ref` varchar(100) NULL,
`cancelled_at` datetime NULL,
`cancelled_by` varchar(255) NULL,
`expired_at` datetime NULL,
`consent_at` datetime NULL,
`consent_notice_id` bigint NULL,
`page_path` varchar(200) NULL,
`utm_source` varchar(100) NULL,
`utm_medium` varchar(100) NULL,
`utm_campaign` varchar(100) NULL,
`last_email` varchar(20) NULL COMMENT 'RECEIVED, PAID, EXPIRED, CANCELLED',
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_shop_order_reference` (`company_id`, `reference`),
UNIQUE KEY `uk_shop_order_token` (`token`),
KEY `idx_shop_order_event_status` (`event_uuid`, `status`),
KEY `idx_shop_order_hold` (`status`, `hold_until`),
KEY `idx_shop_order_buyer` (`event_uuid`, `buyer_email`, `status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `shop_order_line` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint NOT NULL,
`kind` varchar(10) NOT NULL COMMENT 'TICKET; PICKUP and SHIP reserved for merch',
`item_id` bigint NOT NULL COMMENT 'ticket_type.id for TICKET',
`name` varchar(80) NOT NULL,
`unit_price_sen` int NOT NULL,
`quantity` int NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_shop_order_line_order` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `ticket` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint NOT NULL,
`event_uuid` bigint NOT NULL,
`order_id` bigint NOT NULL,
`order_line_id` bigint NOT NULL,
`ticket_type_id` bigint NOT NULL,
`code` varchar(32) NULL COMMENT 'QR code, issued by add-event-tickets',
`attendee_name` varchar(100) NULL,
`attendee_mobile_e164` varchar(20) NULL,
`attendee_email` varchar(254) NULL,
`event_lead_uuid` bigint NULL,
`status` varchar(10) NOT NULL DEFAULT 'ACTIVE' COMMENT 'ACTIVE, CANCELLED',
`cancelled_at` datetime NULL,
`cancelled_by` varchar(255) NULL,
`checked_in_at` datetime NULL,
`checked_in_by` varchar(255) NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ticket_code` (`code`),
KEY `idx_ticket_type_status` (`ticket_type_id`, `status`),
KEY `idx_ticket_order` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@@ -0,0 +1,6 @@
-- Co-Lite change add-event-ticket-orders: permission-only module for ticket settings, ticket types and orders.
-- Target: `service-system`. No role gets it by default; a super admin grants it under Roles.
USE `service-system`;
INSERT INTO `module` (`id`, `name`, `desc`, `area`, `type`, `parent`, `url`, `icon_name`) VALUES
(41160000, 'BO_EVENT_TICKETS', 'Event tickets', 'BO', 'M', 40000000, NULL, NULL);
@@ -0,0 +1,221 @@
-- The labels added by add-event-ticket-orders, cut from the output of `npm run i18n:sql`. Run it only in an environment that already ran add-zh-cn-messages/sql/03-zh-cn-messages.sql; otherwise run that 03 file, which includes these labels.
SET NAMES utf8mb4;
USE `service-system`;
INSERT INTO message (code, content, area) SELECT 'GuestHeldTickets', JSON_OBJECT('en_US', 'Held tickets', 'zh_CN', '已占门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestHeldTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已占门票') WHERE LOWER(code) = LOWER('GuestHeldTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTicketsClosed', JSON_OBJECT('en_US', 'Choose an event that is selling tickets.', 'zh_CN', '请选择正在售票的活动。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTicketsClosed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请选择正在售票的活动。') WHERE LOWER(code) = LOWER('PagesTicketsClosed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTitle', JSON_OBJECT('en_US', 'Tickets', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('TktTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktViewOrders', JSON_OBJECT('en_US', 'View orders', 'zh_CN', '查看订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktViewOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '查看订单') WHERE LOWER(code) = LOWER('TktViewOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktLoadFailed', JSON_OBJECT('en_US', 'Could not load the tickets.', 'zh_CN', '无法加载门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktLoadFailed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无法加载门票。') WHERE LOWER(code) = LOWER('TktLoadFailed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveFailed', JSON_OBJECT('en_US', 'Could not save. Try again.', 'zh_CN', '无法保存,请重试。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveFailed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无法保存,请重试。') WHERE LOWER(code) = LOWER('TktSaveFailed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSettingsSaved', JSON_OBJECT('en_US', 'Ticket settings saved.', 'zh_CN', '门票设置已保存。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSettingsSaved') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票设置已保存。') WHERE LOWER(code) = LOWER('TktSettingsSaved') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSellTickets', JSON_OBJECT('en_US', 'Sell tickets', 'zh_CN', '售卖门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSellTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '售卖门票') WHERE LOWER(code) = LOWER('TktSellTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaymentInstructions', JSON_OBJECT('en_US', 'Payment instructions', 'zh_CN', '付款说明'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaymentInstructions') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款说明') WHERE LOWER(code) = LOWER('TktPaymentInstructions') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaymentInstructionsHelp', JSON_OBJECT('en_US', 'Shown to buyers after they request tickets, e.g. the bank account and what reference to use.', 'zh_CN', '买家申请门票后显示,例如银行账户及付款备注。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaymentInstructionsHelp') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '买家申请门票后显示,例如银行账户及付款备注。') WHERE LOWER(code) = LOWER('TktPaymentInstructionsHelp') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktHoldDays', JSON_OBJECT('en_US', 'Hold days', 'zh_CN', '保留天数'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktHoldDays') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保留天数') WHERE LOWER(code) = LOWER('TktHoldDays') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveSettings', JSON_OBJECT('en_US', 'Save ticket settings', 'zh_CN', '保存门票设置'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveSettings') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存门票设置') WHERE LOWER(code) = LOWER('TktSaveSettings') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPrice', JSON_OBJECT('en_US', 'Price', 'zh_CN', '价格'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPrice') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '价格') WHERE LOWER(code) = LOWER('TktPrice') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPriceRm', JSON_OBJECT('en_US', 'Price (RM)', 'zh_CN', '价格(RM)'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPriceRm') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '价格(RM)') WHERE LOWER(code) = LOWER('TktPriceRm') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktQuantity', JSON_OBJECT('en_US', 'Quantity', 'zh_CN', '数量'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktQuantity') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '数量') WHERE LOWER(code) = LOWER('TktQuantity') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktLeft', JSON_OBJECT('en_US', 'Left', 'zh_CN', '剩余'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktLeft') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '剩余') WHERE LOWER(code) = LOWER('TktLeft') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesEnd', JSON_OBJECT('en_US', 'Sales end', 'zh_CN', '停售日期'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesEnd') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '停售日期') WHERE LOWER(code) = LOWER('TktSalesEnd') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesEndHelp', JSON_OBJECT('en_US', 'An empty sales end date means sales end with the event.', 'zh_CN', '停售日期留空表示随活动结束而停售。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesEndHelp') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '停售日期留空表示随活动结束而停售。') WHERE LOWER(code) = LOWER('TktSalesEndHelp') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNoTypes', JSON_OBJECT('en_US', 'No ticket types yet.', 'zh_CN', '尚无门票类型。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNoTypes') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚无门票类型。') WHERE LOWER(code) = LOWER('TktNoTypes') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktFree', JSON_OBJECT('en_US', 'Free', 'zh_CN', '免费'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktFree') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '免费') WHERE LOWER(code) = LOWER('TktFree') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDisable', JSON_OBJECT('en_US', 'Disable', 'zh_CN', '停用'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDisable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '停用') WHERE LOWER(code) = LOWER('TktDisable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktEnable', JSON_OBJECT('en_US', 'Enable', 'zh_CN', '启用'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktEnable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '启用') WHERE LOWER(code) = LOWER('TktEnable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDelete', JSON_OBJECT('en_US', 'Delete', 'zh_CN', '删除'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDelete') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '删除') WHERE LOWER(code) = LOWER('TktDelete') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTypeName', JSON_OBJECT('en_US', 'Ticket name', 'zh_CN', '门票名称'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTypeName') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票名称') WHERE LOWER(code) = LOWER('TktTypeName') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAddType', JSON_OBJECT('en_US', 'Add ticket type', 'zh_CN', '添加门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAddType') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '添加门票类型') WHERE LOWER(code) = LOWER('TktAddType') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveType', JSON_OBJECT('en_US', 'Save ticket type', 'zh_CN', '保存门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveType') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存门票类型') WHERE LOWER(code) = LOWER('TktSaveType') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDeleteTitle', JSON_OBJECT('en_US', 'Delete ticket type', 'zh_CN', '删除门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDeleteTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '删除门票类型') WHERE LOWER(code) = LOWER('TktDeleteTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktDeleteMessage', JSON_OBJECT('en_US', 'Delete {name}? This cannot be undone.', 'zh_CN', '删除 {name}?此操作无法撤销。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktDeleteMessage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '删除 {name}?此操作无法撤销。') WHERE LOWER(code) = LOWER('TktDeleteMessage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrInstructionsRequired', JSON_OBJECT('en_US', 'Enter the payment instructions before turning tickets on.', 'zh_CN', '开启售票前请填写付款说明。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrInstructionsRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '开启售票前请填写付款说明。') WHERE LOWER(code) = LOWER('TktErrInstructionsRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrInstructionsTooLong', JSON_OBJECT('en_US', 'Payment instructions can be at most 1000 characters.', 'zh_CN', '付款说明最多 1000 个字符。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrInstructionsTooLong') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款说明最多 1000 个字符。') WHERE LOWER(code) = LOWER('TktErrInstructionsTooLong') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrHoldDays', JSON_OBJECT('en_US', 'Hold days must be from 1 to 14.', 'zh_CN', '保留天数须为 1 至 14。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrHoldDays') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保留天数须为 1 至 14。') WHERE LOWER(code) = LOWER('TktErrHoldDays') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrName', JSON_OBJECT('en_US', 'Enter a name of 1 to 80 characters.', 'zh_CN', '请输入 1 至 80 个字符的名称。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrName') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入 1 至 80 个字符的名称。') WHERE LOWER(code) = LOWER('TktErrName') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrNameTaken', JSON_OBJECT('en_US', 'This event already has a ticket type with this name.', 'zh_CN', '本活动已有同名门票类型。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrNameTaken') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '本活动已有同名门票类型。') WHERE LOWER(code) = LOWER('TktErrNameTaken') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrPrice', JSON_OBJECT('en_US', 'Enter a price from 0.00 to 99999.99.', 'zh_CN', '请输入 0.00 至 99999.99 的价格。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrPrice') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入 0.00 至 99999.99 的价格。') WHERE LOWER(code) = LOWER('TktErrPrice') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrQuantity', JSON_OBJECT('en_US', 'Enter a quantity of at least 1.', 'zh_CN', '数量至少为 1。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrQuantity') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '数量至少为 1。') WHERE LOWER(code) = LOWER('TktErrQuantity') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrQuantityBelowHeld', JSON_OBJECT('en_US', 'The quantity cannot be below the seats already held.', 'zh_CN', '数量不能低于已占座位。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrQuantityBelowHeld') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '数量不能低于已占座位。') WHERE LOWER(code) = LOWER('TktErrQuantityBelowHeld') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrDate', JSON_OBJECT('en_US', 'Enter a valid date.', 'zh_CN', '请输入有效日期。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrDate') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入有效日期。') WHERE LOWER(code) = LOWER('TktErrDate') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrTypeHasOrders', JSON_OBJECT('en_US', 'This ticket type has orders. Disable it instead.', 'zh_CN', '此门票类型已有订单,请改为停用。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrTypeHasOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票类型已有订单,请改为停用。') WHERE LOWER(code) = LOWER('TktErrTypeHasOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrNotPayable', JSON_OBJECT('en_US', 'Only an order awaiting payment or expired can be marked paid.', 'zh_CN', '只有待付款或已过期的订单可标记为已付款。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrNotPayable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '只有待付款或已过期的订单可标记为已付款。') WHERE LOWER(code) = LOWER('TktErrNotPayable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrSeatsGone', JSON_OBJECT('en_US', 'The seats of this expired order were taken. It cannot be marked paid.', 'zh_CN', '此过期订单的座位已被占用,无法标记为已付款。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrSeatsGone') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此过期订单的座位已被占用,无法标记为已付款。') WHERE LOWER(code) = LOWER('TktErrSeatsGone') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrPaymentRef', JSON_OBJECT('en_US', 'The payment reference can be at most 100 characters.', 'zh_CN', '付款参考最多 100 个字符。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrPaymentRef') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款参考最多 100 个字符。') WHERE LOWER(code) = LOWER('TktErrPaymentRef') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrNotCancellable', JSON_OBJECT('en_US', 'Only an order awaiting payment or paid can be cancelled.', 'zh_CN', '只有待付款或已付款的订单可取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrNotCancellable') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '只有待付款或已付款的订单可取消。') WHERE LOWER(code) = LOWER('TktErrNotCancellable') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrLastTicket', JSON_OBJECT('en_US', 'This is the order''s last ticket. Cancel the order instead.', 'zh_CN', '这是订单的最后一张门票,请改为取消订单。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrLastTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '这是订单的最后一张门票,请改为取消订单。') WHERE LOWER(code) = LOWER('TktErrLastTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusAWAITING', JSON_OBJECT('en_US', 'Awaiting payment', 'zh_CN', '待付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusAWAITING') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '待付款') WHERE LOWER(code) = LOWER('TktStatusAWAITING') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusPAID', JSON_OBJECT('en_US', 'Paid', 'zh_CN', '已付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusPAID') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已付款') WHERE LOWER(code) = LOWER('TktStatusPAID') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusCANCELLED', JSON_OBJECT('en_US', 'Cancelled', 'zh_CN', '已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusCANCELLED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已取消') WHERE LOWER(code) = LOWER('TktStatusCANCELLED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStatusEXPIRED', JSON_OBJECT('en_US', 'Expired', 'zh_CN', '已过期'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStatusEXPIRED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已过期') WHERE LOWER(code) = LOWER('TktStatusEXPIRED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrdersTitle', JSON_OBJECT('en_US', 'Ticket orders', 'zh_CN', '门票订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrdersTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票订单') WHERE LOWER(code) = LOWER('TktOrdersTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktBackToEvent', JSON_OBJECT('en_US', 'Back to event', 'zh_CN', '返回活动'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktBackToEvent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '返回活动') WHERE LOWER(code) = LOWER('TktBackToEvent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderState', JSON_OBJECT('en_US', 'Order state', 'zh_CN', '订单状态'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderState') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单状态') WHERE LOWER(code) = LOWER('TktOrderState') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSearchOrders', JSON_OBJECT('en_US', 'Search orders', 'zh_CN', '搜索订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSearchOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '搜索订单') WHERE LOWER(code) = LOWER('TktSearchOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSearchOrdersHint', JSON_OBJECT('en_US', 'Reference, name, email or mobile', 'zh_CN', '编号、姓名、电邮或手机'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSearchOrdersHint') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '编号、姓名、电邮或手机') WHERE LOWER(code) = LOWER('TktSearchOrdersHint') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReference', JSON_OBJECT('en_US', 'Reference', 'zh_CN', '编号'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReference') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '编号') WHERE LOWER(code) = LOWER('TktReference') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktBuyer', JSON_OBJECT('en_US', 'Buyer', 'zh_CN', '买家'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktBuyer') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '买家') WHERE LOWER(code) = LOWER('TktBuyer') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTickets', JSON_OBJECT('en_US', 'Tickets', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('TktTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTotal', JSON_OBJECT('en_US', 'Total', 'zh_CN', '总额'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTotal') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '总额') WHERE LOWER(code) = LOWER('TktTotal') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesEnded', JSON_OBJECT('en_US', 'Sales ended', 'zh_CN', '已停售'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesEnded') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已停售') WHERE LOWER(code) = LOWER('TktSalesEnded') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSeatsLeft', JSON_OBJECT('en_US', '{count} left', 'zh_CN', '剩余 {count} 张'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSeatsLeft') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '剩余 {count} 张') WHERE LOWER(code) = LOWER('TktSeatsLeft') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSoldOut', JSON_OBJECT('en_US', 'Sold out', 'zh_CN', '已售罄'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSoldOut') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已售罄') WHERE LOWER(code) = LOWER('TktSoldOut') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktRemoveOne', JSON_OBJECT('en_US', 'Remove one {name}', 'zh_CN', '减少一张 {name}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktRemoveOne') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '减少一张 {name}') WHERE LOWER(code) = LOWER('TktRemoveOne') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAddOne', JSON_OBJECT('en_US', 'Add one {name}', 'zh_CN', '增加一张 {name}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAddOne') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '增加一张 {name}') WHERE LOWER(code) = LOWER('TktAddOne') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPreviewNote', JSON_OBJECT('en_US', 'Visitors choose tickets and fill in their details here.', 'zh_CN', '访客在此选择门票并填写资料。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPreviewNote') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '访客在此选择门票并填写资料。') WHERE LOWER(code) = LOWER('TktPreviewNote') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSalesClosed', JSON_OBJECT('en_US', 'Ticket sales are closed.', 'zh_CN', '门票销售已结束。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSalesClosed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票销售已结束。') WHERE LOWER(code) = LOWER('TktSalesClosed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktChooseTickets', JSON_OBJECT('en_US', 'Choose at least one ticket.', 'zh_CN', '请至少选择一张门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktChooseTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请至少选择一张门票。') WHERE LOWER(code) = LOWER('TktChooseTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktEmailRequired', JSON_OBJECT('en_US', 'Enter your email.', 'zh_CN', '请输入电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktEmailRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入电子邮件。') WHERE LOWER(code) = LOWER('TktEmailRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktConsentRequired', JSON_OBJECT('en_US', 'Tick the box to agree to the privacy notice.', 'zh_CN', '请勾选以同意隐私声明。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请勾选以同意隐私声明。') WHERE LOWER(code) = LOWER('TktConsentRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktMax', JSON_OBJECT('en_US', 'Up to 10 tickets per order.', 'zh_CN', '每笔订单最多 10 张门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktMax') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '每笔订单最多 10 张门票。') WHERE LOWER(code) = LOWER('TktMax') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktRequest', JSON_OBJECT('en_US', 'Request tickets', 'zh_CN', '申请门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktRequest') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '申请门票') WHERE LOWER(code) = LOWER('TktRequest') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktThanksPlain', JSON_OBJECT('en_US', 'Thank you. Your request for {event} is in.', 'zh_CN', '谢谢,您对 {event} 的申请已收到。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktThanksPlain') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '谢谢,您对 {event} 的申请已收到。') WHERE LOWER(code) = LOWER('TktThanksPlain') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktThanksPaid', JSON_OBJECT('en_US', 'Your order {reference} is confirmed.', 'zh_CN', '您的订单 {reference} 已确认。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktThanksPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '您的订单 {reference} 已确认。') WHERE LOWER(code) = LOWER('TktThanksPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktThanks', JSON_OBJECT('en_US', 'We have your order {reference}. It is held until you pay.', 'zh_CN', '我们已收到您的订单 {reference},付款前为您保留。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktThanks') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '我们已收到您的订单 {reference},付款前为您保留。') WHERE LOWER(code) = LOWER('TktThanks') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktViewOrder', JSON_OBJECT('en_US', 'View your order', 'zh_CN', '查看订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktViewOrder') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '查看订单') WHERE LOWER(code) = LOWER('TktViewOrder') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktHowToPay', JSON_OBJECT('en_US', 'How to pay', 'zh_CN', '付款方式'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktHowToPay') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款方式') WHERE LOWER(code) = LOWER('TktHowToPay') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPayBy', JSON_OBJECT('en_US', 'Pay by {when}', 'zh_CN', '请于 {when} 前付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPayBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请于 {when} 前付款') WHERE LOWER(code) = LOWER('TktPayBy') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicOrder', JSON_OBJECT('en_US', 'Order {reference}', 'zh_CN', '订单 {reference}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicOrder') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单 {reference}') WHERE LOWER(code) = LOWER('TktPublicOrder') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicAwaiting', JSON_OBJECT('en_US', 'Awaiting payment', 'zh_CN', '等待付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicAwaiting') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '等待付款') WHERE LOWER(code) = LOWER('TktPublicAwaiting') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicPaid', JSON_OBJECT('en_US', 'Paid. Your order is confirmed.', 'zh_CN', '已付款,订单已确认。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已付款,订单已确认。') WHERE LOWER(code) = LOWER('TktPublicPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicCancelled', JSON_OBJECT('en_US', 'This order was cancelled.', 'zh_CN', '此订单已取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicCancelled') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此订单已取消。') WHERE LOWER(code) = LOWER('TktPublicCancelled') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPublicExpired', JSON_OBJECT('en_US', 'This order expired before payment arrived.', 'zh_CN', '此订单在收到付款前已过期。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPublicExpired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此订单在收到付款前已过期。') WHERE LOWER(code) = LOWER('TktPublicExpired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderInvalid', JSON_OBJECT('en_US', 'This order link is not valid.', 'zh_CN', '此订单链接无效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderInvalid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此订单链接无效。') WHERE LOWER(code) = LOWER('TktOrderInvalid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesBlockTickets', JSON_OBJECT('en_US', 'Tickets', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesBlockTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('PagesBlockTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTicketsEvent', JSON_OBJECT('en_US', 'Event selling tickets', 'zh_CN', '售票活动'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTicketsEvent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '售票活动') WHERE LOWER(code) = LOWER('PagesTicketsEvent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesChooseTicketsEvent', JSON_OBJECT('en_US', 'Choose an event with tickets on', 'zh_CN', '选择已开启售票的活动'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesChooseTicketsEvent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '选择已开启售票的活动') WHERE LOWER(code) = LOWER('PagesChooseTicketsEvent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTicketsEventHint', JSON_OBJECT('en_US', 'Only events with tickets switched on are listed.', 'zh_CN', '仅列出已开启售票的活动。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTicketsEventHint') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '仅列出已开启售票的活动。') WHERE LOWER(code) = LOWER('PagesTicketsEventHint') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCreated', JSON_OBJECT('en_US', 'Created', 'zh_CN', '创建时间'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCreated') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '创建时间') WHERE LOWER(code) = LOWER('TktCreated') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNoOrders', JSON_OBJECT('en_US', 'No orders yet.', 'zh_CN', '尚无订单。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNoOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚无订单。') WHERE LOWER(code) = LOWER('TktNoOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderTitle', JSON_OBJECT('en_US', 'Ticket order', 'zh_CN', '门票订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票订单') WHERE LOWER(code) = LOWER('TktOrderTitle') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderNamed', JSON_OBJECT('en_US', 'Order {reference}', 'zh_CN', '订单 {reference}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderNamed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单 {reference}') WHERE LOWER(code) = LOWER('TktOrderNamed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderNotFound', JSON_OBJECT('en_US', 'Order not found.', 'zh_CN', '找不到订单。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderNotFound') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '找不到订单。') WHERE LOWER(code) = LOWER('TktOrderNotFound') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktBackToOrders', JSON_OBJECT('en_US', 'Back to orders', 'zh_CN', '返回订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktBackToOrders') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '返回订单') WHERE LOWER(code) = LOWER('TktBackToOrders') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktActionFailed', JSON_OBJECT('en_US', 'The action failed. Try again.', 'zh_CN', '操作失败,请重试。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktActionFailed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '操作失败,请重试。') WHERE LOWER(code) = LOWER('TktActionFailed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktHoldUntil', JSON_OBJECT('en_US', 'Held until', 'zh_CN', '保留至'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktHoldUntil') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保留至') WHERE LOWER(code) = LOWER('TktHoldUntil') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaymentRef', JSON_OBJECT('en_US', 'Payment reference', 'zh_CN', '付款参考'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaymentRef') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '付款参考') WHERE LOWER(code) = LOWER('TktPaymentRef') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPaidBy', JSON_OBJECT('en_US', 'Marked paid by', 'zh_CN', '标记付款者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPaidBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '标记付款者') WHERE LOWER(code) = LOWER('TktPaidBy') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelledBy', JSON_OBJECT('en_US', 'Cancelled by', 'zh_CN', '取消者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelledBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消者') WHERE LOWER(code) = LOWER('TktCancelledBy') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktExpiredAt', JSON_OBJECT('en_US', 'Expired', 'zh_CN', '过期时间'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktExpiredAt') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '过期时间') WHERE LOWER(code) = LOWER('TktExpiredAt') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktResend', JSON_OBJECT('en_US', 'Resend email', 'zh_CN', '重新发送电邮'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktResend') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '重新发送电邮') WHERE LOWER(code) = LOWER('TktResend') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktEmailResent', JSON_OBJECT('en_US', 'Email sent again.', 'zh_CN', '电邮已重新发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktEmailResent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '电邮已重新发送。') WHERE LOWER(code) = LOWER('TktEmailResent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktMarkPaid', JSON_OBJECT('en_US', 'Mark paid', 'zh_CN', '标记为已付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktMarkPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '标记为已付款') WHERE LOWER(code) = LOWER('TktMarkPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktMarkedPaid', JSON_OBJECT('en_US', 'Order marked paid.', 'zh_CN', '订单已标记为已付款。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktMarkedPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已标记为已付款。') WHERE LOWER(code) = LOWER('TktMarkedPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelOrder', JSON_OBJECT('en_US', 'Cancel order', 'zh_CN', '取消订单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelOrder') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消订单') WHERE LOWER(code) = LOWER('TktCancelOrder') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelOrderMessage', JSON_OBJECT('en_US', 'Cancel this order and free its seats? The buyer gets an email.', 'zh_CN', '取消此订单并释放座位?买家将收到电邮。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelOrderMessage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消此订单并释放座位?买家将收到电邮。') WHERE LOWER(code) = LOWER('TktCancelOrderMessage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOrderCancelled', JSON_OBJECT('en_US', 'Order cancelled.', 'zh_CN', '订单已取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOrderCancelled') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已取消。') WHERE LOWER(code) = LOWER('TktOrderCancelled') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelTicket', JSON_OBJECT('en_US', 'Cancel ticket', 'zh_CN', '取消门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消门票') WHERE LOWER(code) = LOWER('TktCancelTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCancelTicketMessage', JSON_OBJECT('en_US', 'Cancel this ticket, free its seat and lower the order total?', 'zh_CN', '取消此门票、释放座位并降低订单总额?'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCancelTicketMessage') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '取消此门票、释放座位并降低订单总额?') WHERE LOWER(code) = LOWER('TktCancelTicketMessage') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketCancelled', JSON_OBJECT('en_US', 'Ticket cancelled.', 'zh_CN', '门票已取消。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketCancelled') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已取消。') WHERE LOWER(code) = LOWER('TktTicketCancelled') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketType', JSON_OBJECT('en_US', 'Ticket type', 'zh_CN', '门票类型'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketType') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票类型') WHERE LOWER(code) = LOWER('TktTicketType') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketActive', JSON_OBJECT('en_US', 'Active', 'zh_CN', '有效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketActive') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '有效') WHERE LOWER(code) = LOWER('TktTicketActive') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketCancelledBy', JSON_OBJECT('en_US', 'Cancelled by {by}, {at}', 'zh_CN', '{by} 于 {at} 取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketCancelledBy') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '{by} 于 {at} 取消') WHERE LOWER(code) = LOWER('TktTicketCancelledBy') AND area = 'A';
@@ -0,0 +1,11 @@
-- Co-Lite change add-event-ticket-orders: rollback. Drops every ticket order and ticket. Run only to remove the data too.
USE `service-counter`;
DROP TABLE IF EXISTS `ticket`;
DROP TABLE IF EXISTS `shop_order_line`;
DROP TABLE IF EXISTS `shop_order`;
DROP TABLE IF EXISTS `ticket_type`;
ALTER TABLE `event` DROP COLUMN `tickets_enabled`, DROP COLUMN `payment_instructions`, DROP COLUMN `hold_days`;
USE `service-system`;
DELETE FROM `modules_roles` WHERE `module_id` = 41160000;
DELETE FROM `module` WHERE `id` = 41160000;
@@ -0,0 +1,179 @@
# Tasks
Design: `design.md` (technical contracts) and `docs/superpowers/specs/2026-12-04-event-ticketing-design.md` (product).
**Mode:** all tasks run serially in the main session. The owner asked for no worker subagents. Each task starts with failing tests (TDD).
## 1. Data
- [x] 1.1 Write the SQL:
- `sql/01-event-ticket-orders.sql`: the event columns, `ticket_type`, `shop_order`, `shop_order_line` and `ticket`;
- `sql/02-event-tickets-module.sql`: `BO_EVENT_TICKETS`;
- `sql/99-rollback.sql`.
Mirror 01 and 02 in `local/seed/03-colite.sql`, and apply them to the local database.
- Depends on: none
- Scope: `local/seed/**`, `openspec/changes/add-event-ticket-orders/sql/**`
- Verify: `SELECT` shows the tables, keys, event columns and module row.
## 2. services-counter
- [x] 2.1 Ticket entities, settings and ticket types.
- Depends on: 1.1
- Tests first:
- **Entities:** they map to the DDL.
- **Ticket settings** (own endpoint `ticketType/settings`; an event edit keeps the stored settings):
- switching on with blank instructions is refused on the field;
- hold days 0 or 15 are refused;
- a valid save persists.
- **Type save:**
- a duplicate name gives `NAME_TAKEN`;
- a quantity below held gives `QUANTITY_BELOW_HELD`;
- another company's event gives 404.
- **Type delete:** gives `TYPE_HAS_ORDERS` when the type has orders.
- **`list`:** gives the right `held` and `left` with a mix of ACTIVE and CANCELLED tickets and AWAITING, PAID and EXPIRED orders.
- **`onSale`:** gives only enabled types, the right `state` values (`ON_SALE`, `SOLD_OUT`, `ENDED`) and no company data.
- Scope: `solvway-services-counter/src/**`
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
- [x] 2.2 Order request, seat locking, capacity and the buyer as a lead.
- Depends on: 2.1
- Tests first:
- **Request outcomes:**
- a valid request makes an order, its lines and its tickets, with the reference format, the token and the correct total;
- a total of 0 makes the order PAID;
- quantities 0, 11 or negative give `BAD_QUANTITY`;
- a disabled type, a type past its sales end, or a type short of seats gives `TYPE_UNAVAILABLE` with `left`;
- a 4th awaiting order gives `TOO_MANY_AWAITING`;
- Tickets off, a disabled event or an ended event gives `TICKETS_CLOSED`.
- **Capacity:**
- before the event days, guests plus walk-ins plus held tickets over capacity gives `EVENT_FULL` with `left`;
- on the event days it does not.
- **Concurrency:** the unit test proves the event lock is taken before seats are counted. The module has no test database, and adding H2 or Testcontainers would be a new dependency for one test. So the real lock and the JPQL are checked against the local MySQL stack in 5.1: the counter boots, which validates the queries, and two parallel requests race for the last seat.
- **Buyer lead:**
- a new buyer gets an event lead with source `TICKET` and the UTM values;
- a buyer already captured keeps the old source and gets a note naming the reference.
- **Headcount:** it adds `heldTickets`, and the invite registration's capacity check counts held tickets.
- Scope: `solvway-services-counter/src/**`
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
- [x] 2.3 Staff order actions, the expiry job and emails.
- Depends on: 2.2
- Tests first:
- **`list`:** filter, search and paging.
- **`get`:** another company's order gives 404.
- **`markPaid`:**
- from AWAITING;
- from EXPIRED with seats free;
- `SEATS_GONE`;
- `NOT_PAYABLE` from PAID or CANCELLED.
- **`cancel`:** frees the seats; `NOT_CANCELLABLE` from EXPIRED.
- **`cancelTicket`:** lowers the total and frees the seat; `LAST_TICKET`.
- **Expiry job:**
- expires only orders past their hold;
- a conditional update never overwrites PAID.
- **Mailer:**
- sends after commit;
- escapes user values;
- puts the order link in the email;
- records `last_email`;
- a failed send leaves the order changed.
- **`resend`:** sends the `last_email` kind.
- Scope: `solvway-services-counter/src/**`
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
- [x] 2.4 `CmsBlockValidator` TICKETS.
- Depends on: 2.1
- Tests first:
- **Event checks:**
- a TICKETS block without an event is refused;
- another company's event is refused;
- an event with Tickets off is refused;
- an ended event is refused.
- **Field limits:**
- a heading of 121 characters is refused;
- text of 1001 characters is refused;
- an unused field is refused with `PagesUnusedField`.
- **Valid block:** a valid block with eyebrow, look and anchor is accepted.
- Scope: `solvway-services-counter/src/**`
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
## 3. mobile-api and gateway
- [x] 3.1 Admin ticket endpoints.
- Depends on: 2.3
- Tests first:
- **Gating:**
- every endpoint gives 403 without `BO_EVENT_TICKETS`;
- another company's event or order gives 404;
- the event PUT ignores ticket settings without the permission.
- **Audit:** each write is audited.
- **Event GET:** it returns `ticketsEnabled`.
- Scope: `solvway-mobile-api/src/**`
- Verify: `mvn -T 1C -q -pl solvway-mobile-api verify`
- [x] 3.2 Public TICKETS page data, request and order page, and the gateway paths.
- Depends on: 2.4, 3.1
- Tests first:
- **Page data:** the page GET adds `tickets` or `closed` to a TICKETS block.
- **Request:**
- the honeypot gives a fake success and nothing is posted;
- the `reg:submit` limit applies;
- inputs are normalised;
- counter errors map to the right public messages.
- **Order page:**
- a bad token shape gives 404 with no backend call;
- the `ord:load` limit applies;
- the payment instructions appear only while AWAITING.
- **Gateway:** the three paths are open and nothing else changes.
- Scope: `solvway-mobile-api/src/**`, `solvway-api-gateway/src/**`
- Verify: `mvn -T 1C -q -pl solvway-mobile-api,solvway-api-gateway verify`
## 4. Portal
- [x] 4.1 Event Tickets section, orders list and order detail.
- Depends on: 3.1
- Tests first:
- **Visibility:** the section is hidden without `BO_EVENT_TICKETS`.
- **Settings form:** shows the validation errors.
- **Types table:** add, edit and disable, with the delete error shown.
- **Orders list:** filter and search.
- **Order detail actions:**
- mark paid with a reference;
- cancel order and cancel ticket, each with a confirm;
- the `SEATS_GONE` and `LAST_TICKET` messages shown;
- resend.
- **`ROUTE_MODULES`:** the new pages are mapped.
- Scope: `solvway-admin-portal/app/**`
- Verify: `npx vitest run` (check the exit code), `npx tsc --noEmit`, `npm run lint`
- [x] 4.2 The TICKETS block, the editors and the order page.
- Depends on: 3.2, 4.1
- Tests first:
- **Renderer:**
- types, prices, `Free`, sold out and sales ended;
- steppers capped at 10 in total;
- the running total;
- field errors;
- the thank-you with instructions and the order link;
- the free-order confirmation;
- the closed state.
- **Editors:** the block appears in the Add section menu; the event picker lists only events with tickets on.
- **`/o/[token]`:**
- states and instructions;
- the invalid link message;
- the route is public;
- the proxy sends one X-Forwarded-For hop.
- **Labels:** in English and zh-CN, plus the `sql/03-*-labels.sql` file.
- Scope: `solvway-admin-portal/app/**`, `openspec/changes/add-event-ticket-orders/sql/**`, `local/seed/04-zh-cn-messages.sql`
- Verify: `npx vitest run` (check the exit code), `npx tsc --noEmit`, `npm run lint`
## 5. Verify and ship
- [x] 5.1 Rebuild the local stack, then check in Playwright.
- Sign in as admin.
- Grant Event tickets to the role.
- Click into the test event, turn Tickets on, and add the types.
- Add a TICKETS block to a **draft** test page.
- Open its preview and request tickets with a disposable buyer the owner nominates. Ask before saving any order.
- See the order in staff screens, mark it paid, and cancel a ticket.
- Check the blocked paths: over 10 tickets, sold out, missing consent, and an unknown order link.
- Take screenshots.
- Depends on: 4.2
- [x] 5.2 Write the release note in `docs/deployment.md`. Open the PR to main and merge it, then archive the change in its own PR.
- Depends on: 5.1
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-12-04
@@ -0,0 +1,130 @@
# Design
Product design: `docs/superpowers/specs/2026-12-04-event-ticketing-design.md` (approved 2026-12-04). This file holds the technical contracts. Change 1 (`add-event-ticket-orders`) already built the `ticket` table with `code`, the attendee columns, `event_lead_uuid` and the `checked_in_*` columns, so this change mostly fills them in.
## Context
- **Tickets and orders:**
- Orders and tickets live in services-counter: `TicketOrderService` handles the request and `byToken`; `TicketOrderStaffService` handles mark paid, cancel and resend; `TicketOrderMailer` sends the order emails; `TicketOrderExpiryJob` expires holds.
- mobile-api's `PublicPageService` holds the public order endpoints and `AdminTicketService` the staff ones.
- The gateway's `JWTAuthFilter` lists the counter paths that are public.
- **Venue self check-in:**
- `EventCheckInService.lookup` returns `CHECKED_IN` or `FORM`.
- The walk-in form posts to the existing register path with `attend=true`.
- **Capacity:** "a registered invite counts toward capacity" already holds. `EventGuestService.register`, `TicketOrderService.create` and `EventHeadcountService` all add registered guests, walk-ins and held tickets. No work here.
- **Leads:** `RegistrationService.register(RegisterRequest)` does the QR-registration matching and takes `source`, `consentNoticeId`, `consentAt` and `attend`. It returns the event lead uuid.
- **Portal:**
- `clientApi` redirects to `/login` on a 401.
- `/api/auth/session` does not redirect, and tells whether a staff session exists.
- `qrcode.react` draws QRs in the browser only.
## Goals / Non-Goals
**Goals:**
- Ticket codes on payment.
- The `/t/<code>` page with its public and staff views.
- Attendee naming on the order page.
- Attendee consent.
- The paid email with the tickets, the ticket email, and resend ticket.
- Door check-in.
- Self check-in rules on ticketed events.
- The ticket counts.
**Non-Goals:**
- Payment gateway.
- Merch.
- Member accounts.
- WhatsApp ticket delivery: an attendee named with a mobile only gets no message; the buyer forwards the link.
- Transferring a ticket to another order.
- Printing tickets.
## Decisions
1. **Codes are issued when the order becomes Paid.** This happens inside the same transaction as the status change, at three places: `TicketOrderService.create` (free order), `TicketOrderStaffService.markPaid` (Awaiting payment or Expired), and nowhere else. Codes use the existing 22-character `RegistrationLinkService.newToken()`; `uk_ticket_code` guards uniqueness. Cancelling keeps the code, and validity is computed: the order is `PAID` and the ticket is `ACTIVE`.
- *Alternative:* codes at request time. Rejected, because an unpaid order would then carry QRs that look real.
2. **Ticket state, computed in one place.** `TicketState.of(order, ticket)` returns `VALID`, `CHECKED_IN`, `AWAITING`, `ORDER_CANCELLED`, `ORDER_EXPIRED` or `TICKET_CANCELLED`. The public page, the staff view, check-in and self check-in all use it.
3. **Renaming replaces the code.** The attendee save is `POST ticket/attendee` with the order token, ticket id, name, mobile, email and `permission`. In one transaction it:
- checks the order token and that the order is `PAID`;
- checks the ticket is `ACTIVE` and not checked in;
- sets a new code, `attendee_named_at`, the attendee fields, and clears `attendee_consent_at`, `attendee_notice_id` and `event_lead_uuid`;
- after commit, sends the Ticket email when an email is set.
- Normalisation and the `MOBILE_OR_EMAIL_REQUIRED`, name-length and email-format errors reuse the QR registration helpers in mobile-api.
4. **Consent creates the lead through `RegistrationService.register`.** It is called with source `TICKET`, no salesperson, the company's current notice and `attend=false`. At check-in it is called with `attend=true`. The returned event lead uuid is stored on the ticket. An attendee whose details match a lead is linked to it, as QR registration already does.
- **Unnamed tickets:** the consent needs a name and contact, so on the public page it is offered only for a named ticket. At the door, staff enter them first.
5. **Staff view detection.** The `/t/[code]` page first calls the portal's `/api/tickets/{code}`, which answers 401 at once when there is no session and otherwise calls `GET /api/admin/tickets/{code}`. Only when that fails does it load the public view (`GET /api/public/tickets/{code}`), so a door scan never counts toward the public `tkt:load` limit. That call is guarded by `@AdminModule("BO_EVENTS")` and scoped by company in mobile-api with `loadEvent(uuid, null)`, so another company's event is a 404. On 401, 403 or 404 the page stays public. The admin call uses a plain `fetch`, not `clientApi`, so a signed-out visitor is never bounced to login.
6. **Check-in.** `POST /api/admin/tickets/{code}/checkin` takes optional `{name, mobile, email, consent}`, which are required when the ticket is unnamed. Refusals are 409 with the codes `ALREADY_CHECKED_IN|<time>`, `NOT_VALID|<state>` and `NOT_EVENT_DAY`. The update is conditional (`checked_in_at IS NULL`), so two scanners cannot both check a ticket in; the loser gets `ALREADY_CHECKED_IN`. The action is `@Audited`.
7. **Self check-in on a ticketed event.** For `tickets_enabled` events only, `EventCheckInService.lookup` checks, in order:
1. the oldest `ACTIVE` ticket on a `PAID` order of the event, not checked in, whose attendee mobile or email matches, or whose attendee is blank and whose order's buyer mobile or email matches. It is checked in with `checked_in_by = 'self'`, and the lead is marked attended when the ticket has one;
2. a registered guest of the event, as today;
3. otherwise the result is `SHOW_TICKET`.
The walk-in register path refuses a ticketed event with 409 `TICKETS_ONLY`. The welcome uses the attendee's first name, or the buyer's for an unnamed ticket.
8. **QR PNG in mobile-api.** `GET /api/public/tickets/{code}/qr.png`:
- checks the code shape and validity through counter `ticket/byCode`; an invalid or unknown code is 404;
- encodes `<admin-portal-base>/t/<code>` with zxing `QRCodeWriter` at 300 px, written by `ImageIO`;
- responds `Cache-Control: private, max-age=300`;
- counts toward the `tkt:load` limit.
The portal proxies it like the page images. Emails use the absolute portal URL in `<img src>`.
9. **Order page tickets.** Counter `byToken` adds `tickets: [{id, typeName, attendeeName, code, state, checkedInAt}]` only when the order is PAID. mobile-api passes them through without attendee mobile or email: the counter does not return those to the public call at all.
10. **Emails.** `TicketOrderMailer`:
- **PAID:** gains one block per active ticket: the type, the QR `<img>` and the link. It ends with "Name your attendees: <order link>".
- **New kind TICKET:** sends one ticket to its attendee (or to the buyer, when staff resend an unnamed ticket), with the consent invitation link pointing to the ticket page.
- All of them are sent after commit and are best effort, as today.
11. **Counts.** `EventHeadcountService.Headcount` gains `ticketsAwaiting`, `ticketsPaid` and `ticketsCheckedIn`, from one grouped query over active tickets joined to their order status. The portal's GuestsCard shows them when the event sells tickets.
12. **Limits.**
- `tkt:load:<ip>` allows 120 per 10 minutes, for the ticket page and the QR together.
- `tkt:submit:<ip>:<event>` allows 60 per 10 minutes, for naming and consent. Naming first looks up the order by its token, which counts toward the order page's `ord:load:<ip>` limit (120 per 10 minutes).
- Staff check-in has no IP limit: it is an authenticated admin call.
## Data
`sql/01-ticket-attendees.sql` (services-counter, additive):
```sql
ALTER TABLE `ticket`
ADD COLUMN `attendee_named_at` datetime NULL,
ADD COLUMN `attendee_consent_at` datetime NULL,
ADD COLUMN `attendee_notice_id` bigint NULL,
ADD KEY `idx_ticket_event_mobile` (`event_uuid`, `attendee_mobile_e164`),
ADD KEY `idx_ticket_event_email` (`event_uuid`, `attendee_email`);
```
- `sql/02-ticket-labels.sql` holds the labels, cut from `npm run i18n:sql`.
- `sql/99-rollback.sql` drops the three columns and two keys. Codes stay, because change 1 owns the column.
## Endpoints
| Layer | Method and path | Auth |
|---|---|---|
| counter | `GET ticket/byCode/{code}` | public via gateway |
| counter | `POST ticket/attendee` (order token, ticket id, attendee, permission) | public via gateway |
| counter | `POST ticket/consent` (code, notice id) | public via gateway |
| counter | `POST ticket/staff` and `POST ticket/checkin` (company id and code in the body) | JWT (from mobile-api admin) |
| counter | `POST ticketOrder/resendTicket` (company, event, order and ticket ids in the body) | JWT |
| mobile-api | `GET /api/public/tickets/{code}`, `GET .../qr.png`, `POST .../consent` | public |
| mobile-api | `POST /api/public/orders/{token}/tickets/{ticketId}/attendee` | public |
| mobile-api | `GET /api/admin/tickets/{code}`, `POST /api/admin/tickets/{code}/checkin` | `BO_EVENTS` |
| mobile-api | `POST /api/admin/events/{uuid}/orders/{orderId}/tickets/{ticketId}/resend` | `BO_EVENT_TICKETS` |
| gateway | public: `GET /counter/ticket/byCode/[A-Za-z0-9_-]{22}`, `POST /counter/ticket/attendee`, `POST /counter/ticket/consent` | |
| portal | `/t/[code]` page (public in the route guard); proxies for each mobile-api path above | |
## Risks / Trade-offs
- **Mobile-only attendees get no ticket message.** The buyer shares the link. *Mitigation:* the order page shows each ticket's link with a copy button. WhatsApp delivery can follow once the business account is linked.
- **A forwarded ticket link works for whoever holds it.** This is the same as any paper ticket; check-in is one-time. *Mitigation:* renaming replaces the code.
- **Staff view on a phone needs a signed-in session in that phone's browser.** That is the existing portal login; the door staff sign in once.
- **New dependency** `com.google.zxing:core`, MIT-style Apache 2.0, no transitive dependencies, used only for the email PNG.
- **Self check-in matching an unnamed ticket to its buyer** lets the buyer check in once per unnamed ticket. Each lookup takes one ticket, which matches the buyer bringing friends whose names were never given. ponytail: no per-person cap; add one if abuse is seen.
## Migration Plan
1. Run `sql/01-ticket-attendees.sql` before the new services-counter starts. It is additive, and the old images ignore the columns.
2. Deploy services-counter, mobile-api, api-gateway and the portal.
3. Run `sql/02-ticket-labels.sql`.
4. Orders paid before this release have tickets without codes. A one-off statement in `01` gives every active ticket on a PAID order a code, using `REPLACE(TO_BASE64(RANDOM_BYTES(16)), ...)` trimmed to the 22-character URL-safe form.
5. **Rollback:** the previous images, then `99`.
## Open Questions
None for the owner. Builder calls are recorded above (decisions 4, 5 and 7) and in the release note.
@@ -0,0 +1,85 @@
# Proposal
## Why
Change 1 (`add-event-ticket-orders`, merged 2026-12-04) lets visitors request tickets and staff mark orders paid. A paid order still gives the buyer nothing to show at the door, and the venue's self check-in still offers the walk-in form, so anyone can walk into a paid event. This change adds the ticket itself: a QR code per seat, attendees, and check-in at the door.
The product design was approved on 2026-12-04: `docs/superpowers/specs/2026-12-04-event-ticketing-design.md`. This is the second and last change from that design.
## What Changes
- **Ticket codes:**
- When an order becomes Paid, each of its active tickets gets an unguessable code. This includes free orders, which are Paid at once, and expired orders that staff mark paid.
- The ticket's link is `/t/<code>`.
- Unpaid, cancelled and expired tickets have no valid QR.
- **Ticket page** `/t/<code>`:
- **Public view:**
- the event and ticket type;
- the attendee's first name;
- the ticket's state;
- the QR image while the ticket is valid;
- "This ticket is not valid" otherwise.
- **Staff view:** for signed-in staff with `BO_EVENTS` in the event's company, on an event day, a large state banner and **Check in**. An unnamed ticket first asks for the attendee's name and mobile or email.
- **Refusals:** a second check-in shows "Already checked in at <time>"; an unpaid, cancelled or expired ticket shows a red refusal.
- **Naming attendees on the order page:**
- Once an order is Paid, the order page lists its tickets, each with its link.
- Per ticket, the buyer can name or rename the attendee (a name plus mobile or email). The save needs the tick "I have permission to share these details so their ticket can be sent".
- Naming issues a new code, so the old QR stops working, and emails the attendee their ticket.
- Naming is refused once the ticket is checked in.
- **Attendee consent:**
- A named attendee is not a lead.
- The ticket page, and the staff view at check-in, offer an optional "Keep me updated about <company> events" with the company's privacy notice. Ticking it records the consent and makes the attendee an event lead with source `TICKET`, matched as in QR registration. The ticket email links to that page.
- An attendee who never ticks it can still attend.
- **Emails:**
- "Order paid" now carries each ticket's QR image and link, plus a "Name your attendees" link to the order page.
- A new **Ticket** email goes to a named attendee who has an email.
- Staff can **Resend ticket** from the order detail.
- **Door check-in:** checking a ticket in records who did it and when. An attendee who consented, now or earlier, has their event lead marked attended.
- **Venue self check-in on a ticketed event:**
- It checks in the attendee of a Paid ticket that is not yet checked in. If several match, it takes the oldest. An unnamed ticket counts as its buyer's.
- It also checks in a registered invited guest, as today.
- Anything else shows "Please show your ticket at the entrance" instead of the walk-in form.
- Events without tickets keep today's flow unchanged.
- **Event attendance numbers:** on a ticketed event they add tickets awaiting payment, tickets paid and tickets checked in.
- **QR image for emails:** a public PNG at `/api/public/tickets/<code>/qr.png`. It encodes the ticket's `/t/<code>` link.
- **Already done in change 1, so not repeated here:** a registered invite counts toward capacity alongside held tickets ("Capacity before the event").
## Capabilities
### New Capabilities
None. Tickets belong to the existing `event-ticketing` capability.
### Modified Capabilities
- `event-ticketing`:
- **Order Emails:** the paid email carries the tickets.
- **New requirements:** ticket codes, the ticket page and invalid links, tickets on the order page, naming attendees, attendee consent, the ticket email, the staff ticket view, door check-in, resend ticket, and the ticket abuse limits.
- `event-attendance`:
- **Self check-in of a known person** and **Self check-in of a walk-in** now apply to events without tickets.
- **New requirements:** self check-in on a ticketed event, no walk-ins on a ticketed event, and the ticket attendance numbers.
## Impact
- **services-counter:**
- ticket code issuing on Paid;
- ticket lookup, naming, consent and check-in services;
- `EventCheckInService.lookup` on ticketed events;
- headcount;
- `TicketOrderMailer` (the paid email with tickets, and the ticket email).
- **mobile-api:**
- public endpoints for the ticket page, the QR PNG, naming attendees and attendee consent;
- admin endpoints for the staff ticket view, check-in and resend ticket.
- **api-gateway:** public path patterns for the new endpoints.
- **admin-portal:**
- `/t/[code]` page (public view and staff view);
- the order page gains its tickets section;
- a Resend ticket button on the order detail;
- the guests card shows the ticket counts;
- proxies and the route guard;
- labels in English and zh-CN.
- **Database:** `ticket` gains the attendee consent time, privacy notice id, and naming time.
- **New dependency:**
- **What:** `com.google.zxing:core` in mobile-api, to draw the email QR as a PNG. It has no transitive dependencies; the PNG is written with the JDK's `ImageIO`.
- **Why it is needed:** nothing in the repo draws a QR server-side. The portal's `qrcode.react` renders in the browser only. Email clients block SVG and data-URI images, so the email needs a hosted PNG.
- **No change for events without tickets.**
@@ -0,0 +1,61 @@
## ADDED Requirements
### Requirement: Self check-in on a ticketed event
On an event that sells tickets, the check-in page SHALL match the mobile or email only to the attendee of a valid ticket that is not checked in, or to a registered guest. An unnamed ticket SHALL count as its buyer's, and the oldest ticket SHALL be used when several match. A matched ticket SHALL be checked in, and the attendee's event lead marked attended when they have consented. A matched registered guest SHALL be handled as on other events.
#### Scenario: Ticket holder checks in
- **GIVEN** `KL Hotel Tech Day` sells tickets and `Lim Wei` holds a valid ticket named with his mobile
- **WHEN** he enters that mobile on the check-in page on the event day
- **THEN** the page welcomes `Lim` and his ticket is checked in
### Requirement: No walk-ins on a ticketed event
On an event that sells tickets, when the value matches no valid unchecked ticket and no registered guest, the check-in page SHALL show "Please show your ticket at the entrance." It SHALL NOT offer or accept a walk-in submission.
#### Scenario: No walk-ins on a paid event
- **GIVEN** `KL Hotel Tech Day` sells tickets
- **WHEN** a visitor whose mobile matches no valid ticket and no registered guest enters it
- **THEN** the page says "Please show your ticket at the entrance." and shows no form
- **AND** a walk-in submission sent directly is refused
### Requirement: Ticket attendance numbers
When the event sells tickets, the event page SHALL also show tickets awaiting payment, tickets paid and tickets checked in, counting active tickets only. The numbers SHALL agree with the event's orders.
#### Scenario: Ticket counts
- **GIVEN** `KL Hotel Tech Day` has 2 tickets awaiting payment and 5 paid tickets, 3 of them checked in
- **WHEN** an admin opens the event page
- **THEN** the page shows tickets awaiting payment 2, paid 5, checked in 3
## MODIFIED Requirements
### Requirement: Self check-in of a known person
On the event days, the check-in page SHALL ask for one mobile or email, normalised as in staff capture. On an event that does not sell tickets, when the value matches a registered guest or an event lead of this event, that event lead SHALL be marked attended. After a check-in the page SHALL show "Welcome, <first name>. You're checked in." Checking in again SHALL show the same welcome and change nothing. The page SHALL show no personal details other than the first name.
#### Scenario: Registered guest checks in
- **GIVEN** `Tan Mei Ling` registered by invitation for `KL Expo`
- **WHEN** she enters `012-555 0101` on the check-in page on the event day
- **THEN** the page welcomes `Tan` and her event lead is attended
- **AND** the guest list shows her as Attended
### Requirement: Self check-in of a walk-in
On an event that does not sell tickets, when the value matches an invited guest who has not registered, or no one, the check-in page SHALL show the walk-in form, blank, with the privacy consent. An accepted submission SHALL capture the person with the QR registration rules and no salesperson, link a matching guest, mark the event lead attended, and show the checked-in page.
#### Scenario: Invited but not registered
- **GIVEN** `Lim Wei` is Invited but never registered
- **WHEN** he enters his mobile on the check-in page
- **THEN** a blank walk-in form with the consent is shown, not his details
- **AND** after he submits, he is Attended on the guest list
#### Scenario: Unknown walk-in
- **WHEN** a visitor whose mobile matches no one enters it and submits the walk-in form
- **THEN** an event lead is captured for them and marked attended
@@ -0,0 +1,191 @@
## ADDED Requirements
### Requirement: Ticket Codes
When an order becomes Paid, the system SHALL give each of its active tickets an unguessable code of 22 URL-safe characters, unique across all tickets. This SHALL apply when staff mark an order paid (also an Expired one) and when a free order is Paid at once. The ticket's link SHALL be `/t/<code>`. A ticket SHALL be valid only while its order is Paid and the ticket is active.
#### Scenario: Codes on payment
- **GIVEN** order `T-7K3M9Q` holds 2 `General` tickets and is Awaiting payment
- **WHEN** staff mark it paid
- **THEN** each ticket has its own code and link
#### Scenario: Free order
- **WHEN** a visitor requests 1 free `Community pass`
- **THEN** the order is Paid and its ticket has a code at once
### Requirement: Ticket Page
The ticket link `/t/<code>` SHALL be public. It SHALL show the event name, dates and location, the ticket type, the attendee's first name (or "Not named yet") and the ticket's state. It SHALL show the QR image of its own link only while the ticket is valid and not checked in; a checked-in ticket SHALL show "Checked in at <time>". It SHALL never show the buyer's details, the attendee's mobile or email, or other tickets.
#### Scenario: Valid ticket
- **GIVEN** the ticket of `Tan Mei Ling` for `KL Hotel Tech Day` is valid
- **WHEN** she opens its link
- **THEN** the page shows the event, `General`, `Tan` and the QR image
### Requirement: Invalid Ticket Links
A ticket whose order is not Paid, or which is cancelled, SHALL show "This ticket is not valid" with no QR. An unknown code SHALL show "This ticket link is not valid." and nothing else.
#### Scenario: Cancelled ticket
- **GIVEN** a Paid order's ticket was cancelled by staff
- **WHEN** someone opens that ticket's link
- **THEN** the page says the ticket is not valid and shows no QR
#### Scenario: Unknown link
- **WHEN** a visitor opens `/t/` with an unknown code
- **THEN** the page says the ticket link is not valid
### Requirement: Tickets On The Order Page
Once an order is Paid, its order page SHALL list each active ticket with its type, attendee name (or "Not named yet"), state and ticket link. It SHALL NOT show any attendee's mobile or email.
#### Scenario: Paid order page
- **GIVEN** order `T-7K3M9Q` is Paid with 2 tickets, one named `Tan Mei Ling`
- **WHEN** the buyer opens its link
- **THEN** the page lists both tickets with their links, `Tan Mei Ling` and "Not named yet", without Tan's email
### Requirement: Naming Attendees
On a Paid order's page, the buyer SHALL be able to name or rename the attendee of each ticket on its own: a name of up to 100 characters and a mobile or an email, normalised as in QR registration. The save SHALL need the tick "I have permission to share these details so their ticket can be sent"; without it the save SHALL be refused with "Tick the box to confirm you may share these details."
#### Scenario: Permission not ticked
- **WHEN** the buyer saves an attendee without the permission tick
- **THEN** the save is refused and nothing changes
### Requirement: Naming Effects
Saving an attendee SHALL replace the ticket's code, so the old link becomes unknown. It SHALL record the naming time, clear any earlier attendee consent and lead link on that ticket, and email the new attendee their ticket when an email was given.
#### Scenario: Name an attendee
- **GIVEN** `Aisyah`'s order `T-7K3M9Q` is Paid with 2 unnamed tickets
- **WHEN** she names `Tan Mei Ling`, `tan@example.com`, on the first ticket and ticks the permission
- **THEN** that ticket shows `Tan Mei Ling` with a new link
- **AND** Tan receives the ticket email
- **AND** the old link of that ticket says the ticket link is not valid
### Requirement: Naming Refusals
Naming SHALL be refused for a ticket that is checked in ("This ticket is already checked in."), cancelled, or on an order that is not Paid.
#### Scenario: Checked-in ticket
- **GIVEN** a ticket is checked in
- **WHEN** the buyer tries to rename its attendee
- **THEN** the save is refused with "This ticket is already checked in."
### Requirement: Attendee Is Not A Lead Without Consent
A named attendee SHALL NOT be an event lead, and SHALL NOT appear in event leads, lead lists, exports or the dashboard, until they consent themselves. Their details SHALL be used only to deliver and check the ticket. An attendee who never consents SHALL still be able to attend.
#### Scenario: Attendee never opts in
- **GIVEN** `Lim Wei` was named on a Paid ticket and never ticked the consent
- **WHEN** staff open the event leads listing
- **THEN** Lim does not appear
### Requirement: Attendee Consent
A valid ticket's page SHALL offer an optional "Keep me updated about <company> events" with the company's privacy notice in English and Bahasa Malaysia. Ticking it SHALL record the consent time and notice version on the ticket. It SHALL capture the attendee as an event lead with source `TICKET` and no salesperson, matched and normalised as in QR registration, and link the ticket to that event lead.
#### Scenario: Attendee opts in
- **GIVEN** `Tan Mei Ling` was named on a valid ticket
- **WHEN** she ticks "Keep me updated about INS events" on her ticket page
- **THEN** she is an event lead of `KL Hotel Tech Day` with source Ticket
### Requirement: Ticket Email
A named attendee with an email SHALL get a Ticket email in English and Bahasa Malaysia. It SHALL hold the event name, dates and location, the ticket type, the attendee name, the QR image, and the ticket link, which also offers the consent. The QR image SHALL be a PNG of the ticket link served at `/api/public/tickets/<code>/qr.png`. Each email SHALL be recorded in Emails, and a failed send SHALL NOT undo the naming.
#### Scenario: Ticket email
- **WHEN** the buyer names `Tan Mei Ling`, `tan@example.com`
- **THEN** Tan receives an email with the QR image and her ticket link
### Requirement: Staff Ticket View
On the ticket page, a signed-in user with `BO_EVENTS` in the event's company (any company for super admins) SHALL see the staff view: the ticket's state as a large banner and, for a valid ticket that is not checked in, **Check in**. An unnamed ticket SHALL first ask for the attendee's name and a mobile or email. The staff view SHALL offer the same optional consent as the ticket page. Everyone else SHALL see only the public view.
#### Scenario: Another company's staff
- **WHEN** CV staff open a ticket of an INS event
- **THEN** they see only the public view
### Requirement: Door Check-In
Check-in from the staff view SHALL record the time and the staff user on the ticket, and SHALL be written to the admin audit log. When the attendee has consented, now or earlier, their event lead SHALL be marked attended. An unnamed ticket SHALL take the name and contact entered by staff, normalised as in QR registration.
#### Scenario: Staff check in a named ticket
- **GIVEN** `Tan Mei Ling`'s ticket is valid and it is the event day
- **WHEN** event staff scan her QR and tap Check in
- **THEN** the ticket is checked in with their name and the time
#### Scenario: Unnamed ticket at the door
- **GIVEN** a valid ticket was never named
- **WHEN** staff enter `Lim Wei` and his mobile and tap Check in
- **THEN** the ticket is checked in with Lim as its attendee
- **AND** no lead is created unless he ticked the consent
### Requirement: Door Check-In Refusals
Check-in SHALL change nothing and the staff view SHALL show:
- "Already checked in at <time>" for a checked-in ticket;
- a red "Not valid: <reason>" banner for an invalid ticket, the reason being "awaiting payment", "order cancelled", "order expired" or "ticket cancelled";
- "Check-in is only open on the event days." outside the event days.
#### Scenario: Second scan
- **WHEN** staff scan a checked-in ticket again
- **THEN** the page shows "Already checked in at" the first time and nothing changes
#### Scenario: Unpaid ticket at the door
- **GIVEN** an order is Awaiting payment
- **WHEN** staff open one of its ticket links
- **THEN** the page shows "Not valid: awaiting payment" and no Check in button
### Requirement: Resend Ticket
Users with `BO_EVENT_TICKETS` SHALL be able to resend one valid ticket from the order detail. It SHALL go to its attendee's email when named with an email, otherwise to the buyer. The action SHALL be written to the admin audit log.
#### Scenario: Resend a ticket
- **GIVEN** a valid ticket is named `Tan Mei Ling`, `tan@example.com`
- **WHEN** staff resend that ticket
- **THEN** Tan receives the ticket email again
### Requirement: Ticket Abuse Limits
The public ticket page and its QR image SHALL be limited to 120 loads per client IP per 10 minutes. Naming attendees and attendee consent SHALL be limited to 60 submissions per client IP per event per 10 minutes. Above a limit the answer SHALL be "Too many requests from this device. Try again later." The QR image SHALL be served only for a valid code.
#### Scenario: Too many ticket loads
- **WHEN** one IP loads ticket pages 121 times within 10 minutes
- **THEN** the 121st is refused with "Too many requests from this device. Try again later."
## MODIFIED Requirements
### Requirement: Order Emails
The buyer SHALL get an email when their order is created (lines, total, payment instructions, hold expiry and order link), becomes Paid (lines, total, each ticket's QR image and link, and a "Name your attendees" link to the order page), Expires, or is Cancelled by staff. Each email SHALL be recorded in Emails. A failed send SHALL NOT undo the order change, and staff SHALL be able to resend the latest email of an order.
#### Scenario: Order received email
- **WHEN** `Aisyah` requests tickets
- **THEN** she receives an email with the order reference, payment instructions, hold expiry and order link
#### Scenario: Paid email
- **WHEN** staff mark her order of 2 tickets Paid
- **THEN** she receives a confirmation email with 2 QR images, their ticket links and a link to name her attendees
@@ -0,0 +1,15 @@
-- Co-Lite change add-event-tickets: attendee naming and consent on tickets, and the keys self check-in matches on.
-- Target: `service-counter`. Additive only. Run before the new services-counter starts. Needs a user that may alter tables.
USE `service-counter`;
ALTER TABLE `ticket`
ADD COLUMN `attendee_named_at` datetime NULL COMMENT 'when the buyer last named the attendee',
ADD COLUMN `attendee_consent_at` datetime NULL COMMENT 'when the attendee agreed to be kept updated',
ADD COLUMN `attendee_notice_id` bigint NULL COMMENT 'privacy notice version they agreed to',
ADD KEY `idx_ticket_event_mobile` (`event_uuid`, `attendee_mobile_e164`),
ADD KEY `idx_ticket_event_email` (`event_uuid`, `attendee_email`);
-- Tickets of orders paid before this release get their code now (22 URL-safe characters, like the new ones).
UPDATE `ticket` t JOIN `shop_order` o ON o.id = t.order_id
SET t.code = LEFT(REPLACE(REPLACE(REPLACE(TO_BASE64(RANDOM_BYTES(16)), '+', '-'), '/', '_'), '=', ''), 22)
WHERE o.status = 'PAID' AND t.status = 'ACTIVE' AND t.code IS NULL;
@@ -0,0 +1,94 @@
-- The labels added by add-event-tickets, cut from the output of `npm run i18n:sql`. Run it only in an environment that already ran add-zh-cn-messages/sql/03-zh-cn-messages.sql; otherwise run that 03 file, which includes these labels.
SET NAMES utf8mb4;
USE `service-system`;
INSERT INTO message (code, content, area) SELECT 'TktTicketInvalid', JSON_OBJECT('en_US', 'This ticket link is not valid.', 'zh_CN', '此门票链接无效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketInvalid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票链接无效。') WHERE LOWER(code) = LOWER('TktTicketInvalid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketFor', JSON_OBJECT('en_US', 'Ticket for {name}', 'zh_CN', '{name} 的门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketFor') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '{name} 的门票') WHERE LOWER(code) = LOWER('TktTicketFor') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktQrAlt', JSON_OBJECT('en_US', 'Ticket QR code', 'zh_CN', '门票二维码'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktQrAlt') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票二维码') WHERE LOWER(code) = LOWER('TktQrAlt') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktShowQr', JSON_OBJECT('en_US', 'Show this QR code at the entrance.', 'zh_CN', '请在入口出示此二维码。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktShowQr') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请在入口出示此二维码。') WHERE LOWER(code) = LOWER('TktShowQr') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCheckedInAt', JSON_OBJECT('en_US', 'Checked in at {when}', 'zh_CN', '已于 {when} 签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckedInAt') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已于 {when} 签到') WHERE LOWER(code) = LOWER('TktCheckedInAt') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotValid', JSON_OBJECT('en_US', 'This ticket is not valid', 'zh_CN', '此门票无效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotValid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票无效') WHERE LOWER(code) = LOWER('TktNotValid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonAWAITING', JSON_OBJECT('en_US', 'awaiting payment', 'zh_CN', '等待付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonAWAITING') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '等待付款') WHERE LOWER(code) = LOWER('TktReasonAWAITING') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonORDER_CANCELLED', JSON_OBJECT('en_US', 'order cancelled', 'zh_CN', '订单已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonORDER_CANCELLED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已取消') WHERE LOWER(code) = LOWER('TktReasonORDER_CANCELLED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonORDER_EXPIRED', JSON_OBJECT('en_US', 'order expired', 'zh_CN', '订单已过期'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonORDER_EXPIRED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已过期') WHERE LOWER(code) = LOWER('TktReasonORDER_EXPIRED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktReasonTICKET_CANCELLED', JSON_OBJECT('en_US', 'ticket cancelled', 'zh_CN', '门票已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonTICKET_CANCELLED') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已取消') WHERE LOWER(code) = LOWER('TktReasonTICKET_CANCELLED') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktKeepUpdated', JSON_OBJECT('en_US', 'Keep me updated about {company} events', 'zh_CN', '向我发送 {company} 的活动资讯'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktKeepUpdated') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '向我发送 {company} 的活动资讯') WHERE LOWER(code) = LOWER('TktKeepUpdated') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktConsentSave', JSON_OBJECT('en_US', 'Save', 'zh_CN', '保存'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentSave') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存') WHERE LOWER(code) = LOWER('TktConsentSave') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktConsentDone', JSON_OBJECT('en_US', 'Thank you. We will keep you updated.', 'zh_CN', '谢谢,我们会向您发送最新资讯。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentDone') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '谢谢,我们会向您发送最新资讯。') WHERE LOWER(code) = LOWER('TktConsentDone') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStaffView', JSON_OBJECT('en_US', 'Staff check-in', 'zh_CN', '工作人员签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStaffView') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '工作人员签到') WHERE LOWER(code) = LOWER('TktStaffView') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktStaffValid', JSON_OBJECT('en_US', 'Valid', 'zh_CN', '有效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStaffValid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '有效') WHERE LOWER(code) = LOWER('TktStaffValid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAlreadyCheckedIn', JSON_OBJECT('en_US', 'Already checked in at {when}', 'zh_CN', '已于 {when} 签到过'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAlreadyCheckedIn') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已于 {when} 签到过') WHERE LOWER(code) = LOWER('TktAlreadyCheckedIn') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotValidReason', JSON_OBJECT('en_US', 'Not valid: {reason}', 'zh_CN', '无效:{reason}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotValidReason') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无效:{reason}') WHERE LOWER(code) = LOWER('TktNotValidReason') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotEventDay', JSON_OBJECT('en_US', 'Check-in is only open on the event days.', 'zh_CN', '仅在活动日开放签到。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotEventDay') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '仅在活动日开放签到。') WHERE LOWER(code) = LOWER('TktNotEventDay') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCheckIn', JSON_OBJECT('en_US', 'Check in', 'zh_CN', '签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckIn') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '签到') WHERE LOWER(code) = LOWER('TktCheckIn') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCheckedInNow', JSON_OBJECT('en_US', 'Checked in.', 'zh_CN', '签到成功。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckedInNow') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '签到成功。') WHERE LOWER(code) = LOWER('TktCheckedInNow') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktUnnamed', JSON_OBJECT('en_US', 'No attendee named yet', 'zh_CN', '尚未填写参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktUnnamed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚未填写参加者') WHERE LOWER(code) = LOWER('TktUnnamed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAttendeeName', JSON_OBJECT('en_US', 'Attendee name', 'zh_CN', '参加者姓名'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeName') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '参加者姓名') WHERE LOWER(code) = LOWER('TktAttendeeName') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktContactRequired', JSON_OBJECT('en_US', 'Enter a mobile number or an email.', 'zh_CN', '请输入手机号码或电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktContactRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入手机号码或电子邮件。') WHERE LOWER(code) = LOWER('TktContactRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'ChkShowTicket', JSON_OBJECT('en_US', 'Please show your ticket at the entrance.', 'zh_CN', '请在入口出示您的门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('ChkShowTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请在入口出示您的门票。') WHERE LOWER(code) = LOWER('ChkShowTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'GuestTicketsAwaiting', JSON_OBJECT('en_US', 'Tickets awaiting payment', 'zh_CN', '待付款门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsAwaiting') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '待付款门票') WHERE LOWER(code) = LOWER('GuestTicketsAwaiting') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'GuestTicketsPaid', JSON_OBJECT('en_US', 'Tickets paid', 'zh_CN', '已付款门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsPaid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已付款门票') WHERE LOWER(code) = LOWER('GuestTicketsPaid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'GuestTicketsCheckedIn', JSON_OBJECT('en_US', 'Tickets checked in', 'zh_CN', '已签到门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsCheckedIn') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已签到门票') WHERE LOWER(code) = LOWER('GuestTicketsCheckedIn') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktErrTicketNotValid', JSON_OBJECT('en_US', 'This ticket is not valid, so it cannot be sent.', 'zh_CN', '此门票无效,无法发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrTicketNotValid') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票无效,无法发送。') WHERE LOWER(code) = LOWER('TktErrTicketNotValid') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktResendTicket', JSON_OBJECT('en_US', 'Resend ticket', 'zh_CN', '重新发送门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktResendTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '重新发送门票') WHERE LOWER(code) = LOWER('TktResendTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktTicketSent', JSON_OBJECT('en_US', 'Ticket sent.', 'zh_CN', '门票已发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketSent') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已发送。') WHERE LOWER(code) = LOWER('TktTicketSent') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktYourTickets', JSON_OBJECT('en_US', 'Your tickets', 'zh_CN', '您的门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktYourTickets') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '您的门票') WHERE LOWER(code) = LOWER('TktYourTickets') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNameAttendeesHelp', JSON_OBJECT('en_US', 'Name each attendee so their ticket can be emailed to them, or share each ticket''s link.', 'zh_CN', '填写每位参加者,以便通过电子邮件将门票发送给他们,或分享每张门票的链接。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNameAttendeesHelp') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '填写每位参加者,以便通过电子邮件将门票发送给他们,或分享每张门票的链接。') WHERE LOWER(code) = LOWER('TktNameAttendeesHelp') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAttendeeSaved', JSON_OBJECT('en_US', 'Saved. The ticket has a new link; the old one no longer works.', 'zh_CN', '已保存。门票已有新链接,旧链接已失效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeSaved') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已保存。门票已有新链接,旧链接已失效。') WHERE LOWER(code) = LOWER('TktAttendeeSaved') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNotNamed', JSON_OBJECT('en_US', 'Not named yet', 'zh_CN', '尚未填写'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotNamed') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚未填写') WHERE LOWER(code) = LOWER('TktNotNamed') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktOpenTicket', JSON_OBJECT('en_US', 'Open ticket', 'zh_CN', '打开门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOpenTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '打开门票') WHERE LOWER(code) = LOWER('TktOpenTicket') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktCopyLink', JSON_OBJECT('en_US', 'Copy link', 'zh_CN', '复制链接'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCopyLink') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '复制链接') WHERE LOWER(code) = LOWER('TktCopyLink') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktLinkCopied', JSON_OBJECT('en_US', 'Link copied.', 'zh_CN', '链接已复制。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktLinkCopied') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '链接已复制。') WHERE LOWER(code) = LOWER('TktLinkCopied') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktNameAttendee', JSON_OBJECT('en_US', 'Name attendee', 'zh_CN', '填写参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNameAttendee') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '填写参加者') WHERE LOWER(code) = LOWER('TktNameAttendee') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktChangeAttendee', JSON_OBJECT('en_US', 'Change attendee', 'zh_CN', '更改参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktChangeAttendee') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '更改参加者') WHERE LOWER(code) = LOWER('TktChangeAttendee') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktAttendeeRequired', JSON_OBJECT('en_US', 'Enter the attendee''s name and a mobile number or an email.', 'zh_CN', '请输入参加者姓名,以及手机号码或电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入参加者姓名,以及手机号码或电子邮件。') WHERE LOWER(code) = LOWER('TktAttendeeRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPermissionRequired', JSON_OBJECT('en_US', 'Tick the box to confirm you have permission.', 'zh_CN', '请勾选以确认您已获得许可。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPermissionRequired') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请勾选以确认您已获得许可。') WHERE LOWER(code) = LOWER('TktPermissionRequired') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktPermission', JSON_OBJECT('en_US', 'I have permission to share these details so their ticket can be sent', 'zh_CN', '我已获得许可分享这些资料,以便发送其门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPermission') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '我已获得许可分享这些资料,以便发送其门票') WHERE LOWER(code) = LOWER('TktPermission') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktRenameWarning', JSON_OBJECT('en_US', 'Saving gives this ticket a new link and QR code. The old ones stop working.', 'zh_CN', '保存后此门票将获得新的链接和二维码,旧的将失效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktRenameWarning') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存后此门票将获得新的链接和二维码,旧的将失效。') WHERE LOWER(code) = LOWER('TktRenameWarning') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'TktSaveAttendee', JSON_OBJECT('en_US', 'Save attendee', 'zh_CN', '保存参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存参加者') WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'LeadSourceTicket', JSON_OBJECT('en_US', 'Ticket', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A';
UPDATE catalog_meta SET version = version + 1, updated_at = NOW() WHERE id = 1;
@@ -0,0 +1,8 @@
-- Co-Lite change add-event-tickets: rollback. Drops attendee naming times and consent records. Ticket codes stay (add-event-ticket-orders owns that column).
USE `service-counter`;
ALTER TABLE `ticket`
DROP KEY `idx_ticket_event_mobile`,
DROP KEY `idx_ticket_event_email`,
DROP COLUMN `attendee_named_at`,
DROP COLUMN `attendee_consent_at`,
DROP COLUMN `attendee_notice_id`;
@@ -0,0 +1,156 @@
# Tasks
Design: `design.md` (technical contracts) and `docs/superpowers/specs/2026-12-04-event-ticketing-design.md` (product).
**Mode:** all tasks run serially in the main session (the owner asked for no worker subagents). Each task starts with failing tests (TDD).
## 1. Data
- [x] 1.1 Write the SQL:
- `sql/01-ticket-attendees.sql`: the three `ticket` columns, the two keys, and codes for active tickets on Paid orders that have none;
- `sql/99-rollback.sql`.
Mirror 01 in `local/seed/03-colite.sql` and apply it to the local database.
- Depends on: none
- Scope: `local/seed/**`, `openspec/changes/add-event-tickets/sql/**`
- Verify: `SHOW CREATE TABLE ticket` shows the columns and keys; local Paid tickets have 22-character codes.
## 2. services-counter
- [x] 2.1 Ticket codes, ticket state and the ticket lookups.
- Depends on: 1.1
- Tests first:
- **Codes:**
- a free order's tickets get codes at creation;
- mark paid (from Awaiting payment and from Expired) gives each active ticket a distinct 22-character code;
- an Awaiting-payment order has none.
- **`TicketState.of`:** valid, checked in, awaiting, order cancelled, order expired and ticket cancelled.
- **`ticket/byCode`:**
- returns the event, type, attendee first name, state and check-in time;
- never returns mobile, email or buyer details;
- an unknown code is 404 `TICKET_NOT_FOUND`.
- **`byToken`:** lists tickets (id, type, attendee name, code, state) only when Paid, without contacts.
- Scope: `solvway-services-counter/src/**`
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
- [x] 2.2 Naming attendees, consent and ticket emails.
- Depends on: 2.1
- Tests first:
- **Naming:**
- refused without `permission`, when the order is not Paid, when the ticket is cancelled, and when it is checked in (`ALREADY_CHECKED_IN`);
- an unknown token or a ticket of another order is 404;
- a save sets a new code and `attendee_named_at`, and clears consent and the lead link.
- **Consent:**
- refused on an invalid or unnamed ticket;
- calls registration with source `TICKET`, the notice and no salesperson, and stores consent time, notice id and lead uuid.
- **Mailer:**
- PAID lists every active ticket with its QR `<img>` URL, its link and the "Name your attendees" link;
- TICKET goes to the attendee's email;
- naming with only a mobile sends nothing.
- **Resend ticket:** goes to the attendee's email, else the buyer; refused for an invalid ticket.
- Scope: `solvway-services-counter/src/**`
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
- [x] 2.3 Door check-in, self check-in rules and the counts.
- Depends on: 2.2
- Tests first:
- **Staff check-in:**
- records the time and user;
- a second check-in gives `ALREADY_CHECKED_IN|<time>`;
- each invalid state gives `NOT_VALID|<state>`;
- outside the event days gives `NOT_EVENT_DAY`;
- an unnamed ticket needs a name and contact;
- consent creates the lead and marks it attended;
- another company's ticket is 404.
- **Self check-in on a ticketed event:**
- a named attendee's ticket is checked in;
- an unnamed ticket matches its buyer, oldest first;
- a registered guest still works;
- anything else gives `SHOW_TICKET`;
- walk-in register is refused with `TICKETS_ONLY`.
- On an event without tickets, the old results are unchanged.
- **Headcount:** tickets awaiting, paid and checked in, counting active tickets only.
- Scope: `solvway-services-counter/src/**`
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
## 3. mobile-api and gateway
- [x] 3.1 Public ticket endpoints, the QR PNG and gateway paths.
- Depends on: 2.3
- Tests first:
- **`GET /api/public/tickets/{code}`:**
- a bad shape is 404 `TICKET_INVALID`;
- the `tkt:load` limit applies;
- the event fields are added.
- **`qr.png`:**
- the PNG decodes back to `<portal>/t/<code>`;
- an invalid ticket is 404;
- the response is `image/png`, `private`.
- **Attendee save:**
- name, mobile and email normalised as in QR registration;
- a missing permission gives a field error;
- counter refusals map to public messages;
- the `tkt:submit` limit applies.
- **Consent:** the current notice id is sent.
- **Order view:** carries the tickets when Paid.
- **Gateway:** the three counter paths are public, other shapes are not.
- Adds `com.google.zxing:core` to `solvway-mobile-api/pom.xml`. This hotspot runs alone.
- Scope: `solvway-mobile-api/**`, `solvway-api-gateway/src/**`
- Verify: `mvn -T 1C -q -pl solvway-mobile-api,solvway-api-gateway verify`
- [x] 3.2 Admin ticket endpoints.
- Depends on: 3.1
- Tests first:
- **`GET /api/admin/tickets/{code}`:** `BO_EVENTS` and company-scoped (another company's ticket is 404).
- **`checkin`:** passes the body, maps 409 codes, is `@Audited`.
- **Resend ticket:** under `BO_EVENT_TICKETS`, `@Audited`.
- **Headcount:** passes the ticket counts.
- **Check-in lookup:** passes `SHOW_TICKET`, and walk-in `TICKETS_ONLY` maps to its message.
- Scope: `solvway-mobile-api/src/**`
- Verify: `mvn -T 1C -q -pl solvway-mobile-api verify`
## 4. admin-portal
- [x] 4.1 The ticket page `/t/[code]`.
- Depends on: 3.2
- Tests first:
- **Public view:** valid, checked in, not valid and unknown.
- **Consent:** only on a valid named ticket, with the notice.
- **Staff view:**
- shown only when the session and admin call succeed;
- a 401, 403 or 404 keeps the public view and never redirects;
- Check in;
- the unnamed form;
- the refusal banners.
- **Routes:**
- the route guard lets `/t/x` through;
- the proxies send one X-Forwarded-For hop;
- the PNG proxy passes bytes and content type.
- Scope: `solvway-admin-portal/app/**`
- Verify: `npx vitest run` (check the exit code), `npx tsc --noEmit`, `npm run lint`
- [x] 4.2 Order page tickets, staff resend, counts, venue check-in message and labels.
- Depends on: 4.1
- Tests first:
- **Order page:**
- a Paid order lists tickets with links and copy buttons;
- the naming form, with the permission tick, mobile or email, and field errors;
- a refusal for a checked-in ticket.
- **Order detail:** Resend ticket per valid ticket.
- **GuestsCard:** the three ticket counts on a ticketed event.
- **`/c/[token]`:** shows "Please show your ticket at the entrance." for `SHOW_TICKET`, with no form.
- **Labels:** English and zh-CN, plus `sql/02-ticket-labels.sql`; seed regenerated.
- Scope: `solvway-admin-portal/app/**`, `openspec/changes/add-event-tickets/sql/**`, `local/seed/04-zh-cn-messages.sql`
- Verify: `npx vitest run` (check the exit code), `npx tsc --noEmit`, `npm run lint`
## 5. Verify and ship
- [x] 5.1 Rebuild the local stack, then check in Playwright, signing in through the form and clicking through.
- On LC CV Expo, use the owner-approved test buyer "Tiket Test", tickets-test@example.com, and ask before any new order.
- Open T-EKBD2K's order page and name an attendee. See the new link and that the old link is not valid.
- On the ticket page, tick the consent and see the lead.
- In the staff view, check a ticket in, then scan it again.
- Check an unpaid ticket's refusal, and an unnamed ticket at the door.
- Venue self check-in: a ticket holder, and a stranger who gets "show your ticket".
- Check the counts on the event page and resend a ticket.
- Take screenshots.
- Depends on: 4.2
- Done 2026-12-04. Not reachable: an unpaid ticket at the door, because an Awaiting order's tickets have no code yet. The staff banner for that state is covered by the page tests. Fixed during the check: the event leads list crashed on source Ticket, and order detail did not show which ticket is whose.
- [x] 5.2 Write the release note in `docs/deployment.md`. Open the PR to main and merge it, then archive the change in its own PR and republish the blueprint.
- Depends on: 5.1
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-12-04
@@ -0,0 +1,22 @@
# Design
## Context
Measured at 1920×1080 on the INS page: top bar 69 px, hero 886 px (set by the form card), trust strip about 122 px, 1077 px in all. The hero grid has `pt-16 pb-12`. Bands get `py-12`. The compact form uses `space-y-4`, and its consent box holds two lines of normal-size text (English and Malay).
## Approaches
1. **Trim spacing (chosen).** Trust band padding, hero padding and the compact form's gaps. It is about 150 px in all, with no field taken away and no setting added.
2. **Side-by-side fields** (Mobile and Email on one row on wide screens). That saves about 80 px more, but the fields get narrower, and the hint and errors under Mobile get harder to lay out. It is kept in reserve.
3. **A form-size setting for staff.** This adds UI for something the page should simply get right.
## Decisions
- The trust band padding is `py-5` only for TRUST. Other bands keep `py-12`.
- The full-width hero grid is `pt-8 pb-8`. The editor's image button still fits in the corner, because it is positioned on the section, not in the padding.
- In the compact form: `space-y-3` between fields, the consent box text is `text-sm`, and the form card's gap is `space-y-3`. The 44 px control heights stay, for touch targets.
- The check is a Playwright measurement at 1920×1080: the bottom of the trust strip at or below 950 px from the top. There is no unit test for pixel heights (jsdom has no layout). Render tests pin the classes instead.
## Risks
- **A tighter consent box is still the consent.** Its text, its checkbox and its required state do not change; only the font size does. `text-sm` (14 px) stays readable.
@@ -0,0 +1,33 @@
# Proposal
## Why
On the INS Hotel technology page (`/p/INS/hotel-technology`), the top bar, the full-width hero with its sign-up form, and the trust strip together are 1077 px tall. A visitor on a 1080p or 1440p desktop sees the trust strip cut off at the bottom of the first screen. The owner wants the hero and the trust strip to fit on one desktop screen. Staff have no way to change the form's size, and the form sets the hero's height.
## What Changes
- **Thinner trust strip.** A trust strip shown as a coloured band uses less padding above and below (about 20 px instead of 48 px), close to INS's 22 px.
- **Less padding in the full-width hero.** It is about 32 px top and bottom, instead of 64 px top and 48 px bottom.
- **Tighter compact form.** The landing-page form (the compact form) has smaller gaps between fields, and the consent box uses small text. The fields, the dropdown and the button keep their 44 px height, so they stay easy to tap.
- **Result.** The INS page's top bar, hero and trust strip fit within 950 px, which shows them in full on a 1920×1080 desktop browser.
Not changing:
- QR, invitation and customer forms.
- Heroes that are not full width, and other band looks.
- Phones, where the hero stacks the form below the text.
- Small laptops (768 px tall). There the form alone is taller than the screen, as on INS's own page.
## Capabilities
### New Capabilities
None.
### Modified Capabilities
- `landing-pages`: adds "First Screen Fits The Hero And Trust Strip".
## Impact
- Portal only: `CmsBlocks.tsx` (trust band padding, full-width hero padding, form card gap) and `RegistrationForm.tsx` (compact spacing and consent text).
- No server, API or data change. No new labels.
@@ -0,0 +1,16 @@
## ADDED Requirements
### Requirement: First Screen Fits The Hero And Trust Strip
A page with a top bar, a full-width hero with its sign-up form, and a trust strip SHALL show all three in full within the first 950 px of a desktop browser window. To fit, the trust strip band SHALL use less padding than other bands, and the landing-page form SHALL keep its fields, dropdown and button at least 44 px tall.
#### Scenario: INS page on a 1080p desktop
- **GIVEN** page `/p/INS/hotel-technology` with a top bar, a full-width hero with a form, and a trust strip
- **WHEN** a visitor opens it in a 1920×1080 browser window
- **THEN** the bottom of the trust strip is within 950 px of the top of the page
#### Scenario: Form controls stay easy to tap
- **WHEN** a visitor opens a landing page with a sign-up form
- **THEN** each text field, the service dropdown and the Register button are at least 44 px tall
@@ -0,0 +1,26 @@
# Tasks
## 1. Portal
- [x] 1.1 `CmsBlocks.tsx`:
- a TRUST band uses `py-5`; other bands keep `py-12`;
- the full-width hero grid uses `pt-8 pb-8`;
- the hero form card uses `space-y-3`.
`RegistrationForm.tsx`, compact only: `space-y-3` between fields, and `text-sm` in the consent box.
Verify: render tests fail first, then pass; vitest exit 0, tsc and lint clean.
## 2. Verification
- [x] 2.1 Use Playwright on port 3001 to measure `/p/INS/hotel-technology` at 1920×1080: the trust strip's bottom is at most 950 px, and the controls are at least 44 px tall. Take screenshots at 1920×1080, 1280×900 and 390 px.
- [x] 2.2 Run `openspec validate add-hero-fits-screen --strict`.
## Notes (2026-12-04)
- **Red first:** the new render tests failed on the trust band padding, the hero padding, the card gap, the compact form gap and the consent text size.
- **Changed existing tests:** none.
- **Measured** on `/p/INS/hotel-technology` at 1920×1080 with Playwright:
- before: hero 886 px, trust strip bottom 1077 px;
- with `pt-10 pb-10`: 953 px, still over the 950 px target, so the hero padding became `pt-8 pb-8`;
- final: hero 802 px, trust strip bottom 937 px. Every text field, the dropdown and the Register button are 44 px.
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-12-04
@@ -0,0 +1,24 @@
# Design
## Context
The company header and the page title are drawn by `LandingPage`, and "hide page header" (`hideHeader`) removes both. Page settings are database columns threaded through services-counter, mobile-api and the portal. Blocks are JSON validated by `CmsBlockValidator`, so a new block or block field needs no schema change.
## Approaches
1. **A Top bar block, used with "hide page header" (chosen).** It is JSON only: no migration, and no changes to the page records in three services. The INS page already uses "hide page header" with a Custom HTML top bar, so this is a native swap for the same layout.
2. **New page settings** ("hide title", header button label and link, heading font). This is the natural model, but it means four new columns and changes to every page DTO, the draft record, the admin and public APIs, and the settings panel. That is about ten times the work for the same result.
3. **Keep the top bar in Custom HTML.** This is what the original page does; the native page exists to avoid it.
## Decisions
- **The top bar is the first block only.** The server refuses it anywhere else (`PagesTopBarFirst`), because a sticky bar in the middle of a page would cover the content as the visitor scrolls past it. The bar is `sticky top-0` with a card background and a bottom border. It runs full width (it counts as bleed), so it joins a full-width hero below it with no gap.
- **Top bar fields.** Only `buttonLabel` and `buttonUrl` (the pair rule, at most 40 characters, a safe link) plus the usual `anchor`. A heading, text, image, cards or look are refused (`PagesUnusedField`). The logo comes from the company's branding, as the default header's does.
- **The label (`eyebrow`).** At most 40 characters, allowed on FEATURES, STEPS, IMAGE_TEXT, FAQ and CTA, and refused on other types. It renders as a `p` above the h2, not as part of the heading, so screen readers read the heading on its own. It can be edited in place on the canvas.
- **Label colour.** On the DARK band it uses `text-primary`, the accent colour. On light backgrounds the accent can be too pale (INS gold on white is about 2:1), so it uses the accent mixed with the foreground colour, `color-mix(in srgb, var(--primary) 60%, var(--foreground))`. On the ACCENT band it uses the band's own text colour.
- **Serif headings.** Section h2s get `font-serif`, Tailwind's system serif, as the full-width hero does. No web font is added. This changes every landing page, CV's included. It is a small change, and it matches the hero.
## Risks
- **CV pages change font.** CV's section headings become serif. If CV wants sans-serif, a later change can make the font a company setting.
- **Sticky bar and same-page links.** A `#name` jump lands with the heading under the bar. `scroll-margin-top` on the named blocks keeps them clear when a top bar exists.
@@ -0,0 +1,42 @@
# Proposal
## Why
The native INS page (`/p/INS/hotel-technology-native`) now matches INS's standalone page in content, but it still looks different at the top and in its section headings:
- INS has a white top bar with the logo on the left and a "Get My Free Consultation" button on the right. The bar stays at the top while the visitor scrolls. Our page has two choices: show the company header and the page title, which INS does not have, or hide both, which also hides the logo.
- INS puts a small gold uppercase label above each section heading ("Services", "How we work", "Why Infinity", "FAQ"). We have no such label.
- INS's section headings are serif. Ours are sans-serif, except for the full-width hero.
## What Changes
- **Top bar block** (`TOPBAR`). It shows the company logo on the left (the company name when there is no logo) and an optional button on the right (`buttonLabel` and `buttonUrl`, with the same link rules as other buttons). It stays at the top of the window while the page scrolls. It may only be the first block. Together with "hide page header", it gives INS's layout: the logo and button stay, and the title and the default header go.
- **Section labels** (`eyebrow`, at most 40 characters). Feature cards, Steps, Image with text, FAQ and Call to action may carry a short label. It shows above the heading in small uppercase letters in the accent colour, darkened on light backgrounds so it stays readable.
- **Serif section headings.** Section headings (h2) on landing pages use the same serif as the full-width hero.
- New editor labels in English and Chinese, with an SQL label file.
Not changing:
- The page settings and the database. "Hide page header" already exists, and the new fields live in the block JSON.
- Card and step layout, and the bullet style in rich text.
- The default company header on pages without a top bar.
## Capabilities
### New Capabilities
None.
### Modified Capabilities
- `landing-pages`: adds "Top Bar Block", "Section Labels" and "Serif Section Headings".
## Impact
- services-counter: `CmsBlock` gains `eyebrow`. `CmsBlockValidator` validates TOPBAR and `eyebrow`.
- mobile-api: none. Public blocks pass through as maps.
- Portal:
- `cmsPages.ts`: the TOPBAR type, its label and empty block, and `eyebrow`;
- `CmsBlocks.tsx`: renders the top bar, the labels and the serif headings;
- `BlockFields.tsx`: the top bar's button and the label field;
- labels in `defaultMessages.ts` and `zh_CN.seed.json`.
- Data: no schema change. The new labels need a SQL label file in this change folder.
@@ -0,0 +1,42 @@
## ADDED Requirements
### Requirement: Top Bar Block
A page's first block MAY be a top bar. The top bar SHALL show the company logo, or the company name when there is no logo, and an optional button, and SHALL stay at the top of the window while the page scrolls. The server SHALL refuse a top bar that is not the first block, or one that carries fields other than its button and link name.
#### Scenario: Logo and button without the page title
- **GIVEN** page `/p/INS/hotel-technology-native` with "hide page header" on, a top bar with the button "Get My Free Consultation" linking to `#consult`, and a full-width hero
- **WHEN** a visitor opens the page and scrolls down
- **THEN** the INS logo and the button stay at the top of the window
- **AND** no page title heading shows, and the hero starts directly under the bar
#### Scenario: Top bar further down is refused
- **WHEN** staff save a page whose top bar is the second block
- **THEN** the save is refused with the reason naming that block
### Requirement: Section Labels
Feature cards, Steps, Image with text, FAQ and Call to action blocks MAY carry a label of at most 40 characters. The page SHALL show the label above the block's heading, in small uppercase letters in the accent colour. The server SHALL refuse a longer label, or a label on any other block type.
#### Scenario: Label above a heading
- **GIVEN** a Feature cards block with the label "Services" and the heading "Everything your guests touch, handled by one team"
- **WHEN** a visitor opens the page
- **THEN** "Services" shows in small uppercase letters directly above the heading
#### Scenario: Type a label in the editor
- **GIVEN** staff editing a Steps block
- **WHEN** they type "How we work" in its label field and save
- **THEN** the page keeps the label
### Requirement: Serif Section Headings
Section headings on landing pages SHALL use the serif typeface that the full-width hero uses.
#### Scenario: Feature heading in serif
- **WHEN** a visitor opens a page with a Feature cards block
- **THEN** its heading uses the serif typeface
@@ -0,0 +1,9 @@
-- The labels added by add-landing-page-polish, cut from the output of `npm run i18n:sql`. Run it only in an environment that already ran add-zh-cn-messages/sql/03-zh-cn-messages.sql; otherwise run that 03 file, which includes these labels.
SET NAMES utf8mb4;
USE `service-system`;
INSERT INTO message (code, content, area) SELECT 'PagesBlockTopBar', JSON_OBJECT('en_US', 'Top bar', 'zh_CN', '顶栏'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesBlockTopBar') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '顶栏') WHERE LOWER(code) = LOWER('PagesBlockTopBar') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesEyebrow', JSON_OBJECT('en_US', 'Label', 'zh_CN', '小标签'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesEyebrow') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '小标签') WHERE LOWER(code) = LOWER('PagesEyebrow') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'PagesTopBarFirst', JSON_OBJECT('en_US', 'The top bar must be the first section.', 'zh_CN', '顶栏必须是第一个区块。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTopBarFirst') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '顶栏必须是第一个区块。') WHERE LOWER(code) = LOWER('PagesTopBarFirst') AND area = 'A';
@@ -0,0 +1,55 @@
# Tasks
## 1. Server
- [x] 1.1 services-counter `CmsBlock`: add `eyebrow`. `CmsBlockValidator`:
- TOPBAR is allowed only at index 0 (`PagesTopBarFirst`); it takes the button pair and `anchor` only, and any other field is refused (`PagesUnusedField`);
- `eyebrow` at most 40 characters on FEATURES, STEPS, IMAGE_TEXT, FAQ and CTA, and refused elsewhere (`PagesUnusedField`).
Verify: new validator tests fail first, then pass; `mvn -T 1C -pl solvway-services-counter verify`.
## 2. Portal
- [x] 2.1 `CmsBlocks.tsx`:
- renders TOPBAR (logo or name, optional button, sticky, full width, joins a full-width hero);
- renders the label above section headings, in the accent colour, darkened on light backgrounds;
- renders section h2s in serif;
- named blocks keep clear of a sticky bar when jumped to.
Verify: render tests fail first, then pass; vitest exit 0.
- [x] 2.2 Editor:
- `cmsPages.ts`: TOPBAR type, label and empty block; `eyebrow`;
- `BlockFields.tsx`: the top bar's button fields, and the label field on the five types; the label is editable in place on the canvas;
- labels in `defaultMessages.ts`, `zh_CN.seed.json` and `sql/01-polish-labels.sql`; regenerate `local/seed/04-zh-cn-messages.sql`.
Verify: editor tests fail first, then pass; tsc and lint clean.
## 3. Verification
- [x] 3.1 Rebuild services-counter. Use Playwright on port 3001 to edit `/p/INS/hotel-technology-native` through the editor:
- turn on "hide page header";
- add a top bar first, with "Get My Free Consultation" linking to `#consult`;
- add the labels "Services", "How we work", "Why Infinity" and "FAQ";
- publish.
Check the published page at 1280 px and 390 px against the INS page, including the bar staying put on scroll.
- [x] 3.2 Run the full portal vitest (exit 0), tsc, lint, Maven verify for services-counter, and `openspec validate add-landing-page-polish --strict`.
- [x] 3.3 Add a release note to `docs/deployment.md` (label SQL).
## Notes (2026-12-04)
- **Red first:**
- the validator tests failed on the top bar and the labels;
- the render tests failed on the top bar, the scroll margin, the labels and the serif headings;
- the editor test failed on the label field and the top bar.
- **Changed existing tests:** none. One of my own new render tests changed before going green: the sticky class sits on the top bar's row, not on the header. A sticky element only sticks inside its parent, and the header's parent is just as tall as the header.
- **Live check** (port 3001, rebuilt counter), on `/p/INS/hotel-technology-native` through the editor:
- "hide page header" was already on;
- added a Top bar section, moved it first, and set "Get My Free Consultation" linking to `#consult`;
- typed the labels "Services", "How we work", "Why Infinity" and "FAQ" on the canvas;
- saved and published.
- **Published result:**
- at 1280 px the logo and button sit in a white bar above the full-width hero, with no title, and the bar stays at the top while scrolling;
- the labels show in darkened gold uppercase above serif headings;
- at 390 px the bar keeps the logo and button, and the hero stacks.
- **Not reachable in the UI, covered by the validator tests:** a top bar that is not first is refused (the server rule; the editor's Move up and Move down allow it, and the refusal shows on the canvas).
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-12-04
+40 -11
View File
@@ -33,7 +33,7 @@ The check-in code SHALL work only on the event days (Malaysia, from the start da
### Requirement: Self check-in of a known person
On the event days, the check-in page SHALL ask for one mobile or email, normalised as in staff capture. When the value matches a registered guest or an event lead of this event, that event lead SHALL be marked attended and the page SHALL show "Welcome, <first name>. You're checked in." Checking in again SHALL show the same welcome and change nothing. The page SHALL never show a guest's or lead's details other than the first name in the welcome.
On the event days, the check-in page SHALL ask for one mobile or email, normalised as in staff capture. On an event that does not sell tickets, when the value matches a registered guest or an event lead of this event, that event lead SHALL be marked attended. After a check-in the page SHALL show "Welcome, <first name>. You're checked in." Checking in again SHALL show the same welcome and change nothing. The page SHALL show no personal details other than the first name.
#### Scenario: Registered guest checks in
@@ -44,7 +44,7 @@ On the event days, the check-in page SHALL ask for one mobile or email, normalis
### Requirement: Self check-in of a walk-in
When the value matches an invited guest who has not registered, or no one, the check-in page SHALL show the walk-in form, blank, with the privacy consent. An accepted submission SHALL capture the person with the QR registration rules and no salesperson, link a matching guest, mark the event lead attended, and show the checked-in page.
On an event that does not sell tickets, when the value matches an invited guest who has not registered, or no one, the check-in page SHALL show the walk-in form, blank, with the privacy consent. An accepted submission SHALL capture the person with the QR registration rules and no salesperson, link a matching guest, mark the event lead attended, and show the checked-in page.
#### Scenario: Invited but not registered
@@ -118,15 +118,7 @@ A guest's status SHALL be derived from the event lead it is linked to: Registere
### Requirement: Event attendance numbers
The event page SHALL show:
- invited: the number of guests, against the invitation cap when set;
- registered: guests linked to an event lead;
- attended: attended event leads;
- walk-ins: event leads not linked to a guest;
- total: registered guests plus walk-ins, against capacity when set.
The numbers SHALL agree with the guest list and the event leads listing. A total above capacity SHALL be shown, not hidden.
The event page SHALL show invited guests (against the cap), registered guests, attended event leads, walk-ins (event leads linked to no guest and not created by a ticket order), held tickets (only when the event sells tickets), and a total of registered plus walk-ins plus held tickets (against capacity). The numbers SHALL agree with the guest list and event leads listing, and a total above capacity SHALL be shown.
#### Scenario: Numbers
@@ -134,6 +126,12 @@ The numbers SHALL agree with the guest list and the event leads listing. A total
- **WHEN** an admin opens the event page
- **THEN** the event page shows invited 40 of 50, registered 30, attended 35, walk-ins 15, total 45 of 100
#### Scenario: Ticket buyers are not walk-ins
- **GIVEN** `KL Hotel Tech Day` has 2 walk-ins, and a buyer whose order holds 3 tickets
- **WHEN** an admin opens the event page
- **THEN** the page shows walk-ins 2, held tickets 3, total 5
### Requirement: Check-in abuse limits
The check-in endpoints SHALL allow at most 300 lookups and submissions per IP per event per 10 minutes, answering "Too many attempts. Try again later." beyond that. The IP SHALL be determined as on the QR page. The check-in page SHALL NOT count against the QR page-load limit.
@@ -142,3 +140,34 @@ The check-in endpoints SHALL allow at most 300 lookups and submissions per IP pe
- **WHEN** 200 guests check in from the venue Wi-Fi within 10 minutes
- **THEN** none of them is refused as too many
### Requirement: Self check-in on a ticketed event
On an event that sells tickets, the check-in page SHALL match the mobile or email only to the attendee of a valid ticket that is not checked in, or to a registered guest. An unnamed ticket SHALL count as its buyer's, and the oldest ticket SHALL be used when several match. A matched ticket SHALL be checked in, and the attendee's event lead marked attended when they have consented. A matched registered guest SHALL be handled as on other events.
#### Scenario: Ticket holder checks in
- **GIVEN** `KL Hotel Tech Day` sells tickets and `Lim Wei` holds a valid ticket named with his mobile
- **WHEN** he enters that mobile on the check-in page on the event day
- **THEN** the page welcomes `Lim` and his ticket is checked in
### Requirement: No walk-ins on a ticketed event
On an event that sells tickets, when the value matches no valid unchecked ticket and no registered guest, the check-in page SHALL show "Please show your ticket at the entrance." It SHALL NOT offer or accept a walk-in submission.
#### Scenario: No walk-ins on a paid event
- **GIVEN** `KL Hotel Tech Day` sells tickets
- **WHEN** a visitor whose mobile matches no valid ticket and no registered guest enters it
- **THEN** the page says "Please show your ticket at the entrance." and shows no form
- **AND** a walk-in submission sent directly is refused
### Requirement: Ticket attendance numbers
When the event sells tickets, the event page SHALL also show tickets awaiting payment, tickets paid and tickets checked in, counting active tickets only. The numbers SHALL agree with the event's orders.
#### Scenario: Ticket counts
- **GIVEN** `KL Hotel Tech Day` has 2 tickets awaiting payment and 5 paid tickets, 3 of them checked in
- **WHEN** an admin opens the event page
- **THEN** the page shows tickets awaiting payment 2, paid 5, checked in 3
+7 -1
View File
@@ -152,7 +152,7 @@ An accepted invite submission SHALL register the guest with the same normalisati
### Requirement: Capacity before the event
When an event has a capacity, invite registrations SHALL be refused before the event days once the number of registered guests plus walk-in event leads reaches it. A refused registration SHALL show "This event is full". On the event days (Malaysia, from the start date through the end date) no registration or check-in SHALL be refused for capacity. Staff capture SHALL never be refused for capacity.
When an event has a capacity, invite registrations and ticket requests SHALL be refused before the event days once registered guests plus walk-in event leads plus held tickets would exceed it; an invite shows "This event is full". On the event days (Malaysia, start through end date) nothing SHALL be refused for capacity, though ticket types keep their own seats. Staff capture SHALL never be refused for capacity.
#### Scenario: Full before the event
@@ -166,6 +166,12 @@ When an event has a capacity, invite registrations SHALL be refused before the e
- **WHEN** the third guest submits their invite
- **THEN** they are registered
#### Scenario: Held tickets fill the event
- **GIVEN** `KL Expo` starts next week, has capacity 10, one registered guest and 9 held tickets
- **WHEN** another guest submits their invite
- **THEN** the page says the event is full and nothing is saved
### Requirement: Guest list access
Users with `BO_EVENTS` SHALL see an event's guest list with each guest's status, invite sent count and salesperson. Only users with `BO_EVENT_GUESTS` SHALL add, paste, remove, copy links for or send invites to guests. Guest endpoints SHALL apply the company scope as everywhere: staff only reach their company's events.
+428
View File
@@ -0,0 +1,428 @@
# event-ticketing Specification
## Purpose
Event ticket sales with payment outside Co-Lite: per-event ticket settings and types, buyer ticket requests from a landing page's Tickets section with seat holds, the buyer's order page and emails, hold expiry, and the staff order screens that mark orders paid or cancel orders and tickets.
## Requirements
### Requirement: Ticket Settings On An Event
An event SHALL have a Tickets switch that is off by default, payment instructions of up to 1000 characters, and hold days from 1 to 14 that default to 3. Only users with `BO_EVENT_TICKETS` SHALL change them. While the switch is off, the event SHALL behave as it did before this change, and no ticket order SHALL be accepted for it. Turning the switch on SHALL require payment instructions.
#### Scenario: Turn tickets on
- **WHEN** a user with `BO_EVENT_TICKETS` turns Tickets on for `KL Hotel Tech Day` with payment instructions `Maybank 5140 1234 5678, ref your order number` and hold days 3
- **THEN** the event shows Tickets on with those instructions and 3 hold days
#### Scenario: Instructions required
- **WHEN** a user turns Tickets on with empty payment instructions
- **THEN** the save is refused on the payment instructions field and nothing changes
#### Scenario: Hold days out of range
- **WHEN** a user saves hold days 15
- **THEN** the save is refused on the hold days field
#### Scenario: Without the permission
- **GIVEN** a user has `BO_EVENTS` but not `BO_EVENT_TICKETS`
- **WHEN** they open the event
- **THEN** they do not see the Tickets section
### Requirement: Ticket Types
A ticketed event SHALL have zero or more ticket types. Each type SHALL have a name of 1 to 80 characters unique within the event, a price in MYR from 0.00 to 99999.99 in whole sen, a quantity of at least 1, an optional sales end date (empty means the event's end date), a sort order and an enabled flag.
#### Scenario: Add types
- **WHEN** staff add `Early bird` at RM 150.00 quantity 20 and `General` at RM 250.00 quantity 100
- **THEN** both types are listed in sort order with their prices and 20 and 100 seats left
### Requirement: Ticket Type Changes
A type with any order SHALL NOT be deleted, only disabled. A type's quantity SHALL NOT be set below the seats it holds. A price change SHALL apply only to orders made after it.
#### Scenario: Type with orders cannot be deleted
- **GIVEN** `Early bird` has an order
- **WHEN** staff delete it
- **THEN** the delete is refused with "This ticket type has orders. Disable it instead."
#### Scenario: Quantity below held seats
- **GIVEN** `Early bird` holds 12 seats
- **WHEN** staff set its quantity to 10
- **THEN** the save is refused on the quantity field
#### Scenario: Price change keeps old orders
- **GIVEN** an order holds 2 `General` tickets at RM 250.00
- **WHEN** staff change `General` to RM 280.00
- **THEN** that order still totals RM 500.00
### Requirement: Seats Held
A ticket SHALL hold a seat while its order is Awaiting payment or Paid and the ticket is not cancelled. A type's seats left SHALL be its quantity minus the seats it holds. Requests SHALL never cause a type to hold more seats than its quantity, including when requests arrive at the same moment. When the event has a capacity, a request made before the event days SHALL be refused if held tickets plus registered guests plus walk-in event leads would exceed it.
#### Scenario: Last seat taken once
- **GIVEN** `VIP` has 1 seat left
- **WHEN** two visitors request 1 `VIP` ticket at the same moment
- **THEN** one order is created and the other request is told `VIP` has only 0 left
#### Scenario: Expired order frees seats
- **GIVEN** an Awaiting-payment order holds 3 `General` tickets
- **WHEN** it expires
- **THEN** `General` shows 3 more seats left
#### Scenario: Event capacity
- **GIVEN** `KL Hotel Tech Day` starts next week with capacity 50, 45 held tickets and 3 registered guests
- **WHEN** a visitor requests 3 tickets
- **THEN** the request is refused with "Only 2 places are left for this event"
### Requirement: Ticket Request
A ticket request SHALL carry a quantity per ticket type from 0 to 10 with a total from 1 to 10, the buyer's name and email (both required), an optional mobile and company, and the privacy notice consent (required). Inputs SHALL be normalised and limited as in staff capture. An accepted request SHALL create one order with a line per type keeping its name and price at the time, one ticket per seat, an order reference unique within the company, and an unguessable link token.
#### Scenario: Request two types
- **WHEN** a visitor requests 2 `General` and 1 `VIP` as `Aisyah`, `aisyah@example.test`, and ticks the consent
- **THEN** an order with 3 tickets totalling RM 1000.00 is Awaiting payment
- **AND** the thank-you shows its reference, lines, total, payment instructions, hold expiry and a "View your order" link
#### Scenario: Missing email or consent
- **WHEN** a visitor submits without an email, or without ticking the consent
- **THEN** nothing is saved and the error shows under that field
### Requirement: Ticket Request Refusals
A request SHALL be refused, saving nothing, when a requested type is disabled, past its sales end date or short of seats, naming the type and its seats left. A request SHALL be accepted only while the event has Tickets on, is enabled, has not passed its end date in Malaysia time, and its company has a privacy notice.
#### Scenario: Over ten
- **WHEN** a visitor requests 11 tickets
- **THEN** the request is refused and nothing is saved
#### Scenario: Sales ended for a type
- **GIVEN** `Early bird` sales ended yesterday
- **WHEN** a visitor requests 1 `Early bird`
- **THEN** the request is refused naming `Early bird`
#### Scenario: Tickets turned off
- **GIVEN** staff turned Tickets off for `KL Hotel Tech Day`
- **WHEN** a visitor submits a request
- **THEN** the request is refused and nothing is saved
### Requirement: Free Orders
An order whose total is RM 0.00 SHALL be Paid when it is created, without staff action. Its thank-you page and email SHALL say the order is confirmed and SHALL NOT show payment instructions.
#### Scenario: Free ticket type
- **GIVEN** `Community pass` is priced RM 0.00
- **WHEN** a visitor requests 2 `Community pass`
- **THEN** the order is Paid at once and the thank-you says it is confirmed
### Requirement: Awaiting-Payment Limit Per Buyer
An email SHALL have at most 3 orders Awaiting payment per event. A further request SHALL be refused with "You already have orders awaiting payment for this event." and nothing SHALL be saved.
#### Scenario: Fourth unpaid order
- **GIVEN** `aisyah@example.test` has 3 orders Awaiting payment for `KL Hotel Tech Day`
- **WHEN** she requests another ticket
- **THEN** the request is refused with that message
### Requirement: Order States
An order SHALL be in one of four states:
- **Awaiting payment.**
- **Paid.**
- **Cancelled.**
- **Expired.**
An order Awaiting payment SHALL hold its seats until its hold expiry, which is the creation time plus the event's hold days at the time of the request. After the hold expiry it SHALL become Expired within 15 minutes. Paid, Cancelled and Expired orders SHALL never expire.
#### Scenario: Hold runs out
- **GIVEN** an order made on 1 December at 10:00 with 3 hold days is still Awaiting payment
- **WHEN** it is 4 December 10:15
- **THEN** the order is Expired and its seats are free
### Requirement: Buyer Becomes An Event Lead
An accepted request SHALL match the buyer to a lead with the QR registration rules, including the existing-lead notes, and create the buyer's event lead with source TICKET, no salesperson, the consent time and notice version, and the page address and UTM values as for a FORM block. A buyer already captured at the event SHALL change nothing on that event lead except a note naming the order reference. These event leads SHALL appear in every lead listing, export and the dashboard.
#### Scenario: New buyer
- **WHEN** `Aisyah`, unknown to INS, requests tickets
- **THEN** staff see `Aisyah` in the event's leads with source Ticket, NEW and OPEN
#### Scenario: Buyer already captured
- **GIVEN** `Aisyah` registered at `KL Hotel Tech Day` through the QR code
- **WHEN** she requests tickets
- **THEN** her event lead keeps source QR, and its notes name the order reference
### Requirement: Order Page
The order link `/o/<token>` SHALL show:
- the event's name, dates and location;
- the order reference, lines, total, state and creation time;
- while Awaiting payment, the payment instructions and hold expiry.
It SHALL show the buyer's name but no other personal details. An unknown token SHALL show "This order link is not valid." The page SHALL be limited to 120 loads per IP per 10 minutes.
#### Scenario: Unpaid order page
- **GIVEN** order `T-7K3M9Q` is Awaiting payment
- **WHEN** the buyer opens its link
- **THEN** the page shows the lines, total, payment instructions and hold expiry
#### Scenario: Unknown link
- **WHEN** a visitor opens `/o/` with an unknown token
- **THEN** the page says the order link is not valid and shows nothing else
### Requirement: Order Emails
The buyer SHALL get an email when their order is created (lines, total, payment instructions, hold expiry and order link), becomes Paid (lines, total, each ticket's QR image and link, and a "Name your attendees" link to the order page), Expires, or is Cancelled by staff. Each email SHALL be recorded in Emails. A failed send SHALL NOT undo the order change, and staff SHALL be able to resend the latest email of an order.
#### Scenario: Order received email
- **WHEN** `Aisyah` requests tickets
- **THEN** she receives an email with the order reference, payment instructions, hold expiry and order link
#### Scenario: Paid email
- **WHEN** staff mark her order of 2 tickets Paid
- **THEN** she receives a confirmation email with 2 QR images, their ticket links and a link to name her attendees
### Requirement: Staff Order Screens
The event's Tickets section SHALL list the event's orders with reference, buyer name, email, ticket count, total, state and creation time, newest first in pages of 50, filterable by state and searchable by reference, name, email or mobile. The order detail SHALL show the lines, tickets, buyer details, payment reference, and who changed the state and when. A user without `BO_EVENT_TICKETS` SHALL NOT see or reach these screens.
#### Scenario: Company separation
- **WHEN** INS staff open an order of a CV event by its address
- **THEN** they get not found
### Requirement: Staff Order Actions
Users with `BO_EVENT_TICKETS` SHALL be able to mark an order paid with an optional payment reference of up to 100 characters (when Awaiting payment, or Expired with all its seats still available), cancel an order that is Awaiting payment or Paid (freeing its seats), cancel one ticket of such an order that has another uncancelled ticket (freeing the seat and lowering the total), and resend the latest order email. Each action SHALL be written to the admin audit log.
#### Scenario: Mark paid with reference
- **GIVEN** order `T-7K3M9Q` is Awaiting payment
- **WHEN** staff mark it paid with reference `MBB 0412 883`
- **THEN** the order is Paid with that reference, their name and the time
- **AND** the audit log records the action
#### Scenario: Expired order after its seats were taken
- **GIVEN** order `T-7K3M9Q` expired, and its `VIP` seat was then taken by another order
- **WHEN** staff mark it paid
- **THEN** the action is refused with "Not enough seats left to confirm this order" and the order stays Expired
#### Scenario: Cancel one ticket
- **GIVEN** a Paid order holds 3 `General` tickets at RM 250.00
- **WHEN** staff cancel one ticket
- **THEN** the order holds 2 tickets, totals RM 500.00, and `General` has one more seat left
### Requirement: Ticket Request Abuse Limits
Ticket requests SHALL follow the QR registration limits: at most 60 requests per client IP per event in 10 minutes, answered above the limit with "Too many registrations from this device. Try again later." A request that fills the hidden honeypot field SHALL get the normal thank-you page and save nothing.
#### Scenario: Too many requests
- **WHEN** one IP submits 61 ticket requests for an event within 10 minutes
- **THEN** the 61st is refused with "Too many registrations from this device. Try again later."
#### Scenario: Honeypot filled
- **WHEN** a request fills the hidden honeypot field
- **THEN** the thank-you page shows and no order is saved
### Requirement: Ticket Codes
When an order becomes Paid, the system SHALL give each of its active tickets an unguessable code of 22 URL-safe characters, unique across all tickets. This SHALL apply when staff mark an order paid (also an Expired one) and when a free order is Paid at once. The ticket's link SHALL be `/t/<code>`. A ticket SHALL be valid only while its order is Paid and the ticket is active.
#### Scenario: Codes on payment
- **GIVEN** order `T-7K3M9Q` holds 2 `General` tickets and is Awaiting payment
- **WHEN** staff mark it paid
- **THEN** each ticket has its own code and link
#### Scenario: Free order
- **WHEN** a visitor requests 1 free `Community pass`
- **THEN** the order is Paid and its ticket has a code at once
### Requirement: Ticket Page
The ticket link `/t/<code>` SHALL be public. It SHALL show the event name, dates and location, the ticket type, the attendee's first name (or "Not named yet") and the ticket's state. It SHALL show the QR image of its own link only while the ticket is valid and not checked in; a checked-in ticket SHALL show "Checked in at <time>". It SHALL never show the buyer's details, the attendee's mobile or email, or other tickets.
#### Scenario: Valid ticket
- **GIVEN** the ticket of `Tan Mei Ling` for `KL Hotel Tech Day` is valid
- **WHEN** she opens its link
- **THEN** the page shows the event, `General`, `Tan` and the QR image
### Requirement: Invalid Ticket Links
A ticket whose order is not Paid, or which is cancelled, SHALL show "This ticket is not valid" with no QR. An unknown code SHALL show "This ticket link is not valid." and nothing else.
#### Scenario: Cancelled ticket
- **GIVEN** a Paid order's ticket was cancelled by staff
- **WHEN** someone opens that ticket's link
- **THEN** the page says the ticket is not valid and shows no QR
#### Scenario: Unknown link
- **WHEN** a visitor opens `/t/` with an unknown code
- **THEN** the page says the ticket link is not valid
### Requirement: Tickets On The Order Page
Once an order is Paid, its order page SHALL list each active ticket with its type, attendee name (or "Not named yet"), state and ticket link. It SHALL NOT show any attendee's mobile or email.
#### Scenario: Paid order page
- **GIVEN** order `T-7K3M9Q` is Paid with 2 tickets, one named `Tan Mei Ling`
- **WHEN** the buyer opens its link
- **THEN** the page lists both tickets with their links, `Tan Mei Ling` and "Not named yet", without Tan's email
### Requirement: Naming Attendees
On a Paid order's page, the buyer SHALL be able to name or rename the attendee of each ticket on its own: a name of up to 100 characters and a mobile or an email, normalised as in QR registration. The save SHALL need the tick "I have permission to share these details so their ticket can be sent"; without it the save SHALL be refused with "Tick the box to confirm you may share these details."
#### Scenario: Permission not ticked
- **WHEN** the buyer saves an attendee without the permission tick
- **THEN** the save is refused and nothing changes
### Requirement: Naming Effects
Saving an attendee SHALL replace the ticket's code, so the old link becomes unknown. It SHALL record the naming time, clear any earlier attendee consent and lead link on that ticket, and email the new attendee their ticket when an email was given.
#### Scenario: Name an attendee
- **GIVEN** `Aisyah`'s order `T-7K3M9Q` is Paid with 2 unnamed tickets
- **WHEN** she names `Tan Mei Ling`, `tan@example.com`, on the first ticket and ticks the permission
- **THEN** that ticket shows `Tan Mei Ling` with a new link
- **AND** Tan receives the ticket email
- **AND** the old link of that ticket says the ticket link is not valid
### Requirement: Naming Refusals
Naming SHALL be refused for a ticket that is checked in ("This ticket is already checked in."), cancelled, or on an order that is not Paid.
#### Scenario: Checked-in ticket
- **GIVEN** a ticket is checked in
- **WHEN** the buyer tries to rename its attendee
- **THEN** the save is refused with "This ticket is already checked in."
### Requirement: Attendee Is Not A Lead Without Consent
A named attendee SHALL NOT be an event lead, and SHALL NOT appear in event leads, lead lists, exports or the dashboard, until they consent themselves. Their details SHALL be used only to deliver and check the ticket. An attendee who never consents SHALL still be able to attend.
#### Scenario: Attendee never opts in
- **GIVEN** `Lim Wei` was named on a Paid ticket and never ticked the consent
- **WHEN** staff open the event leads listing
- **THEN** Lim does not appear
### Requirement: Attendee Consent
A valid ticket's page SHALL offer an optional "Keep me updated about <company> events" with the company's privacy notice in English and Bahasa Malaysia. Ticking it SHALL record the consent time and notice version on the ticket. It SHALL capture the attendee as an event lead with source `TICKET` and no salesperson, matched and normalised as in QR registration, and link the ticket to that event lead.
#### Scenario: Attendee opts in
- **GIVEN** `Tan Mei Ling` was named on a valid ticket
- **WHEN** she ticks "Keep me updated about INS events" on her ticket page
- **THEN** she is an event lead of `KL Hotel Tech Day` with source Ticket
### Requirement: Ticket Email
A named attendee with an email SHALL get a Ticket email in English and Bahasa Malaysia. It SHALL hold the event name, dates and location, the ticket type, the attendee name, the QR image, and the ticket link, which also offers the consent. The QR image SHALL be a PNG of the ticket link served at `/api/public/tickets/<code>/qr.png`. Each email SHALL be recorded in Emails, and a failed send SHALL NOT undo the naming.
#### Scenario: Ticket email
- **WHEN** the buyer names `Tan Mei Ling`, `tan@example.com`
- **THEN** Tan receives an email with the QR image and her ticket link
### Requirement: Staff Ticket View
On the ticket page, a signed-in user with `BO_EVENTS` in the event's company (any company for super admins) SHALL see the staff view: the ticket's state as a large banner and, for a valid ticket that is not checked in, **Check in**. An unnamed ticket SHALL first ask for the attendee's name and a mobile or email. The staff view SHALL offer the same optional consent as the ticket page. Everyone else SHALL see only the public view.
#### Scenario: Another company's staff
- **WHEN** CV staff open a ticket of an INS event
- **THEN** they see only the public view
### Requirement: Door Check-In
Check-in from the staff view SHALL record the time and the staff user on the ticket, and SHALL be written to the admin audit log. When the attendee has consented, now or earlier, their event lead SHALL be marked attended. An unnamed ticket SHALL take the name and contact entered by staff, normalised as in QR registration.
#### Scenario: Staff check in a named ticket
- **GIVEN** `Tan Mei Ling`'s ticket is valid and it is the event day
- **WHEN** event staff scan her QR and tap Check in
- **THEN** the ticket is checked in with their name and the time
#### Scenario: Unnamed ticket at the door
- **GIVEN** a valid ticket was never named
- **WHEN** staff enter `Lim Wei` and his mobile and tap Check in
- **THEN** the ticket is checked in with Lim as its attendee
- **AND** no lead is created unless he ticked the consent
### Requirement: Door Check-In Refusals
Check-in SHALL change nothing and the staff view SHALL show:
- "Already checked in at <time>" for a checked-in ticket;
- a red "Not valid: <reason>" banner for an invalid ticket, the reason being "awaiting payment", "order cancelled", "order expired" or "ticket cancelled";
- "Check-in is only open on the event days." outside the event days.
#### Scenario: Second scan
- **WHEN** staff scan a checked-in ticket again
- **THEN** the page shows "Already checked in at" the first time and nothing changes
#### Scenario: Unpaid ticket at the door
- **GIVEN** an order is Awaiting payment
- **WHEN** staff open one of its ticket links
- **THEN** the page shows "Not valid: awaiting payment" and no Check in button
### Requirement: Resend Ticket
Users with `BO_EVENT_TICKETS` SHALL be able to resend one valid ticket from the order detail. It SHALL go to its attendee's email when named with an email, otherwise to the buyer. The action SHALL be written to the admin audit log.
#### Scenario: Resend a ticket
- **GIVEN** a valid ticket is named `Tan Mei Ling`, `tan@example.com`
- **WHEN** staff resend that ticket
- **THEN** Tan receives the ticket email again
### Requirement: Ticket Abuse Limits
The public ticket page and its QR image SHALL be limited to 120 loads per client IP per 10 minutes. Naming attendees and attendee consent SHALL be limited to 60 submissions per client IP per event per 10 minutes. Above a limit the answer SHALL be "Too many requests from this device. Try again later." The QR image SHALL be served only for a valid code.
#### Scenario: Too many ticket loads
- **WHEN** one IP loads ticket pages 121 times within 10 minutes
- **THEN** the 121st is refused with "Too many requests from this device. Try again later."
+149
View File
@@ -727,3 +727,152 @@ A landing page's sign-up form, in a FORM block or a hero, SHALL show name, mobil
- **WHEN** a visitor opens an event's QR sign-up form
- **THEN** it shows job title, the interest checkboxes and the full notice as before
### Requirement: Thank-You Text On Landing Forms
A FORM block, and a HERO block with an event, MAY carry a thank-you text of at most 200 characters. After a visitor signs up through that block's form, the page SHALL show the text, with contact links, under the thank-you heading. Without it, the thank-you SHALL look as before. The server SHALL refuse an over-long thank-you text, or one on a HERO without an event.
#### Scenario: Visitor sees the page's thank-you text with a call link
- **GIVEN** page `/p/INS/hotel-technology-native` whose hero form has the thank-you text "Prefer to talk now? Call +60 12-833 2775."
- **WHEN** a visitor signs up through the hero form
- **THEN** the page shows the thank-you heading and "Prefer to talk now? Call +60 12-833 2775."
- **AND** "+60 12-833 2775" is a link to `tel:+60128332775`
#### Scenario: No thank-you text keeps today's message
- **WHEN** a visitor signs up through a FORM block without a thank-you text
- **THEN** the page shows only the thank-you heading and the "register another" button, as before
#### Scenario: Thank-you text on a hero without a form is refused
- **WHEN** staff save a HERO block without an event but with a thank-you text
- **THEN** the save is refused with the reason naming the hero's thank-you field
#### Scenario: Set the thank-you text in the editor
- **GIVEN** staff editing a hero that has an event
- **WHEN** they type a thank-you text in the hero's settings and save
- **THEN** the page keeps the text
- **AND** choosing "No form" on the hero clears it
### Requirement: Footer Block
A page MAY hold FOOTER blocks: 1 to 4 columns, each a required title (80 characters) and text (300 characters), and an optional legal line (300 characters). The page SHALL show the columns side by side on wide screens and stacked on phones, keep line breaks, show contact links in the column text, and put the legal line under a thin divider. A new footer SHALL start with the dark look. The server SHALL refuse a footer that breaks these limits, or that has a heading or a column icon.
#### Scenario: Visitor sees a three-column footer with links
- **GIVEN** a published page whose footer has the columns "Infinity Networks Security Sdn Bhd", "Talk to us" with "+603-7623 9807" and "info@infinitynetworks.com.my", and "Website" with "www.infinitynetworks.com.my", and a legal line
- **WHEN** a visitor opens the page in a 1280 px window
- **THEN** the three columns sit side by side on a dark band
- **AND** the phone links to `tel:+60376239807`, the email to `mailto:info@infinitynetworks.com.my`, and the website to `https://www.infinitynetworks.com.my`
- **AND** the legal line sits under a divider
#### Scenario: Add a footer in the editor
- **GIVEN** staff editing a page
- **WHEN** they add a Footer section
- **THEN** the canvas shows a dark footer with two empty columns to type into
- **AND** they can add columns up to 4 and type the legal line
#### Scenario: Footer with five columns is refused
- **WHEN** a page is saved with a footer of 5 columns
- **THEN** the save is refused with the reason naming the footer's columns
### Requirement: Contact Links In Plain Text
Where this spec says text shows contact links, the page SHALL show phone numbers that start with `+` as `tel:` links holding only `+` and digits, email addresses as `mailto:` links, and `https://` or `www.` addresses as `https://` links that open in a new tab. Everything else SHALL stay plain text, never HTML.
#### Scenario: Text with markup stays text
- **GIVEN** a footer column text "<b>Call</b> +60 12-833 2775"
- **WHEN** a visitor opens the page
- **THEN** "<b>Call</b>" shows as written
- **AND** "+60 12-833 2775" links to `tel:+60128332775`
### Requirement: Top Bar Block
A page's first block MAY be a top bar. The top bar SHALL show the company logo, or the company name when there is no logo, and an optional button, and SHALL stay at the top of the window while the page scrolls. The server SHALL refuse a top bar that is not the first block, or one that carries fields other than its button and link name.
#### Scenario: Logo and button without the page title
- **GIVEN** page `/p/INS/hotel-technology-native` with "hide page header" on, a top bar with the button "Get My Free Consultation" linking to `#consult`, and a full-width hero
- **WHEN** a visitor opens the page and scrolls down
- **THEN** the INS logo and the button stay at the top of the window
- **AND** no page title heading shows, and the hero starts directly under the bar
#### Scenario: Top bar further down is refused
- **WHEN** staff save a page whose top bar is the second block
- **THEN** the save is refused with the reason naming that block
### Requirement: Section Labels
Feature cards, Steps, Image with text, FAQ and Call to action blocks MAY carry a label of at most 40 characters. The page SHALL show the label above the block's heading, in small uppercase letters in the accent colour. The server SHALL refuse a longer label, or a label on any other block type.
#### Scenario: Label above a heading
- **GIVEN** a Feature cards block with the label "Services" and the heading "Everything your guests touch, handled by one team"
- **WHEN** a visitor opens the page
- **THEN** "Services" shows in small uppercase letters directly above the heading
#### Scenario: Type a label in the editor
- **GIVEN** staff editing a Steps block
- **WHEN** they type "How we work" in its label field and save
- **THEN** the page keeps the label
### Requirement: Serif Section Headings
Section headings on landing pages SHALL use the serif typeface that the full-width hero uses.
#### Scenario: Feature heading in serif
- **WHEN** a visitor opens a page with a Feature cards block
- **THEN** its heading uses the serif typeface
### Requirement: First Screen Fits The Hero And Trust Strip
A page with a top bar, a full-width hero with its sign-up form, and a trust strip SHALL show all three in full within the first 950 px of a desktop browser window. To fit, the trust strip band SHALL use less padding than other bands, and the landing-page form SHALL keep its fields, dropdown and button at least 44 px tall.
#### Scenario: INS page on a 1080p desktop
- **GIVEN** page `/p/INS/hotel-technology` with a top bar, a full-width hero with a form, and a trust strip
- **WHEN** a visitor opens it in a 1920×1080 browser window
- **THEN** the bottom of the trust strip is within 950 px of the top of the page
#### Scenario: Form controls stay easy to tap
- **WHEN** a visitor opens a landing page with a sign-up form
- **THEN** each text field, the service dropdown and the Register button are at least 44 px tall
### Requirement: Tickets Block
A page MAY hold TICKETS blocks. The page SHALL show each enabled ticket type of the block's event in sort order with its name, its price as `RM 150.00` or `Free`, and its seats left or "Sold out" or "Sales ended", a quantity picker per type with an order total of at most 10, the running total, the buyer's fields and the privacy consent. When the event no longer accepts requests, the block SHALL say ticket sales are closed and the rest of the page SHALL still show.
#### Scenario: Visitor sees ticket types
- **GIVEN** a published page with a TICKETS block for `KL Hotel Tech Day`, whose types are `Early bird` RM 150.00 with 12 left, `General` RM 250.00 with 80 left, and `VIP` RM 500.00 sold out
- **WHEN** a visitor opens the page
- **THEN** the block lists the three types with their prices, shows "Sold out" for `VIP`, and offers no quantity for `VIP`
#### Scenario: Sales closed
- **GIVEN** the event of a TICKETS block ended yesterday
- **WHEN** a visitor opens the page
- **THEN** the block says ticket sales are closed and the other blocks still show
### Requirement: Tickets Block Fields
A TICKETS block SHALL name one event of the page's company that is enabled, not ended and has Tickets on when saved. It MAY have a heading (120 characters), text (1000 characters), a section label, a look and a link name. The server SHALL refuse any other field. Both editors SHALL offer the block and pick its event from the company's events that qualify.
#### Scenario: Event without tickets
- **WHEN** staff save a TICKETS block for an event whose Tickets switch is off
- **THEN** the save is refused on that block's event field
#### Scenario: Add a tickets block in the editor
- **WHEN** staff add a Tickets section in the on-page editor and pick `KL Hotel Tech Day`
- **THEN** the canvas shows that event's ticket types
@@ -0,0 +1,48 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
const mocks = vi.hoisted(() => ({ callMobileApi: vi.fn(), getToken: vi.fn() }));
vi.mock("@/app/lib/server/mobileApi", () => ({ callMobileApi: mocks.callMobileApi }));
vi.mock("@/app/lib/server/session", () => ({ getToken: mocks.getToken }));
import { DELETE, GET, POST, PUT } from "./events/[uuid]/[...path]/route";
// add-event-ticket-orders: the event proxy forwards the ticket settings, ticket types and order endpoints.
const req = (url = "http://localhost/x", init?: RequestInit) => new Request(url, init) as never;
const p = (uuid: string, ...path: string[]) => ({ params: Promise.resolve({ uuid, path }) });
beforeEach(() => {
mocks.callMobileApi.mockReset().mockResolvedValue({ ok: true, data: {} });
mocks.getToken.mockReset().mockResolvedValue("jwt");
});
describe("event ticket proxies", () => {
it("forward settings, types and order actions with the token", async () => {
await GET(req(), p("e1", "tickets", "settings"));
await PUT(req("http://localhost/x", { method: "PUT", body: '{"holdDays":3}' }), p("e1", "tickets", "settings"));
await POST(req("http://localhost/x", { method: "POST", body: '{"name":"General"}' }), p("e1", "ticket-types"));
await PUT(req("http://localhost/x", { method: "PUT", body: '{"name":"General"}' }), p("e1", "ticket-types", "2"));
await DELETE(req(), p("e1", "ticket-types", "2"));
await GET(req("http://localhost/x?status=PAID&q=ais&page=1&evil=1"), p("e1", "orders"));
await GET(req("http://localhost/x?status=PAID"), p("e1", "orders", "300"));
await POST(req("http://localhost/x", { method: "POST", body: '{"paymentRef":"MBB"}' }), p("e1", "orders", "300", "paid"));
await POST(req("http://localhost/x", { method: "POST" }), p("e1", "orders", "300", "tickets", "7", "cancel"));
expect(mocks.callMobileApi.mock.calls).toEqual([
["/api/admin/events/e1/tickets/settings", { token: "jwt" }],
["/api/admin/events/e1/tickets/settings", { method: "PUT", body: { holdDays: 3 }, token: "jwt" }],
["/api/admin/events/e1/ticket-types", { method: "POST", body: { name: "General" }, token: "jwt" }],
["/api/admin/events/e1/ticket-types/2", { method: "PUT", body: { name: "General" }, token: "jwt" }],
["/api/admin/events/e1/ticket-types/2", { method: "DELETE", token: "jwt" }],
["/api/admin/events/e1/orders?status=PAID&q=ais&page=1", { token: "jwt" }],
["/api/admin/events/e1/orders/300", { token: "jwt" }],
["/api/admin/events/e1/orders/300/paid", { method: "POST", body: { paymentRef: "MBB" }, token: "jwt" }],
["/api/admin/events/e1/orders/300/tickets/7/cancel", { method: "POST", body: {}, token: "jwt" }],
]);
});
it("refuse other ticket paths", async () => {
for (const path of [["tickets"], ["ticket-types", "x"], ["orders", "300", "refund"], ["orders", "x"]]) {
expect((await GET(req(), p("e1", ...path))).status).toBe(400);
}
expect(mocks.callMobileApi).not.toHaveBeenCalled();
});
});
@@ -3,23 +3,34 @@ import { callMobileApi } from "@/app/lib/server/mobileApi";
import { getToken } from "@/app/lib/server/session";
import { badRequest, errorResponse, unauthorized } from "@/app/lib/server/apiRoute";
// One proxy for the event guest, check-in and attendance endpoints; mobile-api owns validation and the BO_EVENTS / BO_EVENT_GUESTS guards.
// One proxy for the event guest, check-in, attendance and ticket endpoints; mobile-api owns validation and the
// BO_EVENTS / BO_EVENT_GUESTS / BO_EVENT_TICKETS guards.
type Ctx = { params: Promise<{ uuid: string; path: string[] }> };
const ALLOWED = /^(guests(\/(send|\d+))?|checkin|attendance)$/;
const ALLOWED =
/^(guests(\/(send|\d+))?|checkin|attendance|tickets\/settings|ticket-types(\/\d+)?|orders(\/\d+(\/(paid|cancel|resend|tickets\/\d+\/(cancel|resend)))?)?)$/;
// Event uuids are strings, not numbers; word characters and hyphens cover them and nothing that can alter the upstream path.
const EVENT_ID = /^[\w-]+$/;
async function forward(req: NextRequest, { params }: Ctx, method?: "POST" | "DELETE") {
async function forward(req: NextRequest, { params }: Ctx, method?: "POST" | "PUT" | "DELETE") {
const token = await getToken();
if (!token) return unauthorized();
const { uuid, path } = await params;
if (!EVENT_ID.test(uuid) || !ALLOWED.test(path.join("/"))) return badRequest("Invalid path.");
// Only the preview flag is forwarded; nothing else from the browser's query string.
const preview = new URL(req.url).searchParams.getAll("preview").includes("true") ? "?preview=true" : "";
const target = `/api/admin/events/${encodeURIComponent(uuid)}/${path.map(encodeURIComponent).join("/")}${preview}`;
// Only the preview flag, and the orders list's filter and page, are forwarded from the browser's query string.
const query = new URL(req.url).searchParams;
const forwarded = new URLSearchParams();
if (query.getAll("preview").includes("true")) forwarded.set("preview", "true");
if (path.join("/") === "orders") {
for (const k of ["status", "q", "page"]) {
const v = query.get(k);
if (v) forwarded.set(k, v);
}
}
const qs = forwarded.size ? `?${forwarded}` : "";
const target = `/api/admin/events/${encodeURIComponent(uuid)}/${path.map(encodeURIComponent).join("/")}${qs}`;
const result =
method === "POST"
method === "POST" || method === "PUT"
? await callMobileApi<unknown>(target, { method, body: await req.json().catch(() => ({})), token })
: method
? await callMobileApi<unknown>(target, { method, token })
@@ -31,4 +42,5 @@ async function forward(req: NextRequest, { params }: Ctx, method?: "POST" | "DEL
export const GET = (req: NextRequest, ctx: Ctx) => forward(req, ctx);
export const POST = (req: NextRequest, ctx: Ctx) => forward(req, ctx, "POST");
export const PUT = (req: NextRequest, ctx: Ctx) => forward(req, ctx, "PUT");
export const DELETE = (req: NextRequest, ctx: Ctx) => forward(req, ctx, "DELETE");
@@ -0,0 +1,4 @@
import { publicRoute } from "@/app/lib/server/publicProxy";
// add-event-ticket-orders: the buyer's order page reads its order by the link token.
export const GET = publicRoute("orders", "", "GET");
@@ -0,0 +1,11 @@
import { NextResponse, type NextRequest } from "next/server";
import { forwardPublic } from "@/app/lib/server/publicProxy";
type Ctx = { params: Promise<{ token: string; ticketId: string }> };
// add-event-tickets: the buyer names a ticket's attendee from the order page.
export async function POST(req: NextRequest, { params }: Ctx) {
const { token, ticketId } = await params;
if (!/^\d{1,19}$/.test(ticketId)) return NextResponse.json({ error: "Not found" }, { status: 404 });
return forwardPublic(req, `/api/public/orders/${encodeURIComponent(token)}/tickets/${encodeURIComponent(ticketId)}/attendee`, "POST");
}
@@ -0,0 +1,10 @@
import type { NextRequest } from "next/server";
import { forwardPublic } from "@/app/lib/server/publicProxy";
type Ctx = { params: Promise<{ company: string; slug: string; block: string }> };
// add-event-ticket-orders: a landing page's TICKETS block request (signed out); see publicProxy for the X-Forwarded-For rule.
export async function POST(req: NextRequest, { params }: Ctx) {
const { company, slug, block } = await params;
return forwardPublic(req, `/api/public/pages/${encodeURIComponent(company)}/${encodeURIComponent(slug)}/tickets/${encodeURIComponent(block)}`, "POST");
}
@@ -0,0 +1,59 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
const mocks = vi.hoisted(() => ({ callMobileApi: vi.fn(), callMobileApiBinary: vi.fn() }));
vi.mock("@/app/lib/server/mobileApi", () => ({ callMobileApi: mocks.callMobileApi, callMobileApiBinary: mocks.callMobileApiBinary }));
import { GET as ticketGet } from "./tickets/[token]/route";
import { POST as consentPost } from "./tickets/[token]/consent/route";
import { GET as qrGet } from "./tickets/[token]/qr.png/route";
import { POST as attendeePost } from "./orders/[token]/tickets/[ticketId]/attendee/route";
type Handler = (req: never, ctx: { params: Promise<Record<string, string>> }) => Promise<Response>;
const xff = { "x-forwarded-for": "6.6.6.6, 203.0.113.7" };
const call = (h: unknown, params: Record<string, string>, init: RequestInit = {}) =>
(h as Handler)(new Request("http://localhost/x", init) as never, { params: Promise.resolve(params) });
beforeEach(() => {
mocks.callMobileApi.mockReset().mockResolvedValue({ ok: true, data: { state: "VALID" } });
mocks.callMobileApiBinary.mockReset().mockResolvedValue({ ok: true, data: { body: new Uint8Array([137, 80, 78, 71]).buffer, contentType: "image/png" } });
});
// add-event-tickets: the ticket page, its consent, its QR PNG and naming an attendee, signed out, with only the last X-Forwarded-For hop.
describe("public ticket code proxies", () => {
it("GET a ticket by its code", async () => {
const res = await call(ticketGet, { token: "c/1" }, { headers: xff });
expect(await res.json()).toEqual({ state: "VALID" });
expect(mocks.callMobileApi).toHaveBeenCalledWith("/api/public/tickets/c%2F1", { headers: { "X-Forwarded-For": "203.0.113.7" } });
});
it("POST a consent", async () => {
await call(consentPost, { token: "c1" }, { method: "POST", body: '{"consent":true}', headers: xff });
expect(mocks.callMobileApi).toHaveBeenCalledWith("/api/public/tickets/c1/consent",
{ method: "POST", body: { consent: true }, headers: { "X-Forwarded-For": "203.0.113.7" } });
});
it("POST an attendee to an order's ticket", async () => {
await call(attendeePost, { token: "t/1", ticketId: "7" }, { method: "POST", body: '{"name":"Tan"}', headers: xff });
expect(mocks.callMobileApi).toHaveBeenCalledWith("/api/public/orders/t%2F1/tickets/7/attendee",
{ method: "POST", body: { name: "Tan" }, headers: { "X-Forwarded-For": "203.0.113.7" } });
});
it("refuses a ticket id that is not a number without calling upstream", async () => {
const res = await call(attendeePost, { token: "t1", ticketId: "7/x" }, { method: "POST", body: "{}" });
expect(res.status).toBe(404);
expect(mocks.callMobileApi).not.toHaveBeenCalled();
});
it("passes the QR PNG bytes and type, private, with the client hop", async () => {
const res = await call(qrGet, { token: "c1" }, { headers: xff });
expect(res.headers.get("Content-Type")).toBe("image/png");
expect(res.headers.get("Cache-Control")).toBe("private, max-age=300");
expect(new Uint8Array(await res.arrayBuffer())).toEqual(new Uint8Array([137, 80, 78, 71]));
expect(mocks.callMobileApiBinary).toHaveBeenCalledWith("/api/public/tickets/c1/qr.png", { headers: { "X-Forwarded-For": "203.0.113.7" } });
});
it("answers 404 for a QR that is not there", async () => {
mocks.callMobileApiBinary.mockResolvedValue({ ok: false, status: 404, error: "x" });
expect((await call(qrGet, { token: "c1" })).status).toBe(404);
});
});
@@ -0,0 +1,39 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
const mocks = vi.hoisted(() => ({ callMobileApi: vi.fn() }));
vi.mock("@/app/lib/server/mobileApi", () => ({ callMobileApi: mocks.callMobileApi }));
import { GET as orderGet } from "./orders/[token]/route";
import { POST as ticketsPost } from "./pages/[company]/[slug]/tickets/[block]/route";
type Handler = (req: never, ctx: { params: Promise<Record<string, string>> }) => Promise<Response>;
const xff = { "x-forwarded-for": "6.6.6.6, 203.0.113.7" };
const call = (h: unknown, params: Record<string, string>, init: RequestInit = {}) =>
(h as Handler)(new Request("http://localhost/x", init) as never, { params: Promise.resolve(params) });
beforeEach(() => mocks.callMobileApi.mockReset().mockResolvedValue({ ok: true, data: { reference: "T-1" } }));
// add-event-ticket-orders: the order page and the TICKETS block post, signed out, with only the last X-Forwarded-For hop.
describe("public ticket proxies", () => {
it("GET an order by its token", async () => {
const res = await call(orderGet, { token: "tok/1" }, { headers: xff });
expect(await res.json()).toEqual({ reference: "T-1" });
const [p, opts] = mocks.callMobileApi.mock.calls[0];
expect(p).toBe("/api/public/orders/tok%2F1");
expect(opts.headers).toEqual({ "X-Forwarded-For": "203.0.113.7" });
});
it("POST a ticket request to a page block", async () => {
await call(ticketsPost, { company: "INS", slug: "day/1", block: "2" }, { method: "POST", body: JSON.stringify({ a: 1 }), headers: xff });
const [p, opts] = mocks.callMobileApi.mock.calls[0];
expect(p).toBe("/api/public/pages/INS/day%2F1/tickets/2");
expect(opts).toMatchObject({ method: "POST", body: { a: 1 }, headers: { "X-Forwarded-For": "203.0.113.7" } });
});
it("passes refusals with status and code", async () => {
mocks.callMobileApi.mockResolvedValue({ ok: false, error: "General has only 1 ticket left.", status: 409, code: "TYPE_UNAVAILABLE" });
const res = await call(ticketsPost, { company: "INS", slug: "d", block: "0" }, { method: "POST", body: "{}" });
expect(res.status).toBe(409);
expect(((await res.json()) as Record<string, unknown>).code).toBe("TYPE_UNAVAILABLE");
});
});
@@ -0,0 +1,4 @@
import { publicRoute } from "@/app/lib/server/publicProxy";
// add-event-tickets: the attendee's "keep me updated" on their ticket page.
export const POST = publicRoute("tickets", "/consent", "POST");
@@ -0,0 +1,19 @@
import { NextResponse, type NextRequest } from "next/server";
import { callMobileApiBinary } from "@/app/lib/server/mobileApi";
import { clientIp } from "@/app/lib/server/clientContext";
import type { TokenCtx } from "@/app/lib/server/publicProxy";
// add-event-tickets: a valid ticket's QR as a PNG, for the page and the emails. Rate-limited per client, so the client hop goes along.
export async function GET(req: NextRequest, { params }: TokenCtx) {
const xff = clientIp(req);
const result = await callMobileApiBinary(`/api/public/tickets/${encodeURIComponent((await params).token)}/qr.png`,
{ headers: xff ? { "X-Forwarded-For": xff } : {} });
if (!result.ok) return new NextResponse(null, { status: result.status === 404 ? 404 : 502 });
return new NextResponse(result.data.body, {
headers: {
"Content-Type": result.data.contentType ?? "image/png",
"Cache-Control": "private, max-age=300",
"X-Content-Type-Options": "nosniff",
},
});
}
@@ -0,0 +1,4 @@
import { publicRoute } from "@/app/lib/server/publicProxy";
// add-event-tickets: the public ticket page reads its ticket by the code.
export const GET = publicRoute("tickets", "", "GET");
@@ -0,0 +1,16 @@
import { NextResponse, type NextRequest } from "next/server";
import { callMobileApi } from "@/app/lib/server/mobileApi";
import { getToken } from "@/app/lib/server/session";
import { errorResponse, unauthorized } from "@/app/lib/server/apiRoute";
type Ctx = { params: Promise<{ code: string }> };
// add-event-tickets: door check-in from the staff view.
export async function POST(req: NextRequest, { params }: Ctx) {
const token = await getToken();
if (!token) return unauthorized();
const result = await callMobileApi<unknown>(`/api/admin/tickets/${encodeURIComponent((await params).code)}/checkin`,
{ method: "POST", body: await req.json().catch(() => ({})), token });
if (!result.ok) return errorResponse(result);
return NextResponse.json(result.data ?? {});
}
@@ -0,0 +1,15 @@
import { NextResponse, type NextRequest } from "next/server";
import { callMobileApi } from "@/app/lib/server/mobileApi";
import { getToken } from "@/app/lib/server/session";
import { errorResponse, unauthorized } from "@/app/lib/server/apiRoute";
type Ctx = { params: Promise<{ code: string }> };
// add-event-tickets: the staff view of a scanned ticket. mobile-api checks BO_EVENTS and the event's company.
export async function GET(_req: NextRequest, { params }: Ctx) {
const token = await getToken();
if (!token) return unauthorized();
const result = await callMobileApi<unknown>(`/api/admin/tickets/${encodeURIComponent((await params).code)}`, { token });
if (!result.ok) return errorResponse(result);
return NextResponse.json(result.data ?? {});
}
@@ -0,0 +1,53 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
const mocks = vi.hoisted(() => ({ callMobileApi: vi.fn(), getToken: vi.fn() }));
vi.mock("@/app/lib/server/mobileApi", () => ({ callMobileApi: mocks.callMobileApi }));
vi.mock("@/app/lib/server/session", () => ({ getToken: mocks.getToken }));
import { GET } from "./tickets/[code]/route";
import { POST } from "./tickets/[code]/checkin/route";
const req = (init?: RequestInit) => new Request("http://localhost/x", init) as never;
const p = (code: string) => ({ params: Promise.resolve({ code }) });
beforeEach(() => {
mocks.callMobileApi.mockReset().mockResolvedValue({ ok: true, data: { state: "VALID" } });
mocks.getToken.mockReset().mockResolvedValue("jwt");
});
// add-event-tickets: the staff ticket view and door check-in go to mobile-api with the session token.
describe("staff ticket proxies", () => {
it("forward the view and the check-in with the token", async () => {
await GET(req(), p("c/1"));
await POST(req({ method: "POST", body: '{"name":"Lim Wei"}' }), p("c1"));
expect(mocks.callMobileApi.mock.calls).toEqual([
["/api/admin/tickets/c%2F1", { token: "jwt" }],
["/api/admin/tickets/c1/checkin", { method: "POST", body: { name: "Lim Wei" }, token: "jwt" }],
]);
});
it("answer 401 without a session and never call upstream", async () => {
mocks.getToken.mockResolvedValue(undefined);
expect((await GET(req(), p("c1"))).status).toBe(401);
expect((await POST(req({ method: "POST", body: "{}" }), p("c1"))).status).toBe(401);
expect(mocks.callMobileApi).not.toHaveBeenCalled();
});
it("pass a refusal with its status and code", async () => {
mocks.callMobileApi.mockResolvedValue({ ok: false, status: 409, error: "NOT_EVENT_DAY", code: "NOT_EVENT_DAY" });
const res = await POST(req({ method: "POST", body: "{}" }), p("c1"));
expect(res.status).toBe(409);
expect(((await res.json()) as Record<string, unknown>).code).toBe("NOT_EVENT_DAY");
});
});
import { POST as eventPost } from "./events/[uuid]/[...path]/route";
describe("event proxy: resend one ticket", () => {
it("forwards a ticket resend and refuses other ticket actions", async () => {
await eventPost(req({ method: "POST" }), { params: Promise.resolve({ uuid: "e1", path: ["orders", "300", "tickets", "7", "resend"] }) });
expect(mocks.callMobileApi).toHaveBeenCalledWith("/api/admin/events/e1/orders/300/tickets/7/resend", { method: "POST", body: {}, token: "jwt" });
const bad = await eventPost(req({ method: "POST" }), { params: Promise.resolve({ uuid: "e1", path: ["orders", "300", "tickets", "7", "checkin"] }) });
expect(bad.status).toBe(400);
});
});
@@ -0,0 +1,30 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
const mocks = vi.hoisted(() => ({ getCheckin: vi.fn(), lookupCheckin: vi.fn(), registerWalkIn: vi.fn() }));
vi.mock("@/app/lib/services/publicInvite", () => mocks);
vi.mock("next/navigation", () => ({ useParams: () => ({ token: "chk1" }) }));
import CheckinPage from "./page";
beforeEach(() => {
mocks.getCheckin.mockReset().mockResolvedValue({
state: "OPEN", eventName: "Expo 2026", startDate: "2026-12-01", endDate: "2026-12-02", location: "KLCC", companyName: "INS",
notice: { id: 7, textEn: "We keep your data safe.", textMs: "Data anda selamat." }, interests: [],
});
mocks.lookupCheckin.mockReset().mockResolvedValue({ result: "SHOW_TICKET" });
});
// add-event-tickets: on a ticketed event an unmatched visitor is sent to the entrance, with no walk-in form.
describe("/c/[token] on a ticketed event", () => {
it("asks a visitor with no ticket to show it at the entrance", async () => {
const user = userEvent.setup();
render(<CheckinPage />);
await user.type(await screen.findByLabelText("Mobile number or email"), "0125550101");
await user.click(screen.getByRole("button", { name: "Check in" }));
expect(await screen.findByText("Please show your ticket at the entrance.")).toBeInTheDocument();
expect(screen.queryByLabelText("Your name")).not.toBeInTheDocument();
expect(mocks.registerWalkIn).not.toHaveBeenCalled();
});
});
+4 -3
View File
@@ -2,7 +2,7 @@
import { useEffect, useState, type FormEvent } from "react";
import { useParams } from "next/navigation";
import { AlertCircle, CheckCircle2, Clock, Loader2 } from "lucide-react";
import { AlertCircle, CheckCircle2, Clock, Loader2, Ticket } from "lucide-react";
import { Button } from "@/app/components/ui/button";
import { Input } from "@/app/components/ui/input";
import { Label } from "@/app/components/ui/label";
@@ -11,7 +11,7 @@ import { RegistrationForm, apiData, failMessage } from "@/app/components/registr
import { getCheckin, lookupCheckin, registerWalkIn, type CheckinState } from "@/app/lib/services/publicInvite";
import { useT } from "@/app/lib/i18n/MessagesProvider";
type Phase = "loading" | "inactive" | "error" | "lookup" | "form" | "welcome" | "done";
type Phase = "loading" | "inactive" | "error" | "lookup" | "form" | "welcome" | "done" | "showTicket";
// Public event check-in page (QR at the venue): a known person is looked up by mobile or email, anyone else registers as a walk-in.
export default function CheckinPage() {
@@ -52,7 +52,7 @@ export default function CheckinPage() {
if (r.result === "CHECKED_IN") {
setFirstName(r.firstName);
setPhase("welcome");
} else setPhase("form");
} else setPhase(r.result === "SHOW_TICKET" ? "showTicket" : "form"); // a ticketed event takes no walk-ins
} catch (err) {
if (apiData(err).code === "CODE_INACTIVE") setPhase("inactive");
else setError(failMessage(t, err, "InviteTooMany"));
@@ -72,6 +72,7 @@ export default function CheckinPage() {
let body;
if (phase === "welcome") body = <VisitorState icon={CheckCircle2} heading={firstName ? t("InviteWelcome", { name: firstName }) : t("InviteWelcomeAnon")} role="status" />;
else if (phase === "showTicket") body = <VisitorState icon={Ticket} heading={t("ChkShowTicket")} role="status" />;
else if (phase === "done") body = <VisitorState icon={CheckCircle2} heading={t("ChkDone", { event: open.eventName })} role="status" />;
else if (phase === "form") {
body = <RegistrationForm tooManyKey="InviteTooMany" info={open} initial={value.includes("@") ? { email: value.trim() } : { mobile: value.trim() }} submit={(b) => registerWalkIn(token, b)} onDone={() => setPhase("done")} onInactive={() => setPhase("inactive")} />;
@@ -27,7 +27,7 @@ const GUESTS = [
guest({ id: 3, name: "Cara", registeredAt: "2026-12-02T00:00:00Z", token: "t3" }),
guest({ id: 4, name: "Dan", registeredAt: "2026-12-02T00:00:00Z", attended: true, token: "t4" }),
];
const ATT = { invited: 4, cap: 10, registered: 2, attended: 1, walkIns: 3, total: 5, capacity: 100 };
const ATT = { invited: 4, cap: 10, registered: 2, attended: 1, walkIns: 3, heldTickets: 6, total: 11, capacity: 100 };
const asAdmin = (guests: boolean) =>
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" || (guests && m === "BO_EVENT_GUESTS") });
@@ -48,7 +48,7 @@ describe("GuestsCard", () => {
render(<GuestsCard eventUuid="u1" />);
const strip = await screen.findByRole("list", { name: "Attendance numbers" });
const val = (label: string) => within(strip).getByText(label).nextSibling?.textContent;
expect(["Invited", "Invitation cap", "Registered", "Attended", "Walk-ins", "Total", "Capacity"].map(val)).toEqual(["4", "10", "2", "1", "3", "5", "100"]);
expect(["Invited", "Invitation cap", "Registered", "Attended", "Walk-ins", "Held tickets", "Total", "Capacity"].map(val)).toEqual(["4", "10", "2", "1", "3", "6", "11", "100"]);
expect(mocks.getAttendance).toHaveBeenCalledWith("u1");
});
@@ -0,0 +1,39 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, within } from "@testing-library/react";
const mocks = vi.hoisted(() => ({
listGuests: vi.fn(), addGuests: vi.fn(), removeGuest: vi.fn(), sendInvites: vi.fn(), getAttendance: vi.fn(), useAdminAuth: vi.fn(),
}));
vi.mock("@/app/lib/services/adminGuests", () => mocks);
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: mocks.useAdminAuth }));
import { GuestsCard } from "./GuestsCard";
const ATT = { invited: 0, cap: null, registered: 0, attended: 3, walkIns: 0, heldTickets: 7, total: 7, capacity: 100,
ticketsAwaiting: 2, ticketsPaid: 5, ticketsCheckedIn: 3 };
beforeEach(() => {
mocks.listGuests.mockReset().mockResolvedValue([]);
mocks.getAttendance.mockReset().mockResolvedValue(ATT);
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" });
});
const number = async (label: string) => {
const list = await screen.findByRole("list", { name: "Attendance numbers" });
return within(list).queryByText(label)?.parentElement?.textContent;
};
// add-event-tickets: a ticketed event's numbers add tickets awaiting payment, paid and checked in.
describe("GuestsCard ticket numbers", () => {
it("shows the three ticket counts when the event sells tickets", async () => {
render(<GuestsCard eventUuid="e1" ticketsEnabled />);
expect(await number("Tickets awaiting payment")).toBe("Tickets awaiting payment2");
expect(await number("Tickets paid")).toBe("Tickets paid5");
expect(await number("Tickets checked in")).toBe("Tickets checked in3");
});
it("hides them on an event without tickets", async () => {
render(<GuestsCard eventUuid="e1" />);
expect(await number("Tickets paid")).toBeUndefined();
});
});
@@ -44,7 +44,7 @@ const parseLines = (text: string): GuestInput[] =>
return { name, mobile, email, companyName };
});
export function GuestsCard({ eventUuid, team = [] }: { eventUuid: string; team?: AdminEventMember[] }) {
export function GuestsCard({ eventUuid, team = [], ticketsEnabled = false }: { eventUuid: string; team?: AdminEventMember[]; ticketsEnabled?: boolean }) {
const t = useT();
const { hasModule } = useAdminAuth();
const canManage = hasModule("BO_EVENT_GUESTS");
@@ -167,6 +167,12 @@ export function GuestsCard({ eventUuid, team = [] }: { eventUuid: string; team?:
[t("GuestRegistered"), att?.registered],
[t("GuestAttended"), att?.attended],
[t("GuestWalkIns"), att?.walkIns],
[t("GuestHeldTickets"), att?.heldTickets],
...(ticketsEnabled ? [
[t("GuestTicketsAwaiting"), att?.ticketsAwaiting],
[t("GuestTicketsPaid"), att?.ticketsPaid],
[t("GuestTicketsCheckedIn"), att?.ticketsCheckedIn],
] as [string, number | undefined][] : []),
[t("GuestTotal"), att?.total],
[t("EvtCapacity"), att?.capacity],
];
@@ -177,7 +183,7 @@ export function GuestsCard({ eventUuid, team = [] }: { eventUuid: string; team?:
<CardTitle>{t("GuestsTitle")}</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<ul aria-label={t("GuestNumbers")} className="grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-7">
<ul aria-label={t("GuestNumbers")} className="grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-8">
{numbers.map(([label, value]) => (
<li key={label} className="rounded-md border p-2">
<span className="block text-xs text-muted-foreground">{label}</span>
@@ -0,0 +1,12 @@
"use client";
import { Badge } from "@/app/components/ui/badge";
import { useT } from "@/app/lib/i18n/MessagesProvider";
import type { OrderStatus } from "@/app/lib/services/adminTickets";
const VARIANT = { AWAITING: "warning", PAID: "positive", CANCELLED: "neutral", EXPIRED: "negative" } as const;
export function OrderStatusBadge({ status }: { status: OrderStatus }) {
const t = useT();
return <Badge variant={VARIANT[status] ?? "neutral"}>{t(`TktStatus${status}`)}</Badge>;
}
@@ -0,0 +1,118 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { ApiError } from "@/app/lib/clientApi";
const mocks = vi.hoisted(() => ({
getTicketSettings: vi.fn(),
saveTicketSettings: vi.fn(),
listTicketTypes: vi.fn(),
saveTicketType: vi.fn(),
deleteTicketType: vi.fn(),
useAdminAuth: vi.fn(),
}));
vi.mock("@/app/lib/services/adminTickets", async (orig) => ({ ...(await orig<object>()), ...mocks }));
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: mocks.useAdminAuth }));
import { TicketsCard } from "./TicketsCard";
const TYPES = [
{ id: 1, name: "Early bird", priceSen: 15000, quantity: 20, salesEndDate: "2027-01-10", sort: 0, enabled: true, held: 8, left: 12 },
{ id: 2, name: "Community pass", priceSen: 0, quantity: 50, salesEndDate: null, sort: 1, enabled: false, held: 0, left: 50 },
];
const refused = (code: string, field?: string) =>
new ApiError(code, 400, { error: code, code, ...(field ? { details: { field } } : {}) });
beforeEach(() => {
mocks.getTicketSettings.mockReset().mockResolvedValue({ ticketsEnabled: false, paymentInstructions: null, holdDays: 3 });
mocks.saveTicketSettings.mockReset().mockResolvedValue({});
mocks.listTicketTypes.mockReset().mockResolvedValue(TYPES);
mocks.saveTicketType.mockReset().mockResolvedValue({});
mocks.deleteTicketType.mockReset().mockResolvedValue({});
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" || m === "BO_EVENT_TICKETS" });
});
describe("TicketsCard", () => {
it("is hidden without BO_EVENT_TICKETS", () => {
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" });
const { container } = render(<TicketsCard eventUuid="u1" />);
expect(container).toBeEmptyDOMElement();
expect(mocks.getTicketSettings).not.toHaveBeenCalled();
});
it("saves the settings and shows a refusal under its field", async () => {
const user = userEvent.setup();
mocks.saveTicketSettings.mockRejectedValueOnce(refused("PAYMENT_INSTRUCTIONS_REQUIRED", "paymentInstructions"));
render(<TicketsCard eventUuid="u1" />);
await user.click(await screen.findByRole("switch", { name: "Sell tickets" }));
await user.click(screen.getByRole("button", { name: "Save ticket settings" }));
expect(await screen.findByText("Enter the payment instructions before turning tickets on.")).toBeInTheDocument();
await user.type(screen.getByLabelText("Payment instructions"), "Maybank 5140");
await user.clear(screen.getByLabelText("Hold days"));
await user.type(screen.getByLabelText("Hold days"), "5");
await user.click(screen.getByRole("button", { name: "Save ticket settings" }));
await waitFor(() =>
expect(mocks.saveTicketSettings).toHaveBeenLastCalledWith("u1", { ticketsEnabled: true, paymentInstructions: "Maybank 5140", holdDays: 5 }),
);
expect(await screen.findByText("Ticket settings saved.")).toBeInTheDocument();
});
it("lists the types with price, Free, seats left and state", async () => {
render(<TicketsCard eventUuid="u1" />);
const early = await screen.findByRole("row", { name: /Early bird/ });
expect(within(early).getByText("RM 150.00")).toBeInTheDocument();
expect(within(early).getByText("12")).toBeInTheDocument();
const pass = screen.getByRole("row", { name: /Community pass/ });
expect(within(pass).getByText("Free")).toBeInTheDocument();
expect(within(pass).getByText("Disabled")).toBeInTheDocument();
});
it("adds a type with its price in ringgit", async () => {
const user = userEvent.setup();
render(<TicketsCard eventUuid="u1" />);
await screen.findByText("Early bird");
await user.type(screen.getByLabelText("Ticket name"), "General");
await user.type(screen.getByLabelText("Price (RM)"), "250");
await user.type(screen.getByLabelText("Quantity"), "100");
await user.click(screen.getByRole("button", { name: "Add ticket type" }));
await waitFor(() =>
expect(mocks.saveTicketType).toHaveBeenCalledWith("u1", { name: "General", priceSen: 25000, quantity: 100, salesEndDate: null, sort: 2, enabled: true }, undefined),
);
expect(mocks.listTicketTypes).toHaveBeenCalledTimes(2);
});
it("edits a type and shows a quantity refusal", async () => {
const user = userEvent.setup();
mocks.saveTicketType.mockRejectedValueOnce(refused("QUANTITY_BELOW_HELD", "quantity"));
render(<TicketsCard eventUuid="u1" />);
await user.click(within(await screen.findByRole("row", { name: /Early bird/ })).getByRole("button", { name: "Edit" }));
const qty = screen.getByLabelText("Quantity");
await user.clear(qty);
await user.type(qty, "5");
await user.click(screen.getByRole("button", { name: "Save ticket type" }));
expect(await screen.findByText("The quantity cannot be below the seats already held.")).toBeInTheDocument();
expect(mocks.saveTicketType).toHaveBeenCalledWith("u1", expect.objectContaining({ name: "Early bird", quantity: 5, priceSen: 15000 }), 1);
});
it("disables a type", async () => {
const user = userEvent.setup();
render(<TicketsCard eventUuid="u1" />);
await user.click(within(await screen.findByRole("row", { name: /Early bird/ })).getByRole("button", { name: "Disable" }));
await waitFor(() => expect(mocks.saveTicketType).toHaveBeenCalledWith("u1", expect.objectContaining({ name: "Early bird", enabled: false }), 1));
});
it("shows why a type with orders cannot be deleted", async () => {
const user = userEvent.setup();
mocks.deleteTicketType.mockRejectedValueOnce(new ApiError("TYPE_HAS_ORDERS", 409, { error: "TYPE_HAS_ORDERS", code: "TYPE_HAS_ORDERS" }));
render(<TicketsCard eventUuid="u1" />);
await user.click(within(await screen.findByRole("row", { name: /Early bird/ })).getByRole("button", { name: "Delete" }));
await user.click(within(screen.getByRole("dialog")).getByRole("button", { name: "Delete" }));
expect(await screen.findByText("This ticket type has orders. Disable it instead.")).toBeInTheDocument();
expect(mocks.deleteTicketType).toHaveBeenCalledWith("u1", 1);
});
it("links to the orders", async () => {
render(<TicketsCard eventUuid="u1" />);
expect(await screen.findByRole("link", { name: "View orders" })).toHaveAttribute("href", "/events/u1/orders");
});
});
@@ -0,0 +1,305 @@
"use client";
import Link from "next/link";
import { useCallback, useEffect, useState } from "react";
import { Badge } from "@/app/components/ui/badge";
import { Button } from "@/app/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/app/components/ui/card";
import { ConfirmDialog } from "@/app/components/ui/confirm-dialog";
import { DatePicker } from "@/app/components/ui/date-picker";
import { Input } from "@/app/components/ui/input";
import { Label } from "@/app/components/ui/label";
import { ErrorState } from "@/app/components/ui/states";
import { Switch } from "@/app/components/ui/switch";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table";
import { Textarea } from "@/app/components/ui/textarea";
import { useAdminAuth } from "@/app/lib/AdminAuthContext";
import { ApiError } from "@/app/lib/clientApi";
import { useT } from "@/app/lib/i18n/MessagesProvider";
import {
TICKET_ERRORS,
deleteTicketType,
getTicketSettings,
listTicketTypes,
money,
saveTicketSettings,
saveTicketType,
type TicketSettings,
type TicketType,
type TicketTypeInput,
} from "@/app/lib/services/adminTickets";
type Form = { id?: number; name: string; price: string; quantity: string; salesEndDate: string; enabled: boolean };
const EMPTY: Form = { name: "", price: "", quantity: "", salesEndDate: "", enabled: true };
const PRICE = /^\d{1,5}(\.\d{1,2})?$/;
/** A refusal's label and the field it belongs to; anything unknown falls back to the caller's generic text. */
function refusal(err: unknown): { code?: string; field?: string } {
if (!(err instanceof ApiError) || err.status < 400 || err.status >= 500) return {};
const body = err.data as { code?: string; details?: { field?: string } } | undefined;
return { code: body?.code, field: body?.details?.field };
}
/** add-event-ticket-orders: the event's Tickets section (BO_EVENT_TICKETS): settings, ticket types and a link to the orders. */
export function TicketsCard({ eventUuid }: { eventUuid: string }) {
const { hasModule } = useAdminAuth();
if (!hasModule("BO_EVENT_TICKETS")) return null;
return <TicketsCardContent eventUuid={eventUuid} />;
}
function TicketsCardContent({ eventUuid }: { eventUuid: string }) {
const t = useT();
const [settings, setSettings] = useState<TicketSettings | null>(null);
const [holdDays, setHoldDays] = useState("3");
const [types, setTypes] = useState<TicketType[] | null>(null);
const [loadError, setLoadError] = useState(false);
const [form, setForm] = useState<Form>(EMPTY);
const [errors, setErrors] = useState<Record<string, string>>({});
const [error, setError] = useState<string | null>(null);
const [notice, setNotice] = useState<string | null>(null);
const [deleting, setDeleting] = useState<TicketType | null>(null);
const [busy, setBusy] = useState(false);
const load = useCallback(async () => {
try {
const [s, list] = await Promise.all([getTicketSettings(eventUuid), listTicketTypes(eventUuid)]);
setSettings(s);
setHoldDays(String(s.holdDays ?? 3));
setTypes(list);
setLoadError(false);
} catch {
setLoadError(true);
}
}, [eventUuid]);
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect -- load() fetches from the API; its setState runs after the await.
load();
}, [load]);
/** Runs a save; a refusal goes under its field when it names one, else into the card's error line. */
async function run(action: () => Promise<void>, failed: string) {
setErrors({});
setError(null);
setNotice(null);
setBusy(true);
try {
await action();
} catch (err) {
const { code, field } = refusal(err);
const label = code && TICKET_ERRORS[code] ? t(TICKET_ERRORS[code]) : failed;
if (field) setErrors({ [field]: label });
else setError(label);
} finally {
setBusy(false);
}
}
const saveSettings = (e: React.FormEvent) => {
e.preventDefault();
if (!settings) return;
return run(async () => {
const next = { ...settings, holdDays: Number(holdDays) };
await saveTicketSettings(eventUuid, next);
setSettings(next);
setNotice(t("TktSettingsSaved"));
}, t("TktSaveFailed"));
};
const input = (f: Form): TicketTypeInput | null => {
const bad: Record<string, string> = {};
if (!PRICE.test(f.price.trim())) bad.priceSen = t("TktErrPrice");
if (!/^\d+$/.test(f.quantity.trim())) bad.quantity = t("TktErrQuantity");
if (Object.keys(bad).length) {
setErrors(bad);
return null;
}
const sort = f.id == null ? (types?.length ?? 0) : (types?.find((x) => x.id === f.id)?.sort ?? 0);
return {
name: f.name.trim(),
priceSen: Math.round(Number(f.price.trim()) * 100),
quantity: Number(f.quantity.trim()),
salesEndDate: f.salesEndDate || null,
sort,
enabled: f.enabled,
};
};
const saveType = (e: React.FormEvent) => {
e.preventDefault();
const body = input(form);
if (!body) return;
return run(async () => {
await saveTicketType(eventUuid, body, form.id);
setForm(EMPTY);
await load();
}, t("TktSaveFailed"));
};
const toggle = (x: TicketType) =>
run(async () => {
await saveTicketType(eventUuid, { name: x.name, priceSen: x.priceSen, quantity: x.quantity, salesEndDate: x.salesEndDate, sort: x.sort, enabled: !x.enabled }, x.id);
await load();
}, t("TktSaveFailed"));
const remove = async () => {
const x = deleting;
setDeleting(null);
if (x)
await run(async () => {
await deleteTicketType(eventUuid, x.id);
await load();
}, t("TktSaveFailed"));
};
const edit = (x: TicketType) => {
setErrors({});
setForm({ id: x.id, name: x.name, price: (x.priceSen / 100).toFixed(2), quantity: String(x.quantity), salesEndDate: x.salesEndDate ?? "", enabled: x.enabled });
};
const fieldError = (field: string) => errors[field] && <p className="text-sm text-destructive">{errors[field]}</p>;
return (
<Card>
<CardHeader className="flex flex-row items-center justify-between gap-2">
<CardTitle>{t("TktTitle")}</CardTitle>
<Button asChild variant="outline" size="sm">
<Link href={`/events/${encodeURIComponent(eventUuid)}/orders`}>{t("TktViewOrders")}</Link>
</Button>
</CardHeader>
<CardContent className="space-y-6">
{loadError && <ErrorState message={t("TktLoadFailed")} onRetry={load} />}
{error && <p role="alert" className="text-sm text-destructive">{error}</p>}
{notice && <p role="status" className="text-sm text-muted-foreground">{notice}</p>}
{settings && (
<form onSubmit={saveSettings} className="space-y-3">
<div className="flex items-center gap-2">
<Switch
id="tickets-enabled"
aria-label={t("TktSellTickets")}
checked={settings.ticketsEnabled}
onCheckedChange={(on) => setSettings({ ...settings, ticketsEnabled: on })}
/>
<Label htmlFor="tickets-enabled">{t("TktSellTickets")}</Label>
</div>
<div className="space-y-1">
<Label htmlFor="tickets-instructions">{t("TktPaymentInstructions")}</Label>
<Textarea
id="tickets-instructions"
maxLength={1000}
value={settings.paymentInstructions ?? ""}
onChange={(e) => setSettings({ ...settings, paymentInstructions: e.target.value })}
/>
<p className="text-xs text-muted-foreground">{t("TktPaymentInstructionsHelp")}</p>
{fieldError("paymentInstructions")}
</div>
<div className="max-w-40 space-y-1">
<Label htmlFor="tickets-hold">{t("TktHoldDays")}</Label>
<Input id="tickets-hold" type="number" min={1} max={14} value={holdDays} onChange={(e) => setHoldDays(e.target.value)} />
{fieldError("holdDays")}
</div>
<Button type="submit" disabled={busy}>
{t("TktSaveSettings")}
</Button>
</form>
)}
{types && (
<>
<Table>
<TableHeader>
<TableRow>
<TableHead>{t("Name")}</TableHead>
<TableHead>{t("TktPrice")}</TableHead>
<TableHead>{t("TktQuantity")}</TableHead>
<TableHead>{t("TktLeft")}</TableHead>
<TableHead>{t("TktSalesEnd")}</TableHead>
<TableHead>{t("Status")}</TableHead>
<TableHead />
</TableRow>
</TableHeader>
<TableBody>
{types.length === 0 && (
<TableRow>
<TableCell colSpan={7} className="text-muted-foreground">
{t("TktNoTypes")}
</TableCell>
</TableRow>
)}
{types.map((x) => (
<TableRow key={x.id}>
<TableCell>{x.name}</TableCell>
<TableCell>{x.priceSen === 0 ? t("TktFree") : money(x.priceSen)}</TableCell>
<TableCell>{x.quantity}</TableCell>
<TableCell>{x.left}</TableCell>
<TableCell>{x.salesEndDate ?? "-"}</TableCell>
<TableCell>
<Badge variant={x.enabled ? "positive" : "neutral"}>{t(x.enabled ? "Enabled" : "Disabled")}</Badge>
</TableCell>
<TableCell className="space-x-1 whitespace-nowrap text-right">
<Button type="button" variant="ghost" size="sm" disabled={busy} onClick={() => edit(x)}>
{t("Edit")}
</Button>
<Button type="button" variant="ghost" size="sm" disabled={busy} onClick={() => toggle(x)}>
{t(x.enabled ? "TktDisable" : "TktEnable")}
</Button>
<Button type="button" variant="ghost" size="sm" disabled={busy} onClick={() => setDeleting(x)}>
{t("TktDelete")}
</Button>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
<form onSubmit={saveType} className="grid gap-3 sm:grid-cols-2 lg:grid-cols-5">
<div className="space-y-1">
<Label htmlFor="type-name">{t("TktTypeName")}</Label>
<Input id="type-name" maxLength={80} value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
{fieldError("name")}
</div>
<div className="space-y-1">
<Label htmlFor="type-price">{t("TktPriceRm")}</Label>
<Input id="type-price" inputMode="decimal" value={form.price} onChange={(e) => setForm({ ...form, price: e.target.value })} />
{fieldError("priceSen")}
</div>
<div className="space-y-1">
<Label htmlFor="type-quantity">{t("TktQuantity")}</Label>
<Input id="type-quantity" inputMode="numeric" value={form.quantity} onChange={(e) => setForm({ ...form, quantity: e.target.value })} />
{fieldError("quantity")}
</div>
<div className="space-y-1">
<Label htmlFor="type-end">{t("TktSalesEnd")}</Label>
<DatePicker id="type-end" value={form.salesEndDate} onChange={(v) => setForm({ ...form, salesEndDate: v })} />
{fieldError("salesEndDate")}
</div>
<div className="flex items-end gap-2">
<Button type="submit" disabled={busy}>
{t(form.id == null ? "TktAddType" : "TktSaveType")}
</Button>
{form.id != null && (
<Button type="button" variant="outline" disabled={busy} onClick={() => setForm(EMPTY)}>
{t("Cancel")}
</Button>
)}
</div>
</form>
<p className="text-xs text-muted-foreground">{t("TktSalesEndHelp")}</p>
</>
)}
{deleting && (
<ConfirmDialog
title={t("TktDeleteTitle")}
message={t("TktDeleteMessage", { name: deleting.name })}
confirmLabel={t("TktDelete")}
destructive
onConfirm={remove}
onCancel={() => setDeleting(null)}
/>
)}
</CardContent>
</Card>
);
}
@@ -18,15 +18,17 @@ import { CopyAddress } from "./CopyAddress";
const INLINE: Record<string, string[]> = {
HERO: ["imageId", "heading", "text", "buttonLabel", "buttonUrl", "eventUuid", "fullWidth", "formHeading", "formText", "thanksText", "cards"],
RICH_TEXT: ["html"],
IMAGE_TEXT: ["imageId", "imagePosition", "heading", "html", "buttonLabel", "buttonUrl"],
FAQ: ["heading", "items"],
IMAGE_TEXT: ["imageId", "imagePosition", "eyebrow", "heading", "html", "buttonLabel", "buttonUrl"],
FAQ: ["eyebrow", "heading", "items"],
FORM: ["heading", "eventUuid", "thanksText"],
HTML: ["html"],
FEATURES: ["heading", "text", "cards"],
STEPS: ["heading", "cards"],
FEATURES: ["eyebrow", "heading", "text", "cards"],
STEPS: ["eyebrow", "heading", "cards"],
TRUST: ["cards"],
CTA: ["heading", "text", "buttonLabel", "buttonUrl"],
CTA: ["eyebrow", "heading", "text", "buttonLabel", "buttonUrl"],
FOOTER: ["cards", "text"],
TOPBAR: ["buttonLabel", "buttonUrl"],
TICKETS: ["eyebrow", "heading", "text", "eventUuid"],
};
const LISTED = /^(items\[\d+\]\.(question|answer)|cards\[\d+\]\.(icon|title|text))$/;
@@ -51,6 +53,8 @@ const SELECT = "flex h-9 w-full rounded-md border border-input bg-transparent px
export interface EventOption {
uuid: string;
name: string;
/** add-event-ticket-orders: only these are offered to a TICKETS block. */
ticketsEnabled?: boolean;
}
function FieldError({ message }: { message?: string }) {
@@ -92,7 +96,7 @@ export function BlockFields(props: {
const fid = (name: string) => `block-${id}-${name}`;
const topErrors = Object.entries(errors).filter(([path]) => path !== "anchor" && path !== "look" && !INLINE[block.type]?.includes(path) && !LISTED.test(path));
const text = (name: "heading" | "text" | "buttonLabel" | "buttonUrl" | "anchor" | "formHeading" | "formText" | "thanksText", labelCode: string) => (
const text = (name: "heading" | "text" | "buttonLabel" | "buttonUrl" | "anchor" | "formHeading" | "formText" | "thanksText" | "eyebrow", labelCode: string) => (
<Field id={fid(name)} label={t(labelCode)} error={errors[name]}>
<Input id={fid(name)} value={block[name] ?? ""} disabled={saving} aria-invalid={!!errors[name]} onChange={(e) => set({ [name]: e.target.value })} />
</Field>
@@ -124,17 +128,17 @@ export function BlockFields(props: {
const preview = pendingImage?.preview ?? (block.imageId ? imageSrc(block.imageId) : undefined);
// The FORM block's event, and the hero's optional sign-up form (add-hero-signup-form): the same picker and hint.
const eventPicker = (labelCode: string, emptyCode: string) => (
const eventPicker = (labelCode: string, emptyCode: string, options = events, hintCode = "PagesFormEventHint") => (
<Field id={fid("event")} label={t(labelCode)} error={errors.eventUuid}>
<select id={fid("event")} className={SELECT} value={block.eventUuid ?? ""} disabled={saving} aria-invalid={!!errors.eventUuid}
onChange={(e) => set(e.target.value ? { eventUuid: e.target.value } : { eventUuid: null, formHeading: undefined, formText: undefined, thanksText: undefined })}>
<option value="">{t(emptyCode)}</option>
{events.map((ev) => <option key={ev.uuid} value={ev.uuid}>{ev.name}</option>)}
{block.eventUuid && !events.some((ev) => ev.uuid === block.eventUuid) ? (
{options.map((ev) => <option key={ev.uuid} value={ev.uuid}>{ev.name}</option>)}
{block.eventUuid && !options.some((ev) => ev.uuid === block.eventUuid) ? (
<option value={block.eventUuid}>{t("PagesUnavailableEvent")}</option>
) : null}
</select>
<p className="text-xs text-muted-foreground">{t("PagesFormEventHint")}</p>
<p className="text-xs text-muted-foreground">{t(hintCode)}</p>
</Field>
);
const image = (
@@ -258,6 +262,7 @@ export function BlockFields(props: {
<option value="RIGHT">{t("PagesImageRight")}</option>
</select>
</Field>
{text("eyebrow", "PagesEyebrow")}
{text("heading", "PagesHeading")}
{richText("PagesText")}
{text("buttonLabel", "PagesButtonLabel")}
@@ -267,6 +272,7 @@ export function BlockFields(props: {
{block.type === "FAQ" && (
<>
{text("eyebrow", "PagesEyebrow")}
{text("heading", "PagesHeading")}
{items.map((item, i) => (
<div key={i} className="space-y-2 rounded-md border p-3">
@@ -326,8 +332,20 @@ export function BlockFields(props: {
</>
)}
{block.type === "TICKETS" && (
<>
{text("eyebrow", "PagesEyebrow")}
{text("heading", "PagesHeading")}
<Field id={fid("text")} label={t("PagesIntro")} error={errors.text}>
<Textarea id={fid("text")} rows={2} value={block.text ?? ""} disabled={saving} aria-invalid={!!errors.text} onChange={(e) => set({ text: e.target.value })} />
</Field>
{eventPicker("PagesTicketsEvent", "PagesChooseTicketsEvent", events.filter((ev) => ev.ticketsEnabled), "PagesTicketsEventHint")}
</>
)}
{block.type === "FEATURES" && (
<>
{text("eyebrow", "PagesEyebrow")}
{text("heading", "PagesHeading")}
<Field id={fid("text")} label={t("PagesIntro")} error={errors.text}>
<Textarea id={fid("text")} rows={2} value={block.text ?? ""} disabled={saving} aria-invalid={!!errors.text} onChange={(e) => set({ text: e.target.value })} />
@@ -338,6 +356,7 @@ export function BlockFields(props: {
{block.type === "STEPS" && (
<>
{text("eyebrow", "PagesEyebrow")}
{text("heading", "PagesHeading")}
{cardList}
</>
@@ -345,6 +364,14 @@ export function BlockFields(props: {
{block.type === "TRUST" && cardList}
{/* add-landing-page-polish: the top bar's button; its logo comes from the company. */}
{block.type === "TOPBAR" && (
<>
{text("buttonLabel", "PagesButtonLabel")}
{text("buttonUrl", "PagesButtonLink")}
</>
)}
{block.type === "FOOTER" && (
<>
{cardList}
@@ -354,6 +381,7 @@ export function BlockFields(props: {
{block.type === "CTA" && (
<>
{text("eyebrow", "PagesEyebrow")}
{text("heading", "PagesHeading")}
{text("text", "PagesText")}
{text("buttonLabel", "PagesButtonLabel")}
@@ -361,7 +389,7 @@ export function BlockFields(props: {
</>
)}
{block.type !== "HTML" && (
{block.type !== "HTML" && block.type !== "TOPBAR" && (
<Field id={fid("look")} label={t("PagesLook")} error={errors.look}>
<select id={fid("look")} className={SELECT} value={block.look ?? "DEFAULT"} disabled={saving} aria-invalid={!!errors.look}
onChange={(e) => set({ look: e.target.value as Look })}>
@@ -222,6 +222,15 @@ describe("LandingPage thank-you text and footer", () => {
expect(within(foot).getByText(/^© 2026/)).toHaveClass("border-t");
});
it("ends the page at the footer: no blank strip below a closing footer", () => {
const { unmount } = render(<LandingPage company={company} page={page([{ type: "FAQ", items: [{ question: "Q", answer: "A" }] }, footer])} />);
expect(screen.getByRole("main")).not.toHaveClass("pb-8");
expect(screen.getByRole("main")).not.toHaveClass("py-8");
unmount();
render(<LandingPage company={company} page={page([footer, { type: "FAQ", items: [{ question: "Q", answer: "A" }] }])} />);
expect(screen.getByRole("main").className).toMatch(/p[by]-8/);
});
it("keeps markup in footer text as text", () => {
render(<LandingPage company={company} page={page([{ type: "FOOTER", cards: [{ title: "Call", text: "<b>Call</b> +60 12-833 2775" }] }])} />);
const foot = screen.getByRole("contentinfo");
@@ -230,3 +239,92 @@ describe("LandingPage thank-you text and footer", () => {
expect(within(foot).getByRole("link", { name: "+60 12-833 2775" })).toHaveAttribute("href", "tel:+60128332775");
});
});
// add-landing-page-polish: the top bar, section labels and serif headings.
describe("LandingPage polish", () => {
const bar: PublicBlock = { type: "TOPBAR", buttonLabel: "Get My Free Consultation", buttonUrl: "#consult" };
const hero: PublicBlock = { type: "HERO", heading: "One partner", fullWidth: true };
it("a top bar shows the logo and its button, stays at the top, and joins the hero", () => {
render(<LandingPage company={company} page={{ ...page([bar, hero]), hideHeader: true }} />);
const top = screen.getByRole("banner");
expect(within(top).getByRole("img", { name: "INS Sdn Bhd" })).toHaveAttribute("src", "/api/public/page-images/4");
expect(within(top).getByRole("link", { name: "Get My Free Consultation" })).toHaveAttribute("href", "#consult");
// The row sticks, not the header: a sticky element only sticks inside its parent.
expect(top.closest("main > div > div")).toHaveClass("sticky", "top-0");
expect(top.closest(".max-w-5xl")).toBeNull();
expect(screen.getAllByRole("banner")).toHaveLength(1);
const rows = Array.from(document.querySelector("main > div")!.children);
expect(rows.map((r) => r.classList.contains("mt-10"))).toEqual([false, false]);
});
it("a top bar without a logo shows the company name, and no button without one", () => {
render(<LandingPage company={{ ...company, logoImageId: null }} page={{ ...page([{ type: "TOPBAR" }]), hideHeader: true }} />);
const top = screen.getByRole("banner");
expect(top).toHaveTextContent("INS Sdn Bhd");
expect(within(top).queryByRole("link")).toBeNull();
});
it("named blocks keep clear of a sticky bar when jumped to", () => {
render(<LandingPage company={company} page={page([bar, { type: "FORM", heading: "Join", closed: true, anchor: "consult" }])} />);
expect(document.getElementById("consult")).toHaveClass("scroll-mt-24");
});
it("shows a section's label above its heading, and section headings in serif", () => {
render(<LandingPage company={company} page={page([
{ type: "FEATURES", eyebrow: "Services", heading: "Everything your guests touch", cards: [{ icon: "wifi", title: "WiFi", text: "Fast." }] },
{ type: "FAQ", eyebrow: "FAQ", heading: "Questions hotels ask us", items: [{ question: "Q", answer: "A" }], look: "DARK" },
])} />);
const heading = screen.getByRole("heading", { level: 2, name: "Everything your guests touch" });
expect(heading).toHaveClass("font-serif");
const label = heading.previousElementSibling!;
expect(label).toHaveTextContent("Services");
expect(label).toHaveClass("uppercase");
expect(screen.getByRole("heading", { level: 2, name: "Questions hotels ask us" })).toHaveClass("font-serif");
expect(screen.getByRole("heading", { level: 2, name: "Questions hotels ask us" }).previousElementSibling).toHaveClass("text-primary");
});
});
// add-hero-fits-screen: the top bar, hero and trust strip fit one desktop screen.
describe("LandingPage first screen", () => {
it("gives a trust band less padding than other bands, and the full-width hero less padding", () => {
render(<LandingPage company={company} page={page([
{ type: "HERO", heading: "One partner", fullWidth: true, eventUuid: "77", closed: true },
{ type: "TRUST", look: "MUTED", cards: [{ title: "Design" }, { title: "Local support" }] },
{ type: "CTA", heading: "Talk to us", look: "DARK" },
])} />);
const bands = Array.from(document.querySelectorAll("[data-look]"));
expect(bands[0]).toHaveClass("py-5");
expect(bands[1]).toHaveClass("py-12");
const grid = screen.getByRole("heading", { name: "One partner" }).closest(".grid")!;
expect(grid).toHaveClass("pt-8", "pb-8");
expect(screen.getByText("Sign-up is closed.").closest(".shadow-card")).toHaveClass("space-y-3");
});
});
// add-event-ticket-orders: the TICKETS block, a card with its label and heading, the event's types, or closed.
describe("LandingPage TICKETS block", () => {
const tickets = {
eventName: "KL Hotel Tech Day", startDate: "2027-01-15", endDate: "2027-01-16", location: "KLCC", companyName: "INS",
notice: { id: 9, textEn: "English notice", textMs: "Notis" },
types: [{ id: 1, name: "Early bird", priceSen: 15000, left: 12, state: "ON_SALE" as const }],
};
it("shows the label, heading, text and the ticket types", () => {
render(<LandingPage company={company} page={page([
{ type: "TICKETS", eventUuid: "900", eyebrow: "Tickets", heading: "Get your seat", text: "Seats are limited.", tickets, anchor: "tickets" },
])} />);
const heading = screen.getByRole("heading", { level: 2, name: "Get your seat" });
expect(heading.previousElementSibling).toHaveTextContent("Tickets");
expect(screen.getByText("Seats are limited.")).toBeInTheDocument();
expect(screen.getByRole("group", { name: "Early bird" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Request tickets" })).toBeInTheDocument();
expect(document.getElementById("tickets")).not.toBeNull();
});
it("says sales are closed when the page carries closed", () => {
render(<LandingPage company={company} page={page([{ type: "TICKETS", eventUuid: "900", heading: "Get your seat", closed: true }])} />);
expect(screen.getByText("Ticket sales are closed.")).toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Request tickets" })).not.toBeInTheDocument();
});
});
@@ -3,6 +3,8 @@ import { ICONS, LOOKS, anchorId, contrastText, imageSrc, isSafeLink, type CmsBlo
import type { RegistrationInfo } from "@/app/lib/services/publicRegistration";
import { SafeHtml } from "./SafeHtml";
import { LandingForm } from "./LandingForm";
import { TicketsBlock } from "./TicketsBlock";
import type { TicketsInfo } from "@/app/lib/services/publicTickets";
import { HtmlFrame } from "./HtmlFrame";
import { EditContext, EditSection, HeroShade, HtmlSpot, ImageSpot, RichSpot, Text, stopNavigation, type PageEdit } from "./CmsEdit";
@@ -10,7 +12,7 @@ import { EditContext, EditSection, HeroShade, HtmlSpot, ImageSpot, RichSpot, Tex
// images are this company's uploads; buttons render only for a safe link, checked again here. A Custom HTML block is
// never rendered here: it is a sealed frame loaded from its own address (add-custom-html-block).
export type PublicBlock = CmsBlock & { form?: RegistrationInfo; closed?: boolean };
export type PublicBlock = CmsBlock & { form?: RegistrationInfo; tickets?: TicketsInfo; closed?: boolean };
export interface Branding {
code: string;
@@ -42,6 +44,27 @@ function ButtonLink({ block, index, edit }: { block: CmsBlock; index: number; ed
);
}
// add-landing-page-polish: a section's serif heading, with its optional label above. The label is the accent colour,
// darkened toward the text colour on light backgrounds, where a pale accent would be hard to read.
const LABEL_COLOUR: Record<string, string> = {
DARK: "text-primary",
ACCENT: "opacity-80",
LIGHT: "text-[color-mix(in_srgb,var(--primary)_60%,var(--foreground))]",
};
const LABELLED = ["FEATURES", "STEPS", "IMAGE_TEXT", "FAQ", "CTA", "TICKETS"];
function SectionHeading({ block, index, className }: { block: CmsBlock; index: number; className: string }) {
const band = bandOf(block.look);
return (
<>
{LABELLED.includes(block.type) && <Text as="p" index={index} path="eyebrow" value={block.eyebrow} max={40} code="PagesEyebrow"
className={`mb-2 text-xs font-semibold tracking-widest uppercase ${LABEL_COLOUR[band === "DARK" || band === "ACCENT" ? band : "LIGHT"]}`} />}
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className={`font-serif font-semibold ${className}`} />
</>
);
}
function Block({ block, index, company, slug, preview, edit }: { block: PublicBlock; index: number; company: string; slug: string; preview?: boolean; edit?: boolean }) {
const image = block.imageId ? imageSrc(block.imageId) : undefined;
const button = <ButtonLink block={block} index={index} edit={edit} />;
@@ -69,7 +92,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
// add-hero-signup-form: with an event, the sign-up form sits in a card beside the text (below it on phones).
// add-hero-full-width: the card may open with its own heading and text.
const card = block.eventUuid ? (
<div className="space-y-4 rounded-lg border bg-card p-6 text-card-foreground shadow-card">
<div className="space-y-3 rounded-lg border bg-card p-6 text-card-foreground shadow-card">
{block.formHeading || block.formText || edit ? (
<div className="space-y-1">
<Text as="h3" index={index} path="formHeading" value={block.formHeading} max={80} code="PagesFormHeading" className="font-serif text-2xl font-semibold" />
@@ -83,7 +106,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
if (wide) {
// Edge to edge; the shade is darkest behind the text and clears toward the far side. The text is centred in the
// hero's opening height, not beside a long form, so it stays in the first screen.
const grid = `mx-auto grid w-full max-w-6xl items-start gap-8 px-4 pt-16 pb-12 ${card ? "md:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]" : ""}`;
const grid = `mx-auto grid w-full max-w-6xl items-start gap-8 px-4 pt-8 pb-8 ${card ? "md:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]" : ""}`;
return (
<section className={`relative overflow-hidden ${back}`}>
<ImageSpot index={index} src={image} className="absolute inset-0 h-full w-full object-cover" corner />
@@ -133,7 +156,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
</div>
) : null}
<div className="space-y-3">
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className="text-2xl font-semibold" />
<SectionHeading block={block} index={index} className="text-2xl" />
<RichSpot index={index} html={block.html} className={PROSE}>{block.html ? <SafeHtml html={block.html} className={PROSE} /> : null}</RichSpot>
{button}
</div>
@@ -142,7 +165,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
case "FAQ":
return block.items?.length ? (
<section className="space-y-3">
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className="text-2xl font-semibold" />
<SectionHeading block={block} index={index} className="text-2xl" />
<div className="divide-y rounded-lg border">
{block.items.map((item, i) => {
const question = <Text as="span" index={index} path={`items.${i}.question`} value={item.question} max={300} code="PagesQuestionN" n={i + 1} />;
@@ -163,15 +186,26 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
case "FORM":
return (
<section className="mx-auto w-full max-w-md space-y-4 rounded-lg border bg-card p-6 shadow-card">
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className="text-2xl font-semibold" />
<SectionHeading block={block} index={index} className="text-2xl" />
<LandingForm companyCode={company} slug={slug} index={index} info={block.closed ? undefined : block.form} preview={preview} thanks={block.thanksText} />
</section>
);
case "TICKETS":
// add-event-ticket-orders: the event's ticket types and the request form, in a card like FORM.
return (
<section className="mx-auto w-full max-w-lg space-y-4 rounded-lg border bg-card p-6 text-card-foreground shadow-card">
<div className="space-y-2">
<SectionHeading block={block} index={index} className="text-2xl" />
<Text as="p" index={index} path="text" value={block.text} max={1000} code="PagesText" className="text-muted-foreground" />
</div>
<TicketsBlock companyCode={company} slug={slug} index={index} info={block.closed ? undefined : block.tickets} preview={preview} eventUuid={block.eventUuid} />
</section>
);
case "FEATURES":
return (
<section className="space-y-6">
<div className="max-w-2xl space-y-2">
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className="text-2xl font-semibold sm:text-3xl" />
<SectionHeading block={block} index={index} className="text-2xl sm:text-3xl" />
<Text as="p" index={index} path="text" value={block.text} max={300} code="PagesText" className="text-lg opacity-80" />
</div>
<ul className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
@@ -191,7 +225,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
case "STEPS":
return (
<section className="space-y-6">
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className="text-2xl font-semibold sm:text-3xl" />
<SectionHeading block={block} index={index} className="text-2xl sm:text-3xl" />
<ol className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
{(block.cards ?? []).map((card, i) => (
<li key={i} className="flex gap-4">
@@ -216,7 +250,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
case "CTA":
return (
<section className="flex flex-col items-center gap-4 py-4 text-center">
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className="text-2xl font-semibold sm:text-3xl" />
<SectionHeading block={block} index={index} className="text-2xl sm:text-3xl" />
<Text as="p" index={index} path="text" value={block.text} max={300} code="PagesText" className="max-w-2xl text-lg opacity-80" />
{button}
</section>
@@ -243,21 +277,39 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
const WIDTH = "mx-auto w-full max-w-5xl px-4";
/** add-landing-page-polish: the company logo (or name) and an optional button, kept at the top of the window. */
function TopBar({ block, index, company, edit }: { block: CmsBlock; index: number; company: Branding; edit: boolean }) {
return (
<header role="banner" id={anchorId(block.anchor)} className="border-b bg-card/95 backdrop-blur">
<div className="mx-auto flex max-w-6xl items-center justify-between gap-3 px-4 py-3">
{company.logoImageId ? (
// eslint-disable-next-line @next/next/no-img-element -- the company's uploaded logo
<img src={imageSrc(company.logoImageId)} alt={company.name} className="h-10 w-auto" />
) : (
<span className="text-lg font-semibold">{company.name}</span>
)}
<ButtonLink block={block} index={index} edit={edit} />
</div>
</header>
);
}
/**
* Blocks that run the full window width: Custom HTML, a full-width hero, and a coloured band (add-compact-landing-form).
* Two of them in a row join with no gap.
*/
const bleeds = (block: PublicBlock) => block.type === "HTML" || (block.type === "HERO" && !!block.fullWidth) || !!bandOf(block.look);
const bleeds = (block: PublicBlock) => block.type === "HTML" || block.type === "TOPBAR" || (block.type === "HERO" && !!block.fullWidth) || !!bandOf(block.look);
/** A block in the page width; with a non-default look, inside a full-width band of that colour. */
function Section({ block, index, children }: { block: PublicBlock; index: number; children: ReactNode }) {
const band = bandOf(block.look);
// add-hero-full-width: a full-width hero sets its own width.
if (block.type === "HERO" && block.fullWidth) return <EditSection index={index}><div id={anchorId(block.anchor)}>{children}</div></EditSection>;
if (!band) return <EditSection index={index}><div id={anchorId(block.anchor)} className={WIDTH}>{children}</div></EditSection>;
// add-landing-page-polish: a #name jump lands clear of a sticky top bar.
if (!band) return <EditSection index={index}><div id={anchorId(block.anchor)} className={`scroll-mt-24 ${WIDTH}`}>{children}</div></EditSection>;
return (
<EditSection index={index}>
<div id={anchorId(block.anchor)} data-look={band} className={`py-12 ${BANDS[band]}`}>
<div id={anchorId(block.anchor)} data-look={band} className={`scroll-mt-16 ${block.type === "TRUST" ? "py-5" : "py-12"} ${BANDS[band]}`}>
<div className={WIDTH}>{children}</div>
</div>
</EditSection>
@@ -295,12 +347,16 @@ export function LandingPage({ company, page, banner, preview, frameBase, edit }:
)}
</div>
</header>}
<main className={page.hideHeader ? "pb-8" : "py-8"}>
{/* A closing footer is the page's end: no padding below it. */}
<main className={`${page.hideHeader ? "" : "pt-8"} ${page.blocks.at(-1)?.type === "FOOTER" ? "" : "pb-8"}`}>
<h1 className={page.hideHeader ? "sr-only" : `${WIDTH} mb-10 text-3xl font-semibold sm:text-4xl`}>{page.title}</h1>
<div>
{page.blocks.map((block, i) => (
<div key={i} className={i > 0 && !(bleeds(block) && bleeds(page.blocks[i - 1])) ? "mt-10" : undefined}>
{block.type === "HTML"
// A top bar's row is what sticks: a sticky element only sticks inside its parent, and the rows share the page's.
<div key={i} className={block.type === "TOPBAR" ? "sticky top-0 z-20" : i > 0 && !(bleeds(block) && bleeds(page.blocks[i - 1])) ? "mt-10" : undefined}>
{block.type === "TOPBAR"
? <EditSection index={i}><TopBar block={block} index={i} company={company} edit={!!edit} /></EditSection>
: block.type === "HTML"
? <HtmlSpot index={i}><HtmlFrame id={anchorId(block.anchor)} src={`${frames}/${i}${edit ? `?v=${edit.frameVersion}` : ""}`} title={page.title} /></HtmlSpot>
: <Section block={block} index={i}><Block block={block} index={i} company={company.code} slug={page.slug} preview={preview} edit={!!edit} /></Section>}
</div>
@@ -101,6 +101,25 @@ describe("PageEditor: sections", () => {
});
});
// add-landing-page-polish: the top bar's button, and a label above a section's heading.
it("adds a top bar with a button and no look, and saves a section label", async () => {
const user = userEvent.setup();
render(<PageEditor pageId={5} />);
await screen.findByDisplayValue("How it works");
await user.type(within(group("Block 1: Steps")).getByLabelText("Label"), "How we work");
await user.click(screen.getByRole("button", { name: "Add Top bar" }));
const block = group("Block 3: Top bar");
expect(within(block).queryByLabelText("Look")).not.toBeInTheDocument();
expect(within(block).queryByLabelText("Label")).not.toBeInTheDocument();
await user.type(within(block).getByLabelText("Button label"), "Get My Free Consultation");
await user.type(within(block).getByLabelText("Button link"), "#consult");
await user.click(screen.getByRole("button", { name: "Save" }));
await waitFor(() => expect(mocks.savePage).toHaveBeenCalled());
const blocks = mocks.savePage.mock.calls[0][1].blocks;
expect(blocks[0]).toMatchObject({ type: "STEPS", eyebrow: "How we work" });
expect(blocks[2]).toEqual({ type: "TOPBAR", buttonLabel: "Get My Free Consultation", buttonUrl: "#consult" });
});
it("offers no look for a Custom HTML block", async () => {
render(<PageEditor pageId={5} />);
await screen.findByDisplayValue("How it works");
@@ -96,6 +96,26 @@ describe("PageEditor", () => {
expect(mocks.savePage.mock.calls[0][1].blocks[0].imageId).toBe(44);
});
// add-event-ticket-orders: a Tickets section's picker offers only events that sell tickets.
it("adds a Tickets section whose picker offers only events with tickets on", async () => {
mocks.listAdminEvents.mockResolvedValue({ items: [
{ uuid: "3312726793093644288", name: "Website enquiries", endDate: "2099-12-31", enabled: true, location: "", startDate: "", ticketsEnabled: false },
{ uuid: "900", name: "KL Hotel Tech Day", endDate: "2099-12-31", enabled: true, location: "", startDate: "", ticketsEnabled: true },
], total: 2 });
const user = userEvent.setup();
render(<PageEditor pageId={5} />);
await screen.findByLabelText("Event");
await user.click(screen.getByRole("button", { name: "Add Tickets" }));
const picker = await screen.findByLabelText("Event selling tickets");
await waitFor(() => expect(within(picker).getByRole("option", { name: "KL Hotel Tech Day" })).toBeInTheDocument());
expect(within(picker).queryByRole("option", { name: "Website enquiries" })).not.toBeInTheDocument();
await user.selectOptions(picker, "900");
await user.type(screen.getAllByLabelText("Heading").at(-1)!, "Get your seat");
await user.click(screen.getByRole("button", { name: "Save" }));
await waitFor(() => expect(mocks.savePage).toHaveBeenCalled());
expect(mocks.savePage.mock.calls[0][1].blocks.at(-1)).toMatchObject({ type: "TICKETS", eventUuid: "900", heading: "Get your seat" });
});
it("asks before deleting", async () => {
mocks.deletePage.mockResolvedValue(undefined);
const user = userEvent.setup();
@@ -0,0 +1,148 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { ApiError } from "@/app/lib/clientApi";
const mocks = vi.hoisted(() => ({ publicCall: vi.fn(), listTicketTypes: vi.fn() }));
vi.mock("@/app/lib/services/publicRegistration", async (orig) => ({ ...(await orig<object>()), publicCall: mocks.publicCall }));
vi.mock("@/app/lib/services/adminTickets", async (orig) => ({ ...(await orig<object>()), listTicketTypes: mocks.listTicketTypes }));
import { TicketsBlock } from "./TicketsBlock";
import type { TicketsInfo } from "@/app/lib/services/publicTickets";
const INFO: TicketsInfo = {
eventName: "KL Hotel Tech Day",
startDate: "2027-01-15",
endDate: "2027-01-16",
location: "KLCC",
companyName: "INS",
notice: { id: 9, textEn: "English notice", textMs: "Notis" },
types: [
{ id: 1, name: "Early bird", priceSen: 15000, left: 12, state: "ON_SALE" },
{ id: 2, name: "General", priceSen: 25000, left: 3, state: "ON_SALE" },
{ id: 3, name: "VIP", priceSen: 50000, left: 0, state: "SOLD_OUT" },
{ id: 4, name: "Walk-up", priceSen: 20000, left: 5, state: "ENDED" },
{ id: 5, name: "Community pass", priceSen: 0, left: 50, state: "ON_SALE" },
],
};
const RECEIVED = {
reference: "T-7K3M9Q", token: "abcdefghijklmnopqrstuv", status: "AWAITING", totalSen: 30000, holdUntil: "2027-01-13T12:00:00",
lines: [{ name: "Early bird", unitPriceSen: 15000, quantity: 2 }], paymentInstructions: "Maybank 5140\nRef: your order number", eventName: "KL Hotel Tech Day",
};
beforeEach(() => {
mocks.publicCall.mockReset().mockResolvedValue(RECEIVED);
mocks.listTicketTypes.mockReset();
});
const row = (name: string) => screen.getByRole("group", { name });
const add = (user: ReturnType<typeof userEvent.setup>, name: string, times = 1) =>
(async () => { for (let i = 0; i < times; i++) await user.click(within(row(name)).getByRole("button", { name: `Add one ${name}` })); })();
async function fillBuyer(user: ReturnType<typeof userEvent.setup>) {
await user.type(screen.getByLabelText("Your name"), "Aisyah");
await user.type(screen.getByLabelText("Email"), "aisyah@example.test");
await user.click(screen.getByRole("checkbox"));
}
describe("TicketsBlock", () => {
it("lists the types with prices, Free, sold out and sales ended", () => {
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} info={INFO} />);
expect(within(row("Early bird")).getByText("RM 150.00")).toBeInTheDocument();
expect(within(row("Early bird")).getByText("12 left")).toBeInTheDocument();
expect(within(row("Community pass")).getByText("Free")).toBeInTheDocument();
expect(within(row("VIP")).getByText("Sold out")).toBeInTheDocument();
expect(within(row("VIP")).queryByRole("button", { name: "Add one VIP" })).toBeNull();
expect(within(row("Walk-up")).getByText("Sales ended")).toBeInTheDocument();
expect(within(row("Walk-up")).queryByRole("button", { name: "Add one Walk-up" })).toBeNull();
});
it("keeps a running total and caps the order at ten and each type at its seats", async () => {
const user = userEvent.setup();
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} info={INFO} />);
await add(user, "Early bird", 2);
await add(user, "General", 4);
expect(within(row("General")).getByText("3")).toBeInTheDocument();
expect(within(row("General")).getByRole("button", { name: "Add one General" })).toBeDisabled();
expect(screen.getByTestId("tickets-total")).toHaveTextContent("RM 1,050.00");
await add(user, "Community pass", 5);
expect(within(row("Community pass")).getByText("5")).toBeInTheDocument();
expect(within(row("Early bird")).getByRole("button", { name: "Add one Early bird" })).toBeDisabled();
await user.click(within(row("Early bird")).getByRole("button", { name: "Remove one Early bird" }));
expect(screen.getByTestId("tickets-total")).toHaveTextContent("RM 900.00");
});
it("asks for tickets, name, email and consent before sending", async () => {
const user = userEvent.setup();
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} info={INFO} />);
await user.click(screen.getByRole("button", { name: "Request tickets" }));
expect(screen.getByText("Choose at least one ticket.")).toBeInTheDocument();
expect(screen.getByText("Enter your name.")).toBeInTheDocument();
expect(screen.getByText("Enter your email.")).toBeInTheDocument();
expect(screen.getByText("Tick the box to agree to the privacy notice.")).toBeInTheDocument();
expect(mocks.publicCall).not.toHaveBeenCalled();
});
it("sends the request and thanks with the instructions, hold and order link", async () => {
const user = userEvent.setup();
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} info={INFO} />);
await add(user, "Early bird", 2);
await fillBuyer(user);
await user.click(screen.getByRole("button", { name: "Request tickets" }));
await waitFor(() => expect(mocks.publicCall).toHaveBeenCalled());
const [url, init] = mocks.publicCall.mock.calls[0];
expect(url).toBe("/api/public/pages/INS/tech-day/tickets/1");
expect(JSON.parse(init.body)).toMatchObject({
lines: [{ ticketTypeId: 1, quantity: 2 }], name: "Aisyah", email: "aisyah@example.test", consent: true, website: "",
});
expect(await screen.findByText(/T-7K3M9Q/)).toBeInTheDocument();
expect(screen.getByText(/Maybank 5140/)).toBeInTheDocument();
expect(screen.getByText(/13 Jan 2027/)).toBeInTheDocument();
expect(screen.getByRole("link", { name: "View your order" })).toHaveAttribute("href", "/o/abcdefghijklmnopqrstuv");
});
it("confirms a free order without instructions", async () => {
const user = userEvent.setup();
mocks.publicCall.mockResolvedValue({ ...RECEIVED, status: "PAID", totalSen: 0, holdUntil: null, paymentInstructions: undefined });
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} info={INFO} />);
await add(user, "Community pass", 2);
await fillBuyer(user);
await user.click(screen.getByRole("button", { name: "Request tickets" }));
expect(await screen.findByText("Your order T-7K3M9Q is confirmed.")).toBeInTheDocument();
expect(screen.queryByText(/How to pay/)).toBeNull();
});
it("shows a refusal from the server", async () => {
const user = userEvent.setup();
mocks.publicCall.mockRejectedValue(new ApiError("x", 409, { code: "TYPE_UNAVAILABLE", error: "General has only 1 ticket left." }));
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} info={INFO} />);
await add(user, "General", 2);
await fillBuyer(user);
await user.click(screen.getByRole("button", { name: "Request tickets" }));
expect(await screen.findByRole("alert")).toHaveTextContent("General has only 1 ticket left.");
});
it("shows a field error under its field", async () => {
const user = userEvent.setup();
mocks.publicCall.mockRejectedValue(new ApiError("x", 400, { code: "INVALID_EMAIL", error: "Enter a valid email.", details: { field: "email" } }));
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} info={INFO} />);
await add(user, "General", 1);
await fillBuyer(user);
await user.click(screen.getByRole("button", { name: "Request tickets" }));
expect(await screen.findByText("Enter a valid email.")).toBeInTheDocument();
});
it("says ticket sales are closed", () => {
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} />);
expect(screen.getByRole("status")).toHaveTextContent("Ticket sales are closed.");
});
it("shows the event's real types on the editor canvas", async () => {
mocks.listTicketTypes.mockResolvedValue([{ id: 2, name: "General", priceSen: 25000, quantity: 100, salesEndDate: null, sort: 0, enabled: true, held: 20, left: 80 }]);
render(<TicketsBlock companyCode="INS" slug="tech-day" index={1} preview eventUuid="900" />);
expect(await screen.findByText("General")).toBeInTheDocument();
expect(screen.getByText("RM 250.00")).toBeInTheDocument();
expect(mocks.listTicketTypes).toHaveBeenCalledWith("900");
expect(screen.queryByRole("button", { name: "Request tickets" })).toBeNull();
});
});
@@ -0,0 +1,224 @@
"use client";
import Link from "next/link";
import { useEffect, useState, type FormEvent } from "react";
import { AlertCircle, CheckCircle2, Minus, Plus } from "lucide-react";
import { Button } from "@/app/components/ui/button";
import { Checkbox } from "@/app/components/ui/checkbox";
import { Input } from "@/app/components/ui/input";
import { Label } from "@/app/components/ui/label";
import { VisitorState } from "@/app/components/registration/VisitorCard";
import { apiData, failMessage } from "@/app/components/registration/RegistrationForm";
import { utmTags } from "./LandingForm";
import { listTicketTypes, money } from "@/app/lib/services/adminTickets";
import { publicCall } from "@/app/lib/services/publicRegistration";
import { when, type PublicTicketType, type TicketRequestResult, type TicketsInfo } from "@/app/lib/services/publicTickets";
import { useT } from "@/app/lib/i18n/MessagesProvider";
const MAX = 10;
type Buyer = { name: string; mobile: string; email: string; companyName: string; consent: boolean; website: string };
const EMPTY: Buyer = { name: "", mobile: "", email: "", companyName: "", consent: false, website: "" };
const FIELDS = ["name", "mobile", "email", "companyName", "consent"];
const NOTICE = "rounded-md bg-muted p-3 text-xs text-muted-foreground";
/** One type's row: name, price and seats, and a stepper while it is on sale. */
function TypeRow({ type, qty, canAdd, onChange, disabled }: { type: PublicTicketType; qty?: number; canAdd?: boolean; onChange?: (n: number) => void; disabled?: boolean }) {
const t = useT();
const onSale = type.state === "ON_SALE" && type.left > 0;
return (
<div role="group" aria-label={type.name} className="flex items-center justify-between gap-3 rounded-md border p-3">
<div className="min-w-0">
<p className="font-medium">{type.name}</p>
<p className="text-sm text-muted-foreground">
<span>{type.priceSen === 0 ? t("TktFree") : money(type.priceSen)}</span>
{" · "}
<span>{type.state === "ENDED" ? t("TktSalesEnded") : onSale ? t("TktSeatsLeft", { count: type.left }) : t("TktSoldOut")}</span>
</p>
</div>
{onSale && onChange && (
<div className="flex items-center gap-2">
<Button type="button" variant="outline" size="icon" className="size-11" aria-label={t("TktRemoveOne", { name: type.name })}
disabled={disabled || !qty} onClick={() => onChange((qty ?? 0) - 1)}>
<Minus className="size-4" aria-hidden="true" />
</Button>
<span className="w-6 text-center tabular-nums" aria-live="polite">{qty ?? 0}</span>
<Button type="button" variant="outline" size="icon" className="size-11" aria-label={t("TktAddOne", { name: type.name })}
disabled={disabled || !canAdd} onClick={() => onChange((qty ?? 0) + 1)}>
<Plus className="size-4" aria-hidden="true" />
</Button>
</div>
)}
</div>
);
}
/** The editor canvas: the event's real types (read with the staff ticket call), with no form. */
function TicketsPreview({ eventUuid }: { eventUuid?: string | null }) {
const t = useT();
const [types, setTypes] = useState<PublicTicketType[] | null>(null);
useEffect(() => {
if (!eventUuid) return;
listTicketTypes(eventUuid)
.then((list) => setTypes(list.filter((x) => x.enabled).map((x) => ({ id: x.id, name: x.name, priceSen: x.priceSen, left: x.left, state: x.left > 0 ? "ON_SALE" : "SOLD_OUT" }))))
.catch(() => setTypes([]));
}, [eventUuid]);
return (
<div className="space-y-3">
{types?.map((x) => <TypeRow key={x.id} type={x} />)}
<p role="status" className="text-sm text-muted-foreground">{t("TktPreviewNote")}</p>
</div>
);
}
/** add-event-ticket-orders: a landing page's TICKETS block. Quantities per type (10 in all), the buyer, the consent; then the thank-you. */
export function TicketsBlock({ companyCode, slug, index, info, preview, eventUuid }: {
companyCode: string; slug: string; index: number; info?: TicketsInfo; preview?: boolean; eventUuid?: string | null;
}) {
const t = useT();
const [qty, setQty] = useState<Record<number, number>>({});
const [buyer, setBuyer] = useState<Buyer>(EMPTY);
const [errors, setErrors] = useState<Record<string, string>>({});
const [formError, setFormError] = useState<string | null>(null);
const [saving, setSaving] = useState(false);
const [done, setDone] = useState<TicketRequestResult | null>(null);
const [closed, setClosed] = useState(false);
if (preview) return <TicketsPreview eventUuid={eventUuid} />;
if (!info || closed) return <VisitorState icon={AlertCircle} heading={t("TktSalesClosed")} role="status" />;
if (done) return <Thanks result={done} />;
const count = Object.values(qty).reduce((a, b) => a + b, 0);
const total = info.types.reduce((sum, x) => sum + (qty[x.id] ?? 0) * x.priceSen, 0);
const set = (patch: Partial<Buyer>) => setBuyer((b) => ({ ...b, ...patch }));
async function onSubmit(e: FormEvent) {
e.preventDefault();
const errs: Record<string, string> = {};
if (count < 1) errs.tickets = t("TktChooseTickets");
if (!buyer.name.trim()) errs.name = t("RegNameRequired");
if (!buyer.email.trim()) errs.email = t("TktEmailRequired");
if (!buyer.consent) errs.consent = t("TktConsentRequired");
setErrors(errs);
setFormError(null);
if (Object.keys(errs).length) return;
setSaving(true);
try {
const lines = info!.types.filter((x) => qty[x.id]).map((x) => ({ ticketTypeId: x.id, quantity: qty[x.id] }));
const body = { lines, ...buyer, name: buyer.name.trim(), mobile: buyer.mobile.trim(), email: buyer.email.trim(), companyName: buyer.companyName.trim() };
setDone(await publicCall<TicketRequestResult>(`/api/public/pages/${encodeURIComponent(companyCode)}/${encodeURIComponent(slug)}/tickets/${index}`, {
method: "POST",
body: JSON.stringify({ ...body, ...utmTags(window.location.search) }),
}));
} catch (err) {
const { status, code, error, field } = apiData(err);
if (code === "TICKETS_CLOSED") setClosed(true);
else if (status === 400 && error && field && FIELDS.includes(field)) setErrors({ [field]: error });
else setFormError(failMessage(t, err));
setSaving(false);
}
}
const fieldError = (id: string) => errors[id] && <p id={`tkt-${id}-error`} className="text-sm text-destructive">{errors[id]}</p>;
const field = (id: "name" | "mobile" | "email" | "companyName", label: string, type = "text") => (
<div className="space-y-1.5">
<Label htmlFor={`tkt-${id}`}>{label}</Label>
<Input id={`tkt-${id}`} className="h-11" type={type} value={buyer[id]} disabled={saving} onChange={(e) => set({ [id]: e.target.value })}
aria-invalid={!!errors[id]} aria-describedby={errors[id] ? `tkt-${id}-error` : undefined} />
{fieldError(id)}
</div>
);
return (
<form onSubmit={onSubmit} className="space-y-4" noValidate>
{formError && <p role="alert" className="text-sm text-destructive">{formError}</p>}
<div className="space-y-2">
{info.types.map((x) => (
<TypeRow key={x.id} type={x} qty={qty[x.id]} disabled={saving}
canAdd={count < MAX && (qty[x.id] ?? 0) < x.left}
onChange={(n) => setQty((q) => ({ ...q, [x.id]: Math.max(0, n) }))} />
))}
<p className="text-xs text-muted-foreground">{t("TktMax")}</p>
{fieldError("tickets")}
</div>
<p className="flex items-baseline justify-between text-lg font-semibold">
<span>{t("TktTotal")}</span>
<span data-testid="tickets-total" className="tabular-nums">{money(total)}</span>
</p>
{field("name", t("RegName"))}
{field("email", t("RegEmail"), "email")}
{field("mobile", t("RegMobile"), "tel")}
{field("companyName", t("RegCompany"))}
<details className={NOTICE}>
<summary className="cursor-pointer font-medium text-foreground">{t("RegNoticeSummary")}</summary>
<div className="mt-2 space-y-2">
<h3 className="font-semibold text-foreground">{t("RegNoticeEn")}</h3>
<p className="whitespace-pre-line">{info.notice.textEn}</p>
<h3 className="font-semibold text-foreground">{t("RegNoticeMs")}</h3>
<p className="whitespace-pre-line">{info.notice.textMs}</p>
</div>
</details>
<Label htmlFor={`tkt-consent-${index}`} className="flex min-h-11 w-full cursor-pointer items-start gap-3 rounded-md border p-3 leading-normal">
<Checkbox id={`tkt-consent-${index}`} className="mt-0.5 size-6" checked={buyer.consent} onCheckedChange={(on) => set({ consent: on === true })}
aria-invalid={!!errors.consent} aria-describedby={errors.consent ? "tkt-consent-error" : undefined} />
<span className="space-y-1 text-sm font-normal">
<span className="block">{t("RegConsentEn", { company: info.companyName })}</span>
<span className="block">{t("RegConsentMs", { company: info.companyName })}</span>
</span>
</Label>
{fieldError("consent")}
{/* Honeypot: people never see or reach it; bots fill it and the server saves nothing. */}
<div aria-hidden="true" className="absolute -left-[9999px] h-0 w-0 overflow-hidden">
<input name="website" tabIndex={-1} autoComplete="off" value={buyer.website} onChange={(e) => set({ website: e.target.value })} />
</div>
<Button type="submit" className="h-11 w-full" disabled={saving}>{t("TktRequest")}</Button>
</form>
);
}
/** The thank-you: the order, how and by when to pay while it awaits payment, and its link. */
export function Thanks({ result }: { result: TicketRequestResult }) {
const t = useT();
if (!result.reference || !result.token) return <VisitorState icon={CheckCircle2} heading={t("TktThanksPlain", { event: result.eventName })} role="status" />;
const paid = result.status === "PAID";
return (
<div role="status" className="space-y-4">
<VisitorState icon={CheckCircle2} heading={t(paid ? "TktThanksPaid" : "TktThanks", { reference: result.reference })} />
<OrderSummary lines={result.lines ?? []} totalSen={result.totalSen ?? 0} />
{!paid && result.paymentInstructions && (
<PaymentBox instructions={result.paymentInstructions} holdUntil={result.holdUntil} />
)}
<Button asChild className="h-11 w-full">
<Link href={`/o/${encodeURIComponent(result.token)}`}>{t("TktViewOrder")}</Link>
</Button>
</div>
);
}
export function OrderSummary({ lines, totalSen }: { lines: { name: string; unitPriceSen: number; quantity: number }[]; totalSen: number }) {
const t = useT();
return (
<ul className="divide-y rounded-md border text-sm">
{lines.map((l, i) => (
<li key={i} className="flex justify-between gap-3 p-3">
<span>{l.name} × {l.quantity}</span>
<span className="tabular-nums">{money(l.unitPriceSen * l.quantity)}</span>
</li>
))}
<li className="flex justify-between gap-3 p-3 font-semibold">
<span>{t("TktTotal")}</span>
<span className="tabular-nums">{money(totalSen)}</span>
</li>
</ul>
);
}
export function PaymentBox({ instructions, holdUntil }: { instructions: string; holdUntil?: string | null }) {
const t = useT();
return (
<div className="space-y-2 rounded-md bg-muted p-4 text-sm">
<h3 className="font-semibold">{t("TktHowToPay")}</h3>
<p className="whitespace-pre-line">{instructions}</p>
{holdUntil && <p className="font-medium">{t("TktPayBy", { when: when(holdUntil) })}</p>}
</div>
);
}
@@ -133,7 +133,7 @@ export function usePageDraft({ pageId, fromId, initialBlocks }: { pageId?: numbe
let live = true;
const today = malaysiaToday();
listAdminEvents({ enabled: "Y", page: 1, pageSize: 100, sortBy: "name", sortDir: "asc", companyId: eventsCompany })
.then((r) => { if (live) setEvents(r.items.filter((e) => !e.endDate || e.endDate >= today).map((e) => ({ uuid: e.uuid, name: e.name }))); })
.then((r) => { if (live) setEvents(r.items.filter((e) => !e.endDate || e.endDate >= today).map((e) => ({ uuid: e.uuid, name: e.name, ticketsEnabled: e.ticketsEnabled }))); })
.catch(() => {}); // the picker stays empty; a saved event still shows as unavailable
return () => { live = false; };
}, [isSuper, eventsCompany]);
@@ -46,4 +46,18 @@ describe("RegistrationForm compact", () => {
expect(screen.queryByRole("combobox")).not.toBeInTheDocument();
expect(screen.getByText("English text").closest("details")).toBeNull();
});
// add-hero-fits-screen: tighter spacing, but controls stay 44 px (h-11) for touch.
it("is tighter than the full form, with the consent in small text and 44 px controls", () => {
const { container, unmount } = render(<RegistrationForm {...base} submit={async () => undefined} compact />);
expect(container.querySelector("form")).toHaveClass("space-y-3");
expect(screen.getByText(/I agree to INS/).parentElement).toHaveClass("text-sm");
for (const el of [screen.getByLabelText("Your name"), screen.getByLabelText("Mobile number"), screen.getByRole("combobox"), screen.getByRole("button", { name: "Register" })]) {
expect(el).toHaveClass("h-11");
}
unmount();
const full = render(<RegistrationForm {...base} submit={async () => undefined} />);
expect(full.container.querySelector("form")).toHaveClass("space-y-4");
expect(screen.getByText(/I agree to INS/).parentElement).not.toHaveClass("text-sm");
});
});
@@ -41,7 +41,7 @@ interface Props {
onDone: () => void;
/** The code or invitation was switched off: the page shows its own message. */
onInactive: () => void;
/** add-compact-landing-form: a landing page's short form: no job title, one service dropdown, the notice folded. */
/** add-compact-landing-form: a landing page's short form: no job title, one service dropdown, the notice folded; tighter spacing (add-hero-fits-screen). */
compact?: boolean;
}
@@ -134,7 +134,7 @@ export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, on
);
return (
<form onSubmit={onSubmit} className="space-y-4" noValidate>
<form onSubmit={onSubmit} className={compact ? "space-y-3" : "space-y-4"} noValidate>
{formError && <p role="alert" className="text-sm text-destructive">{formError}</p>}
{field("name", t("RegName"))}
{field("mobile", t("RegMobile"), "tel", t("RegContactHint"))}
@@ -152,7 +152,7 @@ export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, on
)}
<Label htmlFor="reg-consent" className={CONSENT_ROW}>
<Checkbox id="reg-consent" className={`${BOX} mt-0.5`} checked={form.consent} onCheckedChange={(on) => set({ consent: on === true })} aria-invalid={!!errors.consent} aria-describedby={errors.consent ? "reg-consent-error" : undefined} />
<span className="space-y-1 font-normal">
<span className={`space-y-1 font-normal ${compact ? "text-sm" : ""}`}>
<span className="block">{t("RegConsentEn", { company: info.companyName })}</span>
<span className="block">{t("RegConsentMs", { company: info.companyName })}</span>
</span>
@@ -24,6 +24,8 @@ const ALLOW: Record<string, string[]> = {
"app/pos/_components/SplitTenderPanel.tsx": ["bg-white"],
// The full-screen QR sits on a white quiet zone so it scans in dark mode.
"app/components/registration/QrCodeItem.tsx": ["bg-white"],
// add-event-tickets: the ticket QR sits on a white quiet zone so it scans in dark mode.
"app/t/[code]/page.tsx": ["bg-white"],
// A sent email's HTML is authored for a white mail-client canvas; a theme surface would put the
// email's dark text on dark in dark mode.
"app/email-templates/logs/[id]/page.tsx": ["bg-white"],
@@ -153,6 +153,21 @@ describe("EventLeadsDetailPage (listing)", { timeout: 20000 }, () => {
expect(card.getByText("Source: QR")).toBeInTheDocument();
});
it("labels ticket leads (buyers and consenting attendees) as Ticket", async () => {
mocks.listEventLeads.mockResolvedValue({
items: [{
eventLeadUuid: "el-1", eventUuid: "evt-1", leadUuid: "lead-1", name: "John Doe", mobile: null, email: null,
companyName: null, jobTitle: null, leadType: "NEW", salesperson: null, temperature: null, status: "OPEN",
interests: [], nextFollowUpDate: null, notes: null, capturedAt: "2025-06-01", attended: null, source: "TICKET",
}],
total: 1,
});
render(<EventLeadsDetailPage />);
const row = (await screen.findByRole("link", { name: "John Doe" })).closest("tr")!;
expect(within(row).getAllByRole("cell").at(-1)!.textContent).toBe("Ticket");
expect(within(screen.getByTestId("lead-card")).getByText("Source: Ticket")).toBeInTheDocument();
});
it("filters by attendance for the list and the export", async () => {
const user = userEvent.setup();
render(<EventLeadsDetailPage />);
@@ -28,7 +28,7 @@ const TEMPERATURE_OPTIONS = [{ value: "HOT", label: "LeadHot" }, { value: "WARM"
const STATUS_OPTIONS = [{ value: "OPEN", label: "LeadOpen" }, { value: "CONTACTED", label: "LeadContacted" }, { value: "QUALIFIED", label: "LeadQualified" }, { value: "WON", label: "LeadWon" }, { value: "LOST", label: "LeadLost" }];
const LEAD_TYPE_OPTIONS = [{ value: "NEW", label: "LeadNew" }, { value: "EXISTING", label: "LeadExisting" }];
const ATTENDED_OPTIONS = [{ value: "true", label: "GuestAttended" }, { value: "false", label: "LeadNotAttended" }];
const SOURCE_LABEL = { STAFF: "LeadSourceStaff", QR: "LeadSourceQr", INVITE: "LeadSourceInvite", WEB: "LeadSourceWeb" } as const;
const SOURCE_LABEL = { STAFF: "LeadSourceStaff", QR: "LeadSourceQr", INVITE: "LeadSourceInvite", WEB: "LeadSourceWeb", TICKET: "LeadSourceTicket" } as const;
const TEMPERATURE_BADGE = { HOT: "negative", WARM: "warning", COLD: "neutral" } as const;
const STATUS_BADGE = { OPEN: "neutral", CONTACTED: "neutral", QUALIFIED: "contrast", WON: "positive", LOST: "negative" } as const;
@@ -0,0 +1,72 @@
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { ApiError } from "@/app/lib/clientApi";
const mocks = vi.hoisted(() => ({ getOrder: vi.fn(), resendTicket: vi.fn(), useAdminAuth: vi.fn() }));
vi.mock("@/app/lib/services/adminTickets", async (orig) => ({ ...(await orig<object>()), getOrder: mocks.getOrder, resendTicket: mocks.resendTicket }));
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: mocks.useAdminAuth }));
vi.mock("next/navigation", () => ({ useParams: () => ({ uuid: "evt-9", orderId: "300" }) }));
import OrderPage from "./page";
const detail = (status: string) => ({
order: {
id: 300, reference: "T-7K3M9Q", status, buyerName: "Aisyah", buyerEmail: "a@example.test", buyerMobileE164: null,
buyerCompany: null, totalSen: 50000, holdUntil: null, paidAt: "2026-12-04T11:00:00", paidBy: "finance1", paymentRef: null,
cancelledAt: null, cancelledBy: null, expiredAt: null, createdAt: "2026-12-04T10:00:00",
},
lines: [{ id: 400, name: "General", unitPriceSen: 25000, quantity: 2 }],
tickets: [
{ id: 1, typeName: "General", status: "ACTIVE", cancelledAt: null, cancelledBy: null },
{ id: 2, typeName: "General", status: "CANCELLED", cancelledAt: "2026-12-04T12:00:00", cancelledBy: "finance1" },
],
});
beforeEach(() => {
mocks.getOrder.mockReset().mockResolvedValue(detail("PAID"));
mocks.resendTicket.mockReset().mockResolvedValue({});
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" || m === "BO_EVENT_TICKETS" });
});
// add-event-tickets: staff resend one valid ticket from the order detail.
describe("OrderPage resend ticket", () => {
it("resends an active ticket of a paid order, not a cancelled one", async () => {
const user = userEvent.setup();
render(<OrderPage />);
await screen.findByRole("heading", { name: /T-7K3M9Q/ });
const rows = screen.getAllByRole("row").filter((r) => r.textContent?.includes("General"));
expect(within(rows[1]).queryByRole("button", { name: "Resend ticket" })).not.toBeInTheDocument();
await user.click(within(rows[0]).getByRole("button", { name: "Resend ticket" }));
await waitFor(() => expect(mocks.resendTicket).toHaveBeenCalledWith("evt-9", "300", 1));
expect(await screen.findByText("Ticket sent.")).toBeInTheDocument();
});
it("shows each ticket's attendee and check-in, and offers no resend once checked in", async () => {
mocks.getOrder.mockResolvedValue({ ...detail("PAID"), tickets: [
{ id: 1, typeName: "General", status: "ACTIVE", cancelledAt: null, cancelledBy: null, attendeeName: "Tan Mei Ling", checkedInAt: null },
{ id: 3, typeName: "General", status: "ACTIVE", cancelledAt: null, cancelledBy: null, attendeeName: null, checkedInAt: "2026-12-04T18:14:00" },
] });
render(<OrderPage />);
const tan = (await screen.findByText("Tan Mei Ling")).closest("tr")!;
expect(within(tan).getByRole("button", { name: "Resend ticket" })).toBeInTheDocument();
const used = screen.getByText("Not named yet").closest("tr")!;
expect(used).toHaveTextContent(/Checked in at/);
expect(within(used).queryByRole("button", { name: "Resend ticket" })).not.toBeInTheDocument();
});
it("offers no resend before payment", async () => {
mocks.getOrder.mockResolvedValue(detail("AWAITING"));
render(<OrderPage />);
await screen.findByRole("heading", { name: /T-7K3M9Q/ });
expect(screen.queryByRole("button", { name: "Resend ticket" })).not.toBeInTheDocument();
});
it("explains a refusal for a ticket that is no longer valid", async () => {
mocks.resendTicket.mockRejectedValue(new ApiError("x", 409, { code: "TICKET_NOT_VALID" }));
const user = userEvent.setup();
render(<OrderPage />);
await user.click(await screen.findByRole("button", { name: "Resend ticket" }));
expect(await screen.findByRole("alert")).toHaveTextContent("This ticket is not valid, so it cannot be sent.");
});
});
@@ -0,0 +1,99 @@
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { ApiError } from "@/app/lib/clientApi";
const mocks = vi.hoisted(() => ({
getOrder: vi.fn(),
markOrderPaid: vi.fn(),
cancelOrder: vi.fn(),
cancelTicket: vi.fn(),
resendOrderEmail: vi.fn(),
useAdminAuth: vi.fn(),
}));
vi.mock("@/app/lib/services/adminTickets", async (orig) => ({ ...(await orig<object>()), ...mocks }));
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: mocks.useAdminAuth }));
vi.mock("next/navigation", () => ({ useParams: () => ({ uuid: "evt-9", orderId: "300" }) }));
import OrderPage from "./page";
const detail = (status: string) => ({
order: {
id: 300, reference: "T-7K3M9Q", status, buyerName: "Aisyah", buyerEmail: "a@example.test", buyerMobileE164: "+60125550101",
buyerCompany: "Hotel Seri", totalSen: 75000, holdUntil: "2026-12-07T10:00:00", paidAt: null, paidBy: null, paymentRef: null,
cancelledAt: null, cancelledBy: null, expiredAt: null, createdAt: "2026-12-04T10:00:00",
},
lines: [{ id: 400, name: "General", unitPriceSen: 25000, quantity: 3 }],
tickets: [1, 2, 3].map((id) => ({ id, typeName: "General", status: "ACTIVE", cancelledAt: null, cancelledBy: null })),
});
const refused = (code: string) => new ApiError(code, 409, { error: code, code });
beforeEach(() => {
for (const m of [mocks.markOrderPaid, mocks.cancelOrder, mocks.cancelTicket, mocks.resendOrderEmail]) m.mockReset().mockResolvedValue({});
mocks.getOrder.mockReset().mockResolvedValue(detail("AWAITING"));
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" || m === "BO_EVENT_TICKETS" });
});
describe("OrderPage", () => {
it("shows the lines, tickets and buyer", async () => {
render(<OrderPage />);
expect(await screen.findByRole("heading", { name: /T-7K3M9Q/ })).toBeInTheDocument();
expect(screen.getByText("RM 750.00")).toBeInTheDocument();
expect(screen.getByText("a@example.test")).toBeInTheDocument();
expect(screen.getByText("+60125550101")).toBeInTheDocument();
expect(screen.getAllByRole("row", { name: /General/ }).length).toBeGreaterThanOrEqual(3);
});
it("marks the order paid with a reference", async () => {
const user = userEvent.setup();
render(<OrderPage />);
await user.type(await screen.findByLabelText("Payment reference"), "MBB 0412 883");
await user.click(screen.getByRole("button", { name: "Mark paid" }));
await waitFor(() => expect(mocks.markOrderPaid).toHaveBeenCalledWith("evt-9", "300", "MBB 0412 883"));
expect(mocks.getOrder).toHaveBeenCalledTimes(2);
});
it("explains when an expired order's seats are gone", async () => {
const user = userEvent.setup();
mocks.getOrder.mockResolvedValue(detail("EXPIRED"));
mocks.markOrderPaid.mockRejectedValueOnce(refused("SEATS_GONE"));
render(<OrderPage />);
await user.click(await screen.findByRole("button", { name: "Mark paid" }));
expect(await screen.findByText("The seats of this expired order were taken. It cannot be marked paid.")).toBeInTheDocument();
});
it("cancels the order after a confirm", async () => {
const user = userEvent.setup();
render(<OrderPage />);
await user.click(await screen.findByRole("button", { name: "Cancel order" }));
expect(mocks.cancelOrder).not.toHaveBeenCalled();
await user.click(within(screen.getByRole("dialog")).getByRole("button", { name: "Cancel order" }));
await waitFor(() => expect(mocks.cancelOrder).toHaveBeenCalledWith("evt-9", "300"));
});
it("cancels one ticket after a confirm and shows the last-ticket refusal", async () => {
const user = userEvent.setup();
mocks.cancelTicket.mockRejectedValueOnce(refused("LAST_TICKET"));
render(<OrderPage />);
const buttons = await screen.findAllByRole("button", { name: "Cancel ticket" });
await user.click(buttons[1]);
await user.click(within(screen.getByRole("dialog")).getByRole("button", { name: "Cancel ticket" }));
await waitFor(() => expect(mocks.cancelTicket).toHaveBeenCalledWith("evt-9", "300", 2));
expect(await screen.findByText("This is the order's last ticket. Cancel the order instead.")).toBeInTheDocument();
});
it("resends the latest email", async () => {
const user = userEvent.setup();
render(<OrderPage />);
await user.click(await screen.findByRole("button", { name: "Resend email" }));
await waitFor(() => expect(mocks.resendOrderEmail).toHaveBeenCalledWith("evt-9", "300"));
expect(await screen.findByText("Email sent again.")).toBeInTheDocument();
});
it("offers no actions on a cancelled order", async () => {
mocks.getOrder.mockResolvedValue(detail("CANCELLED"));
render(<OrderPage />);
await screen.findByText("Cancelled");
for (const name of ["Mark paid", "Cancel order", "Cancel ticket"]) expect(screen.queryByRole("button", { name })).toBeNull();
});
});
@@ -0,0 +1,213 @@
"use client";
import Link from "next/link";
import { useCallback, useEffect, useState } from "react";
import { useParams } from "next/navigation";
import { OrderStatusBadge } from "@/app/components/events/OrderStatusBadge";
import { Button } from "@/app/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/app/components/ui/card";
import { ConfirmDialog } from "@/app/components/ui/confirm-dialog";
import { Input } from "@/app/components/ui/input";
import { Label } from "@/app/components/ui/label";
import { PageHeader } from "@/app/components/ui/page-header";
import { EmptyState, ErrorState } from "@/app/components/ui/states";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table";
import { RequireModule } from "@/app/lib/RequireModule";
import { ApiError } from "@/app/lib/clientApi";
import { useT } from "@/app/lib/i18n/MessagesProvider";
import {
TICKET_ERRORS,
cancelOrder,
cancelTicket,
getOrder,
markOrderPaid,
money,
resendOrderEmail,
resendTicket,
type OrderDetail,
} from "@/app/lib/services/adminTickets";
const when = (s: string | null) => (s ? s.replace("T", " ").slice(0, 16) : "-");
function OrderContent() {
const t = useT();
const { uuid, orderId } = useParams<{ uuid: string; orderId: string }>();
const [d, setD] = useState<OrderDetail | null>(null);
const [notFound, setNotFound] = useState(false);
const [loadError, setLoadError] = useState(false);
const [paymentRef, setPaymentRef] = useState("");
const [error, setError] = useState<string | null>(null);
const [notice, setNotice] = useState<string | null>(null);
const [confirm, setConfirm] = useState<{ ticketId?: number } | null>(null);
const [busy, setBusy] = useState(false);
const load = useCallback(async () => {
try {
setD(await getOrder(uuid, orderId));
setLoadError(false);
} catch (err) {
if (err instanceof ApiError && err.status === 404) setNotFound(true);
else setLoadError(true);
}
}, [uuid, orderId]);
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect -- load() fetches from the API; its setState runs after the await.
load();
}, [load]);
async function run(action: () => Promise<void>, done?: string) {
setError(null);
setNotice(null);
setBusy(true);
try {
await action();
if (done) setNotice(t(done));
await load();
} catch (err) {
const code = err instanceof ApiError ? (err.data as { code?: string } | undefined)?.code : undefined;
setError(t(code && TICKET_ERRORS[code] ? TICKET_ERRORS[code] : "TktActionFailed"));
} finally {
setBusy(false);
}
}
const doConfirm = () => {
const c = confirm;
setConfirm(null);
if (!c) return;
return c.ticketId == null ? run(() => cancelOrder(uuid, orderId).then(() => {}), "TktOrderCancelled")
: run(() => cancelTicket(uuid, orderId, c.ticketId!).then(() => {}), "TktTicketCancelled");
};
const back = (
<Button asChild variant="outline" size="sm">
<Link href={`/events/${encodeURIComponent(uuid)}/orders`}>{t("TktBackToOrders")}</Link>
</Button>
);
if (notFound) return (<><PageHeader title={t("TktOrderTitle")} actions={back} /><EmptyState title={t("TktOrderNotFound")} /></>);
if (loadError) return (<><PageHeader title={t("TktOrderTitle")} actions={back} /><ErrorState message={t("TktLoadFailed")} onRetry={load} /></>);
if (!d) return <PageHeader title={t("TktOrderTitle")} actions={back} />;
const o = d.order;
const open = o.status === "AWAITING" || o.status === "PAID";
const payable = o.status === "AWAITING" || o.status === "EXPIRED";
const facts: [string, string | null][] = [
[t("TktBuyer"), o.buyerName],
[t("Email"), o.buyerEmail],
[t("LeadMobile"), o.buyerMobileE164],
[t("Company"), o.buyerCompany],
[t("TktCreated"), when(o.createdAt)],
[t("TktHoldUntil"), o.status === "AWAITING" ? when(o.holdUntil) : null],
[t("TktPaymentRef"), o.paymentRef],
[t("TktPaidBy"), o.paidAt ? `${o.paidBy ?? "-"}, ${when(o.paidAt)}` : null],
[t("TktCancelledBy"), o.cancelledAt ? `${o.cancelledBy ?? "-"}, ${when(o.cancelledAt)}` : null],
[t("TktExpiredAt"), o.expiredAt ? when(o.expiredAt) : null],
];
return (
<div className="space-y-4">
<PageHeader title={t("TktOrderNamed", { reference: o.reference })} actions={back} />
{error && <p role="alert" className="text-sm text-destructive">{error}</p>}
{notice && <p role="status" className="text-sm text-muted-foreground">{notice}</p>}
<Card>
<CardHeader className="flex flex-row items-center justify-between gap-2">
<CardTitle className="flex items-center gap-2">
<OrderStatusBadge status={o.status} /> <span>{money(o.totalSen)}</span>
</CardTitle>
<Button type="button" variant="outline" size="sm" disabled={busy} onClick={() => run(() => resendOrderEmail(uuid, orderId).then(() => {}), "TktEmailResent")}>
{t("TktResend")}
</Button>
</CardHeader>
<CardContent className="space-y-4">
<dl className="grid gap-x-6 gap-y-2 sm:grid-cols-2">
{facts.filter(([, v]) => v).map(([k, v]) => (
<div key={k}>
<dt className="text-xs text-muted-foreground">{k}</dt>
<dd>{v}</dd>
</div>
))}
</dl>
{payable && (
<div className="flex flex-wrap items-end gap-2">
<div className="space-y-1">
<Label htmlFor="payment-ref">{t("TktPaymentRef")}</Label>
<Input id="payment-ref" maxLength={100} value={paymentRef} onChange={(e) => setPaymentRef(e.target.value)} />
</div>
<Button type="button" disabled={busy} onClick={() => run(() => markOrderPaid(uuid, orderId, paymentRef).then(() => {}), "TktMarkedPaid")}>
{t("TktMarkPaid")}
</Button>
</div>
)}
{open && (
<Button type="button" variant="destructive" disabled={busy} onClick={() => setConfirm({})}>
{t("TktCancelOrder")}
</Button>
)}
</CardContent>
</Card>
<Card>
<CardHeader><CardTitle>{t("TktTickets")}</CardTitle></CardHeader>
<CardContent>
<Table>
<TableHeader>
<TableRow>
<TableHead>{t("TktTicketType")}</TableHead>
<TableHead>{t("TktAttendeeName")}</TableHead>
<TableHead>{t("Status")}</TableHead>
<TableHead />
</TableRow>
</TableHeader>
<TableBody>
{d.tickets.map((x) => (
<TableRow key={x.id}>
<TableCell>{x.typeName ?? "-"}</TableCell>
<TableCell>{x.attendeeName ?? t("TktNotNamed")}</TableCell>
<TableCell>
{x.status !== "ACTIVE" ? t("TktTicketCancelledBy", { by: x.cancelledBy ?? "-", at: when(x.cancelledAt) })
: x.checkedInAt ? t("TktCheckedInAt", { when: when(x.checkedInAt) }) : t("TktTicketActive")}
</TableCell>
<TableCell className="text-right">
{o.status === "PAID" && x.status === "ACTIVE" && !x.checkedInAt && (
<Button type="button" variant="ghost" size="sm" disabled={busy} onClick={() => run(() => resendTicket(uuid, orderId, x.id).then(() => {}), "TktTicketSent")}>
{t("TktResendTicket")}
</Button>
)}
{open && x.status === "ACTIVE" && (
<Button type="button" variant="ghost" size="sm" disabled={busy} onClick={() => setConfirm({ ticketId: x.id })}>
{t("TktCancelTicket")}
</Button>
)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</CardContent>
</Card>
{confirm && (
<ConfirmDialog
title={t(confirm.ticketId == null ? "TktCancelOrder" : "TktCancelTicket")}
message={t(confirm.ticketId == null ? "TktCancelOrderMessage" : "TktCancelTicketMessage")}
confirmLabel={t(confirm.ticketId == null ? "TktCancelOrder" : "TktCancelTicket")}
destructive
busy={busy}
onConfirm={doConfirm}
onCancel={() => setConfirm(null)}
/>
)}
</div>
);
}
/** add-event-ticket-orders: one order with its tickets and the staff actions. */
export default function OrderPage() {
return (
<RequireModule pathname="/event-orders">
<OrderContent />
</RequireModule>
);
}
@@ -0,0 +1,47 @@
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, it, expect, vi, beforeEach } from "vitest";
const mocks = vi.hoisted(() => ({ listOrders: vi.fn(), useAdminAuth: vi.fn() }));
vi.mock("@/app/lib/services/adminTickets", async (orig) => ({ ...(await orig<object>()), listOrders: mocks.listOrders }));
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: mocks.useAdminAuth }));
vi.mock("next/navigation", () => ({ useParams: () => ({ uuid: "evt-9" }) }));
import OrdersPage from "./page";
const ROW = { id: 300, reference: "T-7K3M9Q", buyerName: "Aisyah", buyerEmail: "a@example.test", tickets: 3, totalSen: 75000, status: "AWAITING", createdAt: "2026-12-04T10:00:00" };
beforeEach(() => {
mocks.listOrders.mockReset().mockResolvedValue({ content: [ROW], totalElements: 1, totalPages: 1, number: 0, size: 50 });
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" || m === "BO_EVENT_TICKETS" });
});
describe("OrdersPage", () => {
it("is not reachable without BO_EVENT_TICKETS", () => {
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: (m: string) => m === "BO_EVENTS" });
render(<OrdersPage />);
expect(screen.getByTestId("not-authorized")).toBeInTheDocument();
expect(mocks.listOrders).not.toHaveBeenCalled();
});
it("lists the orders with a link to each", async () => {
render(<OrdersPage />);
const row = await screen.findByRole("row", { name: /T-7K3M9Q/ });
expect(within(row).getByText("Aisyah")).toBeInTheDocument();
expect(within(row).getByText("RM 750.00")).toBeInTheDocument();
expect(within(row).getByText("Awaiting payment")).toBeInTheDocument();
expect(within(row).getByRole("link", { name: "T-7K3M9Q" })).toHaveAttribute("href", "/events/evt-9/orders/300");
expect(mocks.listOrders).toHaveBeenCalledWith("evt-9", { status: "", q: "", page: 0 });
});
it("filters by state and searches", async () => {
const user = userEvent.setup();
render(<OrdersPage />);
await screen.findByText("T-7K3M9Q");
await user.click(screen.getByRole("combobox", { name: "Order state" }));
await user.click(await screen.findByRole("option", { name: "Paid" }));
await waitFor(() => expect(mocks.listOrders).toHaveBeenLastCalledWith("evt-9", { status: "PAID", q: "", page: 0 }));
await user.type(screen.getByRole("searchbox", { name: "Search orders" }), "aisyah");
await waitFor(() => expect(mocks.listOrders).toHaveBeenLastCalledWith("evt-9", { status: "PAID", q: "aisyah", page: 0 }));
});
});
@@ -0,0 +1,117 @@
"use client";
import Link from "next/link";
import { useCallback, useEffect, useState } from "react";
import { useParams } from "next/navigation";
import { OrderStatusBadge } from "@/app/components/events/OrderStatusBadge";
import { Button } from "@/app/components/ui/button";
import { FilterField, FilterPanel, FilterSearch, FilterSelect } from "@/app/components/ui/filter-panel";
import { PageHeader } from "@/app/components/ui/page-header";
import { ErrorState } from "@/app/components/ui/states";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table";
import { TablePager } from "@/app/components/ui/table-pager";
import { RequireModule } from "@/app/lib/RequireModule";
import { useT } from "@/app/lib/i18n/MessagesProvider";
import { ORDER_STATUSES, listOrders, money, type OrderPage } from "@/app/lib/services/adminTickets";
const PAGE_SIZE = 50;
function OrdersContent() {
const t = useT();
const { uuid } = useParams<{ uuid: string }>();
const [status, setStatus] = useState("");
const [q, setQ] = useState("");
const [page, setPage] = useState(0);
const [data, setData] = useState<OrderPage | null>(null);
const [error, setError] = useState(false);
const load = useCallback(async () => {
try {
setData(await listOrders(uuid, { status, q, page }));
setError(false);
} catch {
setError(true);
}
}, [uuid, status, q, page]);
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect -- load() fetches from the API; its setState runs after the await.
load();
}, [load]);
const base = `/events/${encodeURIComponent(uuid)}`;
return (
<div className="space-y-4">
<PageHeader
title={t("TktOrdersTitle")}
actions={
<Button asChild variant="outline" size="sm">
<Link href={base}>{t("TktBackToEvent")}</Link>
</Button>
}
/>
<FilterPanel activeCount={(status ? 1 : 0) + (q ? 1 : 0)} onClear={() => { setStatus(""); setQ(""); setPage(0); }}>
<FilterField label={t("TktOrderState")}>
<FilterSelect
aria-label={t("TktOrderState")}
allLabel={t("AllStatuses")}
options={ORDER_STATUSES.map((s) => ({ value: s, label: t(`TktStatus${s}`) }))}
value={status}
onChange={(v) => { setStatus(v); setPage(0); }}
/>
</FilterField>
<FilterField label={t("TktSearchOrders")}>
<FilterSearch aria-label={t("TktSearchOrders")} placeholder={t("TktSearchOrdersHint")} value={q} onChange={(v) => { setQ(v); setPage(0); }} />
</FilterField>
</FilterPanel>
{error && <ErrorState message={t("TktLoadFailed")} onRetry={load} />}
{data && (
<>
<Table>
<TableHeader>
<TableRow>
<TableHead>{t("TktReference")}</TableHead>
<TableHead>{t("TktBuyer")}</TableHead>
<TableHead>{t("Email")}</TableHead>
<TableHead>{t("TktTickets")}</TableHead>
<TableHead>{t("TktTotal")}</TableHead>
<TableHead>{t("Status")}</TableHead>
<TableHead>{t("TktCreated")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.content.length === 0 && (
<TableRow>
<TableCell colSpan={7} className="text-muted-foreground">{t("TktNoOrders")}</TableCell>
</TableRow>
)}
{data.content.map((o) => (
<TableRow key={o.id}>
<TableCell>
<Link className="font-medium underline-offset-4 hover:underline" href={`${base}/orders/${o.id}`}>{o.reference}</Link>
</TableCell>
<TableCell>{o.buyerName}</TableCell>
<TableCell>{o.buyerEmail}</TableCell>
<TableCell>{o.tickets}</TableCell>
<TableCell>{money(o.totalSen)}</TableCell>
<TableCell><OrderStatusBadge status={o.status} /></TableCell>
<TableCell>{o.createdAt.replace("T", " ").slice(0, 16)}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
<TablePager page={page + 1} pageSize={PAGE_SIZE} total={data.totalElements} onPageChange={(p) => setPage(p - 1)} />
</>
)}
</div>
);
}
/** add-event-ticket-orders: an event's ticket orders, newest first, 50 a page. */
export default function OrdersPage() {
return (
<RequireModule pathname="/event-orders">
<OrdersContent />
</RequireModule>
);
}
@@ -8,6 +8,7 @@ import { Skeleton } from "@/app/components/ui/skeleton";
import { EmptyState, ErrorState } from "@/app/components/ui/states";
import { GuestsCard } from "@/app/components/events/GuestsCard";
import { RegistrationQrCard } from "@/app/components/events/RegistrationQrCard";
import { TicketsCard } from "@/app/components/events/TicketsCard";
import { useAdminAuth } from "@/app/lib/AdminAuthContext";
import { RequireModule } from "@/app/lib/RequireModule";
import { ApiError } from "@/app/lib/clientApi";
@@ -122,7 +123,9 @@ function EditEventPageContent() {
{/* ponytail: no read-only role for events yet; the events module is the write gate for the code switches. */}
<RegistrationQrCard eventUuid={event.uuid} eventName={event.name} canWrite={hasModule("BO_EVENTS")} />
<GuestsCard eventUuid={event.uuid} team={event.team} />
<GuestsCard eventUuid={event.uuid} team={event.team} ticketsEnabled={!!event.ticketsEnabled} />
<TicketsCard eventUuid={event.uuid} />
</div>
);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="7" fill="#2563EB"/><path d="M20.5 11.2a7 7 0 1 0 0 9.6" fill="none" stroke="#fff" stroke-width="3.2" stroke-linecap="round"/></svg>

After

Width:  |  Height:  |  Size: 225 B

+10 -2
View File
@@ -3,9 +3,9 @@
import { Calendar, Cloud, Headset, Lock, Monitor, Phone, ShieldCheck, Star, Tv, Users, Wifi, Wrench, type LucideIcon } from "lucide-react";
export type BlockType = "HERO" | "RICH_TEXT" | "IMAGE_TEXT" | "FAQ" | "FORM" | "HTML" | "FEATURES" | "STEPS" | "TRUST" | "CTA" | "FOOTER";
export type BlockType = "HERO" | "RICH_TEXT" | "IMAGE_TEXT" | "FAQ" | "FORM" | "HTML" | "FEATURES" | "STEPS" | "TRUST" | "CTA" | "FOOTER" | "TOPBAR" | "TICKETS";
export const BLOCK_TYPES: BlockType[] = ["HERO", "RICH_TEXT", "IMAGE_TEXT", "FEATURES", "STEPS", "TRUST", "CTA", "FAQ", "FORM", "HTML", "FOOTER"];
export const BLOCK_TYPES: BlockType[] = ["HERO", "RICH_TEXT", "IMAGE_TEXT", "FEATURES", "STEPS", "TRUST", "CTA", "FAQ", "FORM", "TICKETS", "HTML", "FOOTER", "TOPBAR"];
/** Feature-card icons by the name services-counter accepts (add-page-sections). */
export const ICONS: Record<string, LucideIcon> = {
@@ -29,6 +29,8 @@ export const BLOCK_LABELS: Record<BlockType, string> = {
TRUST: "PagesBlockTrust",
CTA: "PagesBlockCta",
FOOTER: "PagesBlockFooter",
TOPBAR: "PagesBlockTopBar",
TICKETS: "PagesBlockTickets",
};
/** A FEATURES (icon, title, text), STEPS (title, text) or TRUST (title) card; a HERO's points are title-only cards; a FOOTER's columns are title-and-text cards. */
@@ -65,6 +67,8 @@ export interface CmsBlock {
formText?: string;
/** add-landing-thanks-and-footer: text (200) under the thank-you after a sign-up; FORM, or HERO with an event. */
thanksText?: string;
/** add-landing-page-polish: a short label (40) above the heading of FEATURES, STEPS, IMAGE_TEXT, FAQ and CTA. */
eyebrow?: string;
}
export type PageStatus = "DRAFT" | "PUBLISHED";
@@ -125,6 +129,8 @@ export function emptyBlock(type: BlockType): CmsBlock {
return { type, imageId: null, heading: "", html: "", imagePosition: "LEFT", buttonLabel: "", buttonUrl: "" };
case "FORM":
return { type, heading: "", eventUuid: null };
case "TICKETS":
return { type, heading: "", text: "", eventUuid: null };
case "HTML":
return { type, html: "" };
case "FEATURES":
@@ -135,6 +141,8 @@ export function emptyBlock(type: BlockType): CmsBlock {
return { type, cards: [{ title: "" }, { title: "" }] };
case "CTA":
return { type, heading: "", text: "", buttonLabel: "", buttonUrl: "" };
case "TOPBAR":
return { type, buttonLabel: "", buttonUrl: "" };
case "FOOTER":
return { type, look: "DARK", text: "", cards: [{ title: "", text: "" }, { title: "", text: "" }] };
default:
@@ -356,6 +356,7 @@ export const DEFAULT_MESSAGES: Record<string, string> = {
LeadSourceQr: "QR",
LeadSourceInvite: "Invite",
LeadSourceWeb: "Web page",
LeadSourceTicket: "Ticket",
LeadWebPage: "Web page: {path}",
LeadCampaign: "Campaign: {tags}",
LeadHot: "Hot",
@@ -883,6 +884,9 @@ export const DEFAULT_MESSAGES: Record<string, string> = {
PagesColumnN: "Column {number}",
PagesAddColumn: "Add column",
PagesFooterLegal: "Legal line",
PagesBlockTopBar: "Top bar",
PagesEyebrow: "Label",
PagesTopBarFirst: "The top bar must be the first section.",
PagesUploadImage: "Upload image",
PagesUploadImageHint: "PNG, JPEG or WebP up to 2 MB. Paste the link into your HTML, for example in an img tag's src.",
PagesToolbar: "Formatting",
@@ -933,4 +937,158 @@ export const DEFAULT_MESSAGES: Record<string, string> = {
CompAccent: "Accent colour",
CompAccentHint: "Used for buttons on this company's landing pages. Leave empty for the default blue.",
CompBrandingSaveFailed: "Could not save the branding.",
// add-event-ticket-orders
GuestHeldTickets: "Held tickets",
PagesTicketsClosed: "Choose an event that is selling tickets.",
TktTitle: "Tickets",
TktViewOrders: "View orders",
TktLoadFailed: "Could not load the tickets.",
TktSaveFailed: "Could not save. Try again.",
TktSettingsSaved: "Ticket settings saved.",
TktSellTickets: "Sell tickets",
TktPaymentInstructions: "Payment instructions",
TktPaymentInstructionsHelp: "Shown to buyers after they request tickets, e.g. the bank account and what reference to use.",
TktHoldDays: "Hold days",
TktSaveSettings: "Save ticket settings",
TktPrice: "Price",
TktPriceRm: "Price (RM)",
TktQuantity: "Quantity",
TktLeft: "Left",
TktSalesEnd: "Sales end",
TktSalesEndHelp: "An empty sales end date means sales end with the event.",
TktNoTypes: "No ticket types yet.",
TktFree: "Free",
TktDisable: "Disable",
TktEnable: "Enable",
TktDelete: "Delete",
TktTypeName: "Ticket name",
TktAddType: "Add ticket type",
TktSaveType: "Save ticket type",
TktDeleteTitle: "Delete ticket type",
TktDeleteMessage: "Delete {name}? This cannot be undone.",
TktErrInstructionsRequired: "Enter the payment instructions before turning tickets on.",
TktErrInstructionsTooLong: "Payment instructions can be at most 1000 characters.",
TktErrHoldDays: "Hold days must be from 1 to 14.",
TktErrName: "Enter a name of 1 to 80 characters.",
TktErrNameTaken: "This event already has a ticket type with this name.",
TktErrPrice: "Enter a price from 0.00 to 99999.99.",
TktErrQuantity: "Enter a quantity of at least 1.",
TktErrQuantityBelowHeld: "The quantity cannot be below the seats already held.",
TktErrDate: "Enter a valid date.",
TktErrTypeHasOrders: "This ticket type has orders. Disable it instead.",
TktErrNotPayable: "Only an order awaiting payment or expired can be marked paid.",
TktErrSeatsGone: "The seats of this expired order were taken. It cannot be marked paid.",
TktErrPaymentRef: "The payment reference can be at most 100 characters.",
TktErrNotCancellable: "Only an order awaiting payment or paid can be cancelled.",
TktErrLastTicket: "This is the order's last ticket. Cancel the order instead.",
TktStatusAWAITING: "Awaiting payment",
TktStatusPAID: "Paid",
TktStatusCANCELLED: "Cancelled",
TktStatusEXPIRED: "Expired",
TktOrdersTitle: "Ticket orders",
TktBackToEvent: "Back to event",
TktOrderState: "Order state",
TktSearchOrders: "Search orders",
TktSearchOrdersHint: "Reference, name, email or mobile",
TktReference: "Reference",
TktBuyer: "Buyer",
TktTickets: "Tickets",
TktTotal: "Total",
TktSalesEnded: "Sales ended",
TktSeatsLeft: "{count} left",
TktSoldOut: "Sold out",
TktRemoveOne: "Remove one {name}",
TktAddOne: "Add one {name}",
TktPreviewNote: "Visitors choose tickets and fill in their details here.",
TktSalesClosed: "Ticket sales are closed.",
TktChooseTickets: "Choose at least one ticket.",
TktEmailRequired: "Enter your email.",
TktConsentRequired: "Tick the box to agree to the privacy notice.",
TktMax: "Up to 10 tickets per order.",
TktRequest: "Request tickets",
TktThanksPlain: "Thank you. Your request for {event} is in.",
TktThanksPaid: "Your order {reference} is confirmed.",
TktThanks: "We have your order {reference}. It is held until you pay.",
TktViewOrder: "View your order",
TktHowToPay: "How to pay",
TktPayBy: "Pay by {when}",
TktPublicOrder: "Order {reference}",
TktPublicAwaiting: "Awaiting payment",
TktPublicPaid: "Paid. Your order is confirmed.",
TktPublicCancelled: "This order was cancelled.",
TktPublicExpired: "This order expired before payment arrived.",
TktOrderInvalid: "This order link is not valid.",
TktTicketInvalid: "This ticket link is not valid.",
TktTicketFor: "Ticket for {name}",
TktQrAlt: "Ticket QR code",
TktShowQr: "Show this QR code at the entrance.",
TktCheckedInAt: "Checked in at {when}",
TktNotValid: "This ticket is not valid",
TktReasonAWAITING: "awaiting payment",
TktReasonORDER_CANCELLED: "order cancelled",
TktReasonORDER_EXPIRED: "order expired",
TktReasonTICKET_CANCELLED: "ticket cancelled",
TktKeepUpdated: "Keep me updated about {company} events",
TktConsentSave: "Save",
TktConsentDone: "Thank you. We will keep you updated.",
TktStaffView: "Staff check-in",
TktStaffValid: "Valid",
TktAlreadyCheckedIn: "Already checked in at {when}",
TktNotValidReason: "Not valid: {reason}",
TktNotEventDay: "Check-in is only open on the event days.",
TktCheckIn: "Check in",
TktCheckedInNow: "Checked in.",
TktUnnamed: "No attendee named yet",
TktAttendeeName: "Attendee name",
TktContactRequired: "Enter a mobile number or an email.",
ChkShowTicket: "Please show your ticket at the entrance.",
GuestTicketsAwaiting: "Tickets awaiting payment",
GuestTicketsPaid: "Tickets paid",
GuestTicketsCheckedIn: "Tickets checked in",
TktErrTicketNotValid: "This ticket is not valid, so it cannot be sent.",
TktResendTicket: "Resend ticket",
TktTicketSent: "Ticket sent.",
TktYourTickets: "Your tickets",
TktNameAttendeesHelp: "Name each attendee so their ticket can be emailed to them, or share each ticket's link.",
TktAttendeeSaved: "Saved. The ticket has a new link; the old one no longer works.",
TktNotNamed: "Not named yet",
TktOpenTicket: "Open ticket",
TktCopyLink: "Copy link",
TktLinkCopied: "Link copied.",
TktNameAttendee: "Name attendee",
TktChangeAttendee: "Change attendee",
TktAttendeeRequired: "Enter the attendee's name and a mobile number or an email.",
TktPermissionRequired: "Tick the box to confirm you have permission.",
TktPermission: "I have permission to share these details so their ticket can be sent",
TktRenameWarning: "Saving gives this ticket a new link and QR code. The old ones stop working.",
TktSaveAttendee: "Save attendee",
PagesBlockTickets: "Tickets",
PagesTicketsEvent: "Event selling tickets",
PagesChooseTicketsEvent: "Choose an event with tickets on",
PagesTicketsEventHint: "Only events with tickets switched on are listed.",
TktCreated: "Created",
TktNoOrders: "No orders yet.",
TktOrderTitle: "Ticket order",
TktOrderNamed: "Order {reference}",
TktOrderNotFound: "Order not found.",
TktBackToOrders: "Back to orders",
TktActionFailed: "The action failed. Try again.",
TktHoldUntil: "Held until",
TktPaymentRef: "Payment reference",
TktPaidBy: "Marked paid by",
TktCancelledBy: "Cancelled by",
TktExpiredAt: "Expired",
TktResend: "Resend email",
TktEmailResent: "Email sent again.",
TktMarkPaid: "Mark paid",
TktMarkedPaid: "Order marked paid.",
TktCancelOrder: "Cancel order",
TktCancelOrderMessage: "Cancel this order and free its seats? The buyer gets an email.",
TktOrderCancelled: "Order cancelled.",
TktCancelTicket: "Cancel ticket",
TktCancelTicketMessage: "Cancel this ticket, free its seat and lower the order total?",
TktTicketCancelled: "Ticket cancelled.",
TktTicketType: "Ticket type",
TktTicketActive: "Active",
TktTicketCancelledBy: "Cancelled by {by}, {at}",
};
@@ -710,6 +710,7 @@
"MsgsConfirmImport": "确认导入",
"MsgsImportSummary": "已创建 {created} 条,已更新 {updated} 条,失败 {errors} 条。",
"LeadSourceWeb": "网页",
"LeadSourceTicket": "门票",
"LeadWebPage": "网页:{path}",
"LeadCampaign": "推广活动:{tags}",
"BO_PAGES": "网页",
@@ -868,6 +869,9 @@
"PagesColumnN": "第 {number} 栏",
"PagesAddColumn": "添加栏",
"PagesFooterLegal": "版权声明",
"PagesBlockTopBar": "顶栏",
"PagesEyebrow": "小标签",
"PagesTopBarFirst": "顶栏必须是第一个区块。",
"PagesUploadImage": "上传图片",
"PagesUploadImageHint": "PNG、JPEG 或 WebP,最大 2 MB。将链接粘贴到您的 HTML 中,例如 img 标签的 src。",
"PagesToolbar": "格式",
@@ -916,5 +920,158 @@
"CompLogo": "标志",
"CompAccent": "主题色",
"CompAccentHint": "用于本公司网页的按钮。留空则使用默认蓝色。",
"CompBrandingSaveFailed": "无法保存品牌设置。"
"CompBrandingSaveFailed": "无法保存品牌设置。",
"GuestHeldTickets": "已占门票",
"PagesTicketsClosed": "请选择正在售票的活动。",
"TktTitle": "门票",
"TktViewOrders": "查看订单",
"TktLoadFailed": "无法加载门票。",
"TktSaveFailed": "无法保存,请重试。",
"TktSettingsSaved": "门票设置已保存。",
"TktSellTickets": "售卖门票",
"TktPaymentInstructions": "付款说明",
"TktPaymentInstructionsHelp": "买家申请门票后显示,例如银行账户及付款备注。",
"TktHoldDays": "保留天数",
"TktSaveSettings": "保存门票设置",
"TktPrice": "价格",
"TktPriceRm": "价格(RM)",
"TktQuantity": "数量",
"TktLeft": "剩余",
"TktSalesEnd": "停售日期",
"TktSalesEndHelp": "停售日期留空表示随活动结束而停售。",
"TktNoTypes": "尚无门票类型。",
"TktFree": "免费",
"TktDisable": "停用",
"TktEnable": "启用",
"TktDelete": "删除",
"TktTypeName": "门票名称",
"TktAddType": "添加门票类型",
"TktSaveType": "保存门票类型",
"TktDeleteTitle": "删除门票类型",
"TktDeleteMessage": "删除 {name}?此操作无法撤销。",
"TktErrInstructionsRequired": "开启售票前请填写付款说明。",
"TktErrInstructionsTooLong": "付款说明最多 1000 个字符。",
"TktErrHoldDays": "保留天数须为 1 至 14。",
"TktErrName": "请输入 1 至 80 个字符的名称。",
"TktErrNameTaken": "本活动已有同名门票类型。",
"TktErrPrice": "请输入 0.00 至 99999.99 的价格。",
"TktErrQuantity": "数量至少为 1。",
"TktErrQuantityBelowHeld": "数量不能低于已占座位。",
"TktErrDate": "请输入有效日期。",
"TktErrTypeHasOrders": "此门票类型已有订单,请改为停用。",
"TktErrNotPayable": "只有待付款或已过期的订单可标记为已付款。",
"TktErrSeatsGone": "此过期订单的座位已被占用,无法标记为已付款。",
"TktErrPaymentRef": "付款参考最多 100 个字符。",
"TktErrNotCancellable": "只有待付款或已付款的订单可取消。",
"TktErrLastTicket": "这是订单的最后一张门票,请改为取消订单。",
"TktStatusAWAITING": "待付款",
"TktStatusPAID": "已付款",
"TktStatusCANCELLED": "已取消",
"TktStatusEXPIRED": "已过期",
"TktOrdersTitle": "门票订单",
"TktBackToEvent": "返回活动",
"TktOrderState": "订单状态",
"TktSearchOrders": "搜索订单",
"TktSearchOrdersHint": "编号、姓名、电邮或手机",
"TktReference": "编号",
"TktBuyer": "买家",
"TktTickets": "门票",
"TktTotal": "总额",
"TktSalesEnded": "已停售",
"TktSeatsLeft": "剩余 {count} 张",
"TktSoldOut": "已售罄",
"TktRemoveOne": "减少一张 {name}",
"TktAddOne": "增加一张 {name}",
"TktPreviewNote": "访客在此选择门票并填写资料。",
"TktSalesClosed": "门票销售已结束。",
"TktChooseTickets": "请至少选择一张门票。",
"TktEmailRequired": "请输入电子邮件。",
"TktConsentRequired": "请勾选以同意隐私声明。",
"TktMax": "每笔订单最多 10 张门票。",
"TktRequest": "申请门票",
"TktThanksPlain": "谢谢,您对 {event} 的申请已收到。",
"TktThanksPaid": "您的订单 {reference} 已确认。",
"TktThanks": "我们已收到您的订单 {reference},付款前为您保留。",
"TktViewOrder": "查看订单",
"TktHowToPay": "付款方式",
"TktPayBy": "请于 {when} 前付款",
"TktPublicOrder": "订单 {reference}",
"TktPublicAwaiting": "等待付款",
"TktPublicPaid": "已付款,订单已确认。",
"TktPublicCancelled": "此订单已取消。",
"TktPublicExpired": "此订单在收到付款前已过期。",
"TktOrderInvalid": "此订单链接无效。",
"TktTicketInvalid": "此门票链接无效。",
"TktTicketFor": "{name} 的门票",
"TktQrAlt": "门票二维码",
"TktShowQr": "请在入口出示此二维码。",
"TktCheckedInAt": "已于 {when} 签到",
"TktNotValid": "此门票无效",
"TktReasonAWAITING": "等待付款",
"TktReasonORDER_CANCELLED": "订单已取消",
"TktReasonORDER_EXPIRED": "订单已过期",
"TktReasonTICKET_CANCELLED": "门票已取消",
"TktKeepUpdated": "向我发送 {company} 的活动资讯",
"TktConsentSave": "保存",
"TktConsentDone": "谢谢,我们会向您发送最新资讯。",
"TktStaffView": "工作人员签到",
"TktStaffValid": "有效",
"TktAlreadyCheckedIn": "已于 {when} 签到过",
"TktNotValidReason": "无效:{reason}",
"TktNotEventDay": "仅在活动日开放签到。",
"TktCheckIn": "签到",
"TktCheckedInNow": "签到成功。",
"TktUnnamed": "尚未填写参加者",
"TktAttendeeName": "参加者姓名",
"TktContactRequired": "请输入手机号码或电子邮件。",
"ChkShowTicket": "请在入口出示您的门票。",
"GuestTicketsAwaiting": "待付款门票",
"GuestTicketsPaid": "已付款门票",
"GuestTicketsCheckedIn": "已签到门票",
"TktErrTicketNotValid": "此门票无效,无法发送。",
"TktResendTicket": "重新发送门票",
"TktTicketSent": "门票已发送。",
"TktYourTickets": "您的门票",
"TktNameAttendeesHelp": "填写每位参加者,以便通过电子邮件将门票发送给他们,或分享每张门票的链接。",
"TktAttendeeSaved": "已保存。门票已有新链接,旧链接已失效。",
"TktNotNamed": "尚未填写",
"TktOpenTicket": "打开门票",
"TktCopyLink": "复制链接",
"TktLinkCopied": "链接已复制。",
"TktNameAttendee": "填写参加者",
"TktChangeAttendee": "更改参加者",
"TktAttendeeRequired": "请输入参加者姓名,以及手机号码或电子邮件。",
"TktPermissionRequired": "请勾选以确认您已获得许可。",
"TktPermission": "我已获得许可分享这些资料,以便发送其门票",
"TktRenameWarning": "保存后此门票将获得新的链接和二维码,旧的将失效。",
"TktSaveAttendee": "保存参加者",
"PagesBlockTickets": "门票",
"PagesTicketsEvent": "售票活动",
"PagesChooseTicketsEvent": "选择已开启售票的活动",
"PagesTicketsEventHint": "仅列出已开启售票的活动。",
"TktCreated": "创建时间",
"TktNoOrders": "尚无订单。",
"TktOrderTitle": "门票订单",
"TktOrderNamed": "订单 {reference}",
"TktOrderNotFound": "找不到订单。",
"TktBackToOrders": "返回订单",
"TktActionFailed": "操作失败,请重试。",
"TktHoldUntil": "保留至",
"TktPaymentRef": "付款参考",
"TktPaidBy": "标记付款者",
"TktCancelledBy": "取消者",
"TktExpiredAt": "过期时间",
"TktResend": "重新发送电邮",
"TktEmailResent": "电邮已重新发送。",
"TktMarkPaid": "标记为已付款",
"TktMarkedPaid": "订单已标记为已付款。",
"TktCancelOrder": "取消订单",
"TktCancelOrderMessage": "取消此订单并释放座位?买家将收到电邮。",
"TktOrderCancelled": "订单已取消。",
"TktCancelTicket": "取消门票",
"TktCancelTicketMessage": "取消此门票、释放座位并降低订单总额?",
"TktTicketCancelled": "门票已取消。",
"TktTicketType": "门票类型",
"TktTicketActive": "有效",
"TktTicketCancelledBy": "{by} 于 {at} 取消"
}
@@ -48,14 +48,14 @@ describe("guardDecision", () => {
});
});
describe("visitor pages /r, /i, /c", () => {
describe("visitor pages /r, /i, /c, /o", () => {
it("pass signed out and with a reset pending; the bare prefixes and admin paths do not", () => {
const pending = { present: true, resetRequired: true };
for (const p of ["/r/x", "/i/x", "/c/x"]) {
for (const p of ["/r/x", "/i/x", "/c/x", "/o/x", "/t/x"]) {
expect(guardDecision(p, null), p).toBeNull();
expect(guardDecision(p, pending), p).toBeNull();
}
for (const p of ["/events", "/i", "/c/", "/i/", "/c/x/y"]) {
for (const p of ["/events", "/i", "/c/", "/i/", "/c/x/y", "/o/", "/o/x/y", "/t/", "/t/x/y"]) {
expect(guardDecision(p, null), p).toBe("/login");
expect(guardDecision(p, pending), p).toBe("/reset-password");
}
+3 -2
View File
@@ -8,9 +8,10 @@
// resetPasswordRequired); it is reached right after login, so it stays public.
export const PUBLIC_PATHS = new Set<string>(["/login", "/reset-password", "/forgot-password"]);
// Visitor pages, not signed in: /r/<token> QR self-registration, /i/<token> personal invite, /c/<token> event check-in.
// Visitor pages, not signed in: /r/<token> QR self-registration, /i/<token> personal invite, /c/<token> event check-in,
// /o/<token> a ticket order (add-event-ticket-orders), /t/<code> a ticket (add-event-tickets; staff also open it signed in).
// (A pattern, so PUBLIC_PATHS stays exact.)
const VISITOR_PATH = /^\/[ric]\/[^/]+$/;
const VISITOR_PATH = /^\/[ricot]\/[^/]+$/;
// Published landing pages: /p/<company-code>/<slug>.
const LANDING_PATH = /^\/p\/[^/]+\/[^/]+$/;
// add-custom-html-block: a published page's Custom HTML frame, /p/<company-code>/<slug>/frame/<block>.
@@ -8,13 +8,14 @@ describe("routeModules", () => {
expect(requiredModuleFor("/users")).toBe("BO_USERS");
expect(requiredModuleFor("/roles")).toBe("BO_ROLES");
expect(requiredModuleFor("/events")).toBe("BO_EVENTS");
expect(requiredModuleFor("/event-orders")).toBe("BO_EVENT_TICKETS");
expect(requiredModulesFor("/roles")).toEqual(["BO_ROLES"]);
});
it("leaves other routes ungated", () => {
expect(requiredModuleFor("/")).toBeUndefined();
expect(requiredModulesFor("/members")).toBeUndefined();
expect(Object.keys(ROUTE_MODULES).sort()).toEqual(["/audit-log", "/emails", "/event-leads", "/events", "/interests", "/leads", "/locales", "/login-security", "/messages", "/pages", "/roles", "/users", "/whatsapp"]);
expect(Object.keys(ROUTE_MODULES).sort()).toEqual(["/audit-log", "/emails", "/event-leads", "/event-orders", "/events", "/interests", "/leads", "/locales", "/login-security", "/messages", "/pages", "/roles", "/users", "/whatsapp"]);
expect(requiredModuleFor("/emails")).toBe("BO_EMAILS");
expect(requiredModuleFor("/leads")).toBe("BO_LEADS");
});
@@ -6,6 +6,8 @@ export const ROUTE_MODULES: Record<string, string> = {
"/users": "BO_USERS",
"/roles": "BO_ROLES",
"/events": "BO_EVENTS",
// add-event-ticket-orders: /events/[uuid]/orders and its order pages gate on this key.
"/event-orders": "BO_EVENT_TICKETS",
"/interests": "BO_INTERESTS",
"/event-leads": "BO_EVENT_LEADS",
"/pages": "BO_PAGES",
@@ -191,7 +191,7 @@ export interface BinaryPayload {
/** GET a binary upstream response (e.g. an xlsx export); failures use the same shape as callMobileApi. */
export async function callMobileApiBinary(
path: string,
opts: Pick<MobileCallOptions, "token" | "timeoutMs"> = {},
opts: Pick<MobileCallOptions, "token" | "timeoutMs" | "headers"> = {},
): Promise<ApiResult<BinaryPayload>> {
const up = await upstreamFetch(path, opts);
if ("fail" in up) return up.fail;
@@ -39,6 +39,12 @@ export interface Attendance {
registered: number;
attended: number;
walkIns: number;
/** add-event-ticket-orders: seats of awaiting and paid ticket orders; part of the total. */
heldTickets: number;
/** add-event-tickets: active tickets of awaiting and paid orders, and paid tickets checked in. */
ticketsAwaiting?: number;
ticketsPaid?: number;
ticketsCheckedIn?: number;
total: number;
capacity: number | null;
}
@@ -0,0 +1,112 @@
import { apiDelete, apiGet, apiPost, apiPut } from "@/app/lib/clientApi";
// add-event-ticket-orders: an event's ticket settings, ticket types and orders (BO_EVENT_TICKETS).
export interface TicketSettings {
ticketsEnabled: boolean;
paymentInstructions: string | null;
holdDays: number | null;
}
export interface TicketTypeInput {
name: string;
priceSen: number;
quantity: number;
salesEndDate: string | null;
sort: number;
enabled: boolean;
}
export interface TicketType extends TicketTypeInput {
id: number;
held: number;
left: number;
}
export type OrderStatus = "AWAITING" | "PAID" | "CANCELLED" | "EXPIRED";
export const ORDER_STATUSES: OrderStatus[] = ["AWAITING", "PAID", "CANCELLED", "EXPIRED"];
export interface OrderRow {
id: number;
reference: string;
buyerName: string;
buyerEmail: string;
tickets: number;
totalSen: number;
status: OrderStatus;
createdAt: string;
}
export interface OrderPage {
content: OrderRow[];
totalElements: number;
totalPages: number;
number: number;
size: number;
}
export interface OrderDetail {
order: {
id: number;
reference: string;
status: OrderStatus;
buyerName: string;
buyerEmail: string;
buyerMobileE164: string | null;
buyerCompany: string | null;
totalSen: number;
holdUntil: string | null;
paidAt: string | null;
paidBy: string | null;
paymentRef: string | null;
cancelledAt: string | null;
cancelledBy: string | null;
expiredAt: string | null;
createdAt: string;
};
lines: { id: number; name: string; unitPriceSen: number; quantity: number }[];
tickets: { id: number; typeName: string | null; status: "ACTIVE" | "CANCELLED"; cancelledAt: string | null; cancelledBy: string | null;
attendeeName?: string | null; checkedInAt?: string | null }[];
}
const base = (uuid: string) => `/api/events/${encodeURIComponent(uuid)}`;
export const getTicketSettings = (uuid: string) => apiGet<TicketSettings>(`${base(uuid)}/tickets/settings`);
export const saveTicketSettings = (uuid: string, s: TicketSettings) => apiPut<unknown>(`${base(uuid)}/tickets/settings`, s);
export const listTicketTypes = (uuid: string) => apiGet<TicketType[]>(`${base(uuid)}/ticket-types`);
export const saveTicketType = (uuid: string, t: TicketTypeInput, id?: number) =>
id == null ? apiPost<unknown>(`${base(uuid)}/ticket-types`, t) : apiPut<unknown>(`${base(uuid)}/ticket-types/${id}`, t);
export const deleteTicketType = (uuid: string, id: number) => apiDelete<unknown>(`${base(uuid)}/ticket-types/${id}`);
export const listOrders = (uuid: string, f: { status?: string; q?: string; page?: number }) => {
const p = new URLSearchParams();
if (f.status) p.set("status", f.status);
if (f.q) p.set("q", f.q);
p.set("page", String(f.page ?? 0));
return apiGet<OrderPage>(`${base(uuid)}/orders?${p}`);
};
export const getOrder = (uuid: string, id: string) => apiGet<OrderDetail>(`${base(uuid)}/orders/${encodeURIComponent(id)}`);
export const markOrderPaid = (uuid: string, id: string, paymentRef: string) =>
apiPost<unknown>(`${base(uuid)}/orders/${encodeURIComponent(id)}/paid`, { paymentRef });
export const cancelOrder = (uuid: string, id: string) => apiPost<unknown>(`${base(uuid)}/orders/${encodeURIComponent(id)}/cancel`);
export const cancelTicket = (uuid: string, id: string, ticketId: number) =>
apiPost<unknown>(`${base(uuid)}/orders/${encodeURIComponent(id)}/tickets/${ticketId}/cancel`);
export const resendTicket = (uuid: string, id: string, ticketId: number) =>
apiPost<unknown>(`${base(uuid)}/orders/${encodeURIComponent(id)}/tickets/${ticketId}/resend`);
export const resendOrderEmail = (uuid: string, id: string) => apiPost<unknown>(`${base(uuid)}/orders/${encodeURIComponent(id)}/resend`);
/** RM 1,000.00 from whole sen; RM 0 reads "Free" where a caller wants it. */
export const money = (sen: number) =>
`RM ${(sen / 100).toLocaleString("en-MY", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
/** The label for a refusal code from the ticket endpoints, else null (the caller shows its generic text). */
export const TICKET_ERRORS: Record<string, string> = {
PAYMENT_INSTRUCTIONS_REQUIRED: "TktErrInstructionsRequired",
PAYMENT_INSTRUCTIONS_TOO_LONG: "TktErrInstructionsTooLong",
HOLD_DAYS_INVALID: "TktErrHoldDays",
NAME_INVALID: "TktErrName",
NAME_TAKEN: "TktErrNameTaken",
PRICE_INVALID: "TktErrPrice",
QUANTITY_INVALID: "TktErrQuantity",
QUANTITY_BELOW_HELD: "TktErrQuantityBelowHeld",
TICKET_NOT_VALID: "TktErrTicketNotValid",
DATE_INVALID: "TktErrDate",
TYPE_HAS_ORDERS: "TktErrTypeHasOrders",
NOT_PAYABLE: "TktErrNotPayable",
SEATS_GONE: "TktErrSeatsGone",
PAYMENT_REF_TOO_LONG: "TktErrPaymentRef",
NOT_CANCELLABLE: "TktErrNotCancellable",
LAST_TICKET: "TktErrLastTicket",
};
@@ -15,5 +15,5 @@ export const submitInvite = (token: string, body: RegistrationBody) => publicCal
export const inviteCheckin = (token: string) => publicCall<{ firstName: string }>(`${invite(token)}/checkin`, post());
export const getCheckin = (token: string) => publicCall<CheckinState>(checkin(token));
export const lookupCheckin = (token: string, value: string) =>
publicCall<{ result: "CHECKED_IN"; firstName: string } | { result: "FORM" }>(`${checkin(token)}/lookup`, post({ value }));
publicCall<{ result: "CHECKED_IN"; firstName: string } | { result: "FORM" } | { result: "SHOW_TICKET" }>(`${checkin(token)}/lookup`, post({ value }));
export const registerWalkIn = (token: string, body: RegistrationBody) => publicCall<{ eventName: string }>(`${checkin(token)}/register`, post(body));
Loaded 100 of 181 files, more files were not shown because too many files have changed in this diff. Show more