+ Bitte wähle deinen Beitrag für die gesamte Veranstaltung. +
+ + + +| Beitragsstufe: | +{{ feeLabel }} | +
| Teilnahmebeitrag: | {{ summaryAmount }} | diff --git a/app/Models/Event.php b/app/Models/Event.php index 68e6a4b..33b13eb 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -234,13 +234,20 @@ class Event extends InstancedModel * jede Anmeldung dieser Gruppe zu. Null, wenn für die Veranstaltung noch keine Gebühr hinterlegt ist -- * dann ist eine Kurzanmeldung nicht möglich, weil `participation_type` am Teilnehmer Pflicht ist. */ - public function firstParticipationTypeSlug() : ?string { + /** + * Die erste hinterlegte Teilnahmegruppe -- die Kurzanmeldung meldet immer in dieser an. + */ + public function firstParticipationFee() : ?EventParticipationFee { return collect([ $this->participationFee1, $this->participationFee2, $this->participationFee3, $this->participationFee4, - ])->first(fn ($participationFee) => $participationFee !== null)?->type; + ])->first(fn ($participationFee) => $participationFee !== null); + } + + public function firstParticipationTypeSlug() : ?string { + return $this->firstParticipationFee()?->type; } } diff --git a/app/RelationModels/EventParticipationFee.php b/app/RelationModels/EventParticipationFee.php index b21634f..6c25bf0 100644 --- a/app/RelationModels/EventParticipationFee.php +++ b/app/RelationModels/EventParticipationFee.php @@ -21,6 +21,27 @@ class EventParticipationFee extends CommonModel ]; + /** Beitragsstufen in Anzeigereihenfolge; die Schlüssel sind die Spaltensuffixe von `amount_*`. */ + public const array FEE_TYPE_LABELS = [ + 'standard' => 'Standardbeitrag', + 'reduced' => 'Reduzierter Beitrag', + 'solidarity' => 'Solidaritätsbeitrag', + ]; + + /** + * Die Beitragsstufen, die für diese Teilnahmegruppe tatsächlich hinterlegt sind. Den Standardbeitrag gibt es + * immer, reduzierter und Solidaritätsbeitrag sind optional. Nur für diese Stufen liefert + * `EventResource::calculateAmount()` einen Betrag. + * + * @return array