Event addons bookable

This commit is contained in:
2026-08-12 16:45:02 +02:00
parent e95de52768
commit 0ee952212b
25 changed files with 656 additions and 24 deletions
@@ -89,11 +89,32 @@ class SignUpCommand {
);
$this->persistParticipationOptions($response->participant, $participationOptionRows);
$this->persistAddons($response->participant);
$response->success = true;
return $response;
}
/**
* Speichert die gewählten Zusätze (Event-Addons) als Snapshot-Zeilen (Titel/Preis/Betrag) für die spätere
* Rechnung. Die Beträge sind bereits in der Controller-Auflösung (`resolveAddons`) berechnet, inkl. USt.
*/
private function persistAddons(\App\Models\EventParticipant $participant): void
{
foreach ($this->request->addonItems as $item) {
$participant->selectedAddons()->create([
'tenant' => $this->request->event->tenant,
'event_id' => $this->request->event->id,
'addon_key' => $item['key'],
'title' => $item['title'],
'price' => $item['price'] ?? 0,
'flat' => (bool)($item['flat'] ?? false),
'days' => $item['days'] ?? 0,
'amount' => $item['amount'] ?? 0,
]);
}
}
/**
* Validiert die Antworten gegen die am Event definierten Teilnahmeoptionen und erzeugt die zu speichernden
* Zeilen mit Label-Snapshots. Gibt null zurück, wenn eine Pflicht-Frage unbeantwortet oder eine Antwort
@@ -48,6 +48,8 @@ class SignUpRequest {
public array $paymentOptions = [],
/** Antworten auf die Teilnahmeoptionen: [ question_key => value ]. */
public array $participationOptions = [],
/** Aufgelöste Zusätze (Event-Addons): je Eintrag [ key, title, price, flat, days, amount ]. */
public array $addonItems = [],
) {
}
}