Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bef494fc4c |
@@ -23,6 +23,3 @@ Homestead.json
|
|||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
/docker-compose.yaml
|
/docker-compose.yaml
|
||||||
|
|
||||||
# HTML-Report von composer test:coverage
|
|
||||||
/storage/coverage
|
|
||||||
|
|||||||
-29010
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,87 +0,0 @@
|
|||||||
<?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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<?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,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?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;
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
<?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]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?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,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?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,8 +2,6 @@
|
|||||||
|
|
||||||
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)
|
||||||
@@ -17,14 +15,8 @@ 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,14 +12,6 @@ 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,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
namespace App\Domains\Admin\Actions\UpdateTenantTax;
|
namespace App\Domains\Admin\Actions\UpdateTenantTax;
|
||||||
|
|
||||||
use App\Enumerations\VatPricingMode;
|
use App\Enumerations\VatPricingMode;
|
||||||
use App\Models\Tenant;
|
|
||||||
use App\Support\Text;
|
|
||||||
|
|
||||||
class UpdateTenantTaxAction
|
class UpdateTenantTaxAction
|
||||||
{
|
{
|
||||||
@@ -16,23 +14,14 @@ class UpdateTenantTaxAction
|
|||||||
{
|
{
|
||||||
$response = new 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) {
|
if ($this->request->taxLiable) {
|
||||||
$this->request->tenant->update($this->withInvoiceDetails([
|
$this->request->tenant->update([
|
||||||
'tax_liable' => true,
|
'tax_liable' => true,
|
||||||
'vat_rate' => $this->clampVatRate($this->request->vatRate),
|
'vat_rate' => $this->clampVatRate($this->request->vatRate),
|
||||||
'vat_pricing_mode' => $this->request->vatPricingMode->value,
|
'vat_pricing_mode' => $this->request->vatPricingMode->value,
|
||||||
'tax_exemption_reason' => null,
|
'tax_exemption_reason' => null,
|
||||||
'tax_exemption_note' => null,
|
'tax_exemption_note' => null,
|
||||||
], $prefix));
|
]);
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
$response->message = 'Steuerinformationen wurden gespeichert.';
|
$response->message = 'Steuerinformationen wurden gespeichert.';
|
||||||
@@ -56,13 +45,13 @@ class UpdateTenantTaxAction
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->request->tenant->update($this->withInvoiceDetails([
|
$this->request->tenant->update([
|
||||||
'tax_liable' => false,
|
'tax_liable' => false,
|
||||||
'vat_rate' => 0,
|
'vat_rate' => 0,
|
||||||
'vat_pricing_mode' => VatPricingMode::Inclusive->value,
|
'vat_pricing_mode' => VatPricingMode::Inclusive->value,
|
||||||
'tax_exemption_reason' => $reason->slug,
|
'tax_exemption_reason' => $reason->slug,
|
||||||
'tax_exemption_note' => $reason->requires_note ? $note : null,
|
'tax_exemption_note' => $reason->requires_note ? $note : null,
|
||||||
], $prefix));
|
]);
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
$response->message = 'Steuerinformationen wurden gespeichert.';
|
$response->message = 'Steuerinformationen wurden gespeichert.';
|
||||||
@@ -74,31 +63,4 @@ class UpdateTenantTaxAction
|
|||||||
{
|
{
|
||||||
return max(0, min(100, $vatRate));
|
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,6 @@ class UpdateTenantTaxRequest
|
|||||||
public ?TaxExemptionReason $exemptionReason,
|
public ?TaxExemptionReason $exemptionReason,
|
||||||
public ?string $exemptionNote,
|
public ?string $exemptionNote,
|
||||||
public VatPricingMode $vatPricingMode,
|
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,
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
<?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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<?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,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<?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),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?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"',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<?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,13 +15,6 @@ 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,11 +20,6 @@ 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();
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ class ManagedTenantTaxGetController extends CommonController
|
|||||||
'tax_exemption_reason' => $tenant->tax_exemption_reason,
|
'tax_exemption_reason' => $tenant->tax_exemption_reason,
|
||||||
'tax_exemption_note' => $tenant->tax_exemption_note,
|
'tax_exemption_note' => $tenant->tax_exemption_note,
|
||||||
'vat_pricing_mode' => $tenant->vat_pricing_mode,
|
'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(),
|
'exemption_reasons' => TaxExemptionReason::options(),
|
||||||
'pricing_modes' => VatPricingMode::options(),
|
'pricing_modes' => VatPricingMode::options(),
|
||||||
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/tax',
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/tax',
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ class ManagedTenantTaxUpdateController extends CommonController
|
|||||||
exemptionReason: TaxExemptionReason::where('slug', $request->input('tax_exemption_reason'))->first(),
|
exemptionReason: TaxExemptionReason::where('slug', $request->input('tax_exemption_reason'))->first(),
|
||||||
exemptionNote: $request->input('tax_exemption_note'),
|
exemptionNote: $request->input('tax_exemption_note'),
|
||||||
vatPricingMode: VatPricingMode::tryFrom((string) $request->input('vat_pricing_mode', 'inclusive')) ?? VatPricingMode::Inclusive,
|
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();
|
$response = $action->execute();
|
||||||
|
|||||||
@@ -13,13 +13,6 @@ 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,11 +18,6 @@ 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();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace App\Domains\Admin\Controllers;
|
|||||||
use App\Models\AvailablePaymentMethod;
|
use App\Models\AvailablePaymentMethod;
|
||||||
use App\Resources\AvailablePaymentMethodResource;
|
use App\Resources\AvailablePaymentMethodResource;
|
||||||
use App\Scopes\CommonController;
|
use App\Scopes\CommonController;
|
||||||
use App\ValueObjects\BankStatementRuleset;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -17,10 +16,6 @@ class TenantPaymentMethodsGetController extends CommonController
|
|||||||
'paymentMethods' => AvailablePaymentMethod::all()
|
'paymentMethods' => AvailablePaymentMethod::all()
|
||||||
->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)),
|
->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)),
|
||||||
'saveEndpoint' => '/api/v1/admin/tenant/payment-methods',
|
'saveEndpoint' => '/api/v1/admin/tenant/payment-methods',
|
||||||
// Der app-weite Standard für das Kontoauszug-Format. Das Formular zeigt ihn als
|
|
||||||
// Vorbelegung an, damit erkennbar ist, wovon ein Override abweicht.
|
|
||||||
'statementRulesetDefault' => BankStatementRuleset::default()->toArray(),
|
|
||||||
'statementRulesetCharsets' => BankStatementRuleset::CHARSETS,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,6 @@ class TenantTaxGetController extends CommonController
|
|||||||
'tax_exemption_reason' => $this->tenant->tax_exemption_reason,
|
'tax_exemption_reason' => $this->tenant->tax_exemption_reason,
|
||||||
'tax_exemption_note' => $this->tenant->tax_exemption_note,
|
'tax_exemption_note' => $this->tenant->tax_exemption_note,
|
||||||
'vat_pricing_mode' => $this->tenant->vat_pricing_mode,
|
'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(),
|
'exemption_reasons' => TaxExemptionReason::options(),
|
||||||
'pricing_modes' => VatPricingMode::options(),
|
'pricing_modes' => VatPricingMode::options(),
|
||||||
'saveEndpoint' => '/api/v1/admin/tenant/tax',
|
'saveEndpoint' => '/api/v1/admin/tenant/tax',
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ class TenantTaxUpdateController extends CommonController
|
|||||||
exemptionReason: TaxExemptionReason::where('slug', $request->input('tax_exemption_reason'))->first(),
|
exemptionReason: TaxExemptionReason::where('slug', $request->input('tax_exemption_reason'))->first(),
|
||||||
exemptionNote: $request->input('tax_exemption_note'),
|
exemptionNote: $request->input('tax_exemption_note'),
|
||||||
vatPricingMode: VatPricingMode::tryFrom((string) $request->input('vat_pricing_mode', 'inclusive')) ?? VatPricingMode::Inclusive,
|
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();
|
$response = $action->execute();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class UserDetailGetController extends CommonController
|
|||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'user' => $userData,
|
'user' => $userData,
|
||||||
'isOwnUser' => currentUser()?->id === $user->id,
|
'isOwnUser' => auth()->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: currentUser()?->id,
|
currentUserId: auth()->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: currentUser()?->id === $user->id,
|
isOwnUser: auth()->id() === $user->id,
|
||||||
isLvTenant: $this->tenant->slug === 'lv',
|
isLvTenant: $this->tenant->slug === 'lv',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Domains\Admin\Controllers\DocumentAssetDeleteController;
|
|
||||||
use App\Domains\Admin\Controllers\DocumentAssetUpdateController;
|
|
||||||
use App\Domains\Admin\Controllers\DocumentTemplatesGetController;
|
|
||||||
use App\Domains\Admin\Controllers\DocumentTemplatesPreviewController;
|
|
||||||
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;
|
||||||
@@ -39,7 +34,6 @@ 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 () {
|
||||||
@@ -66,18 +60,6 @@ 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);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?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;
|
||||||
@@ -9,7 +8,6 @@ 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 () {
|
||||||
@@ -18,11 +16,6 @@ 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);
|
||||||
|
|||||||
@@ -1,666 +0,0 @@
|
|||||||
<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,17 +13,9 @@ 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 ?? '',
|
||||||
})
|
})
|
||||||
@@ -47,49 +39,16 @@ 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>
|
||||||
@@ -98,27 +57,6 @@ 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>
|
||||||
@@ -163,22 +101,6 @@ 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;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {computed, ref} from 'vue';
|
import {computed, ref} from 'vue';
|
||||||
import BankRulesetEditor from "../../../../Views/Components/BankRulesetEditor.vue";
|
|
||||||
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
||||||
import TextEditor from "../../../../Views/Components/TextEditor.vue";
|
import TextEditor from "../../../../Views/Components/TextEditor.vue";
|
||||||
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
|
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
|
||||||
@@ -103,10 +102,6 @@ async function save() {
|
|||||||
<RichSelectBox v-if="option.type === 'icon'" v-model="form.configuration[option.name]"
|
<RichSelectBox v-if="option.type === 'icon'" v-model="form.configuration[option.name]"
|
||||||
:options="PAYMENT_METHOD_ICONS" placeholder="Symbol wählen…"/>
|
:options="PAYMENT_METHOD_ICONS" placeholder="Symbol wählen…"/>
|
||||||
<TextEditor v-else-if="option.type === 'richtext'" v-model="form.configuration[option.name]"/>
|
<TextEditor v-else-if="option.type === 'richtext'" v-model="form.configuration[option.name]"/>
|
||||||
<BankRulesetEditor v-else-if="option.type === 'bank-ruleset'"
|
|
||||||
v-model="form.configuration[option.name]"
|
|
||||||
:defaults="data.statementRulesetDefault ?? {}"
|
|
||||||
:charsets="data.statementRulesetCharsets ?? undefined"/>
|
|
||||||
<input v-else type="text" v-model="form.configuration[option.name]" class="form-input"/>
|
<input v-else type="text" v-model="form.configuration[option.name]" class="form-input"/>
|
||||||
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
|
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -29,15 +29,8 @@ const form = ref({
|
|||||||
tax_exemption_reason: props.data.tax_exemption_reason ?? '',
|
tax_exemption_reason: props.data.tax_exemption_reason ?? '',
|
||||||
tax_exemption_note: props.data.tax_exemption_note ?? '',
|
tax_exemption_note: props.data.tax_exemption_note ?? '',
|
||||||
vat_pricing_mode: props.data.vat_pricing_mode ?? 'inclusive',
|
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 isLiable = computed(() => form.value.tax_liable === '1')
|
||||||
const isCustomReason = computed(() => form.value.tax_exemption_reason === 'custom')
|
const isCustomReason = computed(() => form.value.tax_exemption_reason === 'custom')
|
||||||
|
|
||||||
@@ -72,9 +65,6 @@ async function save() {
|
|||||||
tax_exemption_reason: isLiable.value ? null : form.value.tax_exemption_reason,
|
tax_exemption_reason: isLiable.value ? null : form.value.tax_exemption_reason,
|
||||||
tax_exemption_note: form.value.tax_exemption_note,
|
tax_exemption_note: form.value.tax_exemption_note,
|
||||||
vat_pricing_mode: form.value.vat_pricing_mode,
|
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,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -110,18 +100,6 @@ async function save() {
|
|||||||
<th>Rechnungshinweis</th>
|
<th>Rechnungshinweis</th>
|
||||||
<td>{{ invoiceHint }}</td>
|
<td>{{ invoiceHint }}</td>
|
||||||
</tr>
|
</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>
|
</table>
|
||||||
<button class="btn-edit" @click="editing = true">Bearbeiten</button>
|
<button class="btn-edit" @click="editing = true">Bearbeiten</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -174,42 +152,6 @@ async function save() {
|
|||||||
<th>Rechnungshinweis</th>
|
<th>Rechnungshinweis</th>
|
||||||
<td class="hint-preview">{{ invoiceHint }}</td>
|
<td class="hint-preview">{{ invoiceHint }}</td>
|
||||||
</tr>
|
</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>
|
</table>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn-save" @click="save">Speichern</button>
|
<button class="btn-save" @click="save">Speichern</button>
|
||||||
@@ -253,25 +195,6 @@ async function save() {
|
|||||||
font-style: italic;
|
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 {
|
.btn-edit, .btn-save, .btn-cancel {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
padding: 8px 20px;
|
padding: 8px 20px;
|
||||||
|
|||||||
@@ -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' => currentTenant()->slug,
|
'tenant' => app('tenant')->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' => currentTenant()->slug,
|
'tenant' => app('tenant')->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' => currentTenant()->slug,
|
'tenant' => app('tenant')->slug,
|
||||||
'type' => $this->request->type,
|
'type' => $this->request->type,
|
||||||
'billing_deadline' => $this->request->billingDeadline,
|
'billing_deadline' => $this->request->billingDeadline,
|
||||||
'distance_allowance' => $this->request->distanceAllowance->getAmount(),
|
'distance_allowance' => $this->request->distanceAllowance->getAmount(),
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class ExportController extends CommonController {
|
|||||||
'amount' => $invoice->amount,
|
'amount' => $invoice->amount,
|
||||||
'recipient_name' => $invoice->contact_bank_owner,
|
'recipient_name' => $invoice->contact_bank_owner,
|
||||||
'recipient_iban' => $invoice->contact_bank_iban,
|
'recipient_iban' => $invoice->contact_bank_iban,
|
||||||
'payment_purpose' => $invoice->paymentPurposeText(),
|
'payment_purpose' => $invoice->payment_purpose ?? 'Auslagenerstattung Rechnungsnummer ' . $invoice->invoice_number,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -18,10 +23,16 @@ 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.
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -89,13 +89,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<table v-if="localData.invoices.length > 0" class="invoice-list-table">
|
<table v-if="localData.invoices.length > 0" class="invoice-list-table">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="7">{{props.data.costUnit.name}}</td>
|
<td colspan="6">{{props.data.costUnit.name}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr v-for="invoice in localData.invoices" :id="'invoice_' + invoice.id">
|
<tr v-for="invoice in localData.invoices" :id="'invoice_' + invoice.id">
|
||||||
<td>{{invoice.invoiceNumber}}</td>
|
<td>{{invoice.invoiceNumber}}</td>
|
||||||
<td>{{invoice.invoiceTypeShort}}</td>
|
<td>{{invoice.invoiceType}}</td>
|
||||||
<td style="max-width: 250px;">{{invoice.purpose}}</td>
|
|
||||||
<td>
|
<td>
|
||||||
{{invoice.amount}}
|
{{invoice.amount}}
|
||||||
</td>
|
</td>
|
||||||
@@ -115,7 +114,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr v-if="props.data.endpoint === 'approved'">
|
<tr v-if="props.data.endpoint === 'approved'">
|
||||||
<td colspan="6"></td>
|
<td colspan="5"></td>
|
||||||
<td>
|
<td>
|
||||||
<a style="font-size: 10pt;" class="link" @click="exportPayouts()">Genehmigte Abrechnungen exportieren</a>
|
<a style="font-size: 10pt;" class="link" @click="exportPayouts()">Genehmigte Abrechnungen exportieren</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class PersonalDataController extends CommonController
|
|||||||
return redirect()->intended('/login');
|
return redirect()->intended('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = currentUser();
|
$user = auth()->user();
|
||||||
$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 = currentUser();
|
$user = auth()->user();
|
||||||
|
|
||||||
$actionRequest = new UpdatePersonalDataRequest(
|
$actionRequest = new UpdatePersonalDataRequest(
|
||||||
user: $user,
|
user: $user,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function navigateTo(url) {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{{participation.eventAddress}}<br />
|
{{participation.event.postal_code}} {{participation.event.location}}<br />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="link" :href="`/api/v1/event/participant/${participation.identifier}/ical`">In Kalender importieren</a>
|
<a class="link" :href="`/api/v1/event/participant/${participation.identifier}/ical`">In Kalender importieren</a>
|
||||||
|
|||||||
-142
@@ -1,142 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\BookBankStatementPayments;
|
|
||||||
|
|
||||||
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentCommand;
|
|
||||||
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentRequest;
|
|
||||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
|
||||||
use App\EventPaymentModules\ReadsBankStatements;
|
|
||||||
use App\Models\EventParticipant;
|
|
||||||
use App\Models\PaymentMethod;
|
|
||||||
use App\Repositories\EventParticipantRepository;
|
|
||||||
use App\ValueObjects\Amount;
|
|
||||||
use App\ValueObjects\BankTransaction;
|
|
||||||
use Carbon\CarbonImmutable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bucht die in der Prüfansicht bestätigten Zahlungseingänge -- alle in einem Durchgang.
|
|
||||||
*
|
|
||||||
* Bewusst **ohne** umspannende Transaktion: Gebucht wird über {@see ParticipantPaymentCommand}, und der
|
|
||||||
* verschickt die Zahlungsmail gleich mit. Das Projekt kennt keine Queue, die Mails gehen also synchron
|
|
||||||
* raus; eine offene Transaktion über achtzig Mailversände wäre die schlechtere Wahl. Jede Zeile ist
|
|
||||||
* für sich vollständig, und das Wasserzeichen schützt sie gegen eine Wiederholung.
|
|
||||||
*/
|
|
||||||
class BookBankStatementPaymentsCommand
|
|
||||||
{
|
|
||||||
public function __construct(private readonly BookBankStatementPaymentsRequest $request)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute(): BookBankStatementPaymentsResponse
|
|
||||||
{
|
|
||||||
$response = new BookBankStatementPaymentsResponse();
|
|
||||||
|
|
||||||
if ($this->request->bookings === []) {
|
|
||||||
$response->message = 'Es wurden keine Zahlungen zum Buchen ausgewählt.';
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$module = EventPaymentModuleRegistry::forSlug(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
|
|
||||||
$participants = new EventParticipantRepository();
|
|
||||||
|
|
||||||
foreach ($this->request->bookings as $booking) {
|
|
||||||
$participant = $participants->findInEventByIdentifier(
|
|
||||||
$this->request->event,
|
|
||||||
(string) ($booking['participantIdentifier'] ?? ''),
|
|
||||||
);
|
|
||||||
|
|
||||||
$transaction = $this->toTransaction($booking);
|
|
||||||
|
|
||||||
if ($participant === null || $transaction === null) {
|
|
||||||
$response->failed++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Zweite Prüfung, nicht bloß Gürtel und Hosenträger: In der Prüfansicht lässt sich eine
|
|
||||||
// Zeile von Hand einer anderen Person zuordnen, und deren Wasserzeichen hat der erste
|
|
||||||
// Durchlauf nie gesehen.
|
|
||||||
if ($this->isBeforeWatermark($participant, $transaction)) {
|
|
||||||
$response->skipped++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($module instanceof ReadsBankStatements) {
|
|
||||||
$module->recordTransaction($participant, $transaction);
|
|
||||||
}
|
|
||||||
|
|
||||||
$participant->last_payment_date = $transaction->paymentDate;
|
|
||||||
|
|
||||||
$this->book($participant, $transaction->amount);
|
|
||||||
$response->booked++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$response->success = true;
|
|
||||||
$response->message = $this->summaryMessage($response);
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bucht den Betrag **zusätzlich** zum bereits Gezahlten.
|
|
||||||
*
|
|
||||||
* Die manuelle Erfassung setzt `amount_paid` absolut, weil dort jemand den Gesamtstand eintippt.
|
|
||||||
* Hier kommt eine einzelne Zahlung an -- eine zweite Rate darf die erste nicht überschreiben.
|
|
||||||
* Der {@see ParticipantPaymentCommand} speichert dabei die zuvor gesetzten Felder mit und schickt
|
|
||||||
* die passende Mail (bezahlt / fehlt noch / überzahlt).
|
|
||||||
*/
|
|
||||||
private function book(EventParticipant $participant, Amount $amount): void
|
|
||||||
{
|
|
||||||
$total = new Amount(
|
|
||||||
round(($participant->amount_paid?->getAmount() ?? 0.0) + $amount->getAmount(), 2),
|
|
||||||
'Euro',
|
|
||||||
);
|
|
||||||
|
|
||||||
new ParticipantPaymentCommand(new ParticipantPaymentRequest($participant, $total))->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param array<string, mixed> $booking */
|
|
||||||
private function toTransaction(array $booking): ?BankTransaction
|
|
||||||
{
|
|
||||||
$date = CarbonImmutable::createFromFormat('!Y-m-d', (string) ($booking['paymentDate'] ?? ''));
|
|
||||||
$amount = $booking['amount'] ?? null;
|
|
||||||
|
|
||||||
if ($date === false || !is_numeric($amount) || (float) $amount <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BankTransaction(
|
|
||||||
paymentDate: $date,
|
|
||||||
amount: new Amount(round((float) $amount, 2), 'Euro'),
|
|
||||||
purpose: (string) ($booking['purpose'] ?? ''),
|
|
||||||
payerName: (string) ($booking['payerName'] ?? ''),
|
|
||||||
payerIban: (string) ($booking['payerIban'] ?? ''),
|
|
||||||
rowNumber: (int) ($booking['rowNumber'] ?? 0),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function isBeforeWatermark(EventParticipant $participant, BankTransaction $transaction): bool
|
|
||||||
{
|
|
||||||
$watermark = $participant->last_payment_date;
|
|
||||||
|
|
||||||
return $watermark !== null && $transaction->paymentDate->startOfDay()->lt($watermark->startOfDay());
|
|
||||||
}
|
|
||||||
|
|
||||||
private function summaryMessage(BookBankStatementPaymentsResponse $response): string
|
|
||||||
{
|
|
||||||
$message = sprintf('%d Zahlungen wurden gebucht.', $response->booked);
|
|
||||||
|
|
||||||
if ($response->skipped > 0) {
|
|
||||||
$message .= sprintf(
|
|
||||||
' %d wurden übersprungen, weil sie älter sind als die zuletzt erfasste Zahlung der Person.',
|
|
||||||
$response->skipped,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($response->failed > 0) {
|
|
||||||
$message .= sprintf(' %d konnten nicht zugeordnet werden.', $response->failed);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\BookBankStatementPayments;
|
|
||||||
|
|
||||||
use App\Models\Event;
|
|
||||||
|
|
||||||
class BookBankStatementPaymentsRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param array<int, array<string, mixed>> $bookings Je Eintrag die bestätigte Zeile der Prüfansicht:
|
|
||||||
* participantIdentifier, paymentDate, amount,
|
|
||||||
* payerName, payerIban, purpose.
|
|
||||||
*/
|
|
||||||
public function __construct(
|
|
||||||
public readonly Event $event,
|
|
||||||
public readonly array $bookings,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\BookBankStatementPayments;
|
|
||||||
|
|
||||||
class BookBankStatementPaymentsResponse
|
|
||||||
{
|
|
||||||
public bool $success = false;
|
|
||||||
public string $message = '';
|
|
||||||
|
|
||||||
public int $booked = 0;
|
|
||||||
|
|
||||||
/** Übersprungen, weil älter als die zuletzt erfasste Zahlung der Person. */
|
|
||||||
public int $skipped = 0;
|
|
||||||
|
|
||||||
/** Nicht verarbeitbar (unbekannte Anmeldung, unbrauchbarer Betrag). */
|
|
||||||
public int $failed = 0;
|
|
||||||
}
|
|
||||||
+1
-2
@@ -12,8 +12,7 @@ class CertificateOfConductionCheckCommand {
|
|||||||
public function execute() : CertificateOfConductionCheckResponse {
|
public function execute() : CertificateOfConductionCheckResponse {
|
||||||
$response = new CertificateOfConductionCheckResponse();
|
$response = new CertificateOfConductionCheckResponse();
|
||||||
|
|
||||||
// Der Stamm ist optional (die Kurzanmeldung erhebt ihn nicht, in der Verwaltung kann er entfernt werden).
|
$localGroup = str_replace('Stamm ', '', $this->request->participant->localGroup()->first()->name);
|
||||||
$localGroup = str_replace('Stamm ', '', $this->request->participant->localGroup()->first()?->name ?? '');
|
|
||||||
|
|
||||||
$apiResponse = Http::acceptJson()
|
$apiResponse = Http::acceptJson()
|
||||||
->asJson()
|
->asJson()
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ 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 App\RelationModels\EventPaymentMethods;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreateEventCommand {
|
class CreateEventCommand {
|
||||||
@@ -28,18 +27,11 @@ class CreateEventCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$tenant = currentTenant();
|
|
||||||
|
|
||||||
// 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([
|
$event = Event::create([
|
||||||
'tenant' => $tenant->slug,
|
'tenant' => app('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,
|
||||||
'street' => $this->normalizeOptional($this->request->street),
|
|
||||||
'house_number' => $this->normalizeOptional($this->request->houseNumber),
|
|
||||||
'postal_code' => $this->request->postalCode,
|
'postal_code' => $this->request->postalCode,
|
||||||
'email' => $this->request->email,
|
'email' => $this->request->email,
|
||||||
'start_date' => $this->request->begin,
|
'start_date' => $this->request->begin,
|
||||||
@@ -57,23 +49,13 @@ class CreateEventCommand {
|
|||||||
'support_flat' => 0,
|
'support_flat' => 0,
|
||||||
// Umsatzsteuerliche Grundlage bei Anlage einfrieren (unveränderlich), damit Preisermittlung und
|
// Umsatzsteuerliche Grundlage bei Anlage einfrieren (unveränderlich), damit Preisermittlung und
|
||||||
// spätere Rechnungen von späteren Tenant-Änderungen unberührt bleiben.
|
// spätere Rechnungen von späteren Tenant-Änderungen unberührt bleiben.
|
||||||
'tax_liable' => $tenant->tax_liable,
|
'tax_liable' => app('tenant')->tax_liable,
|
||||||
'vat_rate' => $tenant->vat_rate,
|
'vat_rate' => app('tenant')->vat_rate,
|
||||||
'vat_pricing_mode' => $tenant->vat_pricing_mode,
|
'vat_pricing_mode' => app('tenant')->vat_pricing_mode,
|
||||||
'tax_exemption_reason' => $tenant->tax_exemption_reason,
|
'tax_exemption_reason' => app('tenant')->tax_exemption_reason,
|
||||||
'tax_exemption_note' => $tenant->tax_exemption_note,
|
'tax_exemption_note' => app('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([
|
||||||
'event_id' => $event->id,
|
'event_id' => $event->id,
|
||||||
@@ -93,12 +75,12 @@ class CreateEventCommand {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTenant()->slug === 'lv') {
|
if (app('tenant')->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' => currentTenant()->id]);
|
EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => app('tenant')->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -108,46 +90,4 @@ class CreateEventCommand {
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Straße und Hausnummer sind optional. Ein leer gelassenes Eingabefeld liefert einen leeren String --
|
|
||||||
* gespeichert wird dafür `null`, damit „nicht angegeben" nur eine Darstellung hat.
|
|
||||||
*/
|
|
||||||
private function normalizeOptional(?string $value): ?string
|
|
||||||
{
|
|
||||||
$value = trim((string) $value);
|
|
||||||
|
|
||||||
return '' === $value ? null : $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event-Teil der Rechnungsnummer, z.B. `WM-V-20260701`: Tenant-Präfix, Dokumentart „V" für
|
|
||||||
* 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,10 +19,8 @@ class CreateEventRequest {
|
|||||||
public string $accountOwner;
|
public string $accountOwner;
|
||||||
public string $accountIban;
|
public string $accountIban;
|
||||||
public bool $payPerDay;
|
public bool $payPerDay;
|
||||||
public ?string $street;
|
|
||||||
public ?string $houseNumber;
|
|
||||||
|
|
||||||
public function __construct(string $name, string $location, string $postalCode, string $email, DateTime $begin, DateTime $end, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $earlyBirdEndAmountIncrease, ParticipationFeeType $participationFeeType, string $accountOwner, string $accountIban, bool $payPerDay, ?string $street = null, ?string $houseNumber = null) {
|
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;
|
||||||
@@ -36,7 +34,5 @@ class CreateEventRequest {
|
|||||||
$this->accountOwner = $accountOwner;
|
$this->accountOwner = $accountOwner;
|
||||||
$this->accountIban = $accountIban;
|
$this->accountIban = $accountIban;
|
||||||
$this->payPerDay = $payPerDay;
|
$this->payPerDay = $payPerDay;
|
||||||
$this->street = $street;
|
|
||||||
$this->houseNumber = $houseNumber;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-205
@@ -1,205 +0,0 @@
|
|||||||
<?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') ?? '',
|
|
||||||
// Ohne die Anmerkung: dort steht, was die Kassenwart*in beim Korrigieren notiert hat,
|
|
||||||
// und das gehört auf den Beleg, nicht in den Zweck.
|
|
||||||
'purpose' => $invoice->purposeText(),
|
|
||||||
'amount' => Amount::fromString($invoice->amount),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$groups[] = [
|
|
||||||
'name' => $group['type']->name,
|
|
||||||
'sum' => $group['sum'],
|
|
||||||
'rows' => $rows,
|
|
||||||
];
|
|
||||||
|
|
||||||
$total->addAmount($group['sum']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ['groups' => $groups, 'total' => $total];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\CreateIncomeSurplusStatement;
|
|
||||||
|
|
||||||
use App\Models\Event;
|
|
||||||
|
|
||||||
class CreateIncomeSurplusStatementRequest
|
|
||||||
{
|
|
||||||
public function __construct(public readonly Event $event)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
<?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,18 +13,18 @@ class GenerateIcalCommand
|
|||||||
$participant = $this->request->participant;
|
$participant = $this->request->participant;
|
||||||
$event = $participant->event;
|
$event = $participant->event;
|
||||||
|
|
||||||
$uid = $participant->identifier . '@' . currentTenant()->slug;
|
$uid = $participant->identifier . '@' . app('tenant')->slug;
|
||||||
$dtStart = $event->start_date->format('Ymd');
|
$dtStart = $event->start_date->format('Ymd');
|
||||||
$dtEnd = $event->end_date->copy()->addDay()->format('Ymd');
|
$dtEnd = $event->end_date->copy()->addDay()->format('Ymd');
|
||||||
$now = now()->format('Ymd\THis\Z');
|
$now = now()->format('Ymd\THis\Z');
|
||||||
$summary = $this->escapeIcal($event->name);
|
$summary = $this->escapeIcal($event->name);
|
||||||
$location = $this->escapeIcal($event->getFullAddress());
|
$location = $this->escapeIcal(trim($event->postal_code . ' ' . $event->location));
|
||||||
$description = $this->escapeIcal('Teilnahme als: ' . $participant->getOfficialName());
|
$description = $this->escapeIcal('Teilnahme als: ' . $participant->getOfficialName());
|
||||||
|
|
||||||
$icalContent = implode("\r\n", [
|
$icalContent = implode("\r\n", [
|
||||||
'BEGIN:VCALENDAR',
|
'BEGIN:VCALENDAR',
|
||||||
'VERSION:2.0',
|
'VERSION:2.0',
|
||||||
'PRODID:-//' . currentTenant()->name . '//Veranstaltungskalender//DE',
|
'PRODID:-//' . app('tenant')->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:-//' . currentTenant()->name . '//Veranstaltungskalender//DE',
|
'PRODID:-//' . app('tenant')->name . '//Veranstaltungskalender//DE',
|
||||||
'CALSCALE:GREGORIAN',
|
'CALSCALE:GREGORIAN',
|
||||||
'METHOD:PUBLISH',
|
'METHOD:PUBLISH',
|
||||||
'BEGIN:VEVENT',
|
'BEGIN:VEVENT',
|
||||||
'UID:payment-deadline-' . $event->identifier . '@' . currentTenant()->slug,
|
'UID:payment-deadline-' . $event->identifier . '@' . app('tenant')->slug,
|
||||||
'DTSTAMP:' . $now,
|
'DTSTAMP:' . $now,
|
||||||
'DTSTART;VALUE=DATE:' . $dtDate,
|
'DTSTART;VALUE=DATE:' . $dtDate,
|
||||||
'DTEND;VALUE=DATE:' . $dtDate,
|
'DTEND;VALUE=DATE:' . $dtDate,
|
||||||
|
|||||||
@@ -1,183 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\ParseBankStatement;
|
|
||||||
|
|
||||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
|
||||||
use App\EventPaymentModules\ProvidesStatementRuleset;
|
|
||||||
use App\EventPaymentModules\ReadsBankStatements;
|
|
||||||
use App\Models\EventParticipant;
|
|
||||||
use App\Models\PaymentMethod;
|
|
||||||
use App\Providers\BankStatementParseProvider;
|
|
||||||
use App\Repositories\EventParticipantRepository;
|
|
||||||
use App\Support\BankStatementParseException;
|
|
||||||
use App\ValueObjects\BankStatementRuleset;
|
|
||||||
use App\ValueObjects\BankTransaction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Liest einen hochgeladenen Kontoauszug und schlägt je Zahlungseingang eine Anmeldung vor.
|
|
||||||
*
|
|
||||||
* Hier wird nichts gebucht -- das Ergebnis ist die Prüfansicht, in der die Aktionsleitung die
|
|
||||||
* Vorschläge bestätigt, korrigiert oder verwirft. Erst der zweite Schritt schreibt.
|
|
||||||
*
|
|
||||||
* Der Ablauf ist zahlartneutral: Was ein verwertbarer Umsatz ist und zu wem er gehört, entscheidet
|
|
||||||
* das Zahlungsmodul über {@see ReadsBankStatements}.
|
|
||||||
*/
|
|
||||||
class ParseBankStatementCommand
|
|
||||||
{
|
|
||||||
/** 8 MB -- ein Jahresauszug bleibt weit darunter, alles darüber ist die falsche Datei. */
|
|
||||||
private const int MAX_BYTES = 8 * 1024 * 1024;
|
|
||||||
|
|
||||||
private const array ALLOWED_EXTENSIONS = ['csv', 'txt'];
|
|
||||||
|
|
||||||
public function __construct(private readonly ParseBankStatementRequest $request)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute(): ParseBankStatementResponse
|
|
||||||
{
|
|
||||||
$response = new ParseBankStatementResponse();
|
|
||||||
|
|
||||||
$module = EventPaymentModuleRegistry::forSlug(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
|
|
||||||
if (!$module instanceof ReadsBankStatements) {
|
|
||||||
$response->message = 'Für die Überweisung ist kein Kontoauszug-Import eingerichtet.';
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$contents = $this->readFile($response);
|
|
||||||
if ($contents === null) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ruleset = $module instanceof ProvidesStatementRuleset
|
|
||||||
? $module->statementRuleset($this->request->configuration)
|
|
||||||
: BankStatementRuleset::default();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$transactions = new BankStatementParseProvider()->parse($contents, $ruleset);
|
|
||||||
} catch (BankStatementParseException $exception) {
|
|
||||||
$response->message = $exception->getMessage();
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$candidates = new EventParticipantRepository()->getForPaymentMatching($this->request->event);
|
|
||||||
|
|
||||||
foreach ($transactions as $transaction) {
|
|
||||||
if (!$module->isRelevantTransaction($transaction)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$match = $module->matchTransaction($transaction, $candidates);
|
|
||||||
|
|
||||||
// Vor der letzten erfassten Zahlung dieser Person: schon gebucht, oder aus einem Auszug,
|
|
||||||
// der bereits verarbeitet wurde. Gar nicht erst anzeigen.
|
|
||||||
if ($match !== null && $this->isBeforeWatermark($match->participant, $transaction)) {
|
|
||||||
$response->skippedOlderThanWatermark++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$response->rows[] = $transaction->toArray() + [
|
|
||||||
'suggestedIdentifier' => $match?->participant->identifier,
|
|
||||||
'confidence' => $match?->confidence,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$response->participants = $candidates
|
|
||||||
->map(fn (EventParticipant $participant): array => $this->participantOption($participant))
|
|
||||||
->values()
|
|
||||||
->all();
|
|
||||||
|
|
||||||
$response->success = true;
|
|
||||||
$response->message = $this->summaryMessage($response);
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function readFile(ParseBankStatementResponse $response): ?string
|
|
||||||
{
|
|
||||||
$file = $this->request->file;
|
|
||||||
|
|
||||||
if ($file === null || !$file->isValid()) {
|
|
||||||
$response->message = 'Es wurde keine Datei hochgeladen.';
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($file->getSize() > self::MAX_BYTES) {
|
|
||||||
$response->message = 'Die Datei ist zu groß (maximal 8 MB).';
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array(strtolower($file->getClientOriginalExtension()), self::ALLOWED_EXTENSIONS, true)) {
|
|
||||||
$response->message = 'Bitte den CSV-Export der Bank hochladen (.csv).';
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$contents = file_get_contents($file->getRealPath());
|
|
||||||
|
|
||||||
if ($contents === false || trim($contents) === '') {
|
|
||||||
$response->message = 'Die Datei ließ sich nicht lesen oder ist leer.';
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function isBeforeWatermark(EventParticipant $participant, BankTransaction $transaction): bool
|
|
||||||
{
|
|
||||||
$watermark = $participant->last_payment_date;
|
|
||||||
|
|
||||||
// Echt kleiner, nicht kleiner-gleich: Zwei Zahlungen am selben Tag sollen beide ankommen.
|
|
||||||
return $watermark !== null && $transaction->paymentDate->startOfDay()->lt($watermark->startOfDay());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return array<string, mixed> */
|
|
||||||
private function participantOption(EventParticipant $participant): array
|
|
||||||
{
|
|
||||||
$amountLeft = clone $participant->amount;
|
|
||||||
if ($participant->amount_paid !== null) {
|
|
||||||
$amountLeft->subtractAmount($participant->amount_paid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'identifier' => $participant->identifier,
|
|
||||||
'name' => $participant->lastname . ', ' . $participant->firstname,
|
|
||||||
'amount' => $participant->amount?->toString(),
|
|
||||||
'amountPaid' => $participant->amount_paid?->toString(),
|
|
||||||
'amountOpen' => $amountLeft->toString(),
|
|
||||||
'isSettled' => round($amountLeft->getAmount(), 2) <= 0,
|
|
||||||
'lastPaymentDate' => $participant->last_payment_date?->format('d.m.Y'),
|
|
||||||
// Zahlt jemand, der sich abgemeldet hat, wird die Zahlung trotzdem erfasst -- danach
|
|
||||||
// steht aber eine Erstattung an. Die Prüfansicht weist darauf hin.
|
|
||||||
'isSignedOff' => $participant->unregistered_at !== null,
|
|
||||||
'signedOffAt' => $participant->unregistered_at?->format('d.m.Y'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function summaryMessage(ParseBankStatementResponse $response): string
|
|
||||||
{
|
|
||||||
if ($response->rows === []) {
|
|
||||||
return $response->skippedOlderThanWatermark > 0
|
|
||||||
? 'Alle Zahlungseingänge dieser Datei wurden bereits erfasst.'
|
|
||||||
: 'In der Datei sind keine Zahlungseingänge zu dieser Aktion enthalten.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$assigned = count(array_filter($response->rows, static fn (array $row): bool => $row['suggestedIdentifier'] !== null));
|
|
||||||
|
|
||||||
$message = sprintf(
|
|
||||||
'%d Zahlungseingänge gelesen, %d davon konnten zugeordnet werden.',
|
|
||||||
count($response->rows),
|
|
||||||
$assigned,
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($response->skippedOlderThanWatermark > 0) {
|
|
||||||
$message .= sprintf(' %d bereits erfasste Zahlungen wurden übersprungen.', $response->skippedOlderThanWatermark);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\ParseBankStatement;
|
|
||||||
|
|
||||||
use App\Models\Event;
|
|
||||||
use Illuminate\Http\UploadedFile;
|
|
||||||
|
|
||||||
class ParseBankStatementRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param array<string, mixed> $configuration Tenant-Konfiguration der Überweisung. Wird hereingereicht
|
|
||||||
* statt hier geholt -- den DB-Zugriff macht der Controller
|
|
||||||
* über das Repository.
|
|
||||||
*/
|
|
||||||
public function __construct(
|
|
||||||
public readonly Event $event,
|
|
||||||
public readonly ?UploadedFile $file,
|
|
||||||
public readonly array $configuration = [],
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\ParseBankStatement;
|
|
||||||
|
|
||||||
class ParseBankStatementResponse
|
|
||||||
{
|
|
||||||
public bool $success = false;
|
|
||||||
public string $message = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Eine Zeile je verwertbarem Umsatz, fertig für die Prüfansicht.
|
|
||||||
*
|
|
||||||
* @var array<int, array<string, mixed>>
|
|
||||||
*/
|
|
||||||
public array $rows = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Alle zuordenbaren Anmeldungen der Aktion für die Auswahlliste.
|
|
||||||
*
|
|
||||||
* @var array<int, array<string, mixed>>
|
|
||||||
*/
|
|
||||||
public array $participants = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Umsätze, die vor der zuletzt erfassten Zahlung der erkannten Person liegen. Sie erscheinen gar
|
|
||||||
* nicht erst in der Prüfansicht -- gezählt werden sie trotzdem, sonst bliebe unerklärt, warum
|
|
||||||
* eine Datei mit 40 Zeilen nur 12 Vorschläge ergibt.
|
|
||||||
*/
|
|
||||||
public int $skippedOlderThanWatermark = 0;
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,7 @@ class SetParticipationFeesCommand {
|
|||||||
$this->cleanBefore();
|
$this->cleanBefore();
|
||||||
|
|
||||||
$this->request->event->participationFee1()->associate(EventParticipationFee::create([
|
$this->request->event->participationFee1()->associate(EventParticipationFee::create([
|
||||||
'tenant' => currentTenant()->slug,
|
'tenant' => app('tenant')->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' => currentTenant()->slug,
|
'tenant' => app('tenant')->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' => currentTenant()->slug,
|
'tenant' => app('tenant')->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' => currentTenant()->slug,
|
'tenant' => app('tenant')->slug,
|
||||||
'type' => $this->request->participationFeeFourth['type'],
|
'type' => $this->request->participationFeeFourth['type'],
|
||||||
'name' => $this->request->participationFeeFourth['name'],
|
'name' => $this->request->participationFeeFourth['name'],
|
||||||
'description' => $this->request->participationFeeFourth['description'],
|
'description' => $this->request->participationFeeFourth['description'],
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class SetPaymentMethodsCommand
|
|||||||
// Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen.
|
// Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen.
|
||||||
if ($override !== null) {
|
if ($override !== null) {
|
||||||
$row = $existing[$slug];
|
$row = $existing[$slug];
|
||||||
$row->configuration = $this->eventConfiguration($slug, $override);
|
$row->configuration = PaymentMethod::sanitizeConfiguration($slug, $override);
|
||||||
$row->save();
|
$row->save();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -75,27 +75,8 @@ class SetPaymentMethodsCommand
|
|||||||
EventPaymentMethods::create([
|
EventPaymentMethods::create([
|
||||||
'event_id' => $event->id,
|
'event_id' => $event->id,
|
||||||
'slug' => $slug,
|
'slug' => $slug,
|
||||||
'configuration' => $this->eventConfiguration($slug, $snapshot ?? []),
|
'configuration' => PaymentMethod::sanitizeConfiguration($slug, $snapshot ?? []),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Was von einer Konfiguration am Event gespeichert wird.
|
|
||||||
*
|
|
||||||
* Neben dem Zuschnitt aufs Schema fallen hier die tenant-weiten Optionen heraus. Das
|
|
||||||
* Kontoauszug-Format etwa beschreibt die Bank, nicht die Zusage an die Teilnehmenden -- eingefroren
|
|
||||||
* ließe sich nach einem Bankwechsel für laufende Aktionen nichts mehr importieren. IBAN und
|
|
||||||
* Kontoinhaber frieren dagegen weiterhin pro Aktion ein.
|
|
||||||
*
|
|
||||||
* @param array<string, mixed> $configuration
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
private function eventConfiguration(string $slug, array $configuration): array
|
|
||||||
{
|
|
||||||
return PaymentMethod::stripTenantScopedOptions(
|
|
||||||
$slug,
|
|
||||||
PaymentMethod::sanitizeConfiguration($slug, $configuration),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,150 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\ShortSignUp;
|
|
||||||
|
|
||||||
use App\Domains\Event\Actions\SignUp\SignUpCommand;
|
|
||||||
use App\Domains\Event\Actions\SignUp\SignUpRequest;
|
|
||||||
use App\ValueObjects\Age;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verkürzte Anmeldung: ergänzt die nicht erhobenen Pflichtangaben um Platzhalter und übergibt an die reguläre
|
|
||||||
* Anmelde-Action. Dadurch gelten für Kurzanmeldungen dieselben Regeln wie für jede andere Anmeldung
|
|
||||||
* (Transaktion, laufende Rechnungsnummer, eFZ-Vorbelegung, Snapshot der Teilnahmeoptionen).
|
|
||||||
*/
|
|
||||||
class ShortSignUpCommand {
|
|
||||||
/** Platzhalter für Angaben, die die Kurzanmeldung nicht erhebt. */
|
|
||||||
private const string PLACEHOLDER = 'Nicht erforderlich';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Die Postleitzahl bekommt bewusst keinen Text-Platzhalter: aus ihr wird in Teilnehmerliste und CSV-Export
|
|
||||||
* das Bundesland abgeleitet.
|
|
||||||
*/
|
|
||||||
private const string PLACEHOLDER_POSTCODE = '00000';
|
|
||||||
|
|
||||||
public function __construct(public ShortSignUpRequest $request) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute() : ShortSignUpResponse {
|
|
||||||
$response = new ShortSignUpResponse();
|
|
||||||
|
|
||||||
// Ohne konfigurierte Teilnahmegruppe gäbe es keinen gültigen `participation_type` -- sauber abbrechen,
|
|
||||||
// statt in einen Fremdschlüssel-Fehler zu laufen.
|
|
||||||
$participationFee = $this->request->event->firstParticipationFee();
|
|
||||||
if ($participationFee === null) {
|
|
||||||
$response->message = 'Für diese Veranstaltung ist noch keine Teilnahmegruppe hinterlegt.';
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$participationType = $participationFee->type;
|
|
||||||
|
|
||||||
// Nur hinterlegte Beitragsstufen sind wählbar -- für jede andere hätte calculateAmount() keinen Betrag.
|
|
||||||
if (!in_array($this->request->feeType, $participationFee->availableFeeTypes(), true)) {
|
|
||||||
$response->message = 'Der gewählte Beitrag ist für diese Veranstaltung nicht verfügbar.';
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$participantAge = new Age($this->request->birthday);
|
|
||||||
|
|
||||||
// Bei Minderjährigen ist die Kontaktperson Pflicht; der Client prüft das ebenfalls, verlassen wird sich
|
|
||||||
// darauf nicht.
|
|
||||||
if (!$participantAge->isfullAged()
|
|
||||||
&& ($this->request->contactPerson === null || $this->request->contactEmail === null)) {
|
|
||||||
$response->message = 'Für Minderjährige werden Name und E-Mail-Adresse einer Kontaktperson benötigt.';
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stamm: bei genau einem teilnehmenden Stamm wird dieser gesetzt, bei mehreren muss gewählt werden,
|
|
||||||
// ohne teilnehmende Stämme bleibt die Zuordnung leer.
|
|
||||||
$localGroups = $this->request->event->localGroups;
|
|
||||||
$localGroup = null;
|
|
||||||
|
|
||||||
if ($localGroups->count() === 1) {
|
|
||||||
$localGroup = $localGroups->first();
|
|
||||||
} elseif ($localGroups->count() > 1) {
|
|
||||||
$localGroup = $localGroups->firstWhere('id', $this->request->localGroupId);
|
|
||||||
|
|
||||||
if ($localGroup === null) {
|
|
||||||
$response->message = 'Bitte einen Stamm auswählen.';
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$eventResource = $this->request->event->toResource();
|
|
||||||
|
|
||||||
// Zeitraum und Gruppe stehen bei der Kurzanmeldung fest, wählbar ist nur die Beitragsstufe.
|
|
||||||
$amount = $eventResource->calculateAmount(
|
|
||||||
$participationType,
|
|
||||||
$this->request->feeType,
|
|
||||||
$this->request->event->start_date,
|
|
||||||
$this->request->event->end_date,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
$signUpRequest = new SignUpRequest(
|
|
||||||
event: $this->request->event,
|
|
||||||
user_id: $this->request->user_id,
|
|
||||||
firstname: $this->request->firstname,
|
|
||||||
lastname: $this->request->lastname,
|
|
||||||
nickname: $this->request->nickname,
|
|
||||||
participationType: $participationType,
|
|
||||||
localGroup: $localGroup,
|
|
||||||
birthday: $this->request->birthday,
|
|
||||||
address_1: self::PLACEHOLDER,
|
|
||||||
address_2: null,
|
|
||||||
postcode: self::PLACEHOLDER_POSTCODE,
|
|
||||||
city: self::PLACEHOLDER,
|
|
||||||
email_1: $this->request->email,
|
|
||||||
phone_1: $this->request->phone,
|
|
||||||
email_2: $this->request->contactEmail,
|
|
||||||
phone_2: null,
|
|
||||||
contact_person: $this->request->contactPerson,
|
|
||||||
allergies: $this->request->allergies,
|
|
||||||
intolerances: $this->request->intolerances,
|
|
||||||
medications: null,
|
|
||||||
tetanus_vaccination: null,
|
|
||||||
// Kein Wert der Zuordnung -- der SignUpCommand fällt damit auf "Omnivor" zurück.
|
|
||||||
eating_habit: '',
|
|
||||||
swimming_permission: $this->resolveSwimmingPermission($participantAge),
|
|
||||||
first_aid_permission: $participantAge->isfullAged() ? '-1' : ($this->request->firstAidPermission ?? '-1'),
|
|
||||||
foto_socialmedia: $this->request->foto_socialmedia,
|
|
||||||
foto_print: $this->request->foto_print,
|
|
||||||
foto_webseite: $this->request->foto_webseite,
|
|
||||||
foto_partner: $this->request->foto_partner,
|
|
||||||
foto_intern: $this->request->foto_intern,
|
|
||||||
arrival: $this->request->event->start_date,
|
|
||||||
departure: $this->request->event->end_date,
|
|
||||||
arrival_eating: 1,
|
|
||||||
departure_eating: 2,
|
|
||||||
notes: null,
|
|
||||||
amount: $amount,
|
|
||||||
paymentMethod: $this->request->paymentMethod,
|
|
||||||
paymentOptions: $this->request->paymentOptions,
|
|
||||||
participationOptions: $this->request->participationOptions,
|
|
||||||
addonItems: [],
|
|
||||||
feeType: $this->request->feeType,
|
|
||||||
siblingReduction: false,
|
|
||||||
);
|
|
||||||
|
|
||||||
$signUpResponse = new SignUpCommand($signUpRequest)->execute();
|
|
||||||
|
|
||||||
$response->success = $signUpResponse->success;
|
|
||||||
$response->participant = $signUpResponse->participant;
|
|
||||||
$response->message = $signUpResponse->message;
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bei Volljährigen und wenn die Veranstaltung die Badeerlaubnis nicht abfragt, entscheidet der SignUpCommand
|
|
||||||
* (volljährig => erteilt, nicht abgefragt => keine). Nur die getroffene Auswahl Minderjähriger wird
|
|
||||||
* durchgereicht.
|
|
||||||
*/
|
|
||||||
private function resolveSwimmingPermission(Age $participantAge) : ?string
|
|
||||||
{
|
|
||||||
if ($participantAge->isfullAged() || !$this->request->event->swimming_permission_required) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->request->swimmingPermission;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\ShortSignUp;
|
|
||||||
|
|
||||||
use App\Models\Event;
|
|
||||||
use DateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Eingabedaten der verkürzten Anmeldung -- ausschließlich das, was der Kurz-Wizard tatsächlich erhebt.
|
|
||||||
* Alle übrigen Pflichtangaben des Teilnehmers setzt der Command auf Platzhalter.
|
|
||||||
*/
|
|
||||||
class ShortSignUpRequest {
|
|
||||||
function __construct(
|
|
||||||
public Event $event,
|
|
||||||
public ?int $user_id,
|
|
||||||
public string $firstname,
|
|
||||||
public string $lastname,
|
|
||||||
public ?string $nickname,
|
|
||||||
public DateTime $birthday,
|
|
||||||
public string $email,
|
|
||||||
public string $phone,
|
|
||||||
/**
|
|
||||||
* Tenant-ID des Stamms. Nur gefüllt, wenn die Veranstaltung mehrere teilnehmende Stämme hat --
|
|
||||||
* bei genau einem wird dieser gesetzt, ohne zu fragen.
|
|
||||||
*/
|
|
||||||
public ?int $localGroupId,
|
|
||||||
/** Kontaktperson: nur bei Minderjährigen erhoben. */
|
|
||||||
public ?string $contactPerson,
|
|
||||||
public ?string $contactEmail,
|
|
||||||
public ?string $allergies,
|
|
||||||
public ?string $intolerances,
|
|
||||||
/** Slug aus `first_aid_permissions`; nur bei Minderjährigen erhoben. */
|
|
||||||
public ?string $firstAidPermission,
|
|
||||||
/** Slug aus `swimming_permissions`; nur bei Minderjährigen und nur wenn die Veranstaltung sie abfragt. */
|
|
||||||
public ?string $swimmingPermission,
|
|
||||||
public bool $foto_socialmedia,
|
|
||||||
public bool $foto_print,
|
|
||||||
public bool $foto_webseite,
|
|
||||||
public bool $foto_partner,
|
|
||||||
public bool $foto_intern,
|
|
||||||
public ?string $paymentMethod,
|
|
||||||
public array $paymentOptions = [],
|
|
||||||
/** Antworten auf die Teilnahmeoptionen: [ question_key => value ]. */
|
|
||||||
public array $participationOptions = [],
|
|
||||||
/**
|
|
||||||
* Beitragsstufe (`standard`, `reduced`, `solidarity`). Wählbar nur, wenn die Teilnahmegruppe neben dem
|
|
||||||
* Standardbeitrag weitere Stufen hinterlegt hat; der Command prüft das.
|
|
||||||
*/
|
|
||||||
public string $feeType = 'standard',
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Actions\ShortSignUp;
|
|
||||||
|
|
||||||
use App\Models\EventParticipant;
|
|
||||||
|
|
||||||
class ShortSignUpResponse {
|
|
||||||
public bool $success;
|
|
||||||
public ?EventParticipant $participant;
|
|
||||||
public ?string $message = null;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->success = false;
|
|
||||||
$this->participant = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,10 +4,8 @@ namespace App\Domains\Event\Actions\SignUp;
|
|||||||
|
|
||||||
use App\Enumerations\EatingHabit;
|
use App\Enumerations\EatingHabit;
|
||||||
use App\Enumerations\EfzStatus;
|
use App\Enumerations\EfzStatus;
|
||||||
use App\Enumerations\SwimmingPermission;
|
|
||||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
||||||
use App\ValueObjects\Age;
|
use App\ValueObjects\Age;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class SignUpCommand {
|
class SignUpCommand {
|
||||||
@@ -45,22 +43,16 @@ class SignUpCommand {
|
|||||||
|
|
||||||
$participantAge = new Age($this->request->birthday);
|
$participantAge = new Age($this->request->birthday);
|
||||||
|
|
||||||
// Anmeldung als Ganzes: die laufende Nummer (invoice_sequence) muss unter der Sperre vergeben und
|
$response->participant = $this->request->event->participants()->create(
|
||||||
// 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,
|
'local_group' => $this->request->localGroup->slug,
|
||||||
'sibling_reduction' => $this->request->siblingReduction,
|
|
||||||
'local_group' => $this->request->localGroup?->slug,
|
|
||||||
'birthday' => $this->request->birthday,
|
'birthday' => $this->request->birthday,
|
||||||
'address_1' => $this->request->address_1,
|
'address_1' => $this->request->address_1,
|
||||||
'address_2' => $this->request->address_2,
|
'address_2' => $this->request->address_2,
|
||||||
@@ -76,10 +68,8 @@ 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' => $this->resolveSwimmingPermission($participantAge),
|
'swimming_permission' => $participantAge->isfullAged() ? 'SWIMMING_PERMISSION_ALLOWED' : $this->request->swimming_permission,
|
||||||
'first_aid_permission' => ($participantAge->isfullAged() || $this->request->first_aid_permission === '-1')
|
'first_aid_permission' => $participantAge->isfullAged() ? 'FIRST_AID_PERMISSION_ALLOWED' : $this->request->first_aid_permission,
|
||||||
? '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,
|
||||||
@@ -98,58 +88,13 @@ class SignUpCommand {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->persistParticipationOptions($participant, $participationOptionRows);
|
$this->persistParticipationOptions($response->participant, $participationOptionRows);
|
||||||
$this->persistAddons($participant);
|
$this->persistAddons($response->participant);
|
||||||
|
|
||||||
return $participant;
|
|
||||||
});
|
|
||||||
|
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Badeerlaubnis auflösen. Volljährige brauchen keine Erlaubnis. Für Minderjährige gilt die getroffene Auswahl;
|
|
||||||
* fehlt sie -- weil die Veranstaltung die Badeerlaubnis gar nicht abfragt oder keine Wahl getroffen wurde --,
|
|
||||||
* wird bewusst "Keine" hinterlegt und nicht etwa stillschweigend eine Erlaubnis angenommen.
|
|
||||||
*/
|
|
||||||
private function resolveSwimmingPermission(Age $participantAge): string
|
|
||||||
{
|
|
||||||
if ($participantAge->isfullAged()) {
|
|
||||||
return SwimmingPermission::SWIMMING_PERMISSION_ALLOWED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->request->event->swimming_permission_required
|
|
||||||
|| $this->request->swimming_permission === null
|
|
||||||
|| $this->request->swimming_permission === '-1') {
|
|
||||||
return SwimmingPermission::SWIMMING_PERMISSION_DENIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->request->swimming_permission;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nächste laufende Nummer des Teilis innerhalb der Veranstaltung -- der letzte Block der
|
|
||||||
* 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
|
* 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.
|
* Rechnung. Die Beträge sind bereits in der Controller-Auflösung (`resolveAddons`) berechnet, inkl. USt.
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ class SignUpRequest {
|
|||||||
public string $lastname,
|
public string $lastname,
|
||||||
public ?string $nickname,
|
public ?string $nickname,
|
||||||
public string $participationType,
|
public string $participationType,
|
||||||
/** Stamm des Teilnehmers; in der Kurzanmeldung nicht erhoben und deshalb optional. */
|
public Tenant $localGroup,
|
||||||
public ?Tenant $localGroup,
|
|
||||||
public DateTime $birthday,
|
public DateTime $birthday,
|
||||||
public string $address_1,
|
public string $address_1,
|
||||||
public ?string $address_2,
|
public ?string $address_2,
|
||||||
@@ -51,10 +50,6 @@ class SignUpRequest {
|
|||||||
public array $participationOptions = [],
|
public array $participationOptions = [],
|
||||||
/** Aufgelöste Zusätze (Event-Addons): je Eintrag [ key, title, price, flat, days, amount ]. */
|
/** Aufgelöste Zusätze (Event-Addons): je Eintrag [ key, title, price, flat, days, amount ]. */
|
||||||
public array $addonItems = [],
|
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,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ class UpdateEventCommand {
|
|||||||
|
|
||||||
$this->request->event->name = $this->request->eventName;
|
$this->request->event->name = $this->request->eventName;
|
||||||
$this->request->event->location = $this->request->eventLocation;
|
$this->request->event->location = $this->request->eventLocation;
|
||||||
$this->request->event->street = $this->normalizeOptional($this->request->street);
|
|
||||||
$this->request->event->house_number = $this->normalizeOptional($this->request->houseNumber);
|
|
||||||
$this->request->event->postal_code = $this->request->postalCode;
|
$this->request->event->postal_code = $this->request->postalCode;
|
||||||
$this->request->event->email = $this->request->email;
|
$this->request->event->email = $this->request->email;
|
||||||
$this->request->event->early_bird_end = $this->request->earlyBirdEnd;
|
$this->request->event->early_bird_end = $this->request->earlyBirdEnd;
|
||||||
@@ -24,8 +22,6 @@ class UpdateEventCommand {
|
|||||||
$this->request->event->support_flat = $this->request->flatSupport;
|
$this->request->event->support_flat = $this->request->flatSupport;
|
||||||
$this->request->event->send_weekly_report = $this->request->sendWeeklyReports;
|
$this->request->event->send_weekly_report = $this->request->sendWeeklyReports;
|
||||||
$this->request->event->registration_allowed = $this->request->registrationAllowed;
|
$this->request->event->registration_allowed = $this->request->registrationAllowed;
|
||||||
$this->request->event->short_registration = $this->request->shortRegistration;
|
|
||||||
$this->request->event->swimming_permission_required = $this->request->swimmingPermissionRequired;
|
|
||||||
$this->request->event->save();
|
$this->request->event->save();
|
||||||
|
|
||||||
$this->request->event->resetAllowedEatingHabits();
|
$this->request->event->resetAllowedEatingHabits();
|
||||||
@@ -44,15 +40,4 @@ class UpdateEventCommand {
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Straße und Hausnummer sind optional. Ein geleertes Eingabefeld liefert einen leeren String --
|
|
||||||
* gespeichert wird dafür `null`, damit „nicht angegeben" nur eine Darstellung hat.
|
|
||||||
*/
|
|
||||||
private function normalizeOptional(?string $value): ?string
|
|
||||||
{
|
|
||||||
$value = trim((string) $value);
|
|
||||||
|
|
||||||
return '' === $value ? null : $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ class UpdateEventRequest {
|
|||||||
public Event $event;
|
public Event $event;
|
||||||
public string $eventName;
|
public string $eventName;
|
||||||
public string $eventLocation;
|
public string $eventLocation;
|
||||||
public ?string $street;
|
|
||||||
public ?string $houseNumber;
|
|
||||||
public string $postalCode;
|
public string $postalCode;
|
||||||
public string $email;
|
public string $email;
|
||||||
public DateTime $earlyBirdEnd;
|
public DateTime $earlyBirdEnd;
|
||||||
@@ -19,20 +17,16 @@ class UpdateEventRequest {
|
|||||||
public int $alcoholicsAge;
|
public int $alcoholicsAge;
|
||||||
public bool $sendWeeklyReports;
|
public bool $sendWeeklyReports;
|
||||||
public bool $registrationAllowed;
|
public bool $registrationAllowed;
|
||||||
public bool $shortRegistration;
|
|
||||||
public bool $swimmingPermissionRequired;
|
|
||||||
public Amount $flatSupport;
|
public Amount $flatSupport;
|
||||||
public Amount $supportPerPerson;
|
public Amount $supportPerPerson;
|
||||||
public array $contributingLocalGroups;
|
public array $contributingLocalGroups;
|
||||||
public array $eatingHabits;
|
public array $eatingHabits;
|
||||||
|
|
||||||
public function __construct(Event $event, string $eventName, string $eventLocation, string $postalCode, string $email, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $alcoholicsAge, bool $sendWeeklyReports, bool $registrationAllowed, Amount $flatSupport, Amount $supportPerPerson, array $contributingLocalGroups, array $eatingHabits, bool $shortRegistration = false, bool $swimmingPermissionRequired = true, ?string $street = null, ?string $houseNumber = null)
|
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;
|
||||||
$this->street = $street;
|
|
||||||
$this->houseNumber = $houseNumber;
|
|
||||||
$this->postalCode = $postalCode;
|
$this->postalCode = $postalCode;
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
$this->earlyBirdEnd = $earlyBirdEnd;
|
$this->earlyBirdEnd = $earlyBirdEnd;
|
||||||
@@ -40,8 +34,6 @@ class UpdateEventRequest {
|
|||||||
$this->alcoholicsAge = $alcoholicsAge;
|
$this->alcoholicsAge = $alcoholicsAge;
|
||||||
$this->sendWeeklyReports = $sendWeeklyReports;
|
$this->sendWeeklyReports = $sendWeeklyReports;
|
||||||
$this->registrationAllowed = $registrationAllowed;
|
$this->registrationAllowed = $registrationAllowed;
|
||||||
$this->shortRegistration = $shortRegistration;
|
|
||||||
$this->swimmingPermissionRequired = $swimmingPermissionRequired;
|
|
||||||
$this->flatSupport = $flatSupport;
|
$this->flatSupport = $flatSupport;
|
||||||
$this->supportPerPerson = $supportPerPerson;
|
$this->supportPerPerson = $supportPerPerson;
|
||||||
$this->contributingLocalGroups = $contributingLocalGroups;
|
$this->contributingLocalGroups = $contributingLocalGroups;
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ class UpdateParticipantCommand {
|
|||||||
$p->address_2 = $this->request->address_2;
|
$p->address_2 = $this->request->address_2;
|
||||||
$p->postcode = $this->request->postcode;
|
$p->postcode = $this->request->postcode;
|
||||||
$p->city = $this->request->city;
|
$p->city = $this->request->city;
|
||||||
// Leerer String würde als Fremdschlüssel scheitern -- kein Stamm heißt null.
|
$p->local_group = $this->request->localgroup;
|
||||||
$p->local_group = $this->request->localgroup ?: null;
|
|
||||||
$p->birthday = DateTime::createFromFormat('Y-m-d', $this->request->birthday);
|
$p->birthday = DateTime::createFromFormat('Y-m-d', $this->request->birthday);
|
||||||
$p->email_1 = $this->request->email_1;
|
$p->email_1 = $this->request->email_1;
|
||||||
$p->phone_1 = $this->request->phone_1;
|
$p->phone_1 = $this->request->phone_1;
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ class UpdateParticipantRequest {
|
|||||||
public ?string $address_2,
|
public ?string $address_2,
|
||||||
public string $postcode,
|
public string $postcode,
|
||||||
public string $city,
|
public string $city,
|
||||||
/** Stamm-Slug; leer/null bei Anmeldungen, die keinen Stamm erfasst haben (Kurzanmeldung). */
|
public string $localgroup,
|
||||||
public ?string $localgroup,
|
|
||||||
public string $birthday,
|
public string $birthday,
|
||||||
public string $email_1,
|
public string $email_1,
|
||||||
public string $phone_1,
|
public string $phone_1,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ class ArchivedEventsController extends CommonController
|
|||||||
'name' => $event->name,
|
'name' => $event->name,
|
||||||
'location' => $event->location,
|
'location' => $event->location,
|
||||||
'postalCode' => $event->postal_code,
|
'postalCode' => $event->postal_code,
|
||||||
'fullAddress' => $event->getFullAddress(),
|
|
||||||
'eventBegin' => $event->start_date->format('d.m.Y'),
|
'eventBegin' => $event->start_date->format('d.m.Y'),
|
||||||
'eventEnd' => $event->end_date->format('d.m.Y'),
|
'eventEnd' => $event->end_date->format('d.m.Y'),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Controllers;
|
|
||||||
|
|
||||||
use App\Domains\Event\Actions\BookBankStatementPayments\BookBankStatementPaymentsCommand;
|
|
||||||
use App\Domains\Event\Actions\BookBankStatementPayments\BookBankStatementPaymentsRequest;
|
|
||||||
use App\Scopes\CommonController;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bucht die in der Prüfansicht bestätigten Zahlungseingänge -- ein Aufruf für alle Zeilen.
|
|
||||||
*/
|
|
||||||
class BankStatementBookController extends CommonController
|
|
||||||
{
|
|
||||||
public function __invoke(int $eventId, Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
$event = $this->events->getById($eventId);
|
|
||||||
|
|
||||||
if ($event === null) {
|
|
||||||
return response()->json(['status' => 'error', 'message' => 'Die Veranstaltung wurde nicht gefunden.']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = new BookBankStatementPaymentsCommand(new BookBankStatementPaymentsRequest(
|
|
||||||
event: $event,
|
|
||||||
bookings: (array) $request->input('bookings', []),
|
|
||||||
))->execute();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => $response->success ? 'success' : 'error',
|
|
||||||
'message' => $response->message,
|
|
||||||
'booked' => $response->booked,
|
|
||||||
'skipped' => $response->skipped,
|
|
||||||
'failed' => $response->failed,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Controllers;
|
|
||||||
|
|
||||||
use App\Domains\Event\Actions\ParseBankStatement\ParseBankStatementCommand;
|
|
||||||
use App\Domains\Event\Actions\ParseBankStatement\ParseBankStatementRequest;
|
|
||||||
use App\Models\PaymentMethod;
|
|
||||||
use App\Scopes\CommonController;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nimmt den CSV-Export der Bank entgegen und liefert die Prüfansicht zurück. Gebucht wird hier nichts.
|
|
||||||
*/
|
|
||||||
class BankStatementParseController extends CommonController
|
|
||||||
{
|
|
||||||
public function __invoke(int $eventId, Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
$event = $this->events->getById($eventId);
|
|
||||||
|
|
||||||
if ($event === null) {
|
|
||||||
return response()->json(['status' => 'error', 'message' => 'Die Veranstaltung wurde nicht gefunden.']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Das Kontoauszug-Format kommt vom Mandanten, nicht aus dem Event-Snapshot: Ein Bankwechsel
|
|
||||||
// muss sofort auch für laufende Aktionen gelten.
|
|
||||||
$configuration = $this->paymentMethods->tenantConfiguration(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
|
|
||||||
|
|
||||||
$response = new ParseBankStatementCommand(new ParseBankStatementRequest(
|
|
||||||
event: $event,
|
|
||||||
file: $request->file('statement'),
|
|
||||||
configuration: $configuration,
|
|
||||||
))->execute();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => $response->success ? 'success' : 'error',
|
|
||||||
'message' => $response->message,
|
|
||||||
'rows' => $response->rows,
|
|
||||||
'participants' => $response->participants,
|
|
||||||
'skipped' => $response->skippedOlderThanWatermark,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,7 +21,7 @@ use Illuminate\Http\Request;
|
|||||||
class CreateController extends CommonController {
|
class CreateController extends CommonController {
|
||||||
public function __invoke() {
|
public function __invoke() {
|
||||||
return new InertiaProvider('Event/Create', [
|
return new InertiaProvider('Event/Create', [
|
||||||
'emailAddress' => currentUserOrFail()->email,
|
'emailAddress' => auth()->user()->email,
|
||||||
'eventAccount' => $this->tenant->account_name,
|
'eventAccount' => $this->tenant->account_name,
|
||||||
'eventIban' => $this->tenant->account_iban,
|
'eventIban' => $this->tenant->account_iban,
|
||||||
'eventPayPerDay' => $this->tenant->slug === 'lv' ? true : false,
|
'eventPayPerDay' => $this->tenant->slug === 'lv' ? true : false,
|
||||||
@@ -56,9 +56,7 @@ class CreateController extends CommonController {
|
|||||||
$participationFeeType,
|
$participationFeeType,
|
||||||
$request->input('eventAccount'),
|
$request->input('eventAccount'),
|
||||||
$request->input('eventIban'),
|
$request->input('eventIban'),
|
||||||
$payPerDay,
|
$payPerDay
|
||||||
$request->input('eventStreet'),
|
|
||||||
$request->input('eventHouseNumber')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$wasSuccessful = false;
|
$wasSuccessful = false;
|
||||||
|
|||||||
@@ -60,11 +60,7 @@ class DetailsController extends CommonController {
|
|||||||
$flatSupport,
|
$flatSupport,
|
||||||
$supportPerPerson,
|
$supportPerPerson,
|
||||||
$contributinLocalGroups,
|
$contributinLocalGroups,
|
||||||
$eatingHabits,
|
$eatingHabits
|
||||||
(bool)$request->input('shortRegistration', false),
|
|
||||||
(bool)$request->input('swimmingPermissionRequired', true),
|
|
||||||
$request->input('street'),
|
|
||||||
$request->input('houseNumber'),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
|
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<?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 . '"',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,7 +38,7 @@ class SendController extends CommonController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = currentUser();
|
$user = auth()->user();
|
||||||
$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(
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Controllers;
|
|
||||||
|
|
||||||
use App\RelationModels\EventParticipationFee;
|
|
||||||
use App\Scopes\CommonController;
|
|
||||||
use App\ValueObjects\Amount;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Beiträge einer Kurzanmeldung. Teilnahmegruppe und Zeitraum stehen fest; geliefert wird der Betrag je
|
|
||||||
* hinterlegter Beitragsstufe, damit der Client zwischen ihnen wählen kann, ohne erneut zu fragen. Der Endpunkt
|
|
||||||
* braucht keine Eingaben -- berechnet wird der gespeicherte Betrag bei der Anmeldung ohnehin neu.
|
|
||||||
*
|
|
||||||
* `amountValue` der gewählten Stufe steuert im Frontend, ob der Schritt "Zahlungsart" gezeigt wird; mehr als
|
|
||||||
* eine Stufe blendet den Schritt "Beitrag" ein.
|
|
||||||
*/
|
|
||||||
class ShortCalculateAmountController extends CommonController {
|
|
||||||
public function __invoke(int $eventId) : JsonResponse {
|
|
||||||
$event = $this->events->getById($eventId, false);
|
|
||||||
|
|
||||||
$participationFee = $event->firstParticipationFee();
|
|
||||||
$eventResource = $event->toResource();
|
|
||||||
|
|
||||||
$feeTypes = array_map(function (string $feeType) use ($event, $eventResource, $participationFee) {
|
|
||||||
$amount = $participationFee === null
|
|
||||||
? new Amount(0, 'Euro')
|
|
||||||
: $eventResource->calculateAmount(
|
|
||||||
$participationFee->type,
|
|
||||||
$feeType,
|
|
||||||
$event->start_date,
|
|
||||||
$event->end_date,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'value' => $feeType,
|
|
||||||
'label' => EventParticipationFee::FEE_TYPE_LABELS[$feeType],
|
|
||||||
'amount' => $amount->toString(),
|
|
||||||
'amountValue' => $amount->getAmount(),
|
|
||||||
];
|
|
||||||
}, $participationFee?->availableFeeTypes() ?? ['standard']);
|
|
||||||
|
|
||||||
return response()->json(['feeTypes' => $feeTypes]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domains\Event\Controllers;
|
|
||||||
|
|
||||||
use App\Domains\Event\Actions\CertificateOfConductionCheck\CertificateOfConductionCheckCommand;
|
|
||||||
use App\Domains\Event\Actions\CertificateOfConductionCheck\CertificateOfConductionCheckRequest;
|
|
||||||
use App\Domains\Event\Actions\ShortSignUp\ShortSignUpCommand;
|
|
||||||
use App\Domains\Event\Actions\ShortSignUp\ShortSignUpRequest;
|
|
||||||
use App\Enumerations\FirstAidPermission;
|
|
||||||
use App\Enumerations\SwimmingPermission;
|
|
||||||
use App\Mail\ParticipantParticipationMails\EventSignUpSuccessfullMail;
|
|
||||||
use App\Providers\DoubleCheckEventRegistrationProvider;
|
|
||||||
use App\RelationModels\EventParticipationFee;
|
|
||||||
use App\Scopes\CommonController;
|
|
||||||
use DateTime;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Mail;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nimmt die verkürzte Anmeldung entgegen. Öffentlich erreichbar, deshalb werden die Eingaben hier -- anders als
|
|
||||||
* im langen Prozess -- validiert, bevor sie die Action erreichen.
|
|
||||||
*/
|
|
||||||
class ShortSignupController extends CommonController {
|
|
||||||
public function __invoke(int $eventId, Request $request) : JsonResponse {
|
|
||||||
$event = $this->events->getById($eventId, false);
|
|
||||||
|
|
||||||
if (!$event->registration_allowed || new DateTime() > $event->start_date) {
|
|
||||||
return response()->json(['status' => 'closed'], 403);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Die Kurzanmeldung darf nicht als Abkürzung um den langen Prozess herum benutzt werden.
|
|
||||||
if (!$event->short_registration) {
|
|
||||||
return response()->json(['status' => 'closed'], 403);
|
|
||||||
}
|
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
|
||||||
'firstname' => 'required|string|max:255',
|
|
||||||
'lastname' => 'required|string|max:255',
|
|
||||||
'nickname' => 'nullable|string|max:255',
|
|
||||||
'birthday' => 'required|date_format:Y-m-d|before:today',
|
|
||||||
'email' => 'required|email|max:255',
|
|
||||||
'phone' => 'required|string|max:255',
|
|
||||||
// Gegen die teilnehmenden Stämme prüft der Command -- hier reicht die Typprüfung.
|
|
||||||
'localGroup' => 'nullable|integer',
|
|
||||||
'contactPerson' => 'nullable|string|max:255',
|
|
||||||
'contactEmail' => 'nullable|email|max:255',
|
|
||||||
'allergies' => 'nullable|string|max:255',
|
|
||||||
'intolerances' => 'nullable|string|max:255',
|
|
||||||
'firstAidPermission' => ['nullable', 'string', 'in:' . implode(',', FirstAidPermission::query()->pluck('slug')->toArray())],
|
|
||||||
'swimmingPermission' => ['nullable', 'string', 'in:' . implode(',', SwimmingPermission::query()->pluck('slug')->toArray())],
|
|
||||||
'foto' => 'array',
|
|
||||||
'participationOptions' => 'array',
|
|
||||||
'paymentMethod' => 'nullable|string',
|
|
||||||
'paymentOptions' => 'array',
|
|
||||||
// Ob die Stufe für die Teilnahmegruppe hinterlegt ist, prüft der Command.
|
|
||||||
'feeType' => 'nullable|string|in:' . implode(',', array_keys(EventParticipationFee::FEE_TYPE_LABELS)),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($validator->fails()) {
|
|
||||||
return response()->json(['status' => 'error', 'message' => $validator->errors()->first()], 422);
|
|
||||||
}
|
|
||||||
|
|
||||||
$birthday = DateTime::createFromFormat('Y-m-d', $request->input('birthday'));
|
|
||||||
|
|
||||||
$doubleCheck = new DoubleCheckEventRegistrationProvider(
|
|
||||||
$event,
|
|
||||||
$request->input('firstname'),
|
|
||||||
$request->input('lastname'),
|
|
||||||
$request->input('email'),
|
|
||||||
$birthday
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($doubleCheck->isRegistered()) {
|
|
||||||
return response()->json(['status' => 'exists']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$foto = (array)$request->input('foto', []);
|
|
||||||
|
|
||||||
$shortSignUpRequest = new ShortSignUpRequest(
|
|
||||||
event: $event,
|
|
||||||
user_id: currentUser()?->id,
|
|
||||||
firstname: $request->input('firstname'),
|
|
||||||
lastname: $request->input('lastname'),
|
|
||||||
nickname: $request->input('nickname'),
|
|
||||||
birthday: $birthday,
|
|
||||||
email: $request->input('email'),
|
|
||||||
phone: $request->input('phone'),
|
|
||||||
localGroupId: $request->input('localGroup') !== null ? (int)$request->input('localGroup') : null,
|
|
||||||
contactPerson: $request->input('contactPerson') ?: null,
|
|
||||||
contactEmail: $request->input('contactEmail') ?: null,
|
|
||||||
allergies: $request->input('allergies') ?: null,
|
|
||||||
intolerances: $request->input('intolerances') ?: null,
|
|
||||||
firstAidPermission: $request->input('firstAidPermission') ?: null,
|
|
||||||
swimmingPermission: $request->input('swimmingPermission') ?: null,
|
|
||||||
foto_socialmedia: (bool)($foto['socialmedia'] ?? false),
|
|
||||||
foto_print: (bool)($foto['print'] ?? false),
|
|
||||||
foto_webseite: (bool)($foto['webseite'] ?? false),
|
|
||||||
foto_partner: (bool)($foto['partner'] ?? false),
|
|
||||||
foto_intern: (bool)($foto['intern'] ?? false),
|
|
||||||
paymentMethod: $request->input('paymentMethod') ?: null,
|
|
||||||
paymentOptions: (array)$request->input('paymentOptions', []),
|
|
||||||
participationOptions: (array)$request->input('participationOptions', []),
|
|
||||||
feeType: $request->input('feeType') ?: 'standard',
|
|
||||||
);
|
|
||||||
|
|
||||||
$shortSignUpResponse = new ShortSignUpCommand($shortSignUpRequest)->execute();
|
|
||||||
|
|
||||||
if (!$shortSignUpResponse->success) {
|
|
||||||
return response()->json(['status' => 'error', 'message' => $shortSignUpResponse->message], 422);
|
|
||||||
}
|
|
||||||
|
|
||||||
$participant = $shortSignUpResponse->participant;
|
|
||||||
|
|
||||||
$cocResponse = new CertificateOfConductionCheckCommand(
|
|
||||||
new CertificateOfConductionCheckRequest($participant)
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$participant->efz_status = $cocResponse->status;
|
|
||||||
$participant->save();
|
|
||||||
|
|
||||||
Mail::to($participant->email_1)->send(new EventSignUpSuccessfullMail(participant: $participant));
|
|
||||||
|
|
||||||
if ($participant->email_2 !== null) {
|
|
||||||
Mail::to($participant->email_2)->send(new EventSignUpSuccessfullMail(participant: $participant));
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'participant' => $participant->toResource()->toArray($request),
|
|
||||||
'status' => 'success',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -35,9 +35,8 @@ class SignupController extends CommonController {
|
|||||||
'lastname' => '',
|
'lastname' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$currentUser = currentUser();
|
if (auth()->check()) {
|
||||||
if ($currentUser !== null) {
|
$user = new UserResource(auth()->user())->toArray($request);
|
||||||
$user = new UserResource($currentUser)->toArray($request);
|
|
||||||
|
|
||||||
$participantData = [
|
$participantData = [
|
||||||
'id' => $user['id'],
|
'id' => $user['id'],
|
||||||
@@ -151,8 +150,6 @@ class SignupController extends CommonController {
|
|||||||
(array)($registrationData['paymentOptions'] ?? []),
|
(array)($registrationData['paymentOptions'] ?? []),
|
||||||
(array)($registrationData['participationOptions'] ?? []),
|
(array)($registrationData['participationOptions'] ?? []),
|
||||||
$addonResolution['items'],
|
$addonResolution['items'],
|
||||||
$registrationData['beitrag'],
|
|
||||||
$siblingReduction,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$signupCommand = new SignUpCommand($signupRequest);
|
$signupCommand = new SignUpCommand($signupRequest);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Domains\Event\Controllers\BankStatementBookController;
|
|
||||||
use App\Domains\Event\Controllers\BankStatementParseController;
|
|
||||||
use App\Domains\Event\Controllers\CreateController;
|
use App\Domains\Event\Controllers\CreateController;
|
||||||
use App\Domains\Event\Controllers\DetailsController;
|
use App\Domains\Event\Controllers\DetailsController;
|
||||||
use App\Domains\Event\Controllers\EventArchiveController;
|
use App\Domains\Event\Controllers\EventArchiveController;
|
||||||
@@ -16,8 +14,6 @@ use App\Domains\Event\Controllers\ParticipantReSignOnController;
|
|||||||
use App\Domains\Event\Controllers\ParticipantSignOffController;
|
use App\Domains\Event\Controllers\ParticipantSignOffController;
|
||||||
use App\Domains\Event\Controllers\ParticipantUpdateController;
|
use App\Domains\Event\Controllers\ParticipantUpdateController;
|
||||||
use App\Domains\Event\Controllers\PaymentReminderController;
|
use App\Domains\Event\Controllers\PaymentReminderController;
|
||||||
use App\Domains\Event\Controllers\ShortCalculateAmountController;
|
|
||||||
use App\Domains\Event\Controllers\ShortSignupController;
|
|
||||||
use App\Domains\Event\Controllers\SignupController;
|
use App\Domains\Event\Controllers\SignupController;
|
||||||
use App\Middleware\IdentifyTenant;
|
use App\Middleware\IdentifyTenant;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
@@ -29,9 +25,6 @@ Route::prefix('api/v1')
|
|||||||
Route::post('{eventId}/calculate-amount', [SignupController::class, 'calculateAmount']);
|
Route::post('{eventId}/calculate-amount', [SignupController::class, 'calculateAmount']);
|
||||||
Route::post('{eventId}/signup', [SignupController::class, 'signUp']);
|
Route::post('{eventId}/signup', [SignupController::class, 'signUp']);
|
||||||
|
|
||||||
Route::post('{eventId}/short-calculate-amount', ShortCalculateAmountController::class);
|
|
||||||
Route::post('{eventId}/short-signup', ShortSignupController::class);
|
|
||||||
|
|
||||||
Route::middleware(['auth'])->group(function () {
|
Route::middleware(['auth'])->group(function () {
|
||||||
Route::post('/create', [CreateController::class, 'doCreate']);
|
Route::post('/create', [CreateController::class, 'doCreate']);
|
||||||
|
|
||||||
@@ -55,9 +48,6 @@ Route::prefix('api/v1')
|
|||||||
Route::post('/payment-methods', [DetailsController::class, 'updatePaymentMethods']);
|
Route::post('/payment-methods', [DetailsController::class, 'updatePaymentMethods']);
|
||||||
Route::post('/participation-options', [DetailsController::class, 'updateParticipationOptions']);
|
Route::post('/participation-options', [DetailsController::class, 'updateParticipationOptions']);
|
||||||
Route::post('/event-addons', [DetailsController::class, 'updateEventAddons']);
|
Route::post('/event-addons', [DetailsController::class, 'updateEventAddons']);
|
||||||
|
|
||||||
Route::post('/bank-statement/parse', BankStatementParseController::class);
|
|
||||||
Route::post('/bank-statement/book', BankStatementBookController::class);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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;
|
||||||
@@ -19,10 +18,6 @@ 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']);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ async function unarchiveEvent(eventId) {
|
|||||||
<div>
|
<div>
|
||||||
<h2 style="margin: 0 0 4px 0; font-size: 1.1rem; font-weight: 600;">{{ event.name }}</h2>
|
<h2 style="margin: 0 0 4px 0; font-size: 1.1rem; font-weight: 600;">{{ event.name }}</h2>
|
||||||
<span style="color: #6b7280; font-size: 0.875rem;">
|
<span style="color: #6b7280; font-size: 0.875rem;">
|
||||||
{{ event.fullAddress }}
|
{{ event.postalCode }} {{ event.location }}
|
||||||
·
|
·
|
||||||
{{ event.eventBegin }} – {{ event.eventEnd }}
|
{{ event.eventBegin }} – {{ event.eventEnd }}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
eventName: '',
|
eventName: '',
|
||||||
eventPostalCode: '',
|
eventPostalCode: '',
|
||||||
eventLocation: '',
|
eventLocation: '',
|
||||||
eventStreet: '',
|
|
||||||
eventHouseNumber: '',
|
|
||||||
eventEmail: props.emailAddress ? props.emailAddress : '',
|
eventEmail: props.emailAddress ? props.emailAddress : '',
|
||||||
eventBegin: '',
|
eventBegin: '',
|
||||||
eventEnd: '',
|
eventEnd: '',
|
||||||
@@ -147,8 +145,6 @@
|
|||||||
eventName: formData.eventName,
|
eventName: formData.eventName,
|
||||||
eventPostalCode: formData.eventPostalCode,
|
eventPostalCode: formData.eventPostalCode,
|
||||||
eventLocation: formData.eventLocation,
|
eventLocation: formData.eventLocation,
|
||||||
eventStreet: formData.eventStreet,
|
|
||||||
eventHouseNumber: formData.eventHouseNumber,
|
|
||||||
eventEmail: formData.eventEmail,
|
eventEmail: formData.eventEmail,
|
||||||
eventBegin: formData.eventBegin,
|
eventBegin: formData.eventBegin,
|
||||||
eventEnd: formData.eventEnd,
|
eventEnd: formData.eventEnd,
|
||||||
@@ -199,16 +195,6 @@
|
|||||||
<ErrorText :message="errors.eventLocation" /></td>
|
<ErrorText :message="errors.eventLocation" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr style="vertical-align: top;">
|
|
||||||
<th class="width-medium pr-20 height-50">Straße (optional)</th>
|
|
||||||
<td class="height-50"><input type="text" v-model="formData.eventStreet" class="width-half-full" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr style="vertical-align: top;">
|
|
||||||
<th class="width-medium pr-20 height-50">Hausnummer (optional)</th>
|
|
||||||
<td class="height-50"><input type="text" v-model="formData.eventHouseNumber" class="width-half-full" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr style="vertical-align: top;">
|
<tr style="vertical-align: top;">
|
||||||
<th class="width-medium pr-20 height-50">Postleitzahl des Veranstaltungsorts</th>
|
<th class="width-medium pr-20 height-50">Postleitzahl des Veranstaltungsorts</th>
|
||||||
<td class="height-50"><input type="text" v-model="formData.eventPostalCode" class="width-half-full" />
|
<td class="height-50"><input type="text" v-model="formData.eventPostalCode" class="width-half-full" />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const props = defineProps({
|
|||||||
<div class="available-event-header">
|
<div class="available-event-header">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="available-event-title">{{ event.name }}</h2>
|
<h2 class="available-event-title">{{ event.name }}</h2>
|
||||||
<span class="available-event-location">{{ event.fullAddress }}</span>
|
<span class="available-event-location">{{ event.postalCode }} {{ event.location }}</span>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
v-if="event.registrationAllowed"
|
v-if="event.registrationAllowed"
|
||||||
@@ -47,7 +47,7 @@ const props = defineProps({
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Veranstaltungsort</th>
|
<th>Veranstaltungsort</th>
|
||||||
<td>{{ event.fullAddress }}</td>
|
<td>{{ event.postalCode }} {{ event.location }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Frühbuchen bis</th>
|
<th>Frühbuchen bis</th>
|
||||||
|
|||||||
@@ -1,635 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
import {computed, ref} from 'vue'
|
|
||||||
import {toast} from 'vue3-toastify'
|
|
||||||
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
|
||||||
import LoadingModal from "../../../../Views/Components/LoadingModal.vue";
|
|
||||||
import Icon from "../../../../Views/Components/Icon.vue";
|
|
||||||
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
|
|
||||||
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Zahlungseingänge aus dem CSV-Export der Bank einbuchen.
|
|
||||||
*
|
|
||||||
* Zwei Schritte: Datei einlesen (der Server ordnet zu und schlägt vor), dann die Prüfansicht
|
|
||||||
* bestätigen. Gebucht wird erst im zweiten Schritt und für alle Zeilen in einem Aufruf.
|
|
||||||
*/
|
|
||||||
const props = defineProps({
|
|
||||||
event: {type: Object, required: true},
|
|
||||||
})
|
|
||||||
const emit = defineEmits(['close', 'booked'])
|
|
||||||
|
|
||||||
const {request} = useAjax()
|
|
||||||
|
|
||||||
const fileInput = ref(null)
|
|
||||||
const fileName = ref('')
|
|
||||||
const parsing = ref(false)
|
|
||||||
const booking = ref(false)
|
|
||||||
|
|
||||||
const rows = ref([])
|
|
||||||
const participants = ref([])
|
|
||||||
// rowNumber -> identifier ('' = ignorieren)
|
|
||||||
const assignment = ref({})
|
|
||||||
const parsed = ref(false)
|
|
||||||
const skipped = ref(0)
|
|
||||||
|
|
||||||
const assignedCount = computed(
|
|
||||||
() => rows.value.filter(row => isAssigned(row)).length,
|
|
||||||
)
|
|
||||||
|
|
||||||
const openCount = computed(() => rows.value.length - assignedCount.value)
|
|
||||||
|
|
||||||
const participantsByIdentifier = computed(
|
|
||||||
() => Object.fromEntries(participants.value.map(participant => [participant.identifier, participant])),
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Die Auswahlliste für alle Zeilen -- einmal gebaut, nicht je Zeile.
|
|
||||||
*
|
|
||||||
* Getrennt nach an- und abgemeldet, weil die Entscheidung unterschiedlich weit trägt: Eine Buchung
|
|
||||||
* auf eine abgemeldete Anmeldung zieht eine Erstattung nach sich. Als Fließtext in einer Zeile ging
|
|
||||||
* das unter, als Gruppenüberschrift steht es da.
|
|
||||||
*/
|
|
||||||
const participantOptions = computed(() => {
|
|
||||||
const options = [{value: '', label: '— ignorieren —'}]
|
|
||||||
|
|
||||||
for (const participant of participants.value) {
|
|
||||||
const state = participant.isSettled ? 'vollständig bezahlt' : participant.amountOpen + ' offen'
|
|
||||||
|
|
||||||
options.push(participant.isSignedOff
|
|
||||||
? {
|
|
||||||
value: participant.identifier,
|
|
||||||
label: participant.name,
|
|
||||||
description: 'abgemeldet am ' + participant.signedOffAt + ' · ' + state,
|
|
||||||
group: 'Abgemeldete Teilis',
|
|
||||||
icon: 'user-slash',
|
|
||||||
muted: true,
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
value: participant.identifier,
|
|
||||||
label: participant.name,
|
|
||||||
description: state,
|
|
||||||
group: 'Angemeldete Teilis',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return options
|
|
||||||
})
|
|
||||||
|
|
||||||
function isAssigned(row) {
|
|
||||||
return (assignment.value[row.rowNumber] ?? '') !== ''
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Der sichtbare Button klickt das versteckte Datei-Element -- wie beim Beleg-Upload der Abrechnung. */
|
|
||||||
function chooseFile() {
|
|
||||||
fileInput.value?.click()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Auswählen und Einlesen sind ein Schritt: Ein zweiter Klick brächte nichts zu entscheiden. */
|
|
||||||
async function onFileChosen(event) {
|
|
||||||
const file = event.target.files?.[0] ?? null
|
|
||||||
if (file === null) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fileName.value = file.name
|
|
||||||
await readStatement(file)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function readStatement(file) {
|
|
||||||
parsing.value = true
|
|
||||||
try {
|
|
||||||
const form = new FormData()
|
|
||||||
form.append('statement', file)
|
|
||||||
|
|
||||||
const response = await request(
|
|
||||||
'/api/v1/event/details/' + props.event.id + '/bank-statement/parse',
|
|
||||||
{method: 'POST', body: form},
|
|
||||||
)
|
|
||||||
|
|
||||||
if (response?.status !== 'success') {
|
|
||||||
toast.error(response?.message ?? 'Die Datei konnte nicht gelesen werden.')
|
|
||||||
reset()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
rows.value = response.rows ?? []
|
|
||||||
participants.value = response.participants ?? []
|
|
||||||
skipped.value = response.skipped ?? 0
|
|
||||||
// Vorschläge sind vorbelegt, aber nichts ist entschieden -- gebucht wird nur, was hier
|
|
||||||
// stehen bleibt.
|
|
||||||
assignment.value = Object.fromEntries(
|
|
||||||
rows.value.map(row => [row.rowNumber, row.suggestedIdentifier ?? '']),
|
|
||||||
)
|
|
||||||
parsed.value = true
|
|
||||||
} finally {
|
|
||||||
parsing.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function bookPayments() {
|
|
||||||
const bookings = rows.value
|
|
||||||
.filter(row => isAssigned(row))
|
|
||||||
.map(row => ({
|
|
||||||
participantIdentifier: assignment.value[row.rowNumber],
|
|
||||||
rowNumber: row.rowNumber,
|
|
||||||
paymentDate: row.paymentDate,
|
|
||||||
amount: row.amount,
|
|
||||||
payerName: row.payerName,
|
|
||||||
payerIban: row.payerIban,
|
|
||||||
purpose: row.purpose,
|
|
||||||
}))
|
|
||||||
|
|
||||||
if (bookings.length === 0) {
|
|
||||||
toast.error('Es ist keine Zahlung zugeordnet.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
booking.value = true
|
|
||||||
try {
|
|
||||||
const response = await request(
|
|
||||||
'/api/v1/event/details/' + props.event.id + '/bank-statement/book',
|
|
||||||
{method: 'POST', body: {bookings}},
|
|
||||||
)
|
|
||||||
|
|
||||||
if (response?.status !== 'success') {
|
|
||||||
toast.error(response?.message ?? 'Die Zahlungen konnten nicht gebucht werden.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
toast.success(response.message)
|
|
||||||
emit('booked')
|
|
||||||
emit('close')
|
|
||||||
} finally {
|
|
||||||
booking.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset() {
|
|
||||||
rows.value = []
|
|
||||||
participants.value = []
|
|
||||||
assignment.value = {}
|
|
||||||
parsed.value = false
|
|
||||||
skipped.value = 0
|
|
||||||
fileName.value = ''
|
|
||||||
if (fileInput.value) fileInput.value.value = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
function assignedParticipant(row) {
|
|
||||||
return participantsByIdentifier.value[assignment.value[row.rowNumber]] ?? null
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Der Zustand einer Zeile: was gebucht wird, was noch offen ist, was geprüft gehört. */
|
|
||||||
function rowState(row) {
|
|
||||||
if (!isAssigned(row)) {
|
|
||||||
return row.suggestedIdentifier === null
|
|
||||||
? {key: 'unmatched', label: 'Keine Zuordnung', icon: 'circle-question'}
|
|
||||||
: {key: 'ignored', label: 'Ignoriert', icon: 'ban'}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assignment.value[row.rowNumber] !== row.suggestedIdentifier) {
|
|
||||||
return {key: 'manual', label: 'Von Hand', icon: 'user-pen'}
|
|
||||||
}
|
|
||||||
|
|
||||||
return row.confidence === 'unsicher'
|
|
||||||
? {key: 'uncertain', label: 'Bitte prüfen', icon: 'triangle-exclamation'}
|
|
||||||
: {key: 'certain', label: 'Vorschlag', icon: 'check'}
|
|
||||||
}
|
|
||||||
|
|
||||||
function lastPaymentOf(row) {
|
|
||||||
return assignedParticipant(row)?.lastPaymentDate ?? null
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Eine Zahlung auf eine abgemeldete Anmeldung zieht eine Erstattung nach sich. */
|
|
||||||
function signedOffOf(row) {
|
|
||||||
const participant = assignedParticipant(row)
|
|
||||||
|
|
||||||
return participant?.isSignedOff === true ? participant : null
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<FullScreenModal :show="true" @close="emit('close')">
|
|
||||||
<div class="import">
|
|
||||||
<header class="import-header">
|
|
||||||
<h2>Zahlungseingänge einlesen</h2>
|
|
||||||
<p class="subtitle">{{ event.name }}</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<!-- Schritt 1: Datei wählen. Das Datei-Element bleibt versteckt, geklickt wird der Button. -->
|
|
||||||
<div v-if="!parsed" class="dropzone">
|
|
||||||
<Icon name="file-csv" class="dropzone-icon"/>
|
|
||||||
<p class="dropzone-title">Kontoauszug als CSV hochladen</p>
|
|
||||||
<p class="dropzone-note">
|
|
||||||
Der Export wird nur gelesen und nicht gespeichert. Gebucht wird anschließend
|
|
||||||
ausschließlich das, was ihr in der Prüfansicht bestätigt.
|
|
||||||
</p>
|
|
||||||
<input type="button" value="Kontoauszug auswählen" @click="chooseFile"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input ref="fileInput" type="file" accept=".csv,text/csv,text/plain"
|
|
||||||
style="display: none" @change="onFileChosen"/>
|
|
||||||
|
|
||||||
<template v-if="parsed">
|
|
||||||
<div class="filebar">
|
|
||||||
<span class="filename"><Icon name="file-csv"/> {{ fileName }}</span>
|
|
||||||
<label class="link" @click="reset">Andere Datei wählen</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="rows.length > 0" class="stats">
|
|
||||||
<div class="stat stat-assigned">
|
|
||||||
<span class="stat-value">{{ assignedCount }}</span>
|
|
||||||
<span class="stat-label">wird gebucht</span>
|
|
||||||
</div>
|
|
||||||
<div class="stat" :class="{'stat-open': openCount > 0}">
|
|
||||||
<span class="stat-value">{{ openCount }}</span>
|
|
||||||
<span class="stat-label">nicht zugeordnet</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="skipped > 0" class="stat">
|
|
||||||
<span class="stat-value">{{ skipped }}</span>
|
|
||||||
<span class="stat-label">bereits erfasst</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="rows.length === 0" class="empty">
|
|
||||||
<Icon name="circle-check" class="empty-icon"/>
|
|
||||||
<p>
|
|
||||||
In dieser Datei sind keine offenen Zahlungseingänge zu dieser Aktion enthalten.
|
|
||||||
<template v-if="skipped > 0">
|
|
||||||
{{ skipped }} Zahlungen wurden bereits früher eingebucht.
|
|
||||||
</template>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table v-else class="statement-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Buchung</th>
|
|
||||||
<th class="right">Betrag</th>
|
|
||||||
<th>Zahler*in</th>
|
|
||||||
<th>Verwendungszweck</th>
|
|
||||||
<th class="assignment-column">Zuordnung</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="row in rows" :key="row.rowNumber" :class="'state-' + rowState(row).key">
|
|
||||||
<td class="nowrap">{{ row.paymentDateFormatted }}</td>
|
|
||||||
<td class="right amount">{{ row.amountFormatted }}</td>
|
|
||||||
<td>
|
|
||||||
<span class="payer">{{ row.payerName || '—' }}</span>
|
|
||||||
<span v-if="row.payerIban" class="iban">{{ row.payerIban }}</span>
|
|
||||||
</td>
|
|
||||||
<td class="purpose">{{ row.purpose }}</td>
|
|
||||||
<td>
|
|
||||||
<div class="assignment">
|
|
||||||
<RichSelectBox v-model="assignment[row.rowNumber]"
|
|
||||||
:options="participantOptions"
|
|
||||||
placeholder="— ignorieren —"
|
|
||||||
filterable/>
|
|
||||||
<span class="pill" :class="'pill-' + rowState(row).key">
|
|
||||||
<Icon :key="rowState(row).icon" :name="rowState(row).icon"/> {{ rowState(row).label }}
|
|
||||||
</span>
|
|
||||||
<span v-if="signedOffOf(row)" class="pill pill-signedoff">
|
|
||||||
<Icon name="user-slash"/> Abgemeldet
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span v-if="signedOffOf(row)" class="hint hint-warning">
|
|
||||||
Am {{ signedOffOf(row).signedOffAt }} abgemeldet — die Zahlung wird
|
|
||||||
erfasst, danach steht eine Erstattung an.
|
|
||||||
</span>
|
|
||||||
<span v-if="lastPaymentOf(row)" class="hint">
|
|
||||||
Zuletzt erfasst: {{ lastPaymentOf(row) }}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<footer v-if="rows.length > 0" class="actions">
|
|
||||||
<span class="actions-note">
|
|
||||||
Die Teilnehmenden erhalten je Buchung die gewohnte Zahlungsmail.
|
|
||||||
</span>
|
|
||||||
<input type="button" class="accept-button"
|
|
||||||
:value="assignedCount === 1 ? '1 Zahlung einbuchen' : assignedCount + ' Zahlungen einbuchen'"
|
|
||||||
:disabled="assignedCount === 0 || booking"
|
|
||||||
@click="bookPayments"/>
|
|
||||||
</footer>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Beim Buchen geht je Zahlung eine Mail an die Teilnehmenden raus, und zwar synchron --
|
|
||||||
bei achtzig Buchungen dauert der Aufruf entsprechend. -->
|
|
||||||
<LoadingModal v-if="parsing || booking" :show="true"
|
|
||||||
:message="booking
|
|
||||||
? 'Die Zahlungen werden gebucht und die Teilnehmenden benachrichtigt. Das kann einen Moment dauern …'
|
|
||||||
: 'Der Kontoauszug wird gelesen …'"/>
|
|
||||||
</FullScreenModal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.import {
|
|
||||||
max-width: 1200px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.import-header {
|
|
||||||
border-bottom: 1px solid #e5e7eb;
|
|
||||||
padding-bottom: 12px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.import-header h2 {
|
|
||||||
margin: 0;
|
|
||||||
color: #1d4899;
|
|
||||||
}
|
|
||||||
|
|
||||||
.subtitle {
|
|
||||||
margin: 2px 0 0 0;
|
|
||||||
color: #6b7280;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Schritt 1: Datei wählen ───────────────────────────────────────────── */
|
|
||||||
|
|
||||||
.dropzone {
|
|
||||||
border: 2px dashed #c7d2e8;
|
|
||||||
border-radius: 10px;
|
|
||||||
background-color: #fafbfe;
|
|
||||||
padding: 48px 24px;
|
|
||||||
text-align: center;
|
|
||||||
max-width: 620px;
|
|
||||||
margin: 40px auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropzone-icon {
|
|
||||||
font-size: 2.6rem;
|
|
||||||
color: #809dd5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropzone-title {
|
|
||||||
margin: 14px 0 6px 0;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.05rem;
|
|
||||||
color: #374151;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropzone-note {
|
|
||||||
margin: 0 auto 22px auto;
|
|
||||||
max-width: 440px;
|
|
||||||
color: #6b7280;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Schritt 2: Prüfansicht ────────────────────────────────────────────── */
|
|
||||||
|
|
||||||
.filebar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 12px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 8px 12px;
|
|
||||||
background-color: #f9fafb;
|
|
||||||
border: 1px solid #e5e7eb;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filename {
|
|
||||||
color: #374151;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stats {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin: 16px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat {
|
|
||||||
flex: 1 1 130px;
|
|
||||||
border: 1px solid #e5e7eb;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px 14px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-value {
|
|
||||||
display: block;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #374151;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-label {
|
|
||||||
display: block;
|
|
||||||
color: #6b7280;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
margin-top: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-assigned {
|
|
||||||
border-color: #508c4c;
|
|
||||||
background-color: #f3faf3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-assigned .stat-value {
|
|
||||||
color: #2f6b2c;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-open .stat-value {
|
|
||||||
color: #92400e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty {
|
|
||||||
text-align: center;
|
|
||||||
color: #6b7280;
|
|
||||||
padding: 40px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-icon {
|
|
||||||
font-size: 2rem;
|
|
||||||
color: #508c4c;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statement-table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin-top: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statement-table th {
|
|
||||||
text-align: left;
|
|
||||||
padding: 8px 10px;
|
|
||||||
background-color: #f9fafb;
|
|
||||||
color: #374151;
|
|
||||||
border-bottom: 2px solid #d1d5db;
|
|
||||||
font-size: 0.82rem;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.03em;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statement-table td {
|
|
||||||
padding: 10px;
|
|
||||||
border-bottom: 1px solid #e5e7eb;
|
|
||||||
vertical-align: top;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statement-table .right {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nowrap {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.amount {
|
|
||||||
white-space: nowrap;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #374151;
|
|
||||||
}
|
|
||||||
|
|
||||||
.assignment-column {
|
|
||||||
width: 360px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Zeilenfarbe sagt auf einen Blick, was passiert: grün wird gebucht, gelb will geprüft werden,
|
|
||||||
grau bleibt liegen. */
|
|
||||||
.state-certain td,
|
|
||||||
.state-manual td {
|
|
||||||
background-color: #f6fdf7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.state-uncertain td {
|
|
||||||
background-color: #fffbeb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.state-ignored td,
|
|
||||||
.state-unmatched td {
|
|
||||||
background-color: #fbfbfb;
|
|
||||||
color: #9ca3af;
|
|
||||||
}
|
|
||||||
|
|
||||||
.payer {
|
|
||||||
display: block;
|
|
||||||
color: #374151;
|
|
||||||
}
|
|
||||||
|
|
||||||
.iban {
|
|
||||||
display: block;
|
|
||||||
color: #9ca3af;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
margin-top: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.purpose {
|
|
||||||
max-width: 320px;
|
|
||||||
word-break: break-word;
|
|
||||||
color: #4b5563;
|
|
||||||
}
|
|
||||||
|
|
||||||
.assignment {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.pill {
|
|
||||||
align-self: flex-start;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 5px;
|
|
||||||
padding: 2px 9px;
|
|
||||||
border-radius: 11px;
|
|
||||||
font-size: 0.72rem;
|
|
||||||
font-weight: bold;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-certain {
|
|
||||||
color: #2f6b2c;
|
|
||||||
background-color: #dcfce7;
|
|
||||||
border-color: #86c884;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-manual {
|
|
||||||
color: #1d4899;
|
|
||||||
background-color: #e4ecfb;
|
|
||||||
border-color: #809dd5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-uncertain {
|
|
||||||
color: #92400e;
|
|
||||||
background-color: #fef3c7;
|
|
||||||
border-color: #d9b45c;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-ignored,
|
|
||||||
.pill-unmatched {
|
|
||||||
color: #6b7280;
|
|
||||||
background-color: #f3f4f6;
|
|
||||||
border-color: #d1d5db;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-signedoff {
|
|
||||||
color: #9a3412;
|
|
||||||
background-color: #ffedd5;
|
|
||||||
border-color: #e0a06a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hint {
|
|
||||||
display: block;
|
|
||||||
color: #9ca3af;
|
|
||||||
font-size: 0.72rem;
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hint-warning {
|
|
||||||
color: #9a3412;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 16px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-top: 20px;
|
|
||||||
padding-top: 16px;
|
|
||||||
border-top: 1px solid #e5e7eb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions-note {
|
|
||||||
color: #6b7280;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions input[disabled] {
|
|
||||||
opacity: 0.5;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Schmale Bildschirme ───────────────────────────────────────────────── */
|
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.assignment-column {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statement-table th {
|
|
||||||
position: static;
|
|
||||||
}
|
|
||||||
|
|
||||||
.purpose {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -27,8 +27,6 @@ const emit = defineEmits(['close'])
|
|||||||
contributingLocalGroups: contributingLocalGroups.value,
|
contributingLocalGroups: contributingLocalGroups.value,
|
||||||
eventName: props.event.name,
|
eventName: props.event.name,
|
||||||
eventLocation: props.event.location,
|
eventLocation: props.event.location,
|
||||||
street: props.event.street ?? '',
|
|
||||||
houseNumber: props.event.houseNumber ?? '',
|
|
||||||
postalCode: props.event.postalCode,
|
postalCode: props.event.postalCode,
|
||||||
email: props.event.email,
|
email: props.event.email,
|
||||||
earlyBirdEnd: props.event.earlyBirdEnd.internal,
|
earlyBirdEnd: props.event.earlyBirdEnd.internal,
|
||||||
@@ -37,8 +35,6 @@ const emit = defineEmits(['close'])
|
|||||||
eatingHabits: eatingHabits.value,
|
eatingHabits: eatingHabits.value,
|
||||||
sendWeeklyReports: props.event.sendWeeklyReports,
|
sendWeeklyReports: props.event.sendWeeklyReports,
|
||||||
registrationAllowed: props.event.registrationAllowed,
|
registrationAllowed: props.event.registrationAllowed,
|
||||||
shortRegistration: props.event.shortRegistration,
|
|
||||||
swimmingPermissionRequired: props.event.swimmingPermissionRequired,
|
|
||||||
flatSupport: props.event.flatSupportEdit,
|
flatSupport: props.event.flatSupportEdit,
|
||||||
supportPerson: props.event.supportPersonIndex,
|
supportPerson: props.event.supportPersonIndex,
|
||||||
})
|
})
|
||||||
@@ -61,8 +57,6 @@ const emit = defineEmits(['close'])
|
|||||||
body: {
|
body: {
|
||||||
eventName: formData.eventName,
|
eventName: formData.eventName,
|
||||||
eventLocation: formData.eventLocation,
|
eventLocation: formData.eventLocation,
|
||||||
street: formData.street,
|
|
||||||
houseNumber: formData.houseNumber,
|
|
||||||
postalCode: formData.postalCode,
|
postalCode: formData.postalCode,
|
||||||
email: formData.email,
|
email: formData.email,
|
||||||
earlyBirdEnd: formData.earlyBirdEnd,
|
earlyBirdEnd: formData.earlyBirdEnd,
|
||||||
@@ -70,8 +64,6 @@ const emit = defineEmits(['close'])
|
|||||||
alcoholicsAge: formData.alcoholicsAge,
|
alcoholicsAge: formData.alcoholicsAge,
|
||||||
sendWeeklyReports: formData.sendWeeklyReports,
|
sendWeeklyReports: formData.sendWeeklyReports,
|
||||||
registrationAllowed: formData.registrationAllowed,
|
registrationAllowed: formData.registrationAllowed,
|
||||||
shortRegistration: formData.shortRegistration,
|
|
||||||
swimmingPermissionRequired: formData.swimmingPermissionRequired,
|
|
||||||
flatSupport: formData.flatSupport,
|
flatSupport: formData.flatSupport,
|
||||||
supportPerson: formData.supportPerson,
|
supportPerson: formData.supportPerson,
|
||||||
contributingLocalGroups: contributingLocalGroups.value,
|
contributingLocalGroups: contributingLocalGroups.value,
|
||||||
@@ -113,20 +105,6 @@ const emit = defineEmits(['close'])
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>Straße (optional)</th>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.street" class="width-full" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>Hausnummer (optional)</th>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.houseNumber" class="width-full" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Postleitzahl des Veranstaltungsorts</th>
|
<th>Postleitzahl des Veranstaltungsorts</th>
|
||||||
<td>
|
<td>
|
||||||
@@ -194,27 +172,6 @@ const emit = defineEmits(['close'])
|
|||||||
<label for="registrationAllowed">Veranstaltung ist für Anmeldungen geöffnet</label>
|
<label for="registrationAllowed">Veranstaltung ist für Anmeldungen geöffnet</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
<input type="checkbox" v-model="formData.shortRegistration" id="shortRegistration" />
|
|
||||||
<label for="shortRegistration">Verkürzte Anmeldung verwenden</label><br />
|
|
||||||
<span style="font-size: 0.8rem; color: #6b7280;">
|
|
||||||
Fragt nur die nötigsten Daten ab (Name, Kontakt, Allergien, Foto-Erlaubnis).
|
|
||||||
Nicht erhobene Angaben wie Anschrift und An-/Abreise werden automatisch gefüllt.
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
<input type="checkbox" v-model="formData.swimmingPermissionRequired" id="swimmingPermissionRequired" />
|
|
||||||
<label for="swimmingPermissionRequired">Badeerlaubnis abfragen</label><br />
|
|
||||||
<span style="font-size: 0.8rem; color: #6b7280;">
|
|
||||||
Ist die Abfrage deaktiviert, wird für Minderjährige „Keine Badeerlaubnis" hinterlegt.
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import EventAddons from "./EventAddons.vue";
|
|||||||
import ParticipationSummary from "./ParticipationSummary.vue";
|
import ParticipationSummary from "./ParticipationSummary.vue";
|
||||||
import CommonSettings from "./CommonSettings.vue";
|
import CommonSettings from "./CommonSettings.vue";
|
||||||
import EventManagement from "./EventManagement.vue";
|
import EventManagement from "./EventManagement.vue";
|
||||||
import BankStatementImport from "./BankStatementImport.vue";
|
|
||||||
import Modal from "../../../../Views/Components/Modal.vue";
|
import Modal from "../../../../Views/Components/Modal.vue";
|
||||||
import MailCompose from "./MailCompose.vue";
|
import MailCompose from "./MailCompose.vue";
|
||||||
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
||||||
@@ -22,12 +21,6 @@ const props = defineProps({
|
|||||||
|
|
||||||
const displayData = ref('main');
|
const displayData = ref('main');
|
||||||
const showEventData = ref(false);
|
const showEventData = ref(false);
|
||||||
const showBankStatement = ref(false);
|
|
||||||
|
|
||||||
// Nach dem Buchen stimmen die Beitragsstände der Übersicht nicht mehr -- neu laden.
|
|
||||||
async function bankStatementBooked() {
|
|
||||||
await showMain();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function showMain() {
|
async function showMain() {
|
||||||
@@ -113,10 +106,6 @@ async function showEventAddons() {
|
|||||||
<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/>
|
||||||
@@ -124,18 +113,9 @@ async function showEventAddons() {
|
|||||||
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'">
|
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'">
|
||||||
<input type="button" value="Foto-Erlaubnis (PDF)" />
|
<input type="button" value="Foto-Erlaubnis (PDF)" />
|
||||||
</a><br/>
|
</a><br/>
|
||||||
|
|
||||||
<input type="button" value="Zahlungseingänge einlesen" @click="showBankStatement = true" /><br/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Liegt außerhalb der displayData-Umschaltung: Der Import ist ein Vollbild-Dialog über der
|
|
||||||
Übersicht, keine Unter-Ansicht, und soll auch aus einer Unter-Ansicht heraus erreichbar sein. -->
|
|
||||||
<BankStatementImport v-if="showBankStatement && dynamicProps.event"
|
|
||||||
:event="dynamicProps.event"
|
|
||||||
@close="showBankStatement = false"
|
|
||||||
@booked="bankStatementBooked" />
|
|
||||||
|
|
||||||
<ParticipationFees v-if="displayData === 'participationFees'" :event="dynamicProps.event" @close="showMain" />
|
<ParticipationFees v-if="displayData === 'participationFees'" :event="dynamicProps.event" @close="showMain" />
|
||||||
<ParticipationOptions v-else-if="displayData === 'participationOptions'" :event="dynamicProps.event"
|
<ParticipationOptions v-else-if="displayData === 'participationOptions'" :event="dynamicProps.event"
|
||||||
@close="showMain"/>
|
@close="showMain"/>
|
||||||
@@ -163,10 +143,6 @@ async function showEventAddons() {
|
|||||||
<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/>
|
||||||
@@ -174,7 +150,6 @@ async function showEventAddons() {
|
|||||||
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'">
|
<a :href="'/event/details/' + props.data.event.identifier + '/pdf/photo-permission-list'">
|
||||||
<input type="button" value="Foto-Erlaubnis (PDF)" />
|
<input type="button" value="Foto-Erlaubnis (PDF)" />
|
||||||
</a><br/>
|
</a><br/>
|
||||||
<input type="button" value="Zahlungseingänge einlesen" @click="showBankStatement = true" /><br/>
|
|
||||||
<input type="button" @click="sendPaymentReminder" class="fix-button" value="Zahlungserinnerung senden" /><br/>
|
<input type="button" @click="sendPaymentReminder" class="fix-button" value="Zahlungserinnerung senden" /><br/>
|
||||||
<input type="button" class="deny-button" value="Letzte Mahnung senden" style="display: none" /><br/>
|
<input type="button" class="deny-button" value="Letzte Mahnung senden" style="display: none" /><br/>
|
||||||
<input type="button" value="Rundmail senden" @click="mailToGroup" /><br/>
|
<input type="button" value="Rundmail senden" @click="mailToGroup" /><br/>
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {computed, onMounted, reactive, ref, watch} from "vue";
|
import {computed, onMounted, reactive, 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,
|
||||||
@@ -150,31 +146,6 @@ 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();
|
||||||
@@ -233,7 +204,6 @@ function saveParticipant() {
|
|||||||
<td>
|
<td>
|
||||||
<span v-if="!staticProps.editMode">{{ props.participant.localgroup }}</span>
|
<span v-if="!staticProps.editMode">{{ props.participant.localgroup }}</span>
|
||||||
<select v-else v-model="form.localgroup">
|
<select v-else v-model="form.localgroup">
|
||||||
<option value="">Kein Stamm</option>
|
|
||||||
<option v-for="group in staticProps.event.contributingLocalGroups" :key="group.id" :value="group.slug">{{ group.name }}</option>
|
<option v-for="group in staticProps.event.contributingLocalGroups" :key="group.id" :value="group.slug">{{ group.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@@ -378,29 +348,6 @@ 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 }}<template
|
|
||||||
v-if="props.participant.refund.donation"
|
|
||||||
> – gespendet, keine Auszahlung</template>
|
|
||||||
</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>
|
||||||
|
|
||||||
@@ -510,12 +457,6 @@ 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>
|
||||||
|
|
||||||
@@ -552,8 +493,4 @@ textarea {
|
|||||||
select {
|
select {
|
||||||
width: 262px;
|
width: 262px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.retention-note {
|
|
||||||
color: #8a6d00;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ 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: {
|
||||||
@@ -31,7 +29,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const today = format(new Date(), "yyyy-MM-dd");
|
const today = format(new Date(), "yyyy-MM-dd");
|
||||||
|
|
||||||
const { request, download } = useAjax();
|
const { request } = useAjax();
|
||||||
|
|
||||||
const searchTerms = reactive({});
|
const searchTerms = reactive({});
|
||||||
const selectedStatuses = reactive({});
|
const selectedStatuses = reactive({});
|
||||||
@@ -46,98 +44,6 @@ 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 refundResending = 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Das Konto, das die Zahlungsart kennt -- bei der Überweisung das des Zahlungseingangs.
|
|
||||||
*
|
|
||||||
* Ist es da, wird es weder erfragt noch bearbeitet: Erstattet wird auf das Konto, von dem der Beitrag
|
|
||||||
* kam, und genau das steht hier. `null`, solange nichts bekannt ist (Barzahlung, Altbestand).
|
|
||||||
*/
|
|
||||||
const knownRefundAccount = computed(
|
|
||||||
() => showParticipant.value?.refundData?.available ? showParticipant.value.refundData : null
|
|
||||||
);
|
|
||||||
|
|
||||||
const retainedAmountReadable = computed(
|
|
||||||
() => 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Beim bekannten Konto gibt es nichts einzugeben -- es steht fest.
|
|
||||||
if (refundForm.captureMode === 'management' && !knownRefundAccount.value) {
|
|
||||||
return refundForm.accountOwner.trim() !== '' && refundForm.accountIban.trim() !== '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
defineEmits(['showParticipantDetails', 'markCocExisting', 'paymentComplete'])
|
defineEmits(['showParticipantDetails', 'markCocExisting', 'paymentComplete'])
|
||||||
|
|
||||||
@@ -386,169 +292,6 @@ 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' && !knownRefundAccount.value) {
|
|
||||||
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. Beim
|
|
||||||
// Sofort-Einreichen mit bekanntem Konto geht dieses mit; eingegeben wurde nichts.
|
|
||||||
accountOwner: refundForm.captureMode === 'management'
|
|
||||||
? (knownRefundAccount.value?.accountOwner ?? refundForm.accountOwner)
|
|
||||||
: '',
|
|
||||||
accountIban: refundForm.captureMode === 'management'
|
|
||||||
? (knownRefundAccount.value?.accountIban ?? refundForm.accountIban)
|
|
||||||
: '',
|
|
||||||
// Spende: kein Konto, trotzdem sofort eingereicht.
|
|
||||||
donation: refundForm.captureMode === 'donation',
|
|
||||||
// Leer bei voller Erstattung -- dann gibt es nichts zu begründen.
|
|
||||||
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.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Die Mail zur freigegebenen Erstattung noch einmal schicken -- ohne Rückfrage, es ändert sich nichts am
|
|
||||||
* Vorgang. Der Guard verhindert, dass ein zweiter Klick eine zweite Mail auslöst, bevor die erste durch ist.
|
|
||||||
*/
|
|
||||||
async function execResendRefundMail(participant) {
|
|
||||||
if (refundResending.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
refundResending.value = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const data = await request('/api/v1/participant-refund/' + participant.refund.token + '/resend-mail', {
|
|
||||||
method: "POST",
|
|
||||||
});
|
|
||||||
|
|
||||||
if (data?.status === 'success') {
|
|
||||||
toast.success(data.message);
|
|
||||||
} else {
|
|
||||||
toast.error(data?.message ?? 'Die Rückerstattungsmail konnte nicht versendet werden.');
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
refundResending.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function downloadRefundDocument(participant) {
|
|
||||||
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('')
|
||||||
|
|
||||||
@@ -601,15 +344,6 @@ 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>
|
||||||
@@ -661,31 +395,6 @@ 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>Rückerstattung vorgemerkt:</strong> {{ participant.refund.amount }}
|
|
||||||
am {{ participant.refund.releasedAt }}, wartet auf Bankverbindung
|
|
||||||
<span class="link" @click="execResendRefundMail(participant)">Rückerstattungsmail erneut senden</span>
|
|
||||||
<span class="link" style="color: #da7070;" @click="execCancelRefund(participant)">Abbrechen</span>
|
|
||||||
</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>
|
||||||
@@ -751,162 +460,6 @@ 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 oder will der Teili spenden, entfällt der Umweg über ihn:
|
|
||||||
die Erstattung wird sofort eingereicht. Er bekommt den Beleg trotzdem.
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
Ist das Konto aus dem Zahlungseingang bekannt, wird es weder erfragt noch bearbeitet: Es
|
|
||||||
steht fest, dass auf genau dieses Konto zu erstatten ist. Der Teili entscheidet dann nur
|
|
||||||
noch, ob er es haben oder spenden möchte.
|
|
||||||
-->
|
|
||||||
<div v-if="knownRefundAccount" class="refund-known-account">
|
|
||||||
<strong>Konto aus dem Zahlungseingang</strong>
|
|
||||||
<span>{{ knownRefundAccount.accountOwner }}</span>
|
|
||||||
<span class="refund-known-account__iban">{{ knownRefundAccount.accountIban }}</span>
|
|
||||||
<span class="refund-known-account__source">{{ knownRefundAccount.source }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="refund-field">
|
|
||||||
<label class="refund-choice">
|
|
||||||
<input type="radio" value="participant" v-model="refundForm.captureMode" />
|
|
||||||
<template v-if="knownRefundAccount">
|
|
||||||
Teilnehmer*in bestätigt die Erstattung oder spendet
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
Teilnehmer*in trägt die Bankverbindung selbst ein
|
|
||||||
</template>
|
|
||||||
</label>
|
|
||||||
<label class="refund-choice">
|
|
||||||
<input type="radio" value="management" v-model="refundForm.captureMode" />
|
|
||||||
<template v-if="knownRefundAccount">
|
|
||||||
Sofort einreichen, ohne auf die Rückmeldung zu warten
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
Bankverbindung liegt mir vor
|
|
||||||
</template>
|
|
||||||
</label>
|
|
||||||
<label class="refund-choice">
|
|
||||||
<input type="radio" value="donation" v-model="refundForm.captureMode" />
|
|
||||||
Teilnehmer*in spendet den Betrag
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p v-if="refundForm.captureMode === 'donation'" class="refund-hint">
|
|
||||||
Der Betrag wird nicht ausgezahlt, sondern als Spende gebucht. Die Erstattung wird sofort
|
|
||||||
eingereicht; der Teili erhält den Beleg per E-Mail.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<!-- Bekanntes Konto: nichts einzugeben, es wird ohnehin dieses genommen. -->
|
|
||||||
<p v-if="refundForm.captureMode === 'management' && knownRefundAccount" class="refund-hint">
|
|
||||||
Die Erstattung wird sofort auf das oben genannte Konto eingereicht. Der Teili erhält den
|
|
||||||
Beleg per E-Mail, wird aber nicht mehr nach einer Spende gefragt.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<template v-if="refundForm.captureMode === 'management' && !knownRefundAccount">
|
|
||||||
<div class="refund-field">
|
|
||||||
<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-if="refundForm.captureMode === 'donation'">Als Spende einreichen</template>
|
|
||||||
<template v-else>Erstattung freigeben</template>
|
|
||||||
</button>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<FullScreenModal
|
<FullScreenModal
|
||||||
:show="mailCompose"
|
:show="mailCompose"
|
||||||
title="E-Mail senden"
|
title="E-Mail senden"
|
||||||
@@ -920,83 +473,6 @@ function mailToGroup(groupKey) {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.refund-intro {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: #4b5563;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Anzeige, kein Feld: bewusst nicht wie ein Eingabeblock gesetzt, damit gar nicht erst der Eindruck
|
|
||||||
entsteht, hier ließe sich etwas ändern. */
|
|
||||||
.refund-known-account {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 2px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
border: 1px solid #d1d5db;
|
|
||||||
border-radius: 6px;
|
|
||||||
background-color: #f9fafb;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refund-known-account__iban {
|
|
||||||
font-family: monospace;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
color: #4b5563;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refund-known-account__source {
|
|
||||||
color: #6b7280;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refund-field {
|
|
||||||
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;
|
||||||
|
|||||||
@@ -26,18 +26,6 @@ const paymentMethodConfigurations = reactive({})
|
|||||||
const showOptionsModal = ref(false)
|
const showOptionsModal = ref(false)
|
||||||
const optionsMethod = ref(null)
|
const optionsMethod = ref(null)
|
||||||
|
|
||||||
/**
|
|
||||||
* Die Optionen, die pro Aktion eingefroren werden.
|
|
||||||
*
|
|
||||||
* Optionen mit `scope: 'tenant'` bleiben draußen: Sie gelten für den ganzen Mandanten. Das
|
|
||||||
* Kontoauszug-Format etwa beschreibt die Bank, nicht die Zusage an die Teilnehmenden — hier
|
|
||||||
* eingefroren ließe sich nach einem Bankwechsel für laufende Aktionen nichts mehr importieren.
|
|
||||||
* Der Server hält sich beim Speichern an dieselbe Regel.
|
|
||||||
*/
|
|
||||||
function eventOptions(method) {
|
|
||||||
return (method?.optionsSchema ?? []).filter(option => option.scope !== 'tenant')
|
|
||||||
}
|
|
||||||
|
|
||||||
function openOptions(method) {
|
function openOptions(method) {
|
||||||
optionsMethod.value = method
|
optionsMethod.value = method
|
||||||
showOptionsModal.value = true
|
showOptionsModal.value = true
|
||||||
@@ -59,7 +47,7 @@ onMounted(async () => {
|
|||||||
for (const method of availablePaymentMethods.value) {
|
for (const method of availablePaymentMethods.value) {
|
||||||
const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {}
|
const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {}
|
||||||
const config = {}
|
const config = {}
|
||||||
for (const option of eventOptions(method)) {
|
for (const option of method.optionsSchema ?? []) {
|
||||||
config[option.name] = source[option.name] ?? ''
|
config[option.name] = source[option.name] ?? ''
|
||||||
}
|
}
|
||||||
paymentMethodConfigurations[method.slug] = config
|
paymentMethodConfigurations[method.slug] = config
|
||||||
@@ -370,7 +358,7 @@ onMounted(async () => {
|
|||||||
paymentMethod.name
|
paymentMethod.name
|
||||||
}}</label>
|
}}</label>
|
||||||
<label
|
<label
|
||||||
v-if="paymentMethods.includes(paymentMethod.slug) && eventOptions(paymentMethod).length > 0"
|
v-if="paymentMethods.includes(paymentMethod.slug) && (paymentMethod.optionsSchema?.length ?? 0) > 0"
|
||||||
class="link"
|
class="link"
|
||||||
style="padding-left: 15px; font-size: 10pt;"
|
style="padding-left: 15px; font-size: 10pt;"
|
||||||
@click="openOptions(paymentMethod)"
|
@click="openOptions(paymentMethod)"
|
||||||
@@ -393,7 +381,7 @@ onMounted(async () => {
|
|||||||
width="700px"
|
width="700px"
|
||||||
@close="showOptionsModal = false"
|
@close="showOptionsModal = false"
|
||||||
>
|
>
|
||||||
<div v-for="option in eventOptions(optionsMethod)" :key="option.name" class="payment-method-config-row">
|
<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>
|
<label>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></label>
|
||||||
<RichSelectBox v-if="option.type === 'icon'"
|
<RichSelectBox v-if="option.type === 'icon'"
|
||||||
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
|
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
|
||||||
|
|||||||
@@ -68,17 +68,6 @@ 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,146 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
import {computed} from 'vue'
|
|
||||||
import {useShortSignupForm} from './composables/useShortSignupForm.js'
|
|
||||||
import {
|
|
||||||
SHORT_STEP_PERSON,
|
|
||||||
SHORT_STEP_FEE,
|
|
||||||
SHORT_STEP_PARTICIPATION_OPTIONS,
|
|
||||||
SHORT_STEP_PHOTO,
|
|
||||||
SHORT_STEP_PAYMENT,
|
|
||||||
SHORT_STEP_SUMMARY,
|
|
||||||
stepVisible,
|
|
||||||
} from './composables/shortStepFlow.js'
|
|
||||||
import ShortStepPerson from './steps/ShortStepPerson.vue'
|
|
||||||
import ShortStepFee from './steps/ShortStepFee.vue'
|
|
||||||
import ShortStepSummary from './steps/ShortStepSummary.vue'
|
|
||||||
import StepParticipationOptions from '../SignUpForm/steps/StepParticipationOptions.vue'
|
|
||||||
import StepPhotoPermissions from '../SignUpForm/steps/StepPhotoPermissions.vue'
|
|
||||||
import StepPaymentMethod from '../SignUpForm/steps/StepPaymentMethod.vue'
|
|
||||||
import SubmitSuccess from '../SignUpForm/after-submit/SubmitSuccess.vue'
|
|
||||||
import SubmitAlreadyExists from '../SignUpForm/after-submit/SubmitAlreadyExists.vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
event: Object,
|
|
||||||
participantData: Object,
|
|
||||||
})
|
|
||||||
|
|
||||||
const {
|
|
||||||
currentStep, goToStep, goNext, goBack, formData, isMinor, localGroups, needsLocalGroup,
|
|
||||||
submit, submitting, submitResult, submitError,
|
|
||||||
summaryLoading, summaryAmount, feeOptions, selectedFee, flowState,
|
|
||||||
} = useShortSignupForm(props.event, props.participantData)
|
|
||||||
|
|
||||||
// Die aus dem langen Prozess übernommenen Schritte emittieren ihre Zielnummer aus jenem Flow mit. Hier zählt
|
|
||||||
// nur, dass "weiter" bzw. "zurück" gedrückt wurde -- die Reihenfolge kennt dieser Host.
|
|
||||||
const onNext = () => goNext()
|
|
||||||
const onBack = () => goBack()
|
|
||||||
|
|
||||||
const allSteps = [
|
|
||||||
{step: SHORT_STEP_PERSON, label: 'Person'},
|
|
||||||
{step: SHORT_STEP_FEE, label: 'Beitrag'},
|
|
||||||
{step: SHORT_STEP_PARTICIPATION_OPTIONS, label: 'Teilnahmeoptionen'},
|
|
||||||
{step: SHORT_STEP_PHOTO, label: 'Fotoerlaubnis'},
|
|
||||||
{step: SHORT_STEP_PAYMENT, label: 'Zahlungsart'},
|
|
||||||
{step: SHORT_STEP_SUMMARY, label: 'Zusammenfassung'},
|
|
||||||
]
|
|
||||||
|
|
||||||
// Nur die tatsächlich vorkommenden Schritte anzeigen, sonst zeigt die Leiste Schritte, die nie erscheinen.
|
|
||||||
const steps = computed(() =>
|
|
||||||
allSteps.filter(s => stepVisible(props.event, s.step, flowState.value))
|
|
||||||
)
|
|
||||||
|
|
||||||
const currentIndex = computed(() => steps.value.findIndex(s => s.step === currentStep.value))
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- Nach Submit -->
|
|
||||||
<SubmitSuccess
|
|
||||||
v-if="submitResult?.status === 'success'"
|
|
||||||
:participant="submitResult?.participant"
|
|
||||||
:event="event"
|
|
||||||
/>
|
|
||||||
<SubmitAlreadyExists v-else-if="submitResult?.status === 'exists'" :event="event" />
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<!-- Fortschrittsleiste -->
|
|
||||||
<div class="signup-progress">
|
|
||||||
<div class="signup-progress-pills">
|
|
||||||
<template v-for="(s, index) in steps" :key="s.step">
|
|
||||||
<div v-if="index > 0" class="signup-progress-separator"></div>
|
|
||||||
<div
|
|
||||||
class="signup-pill"
|
|
||||||
:class="{
|
|
||||||
'signup-pill--active': currentStep === s.step,
|
|
||||||
'signup-pill--done': currentStep > s.step,
|
|
||||||
'signup-pill--upcoming': currentStep < s.step,
|
|
||||||
}"
|
|
||||||
@click="currentStep > s.step ? goToStep(s.step) : null"
|
|
||||||
>
|
|
||||||
<span v-if="currentStep > s.step" class="signup-pill__check">✓</span>
|
|
||||||
{{ s.label }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="signup-progress-bar">
|
|
||||||
<div
|
|
||||||
class="signup-progress-bar__fill"
|
|
||||||
:style="{ width: (steps.length > 1 ? (currentIndex / (steps.length - 1)) * 100 : 100) + '%' }"
|
|
||||||
></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="signup-progress-mobile">
|
|
||||||
Schritt {{ currentIndex + 1 }} von {{ steps.length }}:
|
|
||||||
<strong>{{ steps.find(s => s.step === currentStep)?.label }}</strong>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Steps -->
|
|
||||||
<form @submit.prevent="submit">
|
|
||||||
<ShortStepPerson
|
|
||||||
v-if="currentStep === SHORT_STEP_PERSON"
|
|
||||||
:formData="formData" :event="event" :isMinor="isMinor"
|
|
||||||
:localGroups="localGroups" :needsLocalGroup="needsLocalGroup"
|
|
||||||
@next="onNext"
|
|
||||||
/>
|
|
||||||
<ShortStepFee
|
|
||||||
v-if="currentStep === SHORT_STEP_FEE"
|
|
||||||
:formData="formData" :feeOptions="feeOptions"
|
|
||||||
@next="onNext" @back="onBack"
|
|
||||||
/>
|
|
||||||
<StepParticipationOptions
|
|
||||||
v-if="currentStep === SHORT_STEP_PARTICIPATION_OPTIONS"
|
|
||||||
:formData="formData" :event="event"
|
|
||||||
@next="onNext" @back="onBack"
|
|
||||||
/>
|
|
||||||
<StepPhotoPermissions
|
|
||||||
v-if="currentStep === SHORT_STEP_PHOTO"
|
|
||||||
:formData="formData" :event="event"
|
|
||||||
@next="onNext" @back="onBack"
|
|
||||||
/>
|
|
||||||
<StepPaymentMethod
|
|
||||||
v-if="currentStep === SHORT_STEP_PAYMENT"
|
|
||||||
:formData="formData" :event="event"
|
|
||||||
@next="onNext" @back="onBack"
|
|
||||||
/>
|
|
||||||
<ShortStepSummary
|
|
||||||
v-if="currentStep === SHORT_STEP_SUMMARY"
|
|
||||||
:formData="formData"
|
|
||||||
:event="event"
|
|
||||||
:isMinor="isMinor"
|
|
||||||
:summaryAmount="summaryAmount"
|
|
||||||
:feeLabel="feeOptions.length > 1 ? selectedFee?.label : null"
|
|
||||||
:summaryLoading="summaryLoading"
|
|
||||||
:submitting="submitting"
|
|
||||||
:submitError="submitError"
|
|
||||||
@back="onBack"
|
|
||||||
@submit="submit"
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- Unscoped und mit dem langen Anmeldeprozess geteilt. -->
|
|
||||||
<style src="../SignUpForm/signupForm.css"></style>
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
// Schrittreihenfolge der Kurzanmeldung. Drei Schritte sind optional: der Beitrag erscheint nur, wenn neben dem
|
|
||||||
// Standardbeitrag weitere Stufen (reduziert, Solidarität) hinterlegt sind, die Teilnahmeoptionen entfallen, wenn für
|
|
||||||
// die Veranstaltung keine definiert sind, die Zahlungsart entfällt bei Betrag 0 oder wenn es ohnehin nur eine
|
|
||||||
// Zahlungsart gibt (die wird dann vorausgewählt).
|
|
||||||
export const SHORT_STEP_PERSON = 1
|
|
||||||
export const SHORT_STEP_FEE = 2
|
|
||||||
export const SHORT_STEP_PARTICIPATION_OPTIONS = 3
|
|
||||||
export const SHORT_STEP_PHOTO = 4
|
|
||||||
export const SHORT_STEP_PAYMENT = 5
|
|
||||||
export const SHORT_STEP_SUMMARY = 6
|
|
||||||
|
|
||||||
// `state` kommt mit den Beiträgen vom Server: { amountValue: Betrag der gewählten Stufe, feeOptionCount }.
|
|
||||||
export function stepVisible(event, step, state) {
|
|
||||||
if (step === SHORT_STEP_FEE) {
|
|
||||||
return state.feeOptionCount > 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (step === SHORT_STEP_PARTICIPATION_OPTIONS) {
|
|
||||||
return (event.participationOptions?.length ?? 0) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (step === SHORT_STEP_PAYMENT) {
|
|
||||||
const activeMethods = (event.paymentMethods ?? []).filter(m => m.active)
|
|
||||||
return state.amountValue > 0 && activeMethods.length > 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
export function nextVisibleFrom(event, step, state) {
|
|
||||||
let candidate = step + 1
|
|
||||||
while (candidate < SHORT_STEP_SUMMARY && !stepVisible(event, candidate, state)) {
|
|
||||||
candidate++
|
|
||||||
}
|
|
||||||
return candidate
|
|
||||||
}
|
|
||||||
|
|
||||||
export function prevVisibleFrom(event, step, state) {
|
|
||||||
let candidate = step - 1
|
|
||||||
while (candidate > SHORT_STEP_PERSON && !stepVisible(event, candidate, state)) {
|
|
||||||
candidate--
|
|
||||||
}
|
|
||||||
return candidate
|
|
||||||
}
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
import {computed, reactive, ref, watch} from 'vue'
|
|
||||||
import axios from 'axios'
|
|
||||||
import {differenceInYears, parseISO} from 'date-fns'
|
|
||||||
import {SHORT_STEP_PERSON, nextVisibleFrom, prevVisibleFrom} from './shortStepFlow.js'
|
|
||||||
|
|
||||||
export function useShortSignupForm(event, participantData) {
|
|
||||||
const currentStep = ref(SHORT_STEP_PERSON)
|
|
||||||
const submitting = ref(false)
|
|
||||||
const summaryLoading = ref(false)
|
|
||||||
const submitResult = ref(null) // null | { status: 'success'|'exists', participant: {} }
|
|
||||||
const submitError = ref('')
|
|
||||||
|
|
||||||
// Gibt es nur eine Zahlungsart, wird sie vorausgewählt und der Zahlungsschritt entfällt.
|
|
||||||
const activeMethods = (event.paymentMethods ?? []).filter(m => m.active)
|
|
||||||
|
|
||||||
// Bei genau einem teilnehmenden Stamm wird dieser gesetzt, ohne danach zu fragen; erst ab zwei
|
|
||||||
// Stämmen erscheint das Auswahlfeld.
|
|
||||||
const localGroups = event.contributingLocalGroups ?? []
|
|
||||||
const needsLocalGroup = localGroups.length > 1
|
|
||||||
|
|
||||||
const formData = reactive({
|
|
||||||
userId: participantData.id,
|
|
||||||
vorname: participantData.firstname ?? '',
|
|
||||||
nachname: participantData.lastname ?? '',
|
|
||||||
pfadiname: participantData.nickname ?? '',
|
|
||||||
geburtsdatum: participantData.birthday ?? '',
|
|
||||||
email_1: participantData.email ?? '',
|
|
||||||
telefon_1: participantData.phone ?? '',
|
|
||||||
localGroup: localGroups.length === 1 ? localGroups[0].id : (participantData.localGroup ?? '-1'),
|
|
||||||
ansprechpartner: '',
|
|
||||||
email_2: '',
|
|
||||||
allergien: participantData.allergies ?? '',
|
|
||||||
intolerances: participantData.intolerances ?? '',
|
|
||||||
first_aid: '-1',
|
|
||||||
badeerlaubnis: '-1',
|
|
||||||
// Beitragsstufe; wählbar nur, wenn weitere Stufen hinterlegt sind.
|
|
||||||
feeType: 'standard',
|
|
||||||
// Antworten auf die event-spezifischen Teilnahmeoptionen: { [question.key]: option.value }
|
|
||||||
participationOptions: {},
|
|
||||||
foto: {socialmedia: false, print: false, webseite: false, partner: false, intern: false},
|
|
||||||
paymentMethod: activeMethods.length === 1 ? activeMethods[0].slug : null,
|
|
||||||
paymentOptions: {},
|
|
||||||
summary_information_correct: false,
|
|
||||||
summary_accept_terms: false,
|
|
||||||
legal_accepted: false,
|
|
||||||
payment: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
// Minderjährigkeit steuert Kontaktperson, Erweiterte Erste Hilfe und Badeerlaubnis. Die Grenze von 18 Jahren
|
|
||||||
// entspricht Age::isfullAged() im Backend.
|
|
||||||
const isMinor = computed(() => {
|
|
||||||
if (!formData.geburtsdatum) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return differenceInYears(new Date(), parseISO(formData.geburtsdatum)) < 18
|
|
||||||
})
|
|
||||||
|
|
||||||
// Beitragsstufen mit fertig berechnetem Betrag: [{ value, label, amount, amountValue }]
|
|
||||||
const feeOptions = ref([])
|
|
||||||
const amountLoaded = ref(false)
|
|
||||||
|
|
||||||
const selectedFee = computed(() =>
|
|
||||||
feeOptions.value.find(option => option.value === formData.feeType) ?? feeOptions.value[0] ?? null
|
|
||||||
)
|
|
||||||
const summaryAmount = computed(() => selectedFee.value?.amount ?? '')
|
|
||||||
const summaryAmountValue = computed(() => Number(selectedFee.value?.amountValue ?? 0))
|
|
||||||
|
|
||||||
// Teilnahmegruppe und Zeitraum stehen für die ganze Anmeldung fest, deshalb werden die Beträge aller Stufen
|
|
||||||
// genau einmal geholt. Die Wahl der Stufe entscheidet dann nur noch lokal über den Betrag.
|
|
||||||
const ensureAmount = async () => {
|
|
||||||
if (amountLoaded.value) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
summaryLoading.value = true
|
|
||||||
try {
|
|
||||||
const res = await axios.post('/api/v1/event/' + event.id + '/short-calculate-amount')
|
|
||||||
feeOptions.value = res.data.feeTypes ?? []
|
|
||||||
amountLoaded.value = true
|
|
||||||
} finally {
|
|
||||||
summaryLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bei Betrag 0 gibt es nichts zu bezahlen. Wechselt die Stufe zurück auf einen Betrag, wird die einzige
|
|
||||||
// Zahlungsart wieder vorausgewählt -- sonst fragt sie niemand mehr ab.
|
|
||||||
watch(summaryAmountValue, (value) => {
|
|
||||||
if (value <= 0) {
|
|
||||||
formData.paymentMethod = null
|
|
||||||
formData.paymentOptions = {}
|
|
||||||
} else if (formData.paymentMethod === null && activeMethods.length === 1) {
|
|
||||||
formData.paymentMethod = activeMethods[0].slug
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const flowState = computed(() => ({
|
|
||||||
amountValue: summaryAmountValue.value,
|
|
||||||
feeOptionCount: feeOptions.value.length,
|
|
||||||
}))
|
|
||||||
|
|
||||||
const goToStep = (step) => {
|
|
||||||
currentStep.value = step
|
|
||||||
}
|
|
||||||
|
|
||||||
const goNext = async () => {
|
|
||||||
await ensureAmount()
|
|
||||||
goToStep(nextVisibleFrom(event, currentStep.value, flowState.value))
|
|
||||||
}
|
|
||||||
|
|
||||||
const goBack = async () => {
|
|
||||||
await ensureAmount()
|
|
||||||
goToStep(prevVisibleFrom(event, currentStep.value, flowState.value))
|
|
||||||
}
|
|
||||||
|
|
||||||
const submit = async () => {
|
|
||||||
if (!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
submitting.value = true
|
|
||||||
submitError.value = ''
|
|
||||||
try {
|
|
||||||
const res = await axios.post('/api/v1/event/' + event.id + '/short-signup', {
|
|
||||||
firstname: formData.vorname,
|
|
||||||
lastname: formData.nachname,
|
|
||||||
nickname: formData.pfadiname || null,
|
|
||||||
birthday: formData.geburtsdatum,
|
|
||||||
email: formData.email_1,
|
|
||||||
phone: formData.telefon_1,
|
|
||||||
localGroup: formData.localGroup !== '-1' ? formData.localGroup : null,
|
|
||||||
contactPerson: isMinor.value ? formData.ansprechpartner : null,
|
|
||||||
contactEmail: isMinor.value ? formData.email_2 : null,
|
|
||||||
allergies: formData.allergien || null,
|
|
||||||
intolerances: formData.intolerances || null,
|
|
||||||
firstAidPermission: isMinor.value && formData.first_aid !== '-1' ? formData.first_aid : null,
|
|
||||||
swimmingPermission: isMinor.value && formData.badeerlaubnis !== '-1' ? formData.badeerlaubnis : null,
|
|
||||||
foto: formData.foto,
|
|
||||||
participationOptions: formData.participationOptions,
|
|
||||||
paymentMethod: formData.paymentMethod,
|
|
||||||
paymentOptions: formData.paymentOptions,
|
|
||||||
feeType: formData.feeType,
|
|
||||||
})
|
|
||||||
|
|
||||||
submitResult.value = {
|
|
||||||
status: res.data.status,
|
|
||||||
participant: res.data.participant,
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
submitError.value = error.response?.data?.message
|
|
||||||
?? 'Die Anmeldung konnte nicht gespeichert werden. Bitte versuche es später erneut.'
|
|
||||||
} finally {
|
|
||||||
submitting.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
currentStep,
|
|
||||||
goToStep,
|
|
||||||
goNext,
|
|
||||||
goBack,
|
|
||||||
formData,
|
|
||||||
isMinor,
|
|
||||||
localGroups,
|
|
||||||
needsLocalGroup,
|
|
||||||
submit,
|
|
||||||
submitting,
|
|
||||||
submitResult,
|
|
||||||
submitError,
|
|
||||||
summaryLoading,
|
|
||||||
summaryAmount,
|
|
||||||
summaryAmountValue,
|
|
||||||
feeOptions,
|
|
||||||
selectedFee,
|
|
||||||
flowState,
|
|
||||||
ensureAmount,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
// Erscheint nur, wenn neben dem Standardbeitrag weitere Stufen hinterlegt sind. Die Beträge gelten für die gesamte
|
|
||||||
// Veranstaltung -- die Kurzanmeldung hat keinen wählbaren Zeitraum.
|
|
||||||
defineProps({
|
|
||||||
formData: Object,
|
|
||||||
feeOptions: {type: Array, default: () => []},
|
|
||||||
})
|
|
||||||
const emit = defineEmits(['next', 'back'])
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<h3>Teilnahmebeitrag</h3>
|
|
||||||
<p style="margin: 0 0 16px 0; color: #6b7280; font-size: 0.95rem;">
|
|
||||||
Bitte wähle deinen Beitrag für die gesamte Veranstaltung.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<label
|
|
||||||
v-for="option in feeOptions"
|
|
||||||
:key="option.value"
|
|
||||||
style="display: block; margin-bottom: 8px; cursor: pointer;"
|
|
||||||
>
|
|
||||||
<input type="radio" v-model="formData.feeType" :value="option.value" />
|
|
||||||
{{ option.label }}
|
|
||||||
<span style="color: #606060;">({{ option.amount }})</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="btn-row">
|
|
||||||
<button type="button" class="btn-secondary" @click="emit('back')">← Zurück</button>
|
|
||||||
<button type="button" class="btn-primary" @click="emit('next')">Weiter →</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
import ErrorText from "../../../../../../Views/Components/ErrorText.vue";
|
|
||||||
import {reactive} from "vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
formData: Object,
|
|
||||||
event: Object,
|
|
||||||
isMinor: Boolean,
|
|
||||||
localGroups: {type: Array, default: () => []},
|
|
||||||
needsLocalGroup: Boolean,
|
|
||||||
})
|
|
||||||
const emit = defineEmits(['next'])
|
|
||||||
|
|
||||||
const errors = reactive({
|
|
||||||
vorname: '',
|
|
||||||
nachname: '',
|
|
||||||
geburtsdatum: '',
|
|
||||||
localGroup: '',
|
|
||||||
email_1: '',
|
|
||||||
telefon_1: '',
|
|
||||||
ansprechpartner: '',
|
|
||||||
email_2: '',
|
|
||||||
first_aid: '',
|
|
||||||
badeerlaubnis: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
// Nur sichtbare Felder werden geprüft -- Kontaktperson und Erlaubnisse gibt es bei Volljährigen nicht.
|
|
||||||
const next = () => {
|
|
||||||
Object.keys(errors).forEach(key => errors[key] = '')
|
|
||||||
|
|
||||||
let hasError = false
|
|
||||||
|
|
||||||
if (!props.formData.vorname) {
|
|
||||||
errors.vorname = 'Bitte einen Vornamen angeben.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!props.formData.nachname) {
|
|
||||||
errors.nachname = 'Bitte einen Nachnamen angeben.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!props.formData.geburtsdatum) {
|
|
||||||
errors.geburtsdatum = 'Bitte ein Geburtsdatum angeben.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (props.needsLocalGroup && (!props.formData.localGroup || props.formData.localGroup === '-1')) {
|
|
||||||
errors.localGroup = 'Bitte einen Stamm auswählen.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!props.formData.email_1) {
|
|
||||||
errors.email_1 = 'Bitte eine E-Mail-Adresse angeben.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!props.formData.telefon_1) {
|
|
||||||
errors.telefon_1 = 'Bitte eine Telefonnummer angeben.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (props.isMinor) {
|
|
||||||
if (!props.formData.ansprechpartner) {
|
|
||||||
errors.ansprechpartner = 'Bitte eine Kontaktperson angeben.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!props.formData.email_2) {
|
|
||||||
errors.email_2 = 'Bitte eine E-Mail-Adresse der Kontaktperson angeben.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (props.formData.first_aid === '-1') {
|
|
||||||
errors.first_aid = 'Bitte triff eine Entscheidung. Bist du dir unsicher, kontaktiere bitte die Aktionsleitung.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (props.event.swimmingPermissionRequired && props.formData.badeerlaubnis === '-1') {
|
|
||||||
errors.badeerlaubnis = 'Bitte triff eine Entscheidung. Bist du dir unsicher, kontaktiere bitte die Aktionsleitung.'
|
|
||||||
hasError = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasError) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
emit('next')
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<h3>Angaben zur Person</h3>
|
|
||||||
<table class="form-table">
|
|
||||||
<tr>
|
|
||||||
<td>Vorname:</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.vorname" />
|
|
||||||
<ErrorText :message="errors.vorname" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Pfadiname:</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.pfadiname" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Nachname:</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.nachname" />
|
|
||||||
<ErrorText :message="errors.nachname" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Geburtsdatum:</td>
|
|
||||||
<td>
|
|
||||||
<input type="date" v-model="formData.geburtsdatum" />
|
|
||||||
<ErrorText :message="errors.geburtsdatum" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="needsLocalGroup">
|
|
||||||
<td>Stamm:</td>
|
|
||||||
<td>
|
|
||||||
<select v-model="formData.localGroup">
|
|
||||||
<option value="-1">Bitte wählen</option>
|
|
||||||
<option v-for="group in localGroups" :key="group.id" :value="group.id">{{ group.name }}</option>
|
|
||||||
</select>
|
|
||||||
<ErrorText :message="errors.localGroup" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>E-Mail:</td>
|
|
||||||
<td>
|
|
||||||
<input type="email" v-model="formData.email_1" />
|
|
||||||
<ErrorText :message="errors.email_1" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Telefon:</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.telefon_1" />
|
|
||||||
<ErrorText :message="errors.telefon_1" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<template v-if="isMinor">
|
|
||||||
<tr>
|
|
||||||
<td>Kontaktperson (Nachname, Vorname):</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.ansprechpartner" />
|
|
||||||
<ErrorText :message="errors.ansprechpartner" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>E-Mail der Kontaktperson:</td>
|
|
||||||
<td>
|
|
||||||
<input type="email" v-model="formData.email_2" />
|
|
||||||
<ErrorText :message="errors.email_2" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Allergien:</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.allergien" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Unverträglichkeiten:</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" v-model="formData.intolerances" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<template v-if="isMinor">
|
|
||||||
<tr>
|
|
||||||
<td>Erweiterte Erste Hilfe erlaubt:</td>
|
|
||||||
<td>
|
|
||||||
<select v-model="formData.first_aid">
|
|
||||||
<option value="-1">Bitte wählen</option>
|
|
||||||
<option
|
|
||||||
v-for="firstAidPermission in event.firstAidPermissions"
|
|
||||||
:key="firstAidPermission.slug"
|
|
||||||
:value="firstAidPermission.slug">{{ firstAidPermission.name }}</option>
|
|
||||||
</select><br />
|
|
||||||
<span style="font-size: 0.8rem; color: #6b7280;">
|
|
||||||
Nicht dringend-notwendige Erste-Hilfe-Maßnahmen, beinhaltet das Entfernen von Zecken und Splittern sowie das Kleben von Pflastern.
|
|
||||||
</span>
|
|
||||||
<ErrorText :message="errors.first_aid" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="event.swimmingPermissionRequired">
|
|
||||||
<td>Badeerlaubnis:</td>
|
|
||||||
<td>
|
|
||||||
<select v-model="formData.badeerlaubnis">
|
|
||||||
<option value="-1">Bitte wählen</option>
|
|
||||||
<option
|
|
||||||
v-for="swimmingPermission in event.swimmingPermissions"
|
|
||||||
:key="swimmingPermission.slug"
|
|
||||||
:value="swimmingPermission.slug">{{ swimmingPermission.name }}</option>
|
|
||||||
</select>
|
|
||||||
<ErrorText :message="errors.badeerlaubnis" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" class="btn-row">
|
|
||||||
<button type="button" class="btn-primary" @click="next">Weiter →</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
import {computed} from "vue";
|
|
||||||
|
|
||||||
const PAYMENT_ACCOUNT_TRANSACTION = 'PAYMENT_ACCOUNT_TRANSACTION'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
formData: Object,
|
|
||||||
event: Object,
|
|
||||||
isMinor: Boolean,
|
|
||||||
summaryAmount: String,
|
|
||||||
// Nur gesetzt, wenn zwischen mehreren Beitragsstufen gewählt werden konnte.
|
|
||||||
feeLabel: {type: String, default: null},
|
|
||||||
summaryLoading: Boolean,
|
|
||||||
submitting: Boolean,
|
|
||||||
submitError: {type: String, default: ''},
|
|
||||||
})
|
|
||||||
const emit = defineEmits(['back', 'submit'])
|
|
||||||
|
|
||||||
const selectedMethod = computed(() =>
|
|
||||||
(props.event.paymentMethods ?? []).find(m => m.slug === props.formData.paymentMethod) ?? null
|
|
||||||
)
|
|
||||||
|
|
||||||
// Die Überweisungs-Bestätigung wird nur bei Banküberweisung verlangt.
|
|
||||||
const requiresPaymentConfirmation = computed(() =>
|
|
||||||
props.formData.paymentMethod === PAYMENT_ACCOUNT_TRANSACTION
|
|
||||||
)
|
|
||||||
|
|
||||||
// Bestätigungstext ist ein admin-konfigurierbarer Freitext ({amount}-Platzhalter), sonst Default.
|
|
||||||
const paymentConfirmationText = computed(() => {
|
|
||||||
const configured = selectedMethod.value?.configuration?.summary_confirmation_text
|
|
||||||
const template = (configured && String(configured).trim() !== '')
|
|
||||||
? configured
|
|
||||||
: 'Ich bestätige, den Betrag von {amount} zu überweisen.'
|
|
||||||
return template.replaceAll('{amount}', props.summaryAmount ?? '')
|
|
||||||
})
|
|
||||||
|
|
||||||
// Gewählte Teilnahmeoptionen für die Zusammenfassung (Label statt Wert anzeigen).
|
|
||||||
const selectedParticipationOptions = computed(() =>
|
|
||||||
(props.event.participationOptions ?? []).map(question => {
|
|
||||||
const value = props.formData.participationOptions[question.key]
|
|
||||||
const option = (question.options ?? []).find(o => o.value === value)
|
|
||||||
return {label: question.title || question.label, value: option?.label ?? ''}
|
|
||||||
}).filter(entry => entry.value !== '')
|
|
||||||
)
|
|
||||||
|
|
||||||
// Der Stamm steht entweder fest (genau ein teilnehmender Stamm) oder wurde auf Seite 1 gewählt.
|
|
||||||
const localGroupName = computed(() =>
|
|
||||||
(props.event.contributingLocalGroups ?? []).find(g => g.id === props.formData.localGroup)?.name ?? null
|
|
||||||
)
|
|
||||||
|
|
||||||
const permissionName = (list, slug) =>
|
|
||||||
(list ?? []).find(entry => entry.slug === slug)?.name ?? '—'
|
|
||||||
|
|
||||||
const canSubmit = computed(() =>
|
|
||||||
props.formData.summary_information_correct
|
|
||||||
&& props.formData.summary_accept_terms
|
|
||||||
&& props.formData.legal_accepted
|
|
||||||
&& (!requiresPaymentConfirmation.value || props.formData.payment)
|
|
||||||
&& !props.submitting
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<h3>Zusammenfassung</h3>
|
|
||||||
|
|
||||||
<div v-if="summaryLoading" style="color: #6b7280; padding: 20px 0;">Wird geladen…</div>
|
|
||||||
<div v-else>
|
|
||||||
<table class="form-table" style="margin-bottom: 20px;">
|
|
||||||
<tr>
|
|
||||||
<td>Dein Name:</td>
|
|
||||||
<td>{{ formData.vorname }} {{ formData.nachname }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="formData.pfadiname">
|
|
||||||
<td>Pfadiname:</td>
|
|
||||||
<td>{{ formData.pfadiname }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Deine E-Mail:</td>
|
|
||||||
<td>{{ formData.email_1 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Deine Telefonnummer:</td>
|
|
||||||
<td>{{ formData.telefon_1 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="localGroupName">
|
|
||||||
<td>Stamm:</td>
|
|
||||||
<td>{{ localGroupName }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<template v-if="isMinor">
|
|
||||||
<tr>
|
|
||||||
<td>Kontaktperson:</td>
|
|
||||||
<td>{{ formData.ansprechpartner }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>E-Mail der Kontaktperson:</td>
|
|
||||||
<td>{{ formData.email_2 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Erweiterte Erste Hilfe:</td>
|
|
||||||
<td>{{ permissionName(event.firstAidPermissions, formData.first_aid) }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="event.swimmingPermissionRequired">
|
|
||||||
<td>Badeerlaubnis:</td>
|
|
||||||
<td>{{ permissionName(event.swimmingPermissions, formData.badeerlaubnis) }}</td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Allergien:</td>
|
|
||||||
<td>{{ formData.allergien || 'Keine Angabe' }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Unverträglichkeiten:</td>
|
|
||||||
<td>{{ formData.intolerances || 'Keine Angabe' }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr v-for="option in selectedParticipationOptions" :key="option.label">
|
|
||||||
<td>{{ option.label }}:</td>
|
|
||||||
<td>{{ option.value }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Foto-Erlaubnis:</td>
|
|
||||||
<td>
|
|
||||||
<strong>Social Media:</strong> {{ formData.foto.socialmedia ? 'Ja' : 'Nein' }},
|
|
||||||
<strong>Printmedien:</strong> {{ formData.foto.print ? 'Ja' : 'Nein' }},
|
|
||||||
<strong>Webseite:</strong> {{ formData.foto.webseite ? 'Ja' : 'Nein' }},
|
|
||||||
<strong>Partnerorganisationen:</strong> {{ formData.foto.partner ? 'Ja' : 'Nein' }},
|
|
||||||
<strong>Interne Zwecke:</strong> {{ formData.foto.intern ? 'Ja' : 'Nein' }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr><td>Veranstaltung:</td><td><strong>{{ event.name }}</strong></td></tr>
|
|
||||||
<tr><td>Zeitraum:</td><td>{{ event.eventBegin }} – {{ event.eventEnd }}</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h4 style="margin: 0 0 8px 0;">Kostenübersicht</h4>
|
|
||||||
<table class="form-table cost-table" style="margin-bottom: 20px;">
|
|
||||||
<tr v-if="feeLabel">
|
|
||||||
<td>Beitragsstufe:</td>
|
|
||||||
<td>{{ feeLabel }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="cost-total">
|
|
||||||
<td><strong>Teilnahmebeitrag:</strong></td>
|
|
||||||
<td><strong>{{ summaryAmount }}</strong></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div style="display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;">
|
|
||||||
<label style="display: flex; gap: 10px; cursor: pointer;">
|
|
||||||
<input type="checkbox" v-model="formData.summary_information_correct" />
|
|
||||||
Ich bestätige, dass alle Angaben korrekt sind.
|
|
||||||
</label>
|
|
||||||
<label style="display: flex; gap: 10px; cursor: pointer;">
|
|
||||||
<input type="checkbox" v-model="formData.summary_accept_terms" />
|
|
||||||
Ich akzeptiere die Teilnahmebedingungen.
|
|
||||||
</label>
|
|
||||||
<label style="display: flex; gap: 10px; cursor: pointer;">
|
|
||||||
<input type="checkbox" v-model="formData.legal_accepted" />
|
|
||||||
Ich stimme der Datenschutzerklärung zu.
|
|
||||||
</label>
|
|
||||||
<label v-if="requiresPaymentConfirmation" style="display: flex; gap: 10px; cursor: pointer;">
|
|
||||||
<input type="checkbox" v-model="formData.payment" />
|
|
||||||
{{ paymentConfirmationText }}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p v-if="submitError" style="color: #991b1b; font-weight: 600;">{{ submitError }}</p>
|
|
||||||
|
|
||||||
<div class="btn-row">
|
|
||||||
<button type="button" class="btn-secondary" @click="emit('back')">← Zurück</button>
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
class="btn-primary"
|
|
||||||
:disabled="!canSubmit"
|
|
||||||
style="background: #059669;"
|
|
||||||
>
|
|
||||||
{{ submitting ? 'Wird gesendet…' : 'Jetzt anmelden ✓' }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.cost-table .cost-total td {
|
|
||||||
border-top: 1px solid #d1d5db;
|
|
||||||
padding-top: 8px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -122,5 +122,170 @@ const steps = [
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Unscoped und mit der Kurzanmeldung geteilt (ShortSignupForm.vue bindet dieselbe Datei ein). -->
|
<style>
|
||||||
<style src="./signupForm.css"></style>
|
/* ─── Progress (Step-Pills) ─── */
|
||||||
|
.signup-progress {
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-progress-pills {
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-progress-separator {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 16px;
|
||||||
|
height: 2px;
|
||||||
|
background: #e5e7eb;
|
||||||
|
border-radius: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-pill {
|
||||||
|
padding: 5px 14px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
font-weight: 600;
|
||||||
|
white-space: nowrap;
|
||||||
|
border: 2px solid;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-pill__check { margin-right: 4px; }
|
||||||
|
|
||||||
|
.signup-pill--active {
|
||||||
|
border-color: #2563eb;
|
||||||
|
background: #2563eb;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-pill--done {
|
||||||
|
border-color: #bbf7d0;
|
||||||
|
background: #f0fdf4;
|
||||||
|
color: #15803d;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-pill--upcoming {
|
||||||
|
border-color: #e5e7eb;
|
||||||
|
background: #f9fafb;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-progress-bar {
|
||||||
|
margin-top: 10px;
|
||||||
|
height: 3px;
|
||||||
|
background: #e5e7eb;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-progress-bar__fill {
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(90deg, #2563eb, #3b82f6);
|
||||||
|
border-radius: 2px;
|
||||||
|
transition: width 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-progress-mobile {
|
||||||
|
display: none;
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── Form-Table ─── */
|
||||||
|
.form-table { width: 100%; border-collapse: collapse; }
|
||||||
|
.form-table td { padding: 8px 12px 8px 0; vertical-align: top; }
|
||||||
|
.form-table td:first-child { width: 220px; color: #374151; font-weight: 500; }
|
||||||
|
.form-table input[type="text"],
|
||||||
|
.form-table input[type="date"],
|
||||||
|
.form-table input[type="email"],
|
||||||
|
.form-table input[type="number"],
|
||||||
|
.form-table select,
|
||||||
|
.form-table textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-row { display: flex; gap: 10px; padding-top: 16px; flex-wrap: wrap; }
|
||||||
|
.btn-primary {
|
||||||
|
padding: 8px 20px;
|
||||||
|
background: #2563eb;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||||
|
.btn-secondary {
|
||||||
|
padding: 8px 20px;
|
||||||
|
background: #f3f4f6;
|
||||||
|
color: #374151;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── Tablet ─── */
|
||||||
|
@media (max-width: 1023px) {
|
||||||
|
.form-table td:first-child {
|
||||||
|
width: 160px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── Smartphone ─── */
|
||||||
|
@media (max-width: 639px) {
|
||||||
|
/* Pills auf Mobile: kompakter, Trennstriche ausblenden */
|
||||||
|
.signup-progress-pills {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.signup-progress-mobile {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Form-Table: Label oberhalb des Feldes */
|
||||||
|
.form-table,
|
||||||
|
.form-table tbody,
|
||||||
|
.form-table tr {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-table td {
|
||||||
|
display: block;
|
||||||
|
width: 100% !important;
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-table td:first-child {
|
||||||
|
width: 100% !important;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #374151;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-table td[colspan] {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-row {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary,
|
||||||
|
.btn-secondary {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,167 +0,0 @@
|
|||||||
/* Geteilte Styles der Anmelde-Wizards (langer Prozess und Kurzanmeldung). */
|
|
||||||
|
|
||||||
/* ─── Progress (Step-Pills) ─── */
|
|
||||||
.signup-progress {
|
|
||||||
margin-bottom: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-progress-pills {
|
|
||||||
display: flex;
|
|
||||||
gap: 6px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-progress-separator {
|
|
||||||
flex-shrink: 0;
|
|
||||||
width: 16px;
|
|
||||||
height: 2px;
|
|
||||||
background: #e5e7eb;
|
|
||||||
border-radius: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-pill {
|
|
||||||
padding: 5px 14px;
|
|
||||||
border-radius: 999px;
|
|
||||||
font-size: 0.78rem;
|
|
||||||
font-weight: 600;
|
|
||||||
white-space: nowrap;
|
|
||||||
border: 2px solid;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-pill__check { margin-right: 4px; }
|
|
||||||
|
|
||||||
.signup-pill--active {
|
|
||||||
border-color: #2563eb;
|
|
||||||
background: #2563eb;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-pill--done {
|
|
||||||
border-color: #bbf7d0;
|
|
||||||
background: #f0fdf4;
|
|
||||||
color: #15803d;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-pill--upcoming {
|
|
||||||
border-color: #e5e7eb;
|
|
||||||
background: #f9fafb;
|
|
||||||
color: #9ca3af;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-progress-bar {
|
|
||||||
margin-top: 10px;
|
|
||||||
height: 3px;
|
|
||||||
background: #e5e7eb;
|
|
||||||
border-radius: 2px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-progress-bar__fill {
|
|
||||||
height: 100%;
|
|
||||||
background: linear-gradient(90deg, #2563eb, #3b82f6);
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: width 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-progress-mobile {
|
|
||||||
display: none;
|
|
||||||
margin-top: 8px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: #374151;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ─── Form-Table ─── */
|
|
||||||
.form-table { width: 100%; border-collapse: collapse; }
|
|
||||||
.form-table td { padding: 8px 12px 8px 0; vertical-align: top; }
|
|
||||||
.form-table td:first-child { width: 220px; color: #374151; font-weight: 500; }
|
|
||||||
.form-table input[type="text"],
|
|
||||||
.form-table input[type="date"],
|
|
||||||
.form-table input[type="email"],
|
|
||||||
.form-table input[type="number"],
|
|
||||||
.form-table select,
|
|
||||||
.form-table textarea {
|
|
||||||
width: 100%;
|
|
||||||
padding: 6px 10px;
|
|
||||||
border: 1px solid #d1d5db;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-row { display: flex; gap: 10px; padding-top: 16px; flex-wrap: wrap; }
|
|
||||||
.btn-primary {
|
|
||||||
padding: 8px 20px;
|
|
||||||
background: #2563eb;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
||||||
.btn-secondary {
|
|
||||||
padding: 8px 20px;
|
|
||||||
background: #f3f4f6;
|
|
||||||
color: #374151;
|
|
||||||
border: 1px solid #d1d5db;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ─── Tablet ─── */
|
|
||||||
@media (max-width: 1023px) {
|
|
||||||
.form-table td:first-child {
|
|
||||||
width: 160px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ─── Smartphone ─── */
|
|
||||||
@media (max-width: 639px) {
|
|
||||||
/* Pills auf Mobile: kompakter, Trennstriche ausblenden */
|
|
||||||
.signup-progress-pills {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.signup-progress-mobile {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Form-Table: Label oberhalb des Feldes */
|
|
||||||
.form-table,
|
|
||||||
.form-table tbody,
|
|
||||||
.form-table tr {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-table td {
|
|
||||||
display: block;
|
|
||||||
width: 100% !important;
|
|
||||||
padding: 4px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-table td:first-child {
|
|
||||||
width: 100% !important;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #374151;
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-table td[colspan] {
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-row {
|
|
||||||
flex-direction: column-reverse;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary,
|
|
||||||
.btn-secondary {
|
|
||||||
width: 100%;
|
|
||||||
padding: 12px 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user