Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6bddf9fa5 | ||
|
|
749d8588da | ||
|
|
4bb64b0053 | ||
|
|
d23e6c3914 | ||
|
|
15690b1da9 | ||
|
|
c1c1a4f143 | ||
|
|
5beb2b1d97 | ||
|
|
efee20c16b | ||
|
|
b01288b5e0 | ||
|
|
6a183d6498 | ||
|
|
9c4c28e566 | ||
|
|
a61344395a | ||
|
|
6e4e6b645c | ||
|
|
085299336e | ||
|
|
81912d2433 | ||
|
|
ea57f9400e | ||
|
|
cd51eb3f97 | ||
|
|
1cc84716a1 | ||
|
|
0ee952212b | ||
|
|
e95de52768 | ||
|
|
9581176a0c | ||
|
|
554166803b | ||
|
|
5031d3bde0 | ||
|
|
09f9767eb7 | ||
|
|
b3bbeb5b0b | ||
|
|
c17facf063 | ||
|
|
6b33c1b4dd | ||
|
|
72e0502bb9 | ||
|
|
3b47979265 | ||
|
|
b15573cda6 | ||
|
|
67c4e69f7b | ||
|
|
7f8417e915 | ||
|
|
f8dba18854 | ||
|
|
daff70b4fe | ||
|
|
7919d04dc3 | ||
|
|
cea00f9679 | ||
|
|
a0d26648ee | ||
|
|
e55cdd1988 | ||
|
|
d1ef092bc3 | ||
|
|
78f4d813f9 | ||
|
|
8d6a4041c1 | ||
|
|
29db141b84 | ||
|
|
ab3d526217 | ||
|
|
6c9281516e | ||
|
|
afc91545a9 | ||
|
|
12d98b4d7e | ||
|
|
6c7fe56579 | ||
|
|
e09987f5a8 | ||
|
|
5c514e9ff5 |
@@ -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
|
||||||
|
|||||||
@@ -23,3 +23,6 @@ Homestead.json
|
|||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
/docker-compose.yaml
|
/docker-compose.yaml
|
||||||
|
|
||||||
|
# HTML-Report von composer test:coverage
|
||||||
|
/storage/coverage
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
Laravel 12 + Inertia/Vue, mandantenfähig (custom `tenant`-Scoping über `app('tenant')`, gesetzt in
|
||||||
|
`app/Middleware/IdentifyTenant.php`). PHP 8.5 — Tests/Artisan laufen im Container:
|
||||||
|
`docker exec mareike-mareike-app-1 php artisan test`.
|
||||||
|
|
||||||
|
## Projektkonventionen (verbindlich)
|
||||||
|
|
||||||
|
Die verbindlichen Konventionen (Actions/Request-Command-Response, Controller, Repositories, Models/Resources, Tenant,
|
||||||
|
Routing, Mails) stehen in `.ai/conventions.md` und werden hier eingebunden — **immer beachten**:
|
||||||
|
|
||||||
|
@.ai/conventions.md
|
||||||
|
|
||||||
|
## Bereichs-Dokumentation
|
||||||
|
|
||||||
|
- [Zahlungsmodule](app/EventPaymentModules/CLAUDE.md) — interface-gesteuerte Zahlungsarten (Optionen, Config,
|
||||||
|
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.
|
||||||
+29010
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Domains\Admin\Actions\CreateTenant;
|
namespace App\Domains\Admin\Actions\CreateTenant;
|
||||||
|
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
|
use App\Models\PaymentMethod;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
|
|
||||||
class CreateTenantAction
|
class CreateTenantAction
|
||||||
@@ -29,6 +31,20 @@ class CreateTenantAction
|
|||||||
'has_active_instance' => true,
|
'has_active_instance' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$paymentMethodDefaults = PaymentMethod::defaults();
|
||||||
|
foreach (PaymentMethod::all() as $paymentMethod) {
|
||||||
|
$defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null, 'configuration' => []];
|
||||||
|
|
||||||
|
AvailablePaymentMethod::create([
|
||||||
|
'tenant' => $tenant->slug,
|
||||||
|
'slug' => $paymentMethod->slug,
|
||||||
|
'name' => $defaults['name'],
|
||||||
|
'description' => $defaults['description'],
|
||||||
|
'active' => true,
|
||||||
|
'configuration' => PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $defaults['configuration'] ?? []),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
$response->message = 'Stamm wurde angelegt.';
|
$response->message = 'Stamm wurde angelegt.';
|
||||||
$response->slug = $tenant->slug;
|
$response->slug = $tenant->slug;
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\RemovePaymentMethodUsage;
|
||||||
|
|
||||||
|
use App\Mail\EventReportMails\PaymentMethodsExhaustedMail;
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
|
class RemovePaymentMethodUsageAction
|
||||||
|
{
|
||||||
|
public function execute(AvailablePaymentMethod $availablePaymentMethod): void
|
||||||
|
{
|
||||||
|
foreach ($availablePaymentMethod->events()->get() as $event) {
|
||||||
|
$event->paymentMethods()->detach($availablePaymentMethod->slug);
|
||||||
|
|
||||||
|
$remainingActive = $event->paymentMethods()->where('active', true)->count();
|
||||||
|
if ($remainingActive === 0 && $event->registration_allowed) {
|
||||||
|
$event->registration_allowed = false;
|
||||||
|
$event->save();
|
||||||
|
|
||||||
|
$recipients = $event->eventManagers;
|
||||||
|
if ($event->costUnit !== null) {
|
||||||
|
$recipients = $recipients->merge($event->costUnit->treasurers);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($recipients->unique('id') as $recipient) {
|
||||||
|
Mail::to($recipient->email)->send(new PaymentMethodsExhaustedMail($event));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
|
||||||
|
|
||||||
|
use App\Domains\Admin\Actions\RemovePaymentMethodUsage\RemovePaymentMethodUsageAction;
|
||||||
|
use App\Models\PaymentMethod;
|
||||||
|
|
||||||
|
class UpdateAvailablePaymentMethodAction
|
||||||
|
{
|
||||||
|
public function __construct(private UpdateAvailablePaymentMethodRequest $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): UpdateAvailablePaymentMethodResponse
|
||||||
|
{
|
||||||
|
$response = new UpdateAvailablePaymentMethodResponse();
|
||||||
|
$paymentMethod = $this->request->availablePaymentMethod;
|
||||||
|
$wasActive = $paymentMethod->active;
|
||||||
|
|
||||||
|
// Nur bekannte Options-Keys übernehmen -- das Options-Schema des Zahlungsmoduls ist die Autorität.
|
||||||
|
$configuration = PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $this->request->configuration);
|
||||||
|
|
||||||
|
// Guard: Aktivierung nur erlaubt, wenn alle Pflicht-Optionen befüllt sind.
|
||||||
|
if ($this->request->active && !PaymentMethod::isConfigurationComplete($paymentMethod->slug, $configuration)) {
|
||||||
|
$response->success = false;
|
||||||
|
$response->message = 'Bitte zuerst alle Pflichtfelder ausfüllen, bevor die Zahlungsmethode aktiviert wird.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paymentMethod->update([
|
||||||
|
'name' => $this->request->name,
|
||||||
|
'description' => $this->request->description,
|
||||||
|
'active' => $this->request->active,
|
||||||
|
'configuration' => $configuration,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($wasActive && !$this->request->active) {
|
||||||
|
(new RemovePaymentMethodUsageAction())->execute($paymentMethod);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
$response->message = 'Zahlungsmethode wurde gespeichert.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
|
||||||
|
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
|
|
||||||
|
class UpdateAvailablePaymentMethodRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $configuration
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
public AvailablePaymentMethod $availablePaymentMethod,
|
||||||
|
public string $name,
|
||||||
|
public ?string $description,
|
||||||
|
public bool $active,
|
||||||
|
public array $configuration = [],
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
|
||||||
|
|
||||||
|
class UpdateAvailablePaymentMethodResponse
|
||||||
|
{
|
||||||
|
public bool $success = false;
|
||||||
|
public string $message = '';
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateDocumentAsset;
|
||||||
|
|
||||||
|
use App\Models\DocumentAsset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt ein Bild für die Dokumentvorlagen an oder ersetzt es.
|
||||||
|
*
|
||||||
|
* Gespeichert wird der base64-Payload in der Datenbank -- so überlebt das Bild ein Release (das als
|
||||||
|
* `git checkout` alles unter `public/` überschreibt) und wandert mit jedem Dump mit.
|
||||||
|
*/
|
||||||
|
class UpdateDocumentAssetAction
|
||||||
|
{
|
||||||
|
/** Über 2 MB wird die Vorlage träge und das PDF unnötig groß. */
|
||||||
|
private const int MAX_BYTES = 2 * 1024 * 1024;
|
||||||
|
|
||||||
|
/** @var array<string, string> */
|
||||||
|
private const array ALLOWED_MIME_TYPES = [
|
||||||
|
'image/png' => 'png',
|
||||||
|
'image/jpeg' => 'jpg',
|
||||||
|
'image/gif' => 'gif',
|
||||||
|
'image/svg+xml' => 'svg',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function __construct(private readonly UpdateDocumentAssetRequest $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): UpdateDocumentAssetResponse
|
||||||
|
{
|
||||||
|
$response = new UpdateDocumentAssetResponse();
|
||||||
|
|
||||||
|
$name = $this->normalizeName($this->request->name);
|
||||||
|
|
||||||
|
if ($name === null) {
|
||||||
|
$response->message = 'Bitte einen Namen aus Kleinbuchstaben, Ziffern, Bindestrich oder Unterstrich angeben.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset = DocumentAsset::where('name', $name)->first();
|
||||||
|
$file = $this->request->file;
|
||||||
|
|
||||||
|
if ($file === null && $asset === null) {
|
||||||
|
$response->message = 'Für ein neues Bild wird eine Datei benötigt.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$attributes = ['name' => $name, 'label' => $this->request->label];
|
||||||
|
|
||||||
|
if ($file !== null) {
|
||||||
|
if (!array_key_exists($file->getMimeType(), self::ALLOWED_MIME_TYPES)) {
|
||||||
|
$response->message = 'Nur PNG, JPEG, GIF oder SVG sind zulässig.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($file->getSize() > self::MAX_BYTES) {
|
||||||
|
$response->message = 'Das Bild darf höchstens 2 MB groß sein.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$attributes['mime'] = $file->getMimeType();
|
||||||
|
$attributes['data'] = base64_encode(file_get_contents($file->getRealPath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
$response->asset = $asset === null
|
||||||
|
? DocumentAsset::create($attributes)
|
||||||
|
: tap($asset)->update($attributes);
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
$response->message = 'Das Bild wurde gespeichert.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Namen sind Slugs, damit `{asset:name}` eindeutig erkennbar bleibt. */
|
||||||
|
private function normalizeName(string $name): ?string
|
||||||
|
{
|
||||||
|
$name = strtolower(trim($name));
|
||||||
|
|
||||||
|
return preg_match('/^[a-z0-9_-]+$/', $name) === 1 ? $name : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateDocumentAsset;
|
||||||
|
|
||||||
|
use Illuminate\Http\UploadedFile;
|
||||||
|
|
||||||
|
class UpdateDocumentAssetRequest
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
/** Slug, unter dem das Bild in der Vorlage als `{asset:name}` referenziert wird. */
|
||||||
|
public readonly string $name,
|
||||||
|
public readonly ?string $label = null,
|
||||||
|
public readonly ?UploadedFile $file = null,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateDocumentAsset;
|
||||||
|
|
||||||
|
use App\Models\DocumentAsset;
|
||||||
|
|
||||||
|
class UpdateDocumentAssetResponse
|
||||||
|
{
|
||||||
|
public bool $success = false;
|
||||||
|
|
||||||
|
public ?string $message = null;
|
||||||
|
|
||||||
|
public ?DocumentAsset $asset = null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateDocumentTemplate;
|
||||||
|
|
||||||
|
use App\Models\DocumentTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert die Blockinhalte einer Dokumentvorlage.
|
||||||
|
*
|
||||||
|
* Es werden nur bereits angelegte, als editierbar markierte Blöcke geschrieben. Neue Blöcke entstehen
|
||||||
|
* nicht über das Formular -- welche Blöcke eine Dokumentart hat, gibt die Vorlage vor (das Layout
|
||||||
|
* verweist mit `{block:...}` auf sie).
|
||||||
|
*/
|
||||||
|
class UpdateDocumentTemplateAction
|
||||||
|
{
|
||||||
|
public function __construct(private readonly UpdateDocumentTemplateRequest $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): UpdateDocumentTemplateResponse
|
||||||
|
{
|
||||||
|
$response = new UpdateDocumentTemplateResponse();
|
||||||
|
|
||||||
|
$existing = DocumentTemplate::forType($this->request->documentType);
|
||||||
|
|
||||||
|
// Erst prüfen, dann schreiben -- sonst bliebe bei einem Fehler ein halb gespeicherter Stand übrig.
|
||||||
|
$rejection = $this->rejectBareAssetInStyle();
|
||||||
|
if ($rejection !== null) {
|
||||||
|
$response->message = $rejection;
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->request->blocks as $block => $content) {
|
||||||
|
$template = $existing->get($block);
|
||||||
|
|
||||||
|
if ($template === null || !$template->editable) {
|
||||||
|
$response->skipped[] = $block;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->update(['content' => (string) $content]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
$response->message = $response->skipped === []
|
||||||
|
? 'Die Vorlage wurde gespeichert.'
|
||||||
|
: 'Die Vorlage wurde gespeichert; nicht editierbare Blöcke blieben unverändert.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ein Bild-Platzhalter, der im CSS nicht in `url(...)` steht, expandiert zu einem Data-URI, das
|
||||||
|
* dompdf nicht auslagern kann -- der Parser läuft dann minutenlang und der FPM-Worker stirbt am
|
||||||
|
* Zeitlimit (502). Solches CSS wird gar nicht erst gespeichert.
|
||||||
|
*
|
||||||
|
* @return string|null Fehlermeldung, oder null wenn nichts zu beanstanden ist.
|
||||||
|
*/
|
||||||
|
private function rejectBareAssetInStyle(): ?string
|
||||||
|
{
|
||||||
|
$style = $this->request->blocks[DocumentTemplate::BLOCK_STYLE] ?? null;
|
||||||
|
|
||||||
|
if ($style === null || preg_match('/(?<![("\'])\{asset:([a-z0-9_-]+)}/i', (string) $style, $match) !== 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf(
|
||||||
|
'Im CSS-Block steht der Bild-Platzhalter {asset:%1$s} direkt im Text. Dort gehört er in url("{asset:%1$s}").',
|
||||||
|
$match[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateDocumentTemplate;
|
||||||
|
|
||||||
|
class UpdateDocumentTemplateRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $blocks Blockinhalte, adressiert über den Block-Slug.
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
public readonly string $documentType,
|
||||||
|
public readonly array $blocks,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateDocumentTemplate;
|
||||||
|
|
||||||
|
class UpdateDocumentTemplateResponse
|
||||||
|
{
|
||||||
|
public bool $success = false;
|
||||||
|
|
||||||
|
public ?string $message = null;
|
||||||
|
|
||||||
|
/** @var array<int, string> Blöcke, die nicht gespeichert wurden (unbekannt oder nicht editierbar). */
|
||||||
|
public array $skipped = [];
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Domains\Admin\Actions\UpdateTenantContact;
|
namespace App\Domains\Admin\Actions\UpdateTenantContact;
|
||||||
|
|
||||||
|
use App\Support\Text;
|
||||||
|
|
||||||
class UpdateTenantContactAction
|
class UpdateTenantContactAction
|
||||||
{
|
{
|
||||||
public function __construct(private UpdateTenantContactRequest $request)
|
public function __construct(private UpdateTenantContactRequest $request)
|
||||||
@@ -15,8 +17,14 @@ class UpdateTenantContactAction
|
|||||||
$this->request->tenant->update([
|
$this->request->tenant->update([
|
||||||
'email' => $this->request->email,
|
'email' => $this->request->email,
|
||||||
'email_finance' => $this->request->emailFinance,
|
'email_finance' => $this->request->emailFinance,
|
||||||
|
'invoice_sender_name' => Text::nullIfBlank($this->request->invoiceSenderName),
|
||||||
|
// Leergelassene optionale Felder als NULL, damit sie im Briefkopf sauber wegfallen.
|
||||||
|
'address_1' => Text::nullIfBlank($this->request->address1),
|
||||||
|
'address_2' => Text::nullIfBlank($this->request->address2),
|
||||||
|
'address_3' => Text::nullIfBlank($this->request->address3),
|
||||||
'postcode' => $this->request->postcode,
|
'postcode' => $this->request->postcode,
|
||||||
'city' => $this->request->city,
|
'city' => $this->request->city,
|
||||||
|
'phone' => Text::nullIfBlank($this->request->phone),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ class UpdateTenantContactRequest
|
|||||||
public string $emailFinance,
|
public string $emailFinance,
|
||||||
public string $postcode,
|
public string $postcode,
|
||||||
public string $city,
|
public string $city,
|
||||||
|
/** Bezeichnung des Rechnungsstellers; leer bedeutet "Name des Mandanten verwenden". */
|
||||||
|
public ?string $invoiceSenderName = null,
|
||||||
|
/** Straße und Hausnummer -- Pflichtangabe auf Rechnungen nach § 14 Abs. 4 UStG. */
|
||||||
|
public ?string $address1 = null,
|
||||||
|
/** Optionale Zusatzzeile, z.B. "c/o ...". */
|
||||||
|
public ?string $address2 = null,
|
||||||
|
public ?string $address3 = null,
|
||||||
|
public ?string $phone = null,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateTenantTax;
|
||||||
|
|
||||||
|
use App\Enumerations\VatPricingMode;
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Support\Text;
|
||||||
|
|
||||||
|
class UpdateTenantTaxAction
|
||||||
|
{
|
||||||
|
public function __construct(private UpdateTenantTaxRequest $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): UpdateTenantTaxResponse
|
||||||
|
{
|
||||||
|
$response = new UpdateTenantTaxResponse();
|
||||||
|
|
||||||
|
// Präfixe sind großgeschrieben; null heißt "nicht mitgeschickt" und damit "unverändert".
|
||||||
|
$prefix = Text::nullIfBlank(strtoupper((string) $this->request->invoicePrefix));
|
||||||
|
|
||||||
|
if ($prefix !== null && $this->prefixTakenByAnotherTenant($prefix)) {
|
||||||
|
$response->message = sprintf('Das Rechnungs-Präfix "%s" wird bereits von einem anderen Mandanten genutzt.', $prefix);
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->taxLiable) {
|
||||||
|
$this->request->tenant->update($this->withInvoiceDetails([
|
||||||
|
'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,
|
||||||
|
], $prefix));
|
||||||
|
|
||||||
|
$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($this->withInvoiceDetails([
|
||||||
|
'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,
|
||||||
|
], $prefix));
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
$response->message = 'Steuerinformationen wurden gespeichert.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function clampVatRate(int $vatRate): int
|
||||||
|
{
|
||||||
|
return max(0, min(100, $vatRate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ergänzt die Rechnungsstellerangaben. Sie gelten unabhängig davon, ob Steuerpflicht besteht -- eine
|
||||||
|
* Steuernummer gehört auch auf eine steuerfreie Rechnung.
|
||||||
|
*
|
||||||
|
* @param array<string, mixed> $attributes
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private function withInvoiceDetails(array $attributes, ?string $prefix): array
|
||||||
|
{
|
||||||
|
$attributes['tax_number'] = Text::nullIfBlank($this->request->taxNumber);
|
||||||
|
$attributes['vat_id'] = Text::nullIfBlank($this->request->vatId);
|
||||||
|
|
||||||
|
// Nicht mitgeschickt heißt "unverändert", nicht "leeren".
|
||||||
|
if ($prefix !== null) {
|
||||||
|
$attributes['invoice_prefix'] = $prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prefixTakenByAnotherTenant(string $prefix): bool
|
||||||
|
{
|
||||||
|
return Tenant::where('invoice_prefix', $prefix)
|
||||||
|
->where('id', '!=', $this->request->tenant->id)
|
||||||
|
->exists();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?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,
|
||||||
|
/** Steuernummer bzw. USt-IdNr. -- Pflichtangabe auf Rechnungen (§ 14 Abs. 4 Nr. 2 UStG). */
|
||||||
|
public ?string $taxNumber = null,
|
||||||
|
public ?string $vatId = null,
|
||||||
|
/**
|
||||||
|
* Erster Block der Rechnungsnummer. `null` heißt "unverändert lassen" -- im Self-Service wird das
|
||||||
|
* Feld gar nicht erst mitgeschickt, damit ein bestehender Nummernkreis nicht bricht.
|
||||||
|
*/
|
||||||
|
public ?string $invoicePrefix = null,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Actions\UpdateTenantTax;
|
||||||
|
|
||||||
|
class UpdateTenantTaxResponse
|
||||||
|
{
|
||||||
|
public bool $success = false;
|
||||||
|
public string $message = '';
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\DocumentAsset;
|
||||||
|
use App\Models\DocumentTemplate;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class DocumentAssetDeleteController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $name): JsonResponse
|
||||||
|
{
|
||||||
|
$asset = DocumentAsset::where('name', $name)->first();
|
||||||
|
|
||||||
|
// Durchweg 200 mit Status im Body -- wie die übrigen Admin-Endpunkte, damit der Grund im Frontend
|
||||||
|
// ankommt (der Ajax-Helfer verwirft den Body bei Fehler-Statuscodes).
|
||||||
|
if ($asset === null) {
|
||||||
|
return response()->json(['status' => 'error', 'message' => 'Das Bild existiert nicht.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ein noch referenziertes Bild zu löschen würde stillschweigend eine Lücke in jede künftige
|
||||||
|
// Rechnung reißen -- der Platzhalter löst dann zu einem Leerstring auf.
|
||||||
|
if ($this->isReferenced($asset->name)) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => sprintf('Das Bild wird noch als {asset:%s} in der Vorlage verwendet.', $asset->name),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset->delete();
|
||||||
|
|
||||||
|
return response()->json(['status' => 'success', 'message' => 'Das Bild wurde gelöscht.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function isReferenced(string $name): bool
|
||||||
|
{
|
||||||
|
return DocumentTemplate::query()
|
||||||
|
->where('content', 'like', '%{asset:' . $name . '}%')
|
||||||
|
->exists();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Domains\Admin\Actions\UpdateDocumentAsset\UpdateDocumentAssetAction;
|
||||||
|
use App\Domains\Admin\Actions\UpdateDocumentAsset\UpdateDocumentAssetRequest;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DocumentAssetUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$action = new UpdateDocumentAssetAction(new UpdateDocumentAssetRequest(
|
||||||
|
name: (string) $request->input('name'),
|
||||||
|
label: $request->input('label'),
|
||||||
|
file: $request->file('file'),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $action->execute();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => $response->success ? 'success' : 'error',
|
||||||
|
'message' => $response->message,
|
||||||
|
'token' => $response->asset !== null ? '{asset:' . $response->asset->name . '}' : null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\DocumentAsset;
|
||||||
|
use App\Models\DocumentTemplate;
|
||||||
|
use App\Models\DocumentTypeCatalog;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DocumentTemplatesGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$documentType = (string) $request->input('type', DocumentTypeCatalog::default());
|
||||||
|
|
||||||
|
if (!DocumentTypeCatalog::has($documentType)) {
|
||||||
|
abort(422, 'Unbekannte Dokumentart.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$blocks = DocumentTemplate::forType($documentType)
|
||||||
|
->values()
|
||||||
|
->map(fn(DocumentTemplate $block): array => [
|
||||||
|
'block' => $block->block,
|
||||||
|
'label' => DocumentTypeCatalog::blockLabel($documentType, $block->block),
|
||||||
|
'content' => (string) $block->content,
|
||||||
|
'editable' => $block->editable,
|
||||||
|
'source' => in_array($block->block, DocumentTypeCatalog::SOURCE_BLOCKS, true),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'documentType' => $documentType,
|
||||||
|
'documentTypes' => DocumentTypeCatalog::options(),
|
||||||
|
'blocks' => $blocks,
|
||||||
|
// Die Bilder gelten für alle Dokumentarten -- sie hängen nicht am Typ.
|
||||||
|
'assets' => DocumentAsset::orderBy('name')->get()->map(fn(DocumentAsset $asset): array => [
|
||||||
|
'name' => $asset->name,
|
||||||
|
'label' => $asset->label,
|
||||||
|
'mime' => $asset->mime,
|
||||||
|
'token' => '{asset:' . $asset->name . '}',
|
||||||
|
'preview' => $asset->toDataUri(),
|
||||||
|
]),
|
||||||
|
'tokenGroups' => DocumentTypeCatalog::tokenGroups($documentType),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Providers\InertiaProvider;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class DocumentTemplatesPageController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(): Response
|
||||||
|
{
|
||||||
|
return new InertiaProvider('Admin/DocumentTemplates', [])->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\DocumentTypeCatalog;
|
||||||
|
use App\Providers\DocumentTemplateRenderProvider;
|
||||||
|
use App\Providers\PdfGenerateAndDownloadProvider;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rendert die Vorlage mit Beispieldaten, ohne sie zu speichern -- damit niemand blind HTML editiert.
|
||||||
|
*/
|
||||||
|
class DocumentTemplatesPreviewController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): Response
|
||||||
|
{
|
||||||
|
$documentType = (string) $request->input('type', DocumentTypeCatalog::default());
|
||||||
|
|
||||||
|
if (!DocumentTypeCatalog::has($documentType)) {
|
||||||
|
abort(422, 'Unbekannte Dokumentart.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = new DocumentTemplateRenderProvider(
|
||||||
|
$documentType,
|
||||||
|
(array) $request->input('blocks', []),
|
||||||
|
)->render(DocumentTypeCatalog::sampleTokens($documentType));
|
||||||
|
|
||||||
|
return response(PdfGenerateAndDownloadProvider::fromHtml($html, 'portrait'), 200, [
|
||||||
|
'Content-Type' => 'application/pdf',
|
||||||
|
'Content-Disposition' => 'inline; filename="vorschau.pdf"',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Domains\Admin\Actions\UpdateDocumentTemplate\UpdateDocumentTemplateAction;
|
||||||
|
use App\Domains\Admin\Actions\UpdateDocumentTemplate\UpdateDocumentTemplateRequest;
|
||||||
|
use App\Models\DocumentTypeCatalog;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DocumentTemplatesUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$documentType = (string) $request->input('type', DocumentTypeCatalog::default());
|
||||||
|
|
||||||
|
// Die Dokumentart bestimmt, welche Zeilen geschrieben werden -- ungeprüft weitergereicht wäre
|
||||||
|
// sie ein Weg, in beliebige Vorlagen zu schreiben.
|
||||||
|
if (!DocumentTypeCatalog::has($documentType)) {
|
||||||
|
abort(422, 'Unbekannte Dokumentart.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$action = new UpdateDocumentTemplateAction(new UpdateDocumentTemplateRequest(
|
||||||
|
documentType: $documentType,
|
||||||
|
blocks: (array) $request->input('blocks', []),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $action->execute();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => $response->success ? 'success' : 'error',
|
||||||
|
'message' => $response->message,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,13 @@ class ManagedTenantContactGetController extends CommonController
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'email' => $tenant->email,
|
'email' => $tenant->email,
|
||||||
'email_finance' => $tenant->email_finance,
|
'email_finance' => $tenant->email_finance,
|
||||||
|
'invoice_sender_name' => $tenant->invoice_sender_name,
|
||||||
|
// Als Platzhalter im Formular: so heisst der Absender, solange nichts eingetragen ist.
|
||||||
|
'name' => $tenant->name,
|
||||||
|
'phone' => $tenant->phone,
|
||||||
|
'address_1' => $tenant->address_1,
|
||||||
|
'address_2' => $tenant->address_2,
|
||||||
|
'address_3' => $tenant->address_3,
|
||||||
'postcode' => $tenant->postcode,
|
'postcode' => $tenant->postcode,
|
||||||
'city' => $tenant->city,
|
'city' => $tenant->city,
|
||||||
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/contact',
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/contact',
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ class ManagedTenantContactUpdateController extends CommonController
|
|||||||
emailFinance: $request->input('email_finance'),
|
emailFinance: $request->input('email_finance'),
|
||||||
postcode: $request->input('postcode'),
|
postcode: $request->input('postcode'),
|
||||||
city: $request->input('city'),
|
city: $request->input('city'),
|
||||||
|
invoiceSenderName: $request->input('invoice_sender_name'),
|
||||||
|
address1: $request->input('address_1'),
|
||||||
|
address2: $request->input('address_2'),
|
||||||
|
address3: $request->input('address_3'),
|
||||||
|
phone: $request->input('phone'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$response = $action->execute();
|
$response = $action->execute();
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?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,
|
||||||
|
'tax_number' => $tenant->tax_number,
|
||||||
|
'vat_id' => $tenant->vat_id,
|
||||||
|
'invoice_prefix' => $tenant->invoice_prefix,
|
||||||
|
// In der Mandanten-Verwaltung ist der Nummernkreis änderbar.
|
||||||
|
'can_edit_invoice_prefix' => true,
|
||||||
|
'exemption_reasons' => TaxExemptionReason::options(),
|
||||||
|
'pricing_modes' => VatPricingMode::options(),
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/tax',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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,
|
||||||
|
taxNumber: $request->input('tax_number'),
|
||||||
|
vatId: $request->input('vat_id'),
|
||||||
|
invoicePrefix: $request->input('invoice_prefix'),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $action->execute();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => $response->success ? 'success' : 'error',
|
||||||
|
'message' => $response->message,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,13 @@ class TenantContactGetController extends CommonController
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'email' => $this->tenant->email,
|
'email' => $this->tenant->email,
|
||||||
'email_finance' => $this->tenant->email_finance,
|
'email_finance' => $this->tenant->email_finance,
|
||||||
|
'invoice_sender_name' => $this->tenant->invoice_sender_name,
|
||||||
|
// Als Platzhalter im Formular: so heisst der Absender, solange nichts eingetragen ist.
|
||||||
|
'name' => $this->tenant->name,
|
||||||
|
'phone' => $this->tenant->phone,
|
||||||
|
'address_1' => $this->tenant->address_1,
|
||||||
|
'address_2' => $this->tenant->address_2,
|
||||||
|
'address_3' => $this->tenant->address_3,
|
||||||
'postcode' => $this->tenant->postcode,
|
'postcode' => $this->tenant->postcode,
|
||||||
'city' => $this->tenant->city,
|
'city' => $this->tenant->city,
|
||||||
'saveEndpoint' => '/api/v1/admin/tenant/contact',
|
'saveEndpoint' => '/api/v1/admin/tenant/contact',
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ class TenantContactUpdateController extends CommonController
|
|||||||
emailFinance: $request->input('email_finance'),
|
emailFinance: $request->input('email_finance'),
|
||||||
postcode: $request->input('postcode'),
|
postcode: $request->input('postcode'),
|
||||||
city: $request->input('city'),
|
city: $request->input('city'),
|
||||||
|
invoiceSenderName: $request->input('invoice_sender_name'),
|
||||||
|
address1: $request->input('address_1'),
|
||||||
|
address2: $request->input('address_2'),
|
||||||
|
address3: $request->input('address_3'),
|
||||||
|
phone: $request->input('phone'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$response = $action->execute();
|
$response = $action->execute();
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
|
use App\Resources\AvailablePaymentMethodResource;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantPaymentMethodsGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'paymentMethods' => AvailablePaymentMethod::all()
|
||||||
|
->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)),
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenant/payment-methods',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Domains\Admin\Actions\UpdateAvailablePaymentMethod\UpdateAvailablePaymentMethodAction;
|
||||||
|
use App\Domains\Admin\Actions\UpdateAvailablePaymentMethod\UpdateAvailablePaymentMethodRequest;
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantPaymentMethodsUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(int $id, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$availablePaymentMethod = AvailablePaymentMethod::findOrFail($id);
|
||||||
|
|
||||||
|
$action = new UpdateAvailablePaymentMethodAction(new UpdateAvailablePaymentMethodRequest(
|
||||||
|
availablePaymentMethod: $availablePaymentMethod,
|
||||||
|
name: $request->input('name'),
|
||||||
|
description: $request->input('description'),
|
||||||
|
active: (bool) $request->input('active'),
|
||||||
|
configuration: (array) $request->input('configuration', []),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $action->execute();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => $response->success ? 'success' : 'error',
|
||||||
|
'message' => $response->message,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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,
|
||||||
|
'tax_number' => $this->tenant->tax_number,
|
||||||
|
'vat_id' => $this->tenant->vat_id,
|
||||||
|
'invoice_prefix' => $this->tenant->invoice_prefix,
|
||||||
|
// Im Self-Service nicht änderbar: das Präfix bestimmt den Nummernkreis.
|
||||||
|
'can_edit_invoice_prefix' => false,
|
||||||
|
'exemption_reasons' => TaxExemptionReason::options(),
|
||||||
|
'pricing_modes' => VatPricingMode::options(),
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenant/tax',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?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,
|
||||||
|
taxNumber: $request->input('tax_number'),
|
||||||
|
vatId: $request->input('vat_id'),
|
||||||
|
// invoice_prefix wird hier bewusst nicht durchgereicht -- der Nummernkreis ist nur in der
|
||||||
|
// Mandanten-Verwaltung änderbar.
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $action->execute();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => $response->success ? 'success' : 'error',
|
||||||
|
'message' => $response->message,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ class UserDetailGetController extends CommonController
|
|||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'user' => $userData,
|
'user' => $userData,
|
||||||
'isOwnUser' => auth()->id() === $user->id,
|
'isOwnUser' => currentUser()?->id === $user->id,
|
||||||
'isLvTenant' => $this->tenant->slug === 'lv',
|
'isLvTenant' => $this->tenant->slug === 'lv',
|
||||||
'userRoles' => UserRole::all()->map(fn($role) => ['slug' => $role->slug, 'name' => $role->name]),
|
'userRoles' => UserRole::all()->map(fn($role) => ['slug' => $role->slug, 'name' => $role->name]),
|
||||||
'localGroups' => $this->adminTenants->getActiveLocalGroups()->map(fn($t) => ['slug' => $t->slug, 'name' => $t->name]),
|
'localGroups' => $this->adminTenants->getActiveLocalGroups()->map(fn($t) => ['slug' => $t->slug, 'name' => $t->name]),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class UserToggleActiveController extends CommonController
|
|||||||
|
|
||||||
$action = new ToggleUserActiveAction(new ToggleUserActiveRequest(
|
$action = new ToggleUserActiveAction(new ToggleUserActiveRequest(
|
||||||
user: $user,
|
user: $user,
|
||||||
currentUserId: auth()->id(),
|
currentUserId: currentUser()?->id,
|
||||||
));
|
));
|
||||||
|
|
||||||
$response = $action->execute();
|
$response = $action->execute();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class UserUpdateController extends CommonController
|
|||||||
$action = new UpdateUserAction(new UpdateUserRequest(
|
$action = new UpdateUserAction(new UpdateUserRequest(
|
||||||
user: $user,
|
user: $user,
|
||||||
data: $request->all(),
|
data: $request->all(),
|
||||||
isOwnUser: auth()->id() === $user->id,
|
isOwnUser: currentUser()?->id === $user->id,
|
||||||
isLvTenant: $this->tenant->slug === 'lv',
|
isLvTenant: $this->tenant->slug === 'lv',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Domains\Admin\Controllers\UserDetailGetController;
|
use App\Domains\Admin\Controllers\DocumentAssetDeleteController;
|
||||||
use App\Domains\Admin\Controllers\UserListApiController;
|
use App\Domains\Admin\Controllers\DocumentAssetUpdateController;
|
||||||
use App\Domains\Admin\Controllers\UserResetPasswordController;
|
use App\Domains\Admin\Controllers\DocumentTemplatesGetController;
|
||||||
use App\Domains\Admin\Controllers\UserToggleActiveController;
|
use App\Domains\Admin\Controllers\DocumentTemplatesPreviewController;
|
||||||
use App\Domains\Admin\Controllers\UserUpdateController;
|
use App\Domains\Admin\Controllers\DocumentTemplatesUpdateController;
|
||||||
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 +13,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,10 +26,20 @@ 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\TenantPaymentMethodsGetController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantPaymentMethodsUpdateController;
|
||||||
use App\Domains\Admin\Controllers\TenantPaymentUpdateController;
|
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;
|
||||||
|
use App\Middleware\MainAdminRoleMiddleware;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
||||||
@@ -36,10 +48,14 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
|||||||
Route::post('/contact', TenantContactUpdateController::class);
|
Route::post('/contact', TenantContactUpdateController::class);
|
||||||
Route::get('/payment', TenantPaymentGetController::class);
|
Route::get('/payment', TenantPaymentGetController::class);
|
||||||
Route::post('/payment', TenantPaymentUpdateController::class);
|
Route::post('/payment', TenantPaymentUpdateController::class);
|
||||||
|
Route::get('/payment-methods', TenantPaymentMethodsGetController::class);
|
||||||
|
Route::post('/payment-methods/{id}', TenantPaymentMethodsUpdateController::class);
|
||||||
Route::get('/impress', TenantImpressGetController::class);
|
Route::get('/impress', TenantImpressGetController::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 () {
|
||||||
@@ -50,6 +66,18 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
|||||||
Route::post('/{id}/reset-password', UserResetPasswordController::class);
|
Route::post('/{id}/reset-password', UserResetPasswordController::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Dokumentvorlagen gelten app-weit für alle Mandanten -- deshalb nur für Hauptadministrator*innen,
|
||||||
|
// AdminRoleMiddleware allein ließe auch Gruppenleitungen durch.
|
||||||
|
Route::middleware(MainAdminRoleMiddleware::class)->group(function () {
|
||||||
|
Route::prefix('api/v1/admin/document-templates')->group(function () {
|
||||||
|
Route::get('/', DocumentTemplatesGetController::class);
|
||||||
|
Route::post('/', DocumentTemplatesUpdateController::class);
|
||||||
|
Route::post('/preview', DocumentTemplatesPreviewController::class);
|
||||||
|
Route::post('/assets', DocumentAssetUpdateController::class);
|
||||||
|
Route::delete('/assets/{name}', DocumentAssetDeleteController::class);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
||||||
Route::prefix('api/v1/admin/tenants')->group(function () {
|
Route::prefix('api/v1/admin/tenants')->group(function () {
|
||||||
Route::get('/list', TenantListApiController::class);
|
Route::get('/list', TenantListApiController::class);
|
||||||
@@ -65,6 +93,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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Domains\Admin\Controllers\AdminDashboardController;
|
use App\Domains\Admin\Controllers\AdminDashboardController;
|
||||||
|
use App\Domains\Admin\Controllers\DocumentTemplatesPageController;
|
||||||
use App\Domains\Admin\Controllers\TenantEditPageController;
|
use App\Domains\Admin\Controllers\TenantEditPageController;
|
||||||
use App\Domains\Admin\Controllers\TenantListPageController;
|
use App\Domains\Admin\Controllers\TenantListPageController;
|
||||||
use App\Domains\Admin\Controllers\TenantPageController;
|
use App\Domains\Admin\Controllers\TenantPageController;
|
||||||
@@ -8,6 +9,7 @@ use App\Domains\Admin\Controllers\UserListPageController;
|
|||||||
use App\Middleware\AdminRoleMiddleware;
|
use App\Middleware\AdminRoleMiddleware;
|
||||||
use App\Middleware\IdentifyTenant;
|
use App\Middleware\IdentifyTenant;
|
||||||
use App\Middleware\LvOnlyMiddleware;
|
use App\Middleware\LvOnlyMiddleware;
|
||||||
|
use App\Middleware\MainAdminRoleMiddleware;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
||||||
@@ -16,6 +18,11 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
|||||||
Route::get('/tenant', TenantPageController::class);
|
Route::get('/tenant', TenantPageController::class);
|
||||||
Route::get('/users', UserListPageController::class);
|
Route::get('/users', UserListPageController::class);
|
||||||
|
|
||||||
|
// App-weit gültige Dokumentvorlagen -- nur für Hauptadministrator*innen.
|
||||||
|
Route::middleware(MainAdminRoleMiddleware::class)->group(function () {
|
||||||
|
Route::get('/document-templates', DocumentTemplatesPageController::class);
|
||||||
|
});
|
||||||
|
|
||||||
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
||||||
Route::get('/tenants', TenantListPageController::class);
|
Route::get('/tenants', TenantListPageController::class);
|
||||||
Route::get('/tenants/{slug}', TenantEditPageController::class);
|
Route::get('/tenants/{slug}', TenantEditPageController::class);
|
||||||
|
|||||||
@@ -0,0 +1,666 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, onMounted, ref} from 'vue'
|
||||||
|
import {toast} from 'vue3-toastify'
|
||||||
|
import AdminAppLayout from '../../../../resources/js/layouts/AdminAppLayout.vue'
|
||||||
|
import ShadowedBox from '../../../Views/Components/ShadowedBox.vue'
|
||||||
|
import TextEditor from '../../../Views/Components/TextEditor.vue'
|
||||||
|
import {useAjax} from '../../../../resources/js/components/ajaxHandler.js'
|
||||||
|
|
||||||
|
const {request} = useAjax()
|
||||||
|
|
||||||
|
const blocks = ref([])
|
||||||
|
const assets = ref([])
|
||||||
|
const tokenGroups = ref({})
|
||||||
|
|
||||||
|
// Die Vorlagen sind nach Dokumentart getrennt; der Umschalter lädt jeweils deren Blöcke neu.
|
||||||
|
const documentType = ref(null)
|
||||||
|
const documentTypes = ref([])
|
||||||
|
|
||||||
|
const activeBlock = ref(null)
|
||||||
|
const saving = ref(false)
|
||||||
|
|
||||||
|
// Die Vorschau ist ein PDF, das aus den aktuellen -- auch ungespeicherten -- Blockinhalten entsteht.
|
||||||
|
const previewUrl = ref(null)
|
||||||
|
const previewLoading = ref(false)
|
||||||
|
|
||||||
|
const newAsset = ref({name: '', label: '', file: null})
|
||||||
|
const assetInput = ref(null)
|
||||||
|
|
||||||
|
const current = computed(() => blocks.value.find(b => b.block === activeBlock.value) ?? null)
|
||||||
|
|
||||||
|
/** Beim Blockwechsel die gemerkte Einfügemarke verwerfen -- sie gehört zum vorigen Text. */
|
||||||
|
function selectBlock(block) {
|
||||||
|
activeBlock.value = block
|
||||||
|
caret.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(load)
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
const query = documentType.value ? '?type=' + encodeURIComponent(documentType.value) : ''
|
||||||
|
const data = await request('/api/v1/admin/document-templates' + query, {method: 'GET'})
|
||||||
|
if (!data) {
|
||||||
|
toast.error('Die Vorlage konnte nicht geladen werden.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
documentType.value = data.documentType
|
||||||
|
documentTypes.value = data.documentTypes ?? []
|
||||||
|
blocks.value = data.blocks ?? []
|
||||||
|
assets.value = data.assets ?? []
|
||||||
|
tokenGroups.value = data.tokenGroups ?? {}
|
||||||
|
activeBlock.value = blocks.value.find(b => b.editable)?.block ?? blocks.value[0]?.block ?? null
|
||||||
|
|
||||||
|
await refreshPreview()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Beim Wechsel der Dokumentart alles neu holen -- Blöcke und Platzhalter sind je Art andere. */
|
||||||
|
async function selectDocumentType(type) {
|
||||||
|
if (type === documentType.value) return
|
||||||
|
|
||||||
|
documentType.value = type
|
||||||
|
caret.value = null
|
||||||
|
await load()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Nur editierbare Blöcke werden gesendet; der generierte Rechnungsinhalt bleibt unverändert. */
|
||||||
|
function editableBlocks() {
|
||||||
|
return Object.fromEntries(
|
||||||
|
blocks.value.filter(b => b.editable).map(b => [b.block, b.content ?? ''])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
saving.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await request('/api/v1/admin/document-templates', {
|
||||||
|
method: 'POST',
|
||||||
|
body: {type: documentType.value, blocks: editableBlocks()},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response?.status === 'success') {
|
||||||
|
toast.success(response.message)
|
||||||
|
} else {
|
||||||
|
toast.error(response?.message ?? 'Fehler beim Speichern')
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
saving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refreshPreview() {
|
||||||
|
previewLoading.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/v1/admin/document-templates/preview', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content ?? '',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({type: documentType.value, blocks: editableBlocks()}),
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
toast.error('Die Vorschau konnte nicht erzeugt werden.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previewUrl.value) {
|
||||||
|
URL.revokeObjectURL(previewUrl.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
previewUrl.value = URL.createObjectURL(await response.blob())
|
||||||
|
} finally {
|
||||||
|
previewLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Platzhalter an der Einfügemarke ergänzen. Im WYSIWYG-Editor übernimmt das TinyMCE selbst, im
|
||||||
|
* Quelltext-Editor wird an der zuletzt bekannten Cursorposition eingesetzt.
|
||||||
|
*/
|
||||||
|
function insertToken(token) {
|
||||||
|
const block = current.value
|
||||||
|
if (!block) return
|
||||||
|
|
||||||
|
const placeholder = wrapForBlock('{' + token + '}', token, block)
|
||||||
|
|
||||||
|
if (block.source) {
|
||||||
|
insertIntoTextarea(placeholder)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const editor = window.tinymce?.activeEditor
|
||||||
|
if (editor) {
|
||||||
|
editor.execCommand('mceInsertContent', false, placeholder)
|
||||||
|
} else {
|
||||||
|
block.content = (block.content ?? '') + placeholder
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ein Bild-Platzhalter allein ist nirgends sinnvoll: er expandiert zum nackten Data-URI, das dann als
|
||||||
|
* Zeichenkette im Dokument steht. Er braucht immer eine Hülle — im CSS url("..."), sonst ein <img>.
|
||||||
|
*
|
||||||
|
* Im CSS ist das zusätzlich eine Frage der Funktionsfähigkeit: ein Data-URI ausserhalb von url()
|
||||||
|
* kann dompdf nicht verarbeiten und läuft ins Zeitlimit.
|
||||||
|
*/
|
||||||
|
function wrapForBlock(placeholder, token, block) {
|
||||||
|
if (!token.startsWith('asset:')) {
|
||||||
|
return placeholder
|
||||||
|
}
|
||||||
|
|
||||||
|
return block.block === 'style'
|
||||||
|
? `url("${placeholder}")`
|
||||||
|
: `<img src="${placeholder}" alt="" />`
|
||||||
|
}
|
||||||
|
|
||||||
|
const sourceArea = ref(null)
|
||||||
|
// Zuletzt bekannte Einfügemarke im Quelltext-Feld. Ohne das würde ein Klick in der weit darunter
|
||||||
|
// liegenden Platzhalter- oder Bilder-Liste an unvorhersehbarer Stelle einfügen.
|
||||||
|
const caret = ref(null)
|
||||||
|
|
||||||
|
function rememberCaret() {
|
||||||
|
const area = sourceArea.value
|
||||||
|
if (!area) return
|
||||||
|
|
||||||
|
caret.value = {start: area.selectionStart, end: area.selectionEnd}
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertIntoTextarea(text) {
|
||||||
|
const block = current.value
|
||||||
|
if (!block) return
|
||||||
|
|
||||||
|
const content = block.content ?? ''
|
||||||
|
const position = caret.value
|
||||||
|
|
||||||
|
if (position === null) {
|
||||||
|
block.content = content + text
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
block.content = content.slice(0, position.start) + text + content.slice(position.end)
|
||||||
|
caret.value = {start: position.start + text.length, end: position.start + text.length}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function uploadAsset() {
|
||||||
|
const form = new FormData()
|
||||||
|
form.append('name', newAsset.value.name)
|
||||||
|
form.append('label', newAsset.value.label ?? '')
|
||||||
|
if (newAsset.value.file) {
|
||||||
|
form.append('file', newAsset.value.file)
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await request('/api/v1/admin/document-templates/assets', {
|
||||||
|
method: 'POST',
|
||||||
|
body: form,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (result?.status === 'success') {
|
||||||
|
toast.success(result.message)
|
||||||
|
newAsset.value = {name: '', label: '', file: null}
|
||||||
|
if (assetInput.value) assetInput.value.value = ''
|
||||||
|
await load()
|
||||||
|
} else {
|
||||||
|
toast.error(result?.message ?? 'Fehler beim Hochladen')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteAsset(name) {
|
||||||
|
if (!confirm(`Das Bild „${name}" wirklich löschen?`)) return
|
||||||
|
|
||||||
|
const result = await request('/api/v1/admin/document-templates/assets/' + name, {method: 'DELETE'})
|
||||||
|
|
||||||
|
if (result?.status === 'success') {
|
||||||
|
toast.success(result.message)
|
||||||
|
await load()
|
||||||
|
} else {
|
||||||
|
// Ein noch in der Vorlage referenziertes Bild lehnt der Server ab.
|
||||||
|
toast.error(result?.message ?? 'Das Bild konnte nicht gelöscht werden.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyToken(token) {
|
||||||
|
navigator.clipboard?.writeText(token)
|
||||||
|
toast.success(`${token} kopiert`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFileChosen(event) {
|
||||||
|
newAsset.value.file = event.target.files?.[0] ?? null
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AdminAppLayout title="Dokumentvorlagen">
|
||||||
|
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px;">
|
||||||
|
<p class="intro">
|
||||||
|
Die Vorlagen gelten für <strong>alle Mandanten</strong>; die eingesetzten Werte kommen je
|
||||||
|
Dokument aus dem jeweiligen Mandanten. Sie liegen in der Datenbank und werden von einem
|
||||||
|
Update nicht überschrieben.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="type-switch">
|
||||||
|
<label for="document-type">Dokumentart</label>
|
||||||
|
<select
|
||||||
|
id="document-type"
|
||||||
|
class="form-input"
|
||||||
|
:value="documentType"
|
||||||
|
@change="selectDocumentType($event.target.value)"
|
||||||
|
>
|
||||||
|
<option v-for="type in documentTypes" :key="type.value" :value="type.value">
|
||||||
|
{{ type.label }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layout">
|
||||||
|
<!-- ── Blöcke und Editor ── -->
|
||||||
|
<div class="editor-column">
|
||||||
|
<div class="block-tabs">
|
||||||
|
<button
|
||||||
|
v-for="block in blocks"
|
||||||
|
:key="block.block"
|
||||||
|
class="block-tab"
|
||||||
|
:class="{active: block.block === activeBlock, readonly: !block.editable}"
|
||||||
|
@click="selectBlock(block.block)"
|
||||||
|
>
|
||||||
|
{{ block.label }}
|
||||||
|
<span v-if="!block.editable" class="badge">generiert</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="current" class="editor-panel">
|
||||||
|
<p v-if="!current.editable" class="notice">
|
||||||
|
Dieser Block wird beim Erzeugen des Dokuments aus den Daten der Anmeldung
|
||||||
|
zusammengesetzt und lässt sich nicht bearbeiten.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p v-else-if="current.source" class="notice">
|
||||||
|
Enthält den Seitenaufbau bzw. die Gestaltung und wird deshalb im Quelltext
|
||||||
|
bearbeitet. Für Adresse, Logo oder Fußnote ist das nicht nötig.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<textarea
|
||||||
|
v-if="current.source || !current.editable"
|
||||||
|
ref="sourceArea"
|
||||||
|
v-model="current.content"
|
||||||
|
class="source-editor"
|
||||||
|
:readonly="!current.editable"
|
||||||
|
spellcheck="false"
|
||||||
|
rows="24"
|
||||||
|
@click="rememberCaret"
|
||||||
|
@keyup="rememberCaret"
|
||||||
|
@blur="rememberCaret"
|
||||||
|
></textarea>
|
||||||
|
|
||||||
|
<!-- convert-urls aus: sonst schreibt TinyMCE {asset:...} in einem src um. -->
|
||||||
|
<TextEditor v-else v-model="current.content" :convert-urls="false" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn-save" :disabled="saving" @click="save">
|
||||||
|
{{ saving ? 'Wird gespeichert…' : 'Speichern' }}
|
||||||
|
</button>
|
||||||
|
<button class="btn-secondary" :disabled="previewLoading" @click="refreshPreview">
|
||||||
|
{{ previewLoading ? 'Wird erzeugt…' : 'Vorschau aktualisieren' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ── Platzhalter ── -->
|
||||||
|
<div class="tokens">
|
||||||
|
<h3>Platzhalter</h3>
|
||||||
|
<p class="tokens-hint">
|
||||||
|
Klicken fügt den Platzhalter an der Einfügemarke ein — in
|
||||||
|
<strong>{{ current?.label ?? '—' }}</strong>. Mit
|
||||||
|
<code>{if:name}…{/if:name}</code> lässt sich ein Abschnitt weglassen, solange
|
||||||
|
der Platzhalter leer ist.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div v-for="(group, key) in tokenGroups" :key="key" class="token-group">
|
||||||
|
<h4>{{ group.label }}</h4>
|
||||||
|
<button
|
||||||
|
v-for="(token, name) in group.tokens"
|
||||||
|
:key="name"
|
||||||
|
class="token"
|
||||||
|
:title="token.description"
|
||||||
|
@click="insertToken(name)"
|
||||||
|
>{{ '{' + name + '}' }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ── Bilder ── -->
|
||||||
|
<div class="assets">
|
||||||
|
<h3>Bilder</h3>
|
||||||
|
<p class="tokens-hint">
|
||||||
|
Liegen in der Datenbank, damit ein Update sie nicht überschreibt. „Einfügen"
|
||||||
|
schreibt in <strong>{{ current?.label ?? '—' }}</strong><template
|
||||||
|
v-if="current?.block === 'style'"> — im CSS als
|
||||||
|
<code>url("…")</code>, anders kann dompdf ein Bild dort nicht verarbeiten</template>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="asset-table">
|
||||||
|
<tr v-for="asset in assets" :key="asset.name">
|
||||||
|
<td class="asset-preview"><img :src="asset.preview" :alt="asset.name" /></td>
|
||||||
|
<td>
|
||||||
|
<strong>{{ asset.name }}</strong>
|
||||||
|
<span v-if="asset.label" class="asset-label">{{ asset.label }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<code class="token-code" @click="copyToken(asset.token)">{{ asset.token }}</code>
|
||||||
|
</td>
|
||||||
|
<td class="asset-actions">
|
||||||
|
<button class="btn-link" @click="insertToken('asset:' + asset.name)">Einfügen</button>
|
||||||
|
<button class="btn-link danger" @click="deleteAsset(asset.name)">Löschen</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="asset-upload">
|
||||||
|
<input v-model="newAsset.name" type="text" placeholder="Name, z. B. logo" class="form-input" />
|
||||||
|
<input v-model="newAsset.label" type="text" placeholder="Beschreibung (optional)" class="form-input" />
|
||||||
|
<input ref="assetInput" type="file" accept="image/*" @change="onFileChosen" />
|
||||||
|
<button class="btn-secondary" :disabled="!newAsset.name" @click="uploadAsset">
|
||||||
|
Hochladen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ── Vorschau ── -->
|
||||||
|
<div class="preview-column">
|
||||||
|
<h3>Vorschau</h3>
|
||||||
|
<p class="tokens-hint">Mit Beispieldaten, ohne zu speichern.</p>
|
||||||
|
<iframe v-if="previewUrl" :src="previewUrl" class="preview-frame"></iframe>
|
||||||
|
<p v-else class="notice">Noch keine Vorschau erzeugt.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</shadowed-box>
|
||||||
|
</AdminAppLayout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.intro {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-left: 3px solid #f5c400;
|
||||||
|
background-color: #fffef5;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-switch {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-switch label {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-switch select {
|
||||||
|
width: auto;
|
||||||
|
min-width: 220px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-column {
|
||||||
|
flex: 1 1 60%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-column {
|
||||||
|
flex: 1 1 40%;
|
||||||
|
min-width: 320px;
|
||||||
|
position: sticky;
|
||||||
|
top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-tabs {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-tab {
|
||||||
|
padding: 6px 12px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-tab.active {
|
||||||
|
background-color: #1d4899;
|
||||||
|
border-color: #1d4899;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-tab.readonly {
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
margin-left: 6px;
|
||||||
|
padding: 1px 5px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color: #e5e7eb;
|
||||||
|
color: #4b5563;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-tab.active .badge {
|
||||||
|
background-color: rgba(255, 255, 255, 0.25);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-panel {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-editor {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: 'DejaVu Sans Mono', Menlo, Consolas, monospace;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
box-sizing: border-box;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-editor[readonly] {
|
||||||
|
background-color: #f9fafb;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save, .btn-secondary {
|
||||||
|
padding: 8px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save {
|
||||||
|
background-color: #16a34a;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save:hover:not(:disabled) {
|
||||||
|
background-color: #15803d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: #e5e7eb;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover:not(:disabled) {
|
||||||
|
background-color: #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save:disabled, .btn-secondary:disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tokens, .assets {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tokens h3, .assets h3, .preview-column h3 {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tokens-hint {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tokens-hint code, .token-code {
|
||||||
|
padding: 1px 4px;
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 0.95em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token-group {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token-group h4 {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token {
|
||||||
|
margin: 0 4px 4px 0;
|
||||||
|
padding: 3px 8px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #f9fafb;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: 'DejaVu Sans Mono', Menlo, Consolas, monospace;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token:hover {
|
||||||
|
background-color: #eef2ff;
|
||||||
|
border-color: #1d4899;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asset-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asset-table td {
|
||||||
|
padding: 6px 8px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asset-preview img {
|
||||||
|
max-width: 60px;
|
||||||
|
max-height: 40px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asset-label {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token-code {
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: 'DejaVu Sans Mono', Menlo, Consolas, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asset-actions {
|
||||||
|
text-align: right;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-link {
|
||||||
|
padding: 2px 6px;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #1d4899;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-link.danger {
|
||||||
|
color: #b91c1c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asset-upload {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-frame {
|
||||||
|
width: 100%;
|
||||||
|
height: 780px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1100px) {
|
||||||
|
.layout {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-column {
|
||||||
|
position: static;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -13,9 +13,17 @@ const props = defineProps({
|
|||||||
const { request } = useAjax()
|
const { request } = useAjax()
|
||||||
|
|
||||||
const editing = ref(false)
|
const editing = ref(false)
|
||||||
|
// Solange kein eigener Absender eingetragen ist, steht auf der Rechnung der Name des Mandanten.
|
||||||
|
const senderFallback = props.data.name ?? ''
|
||||||
|
|
||||||
const form = ref({
|
const form = ref({
|
||||||
|
invoice_sender_name: props.data.invoice_sender_name ?? '',
|
||||||
email: props.data.email ?? '',
|
email: props.data.email ?? '',
|
||||||
email_finance: props.data.email_finance ?? '',
|
email_finance: props.data.email_finance ?? '',
|
||||||
|
phone: props.data.phone ?? '',
|
||||||
|
address_1: props.data.address_1 ?? '',
|
||||||
|
address_2: props.data.address_2 ?? '',
|
||||||
|
address_3: props.data.address_3 ?? '',
|
||||||
postcode: props.data.postcode ?? '',
|
postcode: props.data.postcode ?? '',
|
||||||
city: props.data.city ?? '',
|
city: props.data.city ?? '',
|
||||||
})
|
})
|
||||||
@@ -39,16 +47,49 @@ async function save() {
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="!editing">
|
<div v-if="!editing">
|
||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
|
<tr>
|
||||||
|
<th>Rechnungs-Absender:</th>
|
||||||
|
<td>
|
||||||
|
{{ form.invoice_sender_name || senderFallback }}
|
||||||
|
<span v-if="!form.invoice_sender_name" class="field-hint">
|
||||||
|
Name des Mandanten, da nichts Eigenes hinterlegt ist
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr><th>Email:</th><td>{{ form.email }}</td></tr>
|
<tr><th>Email:</th><td>{{ form.email }}</td></tr>
|
||||||
<tr><th>Email Schatzmeister*in:</th><td>{{ form.email_finance }}</td></tr>
|
<tr><th>Email Schatzmeister*in:</th><td>{{ form.email_finance }}</td></tr>
|
||||||
|
<tr><th>Telefon:</th><td>{{ form.phone || '—' }}</td></tr>
|
||||||
|
<tr><th>Straße & Hausnummer:</th><td>{{ form.address_1 || '—' }}</td></tr>
|
||||||
|
<tr><th>Adresszusatz:</th><td>{{ form.address_2 || '—' }}</td></tr>
|
||||||
|
<tr><th>Weiterer Zusatz:</th><td>{{ form.address_3 || '—' }}</td></tr>
|
||||||
<tr><th>Postleitzahl:</th><td>{{ form.postcode }}</td></tr>
|
<tr><th>Postleitzahl:</th><td>{{ form.postcode }}</td></tr>
|
||||||
<tr><th>Ort:</th><td>{{ form.city }}</td></tr>
|
<tr><th>Ort:</th><td>{{ form.city }}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<p v-if="!form.address_1" class="hint">
|
||||||
|
Ohne Straße & Hausnummer ist die Anschrift auf Rechnungen unvollständig
|
||||||
|
(§ 14 Abs. 4 UStG).
|
||||||
|
</p>
|
||||||
<button class="btn-edit" @click="editing = true">Bearbeiten</button>
|
<button class="btn-edit" @click="editing = true">Bearbeiten</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
|
<tr>
|
||||||
|
<th>Rechnungs-Absender:</th>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="form.invoice_sender_name"
|
||||||
|
class="form-input"
|
||||||
|
:placeholder="senderFallback"
|
||||||
|
/>
|
||||||
|
<span class="field-hint">
|
||||||
|
Vollständige Bezeichnung mit Rechtsform, wie sie auf der Rechnung stehen soll.
|
||||||
|
Leer lassen, um den Namen des Mandanten zu verwenden.
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Email:</th>
|
<th>Email:</th>
|
||||||
<td><input type="email" v-model="form.email" class="form-input" /></td>
|
<td><input type="email" v-model="form.email" class="form-input" /></td>
|
||||||
@@ -57,6 +98,27 @@ async function save() {
|
|||||||
<th>Email Schatzmeister*in:</th>
|
<th>Email Schatzmeister*in:</th>
|
||||||
<td><input type="email" v-model="form.email_finance" class="form-input" /></td>
|
<td><input type="email" v-model="form.email_finance" class="form-input" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Telefon:</th>
|
||||||
|
<td><input type="text" v-model="form.phone" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Straße & Hausnummer:</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" v-model="form.address_1" class="form-input" />
|
||||||
|
<span class="field-hint">Pflichtangabe für Rechnungen (§ 14 Abs. 4 UStG)</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Adresszusatz:</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" v-model="form.address_2" class="form-input" placeholder="z. B. c/o Mustermensch" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Weiterer Zusatz:</th>
|
||||||
|
<td><input type="text" v-model="form.address_3" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Postleitzahl:</th>
|
<th>Postleitzahl:</th>
|
||||||
<td><input type="text" v-model="form.postcode" class="form-input" /></td>
|
<td><input type="text" v-model="form.postcode" class="form-input" /></td>
|
||||||
@@ -101,6 +163,22 @@ async function save() {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field-hint {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-left: 3px solid #f5c400;
|
||||||
|
background-color: #fffef5;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-edit, .btn-save, .btn-cancel {
|
.btn-edit, .btn-save, .btn-cancel {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
padding: 8px 20px;
|
padding: 8px 20px;
|
||||||
|
|||||||
@@ -0,0 +1,264 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, ref} from 'vue';
|
||||||
|
import FullScreenModal from "../../../../Views/Components/FullScreenModal.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 {toast} from "vue3-toastify";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const { request } = useAjax()
|
||||||
|
|
||||||
|
const paymentMethods = ref(props.data.paymentMethods ?? [])
|
||||||
|
const editing = ref(null)
|
||||||
|
const form = ref({ name: '', description: '', active: true, configuration: {} })
|
||||||
|
|
||||||
|
// Sind alle Pflichtfelder des aktuell bearbeiteten Moduls befüllt? Der Server ist die
|
||||||
|
// eigentliche Autorität (Guard), das hier dient nur der Bedienführung.
|
||||||
|
const requiredComplete = computed(() => {
|
||||||
|
if (!editing.value) return true
|
||||||
|
return (editing.value.optionsSchema ?? [])
|
||||||
|
.filter(option => option.required)
|
||||||
|
.every(option => {
|
||||||
|
const value = form.value.configuration[option.name]
|
||||||
|
return value !== undefined && value !== null && value !== ''
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function edit(paymentMethod) {
|
||||||
|
editing.value = paymentMethod
|
||||||
|
const configuration = {}
|
||||||
|
for (const option of paymentMethod.optionsSchema ?? []) {
|
||||||
|
configuration[option.name] = paymentMethod.configuration?.[option.name] ?? ''
|
||||||
|
}
|
||||||
|
form.value = {
|
||||||
|
name: paymentMethod.name,
|
||||||
|
description: paymentMethod.description ?? '',
|
||||||
|
active: paymentMethod.active,
|
||||||
|
configuration,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
editing.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
const response = await request('/api/v1/admin/tenant/payment-methods/' + editing.value.id, {
|
||||||
|
method: 'POST',
|
||||||
|
body: form.value,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response && response.status === 'success') {
|
||||||
|
toast.success(response.message)
|
||||||
|
Object.assign(editing.value, form.value)
|
||||||
|
close()
|
||||||
|
} else {
|
||||||
|
toast.error(response?.message ?? 'Fehler beim Speichern')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<table class="payment-method-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th class="empty"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="paymentMethod in paymentMethods" :key="paymentMethod.id">
|
||||||
|
<td>{{ paymentMethod.name }}</td>
|
||||||
|
<td>
|
||||||
|
<span :class="paymentMethod.active ? 'badge-active' : 'badge-inactive'">
|
||||||
|
{{ paymentMethod.active ? 'Aktiv' : 'Inaktiv' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button class="btn-edit" @click="edit(paymentMethod)">Bearbeiten</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<FullScreenModal :show="editing !== null" @close="close">
|
||||||
|
<template v-if="editing">
|
||||||
|
<h2>Zahlungsmodul bearbeiten</h2>
|
||||||
|
<table class="data-table">
|
||||||
|
<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 v-for="option in editing.optionsSchema ?? []" :key="option.name">
|
||||||
|
<th>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></th>
|
||||||
|
<td>
|
||||||
|
<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"/>
|
||||||
|
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Aktiv</th>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" v-model="form.active" :disabled="!requiredComplete && !form.active" />
|
||||||
|
<span v-if="!requiredComplete" class="hint">Bitte zuerst alle Pflichtfelder (*) ausfüllen, um zu aktivieren.</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn-save" @click="save">Speichern</button>
|
||||||
|
<button class="btn-cancel" @click="close">Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</FullScreenModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.payment-method-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-method-table thead th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 10px 16px;
|
||||||
|
background-color: #f9fafb;
|
||||||
|
color: #374151;
|
||||||
|
font-weight: bold;
|
||||||
|
border-bottom: 2px solid #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-method-table tbody td {
|
||||||
|
padding: 10px 16px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-active {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 3px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #166534;
|
||||||
|
background-color: #dcfce7;
|
||||||
|
border: 1px solid #22c55e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-inactive {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 3px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #991b1b;
|
||||||
|
background-color: #fee2e2;
|
||||||
|
border: 1px solid #ef4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit {
|
||||||
|
padding: 6px 16px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
background-color: #1d4899;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit:hover {
|
||||||
|
background-color: #163a7a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px 12px;
|
||||||
|
width: 200px;
|
||||||
|
color: #374151;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.required-marker {
|
||||||
|
color: #ef4444;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #b45309;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-hint {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save, .btn-cancel {
|
||||||
|
padding: 8px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save {
|
||||||
|
background-color: #16a34a;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save:hover {
|
||||||
|
background-color: #15803d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel {
|
||||||
|
background-color: #e5e7eb;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel:hover {
|
||||||
|
background-color: #d1d5db;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,317 @@
|
|||||||
|
<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',
|
||||||
|
tax_number: props.data.tax_number ?? '',
|
||||||
|
vat_id: props.data.vat_id ?? '',
|
||||||
|
invoice_prefix: props.data.invoice_prefix ?? '',
|
||||||
|
})
|
||||||
|
|
||||||
|
// Das Präfix bestimmt den Nummernkreis und darf sich nachträglich nicht ändern -- sonst gehörten bereits
|
||||||
|
// herausgegebene Rechnungen plötzlich zu einer anderen Nummer. Nur in der verwalteten Ansicht editierbar.
|
||||||
|
const canEditPrefix = computed(() => props.data.can_edit_invoice_prefix === true)
|
||||||
|
|
||||||
|
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,
|
||||||
|
tax_number: form.value.tax_number,
|
||||||
|
vat_id: form.value.vat_id,
|
||||||
|
invoice_prefix: canEditPrefix.value ? form.value.invoice_prefix : undefined,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
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>
|
||||||
|
<tr>
|
||||||
|
<th>Steuernummer</th>
|
||||||
|
<td>{{ form.tax_number || '—' }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>USt-IdNr.</th>
|
||||||
|
<td>{{ form.vat_id || '—' }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Rechnungs-Präfix</th>
|
||||||
|
<td>{{ form.invoice_prefix || '—' }}</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>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>Steuernummer</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" v-model="form.tax_number" class="form-input" />
|
||||||
|
<span class="field-hint">
|
||||||
|
Pflichtangabe auf Rechnungen — alternativ die USt-IdNr. (§ 14 Abs. 4 Nr. 2 UStG)
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>USt-IdNr.</th>
|
||||||
|
<td><input type="text" v-model="form.vat_id" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Rechnungs-Präfix</th>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="form.invoice_prefix"
|
||||||
|
class="form-input"
|
||||||
|
:disabled="!canEditPrefix"
|
||||||
|
/>
|
||||||
|
<span class="field-hint">
|
||||||
|
Erster Block der Rechnungsnummer, z. B. <code>WM</code> in
|
||||||
|
<code>WM-V-20260701-0005</code>.
|
||||||
|
<template v-if="canEditPrefix">
|
||||||
|
Eine Änderung wirkt nur auf künftige Veranstaltungen; bereits angelegte behalten
|
||||||
|
ihre Nummer.
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
Änderbar nur in der Mandanten-Verwaltung.
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
</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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-hint {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-hint code {
|
||||||
|
padding: 1px 4px;
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 0.95em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input:disabled {
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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>
|
||||||
@@ -6,6 +6,8 @@ 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 TenantPaymentMethods from "./Partials/TenantPaymentMethods.vue";
|
||||||
|
import TenantTaxInfo from "./Partials/TenantTaxInfo.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
tenant: Object,
|
tenant: Object,
|
||||||
@@ -18,10 +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: 'Zahlungsmodule',
|
||||||
|
component: TenantPaymentMethods,
|
||||||
|
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,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class CreateEstimateAction {
|
|||||||
|
|
||||||
if ($this->request->estimateId === 0) {
|
if ($this->request->estimateId === 0) {
|
||||||
$estimate = CostUnitEstimate::create(array_merge([
|
$estimate = CostUnitEstimate::create(array_merge([
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => currentTenant()->slug,
|
||||||
'cost_unit_id' => $this->request->costUnit->id,
|
'cost_unit_id' => $this->request->costUnit->id,
|
||||||
'type' => $this->request->estimateType,
|
'type' => $this->request->estimateType,
|
||||||
'description' => $this->request->description,
|
'description' => $this->request->description,
|
||||||
@@ -33,7 +33,7 @@ class CreateEstimateAction {
|
|||||||
} else {
|
} else {
|
||||||
$estimate = CostUnitEstimate::find($this->request->estimateId);
|
$estimate = CostUnitEstimate::find($this->request->estimateId);
|
||||||
$estimate->update(array_merge([
|
$estimate->update(array_merge([
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => currentTenant()->slug,
|
||||||
'cost_unit_id' => $this->request->costUnit->id,
|
'cost_unit_id' => $this->request->costUnit->id,
|
||||||
'type' => $this->request->estimateType,
|
'type' => $this->request->estimateType,
|
||||||
'description' => $this->request->description,
|
'description' => $this->request->description,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class CreateCostUnitCommand {
|
|||||||
$response = new CreateCostUnitResponse();
|
$response = new CreateCostUnitResponse();
|
||||||
$costUnit = CostUnit::create([
|
$costUnit = CostUnit::create([
|
||||||
'name' => $this->request->name,
|
'name' => $this->request->name,
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => currentTenant()->slug,
|
||||||
'type' => $this->request->type,
|
'type' => $this->request->type,
|
||||||
'billing_deadline' => $this->request->billingDeadline,
|
'billing_deadline' => $this->request->billingDeadline,
|
||||||
'distance_allowance' => $this->request->distanceAllowance->getAmount(),
|
'distance_allowance' => $this->request->distanceAllowance->getAmount(),
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
use App\Domains\CostUnit\Controllers\CreateController;
|
use App\Domains\CostUnit\Controllers\CreateController;
|
||||||
use App\Domains\CostUnit\Controllers\ListController;
|
use App\Domains\CostUnit\Controllers\ListController;
|
||||||
use App\Domains\CostUnit\Controllers\OpenController;
|
use App\Domains\CostUnit\Controllers\OpenController;
|
||||||
use App\Domains\UserManagement\Controllers\EmailVerificationController;
|
|
||||||
use App\Domains\UserManagement\Controllers\LoginController;
|
|
||||||
use App\Domains\UserManagement\Controllers\LogOutController;
|
|
||||||
use App\Domains\UserManagement\Controllers\RegistrationController;
|
|
||||||
use App\Domains\UserManagement\Controllers\ResetPasswordController;
|
|
||||||
use App\Middleware\IdentifyTenant;
|
use App\Middleware\IdentifyTenant;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
@@ -23,16 +18,10 @@ Route::middleware(IdentifyTenant::class)->group(function () {
|
|||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
Route::get('/register', [RegistrationController::class, 'loginForm']);
|
|
||||||
Route::get('/register/verifyEmail', [EmailVerificationController::class, 'verifyEmailForm']);
|
|
||||||
|
|
||||||
Route::get('/reset-password', [ResetPasswordController::class, 'resetPasswordForm']);
|
|
||||||
|
|
||||||
route::get('/logout', LogOutController::class);
|
|
||||||
route::post('/login', [LoginController::class, 'doLogin']);
|
|
||||||
route::get('/login', [LoginController::class, 'loginForm']);
|
|
||||||
|
|
||||||
|
|
||||||
|
// Anmeldung, Registrierung und Passwort-Reset gehören zur Domain UserManagement und sind dort
|
||||||
|
// definiert. Die Duplikate hier überschrieben die dortigen Routen -- unter anderem die benannte
|
||||||
|
// Route `login`, auf die Laravels `auth`-Middleware Gäste umleitet.
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class PersonalDataController extends CommonController
|
|||||||
return redirect()->intended('/login');
|
return redirect()->intended('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = auth()->user();
|
$user = currentUser();
|
||||||
$data = $this->users->getPersonalData($user);
|
$data = $this->users->getPersonalData($user);
|
||||||
|
|
||||||
$inertiaProvider = new InertiaProvider('Dashboard/PersonalData', [
|
$inertiaProvider = new InertiaProvider('Dashboard/PersonalData', [
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class StorePersonalDataController extends CommonController
|
|||||||
{
|
{
|
||||||
public function __invoke(Request $request): JsonResponse
|
public function __invoke(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = currentUser();
|
||||||
|
|
||||||
$actionRequest = new UpdatePersonalDataRequest(
|
$actionRequest = new UpdatePersonalDataRequest(
|
||||||
user: $user,
|
user: $user,
|
||||||
|
|||||||
@@ -3,10 +3,13 @@
|
|||||||
namespace App\Domains\Event\Actions\CreateEvent;
|
namespace App\Domains\Event\Actions\CreateEvent;
|
||||||
|
|
||||||
use App\Enumerations\EatingHabit;
|
use App\Enumerations\EatingHabit;
|
||||||
|
use App\Models\AvailablePaymentMethod;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\RelationModels\EventEatingHabits;
|
use App\RelationModels\EventEatingHabits;
|
||||||
use App\RelationModels\EventLocalGroups;
|
use App\RelationModels\EventLocalGroups;
|
||||||
|
use App\RelationModels\EventPaymentMethods;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreateEventCommand {
|
class CreateEventCommand {
|
||||||
@@ -25,8 +28,13 @@ class CreateEventCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$event = Event::create([
|
$tenant = currentTenant();
|
||||||
'tenant' => app('tenant')->slug,
|
|
||||||
|
// Anlage als Ganzes: der Event-Teil der Rechnungsnummer wird unter der Sperre vergeben und muss
|
||||||
|
// im selben Zug geschrieben werden, sonst könnten zwei gleichzeitige Anlagen denselben erhalten.
|
||||||
|
$event = DB::transaction(function () use ($tenant): Event {
|
||||||
|
$event = Event::create([
|
||||||
|
'tenant' => $tenant->slug,
|
||||||
'name' => $this->request->name,
|
'name' => $this->request->name,
|
||||||
'identifier' => Str::random(10),
|
'identifier' => Str::random(10),
|
||||||
'location' => $this->request->location,
|
'location' => $this->request->location,
|
||||||
@@ -41,11 +49,28 @@ class CreateEventCommand {
|
|||||||
'account_iban' => $this->request->accountIban,
|
'account_iban' => $this->request->accountIban,
|
||||||
'participation_fee_type' => $this->request->participationFeeType->slug,
|
'participation_fee_type' => $this->request->participationFeeType->slug,
|
||||||
'pay_per_day' => $this->request->payPerDay,
|
'pay_per_day' => $this->request->payPerDay,
|
||||||
'pay_direct' => $this->request->payDirect,
|
'pay_direct' => false,
|
||||||
'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' => $tenant->tax_liable,
|
||||||
|
'vat_rate' => $tenant->vat_rate,
|
||||||
|
'vat_pricing_mode' => $tenant->vat_pricing_mode,
|
||||||
|
'tax_exemption_reason' => $tenant->tax_exemption_reason,
|
||||||
|
'tax_exemption_note' => $tenant->tax_exemption_note,
|
||||||
|
// Den Event-Teil der Rechnungsnummer einfrieren: Tenant-Präfix und Startdatum sind später
|
||||||
|
// änderbar, eine herausgegebene Rechnung würde sonst zu einer anderen Nummer gehören.
|
||||||
|
//
|
||||||
|
// Der Rechnungssteller wird bewusst NICHT mitkopiert -- er ist der Mandant und wird beim
|
||||||
|
// Erzeugen der Rechnung von dort gelesen, damit eine Korrektur an Name oder Anschrift auch
|
||||||
|
// auf bestehende Veranstaltungen wirkt.
|
||||||
|
'invoice_key' => $this->nextInvoiceKey($tenant),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $event;
|
||||||
|
});
|
||||||
|
|
||||||
if ($event !== null) {
|
if ($event !== null) {
|
||||||
EventEatingHabits::create([
|
EventEatingHabits::create([
|
||||||
@@ -58,12 +83,20 @@ class CreateEventCommand {
|
|||||||
'eating_habit_id' => EatingHabit::where('slug', EatingHabit::EATING_HABIT_VEGETARIAN)->first()->id,
|
'eating_habit_id' => EatingHabit::where('slug', EatingHabit::EATING_HABIT_VEGETARIAN)->first()->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (app('tenant')->slug === 'lv') {
|
foreach (AvailablePaymentMethod::where('active', true)->get() as $availablePaymentMethod) {
|
||||||
|
EventPaymentMethods::create([
|
||||||
|
'event_id' => $event->id,
|
||||||
|
'slug' => $availablePaymentMethod->slug,
|
||||||
|
'configuration' => $availablePaymentMethod->configuration ?? [],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentTenant()->slug === 'lv') {
|
||||||
foreach(Tenant::where(['is_active_local_group' => true])->get() as $tenant) {
|
foreach(Tenant::where(['is_active_local_group' => true])->get() as $tenant) {
|
||||||
EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => $tenant->id]);
|
EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => $tenant->id]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => app('tenant')->id]);
|
EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => currentTenant()->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -73,4 +106,35 @@ class CreateEventCommand {
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event-Teil der Rechnungsnummer, z.B. `WM-V-20260701`: Tenant-Präfix, Dokumentart „V" für
|
||||||
|
* Veranstaltung, dann ohne Trenner Jahr, Monat des Beginns und die laufende Nummer der
|
||||||
|
* Veranstaltungen dieses Tenants in diesem Monat.
|
||||||
|
*
|
||||||
|
* Gezählt wird über die bereits vergebenen Schlüssel desselben Monats. Die Sperre auf der
|
||||||
|
* Tenant-Zeile serialisiert gleichzeitige Anlagen; der Aufruf erfolgt innerhalb der
|
||||||
|
* Anlage-Transaktion, sodass die Sperre bis zum Schreiben des Events steht.
|
||||||
|
*/
|
||||||
|
private function nextInvoiceKey(Tenant $tenant): string
|
||||||
|
{
|
||||||
|
// Jahr und Monat ohne Trenner; die laufende Nummer haengt unmittelbar daran. Alle drei Teile
|
||||||
|
// haben feste Laenge, der Schluessel bleibt dadurch eindeutig zerlegbar.
|
||||||
|
$month = $this->request->begin->format('Ym');
|
||||||
|
$prefix = sprintf('%s-V-%s', $tenant->invoice_prefix ?? strtoupper($tenant->slug), $month);
|
||||||
|
|
||||||
|
DB::table('tenants')->where('id', $tenant->id)->lockForUpdate()->first();
|
||||||
|
|
||||||
|
$used = DB::table('events')
|
||||||
|
->where('tenant', $tenant->slug)
|
||||||
|
->where('invoice_key', 'like', $prefix . '%')
|
||||||
|
->pluck('invoice_key');
|
||||||
|
|
||||||
|
$highest = 0;
|
||||||
|
foreach ($used as $key) {
|
||||||
|
$highest = max($highest, (int) substr((string) $key, strlen($prefix)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $prefix . str_pad((string) ($highest + 1), 2, '0', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ class CreateEventRequest {
|
|||||||
public string $accountOwner;
|
public string $accountOwner;
|
||||||
public string $accountIban;
|
public string $accountIban;
|
||||||
public bool $payPerDay;
|
public bool $payPerDay;
|
||||||
public bool $payDirect;
|
|
||||||
|
|
||||||
public function __construct(string $name, string $location, string $postalCode, string $email, DateTime $begin, DateTime $end, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $earlyBirdEndAmountIncrease, ParticipationFeeType $participationFeeType, string $accountOwner, string $accountIban, bool $payPerDay, bool $payDirect) {
|
public function __construct(string $name, string $location, string $postalCode, string $email, DateTime $begin, DateTime $end, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $earlyBirdEndAmountIncrease, ParticipationFeeType $participationFeeType, string $accountOwner, string $accountIban, bool $payPerDay) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->location = $location;
|
$this->location = $location;
|
||||||
$this->postalCode = $postalCode;
|
$this->postalCode = $postalCode;
|
||||||
@@ -35,6 +34,5 @@ class CreateEventRequest {
|
|||||||
$this->accountOwner = $accountOwner;
|
$this->accountOwner = $accountOwner;
|
||||||
$this->accountIban = $accountIban;
|
$this->accountIban = $accountIban;
|
||||||
$this->payPerDay = $payPerDay;
|
$this->payPerDay = $payPerDay;
|
||||||
$this->payDirect = $payDirect;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+224
@@ -0,0 +1,224 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\CreateIncomeSurplusStatement;
|
||||||
|
|
||||||
|
use App\Enumerations\ParticipationType;
|
||||||
|
use App\Models\CostUnit;
|
||||||
|
use App\Models\Event;
|
||||||
|
use App\Providers\PdfGenerateAndDownloadProvider;
|
||||||
|
use App\Repositories\CostUnitRepository;
|
||||||
|
use App\ValueObjects\Amount;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt die Einnahmen-Überschuss-Rechnung einer Veranstaltung als PDF.
|
||||||
|
*
|
||||||
|
* Gezeigt wird ausschließlich Geld, das geflossen ist: gezahlte Beiträge, weitere Einnahmen, was von
|
||||||
|
* Abmeldungen einbehalten wurde, Fördermittel -- und auf der anderen Seite die erfassten Belege. Was nur
|
||||||
|
* erwartet (offene Beiträge) oder geplant (Budgetwerte) ist, gehört in eine Einnahmen-Überschuss-Rechnung
|
||||||
|
* nicht hinein.
|
||||||
|
*
|
||||||
|
* Es wird nichts gespeichert: Alle Zahlen leiten sich aus dem aktuellen Stand ab, ein erneuter Abruf
|
||||||
|
* liefert den dann gültigen Stand.
|
||||||
|
*/
|
||||||
|
class CreateIncomeSurplusStatementCommand
|
||||||
|
{
|
||||||
|
private Event $event;
|
||||||
|
|
||||||
|
private CostUnitRepository $costUnits;
|
||||||
|
|
||||||
|
public function __construct(private readonly CreateIncomeSurplusStatementRequest $request)
|
||||||
|
{
|
||||||
|
$this->event = $request->event;
|
||||||
|
$this->costUnits = new CostUnitRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(): CreateIncomeSurplusStatementResponse
|
||||||
|
{
|
||||||
|
$response = new CreateIncomeSurplusStatementResponse();
|
||||||
|
|
||||||
|
$costUnit = $this->event->costUnit()->first();
|
||||||
|
|
||||||
|
if (!$costUnit instanceof CostUnit) {
|
||||||
|
$response->message = 'Der Veranstaltung ist keine Kostenstelle zugeordnet.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Der Pauschalbetrag wird vor dem Resource-Aufruf gelesen: `EventResource::calculateSupportPerPerson()`
|
||||||
|
// multipliziert das Amount-Objekt von `support_per_person` in place. Auf `support_flat` wirkt das
|
||||||
|
// zwar nicht, aber der gesamte Zugriff auf Beträge des Models ist danach nicht mehr vertrauenswürdig.
|
||||||
|
$otherIncome = $this->event->support_flat->getAmount();
|
||||||
|
|
||||||
|
$eventData = $this->event->toResource()->toArray(new Request());
|
||||||
|
|
||||||
|
$income = $this->buildIncome($eventData, $otherIncome);
|
||||||
|
$expenses = $this->buildExpenses($costUnit);
|
||||||
|
|
||||||
|
$result = new Amount($income['total']->getAmount() - $expenses['total']->getAmount(), 'Euro');
|
||||||
|
|
||||||
|
$html = view('pdfs.income-surplus-statement', [
|
||||||
|
'event' => $this->event,
|
||||||
|
'createdAt' => new \DateTime()->format('d.m.Y'),
|
||||||
|
'income' => $income,
|
||||||
|
'expenses' => $expenses,
|
||||||
|
'result' => $result,
|
||||||
|
'money' => self::money(...),
|
||||||
|
])->render();
|
||||||
|
|
||||||
|
$response->success = true;
|
||||||
|
$response->filename = 'EUER-' . $this->event->identifier . '.pdf';
|
||||||
|
$response->income = $income;
|
||||||
|
$response->expenses = $expenses;
|
||||||
|
$response->result = $result;
|
||||||
|
$response->pdfContent = PdfGenerateAndDownloadProvider::fromHtml($html, 'portrait');
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Einnahmenseite in zwei Ober-Kategorien.
|
||||||
|
*
|
||||||
|
* Alle Zahlen stammen aus {@see \App\Resources\EventResource} -- derselben Quelle wie die
|
||||||
|
* Veranstaltungsübersicht am Bildschirm. Eine eigene Rechnung daneben würde über kurz oder lang von
|
||||||
|
* der Übersicht abweichen, und dann glaubt niemand mehr einer der beiden Zahlen.
|
||||||
|
*
|
||||||
|
* @param array<string, mixed> $eventData
|
||||||
|
*
|
||||||
|
* @return array{categories: array<int, array{name: string, total: Amount, entries: array<int, array{name: string, amount: Amount}>}>, total: Amount}
|
||||||
|
*/
|
||||||
|
private function buildIncome(array $eventData, float $otherIncome): array
|
||||||
|
{
|
||||||
|
// Beiträge aller Teilnahmearten in einer Zeile: Für die Mittelverwendung zählt, was an Beiträgen
|
||||||
|
// hereingekommen ist, nicht von wem.
|
||||||
|
$participationFees = new Amount(0, 'Euro');
|
||||||
|
foreach ([
|
||||||
|
ParticipationType::PARTICIPATION_TYPE_PARTICIPANT,
|
||||||
|
ParticipationType::PARTICIPATION_TYPE_TEAM,
|
||||||
|
ParticipationType::PARTICIPATION_TYPE_VOLUNTEER,
|
||||||
|
ParticipationType::PARTICIPATION_TYPE_OTHER,
|
||||||
|
] as $participationType) {
|
||||||
|
$participationFees->addAmount(
|
||||||
|
new Amount((float) $eventData['participants'][$participationType]['amount']['paid']['value'], 'Euro')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ownFunds = [
|
||||||
|
['name' => 'Teilnahmebeiträge', 'amount' => $participationFees],
|
||||||
|
['name' => 'Weitere Einnahmen', 'amount' => new Amount($otherIncome, 'Euro')],
|
||||||
|
[
|
||||||
|
'name' => 'Einbehaltene Einnahmen aus Abmeldungen',
|
||||||
|
'amount' => new Amount((float) $eventData['retainedFromUnregistered']['value'], 'Euro'),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$supportRate = new Amount((float) $eventData['supportPersonValue'], 'Euro');
|
||||||
|
$funding = [
|
||||||
|
[
|
||||||
|
'name' => 'Fördermittel (' . self::money($supportRate) . ' € p.P./Tag)',
|
||||||
|
'amount' => new Amount($eventData['supportPerson']['amount']->getAmount(), 'Euro'),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$categories = [
|
||||||
|
['name' => 'Eigenmittel', 'entries' => $ownFunds, 'total' => self::sum($ownFunds)],
|
||||||
|
['name' => 'Förderungen', 'entries' => $funding, 'total' => self::sum($funding)],
|
||||||
|
];
|
||||||
|
|
||||||
|
return [
|
||||||
|
'categories' => $categories,
|
||||||
|
'total' => self::sum($categories),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Ausgabenseite: eine Zeile je Ausgabentyp, dazu die Belege für die Anlage.
|
||||||
|
*
|
||||||
|
* @return array{groups: array<int, array{name: string, sum: Amount, rows: array<int, array{number: string, date: string, purpose: string, amount: Amount}>}>, total: Amount}
|
||||||
|
*/
|
||||||
|
private function buildExpenses(CostUnit $costUnit): array
|
||||||
|
{
|
||||||
|
$groups = [];
|
||||||
|
$total = new Amount(0, 'Euro');
|
||||||
|
|
||||||
|
foreach ($this->costUnits->groupExpensesByType($costUnit) as $group) {
|
||||||
|
$rows = [];
|
||||||
|
|
||||||
|
foreach ($group['invoices'] as $invoice) {
|
||||||
|
$rows[] = [
|
||||||
|
'number' => (string) $invoice->invoice_number,
|
||||||
|
'date' => $invoice->created_at?->format('d.m.Y') ?? '',
|
||||||
|
'purpose' => $this->purpose($invoice->type_other, $invoice->comment),
|
||||||
|
'amount' => Amount::fromString($invoice->amount),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$groups[] = [
|
||||||
|
'name' => $group['type']->name,
|
||||||
|
'sum' => $group['sum'],
|
||||||
|
'rows' => $rows,
|
||||||
|
];
|
||||||
|
|
||||||
|
$total->addAmount($group['sum']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['groups' => $groups, 'total' => $total];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wofür der Beleg steht.
|
||||||
|
*
|
||||||
|
* `type_other` trägt seit der Pflichtangabe "Was wurde eingekauft" zu jeder Abrechnung den Zweck,
|
||||||
|
* nicht mehr nur bei "Sonstige Kosten". Ältere Belege haben das Feld leer -- dann bleibt die
|
||||||
|
* Anmerkung, und fehlt auch die, bleibt die Zelle leer. Ein Platzhalter wie "--" würde in der
|
||||||
|
* Belegliste nur Platz kosten.
|
||||||
|
*/
|
||||||
|
private function purpose(?string $typeOther, ?string $comment): string
|
||||||
|
{
|
||||||
|
$parts = [];
|
||||||
|
|
||||||
|
foreach ([$typeOther, $comment] as $part) {
|
||||||
|
if (trim((string) $part) !== '') {
|
||||||
|
$parts[] = trim((string) $part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' — ', $parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ein Betrag in deutscher Schreibweise: Punkt als Tausender-, Komma als Dezimaltrennzeichen.
|
||||||
|
*
|
||||||
|
* Bewusst nicht {@see Amount::getFormattedAmount()}: Die Methode ersetzt nach `number_format` jeden
|
||||||
|
* Punkt durch ein Komma und macht aus 1.487,50 damit "1,487,50". Auf einer Aufstellung, in der
|
||||||
|
* vierstellige Beträge die Regel sind, wäre das nicht lesbar. Der Fehler steckt im Value Object und
|
||||||
|
* wirkt überall, wo Beträge angezeigt werden -- ihn dort zu beheben ist eine eigene Änderung.
|
||||||
|
*
|
||||||
|
* Öffentlich, weil die Vorlage sie als Callable bekommt und weil sie für sich prüfbar sein soll.
|
||||||
|
*/
|
||||||
|
public static function money(Amount $amount): string
|
||||||
|
{
|
||||||
|
return number_format(round($amount->getAmount(), 2), 2, ',', '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summiert Zeilen, die je ein `amount` oder `total` tragen.
|
||||||
|
*
|
||||||
|
* Über ein frisches Amount-Objekt, weil `Amount::addAmount()` den Empfänger verändert -- die
|
||||||
|
* Einzelbeträge sollen unangetastet bleiben, sie werden anschließend gedruckt.
|
||||||
|
*
|
||||||
|
* @param array<int, array<string, mixed>> $rows
|
||||||
|
*/
|
||||||
|
private static function sum(array $rows): Amount
|
||||||
|
{
|
||||||
|
$sum = new Amount(0, 'Euro');
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
/** @var Amount $amount */
|
||||||
|
$amount = $row['amount'] ?? $row['total'];
|
||||||
|
$sum->addAmount($amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sum;
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\CreateIncomeSurplusStatement;
|
||||||
|
|
||||||
|
use App\Models\Event;
|
||||||
|
|
||||||
|
class CreateIncomeSurplusStatementRequest
|
||||||
|
{
|
||||||
|
public function __construct(public readonly Event $event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Actions\CreateIncomeSurplusStatement;
|
||||||
|
|
||||||
|
use App\ValueObjects\Amount;
|
||||||
|
|
||||||
|
class CreateIncomeSurplusStatementResponse
|
||||||
|
{
|
||||||
|
public bool $success = false;
|
||||||
|
|
||||||
|
public string $filename = '';
|
||||||
|
|
||||||
|
public string $pdfContent = '';
|
||||||
|
|
||||||
|
public ?string $message = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Zahlen, aus denen das PDF entsteht -- Einnahmen-Kategorien, Ausgaben-Gruppen und das Ergebnis.
|
||||||
|
*
|
||||||
|
* Sie stehen hier, weil sie das eigentliche Ergebnis der Action sind; das PDF ist nur ihre Darstellung.
|
||||||
|
* So lässt sich die Rechnung prüfen, ohne ein PDF zerlegen zu müssen.
|
||||||
|
*
|
||||||
|
* @var array{categories: array<int, array{name: string, total: Amount, entries: array<int, array{name: string, amount: Amount}>}>, total: Amount}|array{}
|
||||||
|
*/
|
||||||
|
public array $income = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array{groups: array<int, array{name: string, sum: Amount, rows: array<int, array<string, mixed>>}>, total: Amount}|array{}
|
||||||
|
*/
|
||||||
|
public array $expenses = [];
|
||||||
|
|
||||||
|
public ?Amount $result = null;
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ class GenerateIcalCommand
|
|||||||
$participant = $this->request->participant;
|
$participant = $this->request->participant;
|
||||||
$event = $participant->event;
|
$event = $participant->event;
|
||||||
|
|
||||||
$uid = $participant->identifier . '@' . app('tenant')->slug;
|
$uid = $participant->identifier . '@' . currentTenant()->slug;
|
||||||
$dtStart = $event->start_date->format('Ymd');
|
$dtStart = $event->start_date->format('Ymd');
|
||||||
$dtEnd = $event->end_date->copy()->addDay()->format('Ymd');
|
$dtEnd = $event->end_date->copy()->addDay()->format('Ymd');
|
||||||
$now = now()->format('Ymd\THis\Z');
|
$now = now()->format('Ymd\THis\Z');
|
||||||
@@ -24,7 +24,7 @@ class GenerateIcalCommand
|
|||||||
$icalContent = implode("\r\n", [
|
$icalContent = implode("\r\n", [
|
||||||
'BEGIN:VCALENDAR',
|
'BEGIN:VCALENDAR',
|
||||||
'VERSION:2.0',
|
'VERSION:2.0',
|
||||||
'PRODID:-//' . app('tenant')->name . '//Veranstaltungskalender//DE',
|
'PRODID:-//' . currentTenant()->name . '//Veranstaltungskalender//DE',
|
||||||
'CALSCALE:GREGORIAN',
|
'CALSCALE:GREGORIAN',
|
||||||
'METHOD:PUBLISH',
|
'METHOD:PUBLISH',
|
||||||
'BEGIN:VEVENT',
|
'BEGIN:VEVENT',
|
||||||
|
|||||||
+2
-2
@@ -21,11 +21,11 @@ class GenerateIcalForDeadlineCommand {
|
|||||||
$icalContent = implode("\r\n", [
|
$icalContent = implode("\r\n", [
|
||||||
'BEGIN:VCALENDAR',
|
'BEGIN:VCALENDAR',
|
||||||
'VERSION:2.0',
|
'VERSION:2.0',
|
||||||
'PRODID:-//' . app('tenant')->name . '//Veranstaltungskalender//DE',
|
'PRODID:-//' . currentTenant()->name . '//Veranstaltungskalender//DE',
|
||||||
'CALSCALE:GREGORIAN',
|
'CALSCALE:GREGORIAN',
|
||||||
'METHOD:PUBLISH',
|
'METHOD:PUBLISH',
|
||||||
'BEGIN:VEVENT',
|
'BEGIN:VEVENT',
|
||||||
'UID:payment-deadline-' . $event->identifier . '@' . app('tenant')->slug,
|
'UID:payment-deadline-' . $event->identifier . '@' . currentTenant()->slug,
|
||||||
'DTSTAMP:' . $now,
|
'DTSTAMP:' . $now,
|
||||||
'DTSTART;VALUE=DATE:' . $dtDate,
|
'DTSTART;VALUE=DATE:' . $dtDate,
|
||||||
'DTEND;VALUE=DATE:' . $dtDate,
|
'DTEND;VALUE=DATE:' . $dtDate,
|
||||||
|
|||||||
@@ -0,0 +1,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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ class SetParticipationFeesCommand {
|
|||||||
$this->cleanBefore();
|
$this->cleanBefore();
|
||||||
|
|
||||||
$this->request->event->participationFee1()->associate(EventParticipationFee::create([
|
$this->request->event->participationFee1()->associate(EventParticipationFee::create([
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => currentTenant()->slug,
|
||||||
'type' => $this->request->participationFeeFirst['type'],
|
'type' => $this->request->participationFeeFirst['type'],
|
||||||
'name' => $this->request->participationFeeFirst['name'],
|
'name' => $this->request->participationFeeFirst['name'],
|
||||||
'description' => $this->request->participationFeeFirst['description'],
|
'description' => $this->request->participationFeeFirst['description'],
|
||||||
@@ -29,7 +29,7 @@ class SetParticipationFeesCommand {
|
|||||||
|
|
||||||
if ($this->request->participationFeeSecond !== null) {
|
if ($this->request->participationFeeSecond !== null) {
|
||||||
$this->request->event->participationFee2()->associate(EventParticipationFee::create([
|
$this->request->event->participationFee2()->associate(EventParticipationFee::create([
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => currentTenant()->slug,
|
||||||
'type' => $this->request->participationFeeSecond['type'],
|
'type' => $this->request->participationFeeSecond['type'],
|
||||||
'name' => $this->request->participationFeeSecond['name'],
|
'name' => $this->request->participationFeeSecond['name'],
|
||||||
'description' => $this->request->participationFeeSecond['description'],
|
'description' => $this->request->participationFeeSecond['description'],
|
||||||
@@ -41,7 +41,7 @@ class SetParticipationFeesCommand {
|
|||||||
|
|
||||||
if ($this->request->participationFeeThird !== null) {
|
if ($this->request->participationFeeThird !== null) {
|
||||||
$this->request->event->participationFee3()->associate(EventParticipationFee::create([
|
$this->request->event->participationFee3()->associate(EventParticipationFee::create([
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => currentTenant()->slug,
|
||||||
'type' => $this->request->participationFeeThird['type'],
|
'type' => $this->request->participationFeeThird['type'],
|
||||||
'name' => $this->request->participationFeeThird['name'],
|
'name' => $this->request->participationFeeThird['name'],
|
||||||
'description' => $this->request->participationFeeThird['description'],
|
'description' => $this->request->participationFeeThird['description'],
|
||||||
@@ -53,7 +53,7 @@ class SetParticipationFeesCommand {
|
|||||||
|
|
||||||
if ($this->request->participationFeeFourth !== null) {
|
if ($this->request->participationFeeFourth !== null) {
|
||||||
$this->request->event->participationFee4()->associate(EventParticipationFee::create([
|
$this->request->event->participationFee4()->associate(EventParticipationFee::create([
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => currentTenant()->slug,
|
||||||
'type' => $this->request->participationFeeFourth['type'],
|
'type' => $this->request->participationFeeFourth['type'],
|
||||||
'name' => $this->request->participationFeeFourth['name'],
|
'name' => $this->request->participationFeeFourth['name'],
|
||||||
'description' => $this->request->participationFeeFourth['description'],
|
'description' => $this->request->participationFeeFourth['description'],
|
||||||
|
|||||||
@@ -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,7 +4,9 @@ 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\Facades\DB;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class SignUpCommand {
|
class SignUpCommand {
|
||||||
@@ -14,6 +16,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,
|
||||||
@@ -21,15 +43,22 @@ class SignUpCommand {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$participantAge = new Age($this->request->birthday);
|
$participantAge = new Age($this->request->birthday);
|
||||||
$response->participant = $this->request->event->participants()->create(
|
|
||||||
|
// Anmeldung als Ganzes: die laufende Nummer (invoice_sequence) muss unter der Sperre vergeben und
|
||||||
|
// im selben Zug geschrieben werden, sonst könnten zwei gleichzeitige Anmeldungen dieselbe erhalten.
|
||||||
|
$response->participant = DB::transaction(function () use ($participantAge, $eatingHabit, $paymentOptions, $participationOptionRows) {
|
||||||
|
$participant = $this->request->event->participants()->create(
|
||||||
[
|
[
|
||||||
'tenant' => $this->request->event->tenant,
|
'tenant' => $this->request->event->tenant,
|
||||||
'user_id' => $this->request->user_id,
|
'user_id' => $this->request->user_id,
|
||||||
'identifier' => Str::random(10),
|
'identifier' => Str::random(10),
|
||||||
|
'invoice_sequence' => $this->nextInvoiceSequence(),
|
||||||
'firstname' => $this->request->firstname,
|
'firstname' => $this->request->firstname,
|
||||||
'lastname' => $this->request->lastname,
|
'lastname' => $this->request->lastname,
|
||||||
'nickname' => $this->request->nickname,
|
'nickname' => $this->request->nickname,
|
||||||
'participation_type' => $this->request->participationType,
|
'participation_type' => $this->request->participationType,
|
||||||
|
'fee_type' => $this->request->feeType,
|
||||||
|
'sibling_reduction' => $this->request->siblingReduction,
|
||||||
'local_group' => $this->request->localGroup->slug,
|
'local_group' => $this->request->localGroup->slug,
|
||||||
'birthday' => $this->request->birthday,
|
'birthday' => $this->request->birthday,
|
||||||
'address_1' => $this->request->address_1,
|
'address_1' => $this->request->address_1,
|
||||||
@@ -46,8 +75,12 @@ class SignUpCommand {
|
|||||||
'medications' => $this->request->medications,
|
'medications' => $this->request->medications,
|
||||||
'tetanus_vaccination' => $this->request->tetanus_vaccination,
|
'tetanus_vaccination' => $this->request->tetanus_vaccination,
|
||||||
'eating_habit' => $eatingHabit,
|
'eating_habit' => $eatingHabit,
|
||||||
'swimming_permission' => $participantAge->isfullAged() ? 'SWIMMING_PERMISSION_ALLOWED' : $this->request->swimming_permission,
|
'swimming_permission' => ($participantAge->isfullAged() || $this->request->swimming_permission === '-1')
|
||||||
'first_aid_permission' => $participantAge->isfullAged() ? 'FIRST_AID_PERMISSION_ALLOWED' : $this->request->first_aid_permission,
|
? 'SWIMMING_PERMISSION_ALLOWED'
|
||||||
|
: $this->request->swimming_permission,
|
||||||
|
'first_aid_permission' => ($participantAge->isfullAged() || $this->request->first_aid_permission === '-1')
|
||||||
|
? 'FIRST_AID_PERMISSION_ALLOWED'
|
||||||
|
: $this->request->first_aid_permission,
|
||||||
'foto_socialmedia' => $this->request->foto_socialmedia,
|
'foto_socialmedia' => $this->request->foto_socialmedia,
|
||||||
'foto_print' => $this->request->foto_print,
|
'foto_print' => $this->request->foto_print,
|
||||||
'foto_webseite' => $this->request->foto_webseite,
|
'foto_webseite' => $this->request->foto_webseite,
|
||||||
@@ -60,12 +93,120 @@ class SignUpCommand {
|
|||||||
'notes' => $this->request->notes,
|
'notes' => $this->request->notes,
|
||||||
'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_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($participant, $participationOptionRows);
|
||||||
|
$this->persistAddons($participant);
|
||||||
|
|
||||||
|
return $participant;
|
||||||
|
});
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nächste laufende Nummer des Teilis innerhalb der Veranstaltung -- der letzte Block der
|
||||||
|
* Rechnungsnummer. Die Event-Zeile wird gesperrt, damit gleichzeitige Anmeldungen derselben
|
||||||
|
* Veranstaltung serialisiert werden; der Aufruf erfolgt innerhalb der Anmelde-Transaktion, sodass die
|
||||||
|
* Sperre bis zum Schreiben des Teilis steht.
|
||||||
|
*
|
||||||
|
* Abgemeldete Teilis behalten ihre Nummer, gezählt wird deshalb über MAX und nicht über COUNT.
|
||||||
|
*/
|
||||||
|
private function nextInvoiceSequence(): int
|
||||||
|
{
|
||||||
|
DB::table('events')
|
||||||
|
->where('id', $this->request->event->id)
|
||||||
|
->lockForUpdate()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$highest = DB::table('event_participants')
|
||||||
|
->where('event_id', $this->request->event->id)
|
||||||
|
->max('invoice_sequence');
|
||||||
|
|
||||||
|
return (int) $highest + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
@@ -44,7 +43,17 @@ class SignUpRequest {
|
|||||||
public int $arrival_eating,
|
public int $arrival_eating,
|
||||||
public int $departure_eating,
|
public int $departure_eating,
|
||||||
public ?string $notes,
|
public ?string $notes,
|
||||||
public Amount $amount
|
public Amount $amount,
|
||||||
|
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 = [],
|
||||||
|
/** Gewählte Preisspalte: standard | reduced | solidarity. Wird für die Rechnung mitgeschrieben. */
|
||||||
|
public ?string $feeType = null,
|
||||||
|
/** Ob die 50-%-Geschwisterermäßigung in `amount` eingerechnet ist. */
|
||||||
|
public bool $siblingReduction = false,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ class UpdateEventRequest {
|
|||||||
public array $contributingLocalGroups;
|
public array $contributingLocalGroups;
|
||||||
public array $eatingHabits;
|
public array $eatingHabits;
|
||||||
|
|
||||||
public function __construct(Event $event, string $eventName, string $eventLocation, string $postalCode, string $email, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $alcoholicsAge, bool $sendWeeklyReports, bool $registrationAllowed, Amount $flatSupport, Amount $supportPerPerson, array $contributingLocalGroups, array $eatingHabits) {
|
public function __construct(Event $event, string $eventName, string $eventLocation, string $postalCode, string $email, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $alcoholicsAge, bool $sendWeeklyReports, bool $registrationAllowed, Amount $flatSupport, Amount $supportPerPerson, array $contributingLocalGroups, array $eatingHabits)
|
||||||
|
{
|
||||||
$this->event = $event;
|
$this->event = $event;
|
||||||
$this->eventName = $eventName;
|
$this->eventName = $eventName;
|
||||||
$this->eventLocation = $eventLocation;
|
$this->eventLocation = $eventLocation;
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ namespace App\Domains\Event\Actions\UpdateEvent;
|
|||||||
|
|
||||||
class UpdateEventResponse {
|
class UpdateEventResponse {
|
||||||
public bool $success;
|
public bool $success;
|
||||||
|
public string $message;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->success = false;
|
$this->success = false;
|
||||||
|
$this->message = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class UpdateParticipantCommand {
|
|||||||
$p->departure_date = DateTime::createFromFormat('Y-m-d', $this->request->departure);
|
$p->departure_date = DateTime::createFromFormat('Y-m-d', $this->request->departure);
|
||||||
$p->participation_type = $this->request->participationType;
|
$p->participation_type = $this->request->participationType;
|
||||||
$p->eating_habit = $this->request->eatingHabit;
|
$p->eating_habit = $this->request->eatingHabit;
|
||||||
|
$p->payment_method = $this->request->paymentMethod;
|
||||||
$p->allergies = $this->request->allergies;
|
$p->allergies = $this->request->allergies;
|
||||||
$p->intolerances = $this->request->intolerances;
|
$p->intolerances = $this->request->intolerances;
|
||||||
$p->medications = $this->request->medications;
|
$p->medications = $this->request->medications;
|
||||||
@@ -71,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;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class UpdateParticipantRequest {
|
|||||||
public string $departure,
|
public string $departure,
|
||||||
public string $participationType,
|
public string $participationType,
|
||||||
public string $eatingHabit,
|
public string $eatingHabit,
|
||||||
|
public ?string $paymentMethod,
|
||||||
public ?string $allergies,
|
public ?string $allergies,
|
||||||
public ?string $intolerances,
|
public ?string $intolerances,
|
||||||
public ?string $medications,
|
public ?string $medications,
|
||||||
@@ -35,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,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use Illuminate\Http\Request;
|
|||||||
class CreateController extends CommonController {
|
class CreateController extends CommonController {
|
||||||
public function __invoke() {
|
public function __invoke() {
|
||||||
return new InertiaProvider('Event/Create', [
|
return new InertiaProvider('Event/Create', [
|
||||||
'emailAddress' => auth()->user()->email,
|
'emailAddress' => currentUserOrFail()->email,
|
||||||
'eventAccount' => $this->tenant->account_name,
|
'eventAccount' => $this->tenant->account_name,
|
||||||
'eventIban' => $this->tenant->account_iban,
|
'eventIban' => $this->tenant->account_iban,
|
||||||
'eventPayPerDay' => $this->tenant->slug === 'lv' ? true : false,
|
'eventPayPerDay' => $this->tenant->slug === 'lv' ? true : false,
|
||||||
@@ -39,7 +39,6 @@ class CreateController extends CommonController {
|
|||||||
$registrationFinalEnd = DateTime::createFromFormat('Y-m-d', $request->input('eventRegistrationFinalEnd'));
|
$registrationFinalEnd = DateTime::createFromFormat('Y-m-d', $request->input('eventRegistrationFinalEnd'));
|
||||||
$participationFeeType = ParticipationFeeType::where('slug', $request->input('eventParticipationFeeType'))->first();
|
$participationFeeType = ParticipationFeeType::where('slug', $request->input('eventParticipationFeeType'))->first();
|
||||||
$payPerDay = $request->input('eventPayPerDay');
|
$payPerDay = $request->input('eventPayPerDay');
|
||||||
$payDirect = $request->input('eventPayDirectly');
|
|
||||||
|
|
||||||
$billingDeadline = clone $eventEnd;
|
$billingDeadline = clone $eventEnd;
|
||||||
$billingDeadline->modify('+6 weeks');
|
$billingDeadline->modify('+6 weeks');
|
||||||
@@ -57,8 +56,7 @@ class CreateController extends CommonController {
|
|||||||
$participationFeeType,
|
$participationFeeType,
|
||||||
$request->input('eventAccount'),
|
$request->input('eventAccount'),
|
||||||
$request->input('eventIban'),
|
$request->input('eventIban'),
|
||||||
$payPerDay,
|
$payPerDay
|
||||||
$payDirect
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$wasSuccessful = false;
|
$wasSuccessful = false;
|
||||||
|
|||||||
@@ -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) {
|
||||||
@@ -63,7 +66,21 @@ class DetailsController extends CommonController {
|
|||||||
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
|
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
|
||||||
$response = $eventUpdateCommand->execute();
|
$response = $eventUpdateCommand->execute();
|
||||||
|
|
||||||
return response()->json(['status' => $response->success ? 'success' : 'error']);
|
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 {
|
||||||
@@ -129,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);
|
||||||
@@ -182,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;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Event\Controllers;
|
||||||
|
|
||||||
|
use App\Domains\Event\Actions\CreateIncomeSurplusStatement\CreateIncomeSurplusStatementCommand;
|
||||||
|
use App\Domains\Event\Actions\CreateIncomeSurplusStatement\CreateIncomeSurplusStatementRequest;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
class IncomeSurplusStatementController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $eventId): Response
|
||||||
|
{
|
||||||
|
$event = $this->events->getByIdentifier($eventId);
|
||||||
|
|
||||||
|
if ($event === null) {
|
||||||
|
abort(403, 'Zugriff verweigert.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$statementRequest = new CreateIncomeSurplusStatementRequest($event);
|
||||||
|
$statementCommand = new CreateIncomeSurplusStatementCommand($statementRequest);
|
||||||
|
$statementResponse = $statementCommand->execute();
|
||||||
|
|
||||||
|
if (!$statementResponse->success) {
|
||||||
|
abort(422, $statementResponse->message ?? 'Die EÜR konnte nicht erstellt werden.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response($statementResponse->pdfContent, 200, [
|
||||||
|
'Content-Type' => 'application/pdf',
|
||||||
|
'Content-Disposition' => 'attachment; filename="' . $statementResponse->filename . '"',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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')]);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class SendController extends CommonController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = auth()->user();
|
$user = currentUser();
|
||||||
$reportSubject = sprintf('Sendebericht für Nachricht mit Betreff "%s"', $subject);
|
$reportSubject = sprintf('Sendebericht für Nachricht mit Betreff "%s"', $subject);
|
||||||
|
|
||||||
Mail::to($user->email)->send(new ManualMailsReportMail(
|
Mail::to($user->email)->send(new ManualMailsReportMail(
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class ParticipantUpdateController extends CommonController {
|
|||||||
departure: $request->input('departure'),
|
departure: $request->input('departure'),
|
||||||
participationType: $request->input('participationType'),
|
participationType: $request->input('participationType'),
|
||||||
eatingHabit: $request->input('eatingHabit'),
|
eatingHabit: $request->input('eatingHabit'),
|
||||||
|
paymentMethod: $request->input('paymentMethod'),
|
||||||
allergies: $request->input('allergies'),
|
allergies: $request->input('allergies'),
|
||||||
intolerances: $request->input('intolerances'),
|
intolerances: $request->input('intolerances'),
|
||||||
medications: $request->input('medications'),
|
medications: $request->input('medications'),
|
||||||
@@ -43,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;
|
||||||
@@ -24,15 +25,19 @@ class SignupController extends CommonController {
|
|||||||
$availableEvents[] = $event->toResource()->toArray($request);
|
$availableEvents[] = $event->toResource()->toArray($request);
|
||||||
};
|
};
|
||||||
|
|
||||||
$event = $this->events->getByIdentifier($eventId, false)?->toResource()->toArray($request);
|
$eventModel = $this->events->getByIdentifier($eventId, false);
|
||||||
|
$event = $eventModel?->toResource()->toArray($request);
|
||||||
|
// Die (aktiven) Zahlungsmethoden stehen dem Frontend über $event['paymentMethods'] zur Verfügung;
|
||||||
|
// die Auswahl trifft der/die Teilnehmer\*in im Anmeldeschritt "Zahlungsart".
|
||||||
|
|
||||||
$participantData = [
|
$participantData = [
|
||||||
'firstname' => '',
|
'firstname' => '',
|
||||||
'lastname' => '',
|
'lastname' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (auth()->check()) {
|
$currentUser = currentUser();
|
||||||
$user = new UserResource(auth()->user())->toArray($request);
|
if ($currentUser !== null) {
|
||||||
|
$user = new UserResource($currentUser)->toArray($request);
|
||||||
|
|
||||||
$participantData = [
|
$participantData = [
|
||||||
'id' => $user['id'],
|
'id' => $user['id'],
|
||||||
@@ -68,6 +73,11 @@ class SignupController extends CommonController {
|
|||||||
|
|
||||||
public function signUp(int $eventId, Request $request) {
|
public function signUp(int $eventId, Request $request) {
|
||||||
$event = $this->events->getById($eventId, false);
|
$event = $this->events->getById($eventId, false);
|
||||||
|
|
||||||
|
if (!$event->registration_allowed || new \DateTime() > $event->start_date) {
|
||||||
|
return response()->json(['status' => 'closed'], 403);
|
||||||
|
}
|
||||||
|
|
||||||
$eventResource = $event->toResource();
|
$eventResource = $event->toResource();
|
||||||
$registrationData = $request->input('registration_data');
|
$registrationData = $request->input('registration_data');
|
||||||
$siblingReduction = $registrationData['sibling'] === 'true';
|
$siblingReduction = $registrationData['sibling'] === 'true';
|
||||||
@@ -96,6 +106,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,
|
||||||
@@ -131,12 +146,22 @@ class SignupController extends CommonController {
|
|||||||
$registrationData['anreise_essen'],
|
$registrationData['anreise_essen'],
|
||||||
$registrationData['abreise_essen'],
|
$registrationData['abreise_essen'],
|
||||||
$registrationData['anmerkungen'],
|
$registrationData['anmerkungen'],
|
||||||
$amount
|
$amount,
|
||||||
|
$registrationData['paymentMethod'] ?? null,
|
||||||
|
(array)($registrationData['paymentOptions'] ?? []),
|
||||||
|
(array)($registrationData['participationOptions'] ?? []),
|
||||||
|
$addonResolution['items'],
|
||||||
|
$registrationData['beitrag'],
|
||||||
|
$siblingReduction,
|
||||||
);
|
);
|
||||||
|
|
||||||
$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
|
||||||
|
|
||||||
|
|
||||||
@@ -170,14 +195,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'));
|
||||||
$request->input('participationType'),
|
|
||||||
$request->input('beitrag'),
|
$baseFee = $event->calculateAmount(
|
||||||
\DateTime::createFromFormat('Y-m-d', $request->input('arrival')),
|
$request->input('participationType'),
|
||||||
\DateTime::createFromFormat('Y-m-d', $request->input('departure')),
|
$request->input('beitrag'),
|
||||||
$siblingReduction
|
$arrival,
|
||||||
)->toString()
|
$departure,
|
||||||
|
$siblingReduction
|
||||||
|
);
|
||||||
|
|
||||||
|
// 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']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use App\Domains\Event\Controllers\ArchivedEventsController;
|
|||||||
use App\Domains\Event\Controllers\AvailableEventsController;
|
use App\Domains\Event\Controllers\AvailableEventsController;
|
||||||
use App\Domains\Event\Controllers\CreateController;
|
use App\Domains\Event\Controllers\CreateController;
|
||||||
use App\Domains\Event\Controllers\DetailsController;
|
use App\Domains\Event\Controllers\DetailsController;
|
||||||
|
use App\Domains\Event\Controllers\IncomeSurplusStatementController;
|
||||||
use App\Domains\Event\Controllers\SignupController;
|
use App\Domains\Event\Controllers\SignupController;
|
||||||
use App\Middleware\IdentifyTenant;
|
use App\Middleware\IdentifyTenant;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
@@ -18,6 +19,10 @@ Route::middleware(IdentifyTenant::class)->group(function () {
|
|||||||
|
|
||||||
Route::middleware(['auth'])->group(function () {
|
Route::middleware(['auth'])->group(function () {
|
||||||
Route::get('/details/{eventId}', DetailsController::class);
|
Route::get('/details/{eventId}', DetailsController::class);
|
||||||
|
|
||||||
|
// Vor der Wildcard darunter: Sonst greift `downloadPdfList()` und sucht ein Blade namens
|
||||||
|
// `income-surplus-statement` mit Teilnehmendendaten, die die EÜR gar nicht braucht.
|
||||||
|
Route::get('/details/{eventId}/pdf/income-surplus-statement', IncomeSurplusStatementController::class);
|
||||||
Route::get('/details/{eventId}/pdf/{listType}', [DetailsController::class, 'downloadPdfList']);
|
Route::get('/details/{eventId}/pdf/{listType}', [DetailsController::class, 'downloadPdfList']);
|
||||||
Route::get('/details/{eventId}/csv/{listType}', [DetailsController::class, 'downloadCsvList']);
|
Route::get('/details/{eventId}/csv/{listType}', [DetailsController::class, 'downloadCsvList']);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
eventRegistrationFinalEnd: '',
|
eventRegistrationFinalEnd: '',
|
||||||
eventAccount: props.eventAccount ? props.eventAccount : '',
|
eventAccount: props.eventAccount ? props.eventAccount : '',
|
||||||
eventIban: props.eventIban ? props.eventIban : '',
|
eventIban: props.eventIban ? props.eventIban : '',
|
||||||
eventPayDirectly: true,
|
|
||||||
eventPayPerDay: props.eventPayPerDay ? props.eventPayPerDay : false,
|
eventPayPerDay: props.eventPayPerDay ? props.eventPayPerDay : false,
|
||||||
eventParticipationFeeType: props.participationFeeType ? props.participationFeeType : 'fixed',
|
eventParticipationFeeType: props.participationFeeType ? props.participationFeeType : 'fixed',
|
||||||
});
|
});
|
||||||
@@ -154,7 +153,6 @@
|
|||||||
eventRegistrationFinalEnd: formData.eventRegistrationFinalEnd,
|
eventRegistrationFinalEnd: formData.eventRegistrationFinalEnd,
|
||||||
eventAccount: formData.eventAccount,
|
eventAccount: formData.eventAccount,
|
||||||
eventIban: formData.eventIban,
|
eventIban: formData.eventIban,
|
||||||
eventPayDirectly: formData.eventPayDirectly,
|
|
||||||
eventPayPerDay: formData.eventPayPerDay,
|
eventPayPerDay: formData.eventPayPerDay,
|
||||||
eventParticipationFeeType: formData.eventParticipationFeeType,
|
eventParticipationFeeType: formData.eventParticipationFeeType,
|
||||||
}
|
}
|
||||||
@@ -262,13 +260,6 @@
|
|||||||
<ErrorText :message="errors.eventIban" /></td>
|
<ErrorText :message="errors.eventIban" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr style="vertical-align: top;">
|
|
||||||
<td colspan="2" style="font-weight: bold;">
|
|
||||||
<input type="checkbox" v-model="formData.eventPayDirectly">
|
|
||||||
Teilnehmende zahlen direkt aufs Veranstaltungskonto
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr style="vertical-align: top;">
|
<tr style="vertical-align: top;">
|
||||||
<td colspan="2" style="font-weight: bold;">
|
<td colspan="2" style="font-weight: bold;">
|
||||||
<input type="checkbox" v-model="formData.eventPayPerDay">
|
<input type="checkbox" v-model="formData.eventPayPerDay">
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
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 {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";
|
||||||
|
|
||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
const dynmicProps = reactive({
|
const dynmicProps = reactive({
|
||||||
localGroups: [],
|
localGroups: [],
|
||||||
eatingHabits:[]
|
eatingHabits:[],
|
||||||
});
|
});
|
||||||
|
|
||||||
const contributingLocalGroups = ref([])
|
const contributingLocalGroups = ref([])
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
toast.success('Einstellungen wurden erfolgreich gespeichert.')
|
toast.success('Einstellungen wurden erfolgreich gespeichert.')
|
||||||
emit('close')
|
emit('close')
|
||||||
} else {
|
} else {
|
||||||
toast.error('Beim Speichern ist ein Fehler aufgetreten.')
|
toast.error(response.message ?? 'Beim Speichern ist ein Fehler aufgetreten.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,15 +1,17 @@
|
|||||||
<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 ParticipationSummary from "./ParticipationSummary.vue";
|
import ParticipationOptions from "./ParticipationOptions.vue";
|
||||||
import CommonSettings from "./CommonSettings.vue";
|
import EventAddons from "./EventAddons.vue";
|
||||||
import EventManagement from "./EventManagement.vue";
|
import ParticipationSummary from "./ParticipationSummary.vue";
|
||||||
import Modal from "../../../../Views/Components/Modal.vue";
|
import CommonSettings from "./CommonSettings.vue";
|
||||||
import MailCompose from "./MailCompose.vue";
|
import EventManagement from "./EventManagement.vue";
|
||||||
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
import Modal from "../../../../Views/Components/Modal.vue";
|
||||||
import {toast} from "vue3-toastify";
|
import MailCompose from "./MailCompose.vue";
|
||||||
|
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
||||||
|
import {toast} from "vue3-toastify";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: Object,
|
data: Object,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -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';
|
||||||
}
|
}
|
||||||
@@ -96,6 +106,10 @@
|
|||||||
<input type="button" value="Beitragsliste (PDF)" />
|
<input type="button" value="Beitragsliste (PDF)" />
|
||||||
</a><br/>
|
</a><br/>
|
||||||
|
|
||||||
|
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/income-surplus-statement'">
|
||||||
|
<input type="button" value="EüR (PDF)" />
|
||||||
|
</a><br/>
|
||||||
|
|
||||||
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/drinking-list'">
|
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/drinking-list'">
|
||||||
<input type="button" value="Getränkeliste (PDF)" />
|
<input type="button" value="Getränkeliste (PDF)" />
|
||||||
</a><br/>
|
</a><br/>
|
||||||
@@ -107,6 +121,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" />
|
||||||
|
|
||||||
@@ -130,6 +147,10 @@
|
|||||||
<input type="button" value="Beitragsliste (PDF)" />
|
<input type="button" value="Beitragsliste (PDF)" />
|
||||||
</a><br/>
|
</a><br/>
|
||||||
|
|
||||||
|
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/income-surplus-statement'">
|
||||||
|
<input type="button" value="EüR (PDF)" />
|
||||||
|
</a><br/>
|
||||||
|
|
||||||
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/drinking-list'">
|
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/drinking-list'">
|
||||||
<input type="button" value="Getränkeliste (PDF)" />
|
<input type="button" value="Getränkeliste (PDF)" />
|
||||||
</a><br/>
|
</a><br/>
|
||||||
@@ -185,7 +206,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,7 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, reactive, watch} from "vue";
|
import {computed, onMounted, reactive, ref, watch} from "vue";
|
||||||
|
import {toast} from "vue3-toastify";
|
||||||
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";
|
||||||
|
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
||||||
|
|
||||||
|
const {download} = useAjax();
|
||||||
|
|
||||||
const staticProps = defineProps({
|
const staticProps = defineProps({
|
||||||
editMode: Boolean,
|
editMode: Boolean,
|
||||||
@@ -49,6 +53,7 @@ const form = reactive({
|
|||||||
departure: '',
|
departure: '',
|
||||||
participationType: '',
|
participationType: '',
|
||||||
eatingHabit: '',
|
eatingHabit: '',
|
||||||
|
paymentMethod: '',
|
||||||
allergies: '',
|
allergies: '',
|
||||||
intolerances: '',
|
intolerances: '',
|
||||||
medications: '',
|
medications: '',
|
||||||
@@ -59,8 +64,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) => {
|
||||||
@@ -82,6 +106,7 @@ watch(
|
|||||||
form.departure = participant?.departureDate ?? '';
|
form.departure = participant?.departureDate ?? '';
|
||||||
form.participationType = participant?.participation_type ?? '';
|
form.participationType = participant?.participation_type ?? '';
|
||||||
form.eatingHabit = participant?.eating_habit ?? '';
|
form.eatingHabit = participant?.eating_habit ?? '';
|
||||||
|
form.paymentMethod = participant?.payment_method ?? '';
|
||||||
form.allergies = participant?.allergies ?? '';
|
form.allergies = participant?.allergies ?? '';
|
||||||
form.intolerances = participant?.intolerances ?? '';
|
form.intolerances = participant?.intolerances ?? '';
|
||||||
form.medications = participant?.medications ?? '';
|
form.medications = participant?.medications ?? '';
|
||||||
@@ -92,6 +117,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 }
|
||||||
);
|
);
|
||||||
@@ -119,6 +150,31 @@ function enableEditMode() {
|
|||||||
emit('editParticipant');
|
emit('editParticipant');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rechnung über den Teilnahmebeitrag herunterladen. Sie wird bei jedem Klick neu erzeugt und trägt immer
|
||||||
|
* dieselbe, aus Veranstaltung und Position des Teilis abgeleitete Nummer.
|
||||||
|
*
|
||||||
|
* Bei einem Beitrag von 0 € gibt es nichts zu berechnen -- dann entfällt der Knopf.
|
||||||
|
*/
|
||||||
|
const creatingInvoice = ref(false)
|
||||||
|
|
||||||
|
const hasAmount = computed(() => Number(props.participant?.amountExpectedValue ?? 0) > 0)
|
||||||
|
|
||||||
|
async function downloadInvoice() {
|
||||||
|
creatingInvoice.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Der Dateiname (mit der Rechnungsnummer) kommt aus dem Content-Disposition-Header.
|
||||||
|
const ok = await download('/api/v1/participant-invoice/' + staticProps.participant.identifier)
|
||||||
|
|
||||||
|
if (!ok) {
|
||||||
|
toast.error('Die Rechnung konnte nicht erstellt werden.')
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
creatingInvoice.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function saveParticipant() {
|
function saveParticipant() {
|
||||||
emit('saveParticipant', { ...form });
|
emit('saveParticipant', { ...form });
|
||||||
close();
|
close();
|
||||||
@@ -206,7 +262,7 @@ function saveParticipant() {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Telefon</th>
|
<th>Telefon</th>
|
||||||
<td>
|
<td>
|
||||||
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_1"</DialableTelephoneNumber>
|
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_1" />
|
||||||
<input v-else v-model="form.phone_1" type="text" />
|
<input v-else v-model="form.phone_1" type="text" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -230,7 +286,7 @@ function saveParticipant() {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Ansprechperson Telefon</th>
|
<th>Ansprechperson Telefon</th>
|
||||||
<td>
|
<td>
|
||||||
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_2"</DialableTelephoneNumber>
|
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_2" />
|
||||||
<input v-else v-model="form.phone_2" type="text" />
|
<input v-else v-model="form.phone_2" type="text" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -284,6 +340,20 @@ function saveParticipant() {
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Zahlungsmethode</th>
|
||||||
|
<td>
|
||||||
|
<span v-if="!staticProps.editMode">{{ props.participant.paymentMethod }}</span>
|
||||||
|
<select v-else v-model="form.paymentMethod">
|
||||||
|
<option
|
||||||
|
v-for="paymentMethod in staticProps.event.paymentMethods"
|
||||||
|
:value="paymentMethod.slug"
|
||||||
|
>
|
||||||
|
{{ paymentMethod.name }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>eFZ-Status</th>
|
<th>eFZ-Status</th>
|
||||||
<td>
|
<td>
|
||||||
@@ -307,6 +377,27 @@ function saveParticipant() {
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr v-if="props.participant.refund">
|
||||||
|
<th>Erstattung</th>
|
||||||
|
<td>
|
||||||
|
{{ props.participant.refund.amount }} – {{ props.participant.refund.reasonLabel }}<br />
|
||||||
|
<small v-if="props.participant.refund.status === 'pending'">
|
||||||
|
freigegeben am {{ props.participant.refund.releasedAt }}, wartet auf die
|
||||||
|
Bankverbindung des Teilis
|
||||||
|
</small>
|
||||||
|
<small v-else-if="props.participant.refund.status === 'accepted'">
|
||||||
|
bestätigt am {{ props.participant.refund.acceptedAt }}
|
||||||
|
</small>
|
||||||
|
|
||||||
|
<!-- Was beim Verband geblieben ist und warum. -->
|
||||||
|
<small v-if="props.participant.refund.hasRetention" class="retention-note">
|
||||||
|
<br />Einbehalten: {{ props.participant.refund.retainedAmount }} –
|
||||||
|
{{ props.participant.refund.retentionReasonLabel }}<template
|
||||||
|
v-if="props.participant.refund.retentionReasonNote"
|
||||||
|
> ({{ props.participant.refund.retentionReasonNote }})</template>
|
||||||
|
</small>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -372,6 +463,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>
|
||||||
@@ -379,6 +507,12 @@ function saveParticipant() {
|
|||||||
|
|
||||||
<button v-if="!props.participant.unregistered" class="button" @click="paymentComplete(props.participant)">Zahlung vollständig</button>
|
<button v-if="!props.participant.unregistered" class="button" @click="paymentComplete(props.participant)">Zahlung vollständig</button>
|
||||||
<button v-if="!props.participant.unregistered" class="button" @click="markCocExisting(props.participant)">eFZ liegt vor</button>
|
<button v-if="!props.participant.unregistered" class="button" @click="markCocExisting(props.participant)">eFZ liegt vor</button>
|
||||||
|
<button
|
||||||
|
v-if="!props.participant.unregistered && hasAmount"
|
||||||
|
class="button"
|
||||||
|
:disabled="creatingInvoice"
|
||||||
|
@click="downloadInvoice"
|
||||||
|
>{{ creatingInvoice ? 'Wird erstellt…' : 'Rechnung erstellen' }}</button>
|
||||||
<button v-if="!props.participant.unregistered" class="button" @click="cancelParticipation(props.participant)">Abmelden</button>
|
<button v-if="!props.participant.unregistered" class="button" @click="cancelParticipation(props.participant)">Abmelden</button>
|
||||||
<button class="button" @click="close">Schließen</button>
|
<button class="button" @click="close">Schließen</button>
|
||||||
|
|
||||||
@@ -391,6 +525,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;
|
||||||
@@ -411,4 +549,8 @@ textarea {
|
|||||||
select {
|
select {
|
||||||
width: 262px;
|
width: 262px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.retention-note {
|
||||||
|
color: #8a6d00;
|
||||||
|
}
|
||||||
</style>
|
</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
|
||||||
|
// 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>
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref } from "vue";
|
import {computed, reactive, ref} from "vue";
|
||||||
import Modal from "../../../../Views/Components/Modal.vue";
|
import Modal from "../../../../Views/Components/Modal.vue";
|
||||||
import ParticipantData from "./ParticipantData.vue";
|
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";
|
||||||
|
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
||||||
|
import IbanInput from "../../../../Views/Components/IbanInput.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
@@ -20,11 +22,16 @@ 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");
|
||||||
|
|
||||||
const { request } = useAjax();
|
const { request, download } = useAjax();
|
||||||
|
|
||||||
const searchTerms = reactive({});
|
const searchTerms = reactive({});
|
||||||
const selectedStatuses = reactive({});
|
const selectedStatuses = reactive({});
|
||||||
@@ -39,6 +46,86 @@ const mailCompose = ref(false);
|
|||||||
|
|
||||||
const openCancelDialog = ref(false);
|
const openCancelDialog = ref(false);
|
||||||
const openPartialPaymentDialogSwitch = ref(false);
|
const openPartialPaymentDialogSwitch = ref(false);
|
||||||
|
const openRefundDialogSwitch = ref(false);
|
||||||
|
|
||||||
|
// Der Erstattungsdialog. `captureMode` steuert den Weg: 'participant' schickt dem Teili einen Link, über
|
||||||
|
// den er seine Bankverbindung selbst einträgt; 'management' heißt, sie liegt der Aktionsleitung bereits
|
||||||
|
// vor -- dann wird die Erstattung sofort eingereicht.
|
||||||
|
const refundForm = reactive({
|
||||||
|
amount: '', reason: '', reasonNote: '',
|
||||||
|
captureMode: 'participant', accountOwner: '', accountIban: '',
|
||||||
|
retentionReason: '', retentionReasonNote: '',
|
||||||
|
});
|
||||||
|
const refundErrors = reactive({amount: '', reason: '', reasonNote: '', accountOwner: '', accountIban: ''});
|
||||||
|
const refundReasons = ref([]);
|
||||||
|
const retentionReasons = ref([]);
|
||||||
|
const refundSaving = ref(false);
|
||||||
|
|
||||||
|
const selectedRefundReason = computed(
|
||||||
|
() => refundReasons.value.find(r => r.value === refundForm.reason) ?? null
|
||||||
|
);
|
||||||
|
|
||||||
|
const selectedRetentionReason = computed(
|
||||||
|
() => retentionReasons.value.find(r => r.value === refundForm.retentionReason) ?? null
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Was nach der Erstattung beim Verband bleibt -- die Grundlage für den Einbehaltungsblock. */
|
||||||
|
const retainedAmount = computed(() => {
|
||||||
|
const paid = Number(showParticipant.value?.amountPaidValue ?? 0);
|
||||||
|
const refunded = Number((refundForm.amount ?? '').replace(',', '.'));
|
||||||
|
|
||||||
|
if (!Number.isFinite(refunded)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const remaining = Math.round((paid - refunded) * 100) / 100;
|
||||||
|
|
||||||
|
return remaining > 0.005 ? remaining : 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
const hasRetention = computed(() => retainedAmount.value > 0);
|
||||||
|
|
||||||
|
const retainedAmountReadable = computed(
|
||||||
|
() => retainedAmount.value.toFixed(2).replace('.', ',') + ' Euro'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ob abgesendet werden kann. Der Knopf erscheint erst dann -- was noch fehlt, soll die Aktionsleitung
|
||||||
|
* sehen, bevor sie klickt, statt danach eine Fehlermeldung zu lesen.
|
||||||
|
*/
|
||||||
|
const refundFormComplete = computed(() => {
|
||||||
|
const amount = Number((refundForm.amount ?? '').replace(',', '.'));
|
||||||
|
const paid = Number(showParticipant.value?.amountPaidValue ?? 0);
|
||||||
|
|
||||||
|
if (!refundForm.amount || !(amount > 0) || amount > paid + 0.005) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!refundForm.reason) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedRefundReason.value?.requiresNote && !refundForm.reasonNote.trim()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bleibt etwas beim Verband, muss begründet sein, warum.
|
||||||
|
if (hasRetention.value) {
|
||||||
|
if (!refundForm.retentionReason) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedRetentionReason.value?.requiresNote && !refundForm.retentionReasonNote.trim()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (refundForm.captureMode === 'management') {
|
||||||
|
return refundForm.accountOwner.trim() !== '' && refundForm.accountIban.trim() !== '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
defineEmits(['showParticipantDetails', 'markCocExisting', 'paymentComplete'])
|
defineEmits(['showParticipantDetails', 'markCocExisting', 'paymentComplete'])
|
||||||
|
|
||||||
@@ -287,6 +374,136 @@ async function execPartialPayment() {
|
|||||||
openPartialPaymentDialogSwitch.value = false;
|
openPartialPaymentDialogSwitch.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstattung freigeben.
|
||||||
|
*
|
||||||
|
* Der Betrag ist mit dem vor, was der Teili gezahlt hat -- das ist der Regelfall; Abzüge trägt die
|
||||||
|
* Aktionsleitung von Hand ein.
|
||||||
|
*/
|
||||||
|
async function openRefundDialog(participant) {
|
||||||
|
showParticipant.value = participant;
|
||||||
|
|
||||||
|
refundForm.amount = participant.amountPaid?.short ?? '';
|
||||||
|
refundForm.reason = '';
|
||||||
|
refundForm.reasonNote = '';
|
||||||
|
// Vorgabe ist der übliche Weg über den Teili.
|
||||||
|
refundForm.captureMode = 'participant';
|
||||||
|
refundForm.accountOwner = '';
|
||||||
|
refundForm.accountIban = '';
|
||||||
|
refundForm.retentionReason = '';
|
||||||
|
refundForm.retentionReasonNote = '';
|
||||||
|
|
||||||
|
Object.keys(refundErrors).forEach(key => refundErrors[key] = '');
|
||||||
|
|
||||||
|
if (refundReasons.value.length === 0) {
|
||||||
|
const reasons = await request('/api/v1/core/retrieve-refund-reasons', {method: 'GET'});
|
||||||
|
refundReasons.value = reasons ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retentionReasons.value.length === 0) {
|
||||||
|
const reasons = await request('/api/v1/core/retrieve-retention-reasons', {method: 'GET'});
|
||||||
|
retentionReasons.value = reasons ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
openRefundDialogSwitch.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateRefund() {
|
||||||
|
const amount = Number((refundForm.amount ?? '').replace(',', '.'));
|
||||||
|
const paid = Number(showParticipant.value?.amountPaidValue ?? 0);
|
||||||
|
|
||||||
|
Object.keys(refundErrors).forEach(key => refundErrors[key] = '');
|
||||||
|
|
||||||
|
if (!refundForm.amount || !(amount > 0)) {
|
||||||
|
refundErrors.amount = 'Bitte gib einen Betrag größer als 0 ein.';
|
||||||
|
} else if (amount > paid + 0.005) {
|
||||||
|
refundErrors.amount = 'Mehr als der gezahlte Beitrag kann nicht erstattet werden.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!refundForm.reason) {
|
||||||
|
refundErrors.reason = 'Bitte wähle einen Grund aus.';
|
||||||
|
} else if (selectedRefundReason.value?.requiresNote && !refundForm.reasonNote.trim()) {
|
||||||
|
refundErrors.reasonNote = 'Bitte erläutere den Grund.';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Beim Direktweg wird sofort eingereicht -- danach gibt es keine Gelegenheit mehr zu berichtigen.
|
||||||
|
// Ob die IBAN wirklich stimmt, prüft der Server mit Prüfziffer und länderabhängiger Länge.
|
||||||
|
if (refundForm.captureMode === 'management') {
|
||||||
|
if (!refundForm.accountOwner.trim()) {
|
||||||
|
refundErrors.accountOwner = 'Bitte gib an, wem das Konto gehört.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!refundForm.accountIban.trim()) {
|
||||||
|
refundErrors.accountIban = 'Bitte gib die IBAN des Kontos ein.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.values(refundErrors).every(message => !message);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function execRefund() {
|
||||||
|
if (!validateRefund() || refundSaving.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
refundSaving.value = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await request('/api/v1/participant-refund/' + showParticipant.value.identifier + '/release', {
|
||||||
|
method: "POST",
|
||||||
|
body: {
|
||||||
|
amount: refundForm.amount,
|
||||||
|
reason: refundForm.reason,
|
||||||
|
reasonNote: refundForm.reasonNote,
|
||||||
|
// Leer beim Weg über den Teili -- dann verschickt der Server nur den Link.
|
||||||
|
accountOwner: refundForm.captureMode === 'management' ? refundForm.accountOwner : '',
|
||||||
|
accountIban: refundForm.captureMode === 'management' ? refundForm.accountIban : '',
|
||||||
|
// Leer bei voller Erstattung -- dann gibt es nichts zu begründen.
|
||||||
|
retentionReason: hasRetention.value ? refundForm.retentionReason : '',
|
||||||
|
retentionReasonNote: hasRetention.value ? refundForm.retentionReasonNote : '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data?.status === 'success') {
|
||||||
|
toast.success(data.message);
|
||||||
|
// Reaktiv statt per getElementById: die Meta-Zeile hängt am Vorgang und wechselt mit ihm.
|
||||||
|
// Beim Direktweg steht dort sofort "Erstattet" samt Abrechnungsnummer.
|
||||||
|
showParticipant.value.refund = data.refund;
|
||||||
|
// Der gezahlte Beitrag wird beim Einreichen auf 0 gesetzt -- sonst zeigte die Zeile weiter
|
||||||
|
// den alten Stand, bis jemand neu lädt.
|
||||||
|
if (data.refund?.status === 'accepted') {
|
||||||
|
showParticipant.value.amountPaidValue = 0;
|
||||||
|
}
|
||||||
|
openRefundDialogSwitch.value = false;
|
||||||
|
} else {
|
||||||
|
toast.error(data?.message ?? 'Die Erstattung konnte nicht freigegeben werden.');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
refundSaving.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function execCancelRefund(participant) {
|
||||||
|
const data = await request('/api/v1/participant-refund/' + participant.refund.token + '/cancel', {
|
||||||
|
method: "POST",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data?.status === 'success') {
|
||||||
|
toast.success(data.message);
|
||||||
|
participant.refund = null;
|
||||||
|
} else {
|
||||||
|
toast.error(data?.message ?? 'Die Erstattung konnte nicht abgebrochen werden.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function downloadRefundDocument(participant) {
|
||||||
|
const ok = await download('/api/v1/participant-refund/' + participant.refund.token + '/document');
|
||||||
|
|
||||||
|
if (!ok) {
|
||||||
|
toast.error('Der Beleg konnte nicht erstellt werden.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const mailToType = ref('')
|
const mailToType = ref('')
|
||||||
const recipientIdentifier = ref('')
|
const recipientIdentifier = ref('')
|
||||||
|
|
||||||
@@ -339,11 +556,28 @@ function mailToGroup(groupKey) {
|
|||||||
<td class="pl-amount" :id="'participant-' + participant.identifier +'-payment'" :class="participant.amount_left_value != 0 && !participant.unregistered ? 'not-paid' : ''">
|
<td class="pl-amount" :id="'participant-' + participant.identifier +'-payment'" :class="participant.amount_left_value != 0 && !participant.unregistered ? 'not-paid' : ''">
|
||||||
Gezahlt: <label :id="'participant-' + participant.identifier + '-paid'">{{ participant?.amountPaid.readable }}</label> /<br />
|
Gezahlt: <label :id="'participant-' + participant.identifier + '-paid'">{{ participant?.amountPaid.readable }}</label> /<br />
|
||||||
Gesamt: <label :id="'participant-' + participant.identifier + '-expected'">{{ participant?.amountExpected.readable }}</label>
|
Gesamt: <label :id="'participant-' + participant.identifier + '-expected'">{{ participant?.amountExpected.readable }}</label>
|
||||||
|
|
||||||
|
<!-- Warum ein Teil des Beitrags beim Verband geblieben ist. -->
|
||||||
|
<span v-if="participant.refund?.hasRetention" class="retention-note">
|
||||||
|
Einbehalten: {{ participant.refund.retainedAmount }}<br />
|
||||||
|
{{ participant.refund.retentionReasonLabel }}<template
|
||||||
|
v-if="participant.refund.retentionReasonNote"
|
||||||
|
> – {{ participant.refund.retentionReasonNote }}</template>
|
||||||
|
</span>
|
||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<span v-if="participant.amount_left_value != 0 && !participant.unregistered" :id="'participant-' + participant.identifier + '-actions'">
|
<span v-if="participant.amount_left_value != 0 && !participant.unregistered" :id="'participant-' + participant.identifier + '-actions'">
|
||||||
<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">
|
||||||
@@ -382,6 +616,30 @@ function mailToGroup(groupKey) {
|
|||||||
<span class="link">E-Mail senden</span> |
|
<span class="link">E-Mail senden</span> |
|
||||||
<span @click="openCancelParticipationDialog(participant)" v-if="!participant.unregistered" class="link" style="color: #da7070;">Abmelden</span>
|
<span @click="openCancelParticipationDialog(participant)" v-if="!participant.unregistered" class="link" style="color: #da7070;">Abmelden</span>
|
||||||
<span v-else class="link" @click="execResignonParticipant(participant)" style="color: #3cb62e;">Wieder anmelden</span>
|
<span v-else class="link" @click="execResignonParticipant(participant)" style="color: #3cb62e;">Wieder anmelden</span>
|
||||||
|
|
||||||
|
<!-- Erstattung: erst der Einstieg, danach der Zustand des Vorgangs. -->
|
||||||
|
<template v-if="participant.unregistered">
|
||||||
|
<span
|
||||||
|
v-if="!participant.refund && Number(participant.amountPaidValue ?? 0) > 0"
|
||||||
|
class="link"
|
||||||
|
style="color: #da7070;"
|
||||||
|
@click="openRefundDialog(participant)"
|
||||||
|
> | Beitrag erstatten</span>
|
||||||
|
|
||||||
|
<template v-else-if="participant.refund?.status === 'pending'">
|
||||||
|
| <strong>Erstattung offen:</strong> {{ participant.refund.amount }},
|
||||||
|
wartet auf Bankverbindung
|
||||||
|
<span class="link" style="color: #da7070;" @click="execCancelRefund(participant)">Abbrechen</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="participant.refund?.status === 'accepted'">
|
||||||
|
| <strong>Erstattet:</strong> {{ participant.refund.amount }}
|
||||||
|
<template v-if="participant.refund.invoiceNumber">
|
||||||
|
· Abrechnung {{ participant.refund.invoiceNumber }}
|
||||||
|
</template>
|
||||||
|
<span class="link" @click="downloadRefundDocument(participant)">Beleg</span>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
@@ -396,7 +654,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>
|
||||||
@@ -446,6 +705,124 @@ function mailToGroup(groupKey) {
|
|||||||
<button class="button" @click="execPartialPayment()">Teilbetrag buchen</button>
|
<button class="button" @click="execPartialPayment()">Teilbetrag buchen</button>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
:show="openRefundDialogSwitch"
|
||||||
|
title="Beitrag erstatten"
|
||||||
|
width="480px"
|
||||||
|
@close="openRefundDialogSwitch = false"
|
||||||
|
>
|
||||||
|
<p class="refund-intro">
|
||||||
|
{{ showParticipant?.fullname }} hat
|
||||||
|
<strong>{{ showParticipant?.amountPaid?.readable }}</strong> gezahlt.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="refund-field">
|
||||||
|
<label for="refund_amount">Zu erstattender Betrag</label>
|
||||||
|
<div>
|
||||||
|
<AmountInput id="refund_amount" v-model="refundForm.amount" style="width: 100px !important;" /> Euro
|
||||||
|
</div>
|
||||||
|
<ErrorText :message="refundErrors.amount" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="refund-field">
|
||||||
|
<label for="refund_reason">Grund</label>
|
||||||
|
<select id="refund_reason" v-model="refundForm.reason" class="form-input">
|
||||||
|
<option value="">Bitte auswählen …</option>
|
||||||
|
<option v-for="reason in refundReasons" :key="reason.value" :value="reason.value">
|
||||||
|
{{ reason.label }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<ErrorText :message="refundErrors.reason" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="selectedRefundReason?.requiresNote" class="refund-field">
|
||||||
|
<label for="refund_reason_note">Erläuterung</label>
|
||||||
|
<textarea id="refund_reason_note" v-model="refundForm.reasonNote" class="form-input" rows="3"></textarea>
|
||||||
|
<ErrorText :message="refundErrors.reasonNote" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Bleibt ein Teil beim Verband, muss begründet sein, warum -- ein einbehaltener Betrag ohne
|
||||||
|
Grund ist in der Buchhaltung nicht haltbar. Bei voller Erstattung gibt es nichts zu zeigen.
|
||||||
|
-->
|
||||||
|
<template v-if="hasRetention">
|
||||||
|
<p class="refund-hint">
|
||||||
|
<strong>{{ retainedAmountReadable }}</strong> verbleiben beim Verband.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="refund-field">
|
||||||
|
<label for="refund_retention_reason">Grund der Einbehaltung</label>
|
||||||
|
<select id="refund_retention_reason" v-model="refundForm.retentionReason" class="form-input">
|
||||||
|
<option value="">Bitte auswählen …</option>
|
||||||
|
<option v-for="reason in retentionReasons" :key="reason.value" :value="reason.value">
|
||||||
|
{{ reason.label }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="selectedRetentionReason?.requiresNote" class="refund-field">
|
||||||
|
<label for="refund_retention_note">Erläuterung zur Einbehaltung</label>
|
||||||
|
<textarea
|
||||||
|
id="refund_retention_note"
|
||||||
|
v-model="refundForm.retentionReasonNote"
|
||||||
|
class="form-input"
|
||||||
|
rows="3"
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Liegt die Bankverbindung schon vor, entfällt der Umweg über den Teili: die Erstattung wird
|
||||||
|
sofort eingereicht. Er bekommt den Beleg trotzdem.
|
||||||
|
-->
|
||||||
|
<div class="refund-field">
|
||||||
|
<label class="refund-choice">
|
||||||
|
<input type="radio" value="participant" v-model="refundForm.captureMode" />
|
||||||
|
Teilnehmer*in trägt die Bankverbindung selbst ein
|
||||||
|
</label>
|
||||||
|
<label class="refund-choice">
|
||||||
|
<input type="radio" value="management" v-model="refundForm.captureMode" />
|
||||||
|
Bankverbindung liegt mir vor
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="refundForm.captureMode === 'management'">
|
||||||
|
<div class="refund-field">
|
||||||
|
<label for="refund_account_owner">Kontoinhaber*in</label>
|
||||||
|
<input
|
||||||
|
id="refund_account_owner"
|
||||||
|
v-model="refundForm.accountOwner"
|
||||||
|
type="text"
|
||||||
|
class="form-input"
|
||||||
|
/>
|
||||||
|
<ErrorText :message="refundErrors.accountOwner" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="refund-field">
|
||||||
|
<label for="refund_account_iban">IBAN</label>
|
||||||
|
<IbanInput id="refund_account_iban" v-model="refundForm.accountIban" class="form-input" />
|
||||||
|
<ErrorText :message="refundErrors.accountIban" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="refund-hint">
|
||||||
|
Die Erstattung wird sofort als Abrechnung eingereicht. Der Teili erhält den Beleg per
|
||||||
|
E-Mail und kann die Angaben prüfen.
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Erscheint erst, wenn alles ausgefüllt ist; während des Speicherns gesperrt statt weg. -->
|
||||||
|
<button
|
||||||
|
v-if="refundFormComplete"
|
||||||
|
class="button"
|
||||||
|
:disabled="refundSaving"
|
||||||
|
@click="execRefund()"
|
||||||
|
>
|
||||||
|
<template v-if="refundSaving">Wird gespeichert…</template>
|
||||||
|
<template v-else-if="refundForm.captureMode === 'management'">Erstattung einreichen</template>
|
||||||
|
<template v-else>Erstattung freigeben</template>
|
||||||
|
</button>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<FullScreenModal
|
<FullScreenModal
|
||||||
:show="mailCompose"
|
:show="mailCompose"
|
||||||
title="E-Mail senden"
|
title="E-Mail senden"
|
||||||
@@ -459,6 +836,58 @@ function mailToGroup(groupKey) {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.refund-intro {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund-field {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund-field label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund-field select,
|
||||||
|
.refund-field textarea,
|
||||||
|
.refund-field .form-input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund-choice {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #1a1a1a;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund-choice input {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retention-note {
|
||||||
|
display: block;
|
||||||
|
margin-top: 6px;
|
||||||
|
font-size: 10pt;
|
||||||
|
color: #ca5a0a;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refund-hint {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-left: 3px solid #f5c400;
|
||||||
|
background-color: #fffef5;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
.participants-table {
|
.participants-table {
|
||||||
width: 95%;
|
width: 95%;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
|
|||||||
@@ -1,16 +1,59 @@
|
|||||||
<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 {toast} from "vue3-toastify";
|
import TextEditor from "../../../../Views/Components/TextEditor.vue";
|
||||||
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
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 {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||||
|
|
||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
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>
|
||||||
@@ -68,6 +68,17 @@ const props = defineProps({
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Beiträge, die trotz Abmeldung beim Verband geblieben sind. Eigene Zeile, weil die
|
||||||
|
Zeilen darüber nur aktive Anmeldungen führen.
|
||||||
|
-->
|
||||||
|
<tr v-if="props.event.retainedFromUnregistered.value > 0">
|
||||||
|
<th style="padding-bottom: 20px" colspan="2">Einbehalten von Abmeldungen</th>
|
||||||
|
<td style="padding-bottom: 20px" colspan="2">
|
||||||
|
{{ props.event.retainedFromUnregistered.readable }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" style="border-width: 1px; border-top-style: solid">Gesamt</th>
|
<th colspan="2" style="border-width: 1px; border-top-style: solid">Gesamt</th>
|
||||||
<td style="font-weight: bold; border-width: 1px; border-top-style: solid">
|
<td style="font-weight: bold; border-width: 1px; border-top-style: solid">
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { useSignupForm } from './composables/useSignupForm.js'
|
import {useSignupForm} from './composables/useSignupForm.js'
|
||||||
import StepAge from './steps/StepAge.vue'
|
import StepAge from './steps/StepAge.vue'
|
||||||
import StepContactPerson from './steps/StepContactPerson.vue'
|
import StepContactPerson from './steps/StepContactPerson.vue'
|
||||||
import StepPersonalData from './steps/StepPersonalData.vue'
|
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'
|
||||||
@@ -22,7 +24,8 @@ 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,
|
||||||
|
summaryBaseAmount, summaryAddonLines
|
||||||
} = useSignupForm(props.event, props.participantData)
|
} = useSignupForm(props.event, props.participantData)
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
@@ -32,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>
|
||||||
|
|
||||||
@@ -91,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"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user