16 Commits
Author SHA1 Message Date
th.guenther b668c7e805 Bugfix für KSV-Listen 2026-09-10 11:56:24 +02:00
th.guenther ddfaab1501 Anschrift für Veranstaltungsort 2026-09-10 11:45:52 +02:00
th.guenther 70a57d10f5 Kurzanmeldungen 2026-09-10 11:11:20 +02:00
th.guenther 6301c342e4 Automatischer Zahlungsparser 2026-09-10 09:50:14 +02:00
th.guenther 025035190d User-Comfort im Zahlungsparser 2026-09-09 17:32:50 +02:00
th.guenther 651b6147bf Zahlungsparser 2026-09-09 16:55:08 +02:00
th.guenther ae13841699 Merge pull request 'Dev 4.8.1' (#16) from dev-4.8.1 into main
Reviewed-on: #16
2026-09-07 14:18:56 +02:00
th.guenther 91dca31c11 Prepared new version 2026-09-07 14:18:19 +02:00
th.guenther 40d5634764 Zahlungszwecke 2026-09-07 14:17:50 +02:00
th.guenther 350c8dd0d0 better handling payment purpose 2026-09-07 12:10:12 +02:00
th.guenther d07980dd1f Overview for refunds 2026-09-07 10:45:33 +02:00
th.guenther b9795f08f0 Besseres Handling Rückerstattungen 2026-09-06 20:11:50 +02:00
th.guenther e730d6db63 Korrektur Buchungstexte bei Auslagenerstattungen 2026-09-06 16:48:33 +02:00
th.guenther a6bddf9fa5 Merge pull request 'Dev 4.8.0' (#15) from dev-4.8.0 into main
Teili-Rechnungen
Teili-Rückerstattungen
EüR
2026-09-04 09:29:56 +02:00
th.guenther 749d8588da Prepared new versio 2026-09-04 09:28:13 +02:00
th.guenther 4bb64b0053 Code improvements 2026-09-04 09:27:48 +02:00
192 changed files with 40408 additions and 648 deletions
+29010
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -5,6 +5,7 @@ namespace App\Domains\Admin\Controllers;
use App\Models\AvailablePaymentMethod; use App\Models\AvailablePaymentMethod;
use App\Resources\AvailablePaymentMethodResource; use App\Resources\AvailablePaymentMethodResource;
use App\Scopes\CommonController; use App\Scopes\CommonController;
use App\ValueObjects\BankStatementRuleset;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -16,6 +17,10 @@ class TenantPaymentMethodsGetController extends CommonController
'paymentMethods' => AvailablePaymentMethod::all() 'paymentMethods' => AvailablePaymentMethod::all()
->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)), ->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)),
'saveEndpoint' => '/api/v1/admin/tenant/payment-methods', 'saveEndpoint' => '/api/v1/admin/tenant/payment-methods',
// Der app-weite Standard für das Kontoauszug-Format. Das Formular zeigt ihn als
// Vorbelegung an, damit erkennbar ist, wovon ein Override abweicht.
'statementRulesetDefault' => BankStatementRuleset::default()->toArray(),
'statementRulesetCharsets' => BankStatementRuleset::CHARSETS,
]); ]);
} }
} }
@@ -23,7 +23,7 @@ class UserDetailGetController extends CommonController
return response()->json([ return response()->json([
'user' => $userData, 'user' => $userData,
'isOwnUser' => auth()->id() === $user->id, 'isOwnUser' => currentUser()?->id === $user->id,
'isLvTenant' => $this->tenant->slug === 'lv', 'isLvTenant' => $this->tenant->slug === 'lv',
'userRoles' => UserRole::all()->map(fn($role) => ['slug' => $role->slug, 'name' => $role->name]), 'userRoles' => UserRole::all()->map(fn($role) => ['slug' => $role->slug, 'name' => $role->name]),
'localGroups' => $this->adminTenants->getActiveLocalGroups()->map(fn($t) => ['slug' => $t->slug, 'name' => $t->name]), 'localGroups' => $this->adminTenants->getActiveLocalGroups()->map(fn($t) => ['slug' => $t->slug, 'name' => $t->name]),
@@ -16,7 +16,7 @@ class UserToggleActiveController extends CommonController
$action = new ToggleUserActiveAction(new ToggleUserActiveRequest( $action = new ToggleUserActiveAction(new ToggleUserActiveRequest(
user: $user, user: $user,
currentUserId: auth()->id(), currentUserId: currentUser()?->id,
)); ));
$response = $action->execute(); $response = $action->execute();
@@ -17,7 +17,7 @@ class UserUpdateController extends CommonController
$action = new UpdateUserAction(new UpdateUserRequest( $action = new UpdateUserAction(new UpdateUserRequest(
user: $user, user: $user,
data: $request->all(), data: $request->all(),
isOwnUser: auth()->id() === $user->id, isOwnUser: currentUser()?->id === $user->id,
isLvTenant: $this->tenant->slug === 'lv', isLvTenant: $this->tenant->slug === 'lv',
)); ));
@@ -1,5 +1,6 @@
<script setup> <script setup>
import {computed, ref} from 'vue'; import {computed, ref} from 'vue';
import BankRulesetEditor from "../../../../Views/Components/BankRulesetEditor.vue";
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue"; import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
import TextEditor from "../../../../Views/Components/TextEditor.vue"; import TextEditor from "../../../../Views/Components/TextEditor.vue";
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue"; import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
@@ -102,6 +103,10 @@ async function save() {
<RichSelectBox v-if="option.type === 'icon'" v-model="form.configuration[option.name]" <RichSelectBox v-if="option.type === 'icon'" v-model="form.configuration[option.name]"
:options="PAYMENT_METHOD_ICONS" placeholder="Symbol wählen…"/> :options="PAYMENT_METHOD_ICONS" placeholder="Symbol wählen…"/>
<TextEditor v-else-if="option.type === 'richtext'" v-model="form.configuration[option.name]"/> <TextEditor v-else-if="option.type === 'richtext'" v-model="form.configuration[option.name]"/>
<BankRulesetEditor v-else-if="option.type === 'bank-ruleset'"
v-model="form.configuration[option.name]"
:defaults="data.statementRulesetDefault ?? {}"
:charsets="data.statementRulesetCharsets ?? undefined"/>
<input v-else type="text" v-model="form.configuration[option.name]" class="form-input"/> <input v-else type="text" v-model="form.configuration[option.name]" class="form-input"/>
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span> <span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
</td> </td>
@@ -25,7 +25,7 @@ class CreateEstimateAction {
if ($this->request->estimateId === 0) { if ($this->request->estimateId === 0) {
$estimate = CostUnitEstimate::create(array_merge([ $estimate = CostUnitEstimate::create(array_merge([
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'cost_unit_id' => $this->request->costUnit->id, 'cost_unit_id' => $this->request->costUnit->id,
'type' => $this->request->estimateType, 'type' => $this->request->estimateType,
'description' => $this->request->description, 'description' => $this->request->description,
@@ -33,7 +33,7 @@ class CreateEstimateAction {
} else { } else {
$estimate = CostUnitEstimate::find($this->request->estimateId); $estimate = CostUnitEstimate::find($this->request->estimateId);
$estimate->update(array_merge([ $estimate->update(array_merge([
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'cost_unit_id' => $this->request->costUnit->id, 'cost_unit_id' => $this->request->costUnit->id,
'type' => $this->request->estimateType, 'type' => $this->request->estimateType,
'description' => $this->request->description, 'description' => $this->request->description,
@@ -15,7 +15,7 @@ class CreateCostUnitCommand {
$response = new CreateCostUnitResponse(); $response = new CreateCostUnitResponse();
$costUnit = CostUnit::create([ $costUnit = CostUnit::create([
'name' => $this->request->name, 'name' => $this->request->name,
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'type' => $this->request->type, 'type' => $this->request->type,
'billing_deadline' => $this->request->billingDeadline, 'billing_deadline' => $this->request->billingDeadline,
'distance_allowance' => $this->request->distanceAllowance->getAmount(), 'distance_allowance' => $this->request->distanceAllowance->getAmount(),
@@ -93,7 +93,7 @@ class ExportController extends CommonController {
'amount' => $invoice->amount, 'amount' => $invoice->amount,
'recipient_name' => $invoice->contact_bank_owner, 'recipient_name' => $invoice->contact_bank_owner,
'recipient_iban' => $invoice->contact_bank_iban, 'recipient_iban' => $invoice->contact_bank_iban,
'payment_purpose' => $invoice->payment_purpose ?? 'Auslagenerstattung Rechnungsnummer ' . $invoice->invoice_number, 'payment_purpose' => $invoice->paymentPurposeText(),
]); ]);
} }
} }
@@ -89,12 +89,13 @@
<template> <template>
<table v-if="localData.invoices.length > 0" class="invoice-list-table"> <table v-if="localData.invoices.length > 0" class="invoice-list-table">
<tr> <tr>
<td colspan="6">{{props.data.costUnit.name}}</td> <td colspan="7">{{props.data.costUnit.name}}</td>
</tr> </tr>
<tr v-for="invoice in localData.invoices" :id="'invoice_' + invoice.id"> <tr v-for="invoice in localData.invoices" :id="'invoice_' + invoice.id">
<td>{{invoice.invoiceNumber}}</td> <td>{{invoice.invoiceNumber}}</td>
<td>{{invoice.invoiceType}}</td> <td>{{invoice.invoiceTypeShort}}</td>
<td style="max-width: 250px;">{{invoice.purpose}}</td>
<td> <td>
{{invoice.amount}} {{invoice.amount}}
</td> </td>
@@ -114,7 +115,7 @@
</tr> </tr>
<tr v-if="props.data.endpoint === 'approved'"> <tr v-if="props.data.endpoint === 'approved'">
<td colspan="5"></td> <td colspan="6"></td>
<td> <td>
<a style="font-size: 10pt;" class="link" @click="exportPayouts()">Genehmigte Abrechnungen exportieren</a> <a style="font-size: 10pt;" class="link" @click="exportPayouts()">Genehmigte Abrechnungen exportieren</a>
</td> </td>
@@ -13,7 +13,7 @@ class PersonalDataController extends CommonController
return redirect()->intended('/login'); return redirect()->intended('/login');
} }
$user = auth()->user(); $user = currentUser();
$data = $this->users->getPersonalData($user); $data = $this->users->getPersonalData($user);
$inertiaProvider = new InertiaProvider('Dashboard/PersonalData', [ $inertiaProvider = new InertiaProvider('Dashboard/PersonalData', [
@@ -12,7 +12,7 @@ class StorePersonalDataController extends CommonController
{ {
public function __invoke(Request $request): JsonResponse public function __invoke(Request $request): JsonResponse
{ {
$user = auth()->user(); $user = currentUser();
$actionRequest = new UpdatePersonalDataRequest( $actionRequest = new UpdatePersonalDataRequest(
user: $user, user: $user,
@@ -33,7 +33,7 @@ function navigateTo(url) {
</tr> </tr>
<tr> <tr>
<td> <td>
{{participation.event.postal_code}} {{participation.event.location}}<br /> {{participation.eventAddress}}<br />
</td> </td>
<td> <td>
<a class="link" :href="`/api/v1/event/participant/${participation.identifier}/ical`">In Kalender importieren</a> <a class="link" :href="`/api/v1/event/participant/${participation.identifier}/ical`">In Kalender importieren</a>
@@ -0,0 +1,142 @@
<?php
namespace App\Domains\Event\Actions\BookBankStatementPayments;
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentCommand;
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentRequest;
use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\EventPaymentModules\ReadsBankStatements;
use App\Models\EventParticipant;
use App\Models\PaymentMethod;
use App\Repositories\EventParticipantRepository;
use App\ValueObjects\Amount;
use App\ValueObjects\BankTransaction;
use Carbon\CarbonImmutable;
/**
* Bucht die in der Prüfansicht bestätigten Zahlungseingänge -- alle in einem Durchgang.
*
* Bewusst **ohne** umspannende Transaktion: Gebucht wird über {@see ParticipantPaymentCommand}, und der
* verschickt die Zahlungsmail gleich mit. Das Projekt kennt keine Queue, die Mails gehen also synchron
* raus; eine offene Transaktion über achtzig Mailversände wäre die schlechtere Wahl. Jede Zeile ist
* für sich vollständig, und das Wasserzeichen schützt sie gegen eine Wiederholung.
*/
class BookBankStatementPaymentsCommand
{
public function __construct(private readonly BookBankStatementPaymentsRequest $request)
{
}
public function execute(): BookBankStatementPaymentsResponse
{
$response = new BookBankStatementPaymentsResponse();
if ($this->request->bookings === []) {
$response->message = 'Es wurden keine Zahlungen zum Buchen ausgewählt.';
return $response;
}
$module = EventPaymentModuleRegistry::forSlug(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
$participants = new EventParticipantRepository();
foreach ($this->request->bookings as $booking) {
$participant = $participants->findInEventByIdentifier(
$this->request->event,
(string) ($booking['participantIdentifier'] ?? ''),
);
$transaction = $this->toTransaction($booking);
if ($participant === null || $transaction === null) {
$response->failed++;
continue;
}
// Zweite Prüfung, nicht bloß Gürtel und Hosenträger: In der Prüfansicht lässt sich eine
// Zeile von Hand einer anderen Person zuordnen, und deren Wasserzeichen hat der erste
// Durchlauf nie gesehen.
if ($this->isBeforeWatermark($participant, $transaction)) {
$response->skipped++;
continue;
}
if ($module instanceof ReadsBankStatements) {
$module->recordTransaction($participant, $transaction);
}
$participant->last_payment_date = $transaction->paymentDate;
$this->book($participant, $transaction->amount);
$response->booked++;
}
$response->success = true;
$response->message = $this->summaryMessage($response);
return $response;
}
/**
* Bucht den Betrag **zusätzlich** zum bereits Gezahlten.
*
* Die manuelle Erfassung setzt `amount_paid` absolut, weil dort jemand den Gesamtstand eintippt.
* Hier kommt eine einzelne Zahlung an -- eine zweite Rate darf die erste nicht überschreiben.
* Der {@see ParticipantPaymentCommand} speichert dabei die zuvor gesetzten Felder mit und schickt
* die passende Mail (bezahlt / fehlt noch / überzahlt).
*/
private function book(EventParticipant $participant, Amount $amount): void
{
$total = new Amount(
round(($participant->amount_paid?->getAmount() ?? 0.0) + $amount->getAmount(), 2),
'Euro',
);
new ParticipantPaymentCommand(new ParticipantPaymentRequest($participant, $total))->execute();
}
/** @param array<string, mixed> $booking */
private function toTransaction(array $booking): ?BankTransaction
{
$date = CarbonImmutable::createFromFormat('!Y-m-d', (string) ($booking['paymentDate'] ?? ''));
$amount = $booking['amount'] ?? null;
if ($date === false || !is_numeric($amount) || (float) $amount <= 0) {
return null;
}
return new BankTransaction(
paymentDate: $date,
amount: new Amount(round((float) $amount, 2), 'Euro'),
purpose: (string) ($booking['purpose'] ?? ''),
payerName: (string) ($booking['payerName'] ?? ''),
payerIban: (string) ($booking['payerIban'] ?? ''),
rowNumber: (int) ($booking['rowNumber'] ?? 0),
);
}
private function isBeforeWatermark(EventParticipant $participant, BankTransaction $transaction): bool
{
$watermark = $participant->last_payment_date;
return $watermark !== null && $transaction->paymentDate->startOfDay()->lt($watermark->startOfDay());
}
private function summaryMessage(BookBankStatementPaymentsResponse $response): string
{
$message = sprintf('%d Zahlungen wurden gebucht.', $response->booked);
if ($response->skipped > 0) {
$message .= sprintf(
' %d wurden übersprungen, weil sie älter sind als die zuletzt erfasste Zahlung der Person.',
$response->skipped,
);
}
if ($response->failed > 0) {
$message .= sprintf(' %d konnten nicht zugeordnet werden.', $response->failed);
}
return $message;
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Domains\Event\Actions\BookBankStatementPayments;
use App\Models\Event;
class BookBankStatementPaymentsRequest
{
/**
* @param array<int, array<string, mixed>> $bookings Je Eintrag die bestätigte Zeile der Prüfansicht:
* participantIdentifier, paymentDate, amount,
* payerName, payerIban, purpose.
*/
public function __construct(
public readonly Event $event,
public readonly array $bookings,
) {
}
}
@@ -0,0 +1,17 @@
<?php
namespace App\Domains\Event\Actions\BookBankStatementPayments;
class BookBankStatementPaymentsResponse
{
public bool $success = false;
public string $message = '';
public int $booked = 0;
/** Übersprungen, weil älter als die zuletzt erfasste Zahlung der Person. */
public int $skipped = 0;
/** Nicht verarbeitbar (unbekannte Anmeldung, unbrauchbarer Betrag). */
public int $failed = 0;
}
@@ -12,7 +12,8 @@ class CertificateOfConductionCheckCommand {
public function execute() : CertificateOfConductionCheckResponse { public function execute() : CertificateOfConductionCheckResponse {
$response = new CertificateOfConductionCheckResponse(); $response = new CertificateOfConductionCheckResponse();
$localGroup = str_replace('Stamm ', '', $this->request->participant->localGroup()->first()->name); // Der Stamm ist optional (die Kurzanmeldung erhebt ihn nicht, in der Verwaltung kann er entfernt werden).
$localGroup = str_replace('Stamm ', '', $this->request->participant->localGroup()->first()?->name ?? '');
$apiResponse = Http::acceptJson() $apiResponse = Http::acceptJson()
->asJson() ->asJson()
@@ -28,7 +28,7 @@ class CreateEventCommand {
} }
$tenant = app('tenant'); $tenant = currentTenant();
// Anlage als Ganzes: der Event-Teil der Rechnungsnummer wird unter der Sperre vergeben und muss // Anlage als Ganzes: der Event-Teil der Rechnungsnummer wird unter der Sperre vergeben und muss
// im selben Zug geschrieben werden, sonst könnten zwei gleichzeitige Anlagen denselben erhalten. // im selben Zug geschrieben werden, sonst könnten zwei gleichzeitige Anlagen denselben erhalten.
@@ -38,6 +38,8 @@ class CreateEventCommand {
'name' => $this->request->name, 'name' => $this->request->name,
'identifier' => Str::random(10), 'identifier' => Str::random(10),
'location' => $this->request->location, 'location' => $this->request->location,
'street' => $this->normalizeOptional($this->request->street),
'house_number' => $this->normalizeOptional($this->request->houseNumber),
'postal_code' => $this->request->postalCode, 'postal_code' => $this->request->postalCode,
'email' => $this->request->email, 'email' => $this->request->email,
'start_date' => $this->request->begin, 'start_date' => $this->request->begin,
@@ -91,12 +93,12 @@ class CreateEventCommand {
]); ]);
} }
if (app('tenant')->slug === 'lv') { if (currentTenant()->slug === 'lv') {
foreach(Tenant::where(['is_active_local_group' => true])->get() as $tenant) { foreach(Tenant::where(['is_active_local_group' => true])->get() as $tenant) {
EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => $tenant->id]); EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => $tenant->id]);
} }
} else { } else {
EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => app('tenant')->id]); EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => currentTenant()->id]);
} }
@@ -107,6 +109,17 @@ class CreateEventCommand {
return $response; return $response;
} }
/**
* Straße und Hausnummer sind optional. Ein leer gelassenes Eingabefeld liefert einen leeren String --
* gespeichert wird dafür `null`, damit „nicht angegeben" nur eine Darstellung hat.
*/
private function normalizeOptional(?string $value): ?string
{
$value = trim((string) $value);
return '' === $value ? null : $value;
}
/** /**
* Event-Teil der Rechnungsnummer, z.B. `WM-V-20260701`: Tenant-Präfix, Dokumentart „V" für * Event-Teil der Rechnungsnummer, z.B. `WM-V-20260701`: Tenant-Präfix, Dokumentart „V" für
* Veranstaltung, dann ohne Trenner Jahr, Monat des Beginns und die laufende Nummer der * Veranstaltung, dann ohne Trenner Jahr, Monat des Beginns und die laufende Nummer der
@@ -19,8 +19,10 @@ class CreateEventRequest {
public string $accountOwner; public string $accountOwner;
public string $accountIban; public string $accountIban;
public bool $payPerDay; public bool $payPerDay;
public ?string $street;
public ?string $houseNumber;
public function __construct(string $name, string $location, string $postalCode, string $email, DateTime $begin, DateTime $end, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $earlyBirdEndAmountIncrease, ParticipationFeeType $participationFeeType, string $accountOwner, string $accountIban, bool $payPerDay) { public function __construct(string $name, string $location, string $postalCode, string $email, DateTime $begin, DateTime $end, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $earlyBirdEndAmountIncrease, ParticipationFeeType $participationFeeType, string $accountOwner, string $accountIban, bool $payPerDay, ?string $street = null, ?string $houseNumber = null) {
$this->name = $name; $this->name = $name;
$this->location = $location; $this->location = $location;
$this->postalCode = $postalCode; $this->postalCode = $postalCode;
@@ -34,5 +36,7 @@ class CreateEventRequest {
$this->accountOwner = $accountOwner; $this->accountOwner = $accountOwner;
$this->accountIban = $accountIban; $this->accountIban = $accountIban;
$this->payPerDay = $payPerDay; $this->payPerDay = $payPerDay;
$this->street = $street;
$this->houseNumber = $houseNumber;
} }
} }
@@ -148,7 +148,9 @@ class CreateIncomeSurplusStatementCommand
$rows[] = [ $rows[] = [
'number' => (string) $invoice->invoice_number, 'number' => (string) $invoice->invoice_number,
'date' => $invoice->created_at?->format('d.m.Y') ?? '', 'date' => $invoice->created_at?->format('d.m.Y') ?? '',
'purpose' => $this->purpose($invoice->type_other, $invoice->comment), // Ohne die Anmerkung: dort steht, was die Kassenwart*in beim Korrigieren notiert hat,
// und das gehört auf den Beleg, nicht in den Zweck.
'purpose' => $invoice->purposeText(),
'amount' => Amount::fromString($invoice->amount), 'amount' => Amount::fromString($invoice->amount),
]; ];
} }
@@ -165,27 +167,6 @@ class CreateIncomeSurplusStatementCommand
return ['groups' => $groups, 'total' => $total]; return ['groups' => $groups, 'total' => $total];
} }
/**
* Wofür der Beleg steht.
*
* `type_other` trägt seit der Pflichtangabe "Was wurde eingekauft" zu jeder Abrechnung den Zweck,
* nicht mehr nur bei "Sonstige Kosten". Ältere Belege haben das Feld leer -- dann bleibt die
* Anmerkung, und fehlt auch die, bleibt die Zelle leer. Ein Platzhalter wie "--" würde in der
* Belegliste nur Platz kosten.
*/
private function purpose(?string $typeOther, ?string $comment): string
{
$parts = [];
foreach ([$typeOther, $comment] as $part) {
if (trim((string) $part) !== '') {
$parts[] = trim((string) $part);
}
}
return implode(' — ', $parts);
}
/** /**
* Ein Betrag in deutscher Schreibweise: Punkt als Tausender-, Komma als Dezimaltrennzeichen. * Ein Betrag in deutscher Schreibweise: Punkt als Tausender-, Komma als Dezimaltrennzeichen.
* *
@@ -13,18 +13,18 @@ class GenerateIcalCommand
$participant = $this->request->participant; $participant = $this->request->participant;
$event = $participant->event; $event = $participant->event;
$uid = $participant->identifier . '@' . app('tenant')->slug; $uid = $participant->identifier . '@' . currentTenant()->slug;
$dtStart = $event->start_date->format('Ymd'); $dtStart = $event->start_date->format('Ymd');
$dtEnd = $event->end_date->copy()->addDay()->format('Ymd'); $dtEnd = $event->end_date->copy()->addDay()->format('Ymd');
$now = now()->format('Ymd\THis\Z'); $now = now()->format('Ymd\THis\Z');
$summary = $this->escapeIcal($event->name); $summary = $this->escapeIcal($event->name);
$location = $this->escapeIcal(trim($event->postal_code . ' ' . $event->location)); $location = $this->escapeIcal($event->getFullAddress());
$description = $this->escapeIcal('Teilnahme als: ' . $participant->getOfficialName()); $description = $this->escapeIcal('Teilnahme als: ' . $participant->getOfficialName());
$icalContent = implode("\r\n", [ $icalContent = implode("\r\n", [
'BEGIN:VCALENDAR', 'BEGIN:VCALENDAR',
'VERSION:2.0', 'VERSION:2.0',
'PRODID:-//' . app('tenant')->name . '//Veranstaltungskalender//DE', 'PRODID:-//' . currentTenant()->name . '//Veranstaltungskalender//DE',
'CALSCALE:GREGORIAN', 'CALSCALE:GREGORIAN',
'METHOD:PUBLISH', 'METHOD:PUBLISH',
'BEGIN:VEVENT', 'BEGIN:VEVENT',
@@ -21,11 +21,11 @@ class GenerateIcalForDeadlineCommand {
$icalContent = implode("\r\n", [ $icalContent = implode("\r\n", [
'BEGIN:VCALENDAR', 'BEGIN:VCALENDAR',
'VERSION:2.0', 'VERSION:2.0',
'PRODID:-//' . app('tenant')->name . '//Veranstaltungskalender//DE', 'PRODID:-//' . currentTenant()->name . '//Veranstaltungskalender//DE',
'CALSCALE:GREGORIAN', 'CALSCALE:GREGORIAN',
'METHOD:PUBLISH', 'METHOD:PUBLISH',
'BEGIN:VEVENT', 'BEGIN:VEVENT',
'UID:payment-deadline-' . $event->identifier . '@' . app('tenant')->slug, 'UID:payment-deadline-' . $event->identifier . '@' . currentTenant()->slug,
'DTSTAMP:' . $now, 'DTSTAMP:' . $now,
'DTSTART;VALUE=DATE:' . $dtDate, 'DTSTART;VALUE=DATE:' . $dtDate,
'DTEND;VALUE=DATE:' . $dtDate, 'DTEND;VALUE=DATE:' . $dtDate,
@@ -0,0 +1,183 @@
<?php
namespace App\Domains\Event\Actions\ParseBankStatement;
use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\EventPaymentModules\ProvidesStatementRuleset;
use App\EventPaymentModules\ReadsBankStatements;
use App\Models\EventParticipant;
use App\Models\PaymentMethod;
use App\Providers\BankStatementParseProvider;
use App\Repositories\EventParticipantRepository;
use App\Support\BankStatementParseException;
use App\ValueObjects\BankStatementRuleset;
use App\ValueObjects\BankTransaction;
/**
* Liest einen hochgeladenen Kontoauszug und schlägt je Zahlungseingang eine Anmeldung vor.
*
* Hier wird nichts gebucht -- das Ergebnis ist die Prüfansicht, in der die Aktionsleitung die
* Vorschläge bestätigt, korrigiert oder verwirft. Erst der zweite Schritt schreibt.
*
* Der Ablauf ist zahlartneutral: Was ein verwertbarer Umsatz ist und zu wem er gehört, entscheidet
* das Zahlungsmodul über {@see ReadsBankStatements}.
*/
class ParseBankStatementCommand
{
/** 8 MB -- ein Jahresauszug bleibt weit darunter, alles darüber ist die falsche Datei. */
private const int MAX_BYTES = 8 * 1024 * 1024;
private const array ALLOWED_EXTENSIONS = ['csv', 'txt'];
public function __construct(private readonly ParseBankStatementRequest $request)
{
}
public function execute(): ParseBankStatementResponse
{
$response = new ParseBankStatementResponse();
$module = EventPaymentModuleRegistry::forSlug(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
if (!$module instanceof ReadsBankStatements) {
$response->message = 'Für die Überweisung ist kein Kontoauszug-Import eingerichtet.';
return $response;
}
$contents = $this->readFile($response);
if ($contents === null) {
return $response;
}
$ruleset = $module instanceof ProvidesStatementRuleset
? $module->statementRuleset($this->request->configuration)
: BankStatementRuleset::default();
try {
$transactions = new BankStatementParseProvider()->parse($contents, $ruleset);
} catch (BankStatementParseException $exception) {
$response->message = $exception->getMessage();
return $response;
}
$candidates = new EventParticipantRepository()->getForPaymentMatching($this->request->event);
foreach ($transactions as $transaction) {
if (!$module->isRelevantTransaction($transaction)) {
continue;
}
$match = $module->matchTransaction($transaction, $candidates);
// Vor der letzten erfassten Zahlung dieser Person: schon gebucht, oder aus einem Auszug,
// der bereits verarbeitet wurde. Gar nicht erst anzeigen.
if ($match !== null && $this->isBeforeWatermark($match->participant, $transaction)) {
$response->skippedOlderThanWatermark++;
continue;
}
$response->rows[] = $transaction->toArray() + [
'suggestedIdentifier' => $match?->participant->identifier,
'confidence' => $match?->confidence,
];
}
$response->participants = $candidates
->map(fn (EventParticipant $participant): array => $this->participantOption($participant))
->values()
->all();
$response->success = true;
$response->message = $this->summaryMessage($response);
return $response;
}
private function readFile(ParseBankStatementResponse $response): ?string
{
$file = $this->request->file;
if ($file === null || !$file->isValid()) {
$response->message = 'Es wurde keine Datei hochgeladen.';
return null;
}
if ($file->getSize() > self::MAX_BYTES) {
$response->message = 'Die Datei ist zu groß (maximal 8 MB).';
return null;
}
if (!in_array(strtolower($file->getClientOriginalExtension()), self::ALLOWED_EXTENSIONS, true)) {
$response->message = 'Bitte den CSV-Export der Bank hochladen (.csv).';
return null;
}
$contents = file_get_contents($file->getRealPath());
if ($contents === false || trim($contents) === '') {
$response->message = 'Die Datei ließ sich nicht lesen oder ist leer.';
return null;
}
return $contents;
}
private function isBeforeWatermark(EventParticipant $participant, BankTransaction $transaction): bool
{
$watermark = $participant->last_payment_date;
// Echt kleiner, nicht kleiner-gleich: Zwei Zahlungen am selben Tag sollen beide ankommen.
return $watermark !== null && $transaction->paymentDate->startOfDay()->lt($watermark->startOfDay());
}
/** @return array<string, mixed> */
private function participantOption(EventParticipant $participant): array
{
$amountLeft = clone $participant->amount;
if ($participant->amount_paid !== null) {
$amountLeft->subtractAmount($participant->amount_paid);
}
return [
'identifier' => $participant->identifier,
'name' => $participant->lastname . ', ' . $participant->firstname,
'amount' => $participant->amount?->toString(),
'amountPaid' => $participant->amount_paid?->toString(),
'amountOpen' => $amountLeft->toString(),
'isSettled' => round($amountLeft->getAmount(), 2) <= 0,
'lastPaymentDate' => $participant->last_payment_date?->format('d.m.Y'),
// Zahlt jemand, der sich abgemeldet hat, wird die Zahlung trotzdem erfasst -- danach
// steht aber eine Erstattung an. Die Prüfansicht weist darauf hin.
'isSignedOff' => $participant->unregistered_at !== null,
'signedOffAt' => $participant->unregistered_at?->format('d.m.Y'),
];
}
private function summaryMessage(ParseBankStatementResponse $response): string
{
if ($response->rows === []) {
return $response->skippedOlderThanWatermark > 0
? 'Alle Zahlungseingänge dieser Datei wurden bereits erfasst.'
: 'In der Datei sind keine Zahlungseingänge zu dieser Aktion enthalten.';
}
$assigned = count(array_filter($response->rows, static fn (array $row): bool => $row['suggestedIdentifier'] !== null));
$message = sprintf(
'%d Zahlungseingänge gelesen, %d davon konnten zugeordnet werden.',
count($response->rows),
$assigned,
);
if ($response->skippedOlderThanWatermark > 0) {
$message .= sprintf(' %d bereits erfasste Zahlungen wurden übersprungen.', $response->skippedOlderThanWatermark);
}
return $message;
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Domains\Event\Actions\ParseBankStatement;
use App\Models\Event;
use Illuminate\Http\UploadedFile;
class ParseBankStatementRequest
{
/**
* @param array<string, mixed> $configuration Tenant-Konfiguration der Überweisung. Wird hereingereicht
* statt hier geholt -- den DB-Zugriff macht der Controller
* über das Repository.
*/
public function __construct(
public readonly Event $event,
public readonly ?UploadedFile $file,
public readonly array $configuration = [],
) {
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Domains\Event\Actions\ParseBankStatement;
class ParseBankStatementResponse
{
public bool $success = false;
public string $message = '';
/**
* Eine Zeile je verwertbarem Umsatz, fertig für die Prüfansicht.
*
* @var array<int, array<string, mixed>>
*/
public array $rows = [];
/**
* Alle zuordenbaren Anmeldungen der Aktion für die Auswahlliste.
*
* @var array<int, array<string, mixed>>
*/
public array $participants = [];
/**
* Umsätze, die vor der zuletzt erfassten Zahlung der erkannten Person liegen. Sie erscheinen gar
* nicht erst in der Prüfansicht -- gezählt werden sie trotzdem, sonst bliebe unerklärt, warum
* eine Datei mit 40 Zeilen nur 12 Vorschläge ergibt.
*/
public int $skippedOlderThanWatermark = 0;
}
@@ -18,7 +18,7 @@ class SetParticipationFeesCommand {
$this->cleanBefore(); $this->cleanBefore();
$this->request->event->participationFee1()->associate(EventParticipationFee::create([ $this->request->event->participationFee1()->associate(EventParticipationFee::create([
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'type' => $this->request->participationFeeFirst['type'], 'type' => $this->request->participationFeeFirst['type'],
'name' => $this->request->participationFeeFirst['name'], 'name' => $this->request->participationFeeFirst['name'],
'description' => $this->request->participationFeeFirst['description'], 'description' => $this->request->participationFeeFirst['description'],
@@ -29,7 +29,7 @@ class SetParticipationFeesCommand {
if ($this->request->participationFeeSecond !== null) { if ($this->request->participationFeeSecond !== null) {
$this->request->event->participationFee2()->associate(EventParticipationFee::create([ $this->request->event->participationFee2()->associate(EventParticipationFee::create([
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'type' => $this->request->participationFeeSecond['type'], 'type' => $this->request->participationFeeSecond['type'],
'name' => $this->request->participationFeeSecond['name'], 'name' => $this->request->participationFeeSecond['name'],
'description' => $this->request->participationFeeSecond['description'], 'description' => $this->request->participationFeeSecond['description'],
@@ -41,7 +41,7 @@ class SetParticipationFeesCommand {
if ($this->request->participationFeeThird !== null) { if ($this->request->participationFeeThird !== null) {
$this->request->event->participationFee3()->associate(EventParticipationFee::create([ $this->request->event->participationFee3()->associate(EventParticipationFee::create([
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'type' => $this->request->participationFeeThird['type'], 'type' => $this->request->participationFeeThird['type'],
'name' => $this->request->participationFeeThird['name'], 'name' => $this->request->participationFeeThird['name'],
'description' => $this->request->participationFeeThird['description'], 'description' => $this->request->participationFeeThird['description'],
@@ -53,7 +53,7 @@ class SetParticipationFeesCommand {
if ($this->request->participationFeeFourth !== null) { if ($this->request->participationFeeFourth !== null) {
$this->request->event->participationFee4()->associate(EventParticipationFee::create([ $this->request->event->participationFee4()->associate(EventParticipationFee::create([
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'type' => $this->request->participationFeeFourth['type'], 'type' => $this->request->participationFeeFourth['type'],
'name' => $this->request->participationFeeFourth['name'], 'name' => $this->request->participationFeeFourth['name'],
'description' => $this->request->participationFeeFourth['description'], 'description' => $this->request->participationFeeFourth['description'],
@@ -64,7 +64,7 @@ class SetPaymentMethodsCommand
// Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen. // Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen.
if ($override !== null) { if ($override !== null) {
$row = $existing[$slug]; $row = $existing[$slug];
$row->configuration = PaymentMethod::sanitizeConfiguration($slug, $override); $row->configuration = $this->eventConfiguration($slug, $override);
$row->save(); $row->save();
} }
continue; continue;
@@ -75,8 +75,27 @@ class SetPaymentMethodsCommand
EventPaymentMethods::create([ EventPaymentMethods::create([
'event_id' => $event->id, 'event_id' => $event->id,
'slug' => $slug, 'slug' => $slug,
'configuration' => PaymentMethod::sanitizeConfiguration($slug, $snapshot ?? []), 'configuration' => $this->eventConfiguration($slug, $snapshot ?? []),
]); ]);
} }
} }
/**
* Was von einer Konfiguration am Event gespeichert wird.
*
* Neben dem Zuschnitt aufs Schema fallen hier die tenant-weiten Optionen heraus. Das
* Kontoauszug-Format etwa beschreibt die Bank, nicht die Zusage an die Teilnehmenden -- eingefroren
* ließe sich nach einem Bankwechsel für laufende Aktionen nichts mehr importieren. IBAN und
* Kontoinhaber frieren dagegen weiterhin pro Aktion ein.
*
* @param array<string, mixed> $configuration
* @return array<string, mixed>
*/
private function eventConfiguration(string $slug, array $configuration): array
{
return PaymentMethod::stripTenantScopedOptions(
$slug,
PaymentMethod::sanitizeConfiguration($slug, $configuration),
);
}
} }
@@ -0,0 +1,142 @@
<?php
namespace App\Domains\Event\Actions\ShortSignUp;
use App\Domains\Event\Actions\SignUp\SignUpCommand;
use App\Domains\Event\Actions\SignUp\SignUpRequest;
use App\ValueObjects\Age;
/**
* Verkürzte Anmeldung: ergänzt die nicht erhobenen Pflichtangaben um Platzhalter und übergibt an die reguläre
* Anmelde-Action. Dadurch gelten für Kurzanmeldungen dieselben Regeln wie für jede andere Anmeldung
* (Transaktion, laufende Rechnungsnummer, eFZ-Vorbelegung, Snapshot der Teilnahmeoptionen).
*/
class ShortSignUpCommand {
/** Platzhalter für Angaben, die die Kurzanmeldung nicht erhebt. */
private const string PLACEHOLDER = 'Nicht erforderlich';
/**
* Die Postleitzahl bekommt bewusst keinen Text-Platzhalter: aus ihr wird in Teilnehmerliste und CSV-Export
* das Bundesland abgeleitet.
*/
private const string PLACEHOLDER_POSTCODE = '00000';
public function __construct(public ShortSignUpRequest $request) {
}
public function execute() : ShortSignUpResponse {
$response = new ShortSignUpResponse();
// Ohne konfigurierte Teilnahmegruppe gäbe es keinen gültigen `participation_type` -- sauber abbrechen,
// statt in einen Fremdschlüssel-Fehler zu laufen.
$participationType = $this->request->event->firstParticipationTypeSlug();
if ($participationType === null) {
$response->message = 'Für diese Veranstaltung ist noch keine Teilnahmegruppe hinterlegt.';
return $response;
}
$participantAge = new Age($this->request->birthday);
// Bei Minderjährigen ist die Kontaktperson Pflicht; der Client prüft das ebenfalls, verlassen wird sich
// darauf nicht.
if (!$participantAge->isfullAged()
&& ($this->request->contactPerson === null || $this->request->contactEmail === null)) {
$response->message = 'Für Minderjährige werden Name und E-Mail-Adresse einer Kontaktperson benötigt.';
return $response;
}
// Stamm: bei genau einem teilnehmenden Stamm wird dieser gesetzt, bei mehreren muss gewählt werden,
// ohne teilnehmende Stämme bleibt die Zuordnung leer.
$localGroups = $this->request->event->localGroups;
$localGroup = null;
if ($localGroups->count() === 1) {
$localGroup = $localGroups->first();
} elseif ($localGroups->count() > 1) {
$localGroup = $localGroups->firstWhere('id', $this->request->localGroupId);
if ($localGroup === null) {
$response->message = 'Bitte einen Stamm auswählen.';
return $response;
}
}
$eventResource = $this->request->event->toResource();
// Zeitraum, Gruppe und Beitragsstufe stehen bei der Kurzanmeldung fest -- es gibt nichts zu wählen.
$amount = $eventResource->calculateAmount(
$participationType,
'standard',
$this->request->event->start_date,
$this->request->event->end_date,
false
);
$signUpRequest = new SignUpRequest(
event: $this->request->event,
user_id: $this->request->user_id,
firstname: $this->request->firstname,
lastname: $this->request->lastname,
nickname: $this->request->nickname,
participationType: $participationType,
localGroup: $localGroup,
birthday: $this->request->birthday,
address_1: self::PLACEHOLDER,
address_2: null,
postcode: self::PLACEHOLDER_POSTCODE,
city: self::PLACEHOLDER,
email_1: $this->request->email,
phone_1: $this->request->phone,
email_2: $this->request->contactEmail,
phone_2: null,
contact_person: $this->request->contactPerson,
allergies: $this->request->allergies,
intolerances: $this->request->intolerances,
medications: null,
tetanus_vaccination: null,
// Kein Wert der Zuordnung -- der SignUpCommand fällt damit auf "Omnivor" zurück.
eating_habit: '',
swimming_permission: $this->resolveSwimmingPermission($participantAge),
first_aid_permission: $participantAge->isfullAged() ? '-1' : ($this->request->firstAidPermission ?? '-1'),
foto_socialmedia: $this->request->foto_socialmedia,
foto_print: $this->request->foto_print,
foto_webseite: $this->request->foto_webseite,
foto_partner: $this->request->foto_partner,
foto_intern: $this->request->foto_intern,
arrival: $this->request->event->start_date,
departure: $this->request->event->end_date,
arrival_eating: 1,
departure_eating: 2,
notes: null,
amount: $amount,
paymentMethod: $this->request->paymentMethod,
paymentOptions: $this->request->paymentOptions,
participationOptions: $this->request->participationOptions,
addonItems: [],
feeType: 'standard',
siblingReduction: false,
);
$signUpResponse = new SignUpCommand($signUpRequest)->execute();
$response->success = $signUpResponse->success;
$response->participant = $signUpResponse->participant;
$response->message = $signUpResponse->message;
return $response;
}
/**
* Bei Volljährigen und wenn die Veranstaltung die Badeerlaubnis nicht abfragt, entscheidet der SignUpCommand
* (volljährig => erteilt, nicht abgefragt => keine). Nur die getroffene Auswahl Minderjähriger wird
* durchgereicht.
*/
private function resolveSwimmingPermission(Age $participantAge) : ?string
{
if ($participantAge->isfullAged() || !$this->request->event->swimming_permission_required) {
return null;
}
return $this->request->swimmingPermission;
}
}
@@ -0,0 +1,47 @@
<?php
namespace App\Domains\Event\Actions\ShortSignUp;
use App\Models\Event;
use DateTime;
/**
* Eingabedaten der verkürzten Anmeldung -- ausschließlich das, was der Kurz-Wizard tatsächlich erhebt.
* Alle übrigen Pflichtangaben des Teilnehmers setzt der Command auf Platzhalter.
*/
class ShortSignUpRequest {
function __construct(
public Event $event,
public ?int $user_id,
public string $firstname,
public string $lastname,
public ?string $nickname,
public DateTime $birthday,
public string $email,
public string $phone,
/**
* Tenant-ID des Stamms. Nur gefüllt, wenn die Veranstaltung mehrere teilnehmende Stämme hat --
* bei genau einem wird dieser gesetzt, ohne zu fragen.
*/
public ?int $localGroupId,
/** Kontaktperson: nur bei Minderjährigen erhoben. */
public ?string $contactPerson,
public ?string $contactEmail,
public ?string $allergies,
public ?string $intolerances,
/** Slug aus `first_aid_permissions`; nur bei Minderjährigen erhoben. */
public ?string $firstAidPermission,
/** Slug aus `swimming_permissions`; nur bei Minderjährigen und nur wenn die Veranstaltung sie abfragt. */
public ?string $swimmingPermission,
public bool $foto_socialmedia,
public bool $foto_print,
public bool $foto_webseite,
public bool $foto_partner,
public bool $foto_intern,
public ?string $paymentMethod,
public array $paymentOptions = [],
/** Antworten auf die Teilnahmeoptionen: [ question_key => value ]. */
public array $participationOptions = [],
) {
}
}
@@ -0,0 +1,17 @@
<?php
namespace App\Domains\Event\Actions\ShortSignUp;
use App\Models\EventParticipant;
class ShortSignUpResponse {
public bool $success;
public ?EventParticipant $participant;
public ?string $message = null;
public function __construct() {
$this->success = false;
$this->participant = null;
}
}
@@ -4,6 +4,7 @@ namespace App\Domains\Event\Actions\SignUp;
use App\Enumerations\EatingHabit; use App\Enumerations\EatingHabit;
use App\Enumerations\EfzStatus; use App\Enumerations\EfzStatus;
use App\Enumerations\SwimmingPermission;
use App\EventPaymentModules\EventPaymentModuleRegistry; use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\ValueObjects\Age; use App\ValueObjects\Age;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@@ -59,7 +60,7 @@ class SignUpCommand {
'participation_type' => $this->request->participationType, 'participation_type' => $this->request->participationType,
'fee_type' => $this->request->feeType, 'fee_type' => $this->request->feeType,
'sibling_reduction' => $this->request->siblingReduction, 'sibling_reduction' => $this->request->siblingReduction,
'local_group' => $this->request->localGroup->slug, 'local_group' => $this->request->localGroup?->slug,
'birthday' => $this->request->birthday, 'birthday' => $this->request->birthday,
'address_1' => $this->request->address_1, 'address_1' => $this->request->address_1,
'address_2' => $this->request->address_2, 'address_2' => $this->request->address_2,
@@ -75,9 +76,7 @@ class SignUpCommand {
'medications' => $this->request->medications, 'medications' => $this->request->medications,
'tetanus_vaccination' => $this->request->tetanus_vaccination, 'tetanus_vaccination' => $this->request->tetanus_vaccination,
'eating_habit' => $eatingHabit, 'eating_habit' => $eatingHabit,
'swimming_permission' => ($participantAge->isfullAged() || $this->request->swimming_permission === '-1') 'swimming_permission' => $this->resolveSwimmingPermission($participantAge),
? 'SWIMMING_PERMISSION_ALLOWED'
: $this->request->swimming_permission,
'first_aid_permission' => ($participantAge->isfullAged() || $this->request->first_aid_permission === '-1') 'first_aid_permission' => ($participantAge->isfullAged() || $this->request->first_aid_permission === '-1')
? 'FIRST_AID_PERMISSION_ALLOWED' ? 'FIRST_AID_PERMISSION_ALLOWED'
: $this->request->first_aid_permission, : $this->request->first_aid_permission,
@@ -109,6 +108,26 @@ class SignUpCommand {
return $response; return $response;
} }
/**
* Badeerlaubnis auflösen. Volljährige brauchen keine Erlaubnis. Für Minderjährige gilt die getroffene Auswahl;
* fehlt sie -- weil die Veranstaltung die Badeerlaubnis gar nicht abfragt oder keine Wahl getroffen wurde --,
* wird bewusst "Keine" hinterlegt und nicht etwa stillschweigend eine Erlaubnis angenommen.
*/
private function resolveSwimmingPermission(Age $participantAge): string
{
if ($participantAge->isfullAged()) {
return SwimmingPermission::SWIMMING_PERMISSION_ALLOWED;
}
if (!$this->request->event->swimming_permission_required
|| $this->request->swimming_permission === null
|| $this->request->swimming_permission === '-1') {
return SwimmingPermission::SWIMMING_PERMISSION_DENIED;
}
return $this->request->swimming_permission;
}
/** /**
* Nächste laufende Nummer des Teilis innerhalb der Veranstaltung -- der letzte Block der * Nächste laufende Nummer des Teilis innerhalb der Veranstaltung -- der letzte Block der
* Rechnungsnummer. Die Event-Zeile wird gesperrt, damit gleichzeitige Anmeldungen derselben * Rechnungsnummer. Die Event-Zeile wird gesperrt, damit gleichzeitige Anmeldungen derselben
@@ -15,7 +15,8 @@ class SignUpRequest {
public string $lastname, public string $lastname,
public ?string $nickname, public ?string $nickname,
public string $participationType, public string $participationType,
public Tenant $localGroup, /** Stamm des Teilnehmers; in der Kurzanmeldung nicht erhoben und deshalb optional. */
public ?Tenant $localGroup,
public DateTime $birthday, public DateTime $birthday,
public string $address_1, public string $address_1,
public ?string $address_2, public ?string $address_2,
@@ -13,6 +13,8 @@ class UpdateEventCommand {
$this->request->event->name = $this->request->eventName; $this->request->event->name = $this->request->eventName;
$this->request->event->location = $this->request->eventLocation; $this->request->event->location = $this->request->eventLocation;
$this->request->event->street = $this->normalizeOptional($this->request->street);
$this->request->event->house_number = $this->normalizeOptional($this->request->houseNumber);
$this->request->event->postal_code = $this->request->postalCode; $this->request->event->postal_code = $this->request->postalCode;
$this->request->event->email = $this->request->email; $this->request->event->email = $this->request->email;
$this->request->event->early_bird_end = $this->request->earlyBirdEnd; $this->request->event->early_bird_end = $this->request->earlyBirdEnd;
@@ -22,6 +24,8 @@ class UpdateEventCommand {
$this->request->event->support_flat = $this->request->flatSupport; $this->request->event->support_flat = $this->request->flatSupport;
$this->request->event->send_weekly_report = $this->request->sendWeeklyReports; $this->request->event->send_weekly_report = $this->request->sendWeeklyReports;
$this->request->event->registration_allowed = $this->request->registrationAllowed; $this->request->event->registration_allowed = $this->request->registrationAllowed;
$this->request->event->short_registration = $this->request->shortRegistration;
$this->request->event->swimming_permission_required = $this->request->swimmingPermissionRequired;
$this->request->event->save(); $this->request->event->save();
$this->request->event->resetAllowedEatingHabits(); $this->request->event->resetAllowedEatingHabits();
@@ -40,4 +44,15 @@ class UpdateEventCommand {
return $response; return $response;
} }
/**
* Straße und Hausnummer sind optional. Ein geleertes Eingabefeld liefert einen leeren String --
* gespeichert wird dafür `null`, damit „nicht angegeben" nur eine Darstellung hat.
*/
private function normalizeOptional(?string $value): ?string
{
$value = trim((string) $value);
return '' === $value ? null : $value;
}
} }
@@ -10,6 +10,8 @@ class UpdateEventRequest {
public Event $event; public Event $event;
public string $eventName; public string $eventName;
public string $eventLocation; public string $eventLocation;
public ?string $street;
public ?string $houseNumber;
public string $postalCode; public string $postalCode;
public string $email; public string $email;
public DateTime $earlyBirdEnd; public DateTime $earlyBirdEnd;
@@ -17,16 +19,20 @@ class UpdateEventRequest {
public int $alcoholicsAge; public int $alcoholicsAge;
public bool $sendWeeklyReports; public bool $sendWeeklyReports;
public bool $registrationAllowed; public bool $registrationAllowed;
public bool $shortRegistration;
public bool $swimmingPermissionRequired;
public Amount $flatSupport; public Amount $flatSupport;
public Amount $supportPerPerson; public Amount $supportPerPerson;
public array $contributingLocalGroups; public array $contributingLocalGroups;
public array $eatingHabits; public array $eatingHabits;
public function __construct(Event $event, string $eventName, string $eventLocation, string $postalCode, string $email, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $alcoholicsAge, bool $sendWeeklyReports, bool $registrationAllowed, Amount $flatSupport, Amount $supportPerPerson, array $contributingLocalGroups, array $eatingHabits) public function __construct(Event $event, string $eventName, string $eventLocation, string $postalCode, string $email, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $alcoholicsAge, bool $sendWeeklyReports, bool $registrationAllowed, Amount $flatSupport, Amount $supportPerPerson, array $contributingLocalGroups, array $eatingHabits, bool $shortRegistration = false, bool $swimmingPermissionRequired = true, ?string $street = null, ?string $houseNumber = null)
{ {
$this->event = $event; $this->event = $event;
$this->eventName = $eventName; $this->eventName = $eventName;
$this->eventLocation = $eventLocation; $this->eventLocation = $eventLocation;
$this->street = $street;
$this->houseNumber = $houseNumber;
$this->postalCode = $postalCode; $this->postalCode = $postalCode;
$this->email = $email; $this->email = $email;
$this->earlyBirdEnd = $earlyBirdEnd; $this->earlyBirdEnd = $earlyBirdEnd;
@@ -34,6 +40,8 @@ class UpdateEventRequest {
$this->alcoholicsAge = $alcoholicsAge; $this->alcoholicsAge = $alcoholicsAge;
$this->sendWeeklyReports = $sendWeeklyReports; $this->sendWeeklyReports = $sendWeeklyReports;
$this->registrationAllowed = $registrationAllowed; $this->registrationAllowed = $registrationAllowed;
$this->shortRegistration = $shortRegistration;
$this->swimmingPermissionRequired = $swimmingPermissionRequired;
$this->flatSupport = $flatSupport; $this->flatSupport = $flatSupport;
$this->supportPerPerson = $supportPerPerson; $this->supportPerPerson = $supportPerPerson;
$this->contributingLocalGroups = $contributingLocalGroups; $this->contributingLocalGroups = $contributingLocalGroups;
@@ -31,7 +31,8 @@ class UpdateParticipantCommand {
$p->address_2 = $this->request->address_2; $p->address_2 = $this->request->address_2;
$p->postcode = $this->request->postcode; $p->postcode = $this->request->postcode;
$p->city = $this->request->city; $p->city = $this->request->city;
$p->local_group = $this->request->localgroup; // Leerer String würde als Fremdschlüssel scheitern -- kein Stamm heißt null.
$p->local_group = $this->request->localgroup ?: null;
$p->birthday = DateTime::createFromFormat('Y-m-d', $this->request->birthday); $p->birthday = DateTime::createFromFormat('Y-m-d', $this->request->birthday);
$p->email_1 = $this->request->email_1; $p->email_1 = $this->request->email_1;
$p->phone_1 = $this->request->phone_1; $p->phone_1 = $this->request->phone_1;
@@ -14,7 +14,8 @@ class UpdateParticipantRequest {
public ?string $address_2, public ?string $address_2,
public string $postcode, public string $postcode,
public string $city, public string $city,
public string $localgroup, /** Stamm-Slug; leer/null bei Anmeldungen, die keinen Stamm erfasst haben (Kurzanmeldung). */
public ?string $localgroup,
public string $birthday, public string $birthday,
public string $email_1, public string $email_1,
public string $phone_1, public string $phone_1,
@@ -17,6 +17,7 @@ class ArchivedEventsController extends CommonController
'name' => $event->name, 'name' => $event->name,
'location' => $event->location, 'location' => $event->location,
'postalCode' => $event->postal_code, 'postalCode' => $event->postal_code,
'fullAddress' => $event->getFullAddress(),
'eventBegin' => $event->start_date->format('d.m.Y'), 'eventBegin' => $event->start_date->format('d.m.Y'),
'eventEnd' => $event->end_date->format('d.m.Y'), 'eventEnd' => $event->end_date->format('d.m.Y'),
]; ];
@@ -0,0 +1,37 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\BookBankStatementPayments\BookBankStatementPaymentsCommand;
use App\Domains\Event\Actions\BookBankStatementPayments\BookBankStatementPaymentsRequest;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
/**
* Bucht die in der Prüfansicht bestätigten Zahlungseingänge -- ein Aufruf für alle Zeilen.
*/
class BankStatementBookController extends CommonController
{
public function __invoke(int $eventId, Request $request): JsonResponse
{
$event = $this->events->getById($eventId);
if ($event === null) {
return response()->json(['status' => 'error', 'message' => 'Die Veranstaltung wurde nicht gefunden.']);
}
$response = new BookBankStatementPaymentsCommand(new BookBankStatementPaymentsRequest(
event: $event,
bookings: (array) $request->input('bookings', []),
))->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->message,
'booked' => $response->booked,
'skipped' => $response->skipped,
'failed' => $response->failed,
]);
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\ParseBankStatement\ParseBankStatementCommand;
use App\Domains\Event\Actions\ParseBankStatement\ParseBankStatementRequest;
use App\Models\PaymentMethod;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
/**
* Nimmt den CSV-Export der Bank entgegen und liefert die Prüfansicht zurück. Gebucht wird hier nichts.
*/
class BankStatementParseController extends CommonController
{
public function __invoke(int $eventId, Request $request): JsonResponse
{
$event = $this->events->getById($eventId);
if ($event === null) {
return response()->json(['status' => 'error', 'message' => 'Die Veranstaltung wurde nicht gefunden.']);
}
// Das Kontoauszug-Format kommt vom Mandanten, nicht aus dem Event-Snapshot: Ein Bankwechsel
// muss sofort auch für laufende Aktionen gelten.
$configuration = $this->paymentMethods->tenantConfiguration(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
$response = new ParseBankStatementCommand(new ParseBankStatementRequest(
event: $event,
file: $request->file('statement'),
configuration: $configuration,
))->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->message,
'rows' => $response->rows,
'participants' => $response->participants,
'skipped' => $response->skippedOlderThanWatermark,
]);
}
}
@@ -21,7 +21,7 @@ use Illuminate\Http\Request;
class CreateController extends CommonController { class CreateController extends CommonController {
public function __invoke() { public function __invoke() {
return new InertiaProvider('Event/Create', [ return new InertiaProvider('Event/Create', [
'emailAddress' => auth()->user()->email, 'emailAddress' => currentUserOrFail()->email,
'eventAccount' => $this->tenant->account_name, 'eventAccount' => $this->tenant->account_name,
'eventIban' => $this->tenant->account_iban, 'eventIban' => $this->tenant->account_iban,
'eventPayPerDay' => $this->tenant->slug === 'lv' ? true : false, 'eventPayPerDay' => $this->tenant->slug === 'lv' ? true : false,
@@ -56,7 +56,9 @@ class CreateController extends CommonController {
$participationFeeType, $participationFeeType,
$request->input('eventAccount'), $request->input('eventAccount'),
$request->input('eventIban'), $request->input('eventIban'),
$payPerDay $payPerDay,
$request->input('eventStreet'),
$request->input('eventHouseNumber')
); );
$wasSuccessful = false; $wasSuccessful = false;
@@ -60,7 +60,11 @@ class DetailsController extends CommonController {
$flatSupport, $flatSupport,
$supportPerPerson, $supportPerPerson,
$contributinLocalGroups, $contributinLocalGroups,
$eatingHabits $eatingHabits,
(bool)$request->input('shortRegistration', false),
(bool)$request->input('swimmingPermissionRequired', true),
$request->input('street'),
$request->input('houseNumber'),
); );
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest); $eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
@@ -38,7 +38,7 @@ class SendController extends CommonController
} }
} }
$user = auth()->user(); $user = currentUser();
$reportSubject = sprintf('Sendebericht für Nachricht mit Betreff "%s"', $subject); $reportSubject = sprintf('Sendebericht für Nachricht mit Betreff "%s"', $subject);
Mail::to($user->email)->send(new ManualMailsReportMail( Mail::to($user->email)->send(new ManualMailsReportMail(
@@ -0,0 +1,36 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Scopes\CommonController;
use App\ValueObjects\Amount;
use Illuminate\Http\JsonResponse;
/**
* Beitrag einer Kurzanmeldung. Teilnahmegruppe, Beitragsstufe und Zeitraum stehen fest, deshalb braucht der
* Endpunkt keine Eingaben -- und der Betrag lässt sich vom Client nicht beeinflussen.
*
* `amountValue` steuert im Frontend, ob der Schritt "Zahlungsart" gezeigt wird.
*/
class ShortCalculateAmountController extends CommonController {
public function __invoke(int $eventId) : JsonResponse {
$event = $this->events->getById($eventId, false);
$participationType = $event->firstParticipationTypeSlug();
$amount = $participationType === null
? new Amount(0, 'Euro')
: $event->toResource()->calculateAmount(
$participationType,
'standard',
$event->start_date,
$event->end_date,
false
);
return response()->json([
'amount' => $amount->toString(),
'amountValue' => $amount->getAmount(),
]);
}
}
@@ -0,0 +1,130 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\CertificateOfConductionCheck\CertificateOfConductionCheckCommand;
use App\Domains\Event\Actions\CertificateOfConductionCheck\CertificateOfConductionCheckRequest;
use App\Domains\Event\Actions\ShortSignUp\ShortSignUpCommand;
use App\Domains\Event\Actions\ShortSignUp\ShortSignUpRequest;
use App\Enumerations\FirstAidPermission;
use App\Enumerations\SwimmingPermission;
use App\Mail\ParticipantParticipationMails\EventSignUpSuccessfullMail;
use App\Providers\DoubleCheckEventRegistrationProvider;
use App\Scopes\CommonController;
use DateTime;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Validator;
/**
* Nimmt die verkürzte Anmeldung entgegen. Öffentlich erreichbar, deshalb werden die Eingaben hier -- anders als
* im langen Prozess -- validiert, bevor sie die Action erreichen.
*/
class ShortSignupController extends CommonController {
public function __invoke(int $eventId, Request $request) : JsonResponse {
$event = $this->events->getById($eventId, false);
if (!$event->registration_allowed || new DateTime() > $event->start_date) {
return response()->json(['status' => 'closed'], 403);
}
// Die Kurzanmeldung darf nicht als Abkürzung um den langen Prozess herum benutzt werden.
if (!$event->short_registration) {
return response()->json(['status' => 'closed'], 403);
}
$validator = Validator::make($request->all(), [
'firstname' => 'required|string|max:255',
'lastname' => 'required|string|max:255',
'nickname' => 'nullable|string|max:255',
'birthday' => 'required|date_format:Y-m-d|before:today',
'email' => 'required|email|max:255',
'phone' => 'required|string|max:255',
// Gegen die teilnehmenden Stämme prüft der Command -- hier reicht die Typprüfung.
'localGroup' => 'nullable|integer',
'contactPerson' => 'nullable|string|max:255',
'contactEmail' => 'nullable|email|max:255',
'allergies' => 'nullable|string|max:255',
'intolerances' => 'nullable|string|max:255',
'firstAidPermission' => ['nullable', 'string', 'in:' . implode(',', FirstAidPermission::query()->pluck('slug')->toArray())],
'swimmingPermission' => ['nullable', 'string', 'in:' . implode(',', SwimmingPermission::query()->pluck('slug')->toArray())],
'foto' => 'array',
'participationOptions' => 'array',
'paymentMethod' => 'nullable|string',
'paymentOptions' => 'array',
]);
if ($validator->fails()) {
return response()->json(['status' => 'error', 'message' => $validator->errors()->first()], 422);
}
$birthday = DateTime::createFromFormat('Y-m-d', $request->input('birthday'));
$doubleCheck = new DoubleCheckEventRegistrationProvider(
$event,
$request->input('firstname'),
$request->input('lastname'),
$request->input('email'),
$birthday
);
if ($doubleCheck->isRegistered()) {
return response()->json(['status' => 'exists']);
}
$foto = (array)$request->input('foto', []);
$shortSignUpRequest = new ShortSignUpRequest(
event: $event,
user_id: currentUser()?->id,
firstname: $request->input('firstname'),
lastname: $request->input('lastname'),
nickname: $request->input('nickname'),
birthday: $birthday,
email: $request->input('email'),
phone: $request->input('phone'),
localGroupId: $request->input('localGroup') !== null ? (int)$request->input('localGroup') : null,
contactPerson: $request->input('contactPerson') ?: null,
contactEmail: $request->input('contactEmail') ?: null,
allergies: $request->input('allergies') ?: null,
intolerances: $request->input('intolerances') ?: null,
firstAidPermission: $request->input('firstAidPermission') ?: null,
swimmingPermission: $request->input('swimmingPermission') ?: null,
foto_socialmedia: (bool)($foto['socialmedia'] ?? false),
foto_print: (bool)($foto['print'] ?? false),
foto_webseite: (bool)($foto['webseite'] ?? false),
foto_partner: (bool)($foto['partner'] ?? false),
foto_intern: (bool)($foto['intern'] ?? false),
paymentMethod: $request->input('paymentMethod') ?: null,
paymentOptions: (array)$request->input('paymentOptions', []),
participationOptions: (array)$request->input('participationOptions', []),
);
$shortSignUpResponse = new ShortSignUpCommand($shortSignUpRequest)->execute();
if (!$shortSignUpResponse->success) {
return response()->json(['status' => 'error', 'message' => $shortSignUpResponse->message], 422);
}
$participant = $shortSignUpResponse->participant;
$cocResponse = new CertificateOfConductionCheckCommand(
new CertificateOfConductionCheckRequest($participant)
)->execute();
$participant->efz_status = $cocResponse->status;
$participant->save();
Mail::to($participant->email_1)->send(new EventSignUpSuccessfullMail(participant: $participant));
if ($participant->email_2 !== null) {
Mail::to($participant->email_2)->send(new EventSignUpSuccessfullMail(participant: $participant));
}
return response()->json([
'participant' => $participant->toResource()->toArray($request),
'status' => 'success',
]);
}
}
@@ -35,8 +35,9 @@ class SignupController extends CommonController {
'lastname' => '', 'lastname' => '',
]; ];
if (auth()->check()) { $currentUser = currentUser();
$user = new UserResource(auth()->user())->toArray($request); if ($currentUser !== null) {
$user = new UserResource($currentUser)->toArray($request);
$participantData = [ $participantData = [
'id' => $user['id'], 'id' => $user['id'],
+10
View File
@@ -1,5 +1,7 @@
<?php <?php
use App\Domains\Event\Controllers\BankStatementBookController;
use App\Domains\Event\Controllers\BankStatementParseController;
use App\Domains\Event\Controllers\CreateController; use App\Domains\Event\Controllers\CreateController;
use App\Domains\Event\Controllers\DetailsController; use App\Domains\Event\Controllers\DetailsController;
use App\Domains\Event\Controllers\EventArchiveController; use App\Domains\Event\Controllers\EventArchiveController;
@@ -14,6 +16,8 @@ use App\Domains\Event\Controllers\ParticipantReSignOnController;
use App\Domains\Event\Controllers\ParticipantSignOffController; use App\Domains\Event\Controllers\ParticipantSignOffController;
use App\Domains\Event\Controllers\ParticipantUpdateController; use App\Domains\Event\Controllers\ParticipantUpdateController;
use App\Domains\Event\Controllers\PaymentReminderController; use App\Domains\Event\Controllers\PaymentReminderController;
use App\Domains\Event\Controllers\ShortCalculateAmountController;
use App\Domains\Event\Controllers\ShortSignupController;
use App\Domains\Event\Controllers\SignupController; use App\Domains\Event\Controllers\SignupController;
use App\Middleware\IdentifyTenant; use App\Middleware\IdentifyTenant;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
@@ -25,6 +29,9 @@ Route::prefix('api/v1')
Route::post('{eventId}/calculate-amount', [SignupController::class, 'calculateAmount']); Route::post('{eventId}/calculate-amount', [SignupController::class, 'calculateAmount']);
Route::post('{eventId}/signup', [SignupController::class, 'signUp']); Route::post('{eventId}/signup', [SignupController::class, 'signUp']);
Route::post('{eventId}/short-calculate-amount', ShortCalculateAmountController::class);
Route::post('{eventId}/short-signup', ShortSignupController::class);
Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () {
Route::post('/create', [CreateController::class, 'doCreate']); Route::post('/create', [CreateController::class, 'doCreate']);
@@ -48,6 +55,9 @@ Route::prefix('api/v1')
Route::post('/payment-methods', [DetailsController::class, 'updatePaymentMethods']); Route::post('/payment-methods', [DetailsController::class, 'updatePaymentMethods']);
Route::post('/participation-options', [DetailsController::class, 'updateParticipationOptions']); Route::post('/participation-options', [DetailsController::class, 'updateParticipationOptions']);
Route::post('/event-addons', [DetailsController::class, 'updateEventAddons']); Route::post('/event-addons', [DetailsController::class, 'updateEventAddons']);
Route::post('/bank-statement/parse', BankStatementParseController::class);
Route::post('/bank-statement/book', BankStatementBookController::class);
}); });
+1 -1
View File
@@ -47,7 +47,7 @@ async function unarchiveEvent(eventId) {
<div> <div>
<h2 style="margin: 0 0 4px 0; font-size: 1.1rem; font-weight: 600;">{{ event.name }}</h2> <h2 style="margin: 0 0 4px 0; font-size: 1.1rem; font-weight: 600;">{{ event.name }}</h2>
<span style="color: #6b7280; font-size: 0.875rem;"> <span style="color: #6b7280; font-size: 0.875rem;">
{{ event.postalCode }} {{ event.location }} {{ event.fullAddress }}
&nbsp;·&nbsp; &nbsp;·&nbsp;
{{ event.eventBegin }} {{ event.eventEnd }} {{ event.eventBegin }} {{ event.eventEnd }}
</span> </span>
+14
View File
@@ -23,6 +23,8 @@
eventName: '', eventName: '',
eventPostalCode: '', eventPostalCode: '',
eventLocation: '', eventLocation: '',
eventStreet: '',
eventHouseNumber: '',
eventEmail: props.emailAddress ? props.emailAddress : '', eventEmail: props.emailAddress ? props.emailAddress : '',
eventBegin: '', eventBegin: '',
eventEnd: '', eventEnd: '',
@@ -145,6 +147,8 @@
eventName: formData.eventName, eventName: formData.eventName,
eventPostalCode: formData.eventPostalCode, eventPostalCode: formData.eventPostalCode,
eventLocation: formData.eventLocation, eventLocation: formData.eventLocation,
eventStreet: formData.eventStreet,
eventHouseNumber: formData.eventHouseNumber,
eventEmail: formData.eventEmail, eventEmail: formData.eventEmail,
eventBegin: formData.eventBegin, eventBegin: formData.eventBegin,
eventEnd: formData.eventEnd, eventEnd: formData.eventEnd,
@@ -195,6 +199,16 @@
<ErrorText :message="errors.eventLocation" /></td> <ErrorText :message="errors.eventLocation" /></td>
</tr> </tr>
<tr style="vertical-align: top;">
<th class="width-medium pr-20 height-50">Straße (optional)</th>
<td class="height-50"><input type="text" v-model="formData.eventStreet" class="width-half-full" /></td>
</tr>
<tr style="vertical-align: top;">
<th class="width-medium pr-20 height-50">Hausnummer (optional)</th>
<td class="height-50"><input type="text" v-model="formData.eventHouseNumber" class="width-half-full" /></td>
</tr>
<tr style="vertical-align: top;"> <tr style="vertical-align: top;">
<th class="width-medium pr-20 height-50">Postleitzahl des Veranstaltungsorts</th> <th class="width-medium pr-20 height-50">Postleitzahl des Veranstaltungsorts</th>
<td class="height-50"><input type="text" v-model="formData.eventPostalCode" class="width-half-full" /> <td class="height-50"><input type="text" v-model="formData.eventPostalCode" class="width-half-full" />
@@ -22,7 +22,7 @@ const props = defineProps({
<div class="available-event-header"> <div class="available-event-header">
<div> <div>
<h2 class="available-event-title">{{ event.name }}</h2> <h2 class="available-event-title">{{ event.name }}</h2>
<span class="available-event-location">{{ event.postalCode }} {{ event.location }}</span> <span class="available-event-location">{{ event.fullAddress }}</span>
</div> </div>
<span <span
v-if="event.registrationAllowed" v-if="event.registrationAllowed"
@@ -47,7 +47,7 @@ const props = defineProps({
</tr> </tr>
<tr> <tr>
<th>Veranstaltungsort</th> <th>Veranstaltungsort</th>
<td>{{ event.postalCode }} {{ event.location }}</td> <td>{{ event.fullAddress }}</td>
</tr> </tr>
<tr> <tr>
<th>Frühbuchen bis</th> <th>Frühbuchen bis</th>
@@ -0,0 +1,635 @@
<script setup>
import {computed, ref} from 'vue'
import {toast} from 'vue3-toastify'
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
import LoadingModal from "../../../../Views/Components/LoadingModal.vue";
import Icon from "../../../../Views/Components/Icon.vue";
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
/**
* Zahlungseingänge aus dem CSV-Export der Bank einbuchen.
*
* Zwei Schritte: Datei einlesen (der Server ordnet zu und schlägt vor), dann die Prüfansicht
* bestätigen. Gebucht wird erst im zweiten Schritt und für alle Zeilen in einem Aufruf.
*/
const props = defineProps({
event: {type: Object, required: true},
})
const emit = defineEmits(['close', 'booked'])
const {request} = useAjax()
const fileInput = ref(null)
const fileName = ref('')
const parsing = ref(false)
const booking = ref(false)
const rows = ref([])
const participants = ref([])
// rowNumber -> identifier ('' = ignorieren)
const assignment = ref({})
const parsed = ref(false)
const skipped = ref(0)
const assignedCount = computed(
() => rows.value.filter(row => isAssigned(row)).length,
)
const openCount = computed(() => rows.value.length - assignedCount.value)
const participantsByIdentifier = computed(
() => Object.fromEntries(participants.value.map(participant => [participant.identifier, participant])),
)
/**
* Die Auswahlliste für alle Zeilen -- einmal gebaut, nicht je Zeile.
*
* Getrennt nach an- und abgemeldet, weil die Entscheidung unterschiedlich weit trägt: Eine Buchung
* auf eine abgemeldete Anmeldung zieht eine Erstattung nach sich. Als Fließtext in einer Zeile ging
* das unter, als Gruppenüberschrift steht es da.
*/
const participantOptions = computed(() => {
const options = [{value: '', label: '— ignorieren —'}]
for (const participant of participants.value) {
const state = participant.isSettled ? 'vollständig bezahlt' : participant.amountOpen + ' offen'
options.push(participant.isSignedOff
? {
value: participant.identifier,
label: participant.name,
description: 'abgemeldet am ' + participant.signedOffAt + ' · ' + state,
group: 'Abgemeldete Teilis',
icon: 'user-slash',
muted: true,
}
: {
value: participant.identifier,
label: participant.name,
description: state,
group: 'Angemeldete Teilis',
})
}
return options
})
function isAssigned(row) {
return (assignment.value[row.rowNumber] ?? '') !== ''
}
/** Der sichtbare Button klickt das versteckte Datei-Element -- wie beim Beleg-Upload der Abrechnung. */
function chooseFile() {
fileInput.value?.click()
}
/** Auswählen und Einlesen sind ein Schritt: Ein zweiter Klick brächte nichts zu entscheiden. */
async function onFileChosen(event) {
const file = event.target.files?.[0] ?? null
if (file === null) {
return
}
fileName.value = file.name
await readStatement(file)
}
async function readStatement(file) {
parsing.value = true
try {
const form = new FormData()
form.append('statement', file)
const response = await request(
'/api/v1/event/details/' + props.event.id + '/bank-statement/parse',
{method: 'POST', body: form},
)
if (response?.status !== 'success') {
toast.error(response?.message ?? 'Die Datei konnte nicht gelesen werden.')
reset()
return
}
rows.value = response.rows ?? []
participants.value = response.participants ?? []
skipped.value = response.skipped ?? 0
// Vorschläge sind vorbelegt, aber nichts ist entschieden -- gebucht wird nur, was hier
// stehen bleibt.
assignment.value = Object.fromEntries(
rows.value.map(row => [row.rowNumber, row.suggestedIdentifier ?? '']),
)
parsed.value = true
} finally {
parsing.value = false
}
}
async function bookPayments() {
const bookings = rows.value
.filter(row => isAssigned(row))
.map(row => ({
participantIdentifier: assignment.value[row.rowNumber],
rowNumber: row.rowNumber,
paymentDate: row.paymentDate,
amount: row.amount,
payerName: row.payerName,
payerIban: row.payerIban,
purpose: row.purpose,
}))
if (bookings.length === 0) {
toast.error('Es ist keine Zahlung zugeordnet.')
return
}
booking.value = true
try {
const response = await request(
'/api/v1/event/details/' + props.event.id + '/bank-statement/book',
{method: 'POST', body: {bookings}},
)
if (response?.status !== 'success') {
toast.error(response?.message ?? 'Die Zahlungen konnten nicht gebucht werden.')
return
}
toast.success(response.message)
emit('booked')
emit('close')
} finally {
booking.value = false
}
}
function reset() {
rows.value = []
participants.value = []
assignment.value = {}
parsed.value = false
skipped.value = 0
fileName.value = ''
if (fileInput.value) fileInput.value.value = ''
}
function assignedParticipant(row) {
return participantsByIdentifier.value[assignment.value[row.rowNumber]] ?? null
}
/** Der Zustand einer Zeile: was gebucht wird, was noch offen ist, was geprüft gehört. */
function rowState(row) {
if (!isAssigned(row)) {
return row.suggestedIdentifier === null
? {key: 'unmatched', label: 'Keine Zuordnung', icon: 'circle-question'}
: {key: 'ignored', label: 'Ignoriert', icon: 'ban'}
}
if (assignment.value[row.rowNumber] !== row.suggestedIdentifier) {
return {key: 'manual', label: 'Von Hand', icon: 'user-pen'}
}
return row.confidence === 'unsicher'
? {key: 'uncertain', label: 'Bitte prüfen', icon: 'triangle-exclamation'}
: {key: 'certain', label: 'Vorschlag', icon: 'check'}
}
function lastPaymentOf(row) {
return assignedParticipant(row)?.lastPaymentDate ?? null
}
/** Eine Zahlung auf eine abgemeldete Anmeldung zieht eine Erstattung nach sich. */
function signedOffOf(row) {
const participant = assignedParticipant(row)
return participant?.isSignedOff === true ? participant : null
}
</script>
<template>
<FullScreenModal :show="true" @close="emit('close')">
<div class="import">
<header class="import-header">
<h2>Zahlungseingänge einlesen</h2>
<p class="subtitle">{{ event.name }}</p>
</header>
<!-- Schritt 1: Datei wählen. Das Datei-Element bleibt versteckt, geklickt wird der Button. -->
<div v-if="!parsed" class="dropzone">
<Icon name="file-csv" class="dropzone-icon"/>
<p class="dropzone-title">Kontoauszug als CSV hochladen</p>
<p class="dropzone-note">
Der Export wird nur gelesen und nicht gespeichert. Gebucht wird anschließend
ausschließlich das, was ihr in der Prüfansicht bestätigt.
</p>
<input type="button" value="Kontoauszug auswählen" @click="chooseFile"/>
</div>
<input ref="fileInput" type="file" accept=".csv,text/csv,text/plain"
style="display: none" @change="onFileChosen"/>
<template v-if="parsed">
<div class="filebar">
<span class="filename"><Icon name="file-csv"/> {{ fileName }}</span>
<label class="link" @click="reset">Andere Datei wählen</label>
</div>
<div v-if="rows.length > 0" class="stats">
<div class="stat stat-assigned">
<span class="stat-value">{{ assignedCount }}</span>
<span class="stat-label">wird gebucht</span>
</div>
<div class="stat" :class="{'stat-open': openCount > 0}">
<span class="stat-value">{{ openCount }}</span>
<span class="stat-label">nicht zugeordnet</span>
</div>
<div v-if="skipped > 0" class="stat">
<span class="stat-value">{{ skipped }}</span>
<span class="stat-label">bereits erfasst</span>
</div>
</div>
<div v-if="rows.length === 0" class="empty">
<Icon name="circle-check" class="empty-icon"/>
<p>
In dieser Datei sind keine offenen Zahlungseingänge zu dieser Aktion enthalten.
<template v-if="skipped > 0">
{{ skipped }} Zahlungen wurden bereits früher eingebucht.
</template>
</p>
</div>
<table v-else class="statement-table">
<thead>
<tr>
<th>Buchung</th>
<th class="right">Betrag</th>
<th>Zahler*in</th>
<th>Verwendungszweck</th>
<th class="assignment-column">Zuordnung</th>
</tr>
</thead>
<tbody>
<tr v-for="row in rows" :key="row.rowNumber" :class="'state-' + rowState(row).key">
<td class="nowrap">{{ row.paymentDateFormatted }}</td>
<td class="right amount">{{ row.amountFormatted }}</td>
<td>
<span class="payer">{{ row.payerName || '—' }}</span>
<span v-if="row.payerIban" class="iban">{{ row.payerIban }}</span>
</td>
<td class="purpose">{{ row.purpose }}</td>
<td>
<div class="assignment">
<RichSelectBox v-model="assignment[row.rowNumber]"
:options="participantOptions"
placeholder="— ignorieren —"
filterable/>
<span class="pill" :class="'pill-' + rowState(row).key">
<Icon :key="rowState(row).icon" :name="rowState(row).icon"/> {{ rowState(row).label }}
</span>
<span v-if="signedOffOf(row)" class="pill pill-signedoff">
<Icon name="user-slash"/> Abgemeldet
</span>
</div>
<span v-if="signedOffOf(row)" class="hint hint-warning">
Am {{ signedOffOf(row).signedOffAt }} abgemeldet die Zahlung wird
erfasst, danach steht eine Erstattung an.
</span>
<span v-if="lastPaymentOf(row)" class="hint">
Zuletzt erfasst: {{ lastPaymentOf(row) }}
</span>
</td>
</tr>
</tbody>
</table>
<footer v-if="rows.length > 0" class="actions">
<span class="actions-note">
Die Teilnehmenden erhalten je Buchung die gewohnte Zahlungsmail.
</span>
<input type="button" class="accept-button"
:value="assignedCount === 1 ? '1 Zahlung einbuchen' : assignedCount + ' Zahlungen einbuchen'"
:disabled="assignedCount === 0 || booking"
@click="bookPayments"/>
</footer>
</template>
</div>
<!-- Beim Buchen geht je Zahlung eine Mail an die Teilnehmenden raus, und zwar synchron --
bei achtzig Buchungen dauert der Aufruf entsprechend. -->
<LoadingModal v-if="parsing || booking" :show="true"
:message="booking
? 'Die Zahlungen werden gebucht und die Teilnehmenden benachrichtigt. Das kann einen Moment dauern …'
: 'Der Kontoauszug wird gelesen …'"/>
</FullScreenModal>
</template>
<style scoped>
.import {
max-width: 1200px;
margin: 0 auto;
}
.import-header {
border-bottom: 1px solid #e5e7eb;
padding-bottom: 12px;
margin-bottom: 20px;
}
.import-header h2 {
margin: 0;
color: #1d4899;
}
.subtitle {
margin: 2px 0 0 0;
color: #6b7280;
font-size: 0.9rem;
}
/* ── Schritt 1: Datei wählen ───────────────────────────────────────────── */
.dropzone {
border: 2px dashed #c7d2e8;
border-radius: 10px;
background-color: #fafbfe;
padding: 48px 24px;
text-align: center;
max-width: 620px;
margin: 40px auto;
}
.dropzone-icon {
font-size: 2.6rem;
color: #809dd5;
}
.dropzone-title {
margin: 14px 0 6px 0;
font-weight: bold;
font-size: 1.05rem;
color: #374151;
}
.dropzone-note {
margin: 0 auto 22px auto;
max-width: 440px;
color: #6b7280;
font-size: 0.85rem;
line-height: 1.5;
}
/* ── Schritt 2: Prüfansicht ────────────────────────────────────────────── */
.filebar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
padding: 8px 12px;
background-color: #f9fafb;
border: 1px solid #e5e7eb;
border-radius: 8px;
}
.filename {
color: #374151;
font-weight: bold;
font-size: 0.9rem;
word-break: break-all;
}
.stats {
display: flex;
gap: 10px;
flex-wrap: wrap;
margin: 16px 0;
}
.stat {
flex: 1 1 130px;
border: 1px solid #e5e7eb;
border-radius: 8px;
padding: 10px 14px;
background-color: #ffffff;
}
.stat-value {
display: block;
font-size: 1.5rem;
font-weight: bold;
color: #374151;
line-height: 1.1;
}
.stat-label {
display: block;
color: #6b7280;
font-size: 0.8rem;
margin-top: 2px;
}
.stat-assigned {
border-color: #508c4c;
background-color: #f3faf3;
}
.stat-assigned .stat-value {
color: #2f6b2c;
}
.stat-open .stat-value {
color: #92400e;
}
.empty {
text-align: center;
color: #6b7280;
padding: 40px 20px;
}
.empty-icon {
font-size: 2rem;
color: #508c4c;
}
.statement-table {
width: 100%;
border-collapse: collapse;
margin-top: 6px;
}
.statement-table th {
text-align: left;
padding: 8px 10px;
background-color: #f9fafb;
color: #374151;
border-bottom: 2px solid #d1d5db;
font-size: 0.82rem;
text-transform: uppercase;
letter-spacing: 0.03em;
position: sticky;
top: 0;
z-index: 1;
}
.statement-table td {
padding: 10px;
border-bottom: 1px solid #e5e7eb;
vertical-align: top;
font-size: 0.95rem;
}
.statement-table .right {
text-align: right;
}
.nowrap {
white-space: nowrap;
}
.amount {
white-space: nowrap;
font-weight: bold;
color: #374151;
}
.assignment-column {
width: 360px;
}
/* Zeilenfarbe sagt auf einen Blick, was passiert: grün wird gebucht, gelb will geprüft werden,
grau bleibt liegen. */
.state-certain td,
.state-manual td {
background-color: #f6fdf7;
}
.state-uncertain td {
background-color: #fffbeb;
}
.state-ignored td,
.state-unmatched td {
background-color: #fbfbfb;
color: #9ca3af;
}
.payer {
display: block;
color: #374151;
}
.iban {
display: block;
color: #9ca3af;
font-size: 0.75rem;
margin-top: 1px;
}
.purpose {
max-width: 320px;
word-break: break-word;
color: #4b5563;
}
.assignment {
display: flex;
flex-direction: column;
gap: 5px;
}
.pill {
align-self: flex-start;
display: inline-flex;
align-items: center;
gap: 5px;
padding: 2px 9px;
border-radius: 11px;
font-size: 0.72rem;
font-weight: bold;
border: 1px solid transparent;
}
.pill-certain {
color: #2f6b2c;
background-color: #dcfce7;
border-color: #86c884;
}
.pill-manual {
color: #1d4899;
background-color: #e4ecfb;
border-color: #809dd5;
}
.pill-uncertain {
color: #92400e;
background-color: #fef3c7;
border-color: #d9b45c;
}
.pill-ignored,
.pill-unmatched {
color: #6b7280;
background-color: #f3f4f6;
border-color: #d1d5db;
}
.pill-signedoff {
color: #9a3412;
background-color: #ffedd5;
border-color: #e0a06a;
}
.hint {
display: block;
color: #9ca3af;
font-size: 0.72rem;
margin-top: 4px;
}
.hint-warning {
color: #9a3412;
}
.actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 16px;
flex-wrap: wrap;
margin-top: 20px;
padding-top: 16px;
border-top: 1px solid #e5e7eb;
}
.actions-note {
color: #6b7280;
font-size: 0.8rem;
}
.actions input[disabled] {
opacity: 0.5;
cursor: not-allowed;
}
/* ── Schmale Bildschirme ───────────────────────────────────────────────── */
@media (max-width: 900px) {
.assignment-column {
width: auto;
}
.statement-table th {
position: static;
}
.purpose {
max-width: none;
}
}
</style>
@@ -27,6 +27,8 @@ const emit = defineEmits(['close'])
contributingLocalGroups: contributingLocalGroups.value, contributingLocalGroups: contributingLocalGroups.value,
eventName: props.event.name, eventName: props.event.name,
eventLocation: props.event.location, eventLocation: props.event.location,
street: props.event.street ?? '',
houseNumber: props.event.houseNumber ?? '',
postalCode: props.event.postalCode, postalCode: props.event.postalCode,
email: props.event.email, email: props.event.email,
earlyBirdEnd: props.event.earlyBirdEnd.internal, earlyBirdEnd: props.event.earlyBirdEnd.internal,
@@ -35,6 +37,8 @@ const emit = defineEmits(['close'])
eatingHabits: eatingHabits.value, eatingHabits: eatingHabits.value,
sendWeeklyReports: props.event.sendWeeklyReports, sendWeeklyReports: props.event.sendWeeklyReports,
registrationAllowed: props.event.registrationAllowed, registrationAllowed: props.event.registrationAllowed,
shortRegistration: props.event.shortRegistration,
swimmingPermissionRequired: props.event.swimmingPermissionRequired,
flatSupport: props.event.flatSupportEdit, flatSupport: props.event.flatSupportEdit,
supportPerson: props.event.supportPersonIndex, supportPerson: props.event.supportPersonIndex,
}) })
@@ -57,6 +61,8 @@ const emit = defineEmits(['close'])
body: { body: {
eventName: formData.eventName, eventName: formData.eventName,
eventLocation: formData.eventLocation, eventLocation: formData.eventLocation,
street: formData.street,
houseNumber: formData.houseNumber,
postalCode: formData.postalCode, postalCode: formData.postalCode,
email: formData.email, email: formData.email,
earlyBirdEnd: formData.earlyBirdEnd, earlyBirdEnd: formData.earlyBirdEnd,
@@ -64,6 +70,8 @@ const emit = defineEmits(['close'])
alcoholicsAge: formData.alcoholicsAge, alcoholicsAge: formData.alcoholicsAge,
sendWeeklyReports: formData.sendWeeklyReports, sendWeeklyReports: formData.sendWeeklyReports,
registrationAllowed: formData.registrationAllowed, registrationAllowed: formData.registrationAllowed,
shortRegistration: formData.shortRegistration,
swimmingPermissionRequired: formData.swimmingPermissionRequired,
flatSupport: formData.flatSupport, flatSupport: formData.flatSupport,
supportPerson: formData.supportPerson, supportPerson: formData.supportPerson,
contributingLocalGroups: contributingLocalGroups.value, contributingLocalGroups: contributingLocalGroups.value,
@@ -105,6 +113,20 @@ const emit = defineEmits(['close'])
</td> </td>
</tr> </tr>
<tr>
<th>Straße (optional)</th>
<td>
<input type="text" v-model="formData.street" class="width-full" />
</td>
</tr>
<tr>
<th>Hausnummer (optional)</th>
<td>
<input type="text" v-model="formData.houseNumber" class="width-full" />
</td>
</tr>
<tr> <tr>
<th>Postleitzahl des Veranstaltungsorts</th> <th>Postleitzahl des Veranstaltungsorts</th>
<td> <td>
@@ -172,6 +194,27 @@ const emit = defineEmits(['close'])
<label for="registrationAllowed">Veranstaltung ist für Anmeldungen geöffnet</label> <label for="registrationAllowed">Veranstaltung ist für Anmeldungen geöffnet</label>
</td> </td>
</tr> </tr>
<tr>
<td colspan="2">
<input type="checkbox" v-model="formData.shortRegistration" id="shortRegistration" />
<label for="shortRegistration">Verkürzte Anmeldung verwenden</label><br />
<span style="font-size: 0.8rem; color: #6b7280;">
Fragt nur die nötigsten Daten ab (Name, Kontakt, Allergien, Foto-Erlaubnis).
Nicht erhobene Angaben wie Anschrift und An-/Abreise werden automatisch gefüllt.
</span>
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" v-model="formData.swimmingPermissionRequired" id="swimmingPermissionRequired" />
<label for="swimmingPermissionRequired">Badeerlaubnis abfragen</label><br />
<span style="font-size: 0.8rem; color: #6b7280;">
Ist die Abfrage deaktiviert, wird für Minderjährige Keine Badeerlaubnis" hinterlegt.
</span>
</td>
</tr>
</table> </table>
@@ -6,6 +6,7 @@ import EventAddons from "./EventAddons.vue";
import ParticipationSummary from "./ParticipationSummary.vue"; import ParticipationSummary from "./ParticipationSummary.vue";
import CommonSettings from "./CommonSettings.vue"; import CommonSettings from "./CommonSettings.vue";
import EventManagement from "./EventManagement.vue"; import EventManagement from "./EventManagement.vue";
import BankStatementImport from "./BankStatementImport.vue";
import Modal from "../../../../Views/Components/Modal.vue"; import Modal from "../../../../Views/Components/Modal.vue";
import MailCompose from "./MailCompose.vue"; import MailCompose from "./MailCompose.vue";
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue"; import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
@@ -21,6 +22,12 @@ const props = defineProps({
const displayData = ref('main'); const displayData = ref('main');
const showEventData = ref(false); const showEventData = ref(false);
const showBankStatement = ref(false);
// Nach dem Buchen stimmen die Beitragsstände der Übersicht nicht mehr -- neu laden.
async function bankStatementBooked() {
await showMain();
}
async function showMain() { async function showMain() {
@@ -117,9 +124,18 @@ async function showEventAddons() {
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'"> <a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'">
<input type="button" value="Foto-Erlaubnis (PDF)" /> <input type="button" value="Foto-Erlaubnis (PDF)" />
</a><br/> </a><br/>
<input type="button" value="Zahlungseingänge einlesen" @click="showBankStatement = true" /><br/>
</div> </div>
<!-- Liegt außerhalb der displayData-Umschaltung: Der Import ist ein Vollbild-Dialog über der
Übersicht, keine Unter-Ansicht, und soll auch aus einer Unter-Ansicht heraus erreichbar sein. -->
<BankStatementImport v-if="showBankStatement && dynamicProps.event"
:event="dynamicProps.event"
@close="showBankStatement = false"
@booked="bankStatementBooked" />
<ParticipationFees v-if="displayData === 'participationFees'" :event="dynamicProps.event" @close="showMain" /> <ParticipationFees v-if="displayData === 'participationFees'" :event="dynamicProps.event" @close="showMain" />
<ParticipationOptions v-else-if="displayData === 'participationOptions'" :event="dynamicProps.event" <ParticipationOptions v-else-if="displayData === 'participationOptions'" :event="dynamicProps.event"
@close="showMain"/> @close="showMain"/>
@@ -158,6 +174,7 @@ async function showEventAddons() {
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'"> <a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'">
<input type="button" value="Foto-Erlaubnis (PDF)" /> <input type="button" value="Foto-Erlaubnis (PDF)" />
</a><br/> </a><br/>
<input type="button" value="Zahlungseingänge einlesen" @click="showBankStatement = true" /><br/>
<input type="button" @click="sendPaymentReminder" class="fix-button" value="Zahlungserinnerung senden" /><br/> <input type="button" @click="sendPaymentReminder" class="fix-button" value="Zahlungserinnerung senden" /><br/>
<input type="button" class="deny-button" value="Letzte Mahnung senden" style="display: none" /><br/> <input type="button" class="deny-button" value="Letzte Mahnung senden" style="display: none" /><br/>
<input type="button" value="Rundmail senden" @click="mailToGroup" /><br/> <input type="button" value="Rundmail senden" @click="mailToGroup" /><br/>
@@ -233,6 +233,7 @@ function saveParticipant() {
<td> <td>
<span v-if="!staticProps.editMode">{{ props.participant.localgroup }}</span> <span v-if="!staticProps.editMode">{{ props.participant.localgroup }}</span>
<select v-else v-model="form.localgroup"> <select v-else v-model="form.localgroup">
<option value="">Kein Stamm</option>
<option v-for="group in staticProps.event.contributingLocalGroups" :key="group.id" :value="group.slug">{{ group.name }}</option> <option v-for="group in staticProps.event.contributingLocalGroups" :key="group.id" :value="group.slug">{{ group.name }}</option>
</select> </select>
</td> </td>
@@ -386,7 +387,9 @@ function saveParticipant() {
Bankverbindung des Teilis Bankverbindung des Teilis
</small> </small>
<small v-else-if="props.participant.refund.status === 'accepted'"> <small v-else-if="props.participant.refund.status === 'accepted'">
bestätigt am {{ props.participant.refund.acceptedAt }} bestätigt am {{ props.participant.refund.acceptedAt }}<template
v-if="props.participant.refund.donation"
> &ndash; gespendet, keine Auszahlung</template>
</small> </small>
<!-- Was beim Verband geblieben ist und warum. --> <!-- Was beim Verband geblieben ist und warum. -->
@@ -60,6 +60,7 @@ const refundErrors = reactive({amount: '', reason: '', reasonNote: '', accountOw
const refundReasons = ref([]); const refundReasons = ref([]);
const retentionReasons = ref([]); const retentionReasons = ref([]);
const refundSaving = ref(false); const refundSaving = ref(false);
const refundResending = ref(false);
const selectedRefundReason = computed( const selectedRefundReason = computed(
() => refundReasons.value.find(r => r.value === refundForm.reason) ?? null () => refundReasons.value.find(r => r.value === refundForm.reason) ?? null
@@ -85,6 +86,16 @@ const retainedAmount = computed(() => {
const hasRetention = computed(() => retainedAmount.value > 0); const hasRetention = computed(() => retainedAmount.value > 0);
/**
* Das Konto, das die Zahlungsart kennt -- bei der Überweisung das des Zahlungseingangs.
*
* Ist es da, wird es weder erfragt noch bearbeitet: Erstattet wird auf das Konto, von dem der Beitrag
* kam, und genau das steht hier. `null`, solange nichts bekannt ist (Barzahlung, Altbestand).
*/
const knownRefundAccount = computed(
() => showParticipant.value?.refundData?.available ? showParticipant.value.refundData : null
);
const retainedAmountReadable = computed( const retainedAmountReadable = computed(
() => retainedAmount.value.toFixed(2).replace('.', ',') + ' Euro' () => retainedAmount.value.toFixed(2).replace('.', ',') + ' Euro'
); );
@@ -120,7 +131,8 @@ const refundFormComplete = computed(() => {
} }
} }
if (refundForm.captureMode === 'management') { // Beim bekannten Konto gibt es nichts einzugeben -- es steht fest.
if (refundForm.captureMode === 'management' && !knownRefundAccount.value) {
return refundForm.accountOwner.trim() !== '' && refundForm.accountIban.trim() !== ''; return refundForm.accountOwner.trim() !== '' && refundForm.accountIban.trim() !== '';
} }
@@ -428,7 +440,7 @@ function validateRefund() {
// Beim Direktweg wird sofort eingereicht -- danach gibt es keine Gelegenheit mehr zu berichtigen. // Beim Direktweg wird sofort eingereicht -- danach gibt es keine Gelegenheit mehr zu berichtigen.
// Ob die IBAN wirklich stimmt, prüft der Server mit Prüfziffer und länderabhängiger Länge. // Ob die IBAN wirklich stimmt, prüft der Server mit Prüfziffer und länderabhängiger Länge.
if (refundForm.captureMode === 'management') { if (refundForm.captureMode === 'management' && !knownRefundAccount.value) {
if (!refundForm.accountOwner.trim()) { if (!refundForm.accountOwner.trim()) {
refundErrors.accountOwner = 'Bitte gib an, wem das Konto gehört.'; refundErrors.accountOwner = 'Bitte gib an, wem das Konto gehört.';
} }
@@ -455,9 +467,16 @@ async function execRefund() {
amount: refundForm.amount, amount: refundForm.amount,
reason: refundForm.reason, reason: refundForm.reason,
reasonNote: refundForm.reasonNote, reasonNote: refundForm.reasonNote,
// Leer beim Weg über den Teili -- dann verschickt der Server nur den Link. // Leer beim Weg über den Teili -- dann verschickt der Server nur den Link. Beim
accountOwner: refundForm.captureMode === 'management' ? refundForm.accountOwner : '', // Sofort-Einreichen mit bekanntem Konto geht dieses mit; eingegeben wurde nichts.
accountIban: refundForm.captureMode === 'management' ? refundForm.accountIban : '', accountOwner: refundForm.captureMode === 'management'
? (knownRefundAccount.value?.accountOwner ?? refundForm.accountOwner)
: '',
accountIban: refundForm.captureMode === 'management'
? (knownRefundAccount.value?.accountIban ?? refundForm.accountIban)
: '',
// Spende: kein Konto, trotzdem sofort eingereicht.
donation: refundForm.captureMode === 'donation',
// Leer bei voller Erstattung -- dann gibt es nichts zu begründen. // Leer bei voller Erstattung -- dann gibt es nichts zu begründen.
retentionReason: hasRetention.value ? refundForm.retentionReason : '', retentionReason: hasRetention.value ? refundForm.retentionReason : '',
retentionReasonNote: hasRetention.value ? refundForm.retentionReasonNote : '', retentionReasonNote: hasRetention.value ? refundForm.retentionReasonNote : '',
@@ -496,6 +515,32 @@ async function execCancelRefund(participant) {
} }
} }
/**
* Die Mail zur freigegebenen Erstattung noch einmal schicken -- ohne Rückfrage, es ändert sich nichts am
* Vorgang. Der Guard verhindert, dass ein zweiter Klick eine zweite Mail auslöst, bevor die erste durch ist.
*/
async function execResendRefundMail(participant) {
if (refundResending.value) {
return;
}
refundResending.value = true;
try {
const data = await request('/api/v1/participant-refund/' + participant.refund.token + '/resend-mail', {
method: "POST",
});
if (data?.status === 'success') {
toast.success(data.message);
} else {
toast.error(data?.message ?? 'Die Rückerstattungsmail konnte nicht versendet werden.');
}
} finally {
refundResending.value = false;
}
}
async function downloadRefundDocument(participant) { async function downloadRefundDocument(participant) {
const ok = await download('/api/v1/participant-refund/' + participant.refund.token + '/document'); const ok = await download('/api/v1/participant-refund/' + participant.refund.token + '/document');
@@ -627,8 +672,9 @@ function mailToGroup(groupKey) {
> | Beitrag erstatten</span> > | Beitrag erstatten</span>
<template v-else-if="participant.refund?.status === 'pending'"> <template v-else-if="participant.refund?.status === 'pending'">
| <strong>Erstattung offen:</strong> {{ participant.refund.amount }}, | <strong>Rückerstattung vorgemerkt:</strong> {{ participant.refund.amount }}
wartet auf Bankverbindung am {{ participant.refund.releasedAt }}, wartet auf Bankverbindung
<span class="link" @click="execResendRefundMail(participant)">Rückerstattungsmail erneut senden</span>
<span class="link" style="color: #da7070;" @click="execCancelRefund(participant)">Abbrechen</span> <span class="link" style="color: #da7070;" @click="execCancelRefund(participant)">Abbrechen</span>
</template> </template>
@@ -772,21 +818,58 @@ function mailToGroup(groupKey) {
</template> </template>
<!-- <!--
Liegt die Bankverbindung schon vor, entfällt der Umweg über den Teili: die Erstattung wird Liegt die Bankverbindung schon vor oder will der Teili spenden, entfällt der Umweg über ihn:
sofort eingereicht. Er bekommt den Beleg trotzdem. die Erstattung wird sofort eingereicht. Er bekommt den Beleg trotzdem.
--> -->
<!--
Ist das Konto aus dem Zahlungseingang bekannt, wird es weder erfragt noch bearbeitet: Es
steht fest, dass auf genau dieses Konto zu erstatten ist. Der Teili entscheidet dann nur
noch, ob er es haben oder spenden möchte.
-->
<div v-if="knownRefundAccount" class="refund-known-account">
<strong>Konto aus dem Zahlungseingang</strong>
<span>{{ knownRefundAccount.accountOwner }}</span>
<span class="refund-known-account__iban">{{ knownRefundAccount.accountIban }}</span>
<span class="refund-known-account__source">{{ knownRefundAccount.source }}</span>
</div>
<div class="refund-field"> <div class="refund-field">
<label class="refund-choice"> <label class="refund-choice">
<input type="radio" value="participant" v-model="refundForm.captureMode" /> <input type="radio" value="participant" v-model="refundForm.captureMode" />
Teilnehmer*in trägt die Bankverbindung selbst ein <template v-if="knownRefundAccount">
Teilnehmer*in bestätigt die Erstattung oder spendet
</template>
<template v-else>
Teilnehmer*in trägt die Bankverbindung selbst ein
</template>
</label> </label>
<label class="refund-choice"> <label class="refund-choice">
<input type="radio" value="management" v-model="refundForm.captureMode" /> <input type="radio" value="management" v-model="refundForm.captureMode" />
Bankverbindung liegt mir vor <template v-if="knownRefundAccount">
Sofort einreichen, ohne auf die Rückmeldung zu warten
</template>
<template v-else>
Bankverbindung liegt mir vor
</template>
</label>
<label class="refund-choice">
<input type="radio" value="donation" v-model="refundForm.captureMode" />
Teilnehmer*in spendet den Betrag
</label> </label>
</div> </div>
<template v-if="refundForm.captureMode === 'management'"> <p v-if="refundForm.captureMode === 'donation'" class="refund-hint">
Der Betrag wird nicht ausgezahlt, sondern als Spende gebucht. Die Erstattung wird sofort
eingereicht; der Teili erhält den Beleg per E-Mail.
</p>
<!-- Bekanntes Konto: nichts einzugeben, es wird ohnehin dieses genommen. -->
<p v-if="refundForm.captureMode === 'management' && knownRefundAccount" class="refund-hint">
Die Erstattung wird sofort auf das oben genannte Konto eingereicht. Der Teili erhält den
Beleg per E-Mail, wird aber nicht mehr nach einer Spende gefragt.
</p>
<template v-if="refundForm.captureMode === 'management' && !knownRefundAccount">
<div class="refund-field"> <div class="refund-field">
<label for="refund_account_owner">Kontoinhaber*in</label> <label for="refund_account_owner">Kontoinhaber*in</label>
<input <input
@@ -819,6 +902,7 @@ function mailToGroup(groupKey) {
> >
<template v-if="refundSaving">Wird gespeichert</template> <template v-if="refundSaving">Wird gespeichert</template>
<template v-else-if="refundForm.captureMode === 'management'">Erstattung einreichen</template> <template v-else-if="refundForm.captureMode === 'management'">Erstattung einreichen</template>
<template v-else-if="refundForm.captureMode === 'donation'">Als Spende einreichen</template>
<template v-else>Erstattung freigeben</template> <template v-else>Erstattung freigeben</template>
</button> </button>
</Modal> </Modal>
@@ -842,6 +926,31 @@ function mailToGroup(groupKey) {
color: #4b5563; color: #4b5563;
} }
/* Anzeige, kein Feld: bewusst nicht wie ein Eingabeblock gesetzt, damit gar nicht erst der Eindruck
entsteht, hier ließe sich etwas ändern. */
.refund-known-account {
display: flex;
flex-direction: column;
gap: 2px;
margin-bottom: 12px;
padding: 10px 12px;
border: 1px solid #d1d5db;
border-radius: 6px;
background-color: #f9fafb;
font-size: 0.9rem;
}
.refund-known-account__iban {
font-family: monospace;
letter-spacing: 0.04em;
color: #4b5563;
}
.refund-known-account__source {
color: #6b7280;
font-size: 0.8rem;
}
.refund-field { .refund-field {
margin-bottom: 14px; margin-bottom: 14px;
} }
@@ -26,6 +26,18 @@ const paymentMethodConfigurations = reactive({})
const showOptionsModal = ref(false) const showOptionsModal = ref(false)
const optionsMethod = ref(null) const optionsMethod = ref(null)
/**
* Die Optionen, die pro Aktion eingefroren werden.
*
* Optionen mit `scope: 'tenant'` bleiben draußen: Sie gelten für den ganzen Mandanten. Das
* Kontoauszug-Format etwa beschreibt die Bank, nicht die Zusage an die Teilnehmenden — hier
* eingefroren ließe sich nach einem Bankwechsel für laufende Aktionen nichts mehr importieren.
* Der Server hält sich beim Speichern an dieselbe Regel.
*/
function eventOptions(method) {
return (method?.optionsSchema ?? []).filter(option => option.scope !== 'tenant')
}
function openOptions(method) { function openOptions(method) {
optionsMethod.value = method optionsMethod.value = method
showOptionsModal.value = true showOptionsModal.value = true
@@ -47,7 +59,7 @@ onMounted(async () => {
for (const method of availablePaymentMethods.value) { for (const method of availablePaymentMethods.value) {
const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {} const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {}
const config = {} const config = {}
for (const option of method.optionsSchema ?? []) { for (const option of eventOptions(method)) {
config[option.name] = source[option.name] ?? '' config[option.name] = source[option.name] ?? ''
} }
paymentMethodConfigurations[method.slug] = config paymentMethodConfigurations[method.slug] = config
@@ -358,7 +370,7 @@ onMounted(async () => {
paymentMethod.name paymentMethod.name
}}</label> }}</label>
<label <label
v-if="paymentMethods.includes(paymentMethod.slug) && (paymentMethod.optionsSchema?.length ?? 0) > 0" v-if="paymentMethods.includes(paymentMethod.slug) && eventOptions(paymentMethod).length > 0"
class="link" class="link"
style="padding-left: 15px; font-size: 10pt;" style="padding-left: 15px; font-size: 10pt;"
@click="openOptions(paymentMethod)" @click="openOptions(paymentMethod)"
@@ -381,7 +393,7 @@ onMounted(async () => {
width="700px" width="700px"
@close="showOptionsModal = false" @close="showOptionsModal = false"
> >
<div v-for="option in optionsMethod?.optionsSchema ?? []" :key="option.name" class="payment-method-config-row"> <div v-for="option in eventOptions(optionsMethod)" :key="option.name" class="payment-method-config-row">
<label>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></label> <label>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></label>
<RichSelectBox v-if="option.type === 'icon'" <RichSelectBox v-if="option.type === 'icon'"
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]" v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
@@ -0,0 +1,138 @@
<script setup>
import {computed} from 'vue'
import {useShortSignupForm} from './composables/useShortSignupForm.js'
import {
SHORT_STEP_PERSON,
SHORT_STEP_PARTICIPATION_OPTIONS,
SHORT_STEP_PHOTO,
SHORT_STEP_PAYMENT,
SHORT_STEP_SUMMARY,
stepVisible,
} from './composables/shortStepFlow.js'
import ShortStepPerson from './steps/ShortStepPerson.vue'
import ShortStepSummary from './steps/ShortStepSummary.vue'
import StepParticipationOptions from '../SignUpForm/steps/StepParticipationOptions.vue'
import StepPhotoPermissions from '../SignUpForm/steps/StepPhotoPermissions.vue'
import StepPaymentMethod from '../SignUpForm/steps/StepPaymentMethod.vue'
import SubmitSuccess from '../SignUpForm/after-submit/SubmitSuccess.vue'
import SubmitAlreadyExists from '../SignUpForm/after-submit/SubmitAlreadyExists.vue'
const props = defineProps({
event: Object,
participantData: Object,
})
const {
currentStep, goToStep, goNext, goBack, formData, isMinor, localGroups, needsLocalGroup,
submit, submitting, submitResult, submitError,
summaryLoading, summaryAmount, summaryAmountValue,
} = useShortSignupForm(props.event, props.participantData)
// Die aus dem langen Prozess übernommenen Schritte emittieren ihre Zielnummer aus jenem Flow mit. Hier zählt
// nur, dass "weiter" bzw. "zurück" gedrückt wurde -- die Reihenfolge kennt dieser Host.
const onNext = () => goNext()
const onBack = () => goBack()
const allSteps = [
{step: SHORT_STEP_PERSON, label: 'Person'},
{step: SHORT_STEP_PARTICIPATION_OPTIONS, label: 'Teilnahmeoptionen'},
{step: SHORT_STEP_PHOTO, label: 'Fotoerlaubnis'},
{step: SHORT_STEP_PAYMENT, label: 'Zahlungsart'},
{step: SHORT_STEP_SUMMARY, label: 'Zusammenfassung'},
]
// Nur die tatsächlich vorkommenden Schritte anzeigen, sonst zeigt die Leiste Schritte, die nie erscheinen.
const steps = computed(() =>
allSteps.filter(s => stepVisible(props.event, s.step, summaryAmountValue.value))
)
const currentIndex = computed(() => steps.value.findIndex(s => s.step === currentStep.value))
</script>
<template>
<div>
<!-- Nach Submit -->
<SubmitSuccess
v-if="submitResult?.status === 'success'"
:participant="submitResult?.participant"
:event="event"
/>
<SubmitAlreadyExists v-else-if="submitResult?.status === 'exists'" :event="event" />
<template v-else>
<!-- Fortschrittsleiste -->
<div class="signup-progress">
<div class="signup-progress-pills">
<template v-for="(s, index) in steps" :key="s.step">
<div v-if="index > 0" class="signup-progress-separator"></div>
<div
class="signup-pill"
:class="{
'signup-pill--active': currentStep === s.step,
'signup-pill--done': currentStep > s.step,
'signup-pill--upcoming': currentStep < s.step,
}"
@click="currentStep > s.step ? goToStep(s.step) : null"
>
<span v-if="currentStep > s.step" class="signup-pill__check"></span>
{{ s.label }}
</div>
</template>
</div>
<div class="signup-progress-bar">
<div
class="signup-progress-bar__fill"
:style="{ width: (steps.length > 1 ? (currentIndex / (steps.length - 1)) * 100 : 100) + '%' }"
></div>
</div>
<div class="signup-progress-mobile">
Schritt {{ currentIndex + 1 }} von {{ steps.length }}:
<strong>{{ steps.find(s => s.step === currentStep)?.label }}</strong>
</div>
</div>
<!-- Steps -->
<form @submit.prevent="submit">
<ShortStepPerson
v-if="currentStep === SHORT_STEP_PERSON"
:formData="formData" :event="event" :isMinor="isMinor"
:localGroups="localGroups" :needsLocalGroup="needsLocalGroup"
@next="onNext"
/>
<StepParticipationOptions
v-if="currentStep === SHORT_STEP_PARTICIPATION_OPTIONS"
:formData="formData" :event="event"
@next="onNext" @back="onBack"
/>
<StepPhotoPermissions
v-if="currentStep === SHORT_STEP_PHOTO"
:formData="formData" :event="event"
@next="onNext" @back="onBack"
/>
<StepPaymentMethod
v-if="currentStep === SHORT_STEP_PAYMENT"
:formData="formData" :event="event"
@next="onNext" @back="onBack"
/>
<ShortStepSummary
v-if="currentStep === SHORT_STEP_SUMMARY"
:formData="formData"
:event="event"
:isMinor="isMinor"
:summaryAmount="summaryAmount"
:summaryAmountValue="summaryAmountValue"
:summaryLoading="summaryLoading"
:submitting="submitting"
:submitError="submitError"
@back="onBack"
@submit="submit"
/>
</form>
</template>
</div>
</template>
<!-- Unscoped und mit dem langen Anmeldeprozess geteilt. -->
<style src="../SignUpForm/signupForm.css"></style>
@@ -0,0 +1,37 @@
// Schrittreihenfolge der Kurzanmeldung. Zwei Schritte sind optional: die Teilnahmeoptionen entfallen, wenn für
// die Veranstaltung keine definiert sind, die Zahlungsart entfällt bei Betrag 0 oder wenn es ohnehin nur eine
// Zahlungsart gibt (die wird dann vorausgewählt).
export const SHORT_STEP_PERSON = 1
export const SHORT_STEP_PARTICIPATION_OPTIONS = 2
export const SHORT_STEP_PHOTO = 3
export const SHORT_STEP_PAYMENT = 4
export const SHORT_STEP_SUMMARY = 5
export function stepVisible(event, step, amountValue) {
if (step === SHORT_STEP_PARTICIPATION_OPTIONS) {
return (event.participationOptions?.length ?? 0) > 0
}
if (step === SHORT_STEP_PAYMENT) {
const activeMethods = (event.paymentMethods ?? []).filter(m => m.active)
return amountValue > 0 && activeMethods.length > 1
}
return true
}
export function nextVisibleFrom(event, step, amountValue) {
let candidate = step + 1
while (candidate < SHORT_STEP_SUMMARY && !stepVisible(event, candidate, amountValue)) {
candidate++
}
return candidate
}
export function prevVisibleFrom(event, step, amountValue) {
let candidate = step - 1
while (candidate > SHORT_STEP_PERSON && !stepVisible(event, candidate, amountValue)) {
candidate--
}
return candidate
}
@@ -0,0 +1,155 @@
import {computed, reactive, ref} from 'vue'
import axios from 'axios'
import {differenceInYears, parseISO} from 'date-fns'
import {SHORT_STEP_PERSON, nextVisibleFrom, prevVisibleFrom} from './shortStepFlow.js'
export function useShortSignupForm(event, participantData) {
const currentStep = ref(SHORT_STEP_PERSON)
const submitting = ref(false)
const summaryLoading = ref(false)
const submitResult = ref(null) // null | { status: 'success'|'exists', participant: {} }
const submitError = ref('')
// Gibt es nur eine Zahlungsart, wird sie vorausgewählt und der Zahlungsschritt entfällt.
const activeMethods = (event.paymentMethods ?? []).filter(m => m.active)
// Bei genau einem teilnehmenden Stamm wird dieser gesetzt, ohne danach zu fragen; erst ab zwei
// Stämmen erscheint das Auswahlfeld.
const localGroups = event.contributingLocalGroups ?? []
const needsLocalGroup = localGroups.length > 1
const formData = reactive({
userId: participantData.id,
vorname: participantData.firstname ?? '',
nachname: participantData.lastname ?? '',
pfadiname: participantData.nickname ?? '',
geburtsdatum: participantData.birthday ?? '',
email_1: participantData.email ?? '',
telefon_1: participantData.phone ?? '',
localGroup: localGroups.length === 1 ? localGroups[0].id : (participantData.localGroup ?? '-1'),
ansprechpartner: '',
email_2: '',
allergien: participantData.allergies ?? '',
intolerances: participantData.intolerances ?? '',
first_aid: '-1',
badeerlaubnis: '-1',
// Antworten auf die event-spezifischen Teilnahmeoptionen: { [question.key]: option.value }
participationOptions: {},
foto: {socialmedia: false, print: false, webseite: false, partner: false, intern: false},
paymentMethod: activeMethods.length === 1 ? activeMethods[0].slug : null,
paymentOptions: {},
summary_information_correct: false,
summary_accept_terms: false,
legal_accepted: false,
payment: false,
})
// Minderjährigkeit steuert Kontaktperson, Erweiterte Erste Hilfe und Badeerlaubnis. Die Grenze von 18 Jahren
// entspricht Age::isfullAged() im Backend.
const isMinor = computed(() => {
if (!formData.geburtsdatum) {
return false
}
return differenceInYears(new Date(), parseISO(formData.geburtsdatum)) < 18
})
const summaryAmount = ref('')
const summaryAmountValue = ref(0)
const amountLoaded = ref(false)
// Der Betrag steht für die ganze Anmeldung fest (feste Teilnahmegruppe, fester Zeitraum) und wird deshalb
// genau einmal geholt. Er entscheidet, ob der Zahlungsschritt überhaupt vorkommt.
const ensureAmount = async () => {
if (amountLoaded.value) {
return
}
summaryLoading.value = true
try {
const res = await axios.post('/api/v1/event/' + event.id + '/short-calculate-amount')
summaryAmount.value = res.data.amount
summaryAmountValue.value = Number(res.data.amountValue ?? 0)
amountLoaded.value = true
if (summaryAmountValue.value <= 0) {
formData.paymentMethod = null
formData.paymentOptions = {}
}
} finally {
summaryLoading.value = false
}
}
const goToStep = (step) => {
currentStep.value = step
}
const goNext = async () => {
await ensureAmount()
goToStep(nextVisibleFrom(event, currentStep.value, summaryAmountValue.value))
}
const goBack = async () => {
await ensureAmount()
goToStep(prevVisibleFrom(event, currentStep.value, summaryAmountValue.value))
}
const submit = async () => {
if (!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted) {
return
}
submitting.value = true
submitError.value = ''
try {
const res = await axios.post('/api/v1/event/' + event.id + '/short-signup', {
firstname: formData.vorname,
lastname: formData.nachname,
nickname: formData.pfadiname || null,
birthday: formData.geburtsdatum,
email: formData.email_1,
phone: formData.telefon_1,
localGroup: formData.localGroup !== '-1' ? formData.localGroup : null,
contactPerson: isMinor.value ? formData.ansprechpartner : null,
contactEmail: isMinor.value ? formData.email_2 : null,
allergies: formData.allergien || null,
intolerances: formData.intolerances || null,
firstAidPermission: isMinor.value && formData.first_aid !== '-1' ? formData.first_aid : null,
swimmingPermission: isMinor.value && formData.badeerlaubnis !== '-1' ? formData.badeerlaubnis : null,
foto: formData.foto,
participationOptions: formData.participationOptions,
paymentMethod: formData.paymentMethod,
paymentOptions: formData.paymentOptions,
})
submitResult.value = {
status: res.data.status,
participant: res.data.participant,
}
} catch (error) {
submitError.value = error.response?.data?.message
?? 'Die Anmeldung konnte nicht gespeichert werden. Bitte versuche es später erneut.'
} finally {
submitting.value = false
}
}
return {
currentStep,
goToStep,
goNext,
goBack,
formData,
isMinor,
localGroups,
needsLocalGroup,
submit,
submitting,
submitResult,
submitError,
summaryLoading,
summaryAmount,
summaryAmountValue,
ensureAmount,
}
}
@@ -0,0 +1,218 @@
<script setup>
import ErrorText from "../../../../../../Views/Components/ErrorText.vue";
import {reactive} from "vue";
const props = defineProps({
formData: Object,
event: Object,
isMinor: Boolean,
localGroups: {type: Array, default: () => []},
needsLocalGroup: Boolean,
})
const emit = defineEmits(['next'])
const errors = reactive({
vorname: '',
nachname: '',
geburtsdatum: '',
localGroup: '',
email_1: '',
telefon_1: '',
ansprechpartner: '',
email_2: '',
first_aid: '',
badeerlaubnis: '',
})
// Nur sichtbare Felder werden geprüft -- Kontaktperson und Erlaubnisse gibt es bei Volljährigen nicht.
const next = () => {
Object.keys(errors).forEach(key => errors[key] = '')
let hasError = false
if (!props.formData.vorname) {
errors.vorname = 'Bitte einen Vornamen angeben.'
hasError = true
}
if (!props.formData.nachname) {
errors.nachname = 'Bitte einen Nachnamen angeben.'
hasError = true
}
if (!props.formData.geburtsdatum) {
errors.geburtsdatum = 'Bitte ein Geburtsdatum angeben.'
hasError = true
}
if (props.needsLocalGroup && (!props.formData.localGroup || props.formData.localGroup === '-1')) {
errors.localGroup = 'Bitte einen Stamm auswählen.'
hasError = true
}
if (!props.formData.email_1) {
errors.email_1 = 'Bitte eine E-Mail-Adresse angeben.'
hasError = true
}
if (!props.formData.telefon_1) {
errors.telefon_1 = 'Bitte eine Telefonnummer angeben.'
hasError = true
}
if (props.isMinor) {
if (!props.formData.ansprechpartner) {
errors.ansprechpartner = 'Bitte eine Kontaktperson angeben.'
hasError = true
}
if (!props.formData.email_2) {
errors.email_2 = 'Bitte eine E-Mail-Adresse der Kontaktperson angeben.'
hasError = true
}
if (props.formData.first_aid === '-1') {
errors.first_aid = 'Bitte triff eine Entscheidung. Bist du dir unsicher, kontaktiere bitte die Aktionsleitung.'
hasError = true
}
if (props.event.swimmingPermissionRequired && props.formData.badeerlaubnis === '-1') {
errors.badeerlaubnis = 'Bitte triff eine Entscheidung. Bist du dir unsicher, kontaktiere bitte die Aktionsleitung.'
hasError = true
}
}
if (hasError) {
return
}
emit('next')
}
</script>
<template>
<div>
<h3>Angaben zur Person</h3>
<table class="form-table">
<tr>
<td>Vorname:</td>
<td>
<input type="text" v-model="formData.vorname" />
<ErrorText :message="errors.vorname" />
</td>
</tr>
<tr>
<td>Pfadiname:</td>
<td>
<input type="text" v-model="formData.pfadiname" />
</td>
</tr>
<tr>
<td>Nachname:</td>
<td>
<input type="text" v-model="formData.nachname" />
<ErrorText :message="errors.nachname" />
</td>
</tr>
<tr>
<td>Geburtsdatum:</td>
<td>
<input type="date" v-model="formData.geburtsdatum" />
<ErrorText :message="errors.geburtsdatum" />
</td>
</tr>
<tr v-if="needsLocalGroup">
<td>Stamm:</td>
<td>
<select v-model="formData.localGroup">
<option value="-1">Bitte wählen</option>
<option v-for="group in localGroups" :key="group.id" :value="group.id">{{ group.name }}</option>
</select>
<ErrorText :message="errors.localGroup" />
</td>
</tr>
<tr>
<td>E-Mail:</td>
<td>
<input type="email" v-model="formData.email_1" />
<ErrorText :message="errors.email_1" />
</td>
</tr>
<tr>
<td>Telefon:</td>
<td>
<input type="text" v-model="formData.telefon_1" />
<ErrorText :message="errors.telefon_1" />
</td>
</tr>
<template v-if="isMinor">
<tr>
<td>Kontaktperson (Nachname, Vorname):</td>
<td>
<input type="text" v-model="formData.ansprechpartner" />
<ErrorText :message="errors.ansprechpartner" />
</td>
</tr>
<tr>
<td>E-Mail der Kontaktperson:</td>
<td>
<input type="email" v-model="formData.email_2" />
<ErrorText :message="errors.email_2" />
</td>
</tr>
</template>
<tr>
<td>Allergien:</td>
<td>
<input type="text" v-model="formData.allergien" />
</td>
</tr>
<tr>
<td>Unverträglichkeiten:</td>
<td>
<input type="text" v-model="formData.intolerances" />
</td>
</tr>
<template v-if="isMinor">
<tr>
<td>Erweiterte Erste Hilfe erlaubt:</td>
<td>
<select v-model="formData.first_aid">
<option value="-1">Bitte wählen</option>
<option
v-for="firstAidPermission in event.firstAidPermissions"
:key="firstAidPermission.slug"
:value="firstAidPermission.slug">{{ firstAidPermission.name }}</option>
</select><br />
<span style="font-size: 0.8rem; color: #6b7280;">
Nicht dringend-notwendige Erste-Hilfe-Maßnahmen, beinhaltet das Entfernen von Zecken und Splittern sowie das Kleben von Pflastern.
</span>
<ErrorText :message="errors.first_aid" />
</td>
</tr>
<tr v-if="event.swimmingPermissionRequired">
<td>Badeerlaubnis:</td>
<td>
<select v-model="formData.badeerlaubnis">
<option value="-1">Bitte wählen</option>
<option
v-for="swimmingPermission in event.swimmingPermissions"
:key="swimmingPermission.slug"
:value="swimmingPermission.slug">{{ swimmingPermission.name }}</option>
</select>
<ErrorText :message="errors.badeerlaubnis" />
</td>
</tr>
</template>
<tr>
<td colspan="2" class="btn-row">
<button type="button" class="btn-primary" @click="next">Weiter </button>
</td>
</tr>
</table>
</div>
</template>
@@ -0,0 +1,187 @@
<script setup>
import {computed} from "vue";
const PAYMENT_ACCOUNT_TRANSACTION = 'PAYMENT_ACCOUNT_TRANSACTION'
const props = defineProps({
formData: Object,
event: Object,
isMinor: Boolean,
summaryAmount: String,
summaryAmountValue: {type: Number, default: 0},
summaryLoading: Boolean,
submitting: Boolean,
submitError: {type: String, default: ''},
})
const emit = defineEmits(['back', 'submit'])
const selectedMethod = computed(() =>
(props.event.paymentMethods ?? []).find(m => m.slug === props.formData.paymentMethod) ?? null
)
// Die Überweisungs-Bestätigung wird nur bei Banküberweisung verlangt.
const requiresPaymentConfirmation = computed(() =>
props.formData.paymentMethod === PAYMENT_ACCOUNT_TRANSACTION
)
// Bestätigungstext ist ein admin-konfigurierbarer Freitext ({amount}-Platzhalter), sonst Default.
const paymentConfirmationText = computed(() => {
const configured = selectedMethod.value?.configuration?.summary_confirmation_text
const template = (configured && String(configured).trim() !== '')
? configured
: 'Ich bestätige, den Betrag von {amount} zu überweisen.'
return template.replaceAll('{amount}', props.summaryAmount ?? '')
})
// Gewählte Teilnahmeoptionen für die Zusammenfassung (Label statt Wert anzeigen).
const selectedParticipationOptions = computed(() =>
(props.event.participationOptions ?? []).map(question => {
const value = props.formData.participationOptions[question.key]
const option = (question.options ?? []).find(o => o.value === value)
return {label: question.title || question.label, value: option?.label ?? ''}
}).filter(entry => entry.value !== '')
)
// Der Stamm steht entweder fest (genau ein teilnehmender Stamm) oder wurde auf Seite 1 gewählt.
const localGroupName = computed(() =>
(props.event.contributingLocalGroups ?? []).find(g => g.id === props.formData.localGroup)?.name ?? null
)
const permissionName = (list, slug) =>
(list ?? []).find(entry => entry.slug === slug)?.name ?? '—'
const canSubmit = computed(() =>
props.formData.summary_information_correct
&& props.formData.summary_accept_terms
&& props.formData.legal_accepted
&& (!requiresPaymentConfirmation.value || props.formData.payment)
&& !props.submitting
)
</script>
<template>
<div>
<h3>Zusammenfassung</h3>
<div v-if="summaryLoading" style="color: #6b7280; padding: 20px 0;">Wird geladen</div>
<div v-else>
<table class="form-table" style="margin-bottom: 20px;">
<tr>
<td>Dein Name:</td>
<td>{{ formData.vorname }} {{ formData.nachname }}</td>
</tr>
<tr v-if="formData.pfadiname">
<td>Pfadiname:</td>
<td>{{ formData.pfadiname }}</td>
</tr>
<tr>
<td>Deine E-Mail:</td>
<td>{{ formData.email_1 }}</td>
</tr>
<tr>
<td>Deine Telefonnummer:</td>
<td>{{ formData.telefon_1 }}</td>
</tr>
<tr v-if="localGroupName">
<td>Stamm:</td>
<td>{{ localGroupName }}</td>
</tr>
<template v-if="isMinor">
<tr>
<td>Kontaktperson:</td>
<td>{{ formData.ansprechpartner }}</td>
</tr>
<tr>
<td>E-Mail der Kontaktperson:</td>
<td>{{ formData.email_2 }}</td>
</tr>
<tr>
<td>Erweiterte Erste Hilfe:</td>
<td>{{ permissionName(event.firstAidPermissions, formData.first_aid) }}</td>
</tr>
<tr v-if="event.swimmingPermissionRequired">
<td>Badeerlaubnis:</td>
<td>{{ permissionName(event.swimmingPermissions, formData.badeerlaubnis) }}</td>
</tr>
</template>
<tr>
<td>Allergien:</td>
<td>{{ formData.allergien || 'Keine Angabe' }}</td>
</tr>
<tr>
<td>Unverträglichkeiten:</td>
<td>{{ formData.intolerances || 'Keine Angabe' }}</td>
</tr>
<tr v-for="option in selectedParticipationOptions" :key="option.label">
<td>{{ option.label }}:</td>
<td>{{ option.value }}</td>
</tr>
<tr>
<td>Foto-Erlaubnis:</td>
<td>
<strong>Social Media:</strong> {{ formData.foto.socialmedia ? 'Ja' : 'Nein' }},
<strong>Printmedien:</strong> {{ formData.foto.print ? 'Ja' : 'Nein' }},
<strong>Webseite:</strong> {{ formData.foto.webseite ? 'Ja' : 'Nein' }},
<strong>Partnerorganisationen:</strong> {{ formData.foto.partner ? 'Ja' : 'Nein' }},
<strong>Interne Zwecke:</strong> {{ formData.foto.intern ? 'Ja' : 'Nein' }}
</td>
</tr>
<tr><td>Veranstaltung:</td><td><strong>{{ event.name }}</strong></td></tr>
<tr><td>Zeitraum:</td><td>{{ event.eventBegin }} {{ event.eventEnd }}</td></tr>
</table>
<h4 style="margin: 0 0 8px 0;">Kostenübersicht</h4>
<table class="form-table cost-table" style="margin-bottom: 20px;">
<tr class="cost-total">
<td><strong>Teilnahmebeitrag:</strong></td>
<td><strong>{{ summaryAmount }}</strong></td>
</tr>
</table>
<div style="display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;">
<label style="display: flex; gap: 10px; cursor: pointer;">
<input type="checkbox" v-model="formData.summary_information_correct" />
Ich bestätige, dass alle Angaben korrekt sind.
</label>
<label style="display: flex; gap: 10px; cursor: pointer;">
<input type="checkbox" v-model="formData.summary_accept_terms" />
Ich akzeptiere die Teilnahmebedingungen.
</label>
<label style="display: flex; gap: 10px; cursor: pointer;">
<input type="checkbox" v-model="formData.legal_accepted" />
Ich stimme der Datenschutzerklärung zu.
</label>
<label v-if="requiresPaymentConfirmation" style="display: flex; gap: 10px; cursor: pointer;">
<input type="checkbox" v-model="formData.payment" />
{{ paymentConfirmationText }}
</label>
</div>
<p v-if="submitError" style="color: #991b1b; font-weight: 600;">{{ submitError }}</p>
<div class="btn-row">
<button type="button" class="btn-secondary" @click="emit('back')"> Zurück</button>
<button
type="submit"
class="btn-primary"
:disabled="!canSubmit"
style="background: #059669;"
>
{{ submitting ? 'Wird gesendet…' : 'Jetzt anmelden ✓' }}
</button>
</div>
</div>
</div>
</template>
<style scoped>
.cost-table .cost-total td {
border-top: 1px solid #d1d5db;
padding-top: 8px;
}
</style>
@@ -122,170 +122,5 @@ const steps = [
</div> </div>
</template> </template>
<style> <!-- Unscoped und mit der Kurzanmeldung geteilt (ShortSignupForm.vue bindet dieselbe Datei ein). -->
/* ─── Progress (Step-Pills) ─── */ <style src="./signupForm.css"></style>
.signup-progress {
margin-bottom: 28px;
}
.signup-progress-pills {
display: flex;
gap: 6px;
flex-wrap: wrap;
align-items: center;
}
.signup-progress-separator {
flex-shrink: 0;
width: 16px;
height: 2px;
background: #e5e7eb;
border-radius: 1px;
}
.signup-pill {
padding: 5px 14px;
border-radius: 999px;
font-size: 0.78rem;
font-weight: 600;
white-space: nowrap;
border: 2px solid;
cursor: default;
}
.signup-pill__check { margin-right: 4px; }
.signup-pill--active {
border-color: #2563eb;
background: #2563eb;
color: white;
}
.signup-pill--done {
border-color: #bbf7d0;
background: #f0fdf4;
color: #15803d;
cursor: pointer;
}
.signup-pill--upcoming {
border-color: #e5e7eb;
background: #f9fafb;
color: #9ca3af;
}
.signup-progress-bar {
margin-top: 10px;
height: 3px;
background: #e5e7eb;
border-radius: 2px;
overflow: hidden;
}
.signup-progress-bar__fill {
height: 100%;
background: linear-gradient(90deg, #2563eb, #3b82f6);
border-radius: 2px;
transition: width 0.3s ease;
}
.signup-progress-mobile {
display: none;
margin-top: 8px;
font-size: 0.9rem;
color: #374151;
}
/* ─── Form-Table ─── */
.form-table { width: 100%; border-collapse: collapse; }
.form-table td { padding: 8px 12px 8px 0; vertical-align: top; }
.form-table td:first-child { width: 220px; color: #374151; font-weight: 500; }
.form-table input[type="text"],
.form-table input[type="date"],
.form-table input[type="email"],
.form-table input[type="number"],
.form-table select,
.form-table textarea {
width: 100%;
padding: 6px 10px;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 0.95rem;
box-sizing: border-box;
}
.btn-row { display: flex; gap: 10px; padding-top: 16px; flex-wrap: wrap; }
.btn-primary {
padding: 8px 20px;
background: #2563eb;
color: white;
border: none;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
padding: 8px 20px;
background: #f3f4f6;
color: #374151;
border: 1px solid #d1d5db;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
}
/* ─── Tablet ─── */
@media (max-width: 1023px) {
.form-table td:first-child {
width: 160px;
}
}
/* ─── Smartphone ─── */
@media (max-width: 639px) {
/* Pills auf Mobile: kompakter, Trennstriche ausblenden */
.signup-progress-pills {
display: none;
}
.signup-progress-mobile {
display: block;
}
/* Form-Table: Label oberhalb des Feldes */
.form-table,
.form-table tbody,
.form-table tr {
display: block;
width: 100%;
}
.form-table td {
display: block;
width: 100% !important;
padding: 4px 0;
}
.form-table td:first-child {
width: 100% !important;
font-weight: 600;
color: #374151;
padding-top: 10px;
}
.form-table td[colspan] {
width: 100% !important;
}
.btn-row {
flex-direction: column-reverse;
gap: 8px;
}
.btn-primary,
.btn-secondary {
width: 100%;
padding: 12px 20px;
}
}
</style>
@@ -0,0 +1,167 @@
/* Geteilte Styles der Anmelde-Wizards (langer Prozess und Kurzanmeldung). */
/* ─── Progress (Step-Pills) ─── */
.signup-progress {
margin-bottom: 28px;
}
.signup-progress-pills {
display: flex;
gap: 6px;
flex-wrap: wrap;
align-items: center;
}
.signup-progress-separator {
flex-shrink: 0;
width: 16px;
height: 2px;
background: #e5e7eb;
border-radius: 1px;
}
.signup-pill {
padding: 5px 14px;
border-radius: 999px;
font-size: 0.78rem;
font-weight: 600;
white-space: nowrap;
border: 2px solid;
cursor: default;
}
.signup-pill__check { margin-right: 4px; }
.signup-pill--active {
border-color: #2563eb;
background: #2563eb;
color: white;
}
.signup-pill--done {
border-color: #bbf7d0;
background: #f0fdf4;
color: #15803d;
cursor: pointer;
}
.signup-pill--upcoming {
border-color: #e5e7eb;
background: #f9fafb;
color: #9ca3af;
}
.signup-progress-bar {
margin-top: 10px;
height: 3px;
background: #e5e7eb;
border-radius: 2px;
overflow: hidden;
}
.signup-progress-bar__fill {
height: 100%;
background: linear-gradient(90deg, #2563eb, #3b82f6);
border-radius: 2px;
transition: width 0.3s ease;
}
.signup-progress-mobile {
display: none;
margin-top: 8px;
font-size: 0.9rem;
color: #374151;
}
/* ─── Form-Table ─── */
.form-table { width: 100%; border-collapse: collapse; }
.form-table td { padding: 8px 12px 8px 0; vertical-align: top; }
.form-table td:first-child { width: 220px; color: #374151; font-weight: 500; }
.form-table input[type="text"],
.form-table input[type="date"],
.form-table input[type="email"],
.form-table input[type="number"],
.form-table select,
.form-table textarea {
width: 100%;
padding: 6px 10px;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 0.95rem;
box-sizing: border-box;
}
.btn-row { display: flex; gap: 10px; padding-top: 16px; flex-wrap: wrap; }
.btn-primary {
padding: 8px 20px;
background: #2563eb;
color: white;
border: none;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
padding: 8px 20px;
background: #f3f4f6;
color: #374151;
border: 1px solid #d1d5db;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
}
/* ─── Tablet ─── */
@media (max-width: 1023px) {
.form-table td:first-child {
width: 160px;
}
}
/* ─── Smartphone ─── */
@media (max-width: 639px) {
/* Pills auf Mobile: kompakter, Trennstriche ausblenden */
.signup-progress-pills {
display: none;
}
.signup-progress-mobile {
display: block;
}
/* Form-Table: Label oberhalb des Feldes */
.form-table,
.form-table tbody,
.form-table tr {
display: block;
width: 100%;
}
.form-table td {
display: block;
width: 100% !important;
padding: 4px 0;
}
.form-table td:first-child {
width: 100% !important;
font-weight: 600;
color: #374151;
padding-top: 10px;
}
.form-table td[colspan] {
width: 100% !important;
}
.btn-row {
flex-direction: column-reverse;
gap: 8px;
}
.btn-primary,
.btn-secondary {
width: 100%;
padding: 12px 20px;
}
}
@@ -42,7 +42,7 @@ const next = () => {
hasError = true hasError = true
} }
if (props.formData.badeerlaubnis === '-1') { if (props.event.swimmingPermissionRequired && props.formData.badeerlaubnis === '-1') {
errors.badeerlaubnis = 'Bitte triff eine Entscheidung. Bist du dir unsicher, kontaktiere bitte die Aktionsleitung' errors.badeerlaubnis = 'Bitte triff eine Entscheidung. Bist du dir unsicher, kontaktiere bitte die Aktionsleitung'
hasError = true hasError = true
} }
@@ -86,7 +86,7 @@ const next = () => {
<ErrorText :message="errors.email_2" /> <ErrorText :message="errors.email_2" />
</td> </td>
</tr> </tr>
<tr> <tr v-if="event.swimmingPermissionRequired">
<td>Badeerlaubnis:</td> <td>Badeerlaubnis:</td>
<td> <td>
<select v-model="formData.badeerlaubnis"> <select v-model="formData.badeerlaubnis">
+9 -3
View File
@@ -3,6 +3,7 @@
import AppLayout from "../../../../resources/js/layouts/AppLayout.vue"; import AppLayout from "../../../../resources/js/layouts/AppLayout.vue";
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue"; import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
import SignupForm from './Partials/SignUpForm/SignupForm.vue' import SignupForm from './Partials/SignUpForm/SignupForm.vue'
import ShortSignupForm from './Partials/ShortSignUpForm/ShortSignupForm.vue'
import FullScreenModal from "../../../Views/Components/FullScreenModal.vue"; import FullScreenModal from "../../../Views/Components/FullScreenModal.vue";
import AvailableEvents from "./Partials/AvailableEvents.vue"; import AvailableEvents from "./Partials/AvailableEvents.vue";
import {ref} from "vue"; import {ref} from "vue";
@@ -37,7 +38,7 @@ function close() {
</span> </span>
</div> </div>
<p class="signup-event-location"> <p class="signup-event-location">
📍 {{ props.event.postalCode }} {{ props.event.location }} 📍 {{ props.event.fullAddress }}
</p> </p>
</div> </div>
<div v-else class="signup-header signup-header--closed"> <div v-else class="signup-header signup-header--closed">
@@ -48,7 +49,7 @@ function close() {
</span> </span>
</div> </div>
<p class="signup-event-location"> <p class="signup-event-location">
📍 {{ props.event.postalCode }} {{ props.event.location }} 📍 {{ props.event.fullAddress }}
</p> </p>
</div> </div>
@@ -98,8 +99,13 @@ function close() {
<hr class="signup-divider" /> <hr class="signup-divider" />
<div class="signup-body"> <div class="signup-body">
<ShortSignupForm
v-if="props.event.registrationAllowed && props.event.shortRegistration"
:event="props.event"
:participantData="props.participantData ?? {}"
/>
<SignupForm <SignupForm
v-if="props.event.registrationAllowed" v-else-if="props.event.registrationAllowed"
:event="props.event" :event="props.event"
:participantData="props.participantData ?? {}" :participantData="props.participantData ?? {}"
:localGroups="props.localGroups ?? []" :localGroups="props.localGroups ?? []"
@@ -22,7 +22,7 @@ class ChangeStatusCommand {
switch ($this->request->status) { switch ($this->request->status) {
case InvoiceStatus::INVOICE_STATUS_APPROVED: case InvoiceStatus::INVOICE_STATUS_APPROVED:
$this->request->invoice->status = InvoiceStatus::INVOICE_STATUS_APPROVED; $this->request->invoice->status = InvoiceStatus::INVOICE_STATUS_APPROVED;
$this->request->invoice->approved_by = auth()->user()->id; $this->request->invoice->approved_by = currentUserOrFail()->id;
$this->request->invoice->approved_at = now(); $this->request->invoice->approved_at = now();
if ($this->request->invoice->contact_email !== null) { if ($this->request->invoice->contact_email !== null) {
@@ -35,7 +35,7 @@ class ChangeStatusCommand {
case InvoiceStatus::INVOICE_STATUS_DENIED: case InvoiceStatus::INVOICE_STATUS_DENIED:
$this->request->invoice->status = InvoiceStatus::INVOICE_STATUS_DENIED; $this->request->invoice->status = InvoiceStatus::INVOICE_STATUS_DENIED;
$this->request->invoice->denied_by = auth()->user()->id; $this->request->invoice->denied_by = currentUserOrFail()->id;
$this->request->invoice->denied_at = now(); $this->request->invoice->denied_at = now();
$this->request->invoice->denied_reason = $this->request->comment; $this->request->invoice->denied_reason = $this->request->comment;
if ($this->request->invoice->contact_email !== null) { if ($this->request->invoice->contact_email !== null) {
@@ -3,6 +3,8 @@
namespace App\Domains\Invoice\Actions\CreateInvoice; namespace App\Domains\Invoice\Actions\CreateInvoice;
use App\Enumerations\InvoiceStatus; use App\Enumerations\InvoiceStatus;
use App\Enumerations\InvoiceType;
use App\Enumerations\TravelReason;
use App\Mail\InvoiceMails\InvoiceMailsNewInvoiceMail; use App\Mail\InvoiceMails\InvoiceMailsNewInvoiceMail;
use App\Mail\InvoiceMails\InvoiceMailsSubmittedConfirmationMail; use App\Mail\InvoiceMails\InvoiceMailsSubmittedConfirmationMail;
use App\Mail\ParticipantParticipationMails\EventSignUpSuccessfullMail; use App\Mail\ParticipantParticipationMails\EventSignUpSuccessfullMail;
@@ -19,17 +21,27 @@ class CreateInvoiceCommand {
public function execute() : CreateInvoiceResponse { public function execute() : CreateInvoiceResponse {
$response = new CreateInvoiceResponse(); $response = new CreateInvoiceResponse();
$rejection = $this->rejectTravelReason();
if ($rejection !== null) {
$response->message = $rejection;
return $response;
}
if ($this->request->accountIban === 'undefined') { if ($this->request->accountIban === 'undefined') {
$this->request->accountIban = null; $this->request->accountIban = null;
} }
$travelReason = $this->travelReason();
$invoice = Invoice::create([ $invoice = Invoice::create([
'tenant' => app('tenant')->slug, 'tenant' => currentTenant()->slug,
'cost_unit_id' => $this->request->costUnit->id, 'cost_unit_id' => $this->request->costUnit->id,
'invoice_number' => $this->generateInvoiceNumber(), 'invoice_number' => $this->generateInvoiceNumber(),
'status' => InvoiceStatus::INVOICE_STATUS_NEW, 'status' => InvoiceStatus::INVOICE_STATUS_NEW,
'type' => $this->request->invoiceType, 'type' => $this->request->invoiceType,
'type_other' => $this->request->invoiceTypeExtended, 'type_other' => $this->request->invoiceTypeExtended,
'purpose' => $this->purpose($travelReason),
'donation' => $this->request->isDonation, 'donation' => $this->request->isDonation,
'user_id' => $this->request->paymentPurpose === null ? $this->request->userId : null, 'user_id' => $this->request->paymentPurpose === null ? $this->request->userId : null,
'contact_name' => $this->request->contactName, 'contact_name' => $this->request->contactName,
@@ -40,9 +52,7 @@ class CreateInvoiceCommand {
'amount' => $this->request->totalAmount, 'amount' => $this->request->totalAmount,
'distance' => $this->request->distance, 'distance' => $this->request->distance,
'travel_direction' => $this->request->travelRoute, 'travel_direction' => $this->request->travelRoute,
'travel_reason' => $this->request->travelReason, 'travel_reason' => $travelReason,
'passengers' => $this->request->passengers,
'transportation' => $this->request->transportations,
'payment_purpose' => $this->request->paymentPurpose, 'payment_purpose' => $this->request->paymentPurpose,
'comment' => $this->request->notices, 'comment' => $this->request->notices,
'document_filename' => $this->request->receiptFile !== null ? $this->request->receiptFile->fullPath : null, 'document_filename' => $this->request->receiptFile !== null ? $this->request->receiptFile->fullPath : null,
@@ -61,7 +71,7 @@ class CreateInvoiceCommand {
} }
if ($this->request->costUnit->mail_on_new) { if ($this->request->costUnit->mail_on_new) {
$recipients = [app('tenant')->email_finance]; $recipients = [currentTenant()->email_finance];
foreach ($this->request->costUnit->treasurers()->get() as $treasurer) { foreach ($this->request->costUnit->treasurers()->get() as $treasurer) {
if (!in_array($treasurer->email, $recipients)) { if (!in_array($treasurer->email, $recipients)) {
@@ -81,9 +91,71 @@ class CreateInvoiceCommand {
} }
/**
* Der Zahlungsgrund, einmal beim Anlegen festgehalten.
*
* Danach ist er eine eigene Angabe: Die Kassenwart*in kann ihn korrigieren, und nichts schreibt ihn
* mehr um. Bei Fahrtkosten setzt er sich aus Reisegrund und den gefahrenen Personen zusammen, sonst
* trägt ihn "Was wurde eingekauft". Wo nichts erfasst wird -- Beitragserstattungen -- bleibt er leer.
*
* Steht er schon fest, wird er übernommen: Eine Abrechnungskorrektur kopiert den Beleg, und ein von
* Hand gesetzter Grund darf dabei nicht verloren gehen.
*/
private function purpose(?string $travelReason) : ?string {
if (trim((string) $this->request->purpose) !== '') {
return $this->request->purpose;
}
$purpose = Invoice::joinPurposeParts(
$this->request->invoiceType === InvoiceType::INVOICE_TYPE_TRAVELLING
// Der Name des Grundes, nicht sein Schlüssel: In der Belegliste soll "Materialtransport"
// stehen, nicht "material_transport".
? [TravelReason::text($travelReason), $this->request->travellers]
: [$this->request->invoiceTypeExtended]
);
return $purpose === '' ? null : $purpose;
}
/**
* Was in `travel_reason` landet: der Schlüssel des gewählten Grundes -- oder, bei "Anderer Grund",
* der Text selbst. Der Schlüssel `other` sagt für sich nichts aus, der Text alles.
*
* Ein unbekannter Wert ist deshalb kein Fehler, sondern genau dieser Fall: So kommen auch
* Bestandsbelege und Kopien durch, die ihren Freitext schon mitbringen.
*/
private function travelReason() : ?string {
$reason = TravelReason::find($this->request->travelReason);
if ($reason === null) {
return $this->request->travelReason;
}
return $reason->requires_note
? trim((string) $this->request->travelReasonNote)
: $reason->slug;
}
/**
* Sicherheitsnetz hinter der Oberfläche: Dort geht es erst weiter, wenn die Erläuterung steht. Über
* einen direkten Aufruf ginge das sonst vorbei, und ein "Anderer Grund" ohne Text sagt nichts aus --
* gespeichert würde ein leerer Reisegrund.
*/
private function rejectTravelReason() : ?string {
$reason = TravelReason::find($this->request->travelReason);
if ($reason === null || !$reason->requires_note) {
return null;
}
return trim((string) $this->request->travelReasonNote) === ''
? 'Bitte gib an, was der Grund für die Reise war.'
: null;
}
private function generateInvoiceNumber() : string { private function generateInvoiceNumber() : string {
$lastInvoiceNumber = Invoice::query() $lastInvoiceNumber = Invoice::query()
->where('tenant', app('tenant')->slug) ->where('tenant', currentTenant()->slug)
->whereYear('created_at', date('Y')) ->whereYear('created_at', date('Y'))
->count(); ->count();
@@ -16,16 +16,24 @@ class CreateInvoiceRequest {
public ?string $invoiceTypeExtended; public ?string $invoiceTypeExtended;
public ?string $travelRoute; public ?string $travelRoute;
public ?int $distance; public ?int $distance;
public ?int $passengers;
public ?int $transportations;
public ?InvoiceFile $receiptFile; public ?InvoiceFile $receiptFile;
public float $totalAmount; public float $totalAmount;
public bool $isDonation; public bool $isDonation;
public ?int $userId; public ?int $userId;
/** Der Slug eines Reisegrundes -- oder ein Freitext, wenn er von einem Bestandsbeleg stammt. */
public ?string $travelReason; public ?string $travelReason;
/** Die Erläuterung zu "Anderer Grund"; nur bei einem Grund mit `requires_note` von Belang. */
public ?string $travelReasonNote;
public ?string $paymentPurpose; public ?string $paymentPurpose;
public ?string $notices; public ?string $notices;
/** Wer gereist ist -- Freitext aus dem Fahrtkosten-Formular, geht in den Zahlungsgrund ein. */
public ?string $travellers;
/** Ein bereits feststehender Zahlungsgrund; gesetzt, gewinnt er über die Ermittlung im Command. */
public ?string $purpose;
public function __construct( public function __construct(
CostUnit $costUnit, CostUnit $costUnit,
@@ -42,11 +50,12 @@ class CreateInvoiceRequest {
?string $invoiceTypeExtended = null, ?string $invoiceTypeExtended = null,
?string $travelRoute = null, ?string $travelRoute = null,
?int $distance = null, ?int $distance = null,
?int $passengers = null,
?int $transportations,
?string $travelReason = null, ?string $travelReason = null,
?string $travelReasonNote = null,
?string $paymentPurpose = null, ?string $paymentPurpose = null,
?string $notices = null, ?string $notices = null,
?string $travellers = null,
?string $purpose = null,
) { ) {
$this->costUnit = $costUnit; $this->costUnit = $costUnit;
@@ -55,8 +64,6 @@ class CreateInvoiceRequest {
$this->invoiceTypeExtended = $invoiceTypeExtended; $this->invoiceTypeExtended = $invoiceTypeExtended;
$this->travelRoute = $travelRoute; $this->travelRoute = $travelRoute;
$this->distance = $distance; $this->distance = $distance;
$this->passengers = $passengers;
$this->transportations = $transportations;
$this->receiptFile = $receiptFile; $this->receiptFile = $receiptFile;
$this->contactEmail = $contactEmail; $this->contactEmail = $contactEmail;
$this->contactPhone = $contactPhone; $this->contactPhone = $contactPhone;
@@ -66,8 +73,11 @@ class CreateInvoiceRequest {
$this->isDonation = $isDonation; $this->isDonation = $isDonation;
$this->userId = $userId; $this->userId = $userId;
$this->travelReason = $travelReason; $this->travelReason = $travelReason;
$this->travelReasonNote = $travelReasonNote;
$this->paymentPurpose = $paymentPurpose; $this->paymentPurpose = $paymentPurpose;
$this->notices = $notices; $this->notices = $notices;
$this->travellers = $travellers;
$this->purpose = $purpose;
if ($accountIban === 'undefined') { if ($accountIban === 'undefined') {
$this->accountIban = null; $this->accountIban = null;
@@ -8,8 +8,12 @@ class CreateInvoiceResponse {
public bool $success; public bool $success;
public ?Invoice $invoice; public ?Invoice $invoice;
/** Warum keine Abrechnung entstanden ist -- für die Rückmeldung an die einreichende Person. */
public ?string $message;
public function __construct() { public function __construct() {
$this->success = false; $this->success = false;
$this->invoice = null; $this->invoice = null;
$this->message = null;
} }
} }
@@ -83,10 +83,8 @@ class CreateInvoiceReceiptCommand {
$travelPartTemplate = <<<HTML $travelPartTemplate = <<<HTML
<tr><td>Reiseweg:</td><td>%1\$s</td></tr> <tr><td>Reiseweg:</td><td>%1\$s</td></tr>
<tr><td>Grund der Reise:</td><td>%6\$s</td></tr> <tr><td>Grund der Reise:</td><td>%4\$s</td></tr>
<tr><td>Gesamtlänge der Strecke:</td><td>%2\$s km x %3\$s / km</td></tr> <tr><td>Gesamtlänge der Strecke:</td><td>%2\$s km x %3\$s / km</td></tr>
<tr><td>Materialtransport:</td><td>%4\$s</td></tr>
<tr><td>Mitfahrende im PKW:</td><td>%5\$s</td></tr>
HTML; HTML;
$flatTravelPart = sprintf( $flatTravelPart = sprintf(
@@ -94,8 +92,6 @@ HTML;
$invoiceReadable['travelDirection'] , $invoiceReadable['travelDirection'] ,
$invoiceReadable['distance'], $invoiceReadable['distance'],
$invoiceReadable['distanceAllowance'], $invoiceReadable['distanceAllowance'],
$invoiceReadable['transportation'],
$invoiceReadable['passengers'],
$invoiceReadable['travelReason'] , $invoiceReadable['travelReason'] ,
); );
@@ -180,7 +176,10 @@ HTML;
$invoiceReadable['contactEmail'], $invoiceReadable['contactEmail'],
$invoiceReadable['contactPhone'], $invoiceReadable['contactPhone'],
$invoiceReadable['costUnitName'], $invoiceReadable['costUnitName'],
$invoiceReadable['invoiceType'], // Der erfasste Zahlungsgrund, nicht der Abrechnungstyp: Der steht eine Zeile darüber schon
// als Überschrift. Bei Fahrtkosten ist das die einzige Stelle, an der auf dem Beleg steht,
// wer gereist ist.
$invoiceReadable['purpose'],
$invoiceReadable['donationText'], $invoiceReadable['donationText'],
$paymentType, $paymentType,
$invoiceReadable['amount'], $invoiceReadable['amount'],
@@ -34,6 +34,17 @@ class UpdateInvoiceCommand {
} }
$purpose = trim((string) $this->request->purpose);
$purpose = $purpose === '' ? null : $purpose;
// Verglichen wird gegen den angezeigten Text, nicht gegen die Spalte: Das Formular ist damit
// vorbelegt, und wer ihn unverändert abschickt, hat nichts geändert. Ein Bestandsbeleg behält so
// seine leere Spalte und damit die Ableitung; wer das Feld leert, schaltet zurück auf automatisch.
if (($purpose ?? '') !== $this->request->invoice->purposeText()) {
$changes .= 'Zahlungsgrund geändert von ' . $this->request->invoice->purposeText() . ' auf ' . ($purpose ?? '--') . '.<br />';
$this->request->invoice->purpose = $purpose;
}
$this->request->invoice->comment = $this->request->comment; $this->request->invoice->comment = $this->request->comment;
$this->request->invoice->changes = $changes; $this->request->invoice->changes = $changes;
@@ -13,9 +13,11 @@ class UpdateInvoiceRequest {
public CostUnit $costUnit; public CostUnit $costUnit;
public Invoice $invoice; public Invoice $invoice;
public Amount $amount; public Amount $amount;
public ?string $purpose;
public function __construct(Invoice $invoice, ?string $comment, InvoiceType $invoiceType, CostUnit $costUnit, Amount $amount) { public function __construct(Invoice $invoice, ?string $comment, InvoiceType $invoiceType, CostUnit $costUnit, Amount $amount, ?string $purpose = null) {
$this->comment = $comment; $this->comment = $comment;
$this->purpose = $purpose;
$this->invoiceType = $invoiceType; $this->invoiceType = $invoiceType;
$this->costUnit = $costUnit; $this->costUnit = $costUnit;
$this->invoice = $invoice; $this->invoice = $invoice;
@@ -19,7 +19,7 @@ class UploadInvoiceCommand {
$uploadDir = sprintf( $uploadDir = sprintf(
'%1$s%2$s/%3$s', '%1$s%2$s/%3$s',
WebDavProvider::INVOICE_PREFIX, WebDavProvider::INVOICE_PREFIX,
app('tenant')->url, currentTenant()->url,
$this->request->invoice->costUnit()->first()->name $this->request->invoice->costUnit()->first()->name
); );
@@ -32,25 +32,26 @@ class EditController extends CommonController{
$receiptfile->fullPath = $invoice->document_filename; $receiptfile->fullPath = $invoice->document_filename;
} }
$createInvoiceRequest = new CreateInvoiceRequest( $createInvoiceRequest = new CreateInvoiceRequest(
$invoice->costUnit()->first(), costUnit: $invoice->costUnit()->first(),
$invoice->contact_name, contactName: $invoice->contact_name,
$invoice->type, invoiceType: $invoice->type,
$invoice->amount, totalAmount: $invoice->amount,
$receiptfile, receiptFile: $receiptfile,
$invoice->donation, isDonation: $invoice->donation,
$invoice->user_id, userId: $invoice->user_id,
$invoice->contact_email, contactEmail: $invoice->contact_email,
$invoice->contact_phone, contactPhone: $invoice->contact_phone,
$invoice->contact_bank_owner, accountOwner: $invoice->contact_bank_owner,
$invoice->contact_bank_iban, accountIban: $invoice->contact_bank_iban,
$invoice->type_other, invoiceTypeExtended: $invoice->type_other,
$invoice->travel_direction, travelRoute: $invoice->travel_direction,
$invoice->distance, distance: $invoice->distance,
$invoice->passengers, travelReason: $invoice->travel_reason,
$invoice->transportation, paymentPurpose: $invoice->payment_purpose,
$invoice->travel_reason, notices: $invoice->comment,
$invoice->payment_purpose, // Die rohe Spalte, nicht purposeText(): Ein Beleg, der seinen Zahlungsgrund bisher ableitet,
$invoice->comment, // soll das als Kopie weiter tun.
purpose: $invoice->purpose,
); );
$invoiceCreationCommand = new CreateInvoiceCommand($createInvoiceRequest); $invoiceCreationCommand = new CreateInvoiceCommand($createInvoiceRequest);
@@ -92,7 +93,8 @@ class EditController extends CommonController{
$modifyData['notices'], $modifyData['notices'],
$invoiceType, $invoiceType,
$newCostUnit, $newCostUnit,
$newAmount $newAmount,
$modifyData['purpose'] ?? null
); );
$updateInvoiceCommand = new UpdateInvoiceCommand($updateInvoiceRequest); $updateInvoiceCommand = new UpdateInvoiceCommand($updateInvoiceRequest);
$updateInvoiceCommand->execute(); $updateInvoiceCommand->execute();
@@ -107,22 +109,22 @@ class EditController extends CommonController{
$receiptfile->fullPath = $invoice->document_filename; $receiptfile->fullPath = $invoice->document_filename;
} }
$createInvoiceRequest = new CreateInvoiceRequest( $createInvoiceRequest = new CreateInvoiceRequest(
$invoice->costUnit()->first(), costUnit: $invoice->costUnit()->first(),
$invoice->contact_name, contactName: $invoice->contact_name,
$invoice->type, invoiceType: $invoice->type,
$amountLeft->getAmount(), totalAmount: $amountLeft->getAmount(),
$receiptfile, receiptFile: $receiptfile,
$invoice->donation, isDonation: $invoice->donation,
$invoice->user_id, userId: $invoice->user_id,
$invoice->contact_email, contactEmail: $invoice->contact_email,
$invoice->contact_phone, contactPhone: $invoice->contact_phone,
$invoice->contact_bank_owner, accountOwner: $invoice->contact_bank_owner,
$invoice->contact_bank_iban, accountIban: $invoice->contact_bank_iban,
$invoice->type_other, invoiceTypeExtended: $invoice->type_other,
$invoice->travel_direction, travelRoute: $invoice->travel_direction,
$invoice->distance, distance: $invoice->distance,
$invoice->passengers, travelReason: $invoice->travel_reason,
$invoice->transportation purpose: $invoice->purpose,
); );
$invoiceCreationCommand = new CreateInvoiceCommand($createInvoiceRequest); $invoiceCreationCommand = new CreateInvoiceCommand($createInvoiceRequest);
@@ -66,50 +66,43 @@ class SaveInvoiceController extends CommonController
} }
$createInvoiceRequest = new CreateInvoiceRequest( $createInvoiceRequest = new CreateInvoiceRequest(
$costUnit, costUnit: $costUnit,
$request->input('name'), contactName: $request->input('name'),
InvoiceType::INVOICE_TYPE_TRAVELLING, invoiceType: InvoiceType::INVOICE_TYPE_TRAVELLING,
$amount, totalAmount: $amount,
$uploadedFile, receiptFile: $uploadedFile,
'donation' === $request->input('decision') ? true : false, isDonation: 'donation' === $request->input('decision') ? true : false,
$this->users->getCurrentUserDetails()['userId'], userId: $this->users->getCurrentUserDetails()['userId'],
$request->input('email'), contactEmail: $request->input('email'),
$request->input('telephone'), contactPhone: $request->input('telephone'),
$request->input('accountOwner'), accountOwner: $request->input('accountOwner'),
$request->input('accountIban'), accountIban: $request->input('accountIban'),
null, travelRoute: $request->input('otherText'),
$request->input('otherText'), distance: $distance,
$distance, travelReason: $request->input('travelReason'),
$request->input('havePassengers'), travelReasonNote: $request->input('travelReasonNote'),
$request->input('materialTransportation'), notices: $notices,
$request->input('travelReason'), travellers: $request->input('travellers')
null,
$notices
); );
break; break;
default: default:
$createInvoiceRequest = new CreateInvoiceRequest( $createInvoiceRequest = new CreateInvoiceRequest(
$costUnit, costUnit: $costUnit,
$request->input('name'), contactName: $request->input('name'),
$invoiceType, invoiceType: $invoiceType,
Amount::fromString($request->input('amount'))->getAmount(), totalAmount: Amount::fromString($request->input('amount'))->getAmount(),
$uploadedFile, receiptFile: $uploadedFile,
'donation' === $request->input('decision') ? true : false, isDonation: 'donation' === $request->input('decision') ? true : false,
$this->users->getCurrentUserDetails()['userId'], userId: $this->users->getCurrentUserDetails()['userId'],
$request->input('email'), contactEmail: $request->input('email'),
$request->input('telephone'), contactPhone: $request->input('telephone'),
$request->input('accountOwner'), accountOwner: $request->input('accountOwner'),
$request->input('accountIban'), accountIban: $request->input('accountIban'),
$request->input('otherText'), invoiceTypeExtended: $request->input('otherText'),
null, paymentPurpose: $paymentPurpose,
null, notices: $notices
$request->input('havePassengers'),
$request->input('materialTransportation'),
null,
$paymentPurpose,
$notices
); );
break; break;
@@ -128,5 +121,11 @@ class SaveInvoiceController extends CommonController
'message' => 'Alright' 'message' => 'Alright'
]); ]);
} }
return response()->json([
'status' => 'error',
'message' => $response->message
?? 'Beim Speichern ist ein Fehler aufgetreten. Bitte starte den Vorgang erneut.'
]);
} }
} }
@@ -37,15 +37,6 @@ const props = defineProps({
<td style="font-weight: bold">{{props.invoice.amount}}</td> <td style="font-weight: bold">{{props.invoice.amount}}</td>
</tr> </tr>
<tr>
<th>Marterialtransport</th>
<td>{{props.invoice.transportation}}</td>
</tr>
<tr>
<th>Hat Personen mitgenommen</th>
<td>{{props.invoice.passengers}}</td>
</tr>
</table> </table>
</template> </template>
@@ -16,11 +16,18 @@ const props = defineProps({
const emit = defineEmits(['submit', 'cancel']) const emit = defineEmits(['submit', 'cancel'])
/**
* Die Anmerkung heißt in der Resource `comment` und ist dort `'--'`, wenn keine gesetzt ist -- beides
* muss hier stimmen, sonst startet das Feld leer und das Speichern löscht die vorhandene Anmerkung.
*/
const existingComment = props.newInvoice.comment
const formData = reactive({ const formData = reactive({
type_internal: props.newInvoice.internalType || '', type_internal: props.newInvoice.internalType || '',
cost_unit: props.newInvoice.costUnitId || '', cost_unit: props.newInvoice.costUnitId || '',
amount: props.newInvoice.amountPlain || '', amount: props.newInvoice.amountPlain || '',
notices: props.newInvoice.comments || '', purpose: props.newInvoice.purpose || '',
notices: !existingComment || existingComment === '--' ? '' : existingComment,
}) })
const submitForm = () => { const submitForm = () => {
@@ -70,6 +77,13 @@ onMounted(async () => {
</td> </td>
</tr> </tr>
<tr>
<td>Zahlungsgrund:</td>
<td>
<input type="text" v-model="formData.purpose" class="width-almost-full" />
</td>
</tr>
<tr> <tr>
<td>Anmerkungen:</td> <td>Anmerkungen:</td>
<td> <td>
@@ -100,6 +100,10 @@ const emit = defineEmits(["accept", "deny", "fix", "reopen"])
<td v-else-if="props.data.externalPayment">Rechnungszahlung</td> <td v-else-if="props.data.externalPayment">Rechnungszahlung</td>
<td v-else>Klassische Auszahlung</td> <td v-else>Klassische Auszahlung</td>
</tr> </tr>
<tr>
<td>Zahlungsgrund:</td>
<td colspan="3">{{props.data.purpose}}</td>
</tr>
<tr> <tr>
<td>Status:</td> <td>Status:</td>
<td>{{props.data.readableStatus}}</td> <td>{{props.data.readableStatus}}</td>
@@ -32,15 +32,6 @@ const props = defineProps({
<td style="font-weight: bold">{{props.invoice.amount}}</td> <td style="font-weight: bold">{{props.invoice.amount}}</td>
</tr> </tr>
<tr>
<th>Marterialtransport</th>
<td>{{props.invoice.transportation}}</td>
</tr>
<tr>
<th>Hat Personen mitgenommen</th>
<td>{{props.invoice.passengers}}</td>
</tr>
</table> </table>
</template> </template>
@@ -45,12 +45,13 @@
<template> <template>
<table v-if="localData.invoices.length > 0" class="invoice-list-table"> <table v-if="localData.invoices.length > 0" class="invoice-list-table">
<tr> <tr>
<td colspan="6">{{props.data.title}}</td> <td colspan="7">{{props.data.title}}</td>
</tr> </tr>
<tr v-for="invoice in localData.invoices" :id="'invoice_' + invoice.id"> <tr v-for="invoice in localData.invoices" :id="'invoice_' + invoice.id">
<td>{{invoice.invoiceNumber}}</td> <td>{{invoice.invoiceNumber}}</td>
<td>{{invoice.invoiceType}}</td> <td>{{invoice.invoiceTypeShort}}</td>
<td style="max-width: 250px;">{{invoice.purpose}}</td>
<td> <td>
{{invoice.amount}} {{invoice.amount}}
</td> </td>
@@ -24,8 +24,6 @@ const props = defineProps({
userTelephone: String, userTelephone: String,
userAccountOwner: String, userAccountOwner: String,
userAccountIban: String, userAccountIban: String,
havePassengers: Number,
materialTransportation: Boolean,
travelReason: String, travelReason: String,
}) })
@@ -61,8 +59,6 @@ async function sendData() {
formData.append('accountOwner', userAccountOwner.value) formData.append('accountOwner', userAccountOwner.value)
formData.append('accountIban', userIban.value) formData.append('accountIban', userIban.value)
formData.append('paymentPurpose', paymentPurpose.value) formData.append('paymentPurpose', paymentPurpose.value)
formData.append('havePassengers', props.havePassengers ? 1 : 0)
formData.append('materialTransportation', props.materialTransportation ? 1 : 0)
formData.append('travelReason', props.travelReason) formData.append('travelReason', props.travelReason)
if (props.receipt) { if (props.receipt) {
@@ -24,9 +24,9 @@ const props = defineProps({
userTelephone: String, userTelephone: String,
userAccountOwner: String, userAccountOwner: String,
userAccountIban: String, userAccountIban: String,
havePassengers: Number,
materialTransportation: Boolean,
travelReason: String, travelReason: String,
travelReasonNote: String,
travellers: String,
}) })
const finalStep = ref(true) const finalStep = ref(true)
@@ -60,9 +60,9 @@ async function sendData() {
formData.append('decision', decision.value) formData.append('decision', decision.value)
formData.append('accountOwner', userAccountOwner.value) formData.append('accountOwner', userAccountOwner.value)
formData.append('accountIban', userIban.value) formData.append('accountIban', userIban.value)
formData.append('havePassengers', props.havePassengers ? 1 : 0)
formData.append('materialTransportation', props.materialTransportation ? 1 : 0)
formData.append('travelReason', props.travelReason) formData.append('travelReason', props.travelReason)
formData.append('travelReasonNote', props.travelReasonNote ?? '')
formData.append('travellers', props.travellers ?? '')
formData.append('notices', notices.value) formData.append('notices', notices.value)
if (props.receipt) { if (props.receipt) {
@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, reactive } from 'vue' import { ref, computed, onMounted, reactive } from 'vue'
import {checkFilesize} from "../../../../../../resources/js/components/InvoiceUploadChecks.js"; import {checkFilesize} from "../../../../../../resources/js/components/InvoiceUploadChecks.js";
import RefundData from "./refund-data.vue"; import RefundData from "./refund-data.vue";
import NumericInput from "../../../../../Views/Components/NumericInput.vue"; import NumericInput from "../../../../../Views/Components/NumericInput.vue";
@@ -19,15 +19,44 @@ const { request } = useAjax();
const distanceAllowance = ref(null); const distanceAllowance = ref(null);
const travelDirection = ref(null); const travelDirection = ref(null);
const travelReason = ref(null); const travelReason = ref(null);
const travelReasonNote = ref('');
const travelReasonCollection = reactive({
travelReasons: []
});
const selectedTravelReason = computed(() =>
travelReasonCollection.travelReasons.find((reason) => reason.value === travelReason.value)
);
/**
* Ein Grund ist erst vollständig, wenn die Erläuterung steht, die er verlangt: "Anderer Grund" allein
* sagt nichts aus. Die drei anderen Gründe bremsen den Ablauf dadurch nicht.
*/
const travelReasonComplete = computed(() =>
selectedTravelReason.value !== undefined
&& (!selectedTravelReason.value.requiresNote || travelReasonNote.value.trim() !== '')
);
/**
* Wer gereist ist, steht später als Zahlungsgrund in der Belegliste, auf der EüR und auf dem Beleg. Wer
* den Beleg einreicht, war meist selbst dabei -- deshalb der eigene Name als Vorschlag. Ohne Login
* bleibt das Feld leer, und es hält den Ablauf auch dann nicht auf: Ein Name ist eine Hilfe, keine
* Bedingung.
*/
const travellers = ref(data.userName || '');
const have_receipt = ref('') const have_receipt = ref('')
const havePassengers = ref(false);
const materialTransportation = ref(false);
const amount = ref(0.00); const amount = ref(0.00);
const invoiceType = ref(null); const invoiceType = ref(null);
const otherText = ref(''); const otherText = ref('');
const receipt = ref(null) const receipt = ref(null)
const finalStep = ref(false) const finalStep = ref(false)
onMounted(async () => {
const response = await fetch('/api/v1/core/retrieve-travel-reasons');
travelReasonCollection.travelReasons = await response.json();
});
async function getDistanceAllowance() { async function getDistanceAllowance() {
const tempData = await request('/api/v1/cost-unit/get-distance-allowance/' + data.eventId, { const tempData = await request('/api/v1/cost-unit/get-distance-allowance/' + data.eventId, {
method: "GET", method: "GET",
@@ -59,14 +88,40 @@ function handleFileChange(event) {
<fieldset v-if="travelDirection !== null"> <fieldset v-if="travelDirection !== null">
<legend><span style="font-weight: bolder;">Was war der Grund für deine Reise?</span></legend> <legend><span style="font-weight: bolder;">Was war der Grund für deine Reise?</span></legend>
<p v-for="availableReason in travelReasonCollection.travelReasons">
<input
name="travel-reason"
type="radio"
:value="availableReason.value"
:id="'travel_reason_' + availableReason.value"
v-model="travelReason"
>
<label :for="'travel_reason_' + availableReason.value">{{ availableReason.label }}</label><br />
</p>
<template v-if="selectedTravelReason?.requiresNote">
<input
type="text"
class="width-full"
name="travel-reason-note"
placeholder="z. B. Abholung der Ausrüstung aus dem Lager"
v-model="travelReasonNote"
/>
</template>
</fieldset><br /><br />
<fieldset v-if="travelReasonComplete">
<legend><span style="font-weight: bolder;">Welche Personen sind gereist?</span></legend>
<input <input
type="text" type="text"
name="travel-reason" name="travellers"
v-model="travelReason" placeholder="z. B. Mika, Kim und Alex"
v-model="travellers"
/> />
</fieldset><br /><br /> </fieldset><br /><br />
<fieldset v-if="travelReason !== null"> <fieldset v-if="travelReasonComplete">
<legend><span style="font-weight: bolder;">Bist du mit dem ÖPNV gefahren oder besitzt du einen Beleg</span></legend> <legend><span style="font-weight: bolder;">Bist du mit dem ÖPNV gefahren oder besitzt du einen Beleg</span></legend>
<input type="button" style="border-radius: 0; width: 100px;" @click="have_receipt='yes'" value="Ja" /> <input type="button" style="border-radius: 0; width: 100px;" @click="have_receipt='yes'" value="Ja" />
<input type="button" style="border-radius: 0; width: 100px;" @click="getDistanceAllowance" value="Nein" /> <input type="button" style="border-radius: 0; width: 100px;" @click="getDistanceAllowance" value="Nein" />
@@ -93,8 +148,6 @@ function handleFileChange(event) {
invoice-type="travelling" invoice-type="travelling"
:amount="amount" :amount="amount"
:other-text="travelDirection" :other-text="travelDirection"
:materialTransportation="materialTransportation"
:havePassengers="havePassengers"
:userName="data.userName" :userName="data.userName"
:userEmail="data.userEmail" :userEmail="data.userEmail"
:userTelephone="data.userTelephone" :userTelephone="data.userTelephone"
@@ -102,6 +155,8 @@ function handleFileChange(event) {
:userAccountOwner="data.userAccountOwner" :userAccountOwner="data.userAccountOwner"
:receipt="receipt" :receipt="receipt"
:travelReason="travelReason" :travelReason="travelReason"
:travelReasonNote="travelReasonNote"
:travellers="travellers"
@close="finalStep = false" @close="finalStep = false"
/> />
</fieldset> </fieldset>
@@ -117,22 +172,6 @@ function handleFileChange(event) {
<span style="font-weight: normal">({{ amount }} km x {{distanceAllowance.toFixed(2).replace('.', ',')}} Euro / km = <strong>{{ (amount * distanceAllowance).toFixed(2).replace('.', ',') }} Euro</strong>)</span> <span style="font-weight: normal">({{ amount }} km x {{distanceAllowance.toFixed(2).replace('.', ',')}} Euro / km = <strong>{{ (amount * distanceAllowance).toFixed(2).replace('.', ',') }} Euro</strong>)</span>
<br /><br /> <br /><br />
<input
type="checkbox"
name="havePassengers"
v-model="havePassengers"
id="havePassengers"
/> <label style="margin-bottom: 20px;" for="havePassengers">Ich habe Personen mitgenommen</label>
<br />
<input
type="checkbox"
name="materialTransportation"
v-model="materialTransportation"
id="materialTransportation"
/> <label style="margin-bottom: 20px;" for="materialTransportation">Ich habe Material transportiert</label>
<br /><br />
<input <input
v-if="amount !== null && have_receipt === 'no' && amount != '0'" v-if="amount !== null && have_receipt === 'no' && amount != '0'"
@click="finalStep = true;" @click="finalStep = true;"
@@ -145,14 +184,14 @@ function handleFileChange(event) {
invoice-type="travelling" invoice-type="travelling"
:amount="amount" :amount="amount"
:other-text="travelDirection" :other-text="travelDirection"
:materialTransportation="materialTransportation"
:havePassengers="havePassengers"
:userName="data.userName" :userName="data.userName"
:userEmail="data.userEmail" :userEmail="data.userEmail"
:userTelephone="data.userTelephone" :userTelephone="data.userTelephone"
:userAccountIban="data.userAccountIban" :userAccountIban="data.userAccountIban"
:userAccountOwner="data.userAccountOwner" :userAccountOwner="data.userAccountOwner"
:travelReason="travelReason" :travelReason="travelReason"
:travelReasonNote="travelReasonNote"
:travellers="travellers"
@close="finalStep = false" @close="finalStep = false"
/> />
@@ -35,7 +35,7 @@ class CreateParticipantInvoiceCommand
$this->participant = $request->participant; $this->participant = $request->participant;
$this->event = $request->participant->event; $this->event = $request->participant->event;
// Über die Relation und nicht über app('tenant'): die Rechnung hängt an der Veranstaltung, // Über die Relation und nicht über currentTenant(): die Rechnung hängt an der Veranstaltung,
// nicht am gerade aktiven Mandanten. `$event->tenant` liefert das Slug-Attribut, nicht die // nicht am gerade aktiven Mandanten. `$event->tenant` liefert das Slug-Attribut, nicht die
// Relation -- deshalb der ausdrückliche Aufruf. // Relation -- deshalb der ausdrückliche Aufruf.
$this->sender = $this->event->tenant()->first(); $this->sender = $this->event->tenant()->first();
@@ -61,8 +61,16 @@ class AcceptRefundCommand
return $response; return $response;
} }
$owner = trim($this->request->accountOwner); // Steht das Konto bereits am Vorgang, stammt es aus dem Zahlungseingang und wurde bei der
$iban = Iban::normalize($this->request->accountIban); // Freigabe festgeschrieben. Dann gilt es -- und die Felder aus dem Request werden verworfen.
//
// Das ist der eigentliche Gewinn der ganzen Übung: Der Teili tippt keine IBAN mehr ab, also
// kann er sich weder vertippen noch lässt sich über einen direkten Aufruf dieser Route eine
// fremde IBAN unterschieben. Erstattet wird auf das Konto, von dem gezahlt wurde, Punkt.
$accountIsKnown = !$this->request->donation && filled($refund->account_iban);
$owner = $accountIsKnown ? (string) $refund->account_owner : trim($this->request->accountOwner);
$iban = $accountIsKnown ? (string) $refund->account_iban : Iban::normalize($this->request->accountIban);
// Serverseitig und nicht nur im Formular: die Erklärung ist der einzige Grund, warum der Beleg // Serverseitig und nicht nur im Formular: die Erklärung ist der einzige Grund, warum der Beleg
// als Eigenbeleg etwas wert ist. Ließe sie sich mit einem direkten Aufruf übergehen, stünde auf // als Eigenbeleg etwas wert ist. Ließe sie sich mit einem direkten Aufruf übergehen, stünde auf
@@ -74,14 +82,29 @@ class AcceptRefundCommand
$response->errorTypes['declaration'] = 'Bitte bestätige die Erklärung, damit wir erstatten können.'; $response->errorTypes['declaration'] = 'Bitte bestätige die Erklärung, damit wir erstatten können.';
} }
if ($owner === '') { // Wer spendet, gibt kein Konto an -- alles Weitere betrifft nur die Auszahlung.
$response->errorTypes['accountOwner'] = 'Bitte gib an, wem das Konto gehört.'; if (!$this->request->donation) {
} // Erstattet wird ausschließlich auf das Konto, von dem der Beitrag kam. Ohne diese
// Bestätigung ließe sich über eine Erstattung Geld auf ein fremdes Konto umleiten.
if (!$this->request->accountDeclarationAccepted && $this->request->capturedBy === null) {
$response->errorTypes['accountDeclaration'] = 'Bitte bestätige, dass es das Konto ist, '
. 'von dem der Beitrag gezahlt wurde.';
}
if ($iban === '') { // Nur was der Teili selbst eingibt, muss geprüft werden. Das bekannte Konto hat die
$response->errorTypes['accountIban'] = 'Bitte gib die IBAN des Kontos ein.'; // Prüfung schon beim Import bestanden -- dort wird eine ungültige IBAN gar nicht erst
} elseif (!Iban::isValid($iban)) { // übernommen.
$response->errorTypes['accountIban'] = 'Diese IBAN stimmt nicht. Bitte prüfe deine Eingabe.'; if (!$accountIsKnown) {
if ($owner === '') {
$response->errorTypes['accountOwner'] = 'Bitte gib an, wem das Konto gehört.';
}
if ($iban === '') {
$response->errorTypes['accountIban'] = 'Bitte gib die IBAN des Kontos ein.';
} elseif (!Iban::isValid($iban)) {
$response->errorTypes['accountIban'] = 'Diese IBAN stimmt nicht. Bitte prüfe deine Eingabe.';
}
}
} }
if ($response->errorTypes !== []) { if ($response->errorTypes !== []) {
@@ -108,14 +131,21 @@ class AcceptRefundCommand
// Der Beleg entsteht in der Transaktion, weil er den bestätigten Stand abbildet; scheitert das // Der Beleg entsteht in der Transaktion, weil er den bestätigten Stand abbildet; scheitert das
// Einreichen, soll auch kein Beleg gelten. // Einreichen, soll auch kein Beleg gelten.
$document = DB::transaction(function () use ($refund, $owner, $iban, $costUnit) { $document = DB::transaction(function () use ($refund, $owner, $iban, $costUnit) {
$refund->account_owner = $owner; // Bei einer Spende bleiben die Kontofelder leer -- und zwar `null` und nicht Leerstring: Der
$refund->account_iban = $iban; // SEPA-Export unterscheidet daran, ob es etwas auszuzahlen gibt.
$refund->account_owner = $this->request->donation ? null : $owner;
$refund->account_iban = $this->request->donation ? null : $iban;
$refund->captured_by = $this->request->capturedBy; $refund->captured_by = $this->request->capturedBy;
$refund->status = ParticipantRefund::STATUS_ACCEPTED; $refund->status = ParticipantRefund::STATUS_ACCEPTED;
$refund->accepted_at = now(); $refund->accepted_at = now();
$refund->save(); $refund->save();
$document = new CreateRefundDocumentCommand(new CreateRefundDocumentRequest($refund))->execute(); // Die Spende wird hier ausdrücklich mitgegeben statt am Vorgang abgelesen: Die Abrechnung,
// die sie führt, entsteht erst weiter unten -- dieser Beleg ist ihr Anhang.
$document = new CreateRefundDocumentCommand(new CreateRefundDocumentRequest(
refund: $refund,
donation: $this->request->donation,
))->execute();
$invoice = $this->createInvoice($refund, $costUnit, $document); $invoice = $this->createInvoice($refund, $costUnit, $document);
@@ -132,7 +162,9 @@ class AcceptRefundCommand
$this->notify($refund, $document); $this->notify($refund, $document);
$response->success = true; $response->success = true;
$response->message = 'Vielen Dank. Deine Angaben liegen uns vor.'; $response->message = $this->request->donation
? 'Vielen Dank für deine Spende.'
: 'Vielen Dank. Deine Angaben liegen uns vor.';
return $response; return $response;
} }
@@ -141,7 +173,7 @@ class AcceptRefundCommand
* Die Kostenstelle der Veranstaltung. * Die Kostenstelle der Veranstaltung.
* *
* Ohne Zugriffsprüfung, weil hier niemand angemeldet ist -- der Teili bestätigt über seinen Token. * Ohne Zugriffsprüfung, weil hier niemand angemeldet ist -- der Teili bestätigt über seinen Token.
* Der Repository-Check greift sonst auf `auth()->user()->id` zu und liefe in einen Fehler. * Der Repository-Check greift sonst auf `currentUserOrFail()->id` zu und liefe in einen Fehler.
* *
* Bewusst ohne Prüfung auf `allow_new`/`archived`: Eine Erstattung fällt oft erst nach dem Ende der * Bewusst ohne Prüfung auf `allow_new`/`archived`: Eine Erstattung fällt oft erst nach dem Ende der
* Veranstaltung an, wenn die Kostenstelle längst geschlossen ist. Sie gehört trotzdem dorthin -- und * Veranstaltung an, wenn die Kostenstelle längst geschlossen ist. Sie gehört trotzdem dorthin -- und
@@ -177,7 +209,9 @@ class AcceptRefundCommand
invoiceType: InvoiceType::INVOICE_TYPE_PARTICIPATION_REFUND, invoiceType: InvoiceType::INVOICE_TYPE_PARTICIPATION_REFUND,
totalAmount: $refund->amount?->getAmount() ?? 0.0, totalAmount: $refund->amount?->getAmount() ?? 0.0,
receiptFile: $this->storeReceipt($costUnit, $document), receiptFile: $this->storeReceipt($costUnit, $document),
isDonation: false, // Hier landet die Entscheidung des Teilis, und nur hier: Die Abrechnung führt sie, der
// Vorgang liest sie über ParticipantRefund::isDonation() zurück.
isDonation: $this->request->donation,
userId: $participant->user_id, userId: $participant->user_id,
contactEmail: $participant->email_1, contactEmail: $participant->email_1,
contactPhone: $participant->phone_1, contactPhone: $participant->phone_1,
@@ -186,15 +220,6 @@ class AcceptRefundCommand
accountOwner: $refund->account_owner, accountOwner: $refund->account_owner,
accountIban: $refund->account_iban, accountIban: $refund->account_iban,
// Die folgenden vier gehören zu Reisekosten und Freitext-Typen und sind hier leer. Sie
// müssen trotzdem stehen: `transportations` hat als einziger Parameter keinen Vorgabewert,
// und PHP macht damit auch alle optionalen Parameter davor zu Pflichtangaben.
invoiceTypeExtended: null,
travelRoute: null,
distance: null,
passengers: null,
transportations: null,
// MUSS null bleiben (nicht ''): CreateInvoiceCommand verwirft die user_id, sobald hier etwas // MUSS null bleiben (nicht ''): CreateInvoiceCommand verwirft die user_id, sobald hier etwas
// steht -- der Teili fände seine Abrechnung dann nicht unter "Meine Abrechnungen". // steht -- der Teili fände seine Abrechnung dann nicht unter "Meine Abrechnungen".
paymentPurpose: null, paymentPurpose: null,
@@ -247,8 +272,15 @@ class AcceptRefundCommand
{ {
$paid = $refund->participant->amount_paid?->toString() ?? '0,00 Euro'; $paid = $refund->participant->amount_paid?->toString() ?? '0,00 Euro';
// Die Schatzmeisterei sieht die Abrechnung ohne den Vorgang dahinter. Dass nichts ausgezahlt
// wird, steht zwar im Spendenkennzeichen -- warum keine Bankverbindung dabei ist, aber nur hier.
$subject = $this->request->donation
? 'Spende statt Rückerstattung Teilnahmebeitrag'
: 'Rückerstattung Teilnahmebeitrag';
return Str::limit(sprintf( return Str::limit(sprintf(
'Rückerstattung Teilnahmebeitrag %s %s', '%s %s %s',
$subject,
$refund->event->name, $refund->event->name,
$refund->reasonLabel() $refund->reasonLabel()
), 180) . sprintf(' | Gezahlter Beitrag vor Erstattung: %s', $paid); ), 180) . sprintf(' | Gezahlter Beitrag vor Erstattung: %s', $paid);
@@ -8,10 +8,37 @@ class AcceptRefundRequest
{ {
public function __construct( public function __construct(
public readonly ?ParticipantRefund $refund, public readonly ?ParticipantRefund $refund,
public readonly string $accountOwner, /**
public readonly string $accountIban, * Die Eingaben des Teilis -- leer, wenn es nichts einzugeben gab.
/** Ob der Teili die Erklärung auf der Seite angekreuzt hat. Ohne sie taugt der Beleg nichts. */ *
* Das ist der Normalfall bei einer Spende (kein Konto nötig) und bei einem bereits bekannten
* Konto: Dort steht die Bankverbindung seit der Freigabe am Vorgang, und der Command nimmt
* ausschließlich diese.
*/
public readonly string $accountOwner = '',
public readonly string $accountIban = '',
/**
* Ob der Teili die Erklärung auf der Seite angekreuzt hat. Ohne sie taugt der Beleg nichts.
*
* Im Spendenweg ist es die Verzichtserklärung, im Auszahlungsweg die Versicherung über den
* gezahlten Beitrag -- in beiden Fällen die Erklärung, die anschließend auf dem Beleg steht.
*/
public readonly bool $declarationAccepted = false, public readonly bool $declarationAccepted = false,
/**
* Ob auf die Auszahlung verzichtet und der Betrag gespendet wird.
*
* Wird nicht am Vorgang gespeichert: Die Entscheidung landet in der Abrechnung
* (`invoices.donation`), von wo {@see ParticipantRefund::isDonation()} sie zurückliest. Dieses
* Feld ist der Weg dorthin.
*/
public readonly bool $donation = false,
/**
* Nur im Auszahlungsweg: die Bestätigung, dass es das Konto der Ursprungszahlung ist.
*
* Getrennt von der Haupterklärung, weil sie im Spendenweg gegenstandslos ist -- dort gibt es
* kein Konto.
*/
public readonly bool $accountDeclarationAccepted = false,
/** /**
* Die Aktionsleitung, wenn sie die Bankverbindung aufgenommen hat, weil sie ihr vorlag. * Die Aktionsleitung, wenn sie die Bankverbindung aufgenommen hat, weil sie ihr vorlag.
* *
@@ -2,6 +2,7 @@
namespace App\Domains\ParticipantRefund\Actions\CreateRefundDocument; namespace App\Domains\ParticipantRefund\Actions\CreateRefundDocument;
use App\Enumerations\RefundAccountSource;
use App\Models\DocumentTemplate; use App\Models\DocumentTemplate;
use App\Models\Event; use App\Models\Event;
use App\Models\EventParticipant; use App\Models\EventParticipant;
@@ -27,6 +28,18 @@ class CreateRefundDocumentCommand
/** Name des `page_texts`-Eintrags mit der Erklärung -- dieselbe Quelle wie die Bestätigungsseite. */ /** Name des `page_texts`-Eintrags mit der Erklärung -- dieselbe Quelle wie die Bestätigungsseite. */
public const string DECLARATION_TEXT = 'CONFIRMATION_PARTICIPANT_REFUND'; public const string DECLARATION_TEXT = 'CONFIRMATION_PARTICIPANT_REFUND';
/** Die zweite Erklärung des Auszahlungswegs: dass es das Konto der Ursprungszahlung ist. */
public const string ACCOUNT_DECLARATION_TEXT = 'CONFIRMATION_PARTICIPANT_REFUND_ACCOUNT';
/**
* Ihre Fassung für Zahlungsarten ohne Ursprungskonto (Barzahlung): Dort gab es kein Konto, von dem
* der Beitrag kam -- erklärt wird stattdessen, dass das angegebene auf den eigenen Namen läuft.
*/
public const string OWN_ACCOUNT_DECLARATION_TEXT = 'CONFIRMATION_PARTICIPANT_REFUND_ACCOUNT_OWN';
/** Tritt im Spendenweg an die Stelle beider anderen -- dort gibt es kein Konto. */
public const string DONATION_DECLARATION_TEXT = 'CONFIRMATION_PARTICIPANT_REFUND_DONATION';
private ParticipantRefund $refund; private ParticipantRefund $refund;
private EventParticipant $participant; private EventParticipant $participant;
@@ -146,14 +159,76 @@ class CreateRefundDocumentCommand
); );
} }
/**
* Die Herkunft des Erstattungskontos, abgeleitet aus der Zahlungsart der Anmeldung.
*
* Der Beleg wird bei jedem Abruf neu gerendert und nicht gespeichert. Änderte jemand nachträglich
* die Zahlungsart, zeigte ein Nachdruck die jeweils andere Kontoerklärung. Praktisch passiert das
* nicht -- eine eigene Spalte am Vorgang wäre dafür unverhältnismäßig.
*/
private function accountSource(): RefundAccountSource
{
return $this->participant->refundData()->source;
}
private function declarationText(): string private function declarationText(): string
{ {
$text = PageText::where('name', self::DECLARATION_TEXT)->first()?->content; if ($this->request->donation) {
return $this->pageText(
self::DONATION_DECLARATION_TEXT,
'Ich verzichte auf die Auszahlung des genannten Betrags und spende ihn an den Verband. '
. 'Mir ist bewusst, dass dieser Verzicht nicht rückgängig gemacht werden kann.'
);
}
return trim((string) $text) !== '' // Beide Sätze, weil die Person beide angekreuzt hat -- der Beleg schreibt ihr nur zu, was sie
? (string) $text // gelesen hat, und die Kontoerklärung ist der Grund, warum die Auszahlung zulässig ist.
: 'Ich versichere, dass ich den genannten Betrag beglichen habe und nicht anderweitig ' //
. 'zurückerstattet bekomme.'; // Welche der beiden Kontoerklärungen gilt, sagt die Zahlungsart: Wer bar gezahlt hat, kann
// nicht bestätigen, dass das Konto dasselbe ist -- es gab keines.
$accountSource = $this->accountSource();
return $this->pageText(
self::DECLARATION_TEXT,
'Ich versichere, dass ich den genannten Betrag beglichen habe und nicht anderweitig '
. 'zurückerstattet bekomme.'
) . '<br /><br />' . $this->pageText(
$accountSource->accountDeclarationText(),
$accountSource === RefundAccountSource::None
? 'Ich bestätige, dass das angegebene Konto auf meinen Namen läuft oder ich über dieses '
. 'Konto verfügungsberechtigt bin.'
: 'Ich bestätige, dass das angegebene Konto dasselbe ist, von dem der Teilnahmebeitrag '
. 'gezahlt wurde.'
);
}
/**
* Ein Seitentext mit Rückfallwert: Fehlt die Zeile in der Datenbank, soll der Beleg trotzdem
* entstehen. Ohne den Fallback stünde hier ein Fatal Error auf `null` -- so steht es heute im
* Deckblatt-Code der Auslagenerstattung, und daran soll sich der Beleg kein Beispiel nehmen.
*/
private function pageText(string $name, string $fallback): string
{
$text = PageText::where('name', $name)->first()?->content;
return trim((string) $text) !== '' ? (string) $text : $fallback;
}
/**
* Der Einleitungssatz des Belegs, passend zum gewählten Weg.
*
* Als Platzhalter und nicht fest in der Vorlage, weil er sich zwischen Auszahlung und Spende
* unterscheidet -- `{if:…}` kennt keine Verneinung, mit der eine Vorlage den einen Satz gegen den
* anderen tauschen könnte. Ältere, bereits installierte Vorlagen tragen den festen Satz weiter; dass
* gespendet wurde, steht dort in der Angabentabelle und in der Erklärung.
*/
private function introText(): string
{
return $this->request->donation
? 'Ich konnte an der Veranstaltung nicht oder nur teilweise teilnehmen. Auf die Auszahlung '
. 'des erstattungsfähigen Betrags verzichte ich und spende ihn an den Verband:'
: 'Ich konnte an der Veranstaltung nicht oder nur teilweise teilnehmen und bitte um die '
. 'Rückerstattung wie folgt:';
} }
/** /**
@@ -222,6 +297,7 @@ class CreateRefundDocumentCommand
'retained_amount' => $this->money($refund->retained_amount?->getAmount() ?? 0.0), 'retained_amount' => $this->money($refund->retained_amount?->getAmount() ?? 0.0),
'retention_note' => $this->retentionNote(), 'retention_note' => $this->retentionNote(),
'intro_text' => $this->introText(),
'declaration_text' => $this->declarationText(), 'declaration_text' => $this->declarationText(),
'capture_note' => $this->captureNote(), 'capture_note' => $this->captureNote(),
@@ -272,8 +348,17 @@ class CreateRefundDocumentCommand
$rows[] = ['Grund der Einbehaltung', e($this->retentionNote())]; $rows[] = ['Grund der Einbehaltung', e($this->retentionNote())];
} }
$rows[] = ['Kontoinhaber*in', e((string) $refund->account_owner)]; // Bei einer Spende gibt es keine Bankverbindung. Statt zwei leerer Zeilen steht dort, warum --
$rows[] = ['IBAN', e($this->formatIban((string) $refund->account_iban))]; // der Beleg wandert in die Buchhaltung, und "keine IBAN" allein sähe nach einer Lücke aus.
if ($this->request->donation) {
$rows[] = [
'Auszahlung',
'Auf die Auszahlung wird verzichtet; der Betrag verbleibt als Spende beim Verband.',
];
} else {
$rows[] = ['Kontoinhaber*in', e((string) $refund->account_owner)];
$rows[] = ['IBAN', e($this->formatIban((string) $refund->account_iban))];
}
$html = ''; $html = '';
foreach ($rows as [$key, $value]) { foreach ($rows as [$key, $value]) {
@@ -8,6 +8,14 @@ class CreateRefundDocumentRequest
{ {
public function __construct( public function __construct(
public readonly ParticipantRefund $refund, public readonly ParticipantRefund $refund,
/**
* Ob der Betrag gespendet statt ausgezahlt wird.
*
* Ausdrücklich und nicht über {@see ParticipantRefund::isDonation()}: Beim Einreichen entsteht
* dieser Beleg vor der Abrechnung, die die Spende führt -- er ist ihr Anhang. Wer ihn später
* erneut zieht, liest sie dort und gibt sie hier weiter.
*/
public readonly bool $donation = false,
) { ) {
} }
} }
@@ -6,6 +6,7 @@ use App\Domains\ParticipantRefund\Actions\AcceptRefund\AcceptRefundCommand;
use App\Domains\ParticipantRefund\Actions\AcceptRefund\AcceptRefundRequest; use App\Domains\ParticipantRefund\Actions\AcceptRefund\AcceptRefundRequest;
use App\Enumerations\RefundReason; use App\Enumerations\RefundReason;
use App\Enumerations\RetentionReason; use App\Enumerations\RetentionReason;
use App\EventPaymentModules\DTO\GetRefundDataResponse;
use App\Mail\ParticipantRefundMails\RefundReleasedMail; use App\Mail\ParticipantRefundMails\RefundReleasedMail;
use App\Models\EventParticipant; use App\Models\EventParticipant;
use App\Models\ParticipantRefund; use App\Models\ParticipantRefund;
@@ -29,6 +30,8 @@ class ReleaseRefundCommand
private ParticipantRefundRepository $refunds; private ParticipantRefundRepository $refunds;
private ?GetRefundDataResponse $knownRefundData = null;
public function __construct(private readonly ReleaseRefundRequest $request) public function __construct(private readonly ReleaseRefundRequest $request)
{ {
$this->participant = $request->participant; $this->participant = $request->participant;
@@ -63,30 +66,61 @@ class ReleaseRefundCommand
'retained_amount' => $this->request->retainedAmount(), 'retained_amount' => $this->request->retainedAmount(),
'retention_reason' => $this->retentionReason(), 'retention_reason' => $this->retentionReason(),
'retention_reason_note' => $this->retentionReasonNote(), 'retention_reason_note' => $this->retentionReasonNote(),
'released_by' => auth()->id(), // Kennt die Zahlungsart das Konto, von dem der Beitrag kam, steht es von Anfang an
// fest. Der Teili entscheidet dann nur noch: auszahlen oder spenden.
'account_owner' => $this->knownAccountOwner(),
'account_iban' => $this->knownAccountIban(),
'released_by' => currentUser()?->id,
'released_at' => now(), 'released_at' => now(),
]); ]);
if ($this->request->hasBankDetails()) { if ($this->request->submitsDirectly()) {
$this->submitDirectly($refund); $this->submitDirectly($refund);
} }
return $refund; return $refund;
}); });
if (!$this->request->hasBankDetails()) { if (!$this->request->submitsDirectly()) {
$this->notify($refund); $this->notify($refund);
} }
$response->success = true; $response->success = true;
$response->refund = $refund->fresh(); $response->refund = $refund->fresh();
$response->message = $this->request->hasBankDetails() $response->message = match (true) {
? 'Die Erstattung wurde eingereicht. Der Teili hat den Beleg per E-Mail erhalten.' $this->request->donation => 'Die Spende wurde eingereicht. Der Teili hat den Beleg per E-Mail erhalten.',
: 'Die Erstattung wurde freigegeben. Der Teili wurde per E-Mail informiert.'; $this->request->hasBankDetails() => 'Die Erstattung wurde eingereicht. Der Teili hat den Beleg per E-Mail erhalten.',
default => 'Die Erstattung wurde freigegeben. Der Teili wurde per E-Mail informiert.',
};
return $response; return $response;
} }
/**
* Das Konto, das die Zahlungsart kennt -- bei der Überweisung das des Zahlungseingangs.
*
* Lazy und einmalig, weil der Aufruf über die Event-Relation des Teilnehmers läuft
* ({@see EventParticipant::paymentConfiguration()}) und in einem Vorgang mehrfach gebraucht wird.
*/
private function knownRefundData(): GetRefundDataResponse
{
return $this->knownRefundData ??= $this->participant->refundData();
}
/**
* Bei der Sofort-Einreichung und bei der Spende bleibt das Feld leer: Dort setzt der
* {@see AcceptRefundCommand} es -- aus der Eingabe der Aktionsleitung bzw. auf `null`.
*/
private function knownAccountOwner(): ?string
{
return $this->request->submitsDirectly() ? null : ($this->knownRefundData()->accountOwner);
}
private function knownAccountIban(): ?string
{
return $this->request->submitsDirectly() ? null : ($this->knownRefundData()->accountIban);
}
/** /**
* Reicht die Erstattung sofort ein, ohne den Umweg über den Teili. * Reicht die Erstattung sofort ein, ohne den Umweg über den Teili.
* *
@@ -99,9 +133,10 @@ class ReleaseRefundCommand
refund: $refund, refund: $refund,
accountOwner: (string) $this->request->accountOwner, accountOwner: (string) $this->request->accountOwner,
accountIban: (string) $this->request->accountIban, accountIban: (string) $this->request->accountIban,
donation: $this->request->donation,
// Niemand kreuzt hier eine Erklärung an; wer die Angaben aufgenommen hat, hält `captured_by` // Niemand kreuzt hier eine Erklärung an; wer die Angaben aufgenommen hat, hält `captured_by`
// fest, und der Beleg weist es aus. // fest, und der Beleg weist es aus.
capturedBy: auth()->id(), capturedBy: currentUser()?->id,
))->execute(); ))->execute();
if (!$acceptResponse->success) { if (!$acceptResponse->success) {
@@ -181,21 +216,29 @@ class ReleaseRefundCommand
*/ */
private function rejectBankDetails(): ?string private function rejectBankDetails(): ?string
{ {
// Eine Spende wird nicht ausgezahlt. Kämen beide Angaben zusammen, wäre unklar, was gilt --
// lieber nachfragen als das eine stillschweigend gegen das andere entscheiden.
if ($this->request->donation && (filled($this->request->accountOwner) || filled($this->request->accountIban))) {
return 'Eine Spende braucht keine Bankverbindung.';
}
// Halb ausgefüllt ist keine Absicht: entweder beides oder der Weg über den Teili. // Halb ausgefüllt ist keine Absicht: entweder beides oder der Weg über den Teili.
if (filled($this->request->accountOwner) !== filled($this->request->accountIban)) { if (!$this->request->donation
&& filled($this->request->accountOwner) !== filled($this->request->accountIban)) {
return 'Für die sofortige Erstattung werden Kontoinhaber*in und IBAN benötigt.'; return 'Für die sofortige Erstattung werden Kontoinhaber*in und IBAN benötigt.';
} }
if (!$this->request->hasBankDetails()) { if (!$this->request->submitsDirectly()) {
return null; return null;
} }
if (!Iban::isValid((string) $this->request->accountIban)) { if ($this->request->hasBankDetails() && !Iban::isValid((string) $this->request->accountIban)) {
return 'Diese IBAN stimmt nicht. Bitte prüfe die Eingabe.'; return 'Diese IBAN stimmt nicht. Bitte prüfe die Eingabe.';
} }
// Ohne Kostenstelle ließe sich die Abrechnung nicht anlegen. Hier abfangen und nicht erst in der // Ohne Kostenstelle ließe sich die Abrechnung nicht anlegen -- auch die Spende braucht eine, sie
// Transaktion, damit die Aktionsleitung eine verständliche Meldung sieht. // wird ja gebucht. Hier abfangen und nicht erst in der Transaktion, damit die Aktionsleitung eine
// verständliche Meldung sieht.
if ($this->participant->event->cost_unit_id === null) { if ($this->participant->event->cost_unit_id === null) {
return 'Die Veranstaltung hat keine Kostenstelle -- die Erstattung kann nicht eingereicht werden.'; return 'Die Veranstaltung hat keine Kostenstelle -- die Erstattung kann nicht eingereicht werden.';
} }
@@ -28,6 +28,13 @@ class ReleaseRefundRequest
*/ */
public readonly ?string $retentionReason = null, public readonly ?string $retentionReason = null,
public readonly ?string $retentionReasonNote = null, public readonly ?string $retentionReasonNote = null,
/**
* Der Teili spendet den Betrag, statt ihn ausgezahlt zu bekommen.
*
* Dann braucht es keine Bankverbindung, und die Erstattung wird -- wie beim vorliegenden Konto --
* sofort eingereicht. Gespeichert wird die Entscheidung in der Abrechnung, nicht am Vorgang.
*/
public readonly bool $donation = false,
) { ) {
} }
@@ -37,6 +44,12 @@ class ReleaseRefundRequest
return filled($this->accountOwner) && filled($this->accountIban); return filled($this->accountOwner) && filled($this->accountIban);
} }
/** Ob sofort eingereicht wird -- entweder liegt die Bankverbindung vor, oder es wird gespendet. */
public function submitsDirectly(): bool
{
return $this->hasBankDetails() || $this->donation;
}
/** /**
* Der Betrag, der beim Verband bleibt. * Der Betrag, der beim Verband bleibt.
* *
@@ -0,0 +1,70 @@
<?php
namespace App\Domains\ParticipantRefund\Actions\ResendRefundMail;
use App\Mail\ParticipantRefundMails\RefundReleasedMail;
use App\Models\EventParticipant;
use Illuminate\Support\Facades\Mail;
/**
* Schickt die Mail zu einer freigegebenen Erstattung noch einmal.
*
* Der häufige Fall, wenn ein Vorgang hängt: die erste Mail ist untergegangen. Am Vorgang ändert sich
* dabei nichts -- `released_at` bleibt der Zeitpunkt der Vormerkung, der Token bleibt derselbe, der alte
* Link funktioniert also weiter.
*
* Nur solange die Bankverbindung fehlt: nach der Bestätigung wäre der Link wertlos, nach dem Abbruch
* liefe er ins Leere.
*/
class ResendRefundMailCommand
{
public function __construct(private readonly ResendRefundMailRequest $request)
{
}
public function execute(): ResendRefundMailResponse
{
$response = new ResendRefundMailResponse();
$refund = $this->request->refund;
if (!$refund->isPending()) {
$response->message = $refund->isAccepted()
? 'Diese Erstattung wurde bereits bestätigt -- es gibt nichts mehr nachzureichen.'
: 'Diese Erstattung wurde abgebrochen.';
return $response;
}
$this->notify();
$response->success = true;
$response->message = 'Die Rückerstattungsmail wurde erneut versendet.';
return $response;
}
/**
* Teili und Kontaktperson bekommen je eine eigene Mail -- dasselbe Muster wie bei der Freigabe
* (siehe ReleaseRefundCommand).
*/
private function notify(): void
{
/** @var EventParticipant $participant */
$participant = $this->request->refund->participant()->first();
$recipients = [$participant->email_1];
// `filled()` und nicht `!== null`: Der Anmeldewizard überspringt den Schritt "Kontaktperson" bei
// Volljährigen und legt das Feld als Leerstring an -- `Mail::to('')` liefe ins Leere.
if (filled($participant->email_2)) {
$recipients[] = $participant->email_2;
}
foreach ($recipients as $recipient) {
Mail::to($recipient)->send(new RefundReleasedMail(
participant: $participant,
refund: $this->request->refund,
));
}
}
}
@@ -0,0 +1,13 @@
<?php
namespace App\Domains\ParticipantRefund\Actions\ResendRefundMail;
use App\Models\ParticipantRefund;
class ResendRefundMailRequest
{
public function __construct(
public readonly ParticipantRefund $refund,
) {
}
}
@@ -0,0 +1,10 @@
<?php
namespace App\Domains\ParticipantRefund\Actions\ResendRefundMail;
class ResendRefundMailResponse
{
public bool $success = false;
public ?string $message = null;
}
@@ -22,6 +22,8 @@ class AcceptRefundController extends CommonController
accountOwner: (string) $request->input('accountOwner'), accountOwner: (string) $request->input('accountOwner'),
accountIban: (string) $request->input('accountIban'), accountIban: (string) $request->input('accountIban'),
declarationAccepted: $request->boolean('declarationAccepted'), declarationAccepted: $request->boolean('declarationAccepted'),
donation: $request->boolean('donation'),
accountDeclarationAccepted: $request->boolean('accountDeclarationAccepted'),
); );
$response = new AcceptRefundCommand($acceptRequest)->execute(); $response = new AcceptRefundCommand($acceptRequest)->execute();
@@ -18,7 +18,11 @@ class RefundDocumentController extends CommonController
abort(403, 'Zugriff verweigert.'); abort(403, 'Zugriff verweigert.');
} }
$documentResponse = new CreateRefundDocumentCommand(new CreateRefundDocumentRequest($refund))->execute(); $documentResponse = new CreateRefundDocumentCommand(new CreateRefundDocumentRequest(
refund: $refund,
// Beim Nachdruck steht die Abrechnung längst -- sie führt die Spende.
donation: $refund->isDonation(),
))->execute();
if (!$documentResponse->success) { if (!$documentResponse->success) {
abort(422, $documentResponse->message ?? 'Der Beleg konnte nicht erstellt werden.'); abort(422, $documentResponse->message ?? 'Der Beleg konnte nicht erstellt werden.');
@@ -3,16 +3,20 @@
namespace App\Domains\ParticipantRefund\Controllers; namespace App\Domains\ParticipantRefund\Controllers;
use App\Domains\ParticipantRefund\Actions\AcceptRefund\AcceptRefundCommand; use App\Domains\ParticipantRefund\Actions\AcceptRefund\AcceptRefundCommand;
use App\Enumerations\RefundAccountSource;
use App\Models\ParticipantRefund; use App\Models\ParticipantRefund;
use App\Providers\InertiaProvider; use App\Providers\InertiaProvider;
use App\Scopes\CommonController; use App\Scopes\CommonController;
use App\Support\Iban;
use Inertia\Response; use Inertia\Response;
/** /**
* Die öffentliche Seite, auf der der Teili seine Bankverbindung hinterlegt. * Die öffentliche Seite, auf der der Teili seine Bankverbindung hinterlegt.
* *
* Liefert ausschließlich Anzeigedaten -- niemals die bereits erfasste Bankverbindung: der Token wandert * Liefert ausschließlich Anzeigedaten -- niemals die vollständige Bankverbindung: der Token wandert
* durch ein Postfach, und was einmal eingetragen ist, muss von dort nicht wieder herauslesbar sein. * durch ein Postfach, und was einmal eingetragen ist, muss von dort nicht wieder herauslesbar sein.
* Ist das Konto aus dem Zahlungseingang bekannt, geht es deshalb **maskiert** hinaus: genug zum
* Wiedererkennen, zu wenig zum Mitschreiben.
*/ */
class RefundPageController extends CommonController class RefundPageController extends CommonController
{ {
@@ -53,9 +57,31 @@ class RefundPageController extends CommonController
return array_merge($common, [ return array_merge($common, [
'state' => 'accepted', 'state' => 'accepted',
'acceptedAt' => $refund->accepted_at?->format('d.m.Y'), 'acceptedAt' => $refund->accepted_at?->format('d.m.Y'),
// Wurde gespendet, darf der Abschlusstext keine Überweisung ankündigen, die nicht kommt.
'donation' => $refund->isDonation(),
]); ]);
} }
return array_merge($common, ['state' => 'open']); // Woher das Erstattungskonto kommt, entscheidet die Zahlungsart -- und damit, was die Seite
// fragt: gar nichts (Konto liegt vor), die Herkunftsfrage (es gab ein Ursprungskonto) oder nur
// die Felder (Barzahlung, es gab nie eines).
$accountSource = $refund->account_iban !== null
? RefundAccountSource::Known
: $participant->refundData()->source;
return array_merge($common, [
'state' => 'open',
'accountSource' => $accountSource->value,
// Der Name des page_texts-Eintrags, nicht der Text: Welche Erklärung gilt, entscheidet der
// Server -- sonst könnten Seite und Beleg auseinanderlaufen.
'accountDeclarationText' => $accountSource->accountDeclarationText(),
// Ist das Konto bekannt (aus dem Zahlungseingang), braucht der Teili es nicht einzugeben --
// er soll es aber wiedererkennen können, um einen Fehler zu melden. Deshalb maskiert:
// Die vollständige Bankverbindung verlässt diese Seite weiterhin nicht.
'knownAccount' => $refund->account_iban === null ? null : [
'owner' => $refund->account_owner,
'ibanMasked' => Iban::mask($refund->account_iban),
],
]);
} }
} }
@@ -31,6 +31,9 @@ class ReleaseRefundController extends CommonController
// Leer, wenn der volle Beitrag erstattet wird -- dann gibt es nichts zu begründen. // Leer, wenn der volle Beitrag erstattet wird -- dann gibt es nichts zu begründen.
retentionReason: Text::nullIfBlank($request->input('retentionReason')), retentionReason: Text::nullIfBlank($request->input('retentionReason')),
retentionReasonNote: Text::nullIfBlank($request->input('retentionReasonNote')), retentionReasonNote: Text::nullIfBlank($request->input('retentionReasonNote')),
// Der Teili hat der Aktionsleitung gesagt, dass er spenden möchte -- dann entfällt die
// Bankverbindung und die Erstattung wird sofort als Spende eingereicht.
donation: $request->boolean('donation'),
); );
$response = new ReleaseRefundCommand($refundRequest)->execute(); $response = new ReleaseRefundCommand($refundRequest)->execute();
@@ -0,0 +1,30 @@
<?php
namespace App\Domains\ParticipantRefund\Controllers;
use App\Domains\ParticipantRefund\Actions\ResendRefundMail\ResendRefundMailCommand;
use App\Domains\ParticipantRefund\Actions\ResendRefundMail\ResendRefundMailRequest;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ResendRefundMailController extends CommonController
{
public function __invoke(string $refundToken, Request $request): JsonResponse
{
$refund = $this->participantRefunds->getByToken($refundToken);
// Der Token ist hier keine Berechtigung: nachschicken darf nur, wer die Veranstaltung auch
// verwalten kann. `getById()` prüft genau das.
if ($refund === null || $this->events->getById($refund->event_id) === null) {
abort(403, 'Zugriff verweigert.');
}
$response = new ResendRefundMailCommand(new ResendRefundMailRequest($refund))->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->message,
]);
}
}
@@ -67,7 +67,8 @@ final class ParticipantRefundTokens
'refund_reason_text' => ['description' => 'Erläuterung des Grundes (bei „Sonstiger Grund" der Freitext)', 'sample' => 'Die Teilnahme konnte krankheitsbedingt nicht angetreten werden.'], 'refund_reason_text' => ['description' => 'Erläuterung des Grundes (bei „Sonstiger Grund" der Freitext)', 'sample' => 'Die Teilnahme konnte krankheitsbedingt nicht angetreten werden.'],
'account_owner' => ['description' => 'Kontoinhaber*in', 'sample' => 'Mika Muster'], 'account_owner' => ['description' => 'Kontoinhaber*in', 'sample' => 'Mika Muster'],
'account_iban' => ['description' => 'IBAN', 'sample' => 'DE02 1203 0000 0000 2020 51'], 'account_iban' => ['description' => 'IBAN', 'sample' => 'DE02 1203 0000 0000 2020 51'],
'declaration_text' => ['description' => 'Die Erklärung, die die teilnehmende Person bestätigt hat (gepflegt als Seitentext CONFIRMATION_PARTICIPANT_REFUND)', 'sample' => 'Ich versichere, dass ich den genannten Betrag beglichen habe und nicht anderweitig zurückerstattet bekomme.'], 'declaration_text' => ['description' => 'Die Erklärungen, die die teilnehmende Person bestätigt hat (gepflegt als Seitentexte CONFIRMATION_PARTICIPANT_REFUND und CONFIRMATION_PARTICIPANT_REFUND_ACCOUNT, bei einer Spende CONFIRMATION_PARTICIPANT_REFUND_DONATION)', 'sample' => 'Ich versichere, dass ich den genannten Betrag beglichen habe und nicht anderweitig zurückerstattet bekomme.<br /><br />Ich bestätige, dass das angegebene Konto dasselbe ist, von dem der Teilnahmebeitrag gezahlt wurde.'],
'intro_text' => ['description' => 'Einleitungssatz des Belegs — bei einer Spende der Verzicht statt der Bitte um Rückerstattung', 'sample' => 'Ich konnte an der Veranstaltung nicht oder nur teilweise teilnehmen und bitte um die Rückerstattung wie folgt:'],
'capture_note' => ['description' => 'Vermerk, wenn die Aktionsleitung die Bankverbindung aufgenommen hat — sonst leer', 'sample' => 'Angaben aufgenommen durch Aktions Leitung am 18.06.2026.'], 'capture_note' => ['description' => 'Vermerk, wenn die Aktionsleitung die Bankverbindung aufgenommen hat — sonst leer', 'sample' => 'Angaben aufgenommen durch Aktions Leitung am 18.06.2026.'],
], ],
], ],
@@ -4,6 +4,7 @@ use App\Domains\ParticipantRefund\Controllers\AcceptRefundController;
use App\Domains\ParticipantRefund\Controllers\CancelRefundController; use App\Domains\ParticipantRefund\Controllers\CancelRefundController;
use App\Domains\ParticipantRefund\Controllers\RefundDocumentController; use App\Domains\ParticipantRefund\Controllers\RefundDocumentController;
use App\Domains\ParticipantRefund\Controllers\ReleaseRefundController; use App\Domains\ParticipantRefund\Controllers\ReleaseRefundController;
use App\Domains\ParticipantRefund\Controllers\ResendRefundMailController;
use App\Middleware\IdentifyTenant; use App\Middleware\IdentifyTenant;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
@@ -17,6 +18,7 @@ Route::prefix('api/v1')
Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () {
Route::post('{participantIdentifier}/release', ReleaseRefundController::class); Route::post('{participantIdentifier}/release', ReleaseRefundController::class);
Route::post('{refundToken}/cancel', CancelRefundController::class); Route::post('{refundToken}/cancel', CancelRefundController::class);
Route::post('{refundToken}/resend-mail', ResendRefundMailController::class);
Route::get('{refundToken}/document', RefundDocumentController::class); Route::get('{refundToken}/document', RefundDocumentController::class);
}); });
}); });

Some files were not shown because too many files have changed in this diff Show More