Compare commits
23
Commits
7919d04dc3
...
dev-4.7.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bef494fc4c | ||
|
|
6e4e6b645c | ||
|
|
085299336e | ||
|
|
81912d2433 | ||
|
|
ea57f9400e | ||
|
|
cd51eb3f97 | ||
|
|
1cc84716a1 | ||
|
|
0ee952212b | ||
|
|
e95de52768 | ||
|
|
9581176a0c | ||
|
|
554166803b | ||
|
|
5031d3bde0 | ||
|
|
09f9767eb7 | ||
|
|
b3bbeb5b0b | ||
|
|
c17facf063 | ||
|
|
6b33c1b4dd | ||
|
|
72e0502bb9 | ||
|
|
3b47979265 | ||
|
|
b15573cda6 | ||
|
|
67c4e69f7b | ||
|
|
7f8417e915 | ||
|
|
f8dba18854 | ||
|
|
daff70b4fe |
@@ -56,6 +56,8 @@ MAIL_PASSWORD=null
|
|||||||
MAIL_FROM_ADDRESS="hello@example.com"
|
MAIL_FROM_ADDRESS="hello@example.com"
|
||||||
MAIL_FROM_NAME="${APP_NAME}"
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
APP_ADMIN_MAIL=
|
||||||
|
|
||||||
AWS_ACCESS_KEY_ID=
|
AWS_ACCESS_KEY_ID=
|
||||||
AWS_SECRET_ACCESS_KEY=
|
AWS_SECRET_ACCESS_KEY=
|
||||||
AWS_DEFAULT_REGION=us-east-1
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
|||||||
@@ -15,3 +15,60 @@ Routing, Mails) stehen in `.ai/conventions.md` und werden hier eingebunden — *
|
|||||||
|
|
||||||
- [Zahlungsmodule](app/EventPaymentModules/CLAUDE.md) — interface-gesteuerte Zahlungsarten (Optionen, Config,
|
- [Zahlungsmodule](app/EventPaymentModules/CLAUDE.md) — interface-gesteuerte Zahlungsarten (Optionen, Config,
|
||||||
Anmelde-Zusammenfassung, GiroCode/Fähigkeits-Interfaces, neues Modul hinzufügen).
|
Anmelde-Zusammenfassung, GiroCode/Fähigkeits-Interfaces, neues Modul hinzufügen).
|
||||||
|
|
||||||
|
## Umsatzsteuer / Steuerinformationen
|
||||||
|
|
||||||
|
Rechtlich korrekter Begriff ist **Umsatzsteuer (USt)**, nicht MwSt. Ziel: tagesbasierte Anmelde-Rechnungen („Teilnahme
|
||||||
|
Veranstaltung X in Gruppe Y" × Anwesenheitstage × Beitrag/Tag). Grundlage ist gebaut, die Rechnungs-PDF/-berechnung
|
||||||
|
folgt noch.
|
||||||
|
|
||||||
|
### Tenant-Einstellungen (Tab „Steuerinformationen")
|
||||||
|
|
||||||
|
Felder auf `tenants` (Self-Service `TenantData.vue` + verwaltet `TenantEdit.vue`, Partial `TenantTaxInfo.vue`,
|
||||||
|
Controller `TenantTax*` / `ManagedTenantTax*`, Action `UpdateTenantTax`):
|
||||||
|
|
||||||
|
- `tax_liable` (bool) — ob USt-Pflicht besteht.
|
||||||
|
- `vat_rate` (int, %) — USt-Satz, nur relevant wenn `tax_liable` (0–100, geclamped).
|
||||||
|
- `vat_pricing_mode` (Enum `App\Enumerations\VatPricingMode`, natives PHP-Enum: `inclusive` | `add_on`).
|
||||||
|
- `tax_exemption_reason` (FK → `tax_exemption_reasons.slug`, nullable) — Grund wenn **nicht** steuerpflichtig.
|
||||||
|
DB-Default neuer Tenants: `ustg_4_25a` (Jugendhilfe).
|
||||||
|
- `tax_exemption_note` (text, nullable) — Freitext, nur bei Grund `custom` (`requires_note`).
|
||||||
|
|
||||||
|
### Preismodus — **das Kernverhalten**
|
||||||
|
|
||||||
|
Es wird **immer der finale Brutto-Beitrag** pro Anmeldung gespeichert (`EventParticipant.amount`, keine USt-Spalten am
|
||||||
|
Teilnehmer). Der Modus wirkt **nur bei der Preisermittlung im Anmeldeprozess**:
|
||||||
|
|
||||||
|
- **`inclusive`** (Brutto / „zusammenfassen", Supermarkt-Prinzip, Default): der konfigurierte Beitrag **ist** der
|
||||||
|
Endpreis, USt ist bereits enthalten → Preis bleibt gleich; die USt wird erst **auf der Rechnung herausgerechnet**:
|
||||||
|
`USt = brutto × Satz / (100 + Satz)`, `netto = brutto − USt`.
|
||||||
|
- **`add_on`** (Netto / „aufaddieren"): der konfigurierte Beitrag ist netto → Endpreis = `Beitrag × (1 + Satz/100)`. Die
|
||||||
|
USt wird bei der Anmeldung **aufgeschlagen** → Teilnehmer zahlt mehr.
|
||||||
|
|
||||||
|
Umsetzung in `App\Resources\EventResource::calculateAmount()`: nach allen Multiplikatoren (Early-Bird, `pay_per_day`,
|
||||||
|
Geschwister) gilt
|
||||||
|
`if ($event->tax_liable && $event->vat_pricing_mode === VatPricingMode::AddOn->value) $fee->multiply(1 + $event->vat_rate/100);`
|
||||||
|
danach `round(…, 2)`. Bei `inclusive`/nicht steuerpflichtig bleibt der Beitrag unverändert.
|
||||||
|
|
||||||
|
### Event-Snapshot (unveränderlich)
|
||||||
|
|
||||||
|
Bei Event-Anlage (`CreateEventCommand::execute()`) werden `tax_liable`, `vat_rate`, `vat_pricing_mode`,
|
||||||
|
`tax_exemption_reason`, `tax_exemption_note` aus dem Tenant **auf das Event kopiert und dort eingefroren** (Spalten auf
|
||||||
|
`events`). Preisermittlung und spätere Rechnungen lesen vom Event, nicht vom Tenant → spätere Tenant-Änderungen berühren
|
||||||
|
bestehende Events/Rechnungen nicht.
|
||||||
|
|
||||||
|
### Befreiungsgründe (DB-gestützt)
|
||||||
|
|
||||||
|
Tabelle `tax_exemption_reasons`, Model `App\Enumerations\TaxExemptionReason` (Eloquent, `slug` PK; `name`,
|
||||||
|
`invoice_text`, `requires_note`, `sort_order`). `options()` liefert `{value,label,text}` sortiert nach `sort_order`. FK
|
||||||
|
von `tenants` **und** `events`. Seed in Migration `170010`, verfeinert in `170020`. Gründe (in Reihenfolge):
|
||||||
|
`ustg_19` (§ 19 Kleinunternehmer), `ustg_4_24` (§ 4 Nr. 24 Jugendherbergen),
|
||||||
|
`ustg_4_25a` (§ 4 Nr. 25 Buchst. a — Jugendhilfe-Veranstaltungen, Default), `ustg_4_22a` (§ 4 Nr. 22 Buchst. a —
|
||||||
|
Vorträge/Kurse), `custom` (Freitext). Jeder Grund kapselt den Rechnungs-Pflichthinweis nach **§ 14 Abs. 4 Nr. 8 UStG**
|
||||||
|
(`invoice_text`; bei `custom` der Tenant-Freitext via `invoiceText(?note)`). Gemeinnützigkeit allein befreit **nicht** —
|
||||||
|
es braucht immer einen konkreten Rechtsgrund.
|
||||||
|
|
||||||
|
### Noch offen (nächster Schritt)
|
||||||
|
|
||||||
|
Die eigentliche **Rechnung**: tagesbasierte Positionen, USt aus dem gespeicherten Brutto herausrechnen (Satz vom
|
||||||
|
Event-Snapshot); bei Befreiung kein USt-Ausweis, stattdessen der Pflichthinweis des Grundes.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class CreateTenantAction
|
|||||||
|
|
||||||
$paymentMethodDefaults = PaymentMethod::defaults();
|
$paymentMethodDefaults = PaymentMethod::defaults();
|
||||||
foreach (PaymentMethod::all() as $paymentMethod) {
|
foreach (PaymentMethod::all() as $paymentMethod) {
|
||||||
$defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null];
|
$defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null, 'configuration' => []];
|
||||||
|
|
||||||
AvailablePaymentMethod::create([
|
AvailablePaymentMethod::create([
|
||||||
'tenant' => $tenant->slug,
|
'tenant' => $tenant->slug,
|
||||||
@@ -41,6 +41,7 @@ class CreateTenantAction
|
|||||||
'name' => $defaults['name'],
|
'name' => $defaults['name'],
|
||||||
'description' => $defaults['description'],
|
'description' => $defaults['description'],
|
||||||
'active' => true,
|
'active' => true,
|
||||||
|
'configuration' => PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $defaults['configuration'] ?? []),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Domains\Admin\Actions\UpdateTenantPayment;
|
namespace App\Domains\Admin\Actions\UpdateTenantPayment;
|
||||||
|
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
|
use App\Models\PaymentMethod;
|
||||||
|
use App\Scopes\SiteScope;
|
||||||
|
|
||||||
class UpdateTenantPaymentAction
|
class UpdateTenantPaymentAction
|
||||||
{
|
{
|
||||||
public function __construct(private UpdateTenantPaymentRequest $request)
|
public function __construct(private UpdateTenantPaymentRequest $request)
|
||||||
@@ -18,9 +22,41 @@ class UpdateTenantPaymentAction
|
|||||||
'account_name' => $this->request->accountName,
|
'account_name' => $this->request->accountName,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->syncTransferPaymentConfiguration();
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
$response->message = 'Bezahldaten wurden gespeichert.';
|
$response->message = 'IBAN-Informationen wurden gespeichert.';
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Übernimmt die eingegebenen IBAN-Daten direkt in die Tenant-Config der Überweisungs-Zahlungsart
|
||||||
|
* (Kontoinhaber/IBAN/BIC), damit sie nicht doppelt gepflegt werden müssen. Bestehende weitere
|
||||||
|
* Config-Werte (z.B. Symbol) bleiben erhalten. Der Ziel-Tenant kann ein verwalteter sein, daher
|
||||||
|
* ohne SiteScope explizit auf den Tenant-Slug gefiltert.
|
||||||
|
*/
|
||||||
|
private function syncTransferPaymentConfiguration(): void
|
||||||
|
{
|
||||||
|
$slug = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION;
|
||||||
|
|
||||||
|
$method = AvailablePaymentMethod::withoutGlobalScope(SiteScope::class)
|
||||||
|
->where('tenant', $this->request->tenant->slug)
|
||||||
|
->where('slug', $slug)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($method === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$method->configuration = PaymentMethod::sanitizeConfiguration($slug, array_merge(
|
||||||
|
$method->configuration ?? [],
|
||||||
|
[
|
||||||
|
'account_owner' => $this->request->accountName,
|
||||||
|
'iban' => $this->request->accountIban,
|
||||||
|
'bic' => $this->request->accountBic,
|
||||||
|
],
|
||||||
|
));
|
||||||
|
$method->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateTenantTax;
|
||||||
|
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
|
|
||||||
|
class UpdateTenantTaxAction
|
||||||
|
{
|
||||||
|
public function __construct(private UpdateTenantTaxRequest $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): UpdateTenantTaxResponse
|
||||||
|
{
|
||||||
|
$response = new UpdateTenantTaxResponse();
|
||||||
|
|
||||||
|
if ($this->request->taxLiable) {
|
||||||
|
$this->request->tenant->update([
|
||||||
|
'tax_liable' => true,
|
||||||
|
'vat_rate' => $this->clampVatRate($this->request->vatRate),
|
||||||
|
'vat_pricing_mode' => $this->request->vatPricingMode->value,
|
||||||
|
'tax_exemption_reason' => null,
|
||||||
|
'tax_exemption_note' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
$response->message = 'Steuerinformationen wurden gespeichert.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$reason = $this->request->exemptionReason;
|
||||||
|
|
||||||
|
if ($reason === null) {
|
||||||
|
$response->message = 'Bitte einen gültigen Befreiungsgrund auswählen.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$note = trim((string)$this->request->exemptionNote);
|
||||||
|
|
||||||
|
if ($reason->requires_note && $note === '') {
|
||||||
|
$response->message = 'Bitte einen Text für den Befreiungsgrund angeben.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->request->tenant->update([
|
||||||
|
'tax_liable' => false,
|
||||||
|
'vat_rate' => 0,
|
||||||
|
'vat_pricing_mode' => VatPricingMode::Inclusive->value,
|
||||||
|
'tax_exemption_reason' => $reason->slug,
|
||||||
|
'tax_exemption_note' => $reason->requires_note ? $note : null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
$response->message = 'Steuerinformationen wurden gespeichert.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function clampVatRate(int $vatRate): int
|
||||||
|
{
|
||||||
|
return max(0, min(100, $vatRate));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateTenantTax;
|
||||||
|
|
||||||
|
use App\Enumerations\TaxExemptionReason;
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
|
use App\Models\Tenant;
|
||||||
|
|
||||||
|
class UpdateTenantTaxRequest
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public Tenant $tenant,
|
||||||
|
public bool $taxLiable,
|
||||||
|
public int $vatRate,
|
||||||
|
public ?TaxExemptionReason $exemptionReason,
|
||||||
|
public ?string $exemptionNote,
|
||||||
|
public VatPricingMode $vatPricingMode,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateTenantTax;
|
||||||
|
|
||||||
|
class UpdateTenantTaxResponse
|
||||||
|
{
|
||||||
|
public bool $success = false;
|
||||||
|
public string $message = '';
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Enumerations\TaxExemptionReason;
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantTaxGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = $this->adminTenants->findBySlug($slug);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'tax_liable' => $tenant->tax_liable,
|
||||||
|
'vat_rate' => $tenant->vat_rate,
|
||||||
|
'tax_exemption_reason' => $tenant->tax_exemption_reason,
|
||||||
|
'tax_exemption_note' => $tenant->tax_exemption_note,
|
||||||
|
'vat_pricing_mode' => $tenant->vat_pricing_mode,
|
||||||
|
'exemption_reasons' => TaxExemptionReason::options(),
|
||||||
|
'pricing_modes' => VatPricingMode::options(),
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/tax',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Domains\Admin\Actions\UpdateTenantTax\UpdateTenantTaxAction;
|
||||||
|
use App\Domains\Admin\Actions\UpdateTenantTax\UpdateTenantTaxRequest;
|
||||||
|
use App\Enumerations\TaxExemptionReason;
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantTaxUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = $this->adminTenants->findBySlug($slug);
|
||||||
|
|
||||||
|
$action = new UpdateTenantTaxAction(new UpdateTenantTaxRequest(
|
||||||
|
tenant: $tenant,
|
||||||
|
taxLiable: $request->boolean('tax_liable'),
|
||||||
|
vatRate: (int)$request->input('vat_rate', 0),
|
||||||
|
exemptionReason: TaxExemptionReason::where('slug', $request->input('tax_exemption_reason'))->first(),
|
||||||
|
exemptionNote: $request->input('tax_exemption_note'),
|
||||||
|
vatPricingMode: VatPricingMode::tryFrom((string) $request->input('vat_pricing_mode', 'inclusive')) ?? VatPricingMode::Inclusive,
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $action->execute();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => $response->success ? 'success' : 'error',
|
||||||
|
'message' => $response->message,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Enumerations\TaxExemptionReason;
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantTaxGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'tax_liable' => $this->tenant->tax_liable,
|
||||||
|
'vat_rate' => $this->tenant->vat_rate,
|
||||||
|
'tax_exemption_reason' => $this->tenant->tax_exemption_reason,
|
||||||
|
'tax_exemption_note' => $this->tenant->tax_exemption_note,
|
||||||
|
'vat_pricing_mode' => $this->tenant->vat_pricing_mode,
|
||||||
|
'exemption_reasons' => TaxExemptionReason::options(),
|
||||||
|
'pricing_modes' => VatPricingMode::options(),
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenant/tax',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Domains\Admin\Actions\UpdateTenantTax\UpdateTenantTaxAction;
|
||||||
|
use App\Domains\Admin\Actions\UpdateTenantTax\UpdateTenantTaxRequest;
|
||||||
|
use App\Enumerations\TaxExemptionReason;
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantTaxUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$action = new UpdateTenantTaxAction(new UpdateTenantTaxRequest(
|
||||||
|
tenant: $this->tenant,
|
||||||
|
taxLiable: $request->boolean('tax_liable'),
|
||||||
|
vatRate: (int)$request->input('vat_rate', 0),
|
||||||
|
exemptionReason: TaxExemptionReason::where('slug', $request->input('tax_exemption_reason'))->first(),
|
||||||
|
exemptionNote: $request->input('tax_exemption_note'),
|
||||||
|
vatPricingMode: VatPricingMode::tryFrom((string) $request->input('vat_pricing_mode', 'inclusive')) ?? VatPricingMode::Inclusive,
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $action->execute();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => $response->success ? 'success' : 'error',
|
||||||
|
'message' => $response->message,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Domains\Admin\Controllers\UserDetailGetController;
|
|
||||||
use App\Domains\Admin\Controllers\UserListApiController;
|
|
||||||
use App\Domains\Admin\Controllers\UserResetPasswordController;
|
|
||||||
use App\Domains\Admin\Controllers\UserToggleActiveController;
|
|
||||||
use App\Domains\Admin\Controllers\UserUpdateController;
|
|
||||||
use App\Domains\Admin\Controllers\ManagedTenantContactGetController;
|
use App\Domains\Admin\Controllers\ManagedTenantContactGetController;
|
||||||
use App\Domains\Admin\Controllers\ManagedTenantContactUpdateController;
|
use App\Domains\Admin\Controllers\ManagedTenantContactUpdateController;
|
||||||
use App\Domains\Admin\Controllers\ManagedTenantGdprGetController;
|
use App\Domains\Admin\Controllers\ManagedTenantGdprGetController;
|
||||||
@@ -13,6 +8,8 @@ use App\Domains\Admin\Controllers\ManagedTenantImpressGetController;
|
|||||||
use App\Domains\Admin\Controllers\ManagedTenantImpressUpdateController;
|
use App\Domains\Admin\Controllers\ManagedTenantImpressUpdateController;
|
||||||
use App\Domains\Admin\Controllers\ManagedTenantPaymentGetController;
|
use App\Domains\Admin\Controllers\ManagedTenantPaymentGetController;
|
||||||
use App\Domains\Admin\Controllers\ManagedTenantPaymentUpdateController;
|
use App\Domains\Admin\Controllers\ManagedTenantPaymentUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantTaxGetController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantTaxUpdateController;
|
||||||
use App\Domains\Admin\Controllers\TenantContactGetController;
|
use App\Domains\Admin\Controllers\TenantContactGetController;
|
||||||
use App\Domains\Admin\Controllers\TenantContactUpdateController;
|
use App\Domains\Admin\Controllers\TenantContactUpdateController;
|
||||||
use App\Domains\Admin\Controllers\TenantCreateController;
|
use App\Domains\Admin\Controllers\TenantCreateController;
|
||||||
@@ -24,9 +21,16 @@ use App\Domains\Admin\Controllers\TenantImpressGetController;
|
|||||||
use App\Domains\Admin\Controllers\TenantImpressUpdateController;
|
use App\Domains\Admin\Controllers\TenantImpressUpdateController;
|
||||||
use App\Domains\Admin\Controllers\TenantListApiController;
|
use App\Domains\Admin\Controllers\TenantListApiController;
|
||||||
use App\Domains\Admin\Controllers\TenantPaymentGetController;
|
use App\Domains\Admin\Controllers\TenantPaymentGetController;
|
||||||
use App\Domains\Admin\Controllers\TenantPaymentUpdateController;
|
|
||||||
use App\Domains\Admin\Controllers\TenantPaymentMethodsGetController;
|
use App\Domains\Admin\Controllers\TenantPaymentMethodsGetController;
|
||||||
use App\Domains\Admin\Controllers\TenantPaymentMethodsUpdateController;
|
use App\Domains\Admin\Controllers\TenantPaymentMethodsUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantPaymentUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantTaxGetController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantTaxUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\UserDetailGetController;
|
||||||
|
use App\Domains\Admin\Controllers\UserListApiController;
|
||||||
|
use App\Domains\Admin\Controllers\UserResetPasswordController;
|
||||||
|
use App\Domains\Admin\Controllers\UserToggleActiveController;
|
||||||
|
use App\Domains\Admin\Controllers\UserUpdateController;
|
||||||
use App\Middleware\AdminRoleMiddleware;
|
use App\Middleware\AdminRoleMiddleware;
|
||||||
use App\Middleware\IdentifyTenant;
|
use App\Middleware\IdentifyTenant;
|
||||||
use App\Middleware\LvOnlyMiddleware;
|
use App\Middleware\LvOnlyMiddleware;
|
||||||
@@ -44,6 +48,8 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
|||||||
Route::post('/impress', TenantImpressUpdateController::class);
|
Route::post('/impress', TenantImpressUpdateController::class);
|
||||||
Route::get('/gdpr', TenantGdprGetController::class);
|
Route::get('/gdpr', TenantGdprGetController::class);
|
||||||
Route::post('/gdpr', TenantGdprUpdateController::class);
|
Route::post('/gdpr', TenantGdprUpdateController::class);
|
||||||
|
Route::get('/tax', TenantTaxGetController::class);
|
||||||
|
Route::post('/tax', TenantTaxUpdateController::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::prefix('api/v1/admin/users')->group(function () {
|
Route::prefix('api/v1/admin/users')->group(function () {
|
||||||
@@ -69,6 +75,8 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
|||||||
Route::post('/impress', ManagedTenantImpressUpdateController::class);
|
Route::post('/impress', ManagedTenantImpressUpdateController::class);
|
||||||
Route::get('/gdpr', ManagedTenantGdprGetController::class);
|
Route::get('/gdpr', ManagedTenantGdprGetController::class);
|
||||||
Route::post('/gdpr', ManagedTenantGdprUpdateController::class);
|
Route::post('/gdpr', ManagedTenantGdprUpdateController::class);
|
||||||
|
Route::get('/tax', ManagedTenantTaxGetController::class);
|
||||||
|
Route::post('/tax', ManagedTenantTaxUpdateController::class);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
import {computed, ref} from 'vue';
|
import {computed, ref} from '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 {PAYMENT_METHOD_ICONS} from "../../../../../resources/js/constants/paymentMethodIcons.js";
|
||||||
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
||||||
import {toast} from "vue3-toastify";
|
import {toast} from "vue3-toastify";
|
||||||
|
|
||||||
@@ -90,15 +92,18 @@ async function save() {
|
|||||||
|
|
||||||
<FullScreenModal :show="editing !== null" @close="close">
|
<FullScreenModal :show="editing !== null" @close="close">
|
||||||
<template v-if="editing">
|
<template v-if="editing">
|
||||||
<h2>Zahlungsweg bearbeiten</h2>
|
<h2>Zahlungsmodul bearbeiten</h2>
|
||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
<tr><th>Name</th><td><input type="text" v-model="form.name" class="form-input" /></td></tr>
|
<tr><th>Name</th><td><input type="text" v-model="form.name" class="form-input" /></td></tr>
|
||||||
<tr><th>Beschreibung</th><td><textarea v-model="form.description" class="form-input"></textarea></td></tr>
|
<tr><th>Beschreibung</th><td><textarea v-model="form.description" class="form-input"></textarea></td></tr>
|
||||||
<tr v-for="option in editing.optionsSchema ?? []" :key="option.name">
|
<tr v-for="option in editing.optionsSchema ?? []" :key="option.name">
|
||||||
<th>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></th>
|
<th>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></th>
|
||||||
<td>
|
<td>
|
||||||
<TextEditor v-if="option.type === 'richtext'" 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…"/>
|
||||||
|
<TextEditor v-else-if="option.type === 'richtext'" v-model="form.configuration[option.name]"/>
|
||||||
<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>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -217,6 +222,13 @@ async function save() {
|
|||||||
color: #b45309;
|
color: #b45309;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.option-hint {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-group {
|
.btn-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|||||||
@@ -0,0 +1,240 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, ref} from 'vue';
|
||||||
|
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
||||||
|
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
|
||||||
|
import {toast} from "vue3-toastify";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const {request} = useAjax()
|
||||||
|
|
||||||
|
const editing = ref(false)
|
||||||
|
|
||||||
|
const reasons = computed(() => props.data.exemption_reasons ?? [])
|
||||||
|
const pricingModes = computed(() => props.data.pricing_modes ?? [])
|
||||||
|
|
||||||
|
const liableOptions = [
|
||||||
|
{value: '1', label: 'Ja – Umsatzsteuer wird erhoben'},
|
||||||
|
{value: '0', label: 'Nein – umsatzsteuerbefreit'},
|
||||||
|
]
|
||||||
|
|
||||||
|
const form = ref({
|
||||||
|
tax_liable: props.data.tax_liable ? '1' : '0',
|
||||||
|
vat_rate: props.data.vat_rate ?? 0,
|
||||||
|
tax_exemption_reason: props.data.tax_exemption_reason ?? '',
|
||||||
|
tax_exemption_note: props.data.tax_exemption_note ?? '',
|
||||||
|
vat_pricing_mode: props.data.vat_pricing_mode ?? 'inclusive',
|
||||||
|
})
|
||||||
|
|
||||||
|
const isLiable = computed(() => form.value.tax_liable === '1')
|
||||||
|
const isCustomReason = computed(() => form.value.tax_exemption_reason === 'custom')
|
||||||
|
|
||||||
|
const selectedReason = computed(
|
||||||
|
() => reasons.value.find(r => r.value === form.value.tax_exemption_reason) ?? null
|
||||||
|
)
|
||||||
|
|
||||||
|
const pricingModeLabel = computed(
|
||||||
|
() => pricingModes.value.find(m => m.value === form.value.vat_pricing_mode)?.label ?? '—'
|
||||||
|
)
|
||||||
|
|
||||||
|
// Vorschau des Pflichthinweises nach § 14 Abs. 4 Nr. 8 UStG, der später auf der Rechnung erscheint.
|
||||||
|
const invoiceHint = computed(() => {
|
||||||
|
if (isLiable.value) {
|
||||||
|
return `Umsatzsteuerpflichtig – USt-Satz: ${form.value.vat_rate || 0} %`
|
||||||
|
}
|
||||||
|
if (isCustomReason.value) {
|
||||||
|
return form.value.tax_exemption_note?.trim() || '—'
|
||||||
|
}
|
||||||
|
return selectedReason.value?.text || '—'
|
||||||
|
})
|
||||||
|
|
||||||
|
const reasonLabel = computed(() => selectedReason.value?.label ?? '—')
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenant/tax'
|
||||||
|
const response = await request(saveUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
body: {
|
||||||
|
tax_liable: isLiable.value,
|
||||||
|
vat_rate: Number(form.value.vat_rate) || 0,
|
||||||
|
tax_exemption_reason: isLiable.value ? null : form.value.tax_exemption_reason,
|
||||||
|
tax_exemption_note: form.value.tax_exemption_note,
|
||||||
|
vat_pricing_mode: form.value.vat_pricing_mode,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response && response.status === 'success') {
|
||||||
|
toast.success(response.message)
|
||||||
|
editing.value = false
|
||||||
|
} else {
|
||||||
|
toast.error(response?.message ?? 'Fehler beim Speichern')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="!editing">
|
||||||
|
<table class="data-table">
|
||||||
|
<tr>
|
||||||
|
<th>Steuerpflicht</th>
|
||||||
|
<td>{{ isLiable ? 'Ja – Umsatzsteuer wird erhoben' : 'Nein – umsatzsteuerbefreit' }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="isLiable">
|
||||||
|
<th>USt-Satz</th>
|
||||||
|
<td>{{ form.vat_rate || 0 }} %</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="isLiable">
|
||||||
|
<th>Preismodus</th>
|
||||||
|
<td>{{ pricingModeLabel }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-else>
|
||||||
|
<th>Befreiungsgrund</th>
|
||||||
|
<td>{{ reasonLabel }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Rechnungshinweis</th>
|
||||||
|
<td>{{ invoiceHint }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button class="btn-edit" @click="editing = true">Bearbeiten</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<table class="data-table">
|
||||||
|
<tr>
|
||||||
|
<th>Steuerpflicht</th>
|
||||||
|
<td>
|
||||||
|
<RichSelectBox v-model="form.tax_liable" :options="liableOptions"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr v-if="isLiable">
|
||||||
|
<th>USt-Satz (%)</th>
|
||||||
|
<td><input type="number" min="0" max="100" v-model.number="form.vat_rate" class="form-input"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="isLiable">
|
||||||
|
<th>Preismodus</th>
|
||||||
|
<td>
|
||||||
|
<RichSelectBox v-model="form.vat_pricing_mode" :options="pricingModes"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<tr>
|
||||||
|
<th>Befreiungsgrund</th>
|
||||||
|
<td>
|
||||||
|
<RichSelectBox
|
||||||
|
v-model="form.tax_exemption_reason"
|
||||||
|
:options="reasons"
|
||||||
|
placeholder="Grund auswählen…"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="isCustomReason">
|
||||||
|
<th>Freitext</th>
|
||||||
|
<td>
|
||||||
|
<textarea
|
||||||
|
v-model="form.tax_exemption_note"
|
||||||
|
class="form-input"
|
||||||
|
rows="3"
|
||||||
|
placeholder="Hinweistext für die Rechnung…"
|
||||||
|
></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>Rechnungshinweis</th>
|
||||||
|
<td class="hint-preview">{{ invoiceHint }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn-save" @click="save">Speichern</button>
|
||||||
|
<button class="btn-cancel" @click="editing = false">Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.data-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px 12px;
|
||||||
|
width: 200px;
|
||||||
|
color: #374151;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table td {
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint-preview {
|
||||||
|
color: #6b7280;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit, .btn-save, .btn-cancel {
|
||||||
|
margin-top: 15px;
|
||||||
|
padding: 8px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit {
|
||||||
|
background-color: #1d4899;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit:hover {
|
||||||
|
background-color: #163a7a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save {
|
||||||
|
background-color: #16a34a;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save:hover {
|
||||||
|
background-color: #15803d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel {
|
||||||
|
background-color: #e5e7eb;
|
||||||
|
color: #374151;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel:hover {
|
||||||
|
background-color: #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -7,6 +7,7 @@ import TenantPayment from "./Partials/TenantPayment.vue";
|
|||||||
import TenantImpress from "./Partials/TenantImpress.vue";
|
import TenantImpress from "./Partials/TenantImpress.vue";
|
||||||
import TenantGdpr from "./Partials/TenantGdpr.vue";
|
import TenantGdpr from "./Partials/TenantGdpr.vue";
|
||||||
import TenantPaymentMethods from "./Partials/TenantPaymentMethods.vue";
|
import TenantPaymentMethods from "./Partials/TenantPaymentMethods.vue";
|
||||||
|
import TenantTaxInfo from "./Partials/TenantTaxInfo.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
tenant: Object,
|
tenant: Object,
|
||||||
@@ -19,15 +20,20 @@ const tabs = [
|
|||||||
endpoint: '/api/v1/admin/tenant/contact',
|
endpoint: '/api/v1/admin/tenant/contact',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Bezahldaten',
|
title: 'IBAN-Informationen',
|
||||||
component: TenantPayment,
|
component: TenantPayment,
|
||||||
endpoint: '/api/v1/admin/tenant/payment',
|
endpoint: '/api/v1/admin/tenant/payment',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Zahlungswege',
|
title: 'Zahlungsmodule',
|
||||||
component: TenantPaymentMethods,
|
component: TenantPaymentMethods,
|
||||||
endpoint: '/api/v1/admin/tenant/payment-methods',
|
endpoint: '/api/v1/admin/tenant/payment-methods',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Steuerinformationen',
|
||||||
|
component: TenantTaxInfo,
|
||||||
|
endpoint: '/api/v1/admin/tenant/tax',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Impressum',
|
title: 'Impressum',
|
||||||
component: TenantImpress,
|
component: TenantImpress,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import TenantContact from "./Partials/TenantContact.vue";
|
|||||||
import TenantPayment from "./Partials/TenantPayment.vue";
|
import TenantPayment from "./Partials/TenantPayment.vue";
|
||||||
import TenantImpress from "./Partials/TenantImpress.vue";
|
import TenantImpress from "./Partials/TenantImpress.vue";
|
||||||
import TenantGdpr from "./Partials/TenantGdpr.vue";
|
import TenantGdpr from "./Partials/TenantGdpr.vue";
|
||||||
|
import TenantTaxInfo from "./Partials/TenantTaxInfo.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
tenant: Object,
|
tenant: Object,
|
||||||
@@ -26,10 +27,15 @@ const tabs = [
|
|||||||
endpoint: '/api/v1/admin/tenants/' + slug + '/contact',
|
endpoint: '/api/v1/admin/tenants/' + slug + '/contact',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Bezahldaten',
|
title: 'IBAN-Informationen',
|
||||||
component: TenantPayment,
|
component: TenantPayment,
|
||||||
endpoint: '/api/v1/admin/tenants/' + slug + '/payment',
|
endpoint: '/api/v1/admin/tenants/' + slug + '/payment',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Steuerinformationen',
|
||||||
|
component: TenantTaxInfo,
|
||||||
|
endpoint: '/api/v1/admin/tenants/' + slug + '/tax',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Impressum',
|
title: 'Impressum',
|
||||||
component: TenantImpress,
|
component: TenantImpress,
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ class CreateEventCommand {
|
|||||||
'total_max_amount' => 0,
|
'total_max_amount' => 0,
|
||||||
'support_per_person' => 0,
|
'support_per_person' => 0,
|
||||||
'support_flat' => 0,
|
'support_flat' => 0,
|
||||||
|
// Umsatzsteuerliche Grundlage bei Anlage einfrieren (unveränderlich), damit Preisermittlung und
|
||||||
|
// spätere Rechnungen von späteren Tenant-Änderungen unberührt bleiben.
|
||||||
|
'tax_liable' => app('tenant')->tax_liable,
|
||||||
|
'vat_rate' => app('tenant')->vat_rate,
|
||||||
|
'vat_pricing_mode' => app('tenant')->vat_pricing_mode,
|
||||||
|
'tax_exemption_reason' => app('tenant')->tax_exemption_reason,
|
||||||
|
'tax_exemption_note' => app('tenant')->tax_exemption_note,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($event !== null) {
|
if ($event !== null) {
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetEventAddons;
|
||||||
|
|
||||||
|
use App\ValueObjects\Amount;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class SetEventAddonsCommand
|
||||||
|
{
|
||||||
|
public function __construct(private SetEventAddonsRequest $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): SetEventAddonsResponse
|
||||||
|
{
|
||||||
|
$response = new SetEventAddonsResponse();
|
||||||
|
|
||||||
|
$this->request->event->addons = $this->normalize($this->request->addons);
|
||||||
|
$this->request->event->save();
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalisiert die rohe Addon-Definition: trimmt Titel/Beschreibung, parst den Preis (≥ 0), erzwingt den
|
||||||
|
* Titel als Pflichtfeld und generiert stabile Keys (Bestandsschutz für bereits gespeicherte Buchungen).
|
||||||
|
*
|
||||||
|
* @param array<int, array<string, mixed>> $addons
|
||||||
|
* @return array<int, array{key: string, title: string, description: string, price: float, flat: bool}>
|
||||||
|
*/
|
||||||
|
private function normalize(array $addons): array
|
||||||
|
{
|
||||||
|
$normalized = [];
|
||||||
|
$usedKeys = [];
|
||||||
|
|
||||||
|
foreach ($addons as $addon) {
|
||||||
|
$title = trim((string)($addon['title'] ?? ''));
|
||||||
|
if ($title === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$price = Amount::fromString((string)($addon['price'] ?? '0'))->getAmount();
|
||||||
|
if ($price < 0) {
|
||||||
|
$price = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$key = $this->uniqueSlug((string)($addon['key'] ?? ''), $title, $usedKeys);
|
||||||
|
$usedKeys[] = $key;
|
||||||
|
|
||||||
|
$normalized[] = [
|
||||||
|
'key' => $key,
|
||||||
|
'title' => $title,
|
||||||
|
'description' => trim((string)($addon['description'] ?? '')),
|
||||||
|
'price' => round($price, 2),
|
||||||
|
'flat' => (bool)($addon['flat'] ?? false),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert einen eindeutigen Slug: bevorzugt den bestehenden Wert, sonst aus dem Titel abgeleitet;
|
||||||
|
* Kollisionen werden durchnummeriert.
|
||||||
|
*
|
||||||
|
* @param array<int, string> $used
|
||||||
|
*/
|
||||||
|
private function uniqueSlug(string $existing, string $title, array $used): string
|
||||||
|
{
|
||||||
|
$base = $existing !== '' ? $existing : Str::slug($title);
|
||||||
|
if ($base === '') {
|
||||||
|
$base = 'addon';
|
||||||
|
}
|
||||||
|
|
||||||
|
$candidate = $base;
|
||||||
|
$suffix = 2;
|
||||||
|
while (in_array($candidate, $used, true)) {
|
||||||
|
$candidate = $base . '-' . $suffix;
|
||||||
|
$suffix++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $candidate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetEventAddons;
|
||||||
|
|
||||||
|
use App\Models\Event;
|
||||||
|
|
||||||
|
class SetEventAddonsRequest
|
||||||
|
{
|
||||||
|
public Event $event;
|
||||||
|
|
||||||
|
/** @var array<int, array<string, mixed>> Rohe Addon-Definition aus dem Admin-Panel. */
|
||||||
|
public array $addons;
|
||||||
|
|
||||||
|
public function __construct(Event $event, array $addons)
|
||||||
|
{
|
||||||
|
$this->event = $event;
|
||||||
|
$this->addons = $addons;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetEventAddons;
|
||||||
|
|
||||||
|
class SetEventAddonsResponse
|
||||||
|
{
|
||||||
|
public bool $success;
|
||||||
|
public ?string $message;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->success = false;
|
||||||
|
$this->message = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetParticipationOptions;
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class SetParticipationOptionsCommand
|
||||||
|
{
|
||||||
|
public function __construct(private SetParticipationOptionsRequest $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): SetParticipationOptionsResponse
|
||||||
|
{
|
||||||
|
$response = new SetParticipationOptionsResponse();
|
||||||
|
|
||||||
|
$this->request->event->participation_options = $this->normalize($this->request->questions);
|
||||||
|
$this->request->event->save();
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalisiert die rohe Fragen-Definition: trimmt Labels, generiert stabile Keys/Values und verwirft
|
||||||
|
* unvollständige Fragen (kein Label oder keine gültige Option). Keys/Values sind innerhalb ihres
|
||||||
|
* Geltungsbereichs eindeutig, damit Antworten robust referenzieren können.
|
||||||
|
*
|
||||||
|
* @param array<int, array<string, mixed>> $questions
|
||||||
|
* @return array<int, array{key: string, title: string, label: string, options: array<int, array{value: string, label: string}>}>
|
||||||
|
*/
|
||||||
|
private function normalize(array $questions): array
|
||||||
|
{
|
||||||
|
$normalized = [];
|
||||||
|
$usedKeys = [];
|
||||||
|
|
||||||
|
foreach ($questions as $question) {
|
||||||
|
// Titel ist Pflicht (Überschrift/Feldbeschriftung); die Frage ist optionaler Erklärtext.
|
||||||
|
$title = trim((string)($question['title'] ?? ''));
|
||||||
|
if ($title === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = trim((string)($question['label'] ?? ''));
|
||||||
|
|
||||||
|
$options = $this->normalizeOptions($question['options'] ?? []);
|
||||||
|
if ($options === []) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$key = $this->uniqueSlug((string)($question['key'] ?? ''), $title, $usedKeys);
|
||||||
|
$usedKeys[] = $key;
|
||||||
|
|
||||||
|
$normalized[] = [
|
||||||
|
'key' => $key,
|
||||||
|
'title' => $title,
|
||||||
|
'label' => $label,
|
||||||
|
'options' => $options,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<int, array<string, mixed>> $options
|
||||||
|
* @return array<int, array{value: string, label: string}>
|
||||||
|
*/
|
||||||
|
private function normalizeOptions(mixed $options): array
|
||||||
|
{
|
||||||
|
if (!is_array($options)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$normalized = [];
|
||||||
|
$usedValues = [];
|
||||||
|
|
||||||
|
foreach ($options as $option) {
|
||||||
|
$label = trim((string)($option['label'] ?? ''));
|
||||||
|
if ($label === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $this->uniqueSlug((string)($option['value'] ?? ''), $label, $usedValues);
|
||||||
|
$usedValues[] = $value;
|
||||||
|
|
||||||
|
$normalized[] = ['value' => $value, 'label' => $label];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert einen eindeutigen Slug: bevorzugt den bestehenden Wert (Bestandsschutz für schon gespeicherte
|
||||||
|
* Fragen/Antworten), sonst aus dem Label abgeleitet; Kollisionen werden durchnummeriert.
|
||||||
|
*
|
||||||
|
* @param array<int, string> $used
|
||||||
|
*/
|
||||||
|
private function uniqueSlug(string $existing, string $label, array $used): string
|
||||||
|
{
|
||||||
|
$base = $existing !== '' ? $existing : Str::slug($label);
|
||||||
|
if ($base === '') {
|
||||||
|
$base = 'option';
|
||||||
|
}
|
||||||
|
|
||||||
|
$candidate = $base;
|
||||||
|
$suffix = 2;
|
||||||
|
while (in_array($candidate, $used, true)) {
|
||||||
|
$candidate = $base . '-' . $suffix;
|
||||||
|
$suffix++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $candidate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetParticipationOptions;
|
||||||
|
|
||||||
|
use App\Models\Event;
|
||||||
|
|
||||||
|
class SetParticipationOptionsRequest
|
||||||
|
{
|
||||||
|
public Event $event;
|
||||||
|
|
||||||
|
/** @var array<int, array<string, mixed>> Rohe Fragen-Definition aus dem Admin-Panel. */
|
||||||
|
public array $questions;
|
||||||
|
|
||||||
|
public function __construct(Event $event, array $questions)
|
||||||
|
{
|
||||||
|
$this->event = $event;
|
||||||
|
$this->questions = $questions;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetParticipationOptions;
|
||||||
|
|
||||||
|
class SetParticipationOptionsResponse
|
||||||
|
{
|
||||||
|
public bool $success;
|
||||||
|
public ?string $message;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->success = false;
|
||||||
|
$this->message = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetPaymentMethods;
|
||||||
|
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
|
use App\Models\PaymentMethod;
|
||||||
|
use App\RelationModels\EventPaymentMethods;
|
||||||
|
|
||||||
|
class SetPaymentMethodsCommand
|
||||||
|
{
|
||||||
|
public SetPaymentMethodsRequest $request;
|
||||||
|
|
||||||
|
public function __construct(SetPaymentMethodsRequest $request)
|
||||||
|
{
|
||||||
|
$this->request = $request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): SetPaymentMethodsResponse
|
||||||
|
{
|
||||||
|
$response = new SetPaymentMethodsResponse();
|
||||||
|
|
||||||
|
if (count($this->request->paymentMethods) === 0) {
|
||||||
|
$response->success = false;
|
||||||
|
$response->message = 'Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.';
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->syncPaymentMethods();
|
||||||
|
|
||||||
|
$this->request->event->save();
|
||||||
|
$response->success = true;
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Differenzieller Sync der Zahlungsmethoden mit Snapshot-Copy-Semantik:
|
||||||
|
* - entfernte Methoden werden gelöscht,
|
||||||
|
* - neue Methoden erhalten einen Snapshot der Tenant-Config (oder eines expliziten Overrides),
|
||||||
|
* - bestehende Methoden behalten ihre pro-Event-Config, sofern kein Override übergeben wird.
|
||||||
|
*/
|
||||||
|
private function syncPaymentMethods(): void
|
||||||
|
{
|
||||||
|
$event = $this->request->event;
|
||||||
|
$desiredSlugs = $this->request->paymentMethods;
|
||||||
|
$overrides = $this->request->paymentMethodConfigurations;
|
||||||
|
|
||||||
|
$existing = EventPaymentMethods::where('event_id', $event->id)->get()->keyBy('slug');
|
||||||
|
|
||||||
|
// Nicht mehr gewünschte Methoden entfernen.
|
||||||
|
foreach ($existing as $slug => $row) {
|
||||||
|
if (!in_array($slug, $desiredSlugs, true)) {
|
||||||
|
$row->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tenant-Instanzen (für Snapshot-Kopie neuer Methoden) laden.
|
||||||
|
$tenantMethods = AvailablePaymentMethod::whereIn('slug', $desiredSlugs)->get()->keyBy('slug');
|
||||||
|
|
||||||
|
foreach ($desiredSlugs as $slug) {
|
||||||
|
$override = $overrides[$slug] ?? null;
|
||||||
|
|
||||||
|
if (isset($existing[$slug])) {
|
||||||
|
// Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen.
|
||||||
|
if ($override !== null) {
|
||||||
|
$row = $existing[$slug];
|
||||||
|
$row->configuration = PaymentMethod::sanitizeConfiguration($slug, $override);
|
||||||
|
$row->save();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Neue Zuweisung: expliziter Override oder Snapshot der Tenant-Config.
|
||||||
|
$snapshot = $override ?? ($tenantMethods[$slug]->configuration ?? []);
|
||||||
|
EventPaymentMethods::create([
|
||||||
|
'event_id' => $event->id,
|
||||||
|
'slug' => $slug,
|
||||||
|
'configuration' => PaymentMethod::sanitizeConfiguration($slug, $snapshot ?? []),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetPaymentMethods;
|
||||||
|
|
||||||
|
use App\Models\Event;
|
||||||
|
|
||||||
|
class SetPaymentMethodsRequest
|
||||||
|
{
|
||||||
|
public Event $event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gewünschte Zahlungsmethoden-Slugs für das Event.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
public array $paymentMethods;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optionale pro-Event-Config-Overrides je Zahlungsmethode: [slug => [option => value]].
|
||||||
|
* Fehlt ein Slug, bleibt die bestehende Config erhalten bzw. wird beim ersten Zuweisen
|
||||||
|
* aus der Tenant-Config als Snapshot kopiert.
|
||||||
|
*
|
||||||
|
* @var array<string, array<string, mixed>>
|
||||||
|
*/
|
||||||
|
public array $paymentMethodConfigurations;
|
||||||
|
|
||||||
|
public function __construct(Event $event, array $paymentMethods, array $paymentMethodConfigurations = [])
|
||||||
|
{
|
||||||
|
$this->event = $event;
|
||||||
|
$this->paymentMethods = $paymentMethods;
|
||||||
|
$this->paymentMethodConfigurations = $paymentMethodConfigurations;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\SetPaymentMethods;
|
||||||
|
|
||||||
|
class SetPaymentMethodsResponse
|
||||||
|
{
|
||||||
|
public bool $success = false;
|
||||||
|
public string $message = '';
|
||||||
|
}
|
||||||
@@ -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\EventPaymentModules\EventPaymentModuleRegistry;
|
||||||
use App\ValueObjects\Age;
|
use App\ValueObjects\Age;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@@ -14,6 +15,26 @@ class SignUpCommand {
|
|||||||
public function execute() : SignUpResponse {
|
public function execute() : SignUpResponse {
|
||||||
$response = new SignUpResponse();
|
$response = new SignUpResponse();
|
||||||
|
|
||||||
|
// Teilnehmer-Eingaben der gewählten Zahlungsart gegen das Modul-Schema absichern.
|
||||||
|
$module = $this->request->paymentMethod !== null
|
||||||
|
? EventPaymentModuleRegistry::forSlug($this->request->paymentMethod)
|
||||||
|
: null;
|
||||||
|
$paymentOptions = $module?->sanitizeParticipantOptions($this->request->paymentOptions) ?? [];
|
||||||
|
|
||||||
|
if ($module !== null && !$module->participantOptionsComplete($paymentOptions)) {
|
||||||
|
$response->success = false;
|
||||||
|
$response->message = 'Bitte alle erforderlichen Zahlungsangaben ausfüllen.';
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Teilnahmeoptionen (event-spezifische Pflicht-Auswahl) gegen die Event-Definition absichern.
|
||||||
|
$participationOptionRows = $this->buildParticipationOptionRows();
|
||||||
|
if ($participationOptionRows === null) {
|
||||||
|
$response->success = false;
|
||||||
|
$response->message = 'Bitte alle Auswahlfelder ausfüllen.';
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
$eatingHabit = match ($this->request->eating_habit) {
|
$eatingHabit = match ($this->request->eating_habit) {
|
||||||
'vegan' => EatingHabit::EATING_HABIT_VEGAN,
|
'vegan' => EatingHabit::EATING_HABIT_VEGAN,
|
||||||
'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN,
|
'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN,
|
||||||
@@ -62,12 +83,94 @@ class SignUpCommand {
|
|||||||
'amount' => $this->request->amount,
|
'amount' => $this->request->amount,
|
||||||
'payment_purpose' => $this->request->event->name . ' - Beitrag ' . $this->request->firstname . ' ' . $this->request->lastname,
|
'payment_purpose' => $this->request->event->name . ' - Beitrag ' . $this->request->firstname . ' ' . $this->request->lastname,
|
||||||
'payment_method' => $this->request->paymentMethod,
|
'payment_method' => $this->request->paymentMethod,
|
||||||
|
'payment_options' => $paymentOptions,
|
||||||
'efz_status' => $participantAge->isfullAged() ? EfzStatus::EFZ_STATUS_NOT_CHECKED : EfzStatus::EFZ_STATUS_NOT_REQUIRED,
|
'efz_status' => $participantAge->isfullAged() ? EfzStatus::EFZ_STATUS_NOT_CHECKED : EfzStatus::EFZ_STATUS_NOT_REQUIRED,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->persistParticipationOptions($response->participant, $participationOptionRows);
|
||||||
|
$this->persistAddons($response->participant);
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert die gewählten Zusätze (Event-Addons) als Snapshot-Zeilen (Titel/Preis/Betrag) für die spätere
|
||||||
|
* Rechnung. Die Beträge sind bereits in der Controller-Auflösung (`resolveAddons`) berechnet, inkl. USt.
|
||||||
|
*/
|
||||||
|
private function persistAddons(\App\Models\EventParticipant $participant): void
|
||||||
|
{
|
||||||
|
foreach ($this->request->addonItems as $item) {
|
||||||
|
$participant->selectedAddons()->create([
|
||||||
|
'tenant' => $this->request->event->tenant,
|
||||||
|
'event_id' => $this->request->event->id,
|
||||||
|
'addon_key' => $item['key'],
|
||||||
|
'title' => $item['title'],
|
||||||
|
'price' => $item['price'] ?? 0,
|
||||||
|
'flat' => (bool)($item['flat'] ?? false),
|
||||||
|
'days' => $item['days'] ?? 0,
|
||||||
|
'amount' => $item['amount'] ?? 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validiert die Antworten gegen die am Event definierten Teilnahmeoptionen und erzeugt die zu speichernden
|
||||||
|
* Zeilen mit Label-Snapshots. Gibt null zurück, wenn eine Pflicht-Frage unbeantwortet oder eine Antwort
|
||||||
|
* ungültig ist (Absicherung gegen manipulierte Payloads).
|
||||||
|
*
|
||||||
|
* @return array<int, array{question_key: string, question_label: string, value: string, value_label: string}>|null
|
||||||
|
*/
|
||||||
|
private function buildParticipationOptionRows(): ?array
|
||||||
|
{
|
||||||
|
$rows = [];
|
||||||
|
|
||||||
|
foreach ($this->request->event->participation_options ?? [] as $question) {
|
||||||
|
$key = $question['key'] ?? null;
|
||||||
|
if ($key === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $this->request->participationOptions[$key] ?? null;
|
||||||
|
if ($value === null || $value === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$option = null;
|
||||||
|
foreach ($question['options'] ?? [] as $candidate) {
|
||||||
|
if (($candidate['value'] ?? null) === $value) {
|
||||||
|
$option = $candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($option === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = [
|
||||||
|
'question_key' => $key,
|
||||||
|
'question_label' => $question['label'] ?? $key,
|
||||||
|
'value' => $value,
|
||||||
|
'value_label' => $option['label'] ?? $value,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<int, array{question_key: string, question_label: string, value: string, value_label: string}> $rows
|
||||||
|
*/
|
||||||
|
private function persistParticipationOptions(\App\Models\EventParticipant $participant, array $rows): void
|
||||||
|
{
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$participant->selectedOptions()->create(array_merge($row, [
|
||||||
|
'tenant' => $this->request->event->tenant,
|
||||||
|
'event_id' => $this->request->event->id,
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Domains\Event\Actions\SignUp;
|
namespace App\Domains\Event\Actions\SignUp;
|
||||||
|
|
||||||
use App\Enumerations\ParticipationType;
|
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\ValueObjects\Amount;
|
use App\ValueObjects\Amount;
|
||||||
@@ -46,6 +45,11 @@ class SignUpRequest {
|
|||||||
public ?string $notes,
|
public ?string $notes,
|
||||||
public Amount $amount,
|
public Amount $amount,
|
||||||
public ?string $paymentMethod,
|
public ?string $paymentMethod,
|
||||||
|
public array $paymentOptions = [],
|
||||||
|
/** Antworten auf die Teilnahmeoptionen: [ question_key => value ]. */
|
||||||
|
public array $participationOptions = [],
|
||||||
|
/** Aufgelöste Zusätze (Event-Addons): je Eintrag [ key, title, price, flat, days, amount ]. */
|
||||||
|
public array $addonItems = [],
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Models\EventParticipant;
|
|||||||
class SignUpResponse {
|
class SignUpResponse {
|
||||||
public bool $success;
|
public bool $success;
|
||||||
public ?EventParticipant $participant;
|
public ?EventParticipant $participant;
|
||||||
|
public ?string $message = null;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->success = false;
|
$this->success = false;
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Domains\Event\Actions\UpdateEvent;
|
namespace App\Domains\Event\Actions\UpdateEvent;
|
||||||
|
|
||||||
use App\Models\AvailablePaymentMethod;
|
|
||||||
use App\Models\PaymentMethod;
|
|
||||||
use App\RelationModels\EventPaymentMethods;
|
|
||||||
|
|
||||||
class UpdateEventCommand {
|
class UpdateEventCommand {
|
||||||
public UpdateEventRequest $request;
|
public UpdateEventRequest $request;
|
||||||
public function __construct(UpdateEventRequest $request) {
|
public function __construct(UpdateEventRequest $request) {
|
||||||
@@ -15,12 +11,6 @@ class UpdateEventCommand {
|
|||||||
public function execute() : UpdateEventResponse {
|
public function execute() : UpdateEventResponse {
|
||||||
$response = new UpdateEventResponse();
|
$response = new UpdateEventResponse();
|
||||||
|
|
||||||
if (count($this->request->paymentMethods) === 0) {
|
|
||||||
$response->success = false;
|
|
||||||
$response->message = 'Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.';
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$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->postal_code = $this->request->postalCode;
|
$this->request->event->postal_code = $this->request->postalCode;
|
||||||
@@ -45,58 +35,9 @@ class UpdateEventCommand {
|
|||||||
$this->request->event->localGroups()->attach($contributingLocalGroup);
|
$this->request->event->localGroups()->attach($contributingLocalGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->syncPaymentMethods();
|
|
||||||
|
|
||||||
$this->request->event->save();
|
$this->request->event->save();
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Differenzieller Sync der Zahlungsmethoden mit Snapshot-Copy-Semantik:
|
|
||||||
* - entfernte Methoden werden gelöscht,
|
|
||||||
* - neue Methoden erhalten einen Snapshot der Tenant-Config (oder eines expliziten Overrides),
|
|
||||||
* - bestehende Methoden behalten ihre pro-Event-Config, sofern kein Override übergeben wird.
|
|
||||||
*/
|
|
||||||
private function syncPaymentMethods(): void
|
|
||||||
{
|
|
||||||
$event = $this->request->event;
|
|
||||||
$desiredSlugs = $this->request->paymentMethods;
|
|
||||||
$overrides = $this->request->paymentMethodConfigurations;
|
|
||||||
|
|
||||||
$existing = EventPaymentMethods::where('event_id', $event->id)->get()->keyBy('slug');
|
|
||||||
|
|
||||||
// Nicht mehr gewünschte Methoden entfernen.
|
|
||||||
foreach ($existing as $slug => $row) {
|
|
||||||
if (!in_array($slug, $desiredSlugs, true)) {
|
|
||||||
$row->delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tenant-Instanzen (für Snapshot-Kopie neuer Methoden) laden.
|
|
||||||
$tenantMethods = AvailablePaymentMethod::whereIn('slug', $desiredSlugs)->get()->keyBy('slug');
|
|
||||||
|
|
||||||
foreach ($desiredSlugs as $slug) {
|
|
||||||
$override = $overrides[$slug] ?? null;
|
|
||||||
|
|
||||||
if (isset($existing[$slug])) {
|
|
||||||
// Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen.
|
|
||||||
if ($override !== null) {
|
|
||||||
$row = $existing[$slug];
|
|
||||||
$row->configuration = PaymentMethod::sanitizeConfiguration($slug, $override);
|
|
||||||
$row->save();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Neue Zuweisung: expliziter Override oder Snapshot der Tenant-Config.
|
|
||||||
$snapshot = $override ?? ($tenantMethods[$slug]->configuration ?? []);
|
|
||||||
EventPaymentMethods::create([
|
|
||||||
'event_id' => $event->id,
|
|
||||||
'slug' => $slug,
|
|
||||||
'configuration' => PaymentMethod::sanitizeConfiguration($slug, $snapshot ?? []),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,18 +21,9 @@ class UpdateEventRequest {
|
|||||||
public Amount $supportPerPerson;
|
public Amount $supportPerPerson;
|
||||||
public array $contributingLocalGroups;
|
public array $contributingLocalGroups;
|
||||||
public array $eatingHabits;
|
public array $eatingHabits;
|
||||||
public array $paymentMethods;
|
|
||||||
|
|
||||||
/**
|
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)
|
||||||
* Optionale pro-Event-Config-Overrides je Zahlungsmethode: [slug => [option => value]].
|
{
|
||||||
* Fehlt ein Slug, bleibt die bestehende Config erhalten bzw. wird beim ersten Zuweisen
|
|
||||||
* aus der Tenant-Config als Snapshot kopiert.
|
|
||||||
*
|
|
||||||
* @var array<string, array<string, mixed>>
|
|
||||||
*/
|
|
||||||
public array $paymentMethodConfigurations;
|
|
||||||
|
|
||||||
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, array $paymentMethods, array $paymentMethodConfigurations = []) {
|
|
||||||
$this->event = $event;
|
$this->event = $event;
|
||||||
$this->eventName = $eventName;
|
$this->eventName = $eventName;
|
||||||
$this->eventLocation = $eventLocation;
|
$this->eventLocation = $eventLocation;
|
||||||
@@ -47,7 +38,5 @@ class UpdateEventRequest {
|
|||||||
$this->supportPerPerson = $supportPerPerson;
|
$this->supportPerPerson = $supportPerPerson;
|
||||||
$this->contributingLocalGroups = $contributingLocalGroups;
|
$this->contributingLocalGroups = $contributingLocalGroups;
|
||||||
$this->eatingHabits = $eatingHabits;
|
$this->eatingHabits = $eatingHabits;
|
||||||
$this->paymentMethods = $paymentMethods;
|
|
||||||
$this->paymentMethodConfigurations = $paymentMethodConfigurations;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,11 +72,97 @@ class UpdateParticipantCommand {
|
|||||||
|
|
||||||
|
|
||||||
$p->save();
|
$p->save();
|
||||||
|
|
||||||
|
if ($this->request->participationOptions !== null) {
|
||||||
|
$this->syncParticipationOptions($p);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->selectedAddons !== null) {
|
||||||
|
$this->syncAddons($p);
|
||||||
|
}
|
||||||
|
|
||||||
$this->response->success = true;
|
$this->response->success = true;
|
||||||
$this->response->participant = $p;
|
$this->response->participant = $p;
|
||||||
return $this->response;
|
return $this->response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ersetzt die zugeordneten Zusätze (Event-Addons) anhand der Auswahl. Bewusst **ohne Preis/Betrag**
|
||||||
|
* (amount 0): der Teilnahmebeitrag wird in den Details ohnehin manuell gesetzt. Es wird nur der Titel als
|
||||||
|
* Snapshot gespeichert, damit die Zuordnung sichtbar bleibt.
|
||||||
|
*/
|
||||||
|
private function syncAddons(EventParticipant $participant): void
|
||||||
|
{
|
||||||
|
$participant->selectedAddons()->delete();
|
||||||
|
|
||||||
|
$selection = $this->request->selectedAddons ?? [];
|
||||||
|
|
||||||
|
foreach ($participant->event?->addons ?? [] as $addon) {
|
||||||
|
$key = $addon['key'] ?? null;
|
||||||
|
if ($key === null || empty($selection[$key])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$participant->selectedAddons()->create([
|
||||||
|
'tenant' => $participant->tenant,
|
||||||
|
'event_id' => $participant->event_id,
|
||||||
|
'addon_key' => $key,
|
||||||
|
'title' => $addon['title'] ?? $key,
|
||||||
|
'price' => 0,
|
||||||
|
'flat' => (bool)($addon['flat'] ?? false),
|
||||||
|
'days' => 0,
|
||||||
|
'amount' => 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ersetzt die zugeordneten Teilnahmeoptionen anhand der übergebenen Antworten. Nachträgliche Zuordnung im
|
||||||
|
* Back-Office ist lückenlos möglich: nur gegen die Event-Definition gültige Antworten werden gespeichert,
|
||||||
|
* leere/entfallene Antworten werden abgeräumt. Frage-/Options-Label werden als Snapshot mitgeschrieben.
|
||||||
|
*/
|
||||||
|
private function syncParticipationOptions(EventParticipant $participant): void
|
||||||
|
{
|
||||||
|
$participant->selectedOptions()->delete();
|
||||||
|
|
||||||
|
$answers = $this->request->participationOptions ?? [];
|
||||||
|
|
||||||
|
foreach ($participant->event?->participation_options ?? [] as $question) {
|
||||||
|
$key = $question['key'] ?? null;
|
||||||
|
if ($key === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $answers[$key] ?? null;
|
||||||
|
if ($value === null || $value === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$option = null;
|
||||||
|
foreach ($question['options'] ?? [] as $candidate) {
|
||||||
|
if (($candidate['value'] ?? null) === $value) {
|
||||||
|
$option = $candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($option === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = trim((string)($question['label'] ?? ''));
|
||||||
|
|
||||||
|
$participant->selectedOptions()->create([
|
||||||
|
'tenant' => $participant->tenant,
|
||||||
|
'event_id' => $participant->event_id,
|
||||||
|
'question_key' => $key,
|
||||||
|
'question_label' => $label !== '' ? $label : ($question['title'] ?? $key),
|
||||||
|
'value' => $value,
|
||||||
|
'value_label' => $option['label'] ?? $value,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function handleAmountChanges(EventParticipant $participant) {
|
private function handleAmountChanges(EventParticipant $participant) {
|
||||||
$this->response->amountPaid = $participant->amount_paid;
|
$this->response->amountPaid = $participant->amount_paid;
|
||||||
$this->response->amountExpected = $participant->amount;
|
$this->response->amountExpected = $participant->amount;
|
||||||
|
|||||||
@@ -36,5 +36,9 @@ class UpdateParticipantRequest {
|
|||||||
public string $amountPaid,
|
public string $amountPaid,
|
||||||
public string $amountExpected,
|
public string $amountExpected,
|
||||||
public string $cocStatus,
|
public string $cocStatus,
|
||||||
|
/** Antworten auf die Teilnahmeoptionen: [ question_key => value ]. null = unverändert lassen. */
|
||||||
|
public ?array $participationOptions = null,
|
||||||
|
/** Gewählte Zusätze: [ addon_key => bool ]. null = unverändert lassen. */
|
||||||
|
public ?array $selectedAddons = null,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,24 +2,27 @@
|
|||||||
|
|
||||||
namespace App\Domains\Event\Controllers;
|
namespace App\Domains\Event\Controllers;
|
||||||
|
|
||||||
|
use App\Domains\Event\Actions\SetEventAddons\SetEventAddonsCommand;
|
||||||
|
use App\Domains\Event\Actions\SetEventAddons\SetEventAddonsRequest;
|
||||||
use App\Domains\Event\Actions\SetParticipationFees\SetParticipationFeesCommand;
|
use App\Domains\Event\Actions\SetParticipationFees\SetParticipationFeesCommand;
|
||||||
use App\Domains\Event\Actions\SetParticipationFees\SetParticipationFeesRequest;
|
use App\Domains\Event\Actions\SetParticipationFees\SetParticipationFeesRequest;
|
||||||
|
use App\Domains\Event\Actions\SetParticipationOptions\SetParticipationOptionsCommand;
|
||||||
|
use App\Domains\Event\Actions\SetParticipationOptions\SetParticipationOptionsRequest;
|
||||||
|
use App\Domains\Event\Actions\SetPaymentMethods\SetPaymentMethodsCommand;
|
||||||
|
use App\Domains\Event\Actions\SetPaymentMethods\SetPaymentMethodsRequest;
|
||||||
use App\Domains\Event\Actions\UpdateEvent\UpdateEventCommand;
|
use App\Domains\Event\Actions\UpdateEvent\UpdateEventCommand;
|
||||||
use App\Domains\Event\Actions\UpdateEvent\UpdateEventRequest;
|
use App\Domains\Event\Actions\UpdateEvent\UpdateEventRequest;
|
||||||
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersCommand;
|
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersCommand;
|
||||||
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersRequest;
|
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersRequest;
|
||||||
use App\Enumerations\ParticipationFeeType;
|
use App\Enumerations\ParticipationFeeType;
|
||||||
use App\Enumerations\ParticipationType;
|
use App\Enumerations\ParticipationType;
|
||||||
use App\Models\EventParticipant;
|
|
||||||
use App\Providers\InertiaProvider;
|
use App\Providers\InertiaProvider;
|
||||||
use App\Providers\PdfGenerateAndDownloadProvider;
|
use App\Providers\PdfGenerateAndDownloadProvider;
|
||||||
use App\Resources\EventResource;
|
|
||||||
use App\Scopes\CommonController;
|
use App\Scopes\CommonController;
|
||||||
use App\ValueObjects\Amount;
|
use App\ValueObjects\Amount;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use function Symfony\Component\String\b;
|
|
||||||
|
|
||||||
class DetailsController extends CommonController {
|
class DetailsController extends CommonController {
|
||||||
public function __invoke(string $eventId) {
|
public function __invoke(string $eventId) {
|
||||||
@@ -42,8 +45,6 @@ class DetailsController extends CommonController {
|
|||||||
|
|
||||||
$contributinLocalGroups = $request->input('contributingLocalGroups');
|
$contributinLocalGroups = $request->input('contributingLocalGroups');
|
||||||
$eatingHabits = $request->input('eatingHabits');
|
$eatingHabits = $request->input('eatingHabits');
|
||||||
$paymentMethods = $request->input('paymentMethods');
|
|
||||||
$paymentMethodConfigurations = (array) $request->input('paymentMethodConfigurations', []);
|
|
||||||
|
|
||||||
$eventUpdateRequest = new UpdateEventRequest(
|
$eventUpdateRequest = new UpdateEventRequest(
|
||||||
$event,
|
$event,
|
||||||
@@ -59,9 +60,7 @@ class DetailsController extends CommonController {
|
|||||||
$flatSupport,
|
$flatSupport,
|
||||||
$supportPerPerson,
|
$supportPerPerson,
|
||||||
$contributinLocalGroups,
|
$contributinLocalGroups,
|
||||||
$eatingHabits,
|
$eatingHabits
|
||||||
$paymentMethods,
|
|
||||||
$paymentMethodConfigurations
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
|
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
|
||||||
@@ -70,6 +69,20 @@ class DetailsController extends CommonController {
|
|||||||
return response()->json(['status' => $response->success ? 'success' : 'error', 'message' => $response->message]);
|
return response()->json(['status' => $response->success ? 'success' : 'error', 'message' => $response->message]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updatePaymentMethods(int $eventId, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$event = $this->events->getById($eventId);
|
||||||
|
|
||||||
|
$paymentMethods = $request->input('paymentMethods', []);
|
||||||
|
$paymentMethodConfigurations = (array)$request->input('paymentMethodConfigurations', []);
|
||||||
|
|
||||||
|
$setPaymentMethodsRequest = new SetPaymentMethodsRequest($event, $paymentMethods, $paymentMethodConfigurations);
|
||||||
|
$setPaymentMethodsCommand = new SetPaymentMethodsCommand($setPaymentMethodsRequest);
|
||||||
|
$response = $setPaymentMethodsCommand->execute();
|
||||||
|
|
||||||
|
return response()->json(['status' => $response->success ? 'success' : 'error', 'message' => $response->message]);
|
||||||
|
}
|
||||||
|
|
||||||
public function updateEventManagers(int $eventId, Request $request) : JsonResponse {
|
public function updateEventManagers(int $eventId, Request $request) : JsonResponse {
|
||||||
$event = $this->events->getById($eventId);
|
$event = $this->events->getById($eventId);
|
||||||
|
|
||||||
@@ -133,6 +146,28 @@ class DetailsController extends CommonController {
|
|||||||
return response()->json(['status' => $response->success ? 'success' : 'error']);
|
return response()->json(['status' => $response->success ? 'success' : 'error']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateParticipationOptions(int $eventId, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$event = $this->events->getById($eventId);
|
||||||
|
|
||||||
|
$setRequest = new SetParticipationOptionsRequest($event, (array)$request->input('questions', []));
|
||||||
|
$setCommand = new SetParticipationOptionsCommand($setRequest);
|
||||||
|
$response = $setCommand->execute();
|
||||||
|
|
||||||
|
return response()->json(['status' => $response->success ? 'success' : 'error', 'message' => $response->message]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateEventAddons(int $eventId, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$event = $this->events->getById($eventId);
|
||||||
|
|
||||||
|
$setRequest = new SetEventAddonsRequest($event, (array)$request->input('addons', []));
|
||||||
|
$setCommand = new SetEventAddonsCommand($setRequest);
|
||||||
|
$response = $setCommand->execute();
|
||||||
|
|
||||||
|
return response()->json(['status' => $response->success ? 'success' : 'error', 'message' => $response->message]);
|
||||||
|
}
|
||||||
|
|
||||||
public function downloadPdfList(string $eventId, string $listType, Request $request): Response
|
public function downloadPdfList(string $eventId, string $listType, Request $request): Response
|
||||||
{
|
{
|
||||||
$event = $this->events->getByIdentifier($eventId);
|
$event = $this->events->getByIdentifier($eventId);
|
||||||
@@ -186,6 +221,12 @@ class DetailsController extends CommonController {
|
|||||||
case 'by-participation-group':
|
case 'by-participation-group':
|
||||||
$participants = $this->eventParticipants->groupByParticipationType($event, $request);
|
$participants = $this->eventParticipants->groupByParticipationType($event, $request);
|
||||||
break;
|
break;
|
||||||
|
case 'by-participation-option':
|
||||||
|
$participants = $this->eventParticipants->groupByParticipationOption($event, $request);
|
||||||
|
break;
|
||||||
|
case 'by-addon':
|
||||||
|
$participants = $this->eventParticipants->groupByAddon($event, $request);
|
||||||
|
break;
|
||||||
case 'signed-off':
|
case 'signed-off':
|
||||||
$participants = $this->eventParticipants->getSignedOffParticipants($event, $request);
|
$participants = $this->eventParticipants->getSignedOffParticipants($event, $request);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ class ByGroupController extends CommonController
|
|||||||
$participants = $this->eventParticipants->groupByParticipationType($event, $request, $request->input('groupName'));
|
$participants = $this->eventParticipants->groupByParticipationType($event, $request, $request->input('groupName'));
|
||||||
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
|
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
|
||||||
break;
|
break;
|
||||||
|
case 'by-participation-option':
|
||||||
|
$participants = $this->eventParticipants->groupByParticipationOption($event, $request, $request->input('groupName'));
|
||||||
|
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')] ?? []);
|
||||||
|
break;
|
||||||
case 'signed-off':
|
case 'signed-off':
|
||||||
$participants = $this->eventParticipants->getSignedOffParticipants($event, $request, $request->input('groupName'));
|
$participants = $this->eventParticipants->getSignedOffParticipants($event, $request, $request->input('groupName'));
|
||||||
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
|
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ class ParticipantUpdateController extends CommonController {
|
|||||||
amountPaid: $request->input('amountPaid'),
|
amountPaid: $request->input('amountPaid'),
|
||||||
amountExpected: $request->input('amountExpected'),
|
amountExpected: $request->input('amountExpected'),
|
||||||
cocStatus: $request->input('cocStatus'),
|
cocStatus: $request->input('cocStatus'),
|
||||||
|
participationOptions: $request->has('participationOptions') ? (array)$request->input('participationOptions') : null,
|
||||||
|
selectedAddons: $request->has('selectedAddons') ? (array)$request->input('selectedAddons') : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
$command = new UpdateParticipantCommand($updateRequest);
|
$command = new UpdateParticipantCommand($updateRequest);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use App\Providers\DoubleCheckEventRegistrationProvider;
|
|||||||
use App\Providers\InertiaProvider;
|
use App\Providers\InertiaProvider;
|
||||||
use App\Resources\UserResource;
|
use App\Resources\UserResource;
|
||||||
use App\Scopes\CommonController;
|
use App\Scopes\CommonController;
|
||||||
|
use App\ValueObjects\Amount;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -26,10 +27,8 @@ class SignupController extends CommonController {
|
|||||||
|
|
||||||
$eventModel = $this->events->getByIdentifier($eventId, false);
|
$eventModel = $this->events->getByIdentifier($eventId, false);
|
||||||
$event = $eventModel?->toResource()->toArray($request);
|
$event = $eventModel?->toResource()->toArray($request);
|
||||||
// Aktuell ist genau eine aktive Zahlungsmethode je Event vorgesehen; wird bereits beim Start
|
// Die (aktiven) Zahlungsmethoden stehen dem Frontend über $event['paymentMethods'] zur Verfügung;
|
||||||
// der Anmeldung ermittelt und ans Frontend durchgereicht, statt erst bei der Erstellung des
|
// die Auswahl trifft der/die Teilnehmer\*in im Anmeldeschritt "Zahlungsart".
|
||||||
// Teilnehmenden (siehe SignUpCommand).
|
|
||||||
$paymentMethod = $eventModel?->paymentMethods()->where('active', true)->first();
|
|
||||||
|
|
||||||
$participantData = [
|
$participantData = [
|
||||||
'firstname' => '',
|
'firstname' => '',
|
||||||
@@ -67,7 +66,6 @@ class SignupController extends CommonController {
|
|||||||
'availableEvents' => $availableEvents,
|
'availableEvents' => $availableEvents,
|
||||||
'localGroups' => $event['contributingLocalGroups'],
|
'localGroups' => $event['contributingLocalGroups'],
|
||||||
'participantData' => $participantData,
|
'participantData' => $participantData,
|
||||||
'paymentMethod' => $paymentMethod?->slug,
|
|
||||||
]);
|
]);
|
||||||
return $inertiaProvider->render();
|
return $inertiaProvider->render();
|
||||||
}
|
}
|
||||||
@@ -107,6 +105,11 @@ class SignupController extends CommonController {
|
|||||||
$siblingReduction
|
$siblingReduction
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Gewählte Zusätze (Event-Addons) auflösen und auf den Gesamtbetrag aufaddieren.
|
||||||
|
$selectedAddonKeys = array_keys(array_filter((array)$request->input('addons', []), fn($v) => (bool)$v));
|
||||||
|
$addonResolution = $eventResource->resolveAddons($selectedAddonKeys, $arrival, $departure);
|
||||||
|
$amount->addAmount($addonResolution['total']);
|
||||||
|
|
||||||
$signupRequest = new SignUpRequest(
|
$signupRequest = new SignUpRequest(
|
||||||
$event,
|
$event,
|
||||||
$registrationData['userId'] ?? null,
|
$registrationData['userId'] ?? null,
|
||||||
@@ -144,11 +147,18 @@ class SignupController extends CommonController {
|
|||||||
$registrationData['anmerkungen'],
|
$registrationData['anmerkungen'],
|
||||||
$amount,
|
$amount,
|
||||||
$registrationData['paymentMethod'] ?? null,
|
$registrationData['paymentMethod'] ?? null,
|
||||||
|
(array)($registrationData['paymentOptions'] ?? []),
|
||||||
|
(array)($registrationData['participationOptions'] ?? []),
|
||||||
|
$addonResolution['items'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$signupCommand = new SignUpCommand($signupRequest);
|
$signupCommand = new SignUpCommand($signupRequest);
|
||||||
$signupResponse = $signupCommand->execute();
|
$signupResponse = $signupCommand->execute();
|
||||||
|
|
||||||
|
if (!$signupResponse->success) {
|
||||||
|
return response()->json(['status' => 'error', 'message' => $signupResponse->message], 422);
|
||||||
|
}
|
||||||
|
|
||||||
// 4. Addons registrieren
|
// 4. Addons registrieren
|
||||||
|
|
||||||
|
|
||||||
@@ -182,14 +192,41 @@ class SignupController extends CommonController {
|
|||||||
|
|
||||||
$siblingReduction = $request->input('sibling') === 'true';
|
$siblingReduction = $request->input('sibling') === 'true';
|
||||||
|
|
||||||
return response()->json(['amount' =>
|
$arrival = \DateTime::createFromFormat('Y-m-d', $request->input('arrival'));
|
||||||
$event->calculateAmount(
|
$departure = \DateTime::createFromFormat('Y-m-d', $request->input('departure'));
|
||||||
|
|
||||||
|
$baseFee = $event->calculateAmount(
|
||||||
$request->input('participationType'),
|
$request->input('participationType'),
|
||||||
$request->input('beitrag'),
|
$request->input('beitrag'),
|
||||||
\DateTime::createFromFormat('Y-m-d', $request->input('arrival')),
|
$arrival,
|
||||||
\DateTime::createFromFormat('Y-m-d', $request->input('departure')),
|
$departure,
|
||||||
$siblingReduction
|
$siblingReduction
|
||||||
)->toString()
|
);
|
||||||
|
|
||||||
|
// Gewählte Zusätze immer einrechnen -- so enthält der finale Anzeigebetrag (und der Bestätigungstext)
|
||||||
|
// stets die Addons und der Zahlungsschritt wird nur bei Gesamt 0 € übersprungen.
|
||||||
|
$selectedAddonKeys = array_keys(array_filter((array)$request->input('addons', []), fn($v) => (bool)$v));
|
||||||
|
$resolution = $event->resolveAddons($selectedAddonKeys, $arrival, $departure);
|
||||||
|
|
||||||
|
// Gesamt = Teilnahmebeitrag + Zusätze; Basisbetrag separat für die Kostenübersicht in der Zusammenfassung.
|
||||||
|
$total = new Amount($baseFee->getAmount(), 'Euro');
|
||||||
|
$total->addAmount($resolution['total']);
|
||||||
|
|
||||||
|
$addonLines = array_map(fn($item) => [
|
||||||
|
'key' => $item['key'],
|
||||||
|
'title' => $item['title'],
|
||||||
|
'amountValue' => $item['amount'],
|
||||||
|
'amount' => new Amount($item['amount'], 'Euro')->toString(),
|
||||||
|
'free' => $item['amount'] <= 0,
|
||||||
|
], $resolution['items']);
|
||||||
|
|
||||||
|
// amountValue (numerisch) steuert im Frontend das Überspringen des Zahlungsart-Schritts bei 0 €.
|
||||||
|
return response()->json([
|
||||||
|
'amount' => $total->toString(),
|
||||||
|
'amountValue' => $total->getAmount(),
|
||||||
|
'baseAmount' => $baseFee->toString(),
|
||||||
|
'baseAmountValue' => $baseFee->getAmount(),
|
||||||
|
'addons' => $addonLines,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ Route::prefix('api/v1')
|
|||||||
Route::post('/event-managers', [DetailsController::class, 'updateEventManagers']);
|
Route::post('/event-managers', [DetailsController::class, 'updateEventManagers']);
|
||||||
Route::post('/participation-fees', [DetailsController::class, 'updateParticipationFees']);
|
Route::post('/participation-fees', [DetailsController::class, 'updateParticipationFees']);
|
||||||
Route::post('/common-settings', [DetailsController::class, 'updateCommonSettings']);
|
Route::post('/common-settings', [DetailsController::class, 'updateCommonSettings']);
|
||||||
|
Route::post('/payment-methods', [DetailsController::class, 'updatePaymentMethods']);
|
||||||
|
Route::post('/participation-options', [DetailsController::class, 'updateParticipationOptions']);
|
||||||
|
Route::post('/event-addons', [DetailsController::class, 'updateEventAddons']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {reactive, inject, onMounted} from 'vue';
|
import {onMounted} from 'vue';
|
||||||
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 TabbedPage from "../../../Views/Components/TabbedPage.vue";
|
import TabbedPage from "../../../Views/Components/TabbedPage.vue";
|
||||||
import ParticipantsList from "./Partials/ParticipantsList.vue";
|
import ParticipantsList from "./Partials/ParticipantsList.vue";
|
||||||
|
import ParticipantsByOption from "./Partials/ParticipantsByOption.vue";
|
||||||
|
import ParticipantsByAddon from "./Partials/ParticipantsByAddon.vue";
|
||||||
import Overview from "./Partials/Overview.vue";
|
import Overview from "./Partials/Overview.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -31,16 +33,21 @@ const tabs = [
|
|||||||
component: ParticipantsList,
|
component: ParticipantsList,
|
||||||
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/by-participation-group',
|
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/by-participation-group',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Teilis nach Teilnahmeoption',
|
||||||
|
component: ParticipantsByOption,
|
||||||
|
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/by-participation-option',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Teilis mit Zusatzoptionen',
|
||||||
|
component: ParticipantsByAddon,
|
||||||
|
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/by-addon',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Abgemeldete Teilis',
|
title: 'Abgemeldete Teilis',
|
||||||
component: ParticipantsList,
|
component: ParticipantsList,
|
||||||
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/signed-off',
|
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/signed-off',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Zusätze',
|
|
||||||
component: ParticipantsList,
|
|
||||||
endpoint: "/api/v1/cost-unit/open/archived-cost-units",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import {onMounted, reactive, ref} from "vue";
|
import {onMounted, reactive, ref} from "vue";
|
||||||
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
||||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||||
import TextEditor from "../../../../Views/Components/TextEditor.vue";
|
|
||||||
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||||
import {toast} from "vue3-toastify";
|
import {toast} from "vue3-toastify";
|
||||||
|
|
||||||
@@ -17,14 +16,10 @@ const emit = defineEmits(['close'])
|
|||||||
const dynmicProps = reactive({
|
const dynmicProps = reactive({
|
||||||
localGroups: [],
|
localGroups: [],
|
||||||
eatingHabits:[],
|
eatingHabits:[],
|
||||||
paymentMethods: []
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const contributingLocalGroups = ref([])
|
const contributingLocalGroups = ref([])
|
||||||
const eatingHabits = ref([]);
|
const eatingHabits = ref([]);
|
||||||
const paymentMethods = ref([]);
|
|
||||||
// pro-Event-Config je Zahlungsmethode: { slug: { option: value } }
|
|
||||||
const paymentMethodConfigurations = reactive({});
|
|
||||||
|
|
||||||
const errors = reactive({})
|
const errors = reactive({})
|
||||||
|
|
||||||
@@ -51,33 +46,9 @@ const emit = defineEmits(['close'])
|
|||||||
|
|
||||||
contributingLocalGroups.value = props.event.contributingLocalGroups?.map(t => t.id) ?? []
|
contributingLocalGroups.value = props.event.contributingLocalGroups?.map(t => t.id) ?? []
|
||||||
eatingHabits.value = props.event.eatingHabits?.map(t => t.id) ?? []
|
eatingHabits.value = props.event.eatingHabits?.map(t => t.id) ?? []
|
||||||
paymentMethods.value = props.event.paymentMethods?.map(t => t.slug) ?? []
|
|
||||||
|
|
||||||
// Pro-Event-Config vorbelegen: bereits gespeicherte Pivot-Config des Events hat Vorrang,
|
|
||||||
// sonst der Tenant-Standard (Snapshot-Quelle für neu zugewiesene Methoden).
|
|
||||||
const eventConfigBySlug = {}
|
|
||||||
for (const pm of props.event.paymentMethods ?? []) {
|
|
||||||
eventConfigBySlug[pm.slug] = pm.configuration ?? {}
|
|
||||||
}
|
|
||||||
for (const method of dynmicProps.paymentMethods ?? []) {
|
|
||||||
const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {}
|
|
||||||
const config = {}
|
|
||||||
for (const option of method.optionsSchema ?? []) {
|
|
||||||
config[option.name] = source[option.name] ?? ''
|
|
||||||
}
|
|
||||||
paymentMethodConfigurations[method.slug] = config
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
if (paymentMethods.value.length === 0) {
|
|
||||||
toast.error('Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.')
|
|
||||||
return
|
|
||||||
} else if(paymentMethods.value.length > 1) {
|
|
||||||
toast.error('Aktuell wird nur exakt eine Zahlungseinstellung unterstützt.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await request('/api/v1/event/details/' + props.event.id + '/common-settings', {
|
const response = await request('/api/v1/event/details/' + props.event.id + '/common-settings', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -97,8 +68,6 @@ const emit = defineEmits(['close'])
|
|||||||
supportPerson: formData.supportPerson,
|
supportPerson: formData.supportPerson,
|
||||||
contributingLocalGroups: contributingLocalGroups.value,
|
contributingLocalGroups: contributingLocalGroups.value,
|
||||||
eatingHabits: eatingHabits.value,
|
eatingHabits: eatingHabits.value,
|
||||||
paymentMethods: paymentMethods.value,
|
|
||||||
paymentMethodConfigurations: paymentMethodConfigurations,
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -230,31 +199,6 @@ const emit = defineEmits(['close'])
|
|||||||
<label style="padding-left: 5px;" :for="'eatinghabit' + eatingHabit.id">{{eatingHabit.name}}</label>
|
<label style="padding-left: 5px;" :for="'eatinghabit' + eatingHabit.id">{{eatingHabit.name}}</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th style="padding-top: 40px !important;">Zahlungsmöglichkeiten</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr v-for="paymentMethod in dynmicProps.paymentMethods">
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" :id="'paymentmethod' + paymentMethod.id" :value="paymentMethod.slug" v-model="paymentMethods" />
|
|
||||||
<label style="padding-left: 5px;" :for="'paymentmethod' + paymentMethod.id">{{paymentMethod.name}}</label>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="paymentMethods.includes(paymentMethod.slug) && (paymentMethod.optionsSchema?.length ?? 0) > 0"
|
|
||||||
class="payment-method-config"
|
|
||||||
>
|
|
||||||
<div v-for="option in paymentMethod.optionsSchema" :key="option.name" class="payment-method-config-row">
|
|
||||||
<label>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></label>
|
|
||||||
<TextEditor v-if="option.type === 'richtext'"
|
|
||||||
v-model="paymentMethodConfigurations[paymentMethod.slug][option.name]"/>
|
|
||||||
<input v-else type="text"
|
|
||||||
v-model="paymentMethodConfigurations[paymentMethod.slug][option.name]"
|
|
||||||
class="width-full"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@@ -311,26 +255,4 @@ const emit = defineEmits(['close'])
|
|||||||
width: 250px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-method-config {
|
|
||||||
margin: 6px 0 12px 24px;
|
|
||||||
padding-left: 10px;
|
|
||||||
border-left: 2px solid #d1d5db;
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment-method-config-row {
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment-method-config-row label {
|
|
||||||
display: block;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
color: #374151;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.required-marker {
|
|
||||||
color: #ef4444;
|
|
||||||
margin-left: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
<script setup>
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {toast} from "vue3-toastify";
|
||||||
|
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||||
|
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||||
|
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
event: Object,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Addon-Definition dieses Events: [ { key, title, description, price, flat } ].
|
||||||
|
// key bleibt für bestehende Einträge erhalten (Bestandsschutz für bereits gebuchte Zusätze).
|
||||||
|
const addons = ref((props.event.addons ?? []).map(a => ({
|
||||||
|
key: a.key ?? '',
|
||||||
|
title: a.title ?? '',
|
||||||
|
description: a.description ?? '',
|
||||||
|
price: a.price != null ? String(a.price).replace('.', ',') : '0',
|
||||||
|
flat: a.flat ?? false,
|
||||||
|
})))
|
||||||
|
|
||||||
|
function addAddon() {
|
||||||
|
addons.value.push({key: '', title: '', description: '', price: '0', flat: true})
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAddon(index) {
|
||||||
|
addons.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate() {
|
||||||
|
for (const addon of addons.value) {
|
||||||
|
if (addon.title.trim() === '') {
|
||||||
|
toast.error('Bitte für jeden Zusatz einen Titel angeben.')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
if (!validate()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await request('/api/v1/event/details/' + props.event.id + '/event-addons', {
|
||||||
|
method: 'POST',
|
||||||
|
body: {
|
||||||
|
addons: addons.value,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response.status !== 'success') {
|
||||||
|
toast.error(response.message ?? 'Die Zusatzoptionen konnten nicht gespeichert werden.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
toast.success('Die Zusatzoptionen wurden gespeichert')
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="event-addons">
|
||||||
|
<h3>Zusatzoptionen</h3>
|
||||||
|
<p style="color: #6b7280; font-size: 0.9rem;">
|
||||||
|
Buchbare Zusätze zur Veranstaltung (z. B. Parkticket, Aufnäher). Jede Position ist eine Ja/Nein-Auswahl.
|
||||||
|
Preis 0 wird dem Teilnehmenden als „Kostenfrei" angezeigt. Ist „Pauschale" nicht gesetzt, wird der Preis
|
||||||
|
mit der Anzahl der Teilnahmetage multipliziert. Ohne Zusätze wird dieser Schritt in der Anmeldung
|
||||||
|
übersprungen.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div v-for="(addon, index) in addons" :key="index" class="addon-card">
|
||||||
|
<div class="addon-head">
|
||||||
|
<div class="addon-fields">
|
||||||
|
<label class="field-label">Titel</label>
|
||||||
|
<input type="text" v-model="addon.title" class="width-full" placeholder="z. B. „Parkticket“"/>
|
||||||
|
|
||||||
|
<label class="field-label">Beschreibung (optional)</label>
|
||||||
|
<input type="text" v-model="addon.description" class="width-full" placeholder="Kurze Erläuterung"/>
|
||||||
|
|
||||||
|
<div class="addon-price-row">
|
||||||
|
<span>
|
||||||
|
<label class="field-label">Preis</label>
|
||||||
|
<AmountInput v-model="addon.price" class="width-small"/> Euro
|
||||||
|
</span>
|
||||||
|
<label class="flat-label">
|
||||||
|
<input type="checkbox" v-model="addon.flat"/>
|
||||||
|
Pauschale (nicht pro Tag)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label class="link remove-link" @click="removeAddon(index)">Entfernen</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 16px;">
|
||||||
|
<label class="link" @click="addAddon">+ Zusatz hinzufügen</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 24px;">
|
||||||
|
<input type="button" value="Speichern" @click="save"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.addon-card {
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 14px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon-fields {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-label {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 6px 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon-fields .field-label:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon-price-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 24px;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flat-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width-small {
|
||||||
|
width: 90px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-link {
|
||||||
|
white-space: nowrap;
|
||||||
|
color: #ef4444;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, reactive, ref} from "vue";
|
import {onMounted, reactive, ref} from "vue";
|
||||||
import ParticipationFees from "./ParticipationFees.vue";
|
import ParticipationFees from "./ParticipationFees.vue";
|
||||||
|
import ParticipationOptions from "./ParticipationOptions.vue";
|
||||||
|
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";
|
||||||
@@ -36,6 +38,14 @@
|
|||||||
displayData.value = 'participationFees';
|
displayData.value = 'participationFees';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function showParticipationOptions() {
|
||||||
|
displayData.value = 'participationOptions';
|
||||||
|
}
|
||||||
|
|
||||||
|
async function showEventAddons() {
|
||||||
|
displayData.value = 'eventAddons';
|
||||||
|
}
|
||||||
|
|
||||||
async function showEventManagement() {
|
async function showEventManagement() {
|
||||||
displayData.value = 'eventManagement';
|
displayData.value = 'eventManagement';
|
||||||
}
|
}
|
||||||
@@ -107,6 +117,9 @@
|
|||||||
|
|
||||||
|
|
||||||
<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"
|
||||||
|
@close="showMain"/>
|
||||||
|
<EventAddons v-else-if="displayData === 'eventAddons'" :event="dynamicProps.event" @close="showMain"/>
|
||||||
<CommonSettings v-else-if="displayData === 'commonSettings'" :event="dynamicProps.event" @close="showMain" />
|
<CommonSettings v-else-if="displayData === 'commonSettings'" :event="dynamicProps.event" @close="showMain" />
|
||||||
<EventManagement v-else-if="displayData === 'eventManagement'" :event="dynamicProps.event" @close="showMain" />
|
<EventManagement v-else-if="displayData === 'eventManagement'" :event="dynamicProps.event" @close="showMain" />
|
||||||
|
|
||||||
@@ -185,7 +198,10 @@
|
|||||||
<div class="event-flexbox-row bottom">
|
<div class="event-flexbox-row bottom">
|
||||||
<label style="font-size: 9pt;" class="link" @click="showCommonSettings">Allgemeine Einstellungen</label>
|
<label style="font-size: 9pt;" class="link" @click="showCommonSettings">Allgemeine Einstellungen</label>
|
||||||
<label style="font-size: 9pt;" class="link" @click="showEventManagement">Veranstaltungsleitung</label>
|
<label style="font-size: 9pt;" class="link" @click="showEventManagement">Veranstaltungsleitung</label>
|
||||||
<label style="font-size: 9pt;" class="link" @click="showParticipationFees">Teilnahmegebühren</label>
|
<label style="font-size: 9pt;" class="link" @click="showParticipationFees">Teilnahmegebühren</label>
|
||||||
|
<label style="font-size: 9pt;" class="link" @click="showParticipationOptions">Teilnahmeoptionen</label>
|
||||||
|
|
||||||
|
<label style="font-size: 9pt;" class="link" @click="showEventAddons">Zusatzoptionen</label>
|
||||||
<a style="font-size: 9pt;" class="link" :href="'/budget/' + props.data.event.costUnit.id">Budget bearbeiten</a>
|
<a style="font-size: 9pt;" class="link" :href="'/budget/' + props.data.event.costUnit.id">Budget bearbeiten</a>
|
||||||
<a style="font-size: 9pt;" class="link" :href="'/cost-unit/' + props.data.event.costUnit.id">Ausgabenübersicht</a>
|
<a style="font-size: 9pt;" class="link" :href="'/cost-unit/' + props.data.event.costUnit.id">Ausgabenübersicht</a>
|
||||||
<a v-if="!dynamicProps.event.registrationAllowed && !dynamicProps.event.archived" style="color: #ff0000; font-size: 9pt;" class="link" @click="archiveEvent">Archivieren</a>
|
<a v-if="!dynamicProps.event.registrationAllowed && !dynamicProps.event.archived" style="color: #ff0000; font-size: 9pt;" class="link" @click="archiveEvent">Archivieren</a>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, reactive, watch} from "vue";
|
import {computed, onMounted, reactive, watch} from "vue";
|
||||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||||
import DialableTelephoneNumber from "../../../../Views/Components/DialableTelephoneNumber.vue";
|
import DialableTelephoneNumber from "../../../../Views/Components/DialableTelephoneNumber.vue";
|
||||||
|
|
||||||
@@ -60,8 +60,27 @@ const form = reactive({
|
|||||||
amountPaid: '',
|
amountPaid: '',
|
||||||
amountExpected: '',
|
amountExpected: '',
|
||||||
cocStatus: '',
|
cocStatus: '',
|
||||||
|
participationOptions: {},
|
||||||
|
selectedAddons: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Teilnahmeoptionen des Events (Definition mit Titel/Frage/Optionen).
|
||||||
|
const participationQuestions = computed(() => staticProps.event?.participationOptions ?? []);
|
||||||
|
|
||||||
|
// Zusatzoptionen (Event-Addons) des Events.
|
||||||
|
const eventAddons = computed(() => staticProps.event?.addons ?? []);
|
||||||
|
|
||||||
|
// Gewählte Antwort (Options-Label) eines Teilnehmers zu einer Frage – für die Ansicht „Titel: Antwort".
|
||||||
|
function answerLabelFor(questionKey) {
|
||||||
|
const answer = (props.participant?.participationOptions ?? []).find(o => o.questionKey === questionKey);
|
||||||
|
return answer?.valueLabel ?? '—';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hat der Teilnehmer diesen Zusatz gebucht? – für die Ansicht.
|
||||||
|
function isAddonSelected(addonKey) {
|
||||||
|
return (props.participant?.selectedAddons ?? []).some(a => a.addonKey === addonKey);
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.participant,
|
() => props.participant,
|
||||||
(participant) => {
|
(participant) => {
|
||||||
@@ -94,6 +113,12 @@ watch(
|
|||||||
form.amountPaid = participant?.amountPaid.short ?? '';
|
form.amountPaid = participant?.amountPaid.short ?? '';
|
||||||
form.amountExpected = participant?.amountExpected.short ?? '';
|
form.amountExpected = participant?.amountExpected.short ?? '';
|
||||||
form.cocStatus = participant?.efz_status ?? '';
|
form.cocStatus = participant?.efz_status ?? '';
|
||||||
|
form.participationOptions = Object.fromEntries(
|
||||||
|
(participant?.participationOptions ?? []).map(o => [o.questionKey, o.value])
|
||||||
|
);
|
||||||
|
form.selectedAddons = Object.fromEntries(
|
||||||
|
(participant?.selectedAddons ?? []).map(a => [a.addonKey, true])
|
||||||
|
);
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
@@ -388,6 +413,43 @@ function saveParticipant() {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="participationData" v-if="participationQuestions.length > 0 || eventAddons.length > 0">
|
||||||
|
<div>
|
||||||
|
<template v-if="participationQuestions.length > 0">
|
||||||
|
<h3>Teilnahmeoptionen</h3>
|
||||||
|
<table>
|
||||||
|
<tr v-for="question in participationQuestions" :key="question.key">
|
||||||
|
<th>{{ question.title || question.label }}</th>
|
||||||
|
<td>
|
||||||
|
<span v-if="!staticProps.editMode">{{ answerLabelFor(question.key) }}</span>
|
||||||
|
<select v-else v-model="form.participationOptions[question.key]">
|
||||||
|
<option value="">— keine —</option>
|
||||||
|
<option v-for="option in question.options" :key="option.value"
|
||||||
|
:value="option.value">
|
||||||
|
{{ option.label }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<template v-if="eventAddons.length > 0">
|
||||||
|
<h3>Zusatzoptionen</h3>
|
||||||
|
<table>
|
||||||
|
<tr v-for="addon in eventAddons" :key="addon.key">
|
||||||
|
<th>{{ addon.title }}</th>
|
||||||
|
<td>
|
||||||
|
<span v-if="!staticProps.editMode">{{ isAddonSelected(addon.key) ? 'Ja' : '—' }}</span>
|
||||||
|
<input v-else type="checkbox" v-model="form.selectedAddons[addon.key]"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button v-if="!staticProps.editMode" class="button" @click="enableEditMode">Bearbeiten</button>
|
<button v-if="!staticProps.editMode" class="button" @click="enableEditMode">Bearbeiten</button>
|
||||||
@@ -407,6 +469,10 @@ function saveParticipant() {
|
|||||||
gap: 20px;
|
gap: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.participationData table tr th {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
.participationData div {
|
.participationData div {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, inject} from "vue";
|
||||||
|
import ParticipantsList from "./ParticipantsList.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({participants: {}, event: {}, listType: ''}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Von TabbedPage bereitgestellt: erlaubt den Sprung zum Übersicht-Tab (Index 0), wo die
|
||||||
|
// Zusatzoptionen konfiguriert werden.
|
||||||
|
const selectTab = inject('selectTab', null);
|
||||||
|
|
||||||
|
const hasAddons = computed(() => (props.data?.event?.addons?.length ?? 0) > 0);
|
||||||
|
|
||||||
|
function goToOverview() {
|
||||||
|
if (selectTab) {
|
||||||
|
selectTab(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ParticipantsList v-if="hasAddons" :data="data" :show-group-mail="false"/>
|
||||||
|
|
||||||
|
<div v-else class="no-addons">
|
||||||
|
<h3>Keine Zusatzoptionen angelegt</h3>
|
||||||
|
<p>
|
||||||
|
Für diese Veranstaltung sind noch keine Zusatzoptionen angelegt. Sobald du unter
|
||||||
|
<strong>Übersicht → Zusatzoptionen</strong> Zusätze definierst, werden die Teilnehmenden hier nach
|
||||||
|
ihren gebuchten Zusätzen gruppiert.
|
||||||
|
</p>
|
||||||
|
<button v-if="selectTab" type="button" class="button" @click="goToOverview">
|
||||||
|
Zu den Zusatzoptionen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.no-addons {
|
||||||
|
max-width: 640px;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 24px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-addons p {
|
||||||
|
color: #4b5563;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding: 8px 18px;
|
||||||
|
background: #2563eb;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, inject} from "vue";
|
||||||
|
import ParticipantsList from "./ParticipantsList.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({participants: {}, event: {}, listType: ''}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Von TabbedPage bereitgestellt: erlaubt den Sprung zum Übersicht-Tab (Index 0), wo die
|
||||||
|
// Teilnahmeoptionen konfiguriert werden.
|
||||||
|
const selectTab = inject('selectTab', null);
|
||||||
|
|
||||||
|
const hasOptions = computed(() => (props.data?.event?.participationOptions?.length ?? 0) > 0);
|
||||||
|
|
||||||
|
function goToOverview() {
|
||||||
|
if (selectTab) {
|
||||||
|
selectTab(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ParticipantsList v-if="hasOptions" :data="data" :show-group-mail="false"/>
|
||||||
|
|
||||||
|
<div v-else class="no-options">
|
||||||
|
<h3>Keine Teilnahmeoptionen angelegt</h3>
|
||||||
|
<p>
|
||||||
|
Für diese Veranstaltung sind noch keine Teilnahmeoptionen angelegt. Sobald du unter
|
||||||
|
<strong>Übersicht → Teilnahmeoptionen</strong> Fragen definierst, werden die Teilnehmenden hier nach
|
||||||
|
ihrer Auswahl gruppiert.
|
||||||
|
</p>
|
||||||
|
<button v-if="selectTab" type="button" class="button" @click="goToOverview">
|
||||||
|
Zu den Teilnahmeoptionen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.no-options {
|
||||||
|
max-width: 640px;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 24px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-options p {
|
||||||
|
color: #4b5563;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding: 8px 18px;
|
||||||
|
background: #2563eb;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -5,7 +5,7 @@ import ParticipantData from "./ParticipantData.vue";
|
|||||||
import MailCompose from "./MailCompose.vue";
|
import MailCompose from "./MailCompose.vue";
|
||||||
import {toast} from "vue3-toastify";
|
import {toast} from "vue3-toastify";
|
||||||
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
||||||
import {format, getDay, getMonth, getYear} from "date-fns";
|
import {format} from "date-fns";
|
||||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||||
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
||||||
import DialableTelephoneNumber from "../../../../Views/Components/DialableTelephoneNumber.vue";
|
import DialableTelephoneNumber from "../../../../Views/Components/DialableTelephoneNumber.vue";
|
||||||
@@ -20,6 +20,11 @@ const props = defineProps({
|
|||||||
listType: '',
|
listType: '',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
// Steuert, ob je Gruppe der „E-Mail an Gruppe senden"-Button angezeigt wird.
|
||||||
|
showGroupMail: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const today = format(new Date(), "yyyy-MM-dd");
|
const today = format(new Date(), "yyyy-MM-dd");
|
||||||
@@ -344,6 +349,14 @@ function mailToGroup(groupKey) {
|
|||||||
<span class="link" style="font-size:10pt;" @click="paymentComplete(participant)">Zahlung buchen</span>
|
<span class="link" style="font-size:10pt;" @click="paymentComplete(participant)">Zahlung buchen</span>
|
||||||
<span class="link" style="font-size:10pt;" @click="openPartialPaymentDialog(participant)">Teilzahlung buchen</span>
|
<span class="link" style="font-size:10pt;" @click="openPartialPaymentDialog(participant)">Teilzahlung buchen</span>
|
||||||
</span>
|
</span>
|
||||||
|
<br/><br/>
|
||||||
|
<span :id="'participant-' + participant.identifier + '-paymentmethod'"
|
||||||
|
style="font-size:10pt;">
|
||||||
|
Zahlungsweise: <label
|
||||||
|
:id="'participant-' + participant.identifier + '-paymentmethod-name'">{{
|
||||||
|
participant.paymentMethod ?? '—'
|
||||||
|
}}</label>
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="pl-email">
|
<td class="pl-email">
|
||||||
@@ -396,7 +409,8 @@ function mailToGroup(groupKey) {
|
|||||||
27 Jahre und älter: <strong>{{ getAgeCounts(participants)['27+'] ?? 0 }}</strong>
|
27 Jahre und älter: <strong>{{ getAgeCounts(participants)['27+'] ?? 0 }}</strong>
|
||||||
</td>
|
</td>
|
||||||
<td class="pl-summary-action">
|
<td class="pl-summary-action">
|
||||||
<input type="button" class="button" @click="mailToGroup(groupKey)" value="E-Mail an Gruppe senden" />
|
<input v-if="showGroupMail" type="button" class="button" @click="mailToGroup(groupKey)"
|
||||||
|
value="E-Mail an Gruppe senden"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {reactive, watch} from "vue";
|
import {onMounted, reactive, ref} from "vue";
|
||||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||||
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
||||||
|
import TextEditor from "../../../../Views/Components/TextEditor.vue";
|
||||||
|
import Modal from "../../../../Views/Components/Modal.vue";
|
||||||
|
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
|
||||||
|
import {PAYMENT_METHOD_ICONS} from "../../../../../resources/js/constants/paymentMethodIcons.js";
|
||||||
import {toast} from "vue3-toastify";
|
import {toast} from "vue3-toastify";
|
||||||
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||||
|
|
||||||
@@ -11,6 +15,45 @@
|
|||||||
event: Object,
|
event: Object,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Verfügbare (aktive) Zahlungsarten des Tenants inkl. optionsSchema + Default-Config.
|
||||||
|
const availablePaymentMethods = ref([])
|
||||||
|
// Auswahl der Zahlungsart-Slugs für dieses Event (Default: leer bei neuen Events).
|
||||||
|
const paymentMethods = ref([])
|
||||||
|
// pro-Event-Config je Zahlungsmethode: { slug: { option: value } }
|
||||||
|
const paymentMethodConfigurations = reactive({})
|
||||||
|
|
||||||
|
// Optionen-Modal
|
||||||
|
const showOptionsModal = ref(false)
|
||||||
|
const optionsMethod = ref(null)
|
||||||
|
|
||||||
|
function openOptions(method) {
|
||||||
|
optionsMethod.value = method
|
||||||
|
showOptionsModal.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const response = await fetch('/api/v1/core/retrieve-event-setting-data');
|
||||||
|
const data = await response.json();
|
||||||
|
availablePaymentMethods.value = data.paymentMethods ?? []
|
||||||
|
|
||||||
|
paymentMethods.value = props.event.paymentMethods?.map(t => t.slug) ?? []
|
||||||
|
|
||||||
|
// Pro-Event-Config vorbelegen: bereits gespeicherte Pivot-Config des Events hat Vorrang,
|
||||||
|
// sonst der Tenant-Standard (Snapshot-Quelle für neu zugewiesene Methoden).
|
||||||
|
const eventConfigBySlug = {}
|
||||||
|
for (const pm of props.event.paymentMethods ?? []) {
|
||||||
|
eventConfigBySlug[pm.slug] = pm.configuration ?? {}
|
||||||
|
}
|
||||||
|
for (const method of availablePaymentMethods.value) {
|
||||||
|
const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {}
|
||||||
|
const config = {}
|
||||||
|
for (const option of method.optionsSchema ?? []) {
|
||||||
|
config[option.name] = source[option.name] ?? ''
|
||||||
|
}
|
||||||
|
paymentMethodConfigurations[method.slug] = config
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const errors = reactive({})
|
const errors = reactive({})
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
"pft_1_active": true,
|
"pft_1_active": true,
|
||||||
@@ -75,6 +118,24 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (paymentMethods.value.length === 0) {
|
||||||
|
toast.error('Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const paymentResponse = await request('/api/v1/event/details/' + props.event.id + '/payment-methods', {
|
||||||
|
method: "POST",
|
||||||
|
body: {
|
||||||
|
paymentMethods: paymentMethods.value,
|
||||||
|
paymentMethodConfigurations: paymentMethodConfigurations,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (paymentResponse.status !== 'success') {
|
||||||
|
toast.error(paymentResponse.message ?? 'Die Zahlungsmöglichkeiten konnten nicht gespeichert werden.')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const data = await request('/api/v1/event/details/' + props.event.id + '/participation-fees', {
|
const data = await request('/api/v1/event/details/' + props.event.id + '/participation-fees', {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
@@ -286,10 +347,81 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" style="padding-top: 30px;">
|
||||||
|
<h4>Zahlungsmöglichkeiten</h4>
|
||||||
|
<div v-for="paymentMethod in availablePaymentMethods" :key="paymentMethod.slug"
|
||||||
|
class="payment-method-row">
|
||||||
|
<input type="checkbox" :id="'paymentmethod' + paymentMethod.id" :value="paymentMethod.slug"
|
||||||
|
v-model="paymentMethods"/>
|
||||||
|
<label style="padding-left: 5px;" :for="'paymentmethod' + paymentMethod.id">{{
|
||||||
|
paymentMethod.name
|
||||||
|
}}</label>
|
||||||
|
<label
|
||||||
|
v-if="paymentMethods.includes(paymentMethod.slug) && (paymentMethod.optionsSchema?.length ?? 0) > 0"
|
||||||
|
class="link"
|
||||||
|
style="padding-left: 15px; font-size: 10pt;"
|
||||||
|
@click="openOptions(paymentMethod)"
|
||||||
|
>Optionen</label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" style="padding-top: 20px;">
|
<td colspan="4" style="padding-top: 20px;">
|
||||||
<input type="button" value="Speichern" @click="saveParticipationFees" />
|
<input type="button" value="Speichern" @click="saveParticipationFees" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-if="showOptionsModal"
|
||||||
|
:show="showOptionsModal"
|
||||||
|
:title="'Optionen: ' + (optionsMethod?.name ?? '')"
|
||||||
|
width="700px"
|
||||||
|
@close="showOptionsModal = false"
|
||||||
|
>
|
||||||
|
<div v-for="option in optionsMethod?.optionsSchema ?? []" :key="option.name" class="payment-method-config-row">
|
||||||
|
<label>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></label>
|
||||||
|
<RichSelectBox v-if="option.type === 'icon'"
|
||||||
|
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
|
||||||
|
:options="PAYMENT_METHOD_ICONS"
|
||||||
|
placeholder="Symbol wählen…"/>
|
||||||
|
<TextEditor v-else-if="option.type === 'richtext'"
|
||||||
|
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"/>
|
||||||
|
<input v-else type="text"
|
||||||
|
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
|
||||||
|
class="width-full"/>
|
||||||
|
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.payment-method-row {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-method-config-row {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-method-config-row label {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #374151;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.required-marker {
|
||||||
|
color: #ef4444;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-hint {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
<script setup>
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {toast} from "vue3-toastify";
|
||||||
|
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||||
|
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
event: Object,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Fragen-Definition dieses Events: [ { key, label, options: [ { value, label } ] } ].
|
||||||
|
// key/value bleiben für bestehende Einträge erhalten (Bestandsschutz für bereits gespeicherte Antworten);
|
||||||
|
// neue Einträge bekommen serverseitig beim Speichern einen stabilen Slug.
|
||||||
|
const questions = ref((props.event.participationOptions ?? []).map(q => ({
|
||||||
|
key: q.key ?? '',
|
||||||
|
title: q.title ?? '',
|
||||||
|
label: q.label ?? '',
|
||||||
|
options: (q.options ?? []).map(o => ({value: o.value ?? '', label: o.label ?? ''})),
|
||||||
|
})))
|
||||||
|
|
||||||
|
function addQuestion() {
|
||||||
|
questions.value.push({key: '', title: '', label: '', options: [{value: '', label: ''}, {value: '', label: ''}]})
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeQuestion(index) {
|
||||||
|
questions.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function addOption(question) {
|
||||||
|
question.options.push({value: '', label: ''})
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeOption(question, index) {
|
||||||
|
question.options.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate() {
|
||||||
|
for (const question of questions.value) {
|
||||||
|
if (question.title.trim() === '') {
|
||||||
|
toast.error('Bitte für jede Frage einen Titel angeben.')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const validOptions = question.options.filter(o => o.label.trim() !== '')
|
||||||
|
if (validOptions.length < 1) {
|
||||||
|
toast.error('Jede Frage braucht mindestens eine Auswahlmöglichkeit.')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
if (!validate()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await request('/api/v1/event/details/' + props.event.id + '/participation-options', {
|
||||||
|
method: 'POST',
|
||||||
|
body: {
|
||||||
|
questions: questions.value,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response.status !== 'success') {
|
||||||
|
toast.error(response.message ?? 'Die Teilnahmeoptionen konnten nicht gespeichert werden.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
toast.success('Die Teilnahmeoptionen wurden gespeichert')
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="participation-options">
|
||||||
|
<h3>Teilnahmeoptionen</h3>
|
||||||
|
<p style="color: #6b7280; font-size: 0.9rem;">
|
||||||
|
Pflicht-Auswahlfragen für die Anmeldung (z. B. Kurs oder Stufe). Je Frage ist genau eine Option wählbar.
|
||||||
|
Ohne Fragen wird dieser Schritt in der Anmeldung übersprungen.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div v-for="(question, qIndex) in questions" :key="qIndex" class="question-card">
|
||||||
|
<div class="question-head">
|
||||||
|
<div class="question-fields">
|
||||||
|
<label class="field-label">Titel (Überschrift / Feldbeschriftung)</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="question.title"
|
||||||
|
class="width-full"
|
||||||
|
placeholder="Titel, z. B. „Kurs“"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<label class="field-label">Frage / Erklärtext (optional)</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="question.label"
|
||||||
|
class="width-full"
|
||||||
|
placeholder="z. B. „Welchen Kurs möchtest du belegen?“"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<label class="link remove-link" @click="removeQuestion(qIndex)">Frage entfernen</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="options">
|
||||||
|
<div v-for="(option, oIndex) in question.options" :key="oIndex" class="option-row">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="option.label"
|
||||||
|
class="width-full"
|
||||||
|
placeholder="Auswahlmöglichkeit"
|
||||||
|
/>
|
||||||
|
<label class="link remove-link" @click="removeOption(question, oIndex)">✕</label>
|
||||||
|
</div>
|
||||||
|
<label class="link" @click="addOption(question)">+ Option hinzufügen</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 16px;">
|
||||||
|
<label class="link" @click="addQuestion">+ Frage hinzufügen</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 24px;">
|
||||||
|
<input type="button" value="Speichern" @click="save"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.question-card {
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 14px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-fields {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-label {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 6px 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-fields .field-label:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.options {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-link {
|
||||||
|
white-space: nowrap;
|
||||||
|
color: #ef4444;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -6,8 +6,10 @@ import StepPersonalData from './steps/StepPersonalData.vue'
|
|||||||
import StepRegistrationMode from './steps/StepRegistrationMode.vue'
|
import StepRegistrationMode from './steps/StepRegistrationMode.vue'
|
||||||
import StepArrival from './steps/StepArrival.vue'
|
import StepArrival from './steps/StepArrival.vue'
|
||||||
import StepAddons from './steps/StepAddons.vue'
|
import StepAddons from './steps/StepAddons.vue'
|
||||||
|
import StepParticipationOptions from './steps/StepParticipationOptions.vue'
|
||||||
import StepPhotoPermissions from './steps/StepPhotoPermissions.vue'
|
import StepPhotoPermissions from './steps/StepPhotoPermissions.vue'
|
||||||
import StepAllergies from './steps/StepAllergies.vue'
|
import StepAllergies from './steps/StepAllergies.vue'
|
||||||
|
import StepPaymentMethod from './steps/StepPaymentMethod.vue'
|
||||||
import StepSummary from './steps/StepSummary.vue'
|
import StepSummary from './steps/StepSummary.vue'
|
||||||
import SubmitSuccess from './after-submit/SubmitSuccess.vue'
|
import SubmitSuccess from './after-submit/SubmitSuccess.vue'
|
||||||
import SubmitAlreadyExists from './after-submit/SubmitAlreadyExists.vue'
|
import SubmitAlreadyExists from './after-submit/SubmitAlreadyExists.vue'
|
||||||
@@ -16,15 +18,15 @@ const props = defineProps({
|
|||||||
event: Object,
|
event: Object,
|
||||||
participantData: Object,
|
participantData: Object,
|
||||||
localGroups: Array,
|
localGroups: Array,
|
||||||
paymentMethod: String,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['registrationDone'])
|
const emit = defineEmits(['registrationDone'])
|
||||||
|
|
||||||
const {
|
const {
|
||||||
currentStep, goToStep, formData, selectedAddons,
|
currentStep, goToStep, formData, selectedAddons,
|
||||||
submit, submitting, submitResult, summaryLoading, summaryAmount
|
submit, submitting, submitResult, summaryLoading, summaryAmount, summaryAmountValue,
|
||||||
} = useSignupForm(props.event, props.participantData, props.paymentMethod)
|
summaryBaseAmount, summaryAddonLines
|
||||||
|
} = useSignupForm(props.event, props.participantData)
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{ step: 1, label: 'Alter' },
|
{ step: 1, label: 'Alter' },
|
||||||
@@ -33,9 +35,11 @@ const steps = [
|
|||||||
{ step: 4, label: 'An-/Abreise' },
|
{ step: 4, label: 'An-/Abreise' },
|
||||||
{ step: 5, label: 'Teilnahmegruppe' },
|
{ step: 5, label: 'Teilnahmegruppe' },
|
||||||
{ step: 6, label: 'Zusatzoptionen' },
|
{ step: 6, label: 'Zusatzoptionen' },
|
||||||
{ step: 7, label: 'Fotoerlaubnis' },
|
{step: 7, label: 'Teilnahmeoptionen'},
|
||||||
{ step: 8, label: 'Allergien' },
|
{step: 8, label: 'Fotoerlaubnis'},
|
||||||
{ step: 9, label: 'Zusammenfassung' },
|
{step: 9, label: 'Allergien'},
|
||||||
|
{step: 10, label: 'Zahlungsart'},
|
||||||
|
{step: 11, label: 'Zusammenfassung'},
|
||||||
]
|
]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -92,13 +96,22 @@ const steps = [
|
|||||||
<StepArrival v-if="currentStep === 4" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
<StepArrival v-if="currentStep === 4" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
||||||
<StepRegistrationMode v-if="currentStep === 5" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
<StepRegistrationMode v-if="currentStep === 5" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
||||||
<StepAddons v-if="currentStep === 6" :formData="formData" :event="event" :selectedAddons="selectedAddons" @next="goToStep" @back="goToStep" />
|
<StepAddons v-if="currentStep === 6" :formData="formData" :event="event" :selectedAddons="selectedAddons" @next="goToStep" @back="goToStep" />
|
||||||
<StepPhotoPermissions v-if="currentStep === 7" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
<StepParticipationOptions v-if="currentStep === 7" :formData="formData" :event="event" @next="goToStep"
|
||||||
<StepAllergies v-if="currentStep === 8" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
@back="goToStep"/>
|
||||||
|
<StepPhotoPermissions v-if="currentStep === 8" :formData="formData" :event="event" @next="goToStep"
|
||||||
|
@back="goToStep"/>
|
||||||
|
<StepAllergies v-if="currentStep === 9" :formData="formData" :event="event" @next="goToStep"
|
||||||
|
@back="goToStep"/>
|
||||||
|
<StepPaymentMethod v-if="currentStep === 10" :formData="formData" :event="event" @next="goToStep"
|
||||||
|
@back="goToStep"/>
|
||||||
<StepSummary
|
<StepSummary
|
||||||
v-if="currentStep === 9"
|
v-if="currentStep === 11"
|
||||||
:formData="formData"
|
:formData="formData"
|
||||||
:event="event"
|
:event="event"
|
||||||
|
:summaryBaseAmount="summaryBaseAmount"
|
||||||
|
:summaryAddonLines="summaryAddonLines"
|
||||||
:summaryAmount="summaryAmount"
|
:summaryAmount="summaryAmount"
|
||||||
|
:summaryAmountValue="summaryAmountValue"
|
||||||
:summaryLoading="summaryLoading"
|
:summaryLoading="summaryLoading"
|
||||||
:submitting="submitting"
|
:submitting="submitting"
|
||||||
@back="goToStep"
|
@back="goToStep"
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<script setup>
|
||||||
|
import TextEditor from "../../../../../../Views/Components/TextEditor.vue";
|
||||||
|
|
||||||
|
// Generische, schema-getriebene Eingabefelder eines Zahlungsmoduls. Wiederverwendbar für künftige
|
||||||
|
// Verfahren (SEPA, PayPal): das jeweilige Modul liefert das Schema, hier wird nur gerendert.
|
||||||
|
const props = defineProps({
|
||||||
|
// [{ name, label, type, required }] -- z.B. aus participantOptionsSchema einer Zahlungsmethode.
|
||||||
|
schema: {type: Array, default: () => []},
|
||||||
|
// v-model: Objekt { optionName: value }
|
||||||
|
modelValue: {type: Object, default: () => ({})},
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
function setValue(name, value) {
|
||||||
|
emit('update:modelValue', {...props.modelValue, [name]: value})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<table class="form-table">
|
||||||
|
<tr v-for="option in schema" :key="option.name">
|
||||||
|
<td>
|
||||||
|
{{ option.label }}<span v-if="option.required" class="required-marker">*</span>:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<TextEditor
|
||||||
|
v-if="option.type === 'richtext'"
|
||||||
|
:modelValue="modelValue[option.name] ?? ''"
|
||||||
|
@update:modelValue="value => setValue(option.name, value)"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-else-if="option.type === 'checkbox'"
|
||||||
|
type="checkbox"
|
||||||
|
:checked="modelValue[option.name] ?? false"
|
||||||
|
@change="event => setValue(option.name, event.target.checked)"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
v-else
|
||||||
|
type="text"
|
||||||
|
:value="modelValue[option.name] ?? ''"
|
||||||
|
@input="event => setValue(option.name, event.target.value)"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.required-marker {
|
||||||
|
color: #ef4444;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
// Zentrale Schrittreihenfolge des Anmelde-Wizards. Einige Schritte sind optional und werden
|
||||||
|
// übersprungen, wenn sie für das Event nicht zutreffen (Zusatzoptionen, Teilnahmeoptionen).
|
||||||
|
// Der Zahlungsschritt wird separat in useSignupForm anhand des berechneten Betrags übersprungen.
|
||||||
|
export const STEP_AGE = 1
|
||||||
|
export const STEP_CONTACT = 2
|
||||||
|
export const STEP_PERSONAL = 3
|
||||||
|
export const STEP_ARRIVAL = 4
|
||||||
|
export const STEP_REGISTRATION = 5
|
||||||
|
export const STEP_ADDONS = 6
|
||||||
|
export const STEP_PARTICIPATION_OPTIONS = 7
|
||||||
|
export const STEP_PHOTO = 8
|
||||||
|
export const STEP_ALLERGIES = 9
|
||||||
|
export const STEP_PAYMENT = 10
|
||||||
|
export const STEP_SUMMARY = 11
|
||||||
|
|
||||||
|
// Ob ein (optionaler) Schritt für dieses Event angezeigt wird.
|
||||||
|
export function stepVisible(event, step) {
|
||||||
|
if (step === STEP_ADDONS) {
|
||||||
|
return (event.addons?.length ?? 0) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step === STEP_PARTICIPATION_OPTIONS) {
|
||||||
|
return (event.participationOptions?.length ?? 0) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nächster sichtbarer Schritt nach `step` (überspringt ausgeblendete optionale Schritte).
|
||||||
|
export function nextVisibleFrom(event, step) {
|
||||||
|
let candidate = step + 1
|
||||||
|
while (candidate < STEP_SUMMARY && !stepVisible(event, candidate)) {
|
||||||
|
candidate++
|
||||||
|
}
|
||||||
|
return candidate
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vorheriger sichtbarer Schritt vor `step`.
|
||||||
|
export function prevVisibleFrom(event, step) {
|
||||||
|
let candidate = step - 1
|
||||||
|
while (candidate > STEP_AGE && !stepVisible(event, candidate)) {
|
||||||
|
candidate--
|
||||||
|
}
|
||||||
|
return candidate
|
||||||
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
import { ref, reactive, computed } from 'vue'
|
import {reactive, ref} from 'vue'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import {STEP_PAYMENT, STEP_SUMMARY} from './stepFlow.js'
|
||||||
|
|
||||||
export function useSignupForm(event, participantData, paymentMethod) {
|
export function useSignupForm(event, participantData) {
|
||||||
const currentStep = ref(1)
|
const currentStep = ref(1)
|
||||||
const submitting = ref(false)
|
const submitting = ref(false)
|
||||||
const summaryLoading = ref(false)
|
const summaryLoading = ref(false)
|
||||||
@@ -9,9 +10,15 @@ export function useSignupForm(event, participantData, paymentMethod) {
|
|||||||
|
|
||||||
const selectedAddons = reactive({})
|
const selectedAddons = reactive({})
|
||||||
|
|
||||||
|
// Für die Aktion freigeschaltete Zahlungsmethoden; ist genau eine aktiv, wird sie vorausgewählt.
|
||||||
|
const activeMethods = (event.paymentMethods ?? []).filter(m => m.active)
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
eatingHabit: 'EATING_HABIT_VEGAN',
|
eatingHabit: 'EATING_HABIT_VEGAN',
|
||||||
paymentMethod: paymentMethod ?? null,
|
paymentMethod: activeMethods.length === 1 ? activeMethods[0].slug : null,
|
||||||
|
paymentOptions: {},
|
||||||
|
// Antworten auf die event-spezifischen Teilnahmeoptionen: { [question.key]: option.value }
|
||||||
|
participationOptions: {},
|
||||||
userId: participantData.id,
|
userId: participantData.id,
|
||||||
eventId: event.id,
|
eventId: event.id,
|
||||||
vorname: participantData.firstname ?? '',
|
vorname: participantData.firstname ?? '',
|
||||||
@@ -52,11 +59,12 @@ export function useSignupForm(event, participantData, paymentMethod) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const summaryAmount = ref('')
|
const summaryAmount = ref('')
|
||||||
|
const summaryAmountValue = ref(0)
|
||||||
|
const summaryBaseAmount = ref('')
|
||||||
|
const summaryAddonLines = ref([])
|
||||||
|
|
||||||
const goToStep = async (step) => {
|
const fetchAmount = async () => {
|
||||||
if (step === 9) {
|
|
||||||
summaryLoading.value = true
|
summaryLoading.value = true
|
||||||
summaryAmount.value = ''
|
|
||||||
try {
|
try {
|
||||||
const res = await axios.post('/api/v1/event/' + event.id + '/calculate-amount', {
|
const res = await axios.post('/api/v1/event/' + event.id + '/calculate-amount', {
|
||||||
arrival: formData.arrival,
|
arrival: formData.arrival,
|
||||||
@@ -70,15 +78,33 @@ export function useSignupForm(event, participantData, paymentMethod) {
|
|||||||
sibling: formData.sibling,
|
sibling: formData.sibling,
|
||||||
})
|
})
|
||||||
summaryAmount.value = res.data.amount
|
summaryAmount.value = res.data.amount
|
||||||
|
summaryAmountValue.value = Number(res.data.amountValue ?? 0)
|
||||||
|
summaryBaseAmount.value = res.data.baseAmount ?? ''
|
||||||
|
summaryAddonLines.value = res.data.addons ?? []
|
||||||
} finally {
|
} finally {
|
||||||
summaryLoading.value = false
|
summaryLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const goToStep = async (step) => {
|
||||||
|
if (step === STEP_PAYMENT) {
|
||||||
|
// Betrag ermitteln: Bei 0 € wird die Zahlungsart-Auswahl übersprungen.
|
||||||
|
await fetchAmount()
|
||||||
|
if (summaryAmountValue.value <= 0) {
|
||||||
|
formData.paymentMethod = null
|
||||||
|
formData.paymentOptions = {}
|
||||||
|
currentStep.value = STEP_SUMMARY
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else if (step === STEP_SUMMARY) {
|
||||||
|
await fetchAmount()
|
||||||
|
}
|
||||||
currentStep.value = step
|
currentStep.value = step
|
||||||
}
|
}
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
if (!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted || !formData.payment) {
|
// Zahlungs-Bestätigung wird im Summary-Schritt kontextabhängig erzwungen (nur bei Überweisung).
|
||||||
|
if (!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
@@ -96,5 +122,18 @@ export function useSignupForm(event, participantData, paymentMethod) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { currentStep, goToStep, formData, selectedAddons, submit, submitting, submitResult, summaryLoading, summaryAmount }
|
return {
|
||||||
|
currentStep,
|
||||||
|
goToStep,
|
||||||
|
formData,
|
||||||
|
selectedAddons,
|
||||||
|
submit,
|
||||||
|
submitting,
|
||||||
|
submitResult,
|
||||||
|
summaryLoading,
|
||||||
|
summaryAmount,
|
||||||
|
summaryAmountValue,
|
||||||
|
summaryBaseAmount,
|
||||||
|
summaryAddonLines
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import {nextVisibleFrom, STEP_ADDONS} from "../composables/stepFlow.js";
|
||||||
|
|
||||||
const props = defineProps({ formData: Object, event: Object, selectedAddons: Object })
|
const props = defineProps({ formData: Object, event: Object, selectedAddons: Object })
|
||||||
const emit = defineEmits(['next', 'back'])
|
const emit = defineEmits(['next', 'back'])
|
||||||
|
|
||||||
|
const next = () => emit('next', nextVisibleFrom(props.event, STEP_ADDONS))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -25,13 +29,21 @@ const emit = defineEmits(['next', 'back'])
|
|||||||
<!-- Addons -->
|
<!-- Addons -->
|
||||||
<div v-if="event.addons?.length > 0">
|
<div v-if="event.addons?.length > 0">
|
||||||
<h3>Zusatzoptionen</h3>
|
<h3>Zusatzoptionen</h3>
|
||||||
<div v-for="addon in event.addons" :key="addon.id" style="margin-bottom: 16px; padding: 12px; background: #f8fafc; border-radius: 8px;">
|
<div v-for="addon in event.addons" :key="addon.key"
|
||||||
|
style="margin-bottom: 16px; padding: 12px; background: #f8fafc; border-radius: 8px;">
|
||||||
<label style="display: flex; gap: 12px; cursor: pointer;">
|
<label style="display: flex; gap: 12px; cursor: pointer;">
|
||||||
<input type="checkbox" v-model="selectedAddons[addon.id]" style="margin-top: 4px;" />
|
<input type="checkbox" v-model="selectedAddons[addon.key]" style="margin-top: 4px;"/>
|
||||||
<span>
|
<span>
|
||||||
<strong>{{ addon.name }}</strong>
|
<strong>{{ addon.title }}</strong>
|
||||||
<span style="display: block; color: #6b7280; font-size: 0.875rem;">Betrag: {{ addon.amount }}</span>
|
<span style="display: block; color: #6b7280; font-size: 0.875rem;">
|
||||||
<span style="display: block; color: #374151; font-size: 0.875rem; margin-top: 4px;">{{ addon.description }}</span>
|
<template v-if="addon.free">Kostenfrei</template>
|
||||||
|
<template v-else>{{ addon.priceReadable }}<template
|
||||||
|
v-if="!addon.flat"> / Tag</template></template>
|
||||||
|
</span>
|
||||||
|
<span v-if="addon.description"
|
||||||
|
style="display: block; color: #374151; font-size: 0.875rem; margin-top: 4px;">{{
|
||||||
|
addon.description
|
||||||
|
}}</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,7 +51,7 @@ const emit = defineEmits(['next', 'back'])
|
|||||||
|
|
||||||
<div class="btn-row">
|
<div class="btn-row">
|
||||||
<button type="button" class="btn-secondary" @click="emit('back', 5)">← Zurück</button>
|
<button type="button" class="btn-secondary" @click="emit('back', 5)">← Zurück</button>
|
||||||
<button type="button" class="btn-primary" @click="emit('next', 7)">Weiter →</button>
|
<button type="button" class="btn-primary" @click="next">Weiter →</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ const emit = defineEmits(['next', 'back'])
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="btn-row">
|
<td colspan="2" class="btn-row">
|
||||||
<button type="button" class="btn-secondary" @click="emit('back', 7)">← Zurück</button>
|
<button type="button" class="btn-secondary" @click="emit('back', 8)">← Zurück</button>
|
||||||
<button type="button" class="btn-primary" @click="emit('next', 9)">Weiter →</button>
|
<button type="button" class="btn-primary" @click="emit('next', 10)">Weiter →</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed} from "vue";
|
||||||
|
import {nextVisibleFrom, prevVisibleFrom, STEP_PARTICIPATION_OPTIONS} from "../composables/stepFlow.js";
|
||||||
|
|
||||||
|
const props = defineProps({formData: Object, event: Object})
|
||||||
|
const emit = defineEmits(['next', 'back'])
|
||||||
|
|
||||||
|
const questions = computed(() => props.event.participationOptions ?? [])
|
||||||
|
|
||||||
|
// Pflichtfeld: "Weiter" erst möglich, wenn jede Frage beantwortet ist.
|
||||||
|
const canProceed = computed(() =>
|
||||||
|
questions.value.every(q => {
|
||||||
|
const value = props.formData.participationOptions[q.key]
|
||||||
|
return value !== undefined && value !== null && String(value).trim() !== ''
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
const back = () => emit('back', prevVisibleFrom(props.event, STEP_PARTICIPATION_OPTIONS))
|
||||||
|
const next = () => emit('next', nextVisibleFrom(props.event, STEP_PARTICIPATION_OPTIONS))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h3>Teilnahmeoptionen</h3>
|
||||||
|
<p style="color: #6b7280; font-size: 0.95rem; margin-bottom: 20px;">
|
||||||
|
Bitte triff für jede Auswahl eine Entscheidung.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="form-table">
|
||||||
|
<tr v-for="question in questions" :key="question.key">
|
||||||
|
<td>
|
||||||
|
{{ question.title || question.label }}:
|
||||||
|
<span v-if="question.title && question.label" class="option-hint">{{ question.label }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select v-model="formData.participationOptions[question.key]">
|
||||||
|
<option value="">Bitte wählen</option>
|
||||||
|
<option v-for="option in question.options" :key="option.value" :value="option.value">
|
||||||
|
{{ option.label }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="btn-row">
|
||||||
|
<button type="button" class="btn-secondary" @click="back">← Zurück</button>
|
||||||
|
<button type="button" class="btn-primary" :disabled="!canProceed" @click="next">Weiter →</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.option-hint {
|
||||||
|
display: block;
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,226 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed} from "vue";
|
||||||
|
import PaymentMethodInputs from "../components/PaymentMethodInputs.vue";
|
||||||
|
import Icon from "../../../../../../Views/Components/Icon.vue";
|
||||||
|
|
||||||
|
const props = defineProps({formData: Object, event: Object})
|
||||||
|
const emit = defineEmits(['next', 'back'])
|
||||||
|
|
||||||
|
// Für die Aktion freigeschaltete Zahlungsmethoden.
|
||||||
|
const methods = computed(() => (props.event.paymentMethods ?? []).filter(m => m.active))
|
||||||
|
|
||||||
|
const selectedMethod = computed(() =>
|
||||||
|
methods.value.find(m => m.slug === props.formData.paymentMethod) ?? null
|
||||||
|
)
|
||||||
|
|
||||||
|
const participantSchema = computed(() => selectedMethod.value?.participantOptionsSchema ?? [])
|
||||||
|
|
||||||
|
// Font-Awesome-Icon je Zahlungsart: konfiguriertes Symbol hat Vorrang, sonst Slug-Default
|
||||||
|
// (Fallback: generische Karte).
|
||||||
|
function iconFor(method) {
|
||||||
|
const configured = method.configuration?.icon
|
||||||
|
if (configured) return configured
|
||||||
|
if (method.slug === 'PAYMENT_ACCOUNT_TRANSACTION') return 'building-columns'
|
||||||
|
if (method.slug === 'PAYMENT_NOT_DEFINED') return 'money-bill-wave'
|
||||||
|
return 'credit-card'
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectMethod(slug) {
|
||||||
|
props.formData.paymentMethod = slug
|
||||||
|
// Eingaben zurücksetzen -- pro Methode eigene Felder.
|
||||||
|
props.formData.paymentOptions = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Weiter" ist erst möglich, wenn eine Methode gewählt und alle Pflicht-Eingaben befüllt sind.
|
||||||
|
const canProceed = computed(() => {
|
||||||
|
if (!props.formData.paymentMethod) return false
|
||||||
|
return participantSchema.value
|
||||||
|
.filter(o => o.required)
|
||||||
|
.every(o => {
|
||||||
|
const value = props.formData.paymentOptions[o.name]
|
||||||
|
return value !== undefined && value !== null && String(value).trim() !== ''
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h3 style="margin: 0 0 6px 0; color: #111827;">Zahlungsweise</h3>
|
||||||
|
<p style="margin: 0 0 24px 0; color: #6b7280; font-size: 0.95rem;">Bitte wähle, wie du deinen Teilnahmebeitrag
|
||||||
|
begleichen möchtest.</p>
|
||||||
|
|
||||||
|
<div class="pay-card-row">
|
||||||
|
<div
|
||||||
|
v-for="method in methods"
|
||||||
|
:key="method.slug"
|
||||||
|
class="pay-card"
|
||||||
|
:class="{ 'pay-card--active': formData.paymentMethod === method.slug }"
|
||||||
|
role="radio"
|
||||||
|
:aria-checked="formData.paymentMethod === method.slug"
|
||||||
|
tabindex="0"
|
||||||
|
@click="selectMethod(method.slug)"
|
||||||
|
@keydown.enter.prevent="selectMethod(method.slug)"
|
||||||
|
@keydown.space.prevent="selectMethod(method.slug)"
|
||||||
|
>
|
||||||
|
<div class="pay-card__badge">
|
||||||
|
<Icon :name="iconFor(method)"/>
|
||||||
|
</div>
|
||||||
|
<div class="pay-card__body">
|
||||||
|
<h4 class="pay-card__title">{{ method.name }}</h4>
|
||||||
|
<p v-if="method.description" class="pay-card__desc">{{ method.description }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="pay-card__check" aria-hidden="true">✓</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="participantSchema.length > 0" class="pay-inputs">
|
||||||
|
<PaymentMethodInputs :schema="participantSchema" v-model="formData.paymentOptions"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="btn-row">
|
||||||
|
<button type="button" class="btn-secondary" @click="emit('back', 9)">← Zurück</button>
|
||||||
|
<button type="button" class="btn-primary" :disabled="!canProceed" @click="emit('next', 11)">Weiter →
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pay-card-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card {
|
||||||
|
position: relative;
|
||||||
|
flex: 1 1 280px;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 2px solid #e5e7eb;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 28px 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card:hover {
|
||||||
|
border-color: #2563eb;
|
||||||
|
box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card--active {
|
||||||
|
border-color: #2563eb;
|
||||||
|
background: #eff6ff;
|
||||||
|
box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
color: #2563eb;
|
||||||
|
background: #e0f2fe;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card--active .pay-card__badge {
|
||||||
|
background: #dbeafe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__desc {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__check {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
right: 12px;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #2563eb;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 700;
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.6);
|
||||||
|
transition: opacity 0.12s, transform 0.12s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card--active .pay-card__check {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-inputs {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 16px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── Smartphone ─── */
|
||||||
|
@media (max-width: 639px) {
|
||||||
|
.pay-card-row {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card {
|
||||||
|
flex: 1 1 100%;
|
||||||
|
flex-direction: row;
|
||||||
|
text-align: left;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 16px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__badge {
|
||||||
|
flex: 0 0 52px;
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__body {
|
||||||
|
flex: 1;
|
||||||
|
align-items: flex-start;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-card__title {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import {prevVisibleFrom, STEP_ALLERGIES, STEP_PHOTO} from "../composables/stepFlow.js";
|
||||||
|
|
||||||
const props = defineProps({ formData: Object, event: Object })
|
const props = defineProps({ formData: Object, event: Object })
|
||||||
const emit = defineEmits(['next', 'back'])
|
const emit = defineEmits(['next', 'back'])
|
||||||
|
|
||||||
const acceptAll = () => {
|
const acceptAll = () => {
|
||||||
Object.keys(props.formData.foto).forEach(k => props.formData.foto[k] = true)
|
Object.keys(props.formData.foto).forEach(k => props.formData.foto[k] = true)
|
||||||
emit('next', 8)
|
emit('next', STEP_ALLERGIES)
|
||||||
}
|
}
|
||||||
|
|
||||||
const back = () => {
|
const back = () => emit('back', prevVisibleFrom(props.event, STEP_PHOTO))
|
||||||
const hasAddons = (props.event.addons?.length > 0) || props.event.solidarityPayment
|
|
||||||
emit('back', hasAddons ? 6 : 5)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -27,7 +26,7 @@ const back = () => {
|
|||||||
<div class="btn-row">
|
<div class="btn-row">
|
||||||
<button type="button" class="btn-secondary" @click="back">← Zurück</button>
|
<button type="button" class="btn-secondary" @click="back">← Zurück</button>
|
||||||
<button type="button" class="btn-primary" style="background: #059669;" @click="acceptAll">Alle akzeptieren & weiter</button>
|
<button type="button" class="btn-primary" style="background: #059669;" @click="acceptAll">Alle akzeptieren & weiter</button>
|
||||||
<button type="button" class="btn-primary" @click="emit('next', 8)">Weiter →</button>
|
<button type="button" class="btn-primary" @click="emit('next', 9)">Weiter →</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {watch} from "vue";
|
import {watch} from "vue";
|
||||||
|
import {nextVisibleFrom, STEP_REGISTRATION} from "../composables/stepFlow.js";
|
||||||
|
|
||||||
const props = defineProps({ formData: Object, event: Object })
|
const props = defineProps({ formData: Object, event: Object })
|
||||||
const emit = defineEmits(['next', 'back'])
|
const emit = defineEmits(['next', 'back'])
|
||||||
@@ -17,8 +18,7 @@ watch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const nextStep = () => {
|
const nextStep = () => {
|
||||||
const hasAddons = (props.event.addons?.length ?? 0) > 0
|
emit('next', nextVisibleFrom(props.event, STEP_REGISTRATION))
|
||||||
emit('next', hasAddons ? 6 : 7)
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,59 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import {computed} from "vue";
|
||||||
import {format, parseISO} from "date-fns";
|
import {format, parseISO} from "date-fns";
|
||||||
|
|
||||||
|
const PAYMENT_ACCOUNT_TRANSACTION = 'PAYMENT_ACCOUNT_TRANSACTION'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
formData: Object,
|
formData: Object,
|
||||||
event: Object,
|
event: Object,
|
||||||
|
summaryBaseAmount: {type: String, default: ''},
|
||||||
|
summaryAddonLines: {type: Array, default: () => []},
|
||||||
summaryAmount: String,
|
summaryAmount: String,
|
||||||
|
summaryAmountValue: {type: Number, default: 0},
|
||||||
summaryLoading: Boolean,
|
summaryLoading: Boolean,
|
||||||
submitting: Boolean,
|
submitting: Boolean,
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['back', 'submit'])
|
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 (AC #6).
|
||||||
|
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 ?? '')
|
||||||
|
})
|
||||||
|
|
||||||
|
// Zurück führt zur Zahlungsart (10), sofern dieser Schritt gezeigt wurde; bei 0 € direkt zu Allergien (9).
|
||||||
|
const backTarget = computed(() => props.summaryAmountValue > 0 ? 10 : 9)
|
||||||
|
|
||||||
|
// Gewählte Teilnahmeoptionen für die Zusammenfassung (label statt value 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 !== '')
|
||||||
|
)
|
||||||
|
|
||||||
|
const canSubmit = computed(() =>
|
||||||
|
props.formData.summary_information_correct
|
||||||
|
&& props.formData.summary_accept_terms
|
||||||
|
&& props.formData.legal_accepted
|
||||||
|
&& (!requiresPaymentConfirmation.value || props.formData.payment)
|
||||||
|
&& !props.submitting
|
||||||
|
)
|
||||||
|
|
||||||
function formatDate(dateString) {
|
function formatDate(dateString) {
|
||||||
if (!dateString) return ''
|
if (!dateString) return ''
|
||||||
return format(parseISO(dateString), 'dd.MM.yyyy')
|
return format(parseISO(dateString), 'dd.MM.yyyy')
|
||||||
@@ -82,6 +126,11 @@ function eatingHabit() {
|
|||||||
<td>{{ participationGroup() }}</td>
|
<td>{{ participationGroup() }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr v-for="option in selectedParticipationOptions" :key="option.label">
|
||||||
|
<td>{{ option.label }}:</td>
|
||||||
|
<td>{{ option.value }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Foto-Erlaubnis:</td>
|
<td>Foto-Erlaubnis:</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -116,6 +165,22 @@ function eatingHabit() {
|
|||||||
<tr><td>Abreise:</td><td>{{ formatDate(formData.departure) }}</td></tr>
|
<tr><td>Abreise:</td><td>{{ formatDate(formData.departure) }}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<h4 style="margin: 0 0 8px 0;">Kostenübersicht</h4>
|
||||||
|
<table class="form-table cost-table" style="margin-bottom: 20px;">
|
||||||
|
<tr>
|
||||||
|
<td>Teilnahmebeitrag:</td>
|
||||||
|
<td>{{ summaryBaseAmount }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-for="addon in summaryAddonLines" :key="addon.key">
|
||||||
|
<td>{{ addon.title }}:</td>
|
||||||
|
<td>{{ addon.free ? 'Kostenfrei' : addon.amount }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="cost-total">
|
||||||
|
<td><strong>Gesamtbetrag:</strong></td>
|
||||||
|
<td><strong>{{ summaryAmount }}</strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<div style="display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;">
|
<div style="display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;">
|
||||||
<label style="display: flex; gap: 10px; cursor: pointer;">
|
<label style="display: flex; gap: 10px; cursor: pointer;">
|
||||||
<input type="checkbox" v-model="formData.summary_information_correct" />
|
<input type="checkbox" v-model="formData.summary_information_correct" />
|
||||||
@@ -129,18 +194,18 @@ function eatingHabit() {
|
|||||||
<input type="checkbox" v-model="formData.legal_accepted" />
|
<input type="checkbox" v-model="formData.legal_accepted" />
|
||||||
Ich stimme der Datenschutzerklärung zu.
|
Ich stimme der Datenschutzerklärung zu.
|
||||||
</label>
|
</label>
|
||||||
<label style="display: flex; gap: 10px; cursor: pointer;">
|
<label v-if="requiresPaymentConfirmation" style="display: flex; gap: 10px; cursor: pointer;">
|
||||||
<input type="checkbox" v-model="formData.payment" />
|
<input type="checkbox" v-model="formData.payment" />
|
||||||
Ich bestätige, den Betrag von <strong>{{ summaryAmount }}</strong> zu überweisen.
|
{{ paymentConfirmationText }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-row">
|
<div class="btn-row">
|
||||||
<button type="button" class="btn-secondary" @click="emit('back', 8)">← Zurück</button>
|
<button type="button" class="btn-secondary" @click="emit('back', backTarget)">← Zurück</button>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn-primary"
|
class="btn-primary"
|
||||||
:disabled="!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted || !formData.payment || submitting"
|
:disabled="!canSubmit"
|
||||||
style="background: #059669;"
|
style="background: #059669;"
|
||||||
>
|
>
|
||||||
{{ submitting ? 'Wird gesendet…' : 'Jetzt anmelden ✓' }}
|
{{ submitting ? 'Wird gesendet…' : 'Jetzt anmelden ✓' }}
|
||||||
@@ -149,3 +214,10 @@ function eatingHabit() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.cost-table .cost-total td {
|
||||||
|
border-top: 1px solid #d1d5db;
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ const props = defineProps({
|
|||||||
availableEvents: Array,
|
availableEvents: Array,
|
||||||
participantData: Object,
|
participantData: Object,
|
||||||
localGroups: Array,
|
localGroups: Array,
|
||||||
paymentMethod: String,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const showSignup = ref(true)
|
const showSignup = ref(true)
|
||||||
@@ -104,7 +103,6 @@ function close() {
|
|||||||
:event="props.event"
|
:event="props.event"
|
||||||
:participantData="props.participantData ?? {}"
|
:participantData="props.participantData ?? {}"
|
||||||
:localGroups="props.localGroups ?? []"
|
:localGroups="props.localGroups ?? []"
|
||||||
:paymentMethod="props.paymentMethod ?? null"
|
|
||||||
/>
|
/>
|
||||||
<p v-else class="signup-closed-notice">
|
<p v-else class="signup-closed-notice">
|
||||||
Die Anmeldung für diese Veranstaltung ist geschlossen.
|
Die Anmeldung für diese Veranstaltung ist geschlossen.
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enumerations;
|
||||||
|
|
||||||
|
use App\Scopes\CommonModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gründe für eine Umsatzsteuerbefreiung -- DB-gestützt (analog {@see PaymentStatus}), damit Label und
|
||||||
|
* der auf der Rechnung verpflichtende Hinweis nach § 14 Abs. 4 Nr. 8 UStG zentral pflegbar sind.
|
||||||
|
* Gemeinnützigkeit allein befreit nicht; die Befreiung braucht immer einen konkreten Rechtsgrund
|
||||||
|
* (Vereins-Fälle über § 4 Nr. 22a / Nr. 25).
|
||||||
|
*
|
||||||
|
* @property string $slug
|
||||||
|
* @property string $name
|
||||||
|
* @property string $invoice_text
|
||||||
|
* @property bool $requires_note
|
||||||
|
* @property int $sort_order
|
||||||
|
*/
|
||||||
|
class TaxExemptionReason extends CommonModel
|
||||||
|
{
|
||||||
|
public const string USTG_19 = 'ustg_19';
|
||||||
|
public const string USTG_4_24 = 'ustg_4_24';
|
||||||
|
public const string USTG_4_25A = 'ustg_4_25a';
|
||||||
|
public const string USTG_4_22A = 'ustg_4_22a';
|
||||||
|
public const string CUSTOM = 'custom';
|
||||||
|
|
||||||
|
protected $table = 'tax_exemption_reasons';
|
||||||
|
protected $primaryKey = 'slug';
|
||||||
|
public $incrementing = false;
|
||||||
|
protected $keyType = 'string';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'slug',
|
||||||
|
'name',
|
||||||
|
'invoice_text',
|
||||||
|
'requires_note',
|
||||||
|
'sort_order',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'requires_note' => 'boolean',
|
||||||
|
'sort_order' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pflichthinweis für die Rechnung. Bei einem individuellen Grund (requires_note) wird der hinterlegte
|
||||||
|
* Freitext des Tenants verwendet.
|
||||||
|
*/
|
||||||
|
public function invoiceText(?string $customNote = null): string
|
||||||
|
{
|
||||||
|
return $this->requires_note ? trim((string) $customNote) : $this->invoice_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optionen für das Frontend inkl. Vorschau-Text. Bei einem Freitext-Grund ist `text` leer, da der Text
|
||||||
|
* erst aus dem Freitext des Tenants entsteht.
|
||||||
|
*
|
||||||
|
* @return array<int, array{value: string, label: string, text: string}>
|
||||||
|
*/
|
||||||
|
public static function options(): array
|
||||||
|
{
|
||||||
|
return self::orderBy('sort_order')->get()
|
||||||
|
->map(static fn (self $reason): array => [
|
||||||
|
'value' => $reason->slug,
|
||||||
|
'label' => $reason->name,
|
||||||
|
'text' => $reason->requires_note ? '' : $reason->invoice_text,
|
||||||
|
])
|
||||||
|
->all();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enumerations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preismodus bei bestehender Umsatzsteuerpflicht: entweder ist die USt bereits im konfigurierten Beitrag
|
||||||
|
* enthalten (Brutto/„Supermarkt") oder sie wird bei der Preisermittlung aufgeschlagen (Netto). Gespeichert
|
||||||
|
* wird immer der finale Brutto-Beitrag; der Modus beeinflusst nur die Preisermittlung im Anmeldeprozess.
|
||||||
|
*/
|
||||||
|
enum VatPricingMode: string
|
||||||
|
{
|
||||||
|
case Inclusive = 'inclusive';
|
||||||
|
case AddOn = 'add_on';
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Inclusive => 'Inklusive – Beiträge sind Endpreise (USt enthalten)',
|
||||||
|
self::AddOn => 'Aufschlagen – USt wird auf die Beiträge aufgeschlagen',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optionen für das Frontend: [['value' => ..., 'label' => ...], ...].
|
||||||
|
*
|
||||||
|
* @return array<int, array{value: string, label: string}>
|
||||||
|
*/
|
||||||
|
public static function options(): array
|
||||||
|
{
|
||||||
|
return array_map(
|
||||||
|
static fn (self $mode): array => [
|
||||||
|
'value' => $mode->value,
|
||||||
|
'label' => $mode->label(),
|
||||||
|
],
|
||||||
|
self::cases(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,36 +22,93 @@ abstract class AbstractEventPaymentModule implements EventPaymentModule
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------
|
|
||||||
// Aus getOptions() abgeleitete Helfer (zuvor statisch auf PaymentMethod).
|
|
||||||
// -----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Namen aller Pflicht-Optionen dieses Moduls.
|
* Standard-Konfiguration beim Anlegen der Tenant-Instanz. Standard: leer.
|
||||||
*
|
*
|
||||||
* @return array<int, string>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function requiredOptionKeys(): array
|
public function defaultConfiguration(): array
|
||||||
{
|
{
|
||||||
return array_values(array_map(
|
return [];
|
||||||
static fn (array $option) => $option['name'],
|
|
||||||
array_filter($this->getOptions(), static fn (array $option) => $option['required'] ?? false)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduziert eine Konfiguration auf die im Schema definierten Options-Keys.
|
* Payer-seitige Eingaben, die eine Zahlungsart vom Teilnehmer benötigt (z.B. später SEPA-IBAN,
|
||||||
* Unbekannte Keys werden verworfen -- getOptions() ist die Autorität.
|
* PayPal-Mail). Standard: keine. Gleiche Form wie getOptions(): [{name,label,type,required}].
|
||||||
*
|
*
|
||||||
|
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||||
|
*/
|
||||||
|
public function getParticipantOptions(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// Aus dem jeweiligen Schema abgeleitete Helfer (Admin-Config = getOptions(),
|
||||||
|
// Teilnehmer-Eingaben = getParticipantOptions()).
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** @return array<int, string> */
|
||||||
|
public function requiredOptionKeys(): array
|
||||||
|
{
|
||||||
|
return $this->requiredKeys($this->getOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @param array<string, mixed> $config
|
* @param array<string, mixed> $config
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function sanitizeConfiguration(array $config): array
|
public function sanitizeConfiguration(array $config): array
|
||||||
|
{
|
||||||
|
return $this->sanitizeAgainst($this->getOptions(), $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @param array<string, mixed> $config */
|
||||||
|
public function isConfigurationComplete(array $config): bool
|
||||||
|
{
|
||||||
|
return $this->allRequiredFilled($this->getOptions(), $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $input
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function sanitizeParticipantOptions(array $input): array
|
||||||
|
{
|
||||||
|
return $this->sanitizeAgainst($this->getParticipantOptions(), $input);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @param array<string, mixed> $input */
|
||||||
|
public function participantOptionsComplete(array $input): bool
|
||||||
|
{
|
||||||
|
return $this->allRequiredFilled($this->getParticipantOptions(), $input);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<int, array{name: string, required?: bool}> $schema
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
private function requiredKeys(array $schema): array
|
||||||
|
{
|
||||||
|
return array_values(array_map(
|
||||||
|
static fn (array $option) => $option['name'],
|
||||||
|
array_filter($schema, static fn(array $option) => $option['required'] ?? false)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduziert Eingaben auf die im Schema definierten Keys (unbekannte werden verworfen).
|
||||||
|
*
|
||||||
|
* @param array<int, array{name: string}> $schema
|
||||||
|
* @param array<string, mixed> $input
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private function sanitizeAgainst(array $schema, array $input): array
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($this->getOptions() as $option) {
|
foreach ($schema as $option) {
|
||||||
if (array_key_exists($option['name'], $config)) {
|
if (array_key_exists($option['name'], $input)) {
|
||||||
$result[$option['name']] = $config[$option['name']];
|
$result[$option['name']] = $input[$option['name']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,14 +116,15 @@ abstract class AbstractEventPaymentModule implements EventPaymentModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prüft, ob alle Pflicht-Optionen befüllt (non-empty) sind.
|
* Sind alle Pflichtfelder des Schemas befüllt (non-empty)?
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $config
|
* @param array<int, array{name: string, required?: bool}> $schema
|
||||||
|
* @param array<string, mixed> $input
|
||||||
*/
|
*/
|
||||||
public function isConfigurationComplete(array $config): bool
|
private function allRequiredFilled(array $schema, array $input): bool
|
||||||
{
|
{
|
||||||
foreach ($this->requiredOptionKeys() as $key) {
|
foreach ($this->requiredKeys($schema) as $key) {
|
||||||
$value = $config[$key] ?? null;
|
$value = $input[$key] ?? null;
|
||||||
if ($value === null || $value === '' || $value === []) {
|
if ($value === null || $value === '' || $value === []) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,16 +19,37 @@ Rechnung) liegt gekapselt in einem Modul pro Zahlungsart. Aufgelöst wird über
|
|||||||
|
|
||||||
## Kernregeln
|
## Kernregeln
|
||||||
|
|
||||||
- **Options-Schema lebt im Code**, nicht in der DB (`getOptions()` je Modul). In der DB stehen nur die Werte.
|
- **Zwei getrennte Options-Schemata (beide im Code, gleiche Form `['name','label','type','required']`):**
|
||||||
Optionsform: `['name', 'label', 'type', 'required']`. `type` ist i.d.R. `'string'`; `'richtext'` wird im Frontend über
|
- `getOptions()` = **Admin-Config** (was der/die Veranstalter\*in pflegt, z.B. Empfänger-Konto). Werte in der DB
|
||||||
`Views/Components/TextEditor.vue` (TinyMCE, HTML) gerendert und via `v-html`/`{!! !!}` ausgegeben.
|
(`configuration`, s.u.).
|
||||||
|
- `getParticipantOptions()` = **Teilnehmer-Eingaben** beim Anmelden (payer-seitig, z.B. künftig
|
||||||
|
SEPA-IBAN/PayPal-Mail; beide Bestandsmodule: `[]`). Werte in `event_participants.payment_options` (JSON).
|
||||||
|
Abgesichert über
|
||||||
|
`sanitizeParticipantOptions()` / `participantOptionsComplete()` (Guard im `SignUpCommand`).
|
||||||
|
- `type` ist i.d.R. `'string'`; `'richtext'` wird über `Views/Components/TextEditor.vue` (TinyMCE, HTML) gerendert
|
||||||
|
und via `v-html`/`{!! !!}` ausgegeben; `'icon'` rendert die `Views/Components/RichSelectBox.vue` (kuratierte
|
||||||
|
FA-Symbol-Auswahl, Liste in `resources/js/constants/paymentMethodIcons.js`). Teilnehmer-Eingaben rendert die
|
||||||
|
generische `SignUpForm/components/PaymentMethodInputs.vue` schema-getrieben.
|
||||||
|
- Optionaler Schlüssel `'hint'` je Option: erklärender Hilfetext, den die Admin-Render-Stellen unter dem Feld anzeigen
|
||||||
|
(z.B. bei `payment_information`, dass der Text am Anmeldeende + in der Mail erscheint).
|
||||||
|
- `defaultConfiguration()` je Modul liefert die Start-Config beim Anlegen der Tenant-Instanz (`CreateTenantAction`),
|
||||||
|
aktuell das Default-Symbol (`icon`): Überweisung `building-columns`, Sonstiges `coins`.
|
||||||
- **Aktivierungs-Guard:** Eine Tenant-Zahlungsmethode darf nur `active` werden, wenn alle `required`-Optionen befüllt
|
- **Aktivierungs-Guard:** Eine Tenant-Zahlungsmethode darf nur `active` werden, wenn alle `required`-Optionen befüllt
|
||||||
sind (`isConfigurationComplete()`), erzwungen in `UpdateAvailablePaymentMethodAction`.
|
sind (`isConfigurationComplete()`), erzwungen in `UpdateAvailablePaymentMethodAction`.
|
||||||
- **Config-Speicherung (JSON):** pro Tenant auf `available_payment_methods.configuration`, pro Event auf dem Pivot
|
- **Config-Speicherung (JSON):** pro Tenant auf `available_payment_methods.configuration`, pro Event auf dem Pivot
|
||||||
`event_payment_methods.configuration`. Beim Zuweisen an ein Event wird die Tenant-Config als **Snapshot kopiert**
|
`event_payment_methods.configuration`. Beim Zuweisen an ein Event wird die Tenant-Config als **Snapshot kopiert**
|
||||||
(Copy-on-Assign, spätere Tenant-Änderungen wirken NICHT nach). Sync erfolgt differenziell in `UpdateEventCommand`.
|
(Copy-on-Assign, spätere Tenant-Änderungen wirken NICHT nach). Sync erfolgt differenziell in
|
||||||
- **`PaymentMethod` ist nur eine Fassade:** `PaymentMethod::optionsFor/requiredOptionKeys/sanitizeConfiguration/`
|
`SetPaymentMethodsCommand` (Endpoint `/api/v1/event/details/{event}/payment-methods`, ausgelöst aus dem
|
||||||
`isConfigurationComplete/defaults()` delegieren an die Registry. Bestehende Aufrufstellen bleiben so stabil.
|
„Teilnahmegebühren"-Bereich).
|
||||||
|
- **`PaymentMethod` ist nur eine Fassade:** `PaymentMethod::optionsFor/participantOptionsFor/requiredOptionKeys/`
|
||||||
|
`sanitizeConfiguration/isConfigurationComplete/defaults()` delegieren an die Registry. Bestehende Aufrufstellen
|
||||||
|
bleiben stabil.
|
||||||
|
- **Zahlungsauswahl im Anmeldeprozess:** Nach „Allergien" wählt der/die Teilnehmer\*in aus den **aktiven**
|
||||||
|
Event-Methoden (`StepPaymentMethod.vue`); bei Beitrag 0 € wird der Schritt übersprungen. Die Wahl landet in
|
||||||
|
`event_participants.payment_method`, die Eingaben in `payment_options`. Der Überweisungs-Bestätigungstext in der
|
||||||
|
Zusammenfassung ist eine Admin-Config-Option `summary_confirmation_text` (`{amount}`-Platzhalter) und erscheint nur
|
||||||
|
bei
|
||||||
|
`PAYMENT_ACCOUNT_TRANSACTION`.
|
||||||
- **`PaymentStatus`** ist ein DB-gestütztes Enumerations-Model (`app/Enumerations/PaymentStatus.php`, Tabelle
|
- **`PaymentStatus`** ist ein DB-gestütztes Enumerations-Model (`app/Enumerations/PaymentStatus.php`, Tabelle
|
||||||
`payment_status`, geseedet in `ProductionDataSeeder`), analog zu `InvoiceStatus`. Reine Steuersignale (z.B. Redirect)
|
`payment_status`, geseedet in `ProductionDataSeeder`), analog zu `InvoiceStatus`. Reine Steuersignale (z.B. Redirect)
|
||||||
gehören NICHT ins Status-Vokabular, sondern als transiente Felder aufs Response-DTO.
|
gehören NICHT ins Status-Vokabular, sondern als transiente Felder aufs Response-DTO.
|
||||||
@@ -80,7 +101,8 @@ Beispiel GiroCode (nur Überweisung):
|
|||||||
## Neues Zahlungsmodul hinzufügen
|
## Neues Zahlungsmodul hinzufügen
|
||||||
|
|
||||||
1. Klasse unter `Modules/` anlegen, `extends AbstractEventPaymentModule`; `slug()`, `defaultName()`, `getOptions()`
|
1. Klasse unter `Modules/` anlegen, `extends AbstractEventPaymentModule`; `slug()`, `defaultName()`, `getOptions()`
|
||||||
implementieren; `registrationSummary()`/`doPayment()`/`createInvoice()` überschreiben, wo nötig.
|
implementieren; `defaultConfiguration()` (z.B. Default-`icon`) sowie
|
||||||
|
`registrationSummary()`/`doPayment()`/`createInvoice()` überschreiben, wo nötig.
|
||||||
2. Zahlart-spezifische Extras als **eigenes Fähigkeits-Interface** (nicht ins Core-Interface).
|
2. Zahlart-spezifische Extras als **eigenes Fähigkeits-Interface** (nicht ins Core-Interface).
|
||||||
3. In `EventPaymentModuleRegistry::MODULES` eintragen. `PaymentMethod::create(['slug' => …])` wird dann automatisch über
|
3. In `EventPaymentModuleRegistry::MODULES` eintragen. `PaymentMethod::create(['slug' => …])` wird dann automatisch über
|
||||||
`ProductionDataSeeder` (iteriert `EventPaymentModuleRegistry::slugs()`) geseedet.
|
`ProductionDataSeeder` (iteriert `EventPaymentModuleRegistry::slugs()`) geseedet.
|
||||||
@@ -88,8 +110,10 @@ Beispiel GiroCode (nur Überweisung):
|
|||||||
|
|
||||||
## Datenübernahme
|
## Datenübernahme
|
||||||
|
|
||||||
`storage/app/sync_payment_bank_data.php` überführt einmalig Bestands-Bankdaten (Tenant/Event) in die Modul-Config
|
`storage/app/2026_08_05_backfill_payment_method_configuration.sql` überführt einmalig Bestands-IBAN-Daten (Tenant/Event)
|
||||||
(idempotent). Bei Live-Inbetriebnahme einmal ausführen.
|
**und** die Default-Symbole in die Modul-Config (idempotenter JSON-Merge, nichts wird überschrieben). Bei
|
||||||
|
Live-Inbetriebnahme einmal gegen die Produktionsdatenbank ausführen — ersetzt das ältere PHP-Skript
|
||||||
|
`sync_payment_bank_data.php`.
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,26 @@ interface EventPaymentModule
|
|||||||
public function defaultDescription(): ?string;
|
public function defaultDescription(): ?string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options-Schema dieses Moduls (welche Konfigurationsfelder es benötigt).
|
* Standard-Konfiguration beim Anlegen der Tenant-Instanz (z.B. Default-Symbol). Standard: leer.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function defaultConfiguration(): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Admin-Options-Schema dieses Moduls (welche Konfigurationsfelder der/die Veranstalter\*in pflegt).
|
||||||
*
|
*
|
||||||
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||||
*/
|
*/
|
||||||
public function getOptions(): array;
|
public function getOptions(): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teilnehmer-Eingaben, die diese Zahlungsart beim Anmelden abfragt (payer-seitig; Standard: keine).
|
||||||
|
*
|
||||||
|
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||||
|
*/
|
||||||
|
public function getParticipantOptions(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Liefert den zahlungsspezifischen Teil der Anmelde-Zusammenfassung.
|
* Liefert den zahlungsspezifischen Teil der Anmelde-Zusammenfassung.
|
||||||
* (In dieser Iteration nur als Stub vorhanden.)
|
* (In dieser Iteration nur als Stub vorhanden.)
|
||||||
|
|||||||
@@ -27,12 +27,19 @@ class AccountTransferPaymentModule extends AbstractEventPaymentModule implements
|
|||||||
return 'Überweisung auf Veranstaltungskonto';
|
return 'Überweisung auf Veranstaltungskonto';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function defaultConfiguration(): array
|
||||||
|
{
|
||||||
|
return ['icon' => 'building-columns'];
|
||||||
|
}
|
||||||
|
|
||||||
public function getOptions(): array
|
public function getOptions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['name' => 'account_owner', 'label' => 'Kontoinhaber', 'type' => 'string', 'required' => true],
|
['name' => 'account_owner', 'label' => 'Kontoinhaber', 'type' => 'string', 'required' => true],
|
||||||
['name' => 'iban', 'label' => 'IBAN', 'type' => 'string', 'required' => true],
|
['name' => 'iban', 'label' => 'IBAN', 'type' => 'string', 'required' => true],
|
||||||
['name' => 'bic', 'label' => 'BIC', 'type' => 'string', 'required' => false],
|
['name' => 'bic', 'label' => 'BIC', 'type' => 'string', 'required' => false],
|
||||||
|
['name' => 'summary_confirmation_text', 'label' => 'Bestätigung durch Teilnehmende (Zusammenfassung, {amount} als Platzhalter)', 'type' => 'string', 'required' => false],
|
||||||
|
['name' => 'icon', 'label' => 'Symbol', 'type' => 'icon', 'required' => false],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,16 @@ class UndefinedPaymentModule extends AbstractEventPaymentModule
|
|||||||
return 'Sonstiges (Barzahlung, Zahlung vor Ort)';
|
return 'Sonstiges (Barzahlung, Zahlung vor Ort)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function defaultConfiguration(): array
|
||||||
|
{
|
||||||
|
return ['icon' => 'coins'];
|
||||||
|
}
|
||||||
|
|
||||||
public function getOptions(): array
|
public function getOptions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['name' => 'payment_information', 'label' => 'Zahlungsinformationen', 'type' => 'richtext', 'required' => true],
|
['name' => 'payment_information', 'label' => 'Zahlungsinformationen', 'type' => 'richtext', 'required' => true, 'hint' => 'Dieser Text wird der teilnehmenden Person am Ende der Anmeldung und in der Bestätigungs-E-Mail angezeigt.'],
|
||||||
|
['name' => 'icon', 'label' => 'Symbol', 'type' => 'icon', 'required' => false],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail\AdminMails;
|
||||||
|
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Attachment;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
|
||||||
|
class CostUnitInvalidBillingDeadlineMail extends Mailable
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private int|string $costUnitId,
|
||||||
|
private ?string $costUnitName,
|
||||||
|
private ?string $invalidBillingDeadline,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*/
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: sprintf('Ungültiges Abrechnungsende für Kostenstelle #%s', $this->costUnitId),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*/
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'emails.admin.cost_unit_invalid_billing_deadline',
|
||||||
|
with: [
|
||||||
|
'costUnitId' => $this->costUnitId,
|
||||||
|
'costUnitName' => $this->costUnitName,
|
||||||
|
'invalidBillingDeadline' => $this->invalidBillingDeadline,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
-3
@@ -8,14 +8,11 @@ use App\Enumerations\EatingHabit;
|
|||||||
use App\Enumerations\ParticipationFeeType;
|
use App\Enumerations\ParticipationFeeType;
|
||||||
use App\RelationModels\EventParticipationFee;
|
use App\RelationModels\EventParticipationFee;
|
||||||
use App\RelationModels\EventPaymentMethods;
|
use App\RelationModels\EventPaymentMethods;
|
||||||
use App\Resources\EventResource;
|
|
||||||
use App\Scopes\CommonModel;
|
|
||||||
use App\Scopes\InstancedModel;
|
use App\Scopes\InstancedModel;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property string $tenant
|
* @property string $tenant
|
||||||
@@ -85,6 +82,13 @@ class Event extends InstancedModel
|
|||||||
'support_flat',
|
'support_flat',
|
||||||
'alcoholics_age',
|
'alcoholics_age',
|
||||||
'archived',
|
'archived',
|
||||||
|
'tax_liable',
|
||||||
|
'vat_rate',
|
||||||
|
'vat_pricing_mode',
|
||||||
|
'tax_exemption_reason',
|
||||||
|
'tax_exemption_note',
|
||||||
|
'participation_options',
|
||||||
|
'addons',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -109,6 +113,12 @@ class Event extends InstancedModel
|
|||||||
'total_max_amount' => AmountCast::class,
|
'total_max_amount' => AmountCast::class,
|
||||||
|
|
||||||
'sibling_reduction' => 'boolean',
|
'sibling_reduction' => 'boolean',
|
||||||
|
|
||||||
|
'tax_liable' => 'boolean',
|
||||||
|
'vat_rate' => 'integer',
|
||||||
|
|
||||||
|
'participation_options' => 'array',
|
||||||
|
'addons' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function tenant(): BelongsTo
|
public function tenant(): BelongsTo
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
|||||||
use App\EventPaymentModules\EventPaymentModule;
|
use App\EventPaymentModules\EventPaymentModule;
|
||||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
||||||
use App\Scopes\InstancedModel;
|
use App\Scopes\InstancedModel;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
|
||||||
class EventParticipant extends InstancedModel
|
class EventParticipant extends InstancedModel
|
||||||
@@ -69,6 +70,7 @@ class EventParticipant extends InstancedModel
|
|||||||
'amount_paid',
|
'amount_paid',
|
||||||
'payment_purpose',
|
'payment_purpose',
|
||||||
'payment_method',
|
'payment_method',
|
||||||
|
'payment_options',
|
||||||
'efz_status',
|
'efz_status',
|
||||||
'unregistered_at',
|
'unregistered_at',
|
||||||
];
|
];
|
||||||
@@ -88,6 +90,7 @@ class EventParticipant extends InstancedModel
|
|||||||
|
|
||||||
'amount' => AmountCast::class,
|
'amount' => AmountCast::class,
|
||||||
'amount_paid' => AmountCast::class,
|
'amount_paid' => AmountCast::class,
|
||||||
|
'payment_options' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -101,6 +104,18 @@ class EventParticipant extends InstancedModel
|
|||||||
return $this->belongsTo(Event::class);
|
return $this->belongsTo(Event::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gewählte Teilnahmeoptionen (event-spezifische Pflicht-Auswahl) dieser Anmeldung. */
|
||||||
|
public function selectedOptions(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(EventParticipantOption::class, 'event_participant_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gebuchte Zusätze (Event-Addons) dieser Anmeldung. */
|
||||||
|
public function selectedAddons(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(EventParticipantAddon::class, 'event_participant_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Casts\AmountCast;
|
||||||
|
use App\Scopes\InstancedModel;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class EventParticipantAddon extends InstancedModel
|
||||||
|
{
|
||||||
|
protected $table = 'event_participant_addons';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'tenant',
|
||||||
|
'event_id',
|
||||||
|
'event_participant_id',
|
||||||
|
'addon_key',
|
||||||
|
'title',
|
||||||
|
'price',
|
||||||
|
'flat',
|
||||||
|
'days',
|
||||||
|
'amount',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'flat' => 'boolean',
|
||||||
|
'days' => 'integer',
|
||||||
|
'price' => AmountCast::class,
|
||||||
|
'amount' => AmountCast::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
public function event(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Event::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function participant(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(EventParticipant::class, 'event_participant_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Scopes\InstancedModel;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class EventParticipantOption extends InstancedModel
|
||||||
|
{
|
||||||
|
protected $table = 'event_participant_options';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'tenant',
|
||||||
|
'event_id',
|
||||||
|
'event_participant_id',
|
||||||
|
'question_key',
|
||||||
|
'question_label',
|
||||||
|
'value',
|
||||||
|
'value_label',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function event(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Event::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function participant(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(EventParticipant::class, 'event_participant_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,22 +29,26 @@ class PaymentMethod extends CommonModel
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard-Werte (name/description) je Slug -- aus den Zahlungsmodulen aufgebaut.
|
* Standard-Werte (name/description/configuration) je Slug -- aus den Zahlungsmodulen aufgebaut.
|
||||||
*
|
*
|
||||||
* @return array<string, array{name: string, description: ?string}>
|
* @return array<string, array{name: string, description: ?string, configuration: array<string, mixed>}>
|
||||||
*/
|
*/
|
||||||
public static function defaults(): array
|
public static function defaults(): array
|
||||||
{
|
{
|
||||||
$defaults = [];
|
$defaults = [];
|
||||||
foreach (EventPaymentModuleRegistry::all() as $slug => $module) {
|
foreach (EventPaymentModuleRegistry::all() as $slug => $module) {
|
||||||
$defaults[$slug] = ['name' => $module->defaultName(), 'description' => $module->defaultDescription()];
|
$defaults[$slug] = [
|
||||||
|
'name' => $module->defaultName(),
|
||||||
|
'description' => $module->defaultDescription(),
|
||||||
|
'configuration' => $module->defaultConfiguration(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $defaults;
|
return $defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options-Schema für einen Slug.
|
* Admin-Options-Schema für einen Slug.
|
||||||
*
|
*
|
||||||
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||||
*/
|
*/
|
||||||
@@ -53,6 +57,16 @@ class PaymentMethod extends CommonModel
|
|||||||
return EventPaymentModuleRegistry::forSlug($slug)?->getOptions() ?? [];
|
return EventPaymentModuleRegistry::forSlug($slug)?->getOptions() ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teilnehmer-Eingabe-Schema für einen Slug (payer-seitig).
|
||||||
|
*
|
||||||
|
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||||
|
*/
|
||||||
|
public static function participantOptionsFor(string $slug): array
|
||||||
|
{
|
||||||
|
return EventPaymentModuleRegistry::forSlug($slug)?->getParticipantOptions() ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Namen aller Pflicht-Optionen eines Slugs.
|
* Namen aller Pflicht-Optionen eines Slugs.
|
||||||
*
|
*
|
||||||
|
|||||||
+16
-1
@@ -21,6 +21,11 @@ use App\Scopes\CommonModel;
|
|||||||
* @property string $url_participation_rules
|
* @property string $url_participation_rules
|
||||||
* @property boolean $events_allowed
|
* @property boolean $events_allowed
|
||||||
* @property boolean $has_active_instance
|
* @property boolean $has_active_instance
|
||||||
|
* @property boolean $tax_liable
|
||||||
|
* @property int $vat_rate
|
||||||
|
* @property string|null $tax_exemption_reason
|
||||||
|
* @property string|null $tax_exemption_note
|
||||||
|
* @property string $vat_pricing_mode
|
||||||
*/
|
*/
|
||||||
class Tenant extends CommonModel
|
class Tenant extends CommonModel
|
||||||
{
|
{
|
||||||
@@ -46,6 +51,16 @@ class Tenant extends CommonModel
|
|||||||
'impress_text',
|
'impress_text',
|
||||||
'url_participation_rules',
|
'url_participation_rules',
|
||||||
'is_active_local_group',
|
'is_active_local_group',
|
||||||
'has_active_instance'
|
'has_active_instance',
|
||||||
|
'tax_liable',
|
||||||
|
'vat_rate',
|
||||||
|
'tax_exemption_reason',
|
||||||
|
'tax_exemption_note',
|
||||||
|
'vat_pricing_mode',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'tax_liable' => 'boolean',
|
||||||
|
'vat_rate' => 'integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,122 @@ class EventParticipantRepository {
|
|||||||
return $participants;
|
return $participants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gruppiert die (aktiven) Teilnehmenden nach ihren gewählten Teilnahmeoptionen. Je am Event definierter
|
||||||
|
* Frage entsteht eine Sektion mit Gruppen „Frage: Option" (in Definition-Reihenfolge); Teilnehmende ohne
|
||||||
|
* Antwort landen unter „Frage: (keine Angabe)". Ein Teilnehmer erscheint je Frage einmal, kann also über
|
||||||
|
* mehrere Fragen hinweg in mehreren Gruppen auftauchen. `$filter` liefert nur die eine passende Gruppe
|
||||||
|
* (für die E-Mail-Auflösung in ByGroupController).
|
||||||
|
*/
|
||||||
|
public function groupByParticipationOption(Event $event, Request $request, ?string $filter = null): array
|
||||||
|
{
|
||||||
|
$definitions = $event->participation_options ?? [];
|
||||||
|
$allParticipants = $this->getForList($event, $request);
|
||||||
|
$groups = [];
|
||||||
|
|
||||||
|
foreach ($definitions as $question) {
|
||||||
|
$questionKey = $question['key'] ?? null;
|
||||||
|
if ($questionKey === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Überschrift: bevorzugt der Titel, sonst die (längere) Frage bzw. der Key als Fallback.
|
||||||
|
$questionLabel = trim((string)($question['title'] ?? '')) !== ''
|
||||||
|
? $question['title']
|
||||||
|
: ($question['label'] ?? $questionKey);
|
||||||
|
$noAnswerKey = $questionLabel . ': (keine Angabe)';
|
||||||
|
|
||||||
|
// Vordefinierte Optionen in Reihenfolge: value => Gruppen-Key.
|
||||||
|
$definedGroupKeys = [];
|
||||||
|
foreach ($question['options'] ?? [] as $option) {
|
||||||
|
$definedGroupKeys[$option['value']] = $questionLabel . ': ' . ($option['label'] ?? $option['value']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$collected = [];
|
||||||
|
foreach ($allParticipants as $participant) {
|
||||||
|
$answer = null;
|
||||||
|
foreach ($participant['participationOptions'] ?? [] as $selectedOption) {
|
||||||
|
if (($selectedOption['questionKey'] ?? null) === $questionKey) {
|
||||||
|
$answer = $selectedOption;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($answer === null || ($answer['value'] ?? '') === '') {
|
||||||
|
$collected[$noAnswerKey][] = $participant;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bevorzugt die definierte Option; falls sie zwischenzeitlich entfernt wurde, den Snapshot nutzen.
|
||||||
|
$groupKey = $definedGroupKeys[$answer['value']] ?? ($questionLabel . ': ' . ($answer['valueLabel'] ?? $answer['value']));
|
||||||
|
$collected[$groupKey][] = $participant;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ausgabe je Frage: definierte Optionen zuerst (in Reihenfolge), dann Snapshot-Reste, „(keine Angabe)" ans Ende.
|
||||||
|
foreach ($definedGroupKeys as $groupKey) {
|
||||||
|
if (!empty($collected[$groupKey])) {
|
||||||
|
$groups[$groupKey] = $collected[$groupKey];
|
||||||
|
unset($collected[$groupKey]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($collected as $groupKey => $participants) {
|
||||||
|
if ($groupKey === $noAnswerKey) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$groups[$groupKey] = $participants;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($collected[$noAnswerKey])) {
|
||||||
|
$groups[$noAnswerKey] = $collected[$noAnswerKey];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filter !== null) {
|
||||||
|
return array_key_exists($filter, $groups) ? [$filter => $groups[$filter]] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gruppiert die (aktiven) Teilnehmenden nach ihren gebuchten Zusätzen (Event-Addons). Da Addons Ja/Nein
|
||||||
|
* sind, entsteht eine Gruppe je Zusatz (Überschrift = Addon-Titel) mit den Teilnehmenden, die ihn gebucht
|
||||||
|
* haben; ein Teilnehmer kann in mehreren Gruppen auftauchen. Nur nicht-leere Gruppen. Die Reihenfolge folgt
|
||||||
|
* der Event-Definition; nachträglich entfernte Addons werden über den Snapshot-Titel weiterhin abgedeckt.
|
||||||
|
*/
|
||||||
|
public function groupByAddon(Event $event, Request $request, ?string $filter = null): array
|
||||||
|
{
|
||||||
|
$allParticipants = $this->getForList($event, $request);
|
||||||
|
|
||||||
|
// Gruppen-Reihenfolge aus der Event-Definition vorbelegen (leere Gruppen werden am Ende verworfen).
|
||||||
|
$groups = [];
|
||||||
|
foreach ($event->addons ?? [] as $addon) {
|
||||||
|
$title = $addon['title'] ?? ($addon['key'] ?? null);
|
||||||
|
if ($title !== null) {
|
||||||
|
$groups[$title] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($allParticipants as $participant) {
|
||||||
|
foreach ($participant['selectedAddons'] ?? [] as $selectedAddon) {
|
||||||
|
$title = $selectedAddon['title'] ?? ($selectedAddon['addonKey'] ?? null);
|
||||||
|
if ($title === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$groups[$title][] = $participant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$groups = array_filter($groups, fn($group) => count($group) > 0);
|
||||||
|
|
||||||
|
if ($filter !== null) {
|
||||||
|
return array_key_exists($filter, $groups) ? [$filter => $groups[$filter]] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $groups;
|
||||||
|
}
|
||||||
|
|
||||||
public function getSignedOffParticipants(Event $event, Request $request, ?string $filter = null) : array {
|
public function getSignedOffParticipants(Event $event, Request $request, ?string $filter = null) : array {
|
||||||
$allParticipants = $this->getForList($event, $request, true);
|
$allParticipants = $this->getForList($event, $request, true);
|
||||||
$participants = [];
|
$participants = [];
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class AvailablePaymentMethodResource extends JsonResource {
|
|||||||
private AvailablePaymentMethod $availablePaymentMethod;
|
private AvailablePaymentMethod $availablePaymentMethod;
|
||||||
|
|
||||||
public function __construct(AvailablePaymentMethod $availablePaymentMethod) {
|
public function __construct(AvailablePaymentMethod $availablePaymentMethod) {
|
||||||
|
parent::__construct($availablePaymentMethod);
|
||||||
$this->availablePaymentMethod = $availablePaymentMethod;
|
$this->availablePaymentMethod = $availablePaymentMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ class AvailablePaymentMethodResource extends JsonResource {
|
|||||||
'active' => $this->availablePaymentMethod->active,
|
'active' => $this->availablePaymentMethod->active,
|
||||||
'configuration' => (object) $configuration,
|
'configuration' => (object) $configuration,
|
||||||
'optionsSchema' => PaymentMethod::optionsFor($this->availablePaymentMethod->slug),
|
'optionsSchema' => PaymentMethod::optionsFor($this->availablePaymentMethod->slug),
|
||||||
|
'participantOptionsSchema' => PaymentMethod::participantOptionsFor($this->availablePaymentMethod->slug),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Resources;
|
||||||
|
|
||||||
|
use App\Models\EventParticipantAddon;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class EventParticipantAddonResource extends JsonResource
|
||||||
|
{
|
||||||
|
function __construct(EventParticipantAddon $addon)
|
||||||
|
{
|
||||||
|
parent::__construct($addon);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toArray($request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'addonKey' => $this->resource->addon_key,
|
||||||
|
'title' => $this->resource->title,
|
||||||
|
'flat' => $this->resource->flat,
|
||||||
|
'amount' => $this->resource->amount?->getAmount() ?? 0,
|
||||||
|
'amountReadable' => $this->resource->amount?->toString() ?? '0,00 Euro',
|
||||||
|
'free' => ($this->resource->amount?->getAmount() ?? 0) <= 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Resources;
|
||||||
|
|
||||||
|
use App\Models\EventParticipantOption;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class EventParticipantOptionResource extends JsonResource
|
||||||
|
{
|
||||||
|
function __construct(EventParticipantOption $option)
|
||||||
|
{
|
||||||
|
parent::__construct($option);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toArray($request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'questionKey' => $this->resource->question_key,
|
||||||
|
'questionLabel' => $this->resource->question_label,
|
||||||
|
'value' => $this->resource->value,
|
||||||
|
'valueLabel' => $this->resource->value_label,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -96,6 +96,10 @@ class EventParticipantResource extends JsonResource
|
|||||||
'eventName' => $this->resource->event()->first()->name,
|
'eventName' => $this->resource->event()->first()->name,
|
||||||
'arrivalDateReadable' => $this->resource->arrival_date->format('d.m.Y'),
|
'arrivalDateReadable' => $this->resource->arrival_date->format('d.m.Y'),
|
||||||
'departureDateReadable' => $this->resource->departure_date->format('d.m.Y'),
|
'departureDateReadable' => $this->resource->departure_date->format('d.m.Y'),
|
||||||
|
'participationOptions' => $this->resource->selectedOptions()->get()->map(
|
||||||
|
fn($option) => new EventParticipantOptionResource($option)->toArray($request))->toArray(),
|
||||||
|
'selectedAddons' => $this->resource->selectedAddons()->get()->map(
|
||||||
|
fn($addon) => new EventParticipantAddonResource($addon)->toArray($request))->toArray(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Resources;
|
|||||||
|
|
||||||
use App\Enumerations\ParticipationFeeType;
|
use App\Enumerations\ParticipationFeeType;
|
||||||
use App\Enumerations\ParticipationType;
|
use App\Enumerations\ParticipationType;
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\ValueObjects\Amount;
|
use App\ValueObjects\Amount;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
@@ -135,7 +136,24 @@ class EventResource extends JsonResource{
|
|||||||
fn($eatingHabit) => new EatingHabitResource($eatingHabit))->toArray();
|
fn($eatingHabit) => new EatingHabitResource($eatingHabit))->toArray();
|
||||||
|
|
||||||
$returnArray['paymentMethods'] = $this->event->paymentMethods()->get()->map(
|
$returnArray['paymentMethods'] = $this->event->paymentMethods()->get()->map(
|
||||||
fn($paymentMethod) => new AvailablePaymentMethodResource($paymentMethod))->toArray();
|
fn($paymentMethod) => new AvailablePaymentMethodResource($paymentMethod)->toArray($request))->toArray();
|
||||||
|
|
||||||
|
// Veranstaltungsspezifische Pflicht-Auswahlfragen (Teilnahmeoptionen); leeres Array => Schritt entfällt.
|
||||||
|
$returnArray['participationOptions'] = $this->event->participation_options ?? [];
|
||||||
|
|
||||||
|
// Buchbare Zusätze (Event-Addons); leeres Array => Schritt entfällt. Preis 0 => "Kostenfrei".
|
||||||
|
$returnArray['addons'] = collect($this->event->addons ?? [])->map(function ($addon) {
|
||||||
|
$price = (float)($addon['price'] ?? 0);
|
||||||
|
return [
|
||||||
|
'key' => $addon['key'] ?? '',
|
||||||
|
'title' => $addon['title'] ?? '',
|
||||||
|
'description' => $addon['description'] ?? '',
|
||||||
|
'price' => $price,
|
||||||
|
'priceReadable' => new Amount($price, 'Euro')->toString(),
|
||||||
|
'free' => $price <= 0,
|
||||||
|
'flat' => (bool)($addon['flat'] ?? false),
|
||||||
|
];
|
||||||
|
})->toArray();
|
||||||
|
|
||||||
|
|
||||||
$returnArray['participationTypes'] = [];
|
$returnArray['participationTypes'] = [];
|
||||||
@@ -342,7 +360,61 @@ class EventResource extends JsonResource{
|
|||||||
$basicFee = $basicFee->multiply(0.5);
|
$basicFee = $basicFee->multiply(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $basicFee;
|
// Bei bestehender USt-Pflicht und Netto-Preismodus die USt aufschlagen; gespeichert wird immer der
|
||||||
|
// finale Brutto-Betrag. Bei "inklusive" oder ohne Steuerpflicht bleibt der Beitrag unverändert.
|
||||||
|
if ($this->event->tax_liable && $this->event->vat_pricing_mode === VatPricingMode::AddOn->value) {
|
||||||
|
$basicFee = $basicFee->multiply(1 + $this->event->vat_rate / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Amount(round($basicFee->getAmount(), 2), 'Euro');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löst die gewählten Zusätze (Event-Addons) gegen die Event-Definition auf und berechnet je Position den
|
||||||
|
* Betrag: Pauschale => Preis, sonst Preis × Teilnahmetage. Bei USt-Pflicht + Netto-Preismodus (`add_on`)
|
||||||
|
* wird die USt aufgeschlagen (analog Beitrag); bei „inclusive"/keiner Pflicht bleibt der Preis unverändert.
|
||||||
|
* Kein Early-Bird-Aufschlag.
|
||||||
|
*
|
||||||
|
* @param array<int, string> $selectedKeys
|
||||||
|
* @return array{items: array<int, array{key: string, title: string, price: float, flat: bool, days: int, amount: float}>, total: Amount}
|
||||||
|
*/
|
||||||
|
public function resolveAddons(array $selectedKeys, DateTime $arrival, DateTime $departure): array
|
||||||
|
{
|
||||||
|
$days = $arrival->diff($departure)->days + 1;
|
||||||
|
$addsVat = $this->event->tax_liable && $this->event->vat_pricing_mode === VatPricingMode::AddOn->value;
|
||||||
|
|
||||||
|
$items = [];
|
||||||
|
$total = new Amount(0, 'Euro');
|
||||||
|
|
||||||
|
foreach ($this->event->addons ?? [] as $addon) {
|
||||||
|
$key = $addon['key'] ?? null;
|
||||||
|
if ($key === null || !in_array($key, $selectedKeys, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$price = (float)($addon['price'] ?? 0);
|
||||||
|
$flat = (bool)($addon['flat'] ?? false);
|
||||||
|
$usedDays = $flat ? 1 : $days;
|
||||||
|
|
||||||
|
$amount = $flat ? $price : $price * $days;
|
||||||
|
if ($addsVat) {
|
||||||
|
$amount *= 1 + $this->event->vat_rate / 100;
|
||||||
|
}
|
||||||
|
$amount = round($amount, 2);
|
||||||
|
|
||||||
|
$items[] = [
|
||||||
|
'key' => $key,
|
||||||
|
'title' => $addon['title'] ?? $key,
|
||||||
|
'price' => $price,
|
||||||
|
'flat' => $flat,
|
||||||
|
'days' => $usedDays,
|
||||||
|
'amount' => $amount,
|
||||||
|
];
|
||||||
|
|
||||||
|
$total->addAmount(new Amount($amount, 'Euro'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['items' => $items, 'total' => $total];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ use App\Domains\CostUnit\Actions\ChangeCostUnitDetails\ChangeCostUnitDetailsComm
|
|||||||
use App\Domains\CostUnit\Actions\ChangeCostUnitDetails\ChangeCostUnitDetailsRequest;
|
use App\Domains\CostUnit\Actions\ChangeCostUnitDetails\ChangeCostUnitDetailsRequest;
|
||||||
use App\Domains\CostUnit\Actions\ChangeCostUnitState\ChangeCostUnitStateCommand;
|
use App\Domains\CostUnit\Actions\ChangeCostUnitState\ChangeCostUnitStateCommand;
|
||||||
use App\Domains\CostUnit\Actions\ChangeCostUnitState\ChangeCostUnitStateRequest;
|
use App\Domains\CostUnit\Actions\ChangeCostUnitState\ChangeCostUnitStateRequest;
|
||||||
|
use App\Mail\AdminMails\CostUnitInvalidBillingDeadlineMail;
|
||||||
use App\Models\CostUnit;
|
use App\Models\CostUnit;
|
||||||
use App\Repositories\CostUnitRepository;
|
use App\Repositories\CostUnitRepository;
|
||||||
use App\ValueObjects\Amount;
|
use App\ValueObjects\Amount;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
class CloseCostUnit implements CronTask {
|
class CloseCostUnit implements CronTask {
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
@@ -33,6 +35,27 @@ class CloseCostUnit implements CronTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$billingEndTime = \DateTime::createFromFormat('Y-m-d H:i:s', $billingEnd);
|
$billingEndTime = \DateTime::createFromFormat('Y-m-d H:i:s', $billingEnd);
|
||||||
|
if (false === $billingEndTime) {
|
||||||
|
$billingEndTime = \DateTime::createFromFormat('Y-m-d', $billingEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false === $billingEndTime) {
|
||||||
|
$recipients = config('app.admin_mail');
|
||||||
|
if (null === $recipients) {
|
||||||
|
$recipients = CostUnit::where('id', $costUnit['id'])->first()
|
||||||
|
?->treasurers()->pluck('email')->all() ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($recipients)) {
|
||||||
|
Mail::to($recipients)->send(new CostUnitInvalidBillingDeadlineMail(
|
||||||
|
costUnitId: $costUnit['id'],
|
||||||
|
costUnitName: $costUnit['name'] ?? null,
|
||||||
|
invalidBillingDeadline: $billingEnd,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$billingEndTime->setTime(0,0,0);
|
$billingEndTime->setTime(0,0,0);
|
||||||
$billingEndTime->add(new \DateInterval('P1D'));
|
$billingEndTime->add(new \DateInterval('P1D'));
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, onMounted, onUnmounted, nextTick } from 'vue'
|
import {nextTick, onMounted, onUnmounted, ref, watch} from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: Boolean,
|
show: Boolean,
|
||||||
@@ -115,7 +115,7 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-body {
|
.modal-body {
|
||||||
max-height: 600px;
|
max-height: 80vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,193 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, nextTick, onBeforeUnmount, onMounted, ref} from 'vue'
|
||||||
|
import Icon from './Icon.vue'
|
||||||
|
|
||||||
|
// Generisches Custom-Dropdown, das je Option ein Icon + Label anzeigt (ein natives <select> kann
|
||||||
|
// keine SVG-Icons rendern). Die Options-Liste wird per <Teleport> an <body> gehängt und fixed
|
||||||
|
// positioniert, damit sie nicht von einem Eltern-Container mit overflow (z. B. .tab-content in
|
||||||
|
// TabbedPage) abgeschnitten wird. Wiederverwendbar für Icon-/Rich-Selects.
|
||||||
|
const props = defineProps({
|
||||||
|
// Ausgewählter Wert (value einer Option).
|
||||||
|
modelValue: {type: String, default: ''},
|
||||||
|
// [{ value, label, icon? }]
|
||||||
|
options: {type: Array, default: () => []},
|
||||||
|
placeholder: {type: String, default: 'Auswählen…'},
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
const open = ref(false)
|
||||||
|
const root = ref(null)
|
||||||
|
const listRef = ref(null)
|
||||||
|
const pos = ref({top: 0, left: 0, width: 0})
|
||||||
|
|
||||||
|
const selected = computed(() => props.options.find(o => o.value === props.modelValue) ?? null)
|
||||||
|
|
||||||
|
function updatePosition() {
|
||||||
|
if (!root.value) return
|
||||||
|
const rect = root.value.getBoundingClientRect()
|
||||||
|
pos.value = {top: rect.bottom + 4, left: rect.left, width: rect.width}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggle() {
|
||||||
|
open.value = !open.value
|
||||||
|
if (open.value) {
|
||||||
|
await nextTick()
|
||||||
|
updatePosition()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function select(option) {
|
||||||
|
emit('update:modelValue', option.value)
|
||||||
|
open.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function onClickOutside(event) {
|
||||||
|
const inRoot = root.value && root.value.contains(event.target)
|
||||||
|
const inList = listRef.value && listRef.value.contains(event.target)
|
||||||
|
if (!inRoot && !inList) {
|
||||||
|
open.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeydown(event) {
|
||||||
|
if (event.key === 'Escape' || event.key === 'Esc') {
|
||||||
|
open.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onReposition() {
|
||||||
|
if (open.value) updatePosition()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
document.addEventListener('click', onClickOutside)
|
||||||
|
document.addEventListener('keydown', onKeydown)
|
||||||
|
window.addEventListener('resize', onReposition)
|
||||||
|
// capture=true, damit auch Scrollen in inneren Containern die Position aktualisiert
|
||||||
|
window.addEventListener('scroll', onReposition, true)
|
||||||
|
})
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
document.removeEventListener('click', onClickOutside)
|
||||||
|
document.removeEventListener('keydown', onKeydown)
|
||||||
|
window.removeEventListener('resize', onReposition)
|
||||||
|
window.removeEventListener('scroll', onReposition, true)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ref="root" class="rich-select">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="rich-select__trigger"
|
||||||
|
:aria-expanded="open"
|
||||||
|
@click="toggle"
|
||||||
|
>
|
||||||
|
<span class="rich-select__value">
|
||||||
|
<template v-if="selected">
|
||||||
|
<Icon v-if="selected.icon" :key="selected.value" :name="selected.icon"/>
|
||||||
|
<span>{{ selected.label }}</span>
|
||||||
|
</template>
|
||||||
|
<span v-else class="rich-select__placeholder">{{ placeholder }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="rich-select__caret" aria-hidden="true">▾</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<Teleport to="body">
|
||||||
|
<ul
|
||||||
|
v-if="open"
|
||||||
|
ref="listRef"
|
||||||
|
class="rich-select__list"
|
||||||
|
role="listbox"
|
||||||
|
:style="{ top: pos.top + 'px', left: pos.left + 'px', width: pos.width + 'px' }"
|
||||||
|
>
|
||||||
|
<li
|
||||||
|
v-for="option in options"
|
||||||
|
:key="option.value"
|
||||||
|
class="rich-select__option"
|
||||||
|
:class="{ 'rich-select__option--active': option.value === modelValue }"
|
||||||
|
role="option"
|
||||||
|
:aria-selected="option.value === modelValue"
|
||||||
|
@click="select(option)"
|
||||||
|
>
|
||||||
|
<Icon v-if="option.icon" :name="option.icon"/>
|
||||||
|
<span>{{ option.label }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</Teleport>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rich-select {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__trigger {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__trigger:hover {
|
||||||
|
border-color: #2563eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__value {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__placeholder {
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__caret {
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__list {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1000;
|
||||||
|
margin: 0;
|
||||||
|
padding: 4px;
|
||||||
|
list-style: none;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||||
|
max-height: 260px;
|
||||||
|
overflow: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__option:hover {
|
||||||
|
background: #eff6ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-select__option--active {
|
||||||
|
background: #dbeafe;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, shallowRef, onMounted } from "vue"
|
import {onMounted, provide, ref, shallowRef} from "vue"
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
tabs: {
|
tabs: {
|
||||||
@@ -55,6 +55,9 @@ async function selectTab(index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Kind-Komponenten (z. B. Leer-Zustands-Hinweise) können damit gezielt zu einem anderen Tab springen.
|
||||||
|
provide('selectTab', selectTab)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.tabs.length > 0) {
|
if (props.tabs.length > 0) {
|
||||||
selectTab(props.subTabIndex)
|
selectTab(props.subTabIndex)
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ return [
|
|||||||
|
|
||||||
'name' => env('APP_NAME', 'Laravel'),
|
'name' => env('APP_NAME', 'Laravel'),
|
||||||
|
|
||||||
|
'admin_mail' => env('APP_ADMIN_MAIL'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Environment
|
| Application Environment
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('event_participants', function (Blueprint $table) {
|
||||||
|
// Payer-seitige Eingaben der gewählten Zahlungsart (Schema je Modul: getParticipantOptions()).
|
||||||
|
$table->json('payment_options')->nullable()->after('payment_method');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('event_participants', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('payment_options');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('tenants', function (Blueprint $table) {
|
||||||
|
$table->boolean('tax_liable')->default(false);
|
||||||
|
$table->unsignedTinyInteger('vat_rate')->default(0);
|
||||||
|
$table->string('tax_exemption_reason')->nullable();
|
||||||
|
$table->text('tax_exemption_note')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('tenants', function (Blueprint $table) {
|
||||||
|
$table->dropColumn([
|
||||||
|
'tax_liable',
|
||||||
|
'vat_rate',
|
||||||
|
'tax_exemption_reason',
|
||||||
|
'tax_exemption_note',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('tenants', function (Blueprint $table) {
|
||||||
|
$table->string('vat_pricing_mode')->default('inclusive');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('tenants', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('vat_pricing_mode');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Friert die umsatzsteuerliche Grundlage bei Event-Anlage aus den Tenant-Einstellungen ein. Die Werte sind
|
||||||
|
* danach unveränderlich, damit Preisermittlung und spätere Rechnungen von späteren Tenant-Änderungen
|
||||||
|
* unberührt bleiben. Bestandsevents erhalten die Defaults (keine USt).
|
||||||
|
*/
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
$table->boolean('tax_liable')->default(false);
|
||||||
|
$table->unsignedTinyInteger('vat_rate')->default(0);
|
||||||
|
$table->string('vat_pricing_mode')->default('inclusive');
|
||||||
|
$table->string('tax_exemption_reason')->nullable();
|
||||||
|
$table->text('tax_exemption_note')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
$table->dropColumn([
|
||||||
|
'tax_liable',
|
||||||
|
'vat_rate',
|
||||||
|
'vat_pricing_mode',
|
||||||
|
'tax_exemption_reason',
|
||||||
|
'tax_exemption_note',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('tax_exemption_reasons', function (Blueprint $table) {
|
||||||
|
$table->string('slug')->primary();
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('invoice_text')->nullable();
|
||||||
|
$table->boolean('requires_note')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('tax_exemption_reasons');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Befüllt die Referenztabelle mit den Befreiungsgründen (§ 14 Abs. 4 Nr. 8 UStG) und verknüpft danach den
|
||||||
|
* nullbaren Befreiungsgrund von Tenant und Event per Foreign Key. Das Seeding erfolgt hier (nicht im
|
||||||
|
* ProductionDataSeeder), damit die FK-Ziele auch auf bestehenden Datenbanken beim Migrieren existieren.
|
||||||
|
* Ein noch nicht konfigurierter Tenant hat keinen Grund (NULL).
|
||||||
|
*/
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$now = now();
|
||||||
|
DB::table('tax_exemption_reasons')->insertOrIgnore([
|
||||||
|
['slug' => 'small_business', 'name' => 'Kleinunternehmer (§ 19 UStG)', 'invoice_text' => 'Gemäß § 19 UStG wird keine Umsatzsteuer berechnet.', 'requires_note' => false, 'created_at' => $now, 'updated_at' => $now],
|
||||||
|
['slug' => 'education', 'name' => 'Bildungs-/Kursleistung (§ 4 Nr. 22a UStG)', 'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 22 Buchst. a UStG von der Umsatzsteuer befreit.', 'requires_note' => false, 'created_at' => $now, 'updated_at' => $now],
|
||||||
|
['slug' => 'youth_welfare', 'name' => 'Kinder- und Jugendhilfe (§ 4 Nr. 25 UStG)', 'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 25 UStG von der Umsatzsteuer befreit.', 'requires_note' => false, 'created_at' => $now, 'updated_at' => $now],
|
||||||
|
['slug' => 'custom', 'name' => 'Sonstiger Grund (Freitext)', 'invoice_text' => null, 'requires_note' => true, 'created_at' => $now, 'updated_at' => $now],
|
||||||
|
]);
|
||||||
|
|
||||||
|
Schema::table('tenants', function (Blueprint $table) {
|
||||||
|
$table->foreign('tax_exemption_reason')
|
||||||
|
->references('slug')->on('tax_exemption_reasons')
|
||||||
|
->restrictOnDelete()->cascadeOnUpdate();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
$table->foreign('tax_exemption_reason')
|
||||||
|
->references('slug')->on('tax_exemption_reasons')
|
||||||
|
->restrictOnDelete()->cascadeOnUpdate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('tenants', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['tax_exemption_reason']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['tax_exemption_reason']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schärft die Befreiungsgründe: paragraphenbasierte Slugs, präzise Zitate (§ 4 Nr. 25 Buchst. a bzw.
|
||||||
|
* Nr. 22 Buchst. a), neuer Grund § 4 Nr. 24 (Jugendherbergen) und eine feste Anzeige-Reihenfolge.
|
||||||
|
* Slug-Renames kaskadieren über die FKs (ON UPDATE CASCADE) auf tenants/events.
|
||||||
|
*/
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('tax_exemption_reasons', function (Blueprint $table) {
|
||||||
|
$table->unsignedSmallInteger('sort_order')->default(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
// § 19 – nur Slug + Sortierung
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'small_business')->update([
|
||||||
|
'slug' => 'ustg_19',
|
||||||
|
'sort_order' => 10,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// § 4 Nr. 25 Buchst. a – präzises Zitat (Durchführung kultureller/sportlicher Veranstaltungen)
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'youth_welfare')->update([
|
||||||
|
'slug' => 'ustg_4_25a',
|
||||||
|
'name' => 'Jugendhilfe – Veranstaltungen (§ 4 Nr. 25 Buchst. a UStG)',
|
||||||
|
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 25 Buchst. a UStG von der Umsatzsteuer befreit.',
|
||||||
|
'sort_order' => 30,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// § 4 Nr. 22 Buchst. a – korrekt benannt, ans Ende (vor Freitext)
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'education')->update([
|
||||||
|
'slug' => 'ustg_4_22a',
|
||||||
|
'name' => 'Vorträge/Kurse (§ 4 Nr. 22 Buchst. a UStG)',
|
||||||
|
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 22 Buchst. a UStG von der Umsatzsteuer befreit.',
|
||||||
|
'sort_order' => 40,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Freitext ans Ende
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'custom')->update([
|
||||||
|
'sort_order' => 50,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// § 4 Nr. 24 (Jugendherbergen) – neu
|
||||||
|
$now = now();
|
||||||
|
DB::table('tax_exemption_reasons')->insertOrIgnore([
|
||||||
|
[
|
||||||
|
'slug' => 'ustg_4_24',
|
||||||
|
'name' => 'Jugendherbergen (§ 4 Nr. 24 UStG)',
|
||||||
|
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 24 UStG von der Umsatzsteuer befreit.',
|
||||||
|
'requires_note' => false,
|
||||||
|
'sort_order' => 20,
|
||||||
|
'created_at' => $now,
|
||||||
|
'updated_at' => $now,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'ustg_4_24')->delete();
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'ustg_19')->update(['slug' => 'small_business']);
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'ustg_4_25a')->update([
|
||||||
|
'slug' => 'youth_welfare',
|
||||||
|
'name' => 'Kinder- und Jugendhilfe (§ 4 Nr. 25 UStG)',
|
||||||
|
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 25 UStG von der Umsatzsteuer befreit.',
|
||||||
|
]);
|
||||||
|
DB::table('tax_exemption_reasons')->where('slug', 'ustg_4_22a')->update([
|
||||||
|
'slug' => 'education',
|
||||||
|
'name' => 'Bildungs-/Kursleistung (§ 4 Nr. 22a UStG)',
|
||||||
|
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 22 Buchst. a UStG von der Umsatzsteuer befreit.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Schema::table('tax_exemption_reasons', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('sort_order');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Standard-Befreiungsgrund neuer Tenants auf Jugendhilfe (§ 4 Nr. 25 Buchst. a). Der Wert
|
||||||
|
* existiert in tax_exemption_reasons, der FK bleibt gültig. Bestehende Zeilen bleiben unverändert.
|
||||||
|
*/
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
DB::statement("ALTER TABLE tenants ALTER COLUMN tax_exemption_reason SET DEFAULT 'ustg_4_25a'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
DB::statement('ALTER TABLE tenants ALTER COLUMN tax_exemption_reason DROP DEFAULT');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
// Veranstaltungsspezifische Pflicht-Auswahlfragen (Teilnahmeoptionen), je Frage genau eine Option.
|
||||||
|
// Struktur: [ { key, label, options: [ { value, label } ] } ]
|
||||||
|
$table->json('participation_options')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('participation_options');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
// Gewählte Teilnahmeoptionen je Anmeldung -- eine Zeile pro beantworteter Frage.
|
||||||
|
// Frage-/Options-Label werden als Snapshot mitgespeichert, damit spätere Änderungen der
|
||||||
|
// Fragen-Definition am Event bestehende Anmeldungen/Auswertungen nicht verfälschen.
|
||||||
|
Schema::create('event_participant_options', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('tenant');
|
||||||
|
|
||||||
|
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
|
||||||
|
$table->foreignId('event_participant_id')->constrained('event_participants', 'id')->cascadeOnDelete()->cascadeOnUpdate();
|
||||||
|
|
||||||
|
$table->string('question_key');
|
||||||
|
$table->string('question_label');
|
||||||
|
$table->string('value');
|
||||||
|
$table->string('value_label');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('event_participant_options');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
// Buchbare Zusätze (Event-Addons) als Ja/Nein-Optionen mit Preis.
|
||||||
|
// Struktur: [ { key, title, description, price, flat } ]
|
||||||
|
$table->json('addons')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('addons');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
// Gewählte Zusätze je Anmeldung -- eine Zeile pro gebuchtem Addon.
|
||||||
|
// Titel/Preis/Betrag werden als Snapshot mitgespeichert (relevant für die spätere Rechnung).
|
||||||
|
Schema::create('event_participant_addons', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('tenant');
|
||||||
|
|
||||||
|
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
|
||||||
|
$table->foreignId('event_participant_id')->constrained('event_participants', 'id')->cascadeOnDelete()->cascadeOnUpdate();
|
||||||
|
|
||||||
|
$table->string('addon_key');
|
||||||
|
$table->string('title');
|
||||||
|
$table->float('price')->default(0);
|
||||||
|
$table->boolean('flat')->default(false);
|
||||||
|
$table->integer('days')->default(0);
|
||||||
|
$table->float('amount')->default(0);
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('event_participant_addons');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Kuratierte Liste zahlungsrelevanter Font-Awesome-Solid-Icons für die Symbol-Auswahl einer
|
||||||
|
// Zahlungsart. Die Namen sind über app/Views/Components/Icon.vue (free-solid) gedeckt und werden
|
||||||
|
// beim Build gebündelt (kein Netzwerk-Load). value === icon (FA-Solid-Name im kebab-case).
|
||||||
|
export const PAYMENT_METHOD_ICONS = [
|
||||||
|
{value: 'building-columns', label: 'Bank / Überweisung', icon: 'building-columns'},
|
||||||
|
{value: 'money-bill-wave', label: 'Bargeld', icon: 'money-bill-wave'},
|
||||||
|
{value: 'credit-card', label: 'Kreditkarte', icon: 'credit-card'},
|
||||||
|
{value: 'wallet', label: 'Geldbörse', icon: 'wallet'},
|
||||||
|
{value: 'coins', label: 'Münzen', icon: 'coins'},
|
||||||
|
{value: 'euro-sign', label: 'Euro', icon: 'euro-sign'},
|
||||||
|
{value: 'hand-holding-dollar', label: 'Spende', icon: 'hand-holding-dollar'},
|
||||||
|
{value: 'sack-dollar', label: 'Geldsack', icon: 'sack-dollar'},
|
||||||
|
{value: 'money-check-dollar', label: 'Scheck', icon: 'money-check-dollar'},
|
||||||
|
{value: 'receipt', label: 'Beleg', icon: 'receipt'},
|
||||||
|
{value: 'piggy-bank', label: 'Sparschwein', icon: 'piggy-bank'},
|
||||||
|
{value: 'mobile-screen', label: 'Mobil / App', icon: 'mobile-screen'},
|
||||||
|
]
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Für die Kostenstelle "{{ $costUnitName }}" (ID {{ $costUnitId }}) konnte das Abrechnungsende
|
||||||
|
nicht verarbeitet werden.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Der hinterlegte Wert "{{ $invalidBillingDeadline }}" ist weder ein gültiges Datum noch ein
|
||||||
|
Datum mit Uhrzeit. Die automatische Verarbeitung dieser Kostenstelle wurde deshalb übersprungen.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Bitte prüft und korrigiert das Abrechnungsende dieser Kostenstelle.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Domains\Event\Actions\CreateEvent\CreateEventCommand;
|
||||||
|
use App\Domains\Event\Actions\CreateEvent\CreateEventRequest;
|
||||||
|
use App\Enumerations\EatingHabit;
|
||||||
|
use App\Enumerations\ParticipationFeeType;
|
||||||
|
use App\Models\Event;
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\RelationModels\EventParticipationFee;
|
||||||
|
use App\Resources\EventResource;
|
||||||
|
use DateTime;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class EventVatPricingTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
private Tenant $tenant;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->tenant = Tenant::create([
|
||||||
|
'slug' => 'tv',
|
||||||
|
'name' => 'Test',
|
||||||
|
'email' => 't@example.com',
|
||||||
|
'email_finance' => 'finance@example.com',
|
||||||
|
'url' => 'test.local',
|
||||||
|
'account_name' => 'Test e.V.',
|
||||||
|
'account_iban' => 'DE00',
|
||||||
|
'account_bic' => 'XY',
|
||||||
|
'city' => 'Stadt',
|
||||||
|
'postcode' => '00000',
|
||||||
|
'is_active_local_group' => true,
|
||||||
|
'has_active_instance' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
app()->instance('tenant', $this->tenant);
|
||||||
|
|
||||||
|
DB::table('participation_types')->insert(['slug' => 'participant', 'name' => 'Teilnehmer']);
|
||||||
|
DB::table('participation_fee_types')->insert(['slug' => 'fixed', 'name' => 'Fix']);
|
||||||
|
EatingHabit::create(['slug' => EatingHabit::EATING_HABIT_VEGAN, 'name' => 'Vegan']);
|
||||||
|
EatingHabit::create(['slug' => EatingHabit::EATING_HABIT_VEGETARIAN, 'name' => 'Vegetarisch']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function makeFee(float $amountStandard): EventParticipationFee
|
||||||
|
{
|
||||||
|
return EventParticipationFee::create([
|
||||||
|
'tenant' => $this->tenant->slug,
|
||||||
|
'type' => 'participant',
|
||||||
|
'name' => 'Standard',
|
||||||
|
'description' => null,
|
||||||
|
'amount_standard' => $amountStandard,
|
||||||
|
'amount_reduced' => null,
|
||||||
|
'amount_solidarity' => null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function makeEvent(bool $taxLiable, int $vatRate, string $mode, int $feeId): Event
|
||||||
|
{
|
||||||
|
return Event::create([
|
||||||
|
'tenant' => $this->tenant->slug,
|
||||||
|
'name' => 'Event',
|
||||||
|
'identifier' => 'evt-' . uniqid(),
|
||||||
|
'location' => 'Ort',
|
||||||
|
'postal_code' => '00000',
|
||||||
|
'email' => 'e@example.com',
|
||||||
|
'start_date' => '2026-09-01',
|
||||||
|
'end_date' => '2026-09-05',
|
||||||
|
'early_bird_end' => '2026-08-20',
|
||||||
|
'registration_final_end' => '2026-08-25',
|
||||||
|
'early_bird_end_amount_increase' => 0,
|
||||||
|
'account_owner' => 'Owner',
|
||||||
|
'account_iban' => 'DE00',
|
||||||
|
'participation_fee_type' => 'fixed',
|
||||||
|
'participation_fee_1' => $feeId,
|
||||||
|
'pay_per_day' => false,
|
||||||
|
'pay_direct' => false,
|
||||||
|
'tax_liable' => $taxLiable,
|
||||||
|
'vat_rate' => $vatRate,
|
||||||
|
'vat_pricing_mode' => $mode,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function calculate(Event $event): float
|
||||||
|
{
|
||||||
|
return new EventResource($event)->calculateAmount(
|
||||||
|
'participant',
|
||||||
|
'standard',
|
||||||
|
new DateTime('2026-09-01'),
|
||||||
|
new DateTime('2026-09-01'),
|
||||||
|
false,
|
||||||
|
)->getAmount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_add_on_mode_adds_vat_on_top(): void
|
||||||
|
{
|
||||||
|
$event = $this->makeEvent(taxLiable: true, vatRate: 19, mode: 'add_on', feeId: $this->makeFee(100.0)->id);
|
||||||
|
|
||||||
|
$this->assertEqualsWithDelta(119.0, $this->calculate($event), 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_inclusive_mode_keeps_amount(): void
|
||||||
|
{
|
||||||
|
$event = $this->makeEvent(taxLiable: true, vatRate: 19, mode: 'inclusive', feeId: $this->makeFee(100.0)->id);
|
||||||
|
|
||||||
|
$this->assertEqualsWithDelta(100.0, $this->calculate($event), 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_not_liable_ignores_add_on_mode(): void
|
||||||
|
{
|
||||||
|
$event = $this->makeEvent(taxLiable: false, vatRate: 19, mode: 'add_on', feeId: $this->makeFee(100.0)->id);
|
||||||
|
|
||||||
|
$this->assertEqualsWithDelta(100.0, $this->calculate($event), 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_create_event_snapshots_tenant_tax_config(): void
|
||||||
|
{
|
||||||
|
$this->tenant->update([
|
||||||
|
'tax_liable' => true,
|
||||||
|
'vat_rate' => 7,
|
||||||
|
'vat_pricing_mode' => 'add_on',
|
||||||
|
'tax_exemption_reason' => null,
|
||||||
|
'tax_exemption_note' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = new CreateEventCommand(new CreateEventRequest(
|
||||||
|
name: 'Sommerlager',
|
||||||
|
location: 'Ort',
|
||||||
|
postalCode: '00000',
|
||||||
|
email: 'e@example.com',
|
||||||
|
begin: new DateTime('2026-09-01'),
|
||||||
|
end: new DateTime('2026-09-05'),
|
||||||
|
earlyBirdEnd: new DateTime('2026-08-20'),
|
||||||
|
registrationFinalEnd: new DateTime('2026-08-25'),
|
||||||
|
earlyBirdEndAmountIncrease: 0,
|
||||||
|
participationFeeType: ParticipationFeeType::where('slug', 'fixed')->first(),
|
||||||
|
accountOwner: 'Owner',
|
||||||
|
accountIban: 'DE00',
|
||||||
|
payPerDay: false,
|
||||||
|
))->execute();
|
||||||
|
|
||||||
|
$this->assertTrue($response->success);
|
||||||
|
|
||||||
|
$event = $response->event->fresh();
|
||||||
|
$this->assertTrue($event->tax_liable);
|
||||||
|
$this->assertSame(7, $event->vat_rate);
|
||||||
|
$this->assertSame('add_on', $event->vat_pricing_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user