feat(events): "Create invoice" action on the event detail page

Add a bills-gated button that opens the bill editor pre-filled with the
event (eventId FK + name/date snapshot) and the linked customer (when
exactly one). BillEditorPage gains eventId state + query-param prefill +
sends eventId on create; backend validates eventId (already forwarded +
persisted). Reuses the editor — no empty drafts. Does not auto-pull hours.
This commit is contained in:
Luca
2026-06-03 00:07:00 +02:00
parent b378ad679f
commit a03146edc9
5 changed files with 46 additions and 0 deletions
+3
View File
@@ -240,6 +240,9 @@ const INVOICE_BODY_VALIDATORS = [
body('skontoDisabled').optional().isBoolean(),
// Inline event snapshot (migration 123). Mirrors quotes — kept
// optional because standalone invoices may not have an event yet.
// eventId links the invoice to a gallery event (FK) when created from
// the event detail page; persisted by createInvoice (event_id).
body('eventId').optional({ values: 'falsy' }).isInt({ min: 1 }),
body('eventName').optional({ values: 'falsy' }).isString().isLength({ max: 255 }),
body('eventDate').optional({ values: 'falsy' }).isISO8601(),
body('eventTimeStart').optional({ values: 'falsy' }).isString().isLength({ max: 8 }),