feat: add per-event badge editor, pretix company import, smart guides
Badge Designer (admin): per-event WYSIWYG badge/PDF layout editor with mm canvas, text/QR/image elements, multi-select, Word+PowerPoint alignment, PowerPoint-style smart guides with snapping, Delete-key, preview and JSON views. Migration 20261015194531_badge_editor (badge_layouts + admin-only save/set-default/delete RPCs). Company import: migration 20261015200719_events_company adds events.company; the sidecar pretix sync now fetches the organizer display name and stores it (best-effort). Bindable on badges as Company/organizer. Tests: 15 SQL rollback assertions + 13 mocked browser tests. Docs synced.
This commit is contained in:
1 parent
3e2f8ff0ed
commit
ab25c102dc
16 files changed
+1914
-9
No files matched your search
@@ -1,5 +1,7 @@
|
||||
import { supabase } from './supabase';
|
||||
import type {
|
||||
BadgeElement,
|
||||
BadgeLayout,
|
||||
Checkin,
|
||||
Connection,
|
||||
Contact,
|
||||
@@ -215,6 +217,7 @@ export async function upsertEvent(
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
location?: string | null;
|
||||
company?: string | null;
|
||||
sessionize_endpoint?: string | null;
|
||||
pretix_organizer?: string | null;
|
||||
pretix_event_slug?: string | null;
|
||||
@@ -376,6 +379,45 @@ export async function resetRaffle(): Promise<void> {
|
||||
await rpc('reset_raffle', {});
|
||||
}
|
||||
|
||||
// ---- Badge editor (per-event WYSIWYG badge layout) --------------------------
|
||||
|
||||
/** All badge layouts for an event (default first, then by name). */
|
||||
export async function getBadgeLayouts(eventId: string): Promise<BadgeLayout[]> {
|
||||
const rows = await all<BadgeLayout>('badge_layouts');
|
||||
return rows
|
||||
.filter((r) => r.event_id === eventId)
|
||||
.sort((a, b) => Number(b.is_default) - Number(a.is_default) || a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
/** Insert or update a layout (matched on event_id + name). */
|
||||
export async function saveBadgeLayout(input: {
|
||||
event_id: string;
|
||||
name: string;
|
||||
page_width_mm: number;
|
||||
page_height_mm: number;
|
||||
elements: BadgeElement[];
|
||||
is_default: boolean;
|
||||
}): Promise<BadgeLayout> {
|
||||
return rpc<BadgeLayout>('save_badge_layout', {
|
||||
p_event_id: input.event_id,
|
||||
p_name: input.name,
|
||||
p_page_width_mm: input.page_width_mm,
|
||||
p_page_height_mm: input.page_height_mm,
|
||||
p_elements: input.elements,
|
||||
p_is_default: input.is_default,
|
||||
});
|
||||
}
|
||||
|
||||
/** Promote a layout to the event's default (demoting the previous one). */
|
||||
export async function setDefaultBadgeLayout(id: string): Promise<void> {
|
||||
await rpc('set_default_badge_layout', { p_id: id });
|
||||
}
|
||||
|
||||
/** Delete a layout (the sole default may not be removed). */
|
||||
export async function deleteBadgeLayout(id: string): Promise<void> {
|
||||
await rpc('delete_badge_layout', { p_id: id });
|
||||
}
|
||||
|
||||
// ---- Sessions: speakers, material, AI feedback -------------------------------
|
||||
|
||||
export async function setSessionSpeakers(sessionId: string, emails: string[]): Promise<void> {
|
||||
|
||||
Reference in new issue
Block a user