6 Commits
Author SHA1 Message Date
th.guenther d511dbdd66 Handling SEPA Direct Payment 2026-10-04 16:47:15 +02:00
th.guenther 9e9ea0cfd5 Fixed bug selecting eating habits 2026-10-04 14:36:15 +02:00
th.guenther bcebe2ebed Verbesserte EÜR-Abrechnung 2026-10-01 13:40:51 +02:00
th.guenther a43fd9cedf CoC Checks now optional 2026-09-29 14:58:21 +02:00
th.guenther a5e4e55df5 Support oft parent groups 2026-09-29 14:35:33 +02:00
th.guentherandClaude Opus 5.5 c4ca101594 endeavour: .env-Rechte, Socket-Prüfung und HTTPS-Proxy korrigiert
- deploy.sh setzt die .env auf root:mareike-docker 0640 und prüft DB_SOCKET/Socket vor dem Build
- optionale shared/deploy.conf für server-spezifische Einstellungen (z. B. MAREIKE_DB_SOCKET_DIR)
- nginx: absolute_redirect off, damit keine http://-Redirects entstehen
- Anleitung: Proxy per mod_rewrite nur unter HTTPS, keine KeyHelp-Weiterleitung, lv auf der Hauptdomain

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 14:30:42 +02:00
119 changed files with 3344 additions and 204 deletions

No files matched your search

+26
View File
@@ -16,6 +16,32 @@ Routing, Mails) stehen in `.ai/conventions.md` und werden hier eingebunden — *
- [Zahlungsmodule](app/EventPaymentModules/CLAUDE.md) — interface-gesteuerte Zahlungsarten (Optionen, Config,
Anmelde-Zusammenfassung, GiroCode/Fähigkeits-Interfaces, neues Modul hinzufügen).
## Local Group / Parent Group (Stamm / Bund)
Technisch heißt es **Local Group** (Mandant/Tenant) und **Parent Group** (übergeordnete Gruppe); „Stamm"/„Bund" sind nur
UI-Bezeichnungen.
- **ParentGroup** (`App\Models\ParentGroup`, Tabelle `parent_groups`, app-weit): `tenants.parent_group_id` ist Pflicht
(n:1). `is_fallback` markiert „Ohne Zuordnung" — `Tenant::booted()` setzt sie, wenn nichts angegeben ist; sie ist nie
löschbar. Andere nur, solange weder Tenant noch Anmeldung sie nutzt (`AdminParentGroupRepository::isInUse()`).
Verwaltung LV-only unter `/admin/parent-groups`; Zuordnung am Tenant im Tab „Allgemeines" und bei der Anlage.
- **Event**: `participant_group_type` (Enum `App\Enumerations\ParticipantGroupType`: `local_group` | `parent_group`),
gewählt bei der Anlage, in den Einstellungen änderbar nur ohne Anmeldungen. **Einzige Quelle für die Auswahl**:
`Event::participantGroupOptions()` — teilnehmende Stämme oder deren Bünde (distinct). Gespeichert wird
`event_participants.local_group` (Slug) **oder** `event_participants.parent_group_id`.
- **Anzeige**: `EventParticipant::participantGroupName()` → Resource-Feld `participantGroup`; `EventResource` liefert
`participantGroupType`, `participantGroupLabel`, `participantGroupOptions` (`{id, name, value}`).
- **Bezeichnungen** in `global_settings` (Model `GlobalSetting`, Repository `GlobalSettingRepository`, im Container
`scoped` — immer über `app(...)` beziehen), Singular + Plural je Ebene, gepflegt von Hauptadmins unter
`/admin/settings`. Gelesen über `ParticipantGroupType::label()/pluralLabel()/labels()`. Texte ohne Artikel formulieren
(„Bitte bei „{label}" eine Auswahl treffen."), weil der Artikel vom Wort abhängt.
## eFZ-Prüfung pro Veranstaltung
`events.coc_check_required` (Default `true`, Checkbox in `CommonSettings.vue`, Resource-Feld `cocCheckRequired`). Ist
sie aus, liefert `CertificateOfConductionCheckCommand` ohne API-Aufruf `not_required`, und `SignUpCommand` belegt
`efz_status` mit `not_required` vor. Wirkt nur auf neue Anmeldungen, bestehende Status bleiben.
## Umsatzsteuer / Steuerinformationen
Rechtlich korrekter Begriff ist **Umsatzsteuer (USt)**, nicht MwSt. Ziel: tagesbasierte Anmelde-Rechnungen („Teilnahme
@@ -0,0 +1,36 @@
<?php
namespace App\Domains\Admin\Actions\CreateParentGroup;
use App\Enumerations\ParticipantGroupType;
use App\Models\ParentGroup;
class CreateParentGroupAction
{
public function __construct(private CreateParentGroupRequest $request)
{
}
public function execute(): CreateParentGroupResponse
{
$response = new CreateParentGroupResponse();
$name = trim($this->request->name);
if ($name === '') {
$response->message = 'Bitte einen Namen angeben.';
return $response;
}
$response->parentGroup = ParentGroup::create([
'name' => $name,
'is_fallback' => false,
]);
$response->success = true;
$response->message = sprintf('%s „%s" wurde angelegt.', ParticipantGroupType::ParentGroup->label(), $name);
return $response;
}
}
@@ -0,0 +1,11 @@
<?php
namespace App\Domains\Admin\Actions\CreateParentGroup;
class CreateParentGroupRequest
{
public function __construct(
public string $name,
) {
}
}
@@ -0,0 +1,12 @@
<?php
namespace App\Domains\Admin\Actions\CreateParentGroup;
use App\Models\ParentGroup;
class CreateParentGroupResponse
{
public bool $success = false;
public string $message = '';
public ?ParentGroup $parentGroup = null;
}
@@ -2,6 +2,7 @@
namespace App\Domains\Admin\Actions\CreateTenant;
use App\Enumerations\ParticipantGroupType;
use App\Models\AvailablePaymentMethod;
use App\Models\PaymentMethod;
use App\Models\Tenant;
@@ -16,10 +17,17 @@ class CreateTenantAction
{
$response = new CreateTenantResponse();
if ($this->request->parentGroup === null) {
$response->message = sprintf('Bitte bei „%s" eine Auswahl treffen.', ParticipantGroupType::ParentGroup->label());
return $response;
}
$tenant = Tenant::create([
'name' => $this->request->name,
'slug' => $this->request->slug,
'url' => $this->request->url,
'parent_group_id' => $this->request->parentGroup->id,
'email' => '',
'email_finance' => '',
'account_name' => '',
@@ -34,19 +42,23 @@ class CreateTenantAction
$paymentMethodDefaults = PaymentMethod::defaults();
foreach (PaymentMethod::all() as $paymentMethod) {
$defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null, 'configuration' => []];
$configuration = PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $defaults['configuration'] ?? []);
// Aktiv nur, was schon vollständig konfiguriert ist -- derselbe Maßstab wie beim Aktivieren
// von Hand. Ein neuer Stamm hat noch keine Bankdaten; seine Zahlungsarten schaltet er frei,
// sobald sie gepflegt sind.
AvailablePaymentMethod::create([
'tenant' => $tenant->slug,
'slug' => $paymentMethod->slug,
'name' => $defaults['name'],
'description' => $defaults['description'],
'active' => true,
'configuration' => PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $defaults['configuration'] ?? []),
'active' => PaymentMethod::isConfigurationComplete($paymentMethod->slug, $configuration),
'configuration' => $configuration,
]);
}
$response->success = true;
$response->message = 'Stamm wurde angelegt.';
$response->message = sprintf('%s wurde angelegt.', ParticipantGroupType::LocalGroup->label());
$response->slug = $tenant->slug;
return $response;
@@ -2,12 +2,16 @@
namespace App\Domains\Admin\Actions\CreateTenant;
use App\Models\ParentGroup;
class CreateTenantRequest
{
public function __construct(
public string $name,
public string $slug,
public string $url,
/** Pflicht; null heißt, die übermittelte ID war unbekannt. */
public ?ParentGroup $parentGroup,
) {
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Domains\Admin\Actions\DeleteParentGroup;
class DeleteParentGroupAction
{
public function __construct(private DeleteParentGroupRequest $request)
{
}
public function execute(): DeleteParentGroupResponse
{
$response = new DeleteParentGroupResponse();
// Die Fallback-Gruppe nimmt Mandanten ohne Zuordnung auf und muss deshalb bestehen bleiben.
if ($this->request->parentGroup->is_fallback) {
$response->message = sprintf('„%s" kann nicht gelöscht werden.', $this->request->parentGroup->name);
return $response;
}
if ($this->request->inUse) {
$response->message = sprintf(
'„%s" ist noch zugeordnet und kann deshalb nicht gelöscht werden.',
$this->request->parentGroup->name,
);
return $response;
}
$this->request->parentGroup->delete();
$response->success = true;
$response->message = sprintf('„%s" wurde gelöscht.', $this->request->parentGroup->name);
return $response;
}
}
@@ -0,0 +1,15 @@
<?php
namespace App\Domains\Admin\Actions\DeleteParentGroup;
use App\Models\ParentGroup;
class DeleteParentGroupRequest
{
public function __construct(
public ParentGroup $parentGroup,
/** Ob die Gruppe noch von einem Mandanten oder einer Anmeldung verwendet wird. */
public bool $inUse,
) {
}
}
@@ -0,0 +1,9 @@
<?php
namespace App\Domains\Admin\Actions\DeleteParentGroup;
class DeleteParentGroupResponse
{
public bool $success = false;
public string $message = '';
}
@@ -0,0 +1,31 @@
<?php
namespace App\Domains\Admin\Actions\RenameParentGroup;
class RenameParentGroupAction
{
public function __construct(private RenameParentGroupRequest $request)
{
}
public function execute(): RenameParentGroupResponse
{
$response = new RenameParentGroupResponse();
$name = trim($this->request->name);
if ($name === '') {
$response->message = 'Bitte einen Namen angeben.';
return $response;
}
// Umbenennen ist jederzeit möglich: Mandanten und Anmeldungen verweisen über die ID.
$this->request->parentGroup->update(['name' => $name]);
$response->success = true;
$response->message = 'Der Name wurde gespeichert.';
return $response;
}
}
@@ -0,0 +1,14 @@
<?php
namespace App\Domains\Admin\Actions\RenameParentGroup;
use App\Models\ParentGroup;
class RenameParentGroupRequest
{
public function __construct(
public ParentGroup $parentGroup,
public string $name,
) {
}
}
@@ -0,0 +1,9 @@
<?php
namespace App\Domains\Admin\Actions\RenameParentGroup;
class RenameParentGroupResponse
{
public bool $success = false;
public string $message = '';
}
@@ -20,10 +20,15 @@ class UpdateAvailablePaymentMethodAction
// Nur bekannte Options-Keys übernehmen -- das Options-Schema des Zahlungsmoduls ist die Autorität.
$configuration = PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $this->request->configuration);
// Guard: Aktivierung nur erlaubt, wenn alle Pflicht-Optionen befüllt sind.
// Guard: Aktivierung nur erlaubt, wenn alle Pflicht-Optionen befüllt und gültig sind. Inaktiv
// gespeichert werden darf auch eine unfertige Konfiguration -- als Entwurf.
if ($this->request->active && !PaymentMethod::isConfigurationComplete($paymentMethod->slug, $configuration)) {
$errors = PaymentMethod::configurationErrors($paymentMethod->slug, $configuration);
$response->success = false;
$response->message = 'Bitte zuerst alle Pflichtfelder ausfüllen, bevor die Zahlungsmethode aktiviert wird.';
$response->message = $errors !== []
? implode(' ', $errors) . ' Die Zahlungsmethode kann so nicht aktiviert werden.'
: 'Bitte zuerst alle Pflichtfelder ausfüllen, bevor die Zahlungsmethode aktiviert wird.';
return $response;
}
@@ -0,0 +1,38 @@
<?php
namespace App\Domains\Admin\Actions\UpdateGlobalSettings;
use App\Models\GlobalSetting;
class UpdateGlobalSettingsAction
{
public function __construct(private UpdateGlobalSettingsRequest $request)
{
}
public function execute(): UpdateGlobalSettingsResponse
{
$response = new UpdateGlobalSettingsResponse();
$values = [
GlobalSetting::LOCAL_GROUP_LABEL => trim($this->request->localGroupLabel),
GlobalSetting::LOCAL_GROUP_LABEL_PLURAL => trim($this->request->localGroupLabelPlural),
GlobalSetting::PARENT_GROUP_LABEL => trim($this->request->parentGroupLabel),
GlobalSetting::PARENT_GROUP_LABEL_PLURAL => trim($this->request->parentGroupLabelPlural),
];
// Eine leere Bezeichnung ließe Überschriften und Auswahlfelder ohne Beschriftung zurück.
if (in_array('', $values, true)) {
$response->message = 'Bitte alle Bezeichnungen ausfüllen.';
return $response;
}
$this->request->globalSettings->setMany($values);
$response->success = true;
$response->message = 'Einstellungen wurden gespeichert.';
return $response;
}
}
@@ -0,0 +1,17 @@
<?php
namespace App\Domains\Admin\Actions\UpdateGlobalSettings;
use App\Repositories\GlobalSettingRepository;
class UpdateGlobalSettingsRequest
{
public function __construct(
public GlobalSettingRepository $globalSettings,
public string $localGroupLabel,
public string $localGroupLabelPlural,
public string $parentGroupLabel,
public string $parentGroupLabelPlural,
) {
}
}
@@ -0,0 +1,9 @@
<?php
namespace App\Domains\Admin\Actions\UpdateGlobalSettings;
class UpdateGlobalSettingsResponse
{
public bool $success = false;
public string $message = '';
}
@@ -2,6 +2,8 @@
namespace App\Domains\Admin\Actions\UpdateTenantGeneral;
use App\Enumerations\ParticipantGroupType;
class UpdateTenantGeneralAction
{
public function __construct(private UpdateTenantGeneralRequest $request)
@@ -12,10 +14,17 @@ class UpdateTenantGeneralAction
{
$response = new UpdateTenantGeneralResponse();
if ($this->request->parentGroup === null) {
$response->message = sprintf('Bitte bei „%s" eine Auswahl treffen.', ParticipantGroupType::ParentGroup->label());
return $response;
}
$this->request->tenant->update([
'name' => $this->request->name,
'slug' => $this->request->slug,
'url' => $this->request->url,
'parent_group_id' => $this->request->parentGroup->id,
]);
$response->success = true;
@@ -2,6 +2,7 @@
namespace App\Domains\Admin\Actions\UpdateTenantGeneral;
use App\Models\ParentGroup;
use App\Models\Tenant;
class UpdateTenantGeneralRequest
@@ -11,6 +12,8 @@ class UpdateTenantGeneralRequest
public string $name,
public string $slug,
public string $url,
/** Pflicht; null heißt, die übermittelte ID war unbekannt. */
public ?ParentGroup $parentGroup,
) {
}
}
@@ -8,6 +8,12 @@ use App\Scopes\SiteScope;
class UpdateTenantPaymentAction
{
/** Zahlungsarten, deren Konto das Konto des Stammes ist (Überweisung: Ziel, Lastschrift: Gläubiger). */
private const array BANK_ACCOUNT_SLUGS = [
PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION,
PaymentMethod::PAYMENT_SEPA_DIRECT_DEBIT,
];
public function __construct(private UpdateTenantPaymentRequest $request)
{
}
@@ -22,7 +28,9 @@ class UpdateTenantPaymentAction
'account_name' => $this->request->accountName,
]);
$this->syncTransferPaymentConfiguration();
foreach (self::BANK_ACCOUNT_SLUGS as $slug) {
$this->syncPaymentConfiguration($slug);
}
$response->success = true;
$response->message = 'IBAN-Informationen wurden gespeichert.';
@@ -31,15 +39,13 @@ class UpdateTenantPaymentAction
}
/**
* Übernimmt die eingegebenen IBAN-Daten direkt in die Tenant-Config der Überweisungs-Zahlungsart
* Übernimmt die eingegebenen IBAN-Daten direkt in die Tenant-Config der Zahlungsart
* (Kontoinhaber/IBAN/BIC), damit sie nicht doppelt gepflegt werden müssen. Bestehende weitere
* Config-Werte (z.B. Symbol) bleiben erhalten. Der Ziel-Tenant kann ein verwalteter sein, daher
* ohne SiteScope explizit auf den Tenant-Slug gefiltert.
* Config-Werte (z.B. Symbol, Gläubiger-ID) bleiben erhalten. Der Ziel-Tenant kann ein verwalteter
* sein, daher ohne SiteScope explizit auf den Tenant-Slug gefiltert.
*/
private function syncTransferPaymentConfiguration(): void
private function syncPaymentConfiguration(string $slug): void
{
$slug = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION;
$method = AvailablePaymentMethod::withoutGlobalScope(SiteScope::class)
->where('tenant', $this->request->tenant->slug)
->where('slug', $slug)
@@ -0,0 +1,18 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Enumerations\ParticipantGroupType;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class GlobalSettingsGetController extends CommonController
{
public function __invoke(Request $request): JsonResponse
{
return response()->json([
'groupLabels' => ParticipantGroupType::labels(),
]);
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Providers\InertiaProvider;
use App\Scopes\CommonController;
use Illuminate\Http\Request;
use Inertia\Response;
class GlobalSettingsPageController extends CommonController
{
public function __invoke(Request $request): Response
{
return new InertiaProvider('Admin/GlobalSettings', [])->render();
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Domains\Admin\Actions\UpdateGlobalSettings\UpdateGlobalSettingsAction;
use App\Domains\Admin\Actions\UpdateGlobalSettings\UpdateGlobalSettingsRequest;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class GlobalSettingsUpdateController extends CommonController
{
public function __invoke(Request $request): JsonResponse
{
$response = new UpdateGlobalSettingsAction(new UpdateGlobalSettingsRequest(
globalSettings: $this->globalSettings,
localGroupLabel: (string) $request->input('localGroup'),
localGroupLabelPlural: (string) $request->input('localGroupPlural'),
parentGroupLabel: (string) $request->input('parentGroup'),
parentGroupLabelPlural: (string) $request->input('parentGroupPlural'),
))->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->message,
]);
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Domains\Admin\Actions\CreateParentGroup\CreateParentGroupAction;
use App\Domains\Admin\Actions\CreateParentGroup\CreateParentGroupRequest;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ParentGroupCreateController extends CommonController
{
public function __invoke(Request $request): JsonResponse
{
$response = new CreateParentGroupAction(new CreateParentGroupRequest(
name: (string) $request->input('name'),
))->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->message,
]);
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Domains\Admin\Actions\DeleteParentGroup\DeleteParentGroupAction;
use App\Domains\Admin\Actions\DeleteParentGroup\DeleteParentGroupRequest;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ParentGroupDeleteController extends CommonController
{
public function __invoke(int $id, Request $request): JsonResponse
{
$parentGroup = $this->adminParentGroups->findById($id);
if ($parentGroup === null) {
return response()->json(['status' => 'error', 'message' => 'Eintrag nicht gefunden.'], 404);
}
$response = new DeleteParentGroupAction(new DeleteParentGroupRequest(
parentGroup: $parentGroup,
inUse: $this->adminParentGroups->isInUse($parentGroup),
))->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->message,
]);
}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ParentGroupListApiController extends CommonController
{
public function __invoke(Request $request): JsonResponse
{
$parentGroups = $this->adminParentGroups->all()->map(fn ($parentGroup) => [
'id' => $parentGroup->id,
'name' => $parentGroup->name,
'isFallback' => $parentGroup->is_fallback,
'tenantCount' => $parentGroup->tenants_count,
'deletable' => !$parentGroup->is_fallback && !$this->adminParentGroups->isInUse($parentGroup),
]);
return response()->json(['parentGroups' => $parentGroups]);
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Enumerations\ParticipantGroupType;
use App\Providers\InertiaProvider;
use App\Scopes\CommonController;
use Illuminate\Http\Request;
use Inertia\Response;
class ParentGroupListPageController extends CommonController
{
public function __invoke(Request $request): Response
{
return new InertiaProvider('Admin/ParentGroupList', [
'groupLabels' => ParticipantGroupType::labels(),
])->render();
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Domains\Admin\Controllers;
use App\Domains\Admin\Actions\RenameParentGroup\RenameParentGroupAction;
use App\Domains\Admin\Actions\RenameParentGroup\RenameParentGroupRequest;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ParentGroupUpdateController extends CommonController
{
public function __invoke(int $id, Request $request): JsonResponse
{
$parentGroup = $this->adminParentGroups->findById($id);
if ($parentGroup === null) {
return response()->json(['status' => 'error', 'message' => 'Eintrag nicht gefunden.'], 404);
}
$response = new RenameParentGroupAction(new RenameParentGroupRequest(
parentGroup: $parentGroup,
name: (string) $request->input('name'),
))->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->message,
]);
}
}
@@ -16,6 +16,7 @@ class TenantCreateController extends CommonController
name: $request->input('name'),
slug: $request->input('slug'),
url: $request->input('url'),
parentGroup: $this->adminParentGroups->findById((int) $request->input('parent_group_id')),
));
$response = $action->execute();
@@ -2,6 +2,7 @@
namespace App\Domains\Admin\Controllers;
use App\Enumerations\ParticipantGroupType;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -17,6 +18,12 @@ class TenantGeneralGetController extends CommonController
'slug' => $tenant->slug,
'url' => $tenant->url,
'is_active_local_group' => $tenant->is_active_local_group,
'parent_group_id' => $tenant->parent_group_id,
'parentGroups' => $this->adminParentGroups->all()->map(fn ($parentGroup) => [
'id' => $parentGroup->id,
'name' => $parentGroup->name,
]),
'parentGroupLabel' => ParticipantGroupType::ParentGroup->label(),
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/general',
]);
}
@@ -19,6 +19,7 @@ class TenantGeneralUpdateController extends CommonController
name: $request->input('name'),
slug: $request->input('slug'),
url: $request->input('url'),
parentGroup: $this->adminParentGroups->findById((int) $request->input('parent_group_id')),
));
$response = $action->execute();
@@ -18,9 +18,17 @@ class TenantListApiController extends CommonController
'slug' => $tenant->slug,
'url' => $tenant->url,
'is_active_local_group' => $tenant->is_active_local_group,
'parentGroup' => $tenant->parentGroup?->name,
];
});
return response()->json(['tenants' => $mapped]);
// Auswahl für das Anlage-Formular (Pflichtangabe).
$parentGroups = $this->adminParentGroups->all()->map(fn ($parentGroup) => [
'id' => $parentGroup->id,
'name' => $parentGroup->name,
'isFallback' => $parentGroup->is_fallback,
]);
return response()->json(['tenants' => $mapped, 'parentGroups' => $parentGroups]);
}
}
@@ -2,6 +2,7 @@
namespace App\Domains\Admin\Controllers;
use App\Enumerations\ParticipantGroupType;
use App\Providers\InertiaProvider;
use App\Scopes\CommonController;
use Illuminate\Http\Request;
@@ -11,7 +12,9 @@ class TenantListPageController extends CommonController
{
public function __invoke(Request $request): Response
{
$inertiaProvider = new InertiaProvider('Admin/TenantList', []);
$inertiaProvider = new InertiaProvider('Admin/TenantList', [
'groupLabels' => ParticipantGroupType::labels(),
]);
return $inertiaProvider->render();
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Domains\Admin\Repositories;
use App\Models\ParentGroup;
use Illuminate\Database\Eloquent\Collection;
class AdminParentGroupRepository
{
/** Alle Parent Groups, alphabetisch mit „Ohne Zuordnung" am Ende, mit der Zahl zugeordneter Mandanten. */
public function all(): Collection
{
return ParentGroup::withCount('tenants')
->ordered()
->get();
}
public function findById(int $id): ?ParentGroup
{
return ParentGroup::find($id);
}
/**
* Ob die Parent Group noch verwendet wird -- von einem Mandanten oder von einer Anmeldung. Anmeldungen sind
* mandantengebunden; gezählt wird hier bewusst über alle Mandanten hinweg.
*/
public function isInUse(ParentGroup $parentGroup): bool
{
return $parentGroup->tenants()->exists()
|| $parentGroup->eventParticipants()->withoutGlobalScopes()->exists();
}
}
+19
View File
@@ -5,6 +5,8 @@ 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\GlobalSettingsGetController;
use App\Domains\Admin\Controllers\GlobalSettingsUpdateController;
use App\Domains\Admin\Controllers\ManagedTenantContactGetController;
use App\Domains\Admin\Controllers\ManagedTenantContactUpdateController;
use App\Domains\Admin\Controllers\ManagedTenantGdprGetController;
@@ -15,6 +17,10 @@ use App\Domains\Admin\Controllers\ManagedTenantPaymentGetController;
use App\Domains\Admin\Controllers\ManagedTenantPaymentUpdateController;
use App\Domains\Admin\Controllers\ManagedTenantTaxGetController;
use App\Domains\Admin\Controllers\ManagedTenantTaxUpdateController;
use App\Domains\Admin\Controllers\ParentGroupCreateController;
use App\Domains\Admin\Controllers\ParentGroupDeleteController;
use App\Domains\Admin\Controllers\ParentGroupListApiController;
use App\Domains\Admin\Controllers\ParentGroupUpdateController;
use App\Domains\Admin\Controllers\TenantContactGetController;
use App\Domains\Admin\Controllers\TenantContactUpdateController;
use App\Domains\Admin\Controllers\TenantCreateController;
@@ -76,6 +82,12 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
Route::post('/assets', DocumentAssetUpdateController::class);
Route::delete('/assets/{name}', DocumentAssetDeleteController::class);
});
// Bezeichnungen der Gruppen-Ebenen gelten ebenfalls app-weit.
Route::prefix('api/v1/admin/settings')->group(function () {
Route::get('/', GlobalSettingsGetController::class);
Route::post('/', GlobalSettingsUpdateController::class);
});
});
Route::middleware(LvOnlyMiddleware::class)->group(function () {
@@ -97,5 +109,12 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
Route::post('/tax', ManagedTenantTaxUpdateController::class);
});
});
Route::prefix('api/v1/admin/parent-groups')->group(function () {
Route::get('/list', ParentGroupListApiController::class);
Route::post('/create', ParentGroupCreateController::class);
Route::post('/{id}', ParentGroupUpdateController::class)->whereNumber('id');
Route::delete('/{id}', ParentGroupDeleteController::class)->whereNumber('id');
});
});
});
+4
View File
@@ -2,6 +2,8 @@
use App\Domains\Admin\Controllers\AdminDashboardController;
use App\Domains\Admin\Controllers\DocumentTemplatesPageController;
use App\Domains\Admin\Controllers\GlobalSettingsPageController;
use App\Domains\Admin\Controllers\ParentGroupListPageController;
use App\Domains\Admin\Controllers\TenantEditPageController;
use App\Domains\Admin\Controllers\TenantListPageController;
use App\Domains\Admin\Controllers\TenantPageController;
@@ -21,11 +23,13 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
// App-weit gültige Dokumentvorlagen -- nur für Hauptadministrator*innen.
Route::middleware(MainAdminRoleMiddleware::class)->group(function () {
Route::get('/document-templates', DocumentTemplatesPageController::class);
Route::get('/settings', GlobalSettingsPageController::class);
});
Route::middleware(LvOnlyMiddleware::class)->group(function () {
Route::get('/tenants', TenantListPageController::class);
Route::get('/tenants/{slug}', TenantEditPageController::class);
Route::get('/parent-groups', ParentGroupListPageController::class);
});
});
});
+116
View File
@@ -0,0 +1,116 @@
<script setup>
import { ref, onMounted } from 'vue';
import AdminAppLayout from "../../../../resources/js/layouts/AdminAppLayout.vue";
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
import { toast } from "vue3-toastify";
const { request } = useAjax()
const form = ref({
localGroup: '',
localGroupPlural: '',
parentGroup: '',
parentGroupPlural: '',
})
onMounted(async () => {
const response = await request('/api/v1/admin/settings')
Object.assign(form.value, response?.groupLabels ?? {})
})
async function save() {
const response = await request('/api/v1/admin/settings', {
method: 'POST',
body: form.value,
})
if (response && response.status === 'success') {
toast.success(response.message)
} else {
toast.error(response?.message ?? 'Fehler beim Speichern')
}
}
</script>
<template>
<AdminAppLayout title="Einstellungen">
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
<h3>Bezeichnungen der Gruppen</h3>
<p class="hint">
Gelten für alle Mandanten: in Anmeldungen, Teilnehmendenlisten, Exporten und in der Verwaltung.
</p>
<table class="data-table">
<thead>
<tr>
<th></th>
<th>Einzahl</th>
<th>Mehrzahl</th>
</tr>
</thead>
<tbody>
<tr>
<th>Gruppe (Mandant)</th>
<td><input type="text" v-model="form.localGroup" class="form-input" placeholder="z. B. Stamm" /></td>
<td><input type="text" v-model="form.localGroupPlural" class="form-input" placeholder="z. B. Stämme" /></td>
</tr>
<tr>
<th>Übergeordnete Gruppe</th>
<td><input type="text" v-model="form.parentGroup" class="form-input" placeholder="z. B. Bund" /></td>
<td><input type="text" v-model="form.parentGroupPlural" class="form-input" placeholder="z. B. Bünde" /></td>
</tr>
</tbody>
</table>
<button class="btn-save" @click="save">Speichern</button>
</shadowed-box>
</AdminAppLayout>
</template>
<style scoped>
.hint {
color: #6b7280;
font-size: 0.9rem;
}
.data-table {
width: 100%;
border-collapse: collapse;
}
.data-table th {
text-align: left;
padding: 8px 12px;
color: #374151;
border-bottom: 1px solid #e5e7eb;
}
.data-table td {
padding: 8px 12px;
border-bottom: 1px solid #e5e7eb;
}
.form-input {
width: 100%;
padding: 6px 10px;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 0.95rem;
box-sizing: border-box;
}
.btn-save {
margin-top: 15px;
padding: 8px 20px;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: bold;
font-size: 0.9rem;
background-color: #16a34a;
color: #ffffff;
}
.btn-save:hover {
background-color: #15803d;
}
</style>
+249
View File
@@ -0,0 +1,249 @@
<script setup>
import { ref, onMounted } from 'vue';
import AdminAppLayout from "../../../../resources/js/layouts/AdminAppLayout.vue";
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
import { toast } from "vue3-toastify";
const props = defineProps({
groupLabels: {
type: Object,
default: () => ({ localGroupPlural: 'Stämme', parentGroup: 'Bund', parentGroupPlural: 'Bünde' }),
},
})
const { request } = useAjax()
const parentGroups = ref([])
const newName = ref('')
const showCreate = ref(false)
// ID des Eintrags, der gerade umbenannt wird, samt Entwurf des neuen Namens.
const editingId = ref(null)
const editName = ref('')
onMounted(async () => {
await loadParentGroups()
})
async function loadParentGroups() {
const response = await request('/api/v1/admin/parent-groups/list')
parentGroups.value = response?.parentGroups ?? []
}
async function createParentGroup() {
const response = await request('/api/v1/admin/parent-groups/create', {
method: 'POST',
body: { name: newName.value },
})
if (response && response.status === 'success') {
toast.success(response.message)
newName.value = ''
showCreate.value = false
await loadParentGroups()
} else {
toast.error(response?.message ?? 'Fehler beim Anlegen')
}
}
function startEditing(parentGroup) {
editingId.value = parentGroup.id
editName.value = parentGroup.name
}
async function saveName(parentGroup) {
const response = await request('/api/v1/admin/parent-groups/' + parentGroup.id, {
method: 'POST',
body: { name: editName.value },
})
if (response && response.status === 'success') {
toast.success(response.message)
editingId.value = null
await loadParentGroups()
} else {
toast.error(response?.message ?? 'Fehler beim Speichern')
}
}
async function deleteParentGroup(parentGroup) {
if (!confirm('„' + parentGroup.name + '" wirklich löschen?')) {
return
}
const response = await request('/api/v1/admin/parent-groups/' + parentGroup.id, {
method: 'DELETE',
})
if (response && response.status === 'success') {
toast.success(response.message)
await loadParentGroups()
} else {
toast.error(response?.message ?? 'Fehler beim Löschen')
}
}
</script>
<template>
<AdminAppLayout :title="props.groupLabels.parentGroupPlural">
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
<table class="parent-group-table">
<thead>
<tr>
<th>Name</th>
<th>Zugeordnete {{ props.groupLabels.localGroupPlural }}</th>
<th></th>
</tr>
</thead>
<tbody>
<tr v-for="parentGroup in parentGroups" :key="parentGroup.id">
<td>
<input v-if="editingId === parentGroup.id" type="text" v-model="editName" class="form-input"
@keyup.enter="saveName(parentGroup)" />
<span v-else>{{ parentGroup.name }}</span>
</td>
<td>{{ parentGroup.tenantCount }}</td>
<td class="actions">
<template v-if="editingId === parentGroup.id">
<button class="btn-save" @click="saveName(parentGroup)">Speichern</button>
<button class="btn-cancel" @click="editingId = null">Abbrechen</button>
</template>
<template v-else>
<button class="btn-edit" @click="startEditing(parentGroup)">Umbenennen</button>
<button v-if="parentGroup.deletable" class="btn-delete" @click="deleteParentGroup(parentGroup)">Löschen</button>
</template>
</td>
</tr>
</tbody>
</table>
<p class="hint">
Löschen ist nur möglich, solange keine {{ props.groupLabels.localGroupPlural }} und keine Anmeldungen
zugeordnet sind. „Ohne Zuordnung" bleibt immer bestehen.
</p>
<div style="margin-top: 20px;">
<button v-if="!showCreate" class="btn-create" @click="showCreate = true">Neuen Eintrag anlegen</button>
<div v-if="showCreate" class="create-form">
<h3>Neuen Eintrag anlegen ({{ props.groupLabels.parentGroup }})</h3>
<input type="text" v-model="newName" class="form-input" placeholder="Name"
@keyup.enter="createParentGroup" />
<div class="btn-group">
<button class="btn-save" @click="createParentGroup">Anlegen</button>
<button class="btn-cancel" @click="showCreate = false">Abbrechen</button>
</div>
</div>
</div>
</shadowed-box>
</AdminAppLayout>
</template>
<style scoped>
.parent-group-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #d1d5db;
border-radius: 8px;
overflow: hidden;
}
.parent-group-table thead th {
text-align: left;
padding: 10px 16px;
background-color: #f9fafb;
color: #374151;
font-weight: bold;
border-bottom: 2px solid #d1d5db;
}
.parent-group-table tbody td {
padding: 10px 16px;
border-bottom: 1px solid #e5e7eb;
}
.actions {
display: flex;
gap: 8px;
justify-content: flex-end;
}
.hint {
margin-top: 12px;
color: #6b7280;
font-size: 0.9rem;
}
.create-form {
margin-top: 15px;
padding: 20px;
border: 1px solid #d1d5db;
border-radius: 8px;
background-color: #f9fafb;
}
.create-form h3 {
margin: 0 0 15px 0;
color: #374151;
}
.form-input {
width: 100%;
padding: 6px 10px;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 0.95rem;
box-sizing: border-box;
}
.btn-group {
display: flex;
gap: 10px;
margin-top: 15px;
}
.btn-create, .btn-save, .btn-cancel, .btn-edit, .btn-delete {
padding: 6px 16px;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: bold;
font-size: 0.9rem;
}
.btn-create, .btn-edit {
background-color: #1d4899;
color: #ffffff;
}
.btn-create:hover, .btn-edit:hover {
background-color: #163a7a;
}
.btn-save {
background-color: #16a34a;
color: #ffffff;
}
.btn-save:hover {
background-color: #15803d;
}
.btn-cancel {
background-color: #e5e7eb;
color: #374151;
}
.btn-cancel:hover {
background-color: #d1d5db;
}
.btn-delete {
background-color: #dc2626;
color: #ffffff;
}
.btn-delete:hover {
background-color: #b91c1c;
}
</style>
@@ -1,5 +1,5 @@
<script setup>
import { ref } from 'vue';
import { computed, ref } from 'vue';
import { useAjax } from "../../../../../resources/js/components/ajaxHandler.js";
import { toast } from "vue3-toastify";
@@ -17,8 +17,16 @@ const form = ref({
name: props.data.name ?? '',
slug: props.data.slug ?? '',
url: props.data.url ?? '',
parent_group_id: props.data.parent_group_id ?? null,
})
// Übergeordnete Gruppe (z. B. „Bund") -- Pflichtangabe, Auswahl aus der LV-seitig gepflegten Liste.
const parentGroups = props.data.parentGroups ?? []
const parentGroupLabel = props.data.parentGroupLabel ?? 'Bund'
const parentGroupName = computed(() =>
parentGroups.find(g => g.id === form.value.parent_group_id)?.name ?? '—'
)
async function save() {
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenants/' + props.data.slug + '/general'
const response = await request(saveUrl, {
@@ -39,6 +47,7 @@ async function save() {
<div v-if="!editing">
<table class="data-table">
<tr><th>Name:</th><td>{{ form.name }}</td></tr>
<tr><th>{{ parentGroupLabel }}:</th><td>{{ parentGroupName }}</td></tr>
<tr><th>Slug:</th><td>{{ form.slug }}</td></tr>
<tr><th>URL:</th><td>{{ form.url }}</td></tr>
<tr><th>Status:</th><td>
@@ -54,6 +63,14 @@ async function save() {
<th>Name:</th>
<td><input type="text" v-model="form.name" class="form-input" /></td>
</tr>
<tr>
<th>{{ parentGroupLabel }}:</th>
<td>
<select v-model="form.parent_group_id" class="form-input">
<option v-for="group in parentGroups" :key="group.id" :value="group.id">{{ group.name }}</option>
</select>
</td>
</tr>
<tr>
<th>Slug:</th>
<td><input type="text" v-model="form.slug" class="form-input" /></td>
@@ -107,6 +107,8 @@ async function save() {
v-model="form.configuration[option.name]"
:defaults="data.statementRulesetDefault ?? {}"
:charsets="data.statementRulesetCharsets ?? undefined"/>
<input v-else-if="option.type === 'number'" type="number" step="1"
v-model="form.configuration[option.name]" class="form-input"/>
<input v-else type="text" v-model="form.configuration[option.name]" class="form-input"/>
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
</td>
+31 -5
View File
@@ -5,6 +5,13 @@ import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
import { toast } from "vue3-toastify";
const props = defineProps({
groupLabels: {
type: Object,
default: () => ({ localGroup: 'Stamm', localGroupPlural: 'Stämme', parentGroup: 'Bund' }),
},
})
const { request } = useAjax()
function openTenant(slug) {
@@ -12,12 +19,16 @@ function openTenant(slug) {
}
const tenants = ref([])
const parentGroups = ref([])
const showCreate = ref(false)
const createForm = ref({
const emptyForm = () => ({
name: '',
slug: '',
url: '',
// Pflichtangabe; vorbelegt mit „Ohne Zuordnung", sobald die Liste geladen ist.
parent_group_id: parentGroups.value.find(g => g.isFallback)?.id ?? null,
})
const createForm = ref(emptyForm())
onMounted(async () => {
await loadTenants()
@@ -33,6 +44,11 @@ async function loadTenants() {
})
const data = await response.json()
tenants.value = data.tenants
parentGroups.value = data.parentGroups ?? []
if (createForm.value.parent_group_id === null) {
createForm.value.parent_group_id = parentGroups.value.find(g => g.isFallback)?.id ?? null
}
}
async function createTenant() {
@@ -44,7 +60,7 @@ async function createTenant() {
if (response && response.status === 'success') {
toast.success(response.message)
showCreate.value = false
createForm.value = { name: '', slug: '', url: '' }
createForm.value = emptyForm()
await loadTenants()
} else {
toast.error(response?.message ?? 'Fehler beim Anlegen')
@@ -53,12 +69,13 @@ async function createTenant() {
</script>
<template>
<AdminAppLayout title="Stämme">
<AdminAppLayout :title="props.groupLabels.localGroupPlural">
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
<table class="tenant-table">
<thead>
<tr>
<th>Name</th>
<th>{{ props.groupLabels.parentGroup }}</th>
<th>Slug</th>
<th>URL</th>
<th>Status</th>
@@ -67,6 +84,7 @@ async function createTenant() {
<tbody>
<tr v-for="tenant in tenants" :key="tenant.slug" class="tenant-row" @click="openTenant(tenant.slug)">
<td>{{ tenant.name }}</td>
<td>{{ tenant.parentGroup ?? '—' }}</td>
<td>{{ tenant.slug }}</td>
<td>{{ tenant.url }}</td>
<td>
@@ -79,15 +97,23 @@ async function createTenant() {
</table>
<div style="margin-top: 20px;">
<button v-if="!showCreate" class="btn-create" @click="showCreate = true">Neuen Stamm anlegen</button>
<button v-if="!showCreate" class="btn-create" @click="showCreate = true">Neuen Eintrag anlegen ({{ props.groupLabels.localGroup }})</button>
<div v-if="showCreate" class="create-form">
<h3>Neuen Stamm anlegen</h3>
<h3>Neuen Eintrag anlegen ({{ props.groupLabels.localGroup }})</h3>
<table class="form-table">
<tr>
<th>Name</th>
<td><input type="text" v-model="createForm.name" class="form-input" /></td>
</tr>
<tr>
<th>{{ props.groupLabels.parentGroup }}</th>
<td>
<select v-model="createForm.parent_group_id" class="form-input">
<option v-for="group in parentGroups" :key="group.id" :value="group.id">{{ group.name }}</option>
</select>
</td>
</tr>
<tr>
<th>Slug</th>
<td><input type="text" v-model="createForm.slug" class="form-input" /></td>
@@ -12,6 +12,12 @@ class CertificateOfConductionCheckCommand {
public function execute() : CertificateOfConductionCheckResponse {
$response = new CertificateOfConductionCheckResponse();
// Verlangt die Veranstaltung kein eFZ, entfällt die Prüfung -- ohne Aufruf der Prüf-API.
if (!$this->request->participant->event()->first()?->coc_check_required) {
$response->status = EfzStatus::EFZ_STATUS_NOT_REQUIRED;
return $response;
}
// 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 ?? '');
@@ -62,6 +62,7 @@ class CreateEventCommand {
'vat_pricing_mode' => $tenant->vat_pricing_mode,
'tax_exemption_reason' => $tenant->tax_exemption_reason,
'tax_exemption_note' => $tenant->tax_exemption_note,
'participant_group_type' => $this->request->participantGroupType->value,
// 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.
//
@@ -2,6 +2,7 @@
namespace App\Domains\Event\Actions\CreateEvent;
use App\Enumerations\ParticipantGroupType;
use App\Enumerations\ParticipationFeeType;
use DateTime;
@@ -21,8 +22,11 @@ class CreateEventRequest {
public bool $payPerDay;
public ?string $street;
public ?string $houseNumber;
/** Wonach bei der Anmeldung gefragt wird: Local Group oder Parent Group. */
public ParticipantGroupType $participantGroupType;
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, ?string $street = null, ?string $houseNumber = null, ParticipantGroupType $participantGroupType = ParticipantGroupType::LocalGroup) {
$this->participantGroupType = $participantGroupType;
$this->name = $name;
$this->location = $location;
$this->postalCode = $postalCode;
@@ -5,6 +5,7 @@ namespace App\Domains\Event\Actions\CreateIncomeSurplusStatement;
use App\Enumerations\ParticipationType;
use App\Models\CostUnit;
use App\Models\Event;
use App\Models\Invoice;
use App\Providers\PdfGenerateAndDownloadProvider;
use App\Repositories\CostUnitRepository;
use App\ValueObjects\Amount;
@@ -52,8 +53,9 @@ class CreateIncomeSurplusStatementCommand
$eventData = $this->event->toResource()->toArray(new Request());
$income = $this->buildIncome($eventData, $otherIncome);
$expenses = $this->buildExpenses($costUnit);
$donations = $this->buildExpenses($costUnit, donationsOnly: true);
$income = $this->buildIncome($eventData, $otherIncome, $donations['total']);
$result = new Amount($income['total']->getAmount() - $expenses['total']->getAmount(), 'Euro');
@@ -62,6 +64,7 @@ class CreateIncomeSurplusStatementCommand
'createdAt' => new \DateTime()->format('d.m.Y'),
'income' => $income,
'expenses' => $expenses,
'donations' => $donations,
'result' => $result,
'money' => self::money(...),
])->render();
@@ -70,6 +73,7 @@ class CreateIncomeSurplusStatementCommand
$response->filename = 'EUER-' . $this->event->identifier . '.pdf';
$response->income = $income;
$response->expenses = $expenses;
$response->donations = $donations;
$response->result = $result;
$response->pdfContent = PdfGenerateAndDownloadProvider::fromHtml($html, 'portrait');
@@ -87,7 +91,7 @@ class CreateIncomeSurplusStatementCommand
*
* @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
private function buildIncome(array $eventData, float $otherIncome, Amount $donations): array
{
// Beiträge aller Teilnahmearten in einer Zeile: Für die Mittelverwendung zählt, was an Beiträgen
// hereingekommen ist, nicht von wem.
@@ -118,6 +122,8 @@ class CreateIncomeSurplusStatementCommand
'name' => 'Fördermittel (' . self::money($supportRate) . ' € p.P./Tag)',
'amount' => new Amount($eventData['supportPerson']['amount']->getAmount(), 'Euro'),
],
// Gespendete Auslagen: als Ausgabe ihres Typs gebucht, hier die Gegenbuchung.
['name' => 'Spenden', 'amount' => $donations],
];
$categories = [
@@ -134,14 +140,17 @@ class CreateIncomeSurplusStatementCommand
/**
* Die Ausgabenseite: eine Zeile je Ausgabentyp, dazu die Belege für die Anlage.
*
* Mit `$donationsOnly` nur die gespendeten Auslagen in derselben Gliederung -- für die Anlage „Spenden"
* und die Summe unter den Förderungen.
*
* @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
private function buildExpenses(CostUnit $costUnit, bool $donationsOnly = false): array
{
$groups = [];
$total = new Amount(0, 'Euro');
foreach ($this->costUnits->groupExpensesByType($costUnit) as $group) {
foreach ($this->costUnits->groupExpensesByType($costUnit, $donationsOnly) as $group) {
$rows = [];
foreach ($group['invoices'] as $invoice) {
@@ -150,7 +159,7 @@ class CreateIncomeSurplusStatementCommand
'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(),
'purpose' => self::purpose($invoice),
'amount' => Amount::fromString($invoice->amount),
];
}
@@ -167,6 +176,25 @@ class CreateIncomeSurplusStatementCommand
return ['groups' => $groups, 'total' => $total];
}
/**
* Der Zweck eines Belegs für die Anlage.
*
* Erfasster oder abgeleiteter Zahlungsgrund wie in der Beleg-Übersicht. Nur wenn es keinen gibt --
* ältere Abrechnungen ohne jede Zweckangabe --, steht dort ersatzweise, wem was erstattet wurde. Bewusst
* hier und nicht in {@see Invoice::purposeText()}: Dort würde der Ersatztext als erfasster Zahlungsgrund
* erscheinen und beim Korrigieren als Änderung protokolliert.
*/
private static function purpose(Invoice $invoice): string
{
$purpose = $invoice->purposeText();
if (trim($purpose) !== '') {
return $purpose;
}
return trim('Auslagenerstattung ' . $invoice->contact_name);
}
/**
* Ein Betrag in deutscher Schreibweise: Punkt als Tausender-, Komma als Dezimaltrennzeichen.
*
@@ -29,5 +29,12 @@ class CreateIncomeSurplusStatementResponse
*/
public array $expenses = [];
/**
* Die gespendeten Auslagen, gegliedert wie die Ausgaben -- die Gegenbuchung zur Zeile „Spenden".
*
* @var array{groups: array<int, array{name: string, sum: Amount, rows: array<int, array<string, mixed>>}>, total: Amount}|array{}
*/
public array $donations = [];
public ?Amount $result = null;
}
@@ -2,9 +2,11 @@
namespace App\Domains\Event\Actions\SetPaymentMethods;
use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\Models\AvailablePaymentMethod;
use App\Models\PaymentMethod;
use App\RelationModels\EventPaymentMethods;
use Illuminate\Support\Collection;
class SetPaymentMethodsCommand
{
@@ -25,7 +27,22 @@ class SetPaymentMethodsCommand
return $response;
}
$this->syncPaymentMethods();
$existing = EventPaymentMethods::where('event_id', $this->request->event->id)->get()->keyBy('slug');
$configurations = $this->configurationsToWrite($existing);
// Erst prüfen, dann schreiben: Eine Zahlungsart, die am Event unvollständig konfiguriert wäre,
// ließe sich bei der Anmeldung wählen, ohne dass die Angaben für die Zahlung vorliegen.
$incomplete = $this->incompleteNames($configurations);
if ($incomplete !== []) {
$response->success = false;
$response->message = sprintf(
'Die Konfiguration von „%s" ist unvollständig oder ungültig.',
implode('", „', $incomplete),
);
return $response;
}
$this->syncPaymentMethods($existing, $configurations);
$this->request->event->save();
$response->success = true;
@@ -34,48 +51,87 @@ class SetPaymentMethodsCommand
}
/**
* Differenzieller Sync der Zahlungsmethoden mit Snapshot-Copy-Semantik:
* - entfernte Methoden werden gelöscht,
* Die Configs, die geschrieben werden (Snapshot-Copy-Semantik):
* - neue Methoden erhalten einen Snapshot der Tenant-Config (oder eines expliziten Overrides),
* - bestehende Methoden behalten ihre pro-Event-Config, sofern kein Override übergeben wird.
* - bestehende Methoden behalten ihre pro-Event-Config, sofern kein Override übergeben wird --
* sie tauchen hier dann nicht auf.
*
* @param Collection<string, EventPaymentMethods> $existing
* @return array<string, array<string, mixed>> slug => Config
*/
private function syncPaymentMethods(): void
private function configurationsToWrite(Collection $existing): array
{
$event = $this->request->event;
$desiredSlugs = $this->request->paymentMethods;
$overrides = $this->request->paymentMethodConfigurations;
$existing = EventPaymentMethods::where('event_id', $event->id)->get()->keyBy('slug');
// Nicht mehr gewünschte Methoden entfernen.
foreach ($existing as $slug => $row) {
if (!in_array($slug, $desiredSlugs, true)) {
$row->delete();
}
}
// Tenant-Instanzen (für Snapshot-Kopie neuer Methoden) laden.
$tenantMethods = AvailablePaymentMethod::whereIn('slug', $desiredSlugs)->get()->keyBy('slug');
$configurations = [];
foreach ($desiredSlugs as $slug) {
$override = $overrides[$slug] ?? null;
if (isset($existing[$slug])) {
// Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen.
if ($override !== null) {
$row = $existing[$slug];
$row->configuration = $this->eventConfiguration($slug, $override);
$row->save();
}
if (isset($existing[$slug]) && $override === null) {
continue;
}
// Neue Zuweisung: expliziter Override oder Snapshot der Tenant-Config.
$snapshot = $override ?? ($tenantMethods[$slug]->configuration ?? []);
$configurations[$slug] = $this->eventConfiguration($slug, $snapshot ?? []);
}
return $configurations;
}
/**
* Namen der Zahlungsarten, deren Config nicht vollständig oder nicht gültig ist.
*
* Geprüft wird auf der Event-Config, also ohne die tenant-weiten Optionen -- die sind ohnehin nie
* Pflicht, weil sie am Event gar nicht liegen.
*
* @param array<string, array<string, mixed>> $configurations
* @return array<int, string>
*/
private function incompleteNames(array $configurations): array
{
$names = [];
foreach ($configurations as $slug => $configuration) {
if (!PaymentMethod::isConfigurationComplete($slug, $configuration)) {
$names[] = EventPaymentModuleRegistry::forSlug($slug)?->defaultName() ?? $slug;
}
}
return $names;
}
/**
* Differenzieller Sync: entfernte Methoden werden gelöscht, die vorbereiteten Configs geschrieben.
*
* @param Collection<string, EventPaymentMethods> $existing
* @param array<string, array<string, mixed>> $configurations
*/
private function syncPaymentMethods(Collection $existing, array $configurations): void
{
$event = $this->request->event;
// Nicht mehr gewünschte Methoden entfernen.
foreach ($existing as $slug => $row) {
if (!in_array($slug, $this->request->paymentMethods, true)) {
$row->delete();
}
}
foreach ($configurations as $slug => $configuration) {
if (isset($existing[$slug])) {
$row = $existing[$slug];
$row->configuration = $configuration;
$row->save();
continue;
}
EventPaymentMethods::create([
'event_id' => $event->id,
'slug' => $slug,
'configuration' => $this->eventConfiguration($slug, $snapshot ?? []),
'configuration' => $configuration,
]);
}
}
@@ -4,6 +4,8 @@ namespace App\Domains\Event\Actions\ShortSignUp;
use App\Domains\Event\Actions\SignUp\SignUpCommand;
use App\Domains\Event\Actions\SignUp\SignUpRequest;
use App\Models\ParentGroup;
use App\Models\Tenant;
use App\ValueObjects\Age;
/**
@@ -53,18 +55,21 @@ class ShortSignUpCommand {
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;
// Gruppe (Local oder Parent Group, je nach Veranstaltung): bei genau einer Option wird diese gesetzt, bei
// mehreren muss gewählt werden, ohne Optionen bleibt die Zuordnung leer.
$groupOptions = $this->request->event->participantGroupOptions();
$participantGroup = null;
if ($localGroups->count() === 1) {
$localGroup = $localGroups->first();
} elseif ($localGroups->count() > 1) {
$localGroup = $localGroups->firstWhere('id', $this->request->localGroupId);
if ($groupOptions->count() === 1) {
$participantGroup = $groupOptions->first();
} elseif ($groupOptions->count() > 1) {
$participantGroup = $groupOptions->firstWhere('id', $this->request->localGroupId);
if ($localGroup === null) {
$response->message = 'Bitte einen Stamm auswählen.';
if ($participantGroup === null) {
$response->message = sprintf(
'Bitte bei „%s" eine Auswahl treffen.',
$this->request->event->participantGroupType()->label(),
);
return $response;
}
}
@@ -87,7 +92,7 @@ class ShortSignUpCommand {
lastname: $this->request->lastname,
nickname: $this->request->nickname,
participationType: $participationType,
localGroup: $localGroup,
localGroup: $participantGroup instanceof Tenant ? $participantGroup : null,
birthday: $this->request->birthday,
address_1: self::PLACEHOLDER,
address_2: null,
@@ -123,6 +128,7 @@ class ShortSignUpCommand {
addonItems: [],
feeType: $this->request->feeType,
siblingReduction: false,
parentGroup: $participantGroup instanceof ParentGroup ? $participantGroup : null,
);
$signUpResponse = new SignUpCommand($signUpRequest)->execute();
@@ -6,6 +6,7 @@ use App\Enumerations\EatingHabit;
use App\Enumerations\EfzStatus;
use App\Enumerations\SwimmingPermission;
use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\Repositories\PaymentMethodRepository;
use App\ValueObjects\Age;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
@@ -17,6 +18,14 @@ class SignUpCommand {
public function execute() : SignUpResponse {
$response = new SignUpResponse();
// Nur eine Zahlungsart, die am Event hängt, aktiv und vollständig konfiguriert ist.
if ($this->request->paymentMethod !== null
&& !new PaymentMethodRepository()->isUsableForSignUp($this->request->event, $this->request->paymentMethod)) {
$response->success = false;
$response->message = 'Die gewählte Zahlungsart steht für diese Veranstaltung nicht zur Verfügung.';
return $response;
}
// Teilnehmer-Eingaben der gewählten Zahlungsart gegen das Modul-Schema absichern.
$module = $this->request->paymentMethod !== null
? EventPaymentModuleRegistry::forSlug($this->request->paymentMethod)
@@ -37,11 +46,7 @@ class SignUpCommand {
return $response;
}
$eatingHabit = match ($this->request->eating_habit) {
'vegan' => EatingHabit::EATING_HABIT_VEGAN,
'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN,
default => EatingHabit::EATING_HABIT_OMNIVOR,
};
$eatingHabit = $this->resolveEatingHabit();
$participantAge = new Age($this->request->birthday);
@@ -61,6 +66,7 @@ class SignUpCommand {
'fee_type' => $this->request->feeType,
'sibling_reduction' => $this->request->siblingReduction,
'local_group' => $this->request->localGroup?->slug,
'parent_group_id' => $this->request->parentGroup?->id,
'birthday' => $this->request->birthday,
'address_1' => $this->request->address_1,
'address_2' => $this->request->address_2,
@@ -94,7 +100,9 @@ class SignUpCommand {
'payment_purpose' => $this->request->event->name . ' - Beitrag ' . $this->request->firstname . ' ' . $this->request->lastname,
'payment_method' => $this->request->paymentMethod,
'payment_options' => $paymentOptions,
'efz_status' => $participantAge->isfullAged() ? EfzStatus::EFZ_STATUS_NOT_CHECKED : EfzStatus::EFZ_STATUS_NOT_REQUIRED,
'efz_status' => $participantAge->isfullAged() && $this->request->event->coc_check_required
? EfzStatus::EFZ_STATUS_NOT_CHECKED
: EfzStatus::EFZ_STATUS_NOT_REQUIRED,
]
);
@@ -108,6 +116,21 @@ class SignUpCommand {
return $response;
}
/**
* Ernährungsweise auflösen. Übernommen wird nur ein Slug, den die Veranstaltung anbietet; ohne Angabe (z. B. bei
* der Kurzanmeldung) oder bei einem nicht angebotenen Wert gilt "Omnivor".
*/
private function resolveEatingHabit(): string
{
$slug = $this->request->eating_habit;
if ($slug !== '' && $this->request->event->eatingHabits()->where('slug', $slug)->exists()) {
return $slug;
}
return EatingHabit::EATING_HABIT_OMNIVOR;
}
/**
* 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 --,
@@ -3,6 +3,7 @@
namespace App\Domains\Event\Actions\SignUp;
use App\Models\Event;
use App\Models\ParentGroup;
use App\Models\Tenant;
use App\ValueObjects\Amount;
use DateTime;
@@ -55,6 +56,8 @@ class SignUpRequest {
public ?string $feeType = null,
/** Ob die 50-%-Geschwisterermäßigung in `amount` eingerechnet ist. */
public bool $siblingReduction = false,
/** Parent Group -- nur bei Veranstaltungen, die danach statt nach der Local Group fragen. */
public ?ParentGroup $parentGroup = null,
) {
}
}
@@ -2,6 +2,8 @@
namespace App\Domains\Event\Actions\UpdateEvent;
use App\Repositories\EventParticipantRepository;
class UpdateEventCommand {
public UpdateEventRequest $request;
public function __construct(UpdateEventRequest $request) {
@@ -26,6 +28,15 @@ class UpdateEventCommand {
$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->coc_check_required = $this->request->cocCheckRequired;
// Umstellen zwischen Local und Parent Group nur ohne Anmeldungen -- sonst stünden in einer Veranstaltung
// beide Arten von Antworten nebeneinander.
if ($this->request->participantGroupType !== null
&& !new EventParticipantRepository()->existsForEvent($this->request->event)) {
$this->request->event->participant_group_type = $this->request->participantGroupType->value;
}
$this->request->event->save();
$this->request->event->resetAllowedEatingHabits();
@@ -2,6 +2,7 @@
namespace App\Domains\Event\Actions\UpdateEvent;
use App\Enumerations\ParticipantGroupType;
use App\Models\Event;
use App\ValueObjects\Amount;
use DateTime;
@@ -21,13 +22,18 @@ class UpdateEventRequest {
public bool $registrationAllowed;
public bool $shortRegistration;
public bool $swimmingPermissionRequired;
public bool $cocCheckRequired;
public Amount $flatSupport;
public Amount $supportPerPerson;
public array $contributingLocalGroups;
public array $eatingHabits;
/** Wonach bei der Anmeldung gefragt wird; null = unverändert. Greift nur, solange es keine Anmeldungen gibt. */
public ?ParticipantGroupType $participantGroupType;
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, bool $shortRegistration = false, bool $swimmingPermissionRequired = true, ?string $street = null, ?string $houseNumber = null, ?ParticipantGroupType $participantGroupType = null, bool $cocCheckRequired = true)
{
$this->participantGroupType = $participantGroupType;
$this->cocCheckRequired = $cocCheckRequired;
$this->event = $event;
$this->eventName = $eventName;
$this->eventLocation = $eventLocation;
@@ -31,9 +31,8 @@ class UpdateParticipantCommand {
$p->address_2 = $this->request->address_2;
$p->postcode = $this->request->postcode;
$p->city = $this->request->city;
// Leerer String würde als Fremdschlüssel scheitern -- kein Stamm heißt null.
$p->local_group = $this->request->localgroup ?: null;
$p->birthday = DateTime::createFromFormat('Y-m-d', $this->request->birthday);
$this->applyParticipantGroup($p);
$p->birthday = DateTime::createFromFormat('Y-m-d', $this->request->birthday);
$p->email_1 = $this->request->email_1;
$p->phone_1 = $this->request->phone_1;
$p->contact_person = $this->request->contact_person;
@@ -87,6 +86,29 @@ class UpdateParticipantCommand {
return $this->response;
}
/**
* Übernimmt die gewählte Gruppe -- je nach Veranstaltung die Local Group (Slug) oder die Parent Group (ID).
* Angenommen wird nur, was die Veranstaltung zur Auswahl stellt; leer heißt keine Angabe (null, ein leerer
* String würde als Fremdschlüssel scheitern).
*/
private function applyParticipantGroup(EventParticipant $participant): void
{
$event = $participant->event;
$value = trim((string) $this->request->participantGroup);
if ($event->asksForParentGroup()) {
$participant->parent_group_id = $value === ''
? null
: $event->participantGroupOptions()->firstWhere('id', (int) $value)?->id;
return;
}
$participant->local_group = $value === ''
? null
: $event->participantGroupOptions()->firstWhere('slug', $value)?->slug;
}
/**
* Ersetzt die zugeordneten Zusätze (Event-Addons) anhand der Auswahl. Bewusst **ohne Preis/Betrag**
* (amount 0): der Teilnahmebeitrag wird in den Details ohnehin manuell gesetzt. Es wird nur der Titel als
@@ -14,8 +14,11 @@ class UpdateParticipantRequest {
public ?string $address_2,
public string $postcode,
public string $city,
/** Stamm-Slug; leer/null bei Anmeldungen, die keinen Stamm erfasst haben (Kurzanmeldung). */
public ?string $localgroup,
/**
* Gewählte Gruppe: Slug der Local Group bzw. ID der Parent Group, je nachdem, wonach die Veranstaltung
* fragt. Leer/null = keine Angabe.
*/
public ?string $participantGroup,
public string $birthday,
public string $email_1,
public string $phone_1,
@@ -9,6 +9,7 @@ use App\Domains\Event\Actions\CreateEvent\CreateEventRequest;
use App\Domains\Event\Actions\SetCostUnit\SetCostUnitCommand;
use App\Domains\Event\Actions\SetCostUnit\SetCostUnitRequest;
use App\Enumerations\CostUnitType;
use App\Enumerations\ParticipantGroupType;
use App\Enumerations\ParticipationFeeType;
use App\Providers\InertiaProvider;
use App\Resources\EventResource;
@@ -28,6 +29,7 @@ class CreateController extends CommonController {
'participationFeeType' => $this->tenant->slug === 'lv' ?
ParticipationFeeType::PARTICIPATION_FEE_TYPE_FIXED :
ParticipationFeeType::PARTICIPATION_FEE_TYPE_SOLIDARITY,
'participantGroupTypes' => ParticipantGroupType::options(),
])->render();
}
@@ -58,7 +60,8 @@ class CreateController extends CommonController {
$request->input('eventIban'),
$payPerDay,
$request->input('eventStreet'),
$request->input('eventHouseNumber')
$request->input('eventHouseNumber'),
ParticipantGroupType::fromStored($request->input('eventParticipantGroupType')),
);
$wasSuccessful = false;
@@ -14,6 +14,7 @@ use App\Domains\Event\Actions\UpdateEvent\UpdateEventCommand;
use App\Domains\Event\Actions\UpdateEvent\UpdateEventRequest;
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersCommand;
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersRequest;
use App\Enumerations\ParticipantGroupType;
use App\Enumerations\ParticipationFeeType;
use App\Enumerations\ParticipationType;
use App\Providers\InertiaProvider;
@@ -27,7 +28,10 @@ use Illuminate\Http\Response;
class DetailsController extends CommonController {
public function __invoke(string $eventId) {
$event = $this->events->getByIdentifier($eventId);
return new InertiaProvider('Event/Details', ['event' => $event])->render();
return new InertiaProvider('Event/Details', [
'event' => $event,
'participantGroupLabel' => $event->participantGroupType()->label(),
])->render();
}
public function summary(int $eventId, Request $request) : JsonResponse {
@@ -65,6 +69,8 @@ class DetailsController extends CommonController {
(bool)$request->input('swimmingPermissionRequired', true),
$request->input('street'),
$request->input('houseNumber'),
ParticipantGroupType::tryFrom((string) $request->input('participantGroupType')),
(bool)$request->input('cocCheckRequired', true),
);
$eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest);
@@ -185,6 +191,7 @@ class DetailsController extends CommonController {
'rows' => $participants,
'kitchenRequirements' => $kitchenOverview,
'participantsForKitchenList' => $this->eventParticipants->getParticipantsWithIntolerances($event, $request),
'participantGroupLabel' => $event->participantGroupType()->label(),
])->render();
$pdf = PdfGenerateAndDownloadProvider::fromHtml(
@@ -208,6 +215,9 @@ class DetailsController extends CommonController {
$csv = view('csvs.' . $listType, [
'event' => $event->name,
'rows' => $participants,
// Die Anschriftsspalten beschreiben immer die Local Group, die Gruppenspalte die gewählte Gruppe.
'localGroupLabel' => ParticipantGroupType::LocalGroup->label(),
'participantGroupLabel' => $event->participantGroupType()->label(),
])->render();
return response($csv, 200, [
@@ -220,7 +230,7 @@ class DetailsController extends CommonController {
$event = $this->events->getByIdentifier($eventId);
switch ($listType) {
case 'by-local-group':
$participants = $this->eventParticipants->groupByLocalGroup($event, $request);
$participants = $this->eventParticipants->groupByParticipantGroup($event, $request);
break;
case 'by-participation-group':
$participants = $this->eventParticipants->groupByParticipationType($event, $request);
@@ -12,7 +12,7 @@ class ByGroupController extends CommonController
$recipients = [];
switch ($groupType) {
case 'by-local-group':
$participants = $this->eventParticipants->groupByLocalGroup($event, $request, $request->input('groupName'));
$participants = $this->eventParticipants->groupByParticipantGroup($event, $request, $request->input('groupName'));
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
break;
case 'by-participation-group':
@@ -22,7 +22,7 @@ class ParticipantUpdateController extends CommonController {
address_2: $request->input('address_2'),
postcode: $request->input('postcode'),
city: $request->input('city'),
localgroup: $request->input('localgroup'),
participantGroup: $request->input('participantGroup'),
birthday: $request->input('birthday'),
email_1: $request->input('email_1'),
phone_1: $request->input('phone_1'),
@@ -7,6 +7,7 @@ use App\Domains\Event\Actions\CertificateOfConductionCheck\CertificateOfConducti
use App\Domains\Event\Actions\SignUp\SignUpCommand;
use App\Domains\Event\Actions\SignUp\SignUpRequest;
use App\Mail\ParticipantParticipationMails\EventSignUpSuccessfullMail;
use App\Models\ParentGroup;
use App\Models\Tenant;
use App\Providers\DoubleCheckEventRegistrationProvider;
use App\Providers\InertiaProvider;
@@ -65,7 +66,7 @@ class SignupController extends CommonController {
$inertiaProvider = new InertiaProvider('Event/Signup', [
'event' => $event,
'availableEvents' => $availableEvents,
'localGroups' => $event['contributingLocalGroups'],
'localGroups' => $event['participantGroupOptions'] ?? [],
'participantData' => $participantData,
]);
return $inertiaProvider->render();
@@ -111,6 +112,15 @@ class SignupController extends CommonController {
$addonResolution = $eventResource->resolveAddons($selectedAddonKeys, $arrival, $departure);
$amount->addAmount($addonResolution['total']);
// Gewählt wird eine der Optionen der Veranstaltung (Local oder Parent Group); anderes wird abgelehnt.
$participantGroup = $event->participantGroupOptions()->firstWhere('id', (int)($registrationData['localGroup'] ?? 0));
if ($participantGroup === null) {
return response()->json([
'status' => 'error',
'message' => sprintf('Bitte bei „%s" eine Auswahl treffen.', $event->participantGroupType()->label()),
], 422);
}
$signupRequest = new SignUpRequest(
$event,
$registrationData['userId'] ?? null,
@@ -118,7 +128,7 @@ class SignupController extends CommonController {
$registrationData['nachname'],
$registrationData['pfadiname'],
$registrationData['participationType'],
Tenant::findOrFail($registrationData['localGroup']),
$participantGroup instanceof Tenant ? $participantGroup : null,
\DateTime::createFromFormat('Y-m-d', $registrationData['geburtsdatum']),
$registrationData['address1'],
$registrationData['address2'],
@@ -133,7 +143,7 @@ class SignupController extends CommonController {
$registrationData['intolerances'],
$registrationData['medikamente'],
$tetanusVaccination,
$registrationData['essgewohnheit'],
$registrationData['eatingHabit'] ?? '',
$registrationData['badeerlaubnis'],
$registrationData['first_aid'],
$registrationData['foto']['socialmedia'],
@@ -153,6 +163,7 @@ class SignupController extends CommonController {
$addonResolution['items'],
$registrationData['beitrag'],
$siblingReduction,
$participantGroup instanceof ParentGroup ? $participantGroup : null,
);
$signupCommand = new SignUpCommand($signupRequest);
+12
View File
@@ -15,6 +15,7 @@
'eventIban': String,
"eventPayPerDay": Boolean,
"participationFeeType": String,
"participantGroupTypes": {type: Array, default: () => []},
})
const errors = reactive({})
@@ -35,6 +36,7 @@
eventIban: props.eventIban ? props.eventIban : '',
eventPayPerDay: props.eventPayPerDay ? props.eventPayPerDay : false,
eventParticipationFeeType: props.participationFeeType ? props.participationFeeType : 'fixed',
eventParticipantGroupType: 'local_group',
});
watch(
@@ -159,6 +161,7 @@
eventIban: formData.eventIban,
eventPayPerDay: formData.eventPayPerDay,
eventParticipationFeeType: formData.eventParticipationFeeType,
eventParticipantGroupType: formData.eventParticipantGroupType,
}
});
@@ -256,6 +259,15 @@
</td>
</tr>
<tr style="vertical-align: top;">
<th class="width-medium pr-20 height-50">Bei der Anmeldung abfragen</th>
<td class="height-50">
<select v-model="formData.eventParticipantGroupType" class="width-half-full">
<option v-for="type in props.participantGroupTypes" :key="type.value" :value="type.value">{{ type.label }}</option>
</select>
</td>
</tr>
<tr style="vertical-align: top;">
<th class="width-medium pr-20 height-50">Preiserhöhung nach Early-Bird-Phase</th>
+2 -1
View File
@@ -10,6 +10,7 @@ import Overview from "./Partials/Overview.vue";
const props = defineProps({
event: Object,
participantGroupLabel: {type: String, default: 'Stamm'},
})
const tabs = [
@@ -24,7 +25,7 @@ const tabs = [
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/all',
},
{
title: 'Teilis nach Stamm',
title: 'Teilis nach ' + props.participantGroupLabel,
component: ParticipantsList,
endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/by-local-group',
},
@@ -16,8 +16,13 @@ const emit = defineEmits(['close'])
const dynmicProps = reactive({
localGroups: [],
eatingHabits:[],
participantGroupTypes: [],
localGroupLabelPlural: 'Stämme',
});
// Umstellen zwischen Local und Parent Group nur, solange es keine Anmeldungen gibt.
const participantGroupTypeLocked = (props.event.totalParticipantCount ?? 0) > 0
const contributingLocalGroups = ref([])
const eatingHabits = ref([]);
@@ -39,8 +44,10 @@ const emit = defineEmits(['close'])
registrationAllowed: props.event.registrationAllowed,
shortRegistration: props.event.shortRegistration,
swimmingPermissionRequired: props.event.swimmingPermissionRequired,
cocCheckRequired: props.event.cocCheckRequired,
flatSupport: props.event.flatSupportEdit,
supportPerson: props.event.supportPersonIndex,
participantGroupType: props.event.participantGroupType ?? 'local_group',
})
onMounted(async () => {
@@ -72,10 +79,12 @@ const emit = defineEmits(['close'])
registrationAllowed: formData.registrationAllowed,
shortRegistration: formData.shortRegistration,
swimmingPermissionRequired: formData.swimmingPermissionRequired,
cocCheckRequired: formData.cocCheckRequired,
flatSupport: formData.flatSupport,
supportPerson: formData.supportPerson,
contributingLocalGroups: contributingLocalGroups.value,
eatingHabits: eatingHabits.value,
participantGroupType: formData.participantGroupType,
}
})
@@ -173,6 +182,18 @@ const emit = defineEmits(['close'])
</td>
</tr>
<tr>
<th>Bei der Anmeldung abfragen</th>
<td>
<select v-model="formData.participantGroupType" class="width-full" :disabled="participantGroupTypeLocked">
<option v-for="type in dynmicProps.participantGroupTypes" :key="type.value" :value="type.value">{{ type.label }}</option>
</select>
<span v-if="participantGroupTypeLocked" style="font-size: 0.8rem; color: #6b7280;">
Nicht mehr änderbar, da bereits Anmeldungen vorliegen.
</span>
</td>
</tr>
<tr>
<th>Mindestalter für Alkoholkonsum</th>
<td>
@@ -215,6 +236,16 @@ const emit = defineEmits(['close'])
</span>
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" v-model="formData.cocCheckRequired" id="cocCheckRequired" />
<label for="cocCheckRequired">Erweitertes Führungszeugnis (eFZ) prüfen</label><br />
<span style="font-size: 0.8rem; color: #6b7280;">
Ist die Prüfung deaktiviert, wird das eFZ bei neuen Anmeldungen als „Nicht erforderlich" hinterlegt.
</span>
</td>
</tr>
</table>
@@ -223,7 +254,7 @@ const emit = defineEmits(['close'])
<div class="right">
<table>
<tr>
<th>Teilnehmende Stämme</th>
<th>Teilnehmende {{ dynmicProps.localGroupLabelPlural }}</th>
</tr>
<tr v-for="localGroup in dynmicProps.localGroups">
<td>
@@ -42,7 +42,7 @@ const form = reactive({
address_2: '',
postcode: '',
city: '',
localgroup: '',
participantGroup: '',
birthday: '',
email_1: '',
phone_1: '',
@@ -71,6 +71,9 @@ const form = reactive({
// Teilnahmeoptionen des Events (Definition mit Titel/Frage/Optionen).
const participationQuestions = computed(() => staticProps.event?.participationOptions ?? []);
// Bezeichnung der gewählten Gruppe (z. B. „Stamm" oder „Bund"), je nach Einstellung der Veranstaltung.
const localGroupLabel = computed(() => staticProps.event?.participantGroupLabel ?? 'Stamm');
// Zusatzoptionen (Event-Addons) des Events.
const eventAddons = computed(() => staticProps.event?.addons ?? []);
@@ -95,7 +98,7 @@ watch(
form.address_2 = participant?.address_2 ?? '';
form.postcode = participant?.postcode ?? '';
form.city = participant?.city ?? '';
form.localgroup = participant?.local_group ?? '';
form.participantGroup = participant?.participantGroupValue ?? '';
form.birthday = participant?.birthdayDate ?? '';
form.email_1 = participant?.email_1 ?? '';
form.phone_1 = participant?.phone_1 ?? '';
@@ -229,12 +232,12 @@ function saveParticipant() {
</tr>
<tr>
<th>Stamm</th>
<th>{{ localGroupLabel }}</th>
<td>
<span v-if="!staticProps.editMode">{{ props.participant.localgroup }}</span>
<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>
<span v-if="!staticProps.editMode">{{ props.participant.participantGroup }}</span>
<select v-else v-model="form.participantGroup">
<option value="">Keine Angabe</option>
<option v-for="group in staticProps.event.participantGroupOptions" :key="group.id" :value="group.value">{{ group.name }}</option>
</select>
</td>
</tr>
@@ -162,7 +162,7 @@ async function saveParticipant(formData) {
document.getElementById('participant-' + data.participant.identifier + '-fullname').innerHTML = data.participant.fullname;
document.getElementById('participant-' + data.participant.identifier + '-birthday').innerText = data.participant.birthday;
document.getElementById('participant-' + data.participant.identifier + '-age').innerText = data.participant.age;
document.getElementById('participant-' + data.participant.identifier + '-localgroup').innerText = data.participant.localgroup;
document.getElementById('participant-' + data.participant.identifier + '-localgroup').innerText = data.participant.participantGroup;
document.getElementById('participant-' + data.participant.identifier + '-arrival').innerText = data.participant.arrival;
document.getElementById('participant-' + data.participant.identifier + '-departure').innerText = data.participant.departure;
document.getElementById('participant-' + data.participant.identifier + '-email_1').innerText = data.participant.email_1;
@@ -641,7 +641,7 @@ function mailToGroup(groupKey) {
<tr class="participant-meta-row" :id="'participant-' + participant.identifier + '-meta'">
<td colspan="5" class="pl-meta">
<label :id="'participant-' + participant.identifier +'-localgroup'">
{{ participant?.localgroup ?? "-" }}
{{ participant?.participantGroup ?? "-" }}
</label> |
<strong> Anreise: </strong>
<label :id="'participant-' + participant.identifier +'-arrival'">
@@ -401,6 +401,9 @@ onMounted(async () => {
placeholder="Symbol wählen…"/>
<TextEditor v-else-if="option.type === 'richtext'"
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"/>
<input v-else-if="option.type === 'number'" type="number" step="1"
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
class="width-full"/>
<input v-else type="text"
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
class="width-full"/>
@@ -13,10 +13,12 @@ export function useShortSignupForm(event, participantData) {
// 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 ?? []
// Auswahl je nach Veranstaltung: teilnehmende Stämme oder deren Bünde. Bei genau einer Option wird diese
// gesetzt, ohne danach zu fragen; erst ab zwei Optionen erscheint das Auswahlfeld.
const localGroups = event.participantGroupOptions ?? []
const needsLocalGroup = localGroups.length > 1
// Vorbelegung mit dem Stamm des eingeloggten Nutzers nur, wenn er zur Auswahl gehört (bei Bund-Abfrage nie).
const preselectedGroup = localGroups.some(g => g.id === participantData.localGroup) ? participantData.localGroup : '-1'
const formData = reactive({
userId: participantData.id,
@@ -26,7 +28,7 @@ export function useShortSignupForm(event, participantData) {
geburtsdatum: participantData.birthday ?? '',
email_1: participantData.email ?? '',
telefon_1: participantData.phone ?? '',
localGroup: localGroups.length === 1 ? localGroups[0].id : (participantData.localGroup ?? '-1'),
localGroup: localGroups.length === 1 ? localGroups[0].id : preselectedGroup,
ansprechpartner: '',
email_2: '',
allergien: participantData.allergies ?? '',
@@ -11,6 +11,9 @@ const props = defineProps({
})
const emit = defineEmits(['next'])
// Bezeichnung der Auswahl (z. B. „Stamm" oder „Bund"), je nach Einstellung der Veranstaltung.
const localGroupLabel = props.event?.participantGroupLabel ?? 'Stamm'
const errors = reactive({
vorname: '',
nachname: '',
@@ -46,7 +49,7 @@ const next = () => {
}
if (props.needsLocalGroup && (!props.formData.localGroup || props.formData.localGroup === '-1')) {
errors.localGroup = 'Bitte einen Stamm auswählen.'
errors.localGroup = 'Bitte bei „' + localGroupLabel + '" eine Auswahl treffen.'
hasError = true
}
@@ -122,7 +125,7 @@ const next = () => {
</td>
</tr>
<tr v-if="needsLocalGroup">
<td>Stamm:</td>
<td>{{ localGroupLabel }}:</td>
<td>
<select v-model="formData.localGroup">
<option value="-1">Bitte wählen</option>
@@ -43,9 +43,9 @@ const selectedParticipationOptions = computed(() =>
}).filter(entry => entry.value !== '')
)
// Der Stamm steht entweder fest (genau ein teilnehmender Stamm) oder wurde auf Seite 1 gewählt.
// Die Gruppe (Stamm oder Bund) steht entweder fest (genau eine Option) oder wurde auf Seite 1 gewählt.
const localGroupName = computed(() =>
(props.event.contributingLocalGroups ?? []).find(g => g.id === props.formData.localGroup)?.name ?? null
(props.event.participantGroupOptions ?? []).find(g => g.id === props.formData.localGroup)?.name ?? null
)
const permissionName = (list, slug) =>
@@ -84,7 +84,7 @@ const canSubmit = computed(() =>
<td>{{ formData.telefon_1 }}</td>
</tr>
<tr v-if="localGroupName">
<td>Stamm:</td>
<td>{{ event.participantGroupLabel ?? 'Stamm' }}:</td>
<td>{{ localGroupName }}</td>
</tr>
@@ -92,7 +92,7 @@ const steps = [
<form @submit.prevent="submit">
<StepAge v-if="currentStep === 1" :event="event" @next="goToStep" />
<StepContactPerson v-if="currentStep === 2" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
<StepPersonalData v-if="currentStep === 3" :formData="formData" :localGroups="localGroups" @next="goToStep" @back="goToStep" />
<StepPersonalData v-if="currentStep === 3" :formData="formData" :event="event" :localGroups="localGroups" @next="goToStep" @back="goToStep" />
<StepArrival v-if="currentStep === 4" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
<StepRegistrationMode v-if="currentStep === 5" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
<StepAddons v-if="currentStep === 6" :formData="formData" :event="event" :selectedAddons="selectedAddons" @next="goToStep" @back="goToStep" />
@@ -13,8 +13,13 @@ export function useSignupForm(event, participantData) {
// Für die Aktion freigeschaltete Zahlungsmethoden; ist genau eine aktiv, wird sie vorausgewählt.
const activeMethods = (event.paymentMethods ?? []).filter(m => m.active)
// Vorbelegung mit der Ernährungsweise aus dem Profil, sofern die Veranstaltung sie anbietet, sonst die erste Option.
const eatingHabitSlugs = (event.eatingHabits ?? []).map(h => h.data.slug)
const formData = reactive({
eatingHabit: 'EATING_HABIT_VEGAN',
eatingHabit: eatingHabitSlugs.includes(participantData.eating_habit)
? participantData.eating_habit
: (eatingHabitSlugs[0] ?? ''),
paymentMethod: activeMethods.length === 1 ? activeMethods[0].slug : null,
paymentOptions: {},
// Antworten auf die event-spezifischen Teilnahmeoptionen: { [question.key]: option.value }
@@ -24,7 +29,10 @@ export function useSignupForm(event, participantData) {
vorname: participantData.firstname ?? '',
nachname: participantData.lastname ?? '',
pfadiname: participantData.nickname ?? '',
localGroup: participantData.localGroup ?? '-1',
// Vorbelegung mit dem Stamm des eingeloggten Nutzers nur, wenn er zur Auswahl gehört (bei Bund-Abfrage nie).
localGroup: (event.participantGroupOptions ?? []).some(g => g.id === participantData.localGroup)
? participantData.localGroup
: '-1',
geburtsdatum: participantData.birthday ?? '',
address1: participantData.address_1 ?? '',
address2: participantData.address_2 ?? '',
@@ -50,7 +58,6 @@ export function useSignupForm(event, participantData) {
intolerances: participantData.intolerances ?? '',
medikamente: participantData.medications ?? '',
tetanusVaccination: participantData.tetanusVaccination ?? '',
essgewohnheit: 'vegetarian',
anmerkungen: '',
summary_information_correct: false,
summary_accept_terms: false,
@@ -2,9 +2,12 @@
import {reactive} from "vue";
import ErrorText from "../../../../../../Views/Components/ErrorText.vue";
const props = defineProps({ formData: Object, localGroups: Array })
const props = defineProps({ formData: Object, event: Object, localGroups: Array })
const emit = defineEmits(['next', 'back'])
// Bezeichnung der Auswahl (z. B. „Stamm" oder „Bund"), je nach Einstellung der Veranstaltung.
const localGroupLabel = props.event?.participantGroupLabel ?? 'Stamm'
const errors = reactive({
vorname: '',
nachname: '',
@@ -46,7 +49,7 @@ const next = () => {
}
if (props.formData.localGroup === '-1') {
errors.localGroup = 'Bitte den Stamm auswählen.'
errors.localGroup = 'Bitte bei „' + localGroupLabel + '" eine Auswahl treffen.'
hasError = true
}
@@ -90,7 +93,7 @@ const next = () => {
<tr><td>Nachname:</td><td><input type="text" v-model="props.formData.nachname" /><ErrorText :message="errors.nachname"/></td></tr>
<tr><td>Pfadiname:</td><td><input type="text" v-model="props.formData.pfadiname" /></td></tr>
<tr>
<td>Stamm:</td>
<td>{{ localGroupLabel }}:</td>
<td>
<select v-model="props.formData.localGroup">
<option value="-1">Bitte wählen</option>
+75
View File
@@ -0,0 +1,75 @@
<?php
namespace App\Enumerations;
use App\Models\GlobalSetting;
use App\Repositories\GlobalSettingRepository;
/**
* Wonach eine Veranstaltung bei der Anmeldung fragt: nach der Local Group (Mandant, im UI z. B. „Stamm") oder nach
* der Parent Group (übergeordnete Gruppe, im UI z. B. „Bund"). Die Bezeichnungen kommen aus den globalen
* Einstellungen.
*/
enum ParticipantGroupType: string
{
case LocalGroup = 'local_group';
case ParentGroup = 'parent_group';
public function label(): string
{
return match ($this) {
self::LocalGroup => self::setting(GlobalSetting::LOCAL_GROUP_LABEL, 'Stamm'),
self::ParentGroup => self::setting(GlobalSetting::PARENT_GROUP_LABEL, 'Bund'),
};
}
public function pluralLabel(): string
{
return match ($this) {
self::LocalGroup => self::setting(GlobalSetting::LOCAL_GROUP_LABEL_PLURAL, 'Stämme'),
self::ParentGroup => self::setting(GlobalSetting::PARENT_GROUP_LABEL_PLURAL, 'Bünde'),
};
}
/**
* Optionen für das Frontend: [['value' => ..., 'label' => ...], ...].
*
* @return array<int, array{value: string, label: string}>
*/
public static function options(): array
{
return array_map(
static fn (self $type): array => [
'value' => $type->value,
'label' => $type->label(),
],
self::cases(),
);
}
/** Typ zu einem gespeicherten Wert; Unbekanntes fällt auf die Local Group zurück. */
public static function fromStored(?string $value): self
{
return self::tryFrom((string) $value) ?? self::LocalGroup;
}
/**
* Alle Bezeichnungen fürs Frontend (Shared Prop).
*
* @return array{localGroup: string, localGroupPlural: string, parentGroup: string, parentGroupPlural: string}
*/
public static function labels(): array
{
return [
'localGroup' => self::LocalGroup->label(),
'localGroupPlural' => self::LocalGroup->pluralLabel(),
'parentGroup' => self::ParentGroup->label(),
'parentGroupPlural' => self::ParentGroup->pluralLabel(),
];
}
private static function setting(string $key, string $default): string
{
return app(GlobalSettingRepository::class)->get($key, $default);
}
}
@@ -66,10 +66,31 @@ abstract class AbstractEventPaymentModule implements EventPaymentModule
return $this->sanitizeAgainst($this->getOptions(), $config);
}
/** @param array<string, mixed> $config */
/**
* Vollständig heißt: alle Pflichtfelder befüllt **und** keine ungültigen Werte. Erst dann darf die
* Zahlungsart aktiv werden bzw. für Anmeldungen genutzt werden.
*
* @param array<string, mixed> $config
*/
public function isConfigurationComplete(array $config): bool
{
return $this->allRequiredFilled($this->getOptions(), $config);
return $this->allRequiredFilled($this->getOptions(), $config)
&& $this->configurationErrors($config) === [];
}
/**
* Inhaltliche Prüfung der Admin-Config über das reine „befüllt" hinaus (z.B. Prüfziffer einer
* IBAN). Leere Felder meldet hier niemand -- das ist Sache der Pflichtfeld-Prüfung.
*
* Standard: keine Prüfung. Bestandsmodule bleiben so, wie sie sind; eine Zahlungsart, bei der ein
* ungültiger Wert erst die Bank zurückweist (Lastschrift), prüft selbst.
*
* @param array<string, mixed> $config
* @return array<string, string> Optionsname => Meldung
*/
public function configurationErrors(array $config): array
{
return [];
}
/**
+42 -4
View File
@@ -11,7 +11,8 @@ Rechnung) liegt gekapselt in einem Modul pro Zahlungsart. Aufgelöst wird über
- `AbstractEventPaymentModule` — Basisklasse (Template-Method). Liefert die aus `getOptions()` abgeleiteten Helfer
(`requiredOptionKeys()`, `sanitizeConfiguration()`, `isConfigurationComplete()`) und sinnvolle Default-/Stub-Bodies.
- `Modules/` — konkrete Module (flach, eine Klasse je Zahlungsart):
`AccountTransferPaymentModule` (Überweisung), `UndefinedPaymentModule` (Barzahlung/Sonstiges).
`AccountTransferPaymentModule` (Überweisung), `UndefinedPaymentModule` (Barzahlung/Sonstiges),
`SepaDirectDebitPaymentModule` (SEPA-Lastschrift, im Aufbau — siehe unten).
- `DTO/` — geteilte Request/Response-DTOs je Operation (`DoPayment*`, `CreateInvoice*`, `RegistrationSummary*`,
`GetRefundData*`, `TransactionMatch`).
- `EventPaymentModuleRegistry` — statische Map `slug → Modul-Instanz` (`forSlug()`, `all()`, `slugs()`). **Neue Module
@@ -44,8 +45,23 @@ Rechnung) liegt gekapselt in einem Modul pro Zahlungsart. Aufgelöst wird über
stehen, sonst verwirft `sanitizeParticipantOptions()` sie als unbekannte Schlüssel.
- `defaultConfiguration()` je Modul liefert die Start-Config beim Anlegen der Tenant-Instanz (`CreateTenantAction`),
aktuell das Default-Symbol (`icon`): Überweisung `building-columns`, Sonstiges `coins`.
- **Aktivierungs-Guard:** Eine Tenant-Zahlungsmethode darf nur `active` werden, wenn alle `required`-Optionen befüllt
sind (`isConfigurationComplete()`), erzwungen in `UpdateAvailablePaymentMethodAction`.
- **Vollständig = befüllt + gültig:** `isConfigurationComplete()` verlangt alle `required`-Optionen **und** ein leeres
`configurationErrors(array $config): array<option, Meldung>`. Der Hook liefert in der Basis `[]`; ein Modul, dessen
Werte sonst erst die Bank zurückweist, prüft selbst (Lastschrift: IBAN, Gläubiger-ID, Vorlauf). Leere Felder meldet
der Hook nicht — das ist Sache der Pflichtfeld-Prüfung. Fassade: `PaymentMethod::configurationErrors()`.
- **Drei Guards, ein Maßstab (`isConfigurationComplete()`):**
- Tenant: `active` nur bei vollständiger Config (`UpdateAvailablePaymentMethodAction`, meldet die konkreten
Fehler; inaktiv speichern geht auch unfertig, als Entwurf). `CreateTenantAction` legt neue Stämme nur mit den
Zahlungsarten aktiv an, die schon vollständig sind — praktisch alle inaktiv, bis Bankdaten gepflegt sind.
- Event: `SetPaymentMethodsCommand` lehnt ab, wenn eine **zu schreibende** Event-Config (neuer Snapshot oder
Override) unvollständig ist — geprüft wird vor dem Schreiben, nichts wird halb übernommen.
- Anmeldung: `SignUpCommand` nimmt nur eine Zahlungsart an, die dem Event zugewiesen, beim Tenant aktiv und am
Event vollständig ist (`PaymentMethodRepository::isUsableForSignUp()`). Gilt auch für die Kurzanmeldung.
**Tests**, die eine Anmeldung durchspielen, müssen die Zahlungsart deshalb zuweisen — Trait
`Tests\Concerns\OffersAccountTransfer`.
- **Bankdaten-Sync:** `UpdateTenantPaymentAction` schreibt Kontoinhaber/IBAN/BIC des Stammes in die Tenant-Config von
Überweisung **und** Lastschrift (`BANK_ACCOUNT_SLUGS`); übrige Optionen bleiben stehen.
- Options-Typ `'number'` rendern beide Admin-Stellen als `<input type="number">`.
- **Config-Speicherung (JSON):** pro Tenant auf `available_payment_methods.configuration`, pro Event auf dem Pivot
`event_payment_methods.configuration`. Beim Zuweisen an ein Event wird die Tenant-Config als **Snapshot kopiert**
(Copy-on-Assign, spätere Tenant-Änderungen wirken NICHT nach). Sync erfolgt differenziell in
@@ -138,6 +154,27 @@ Beispiel GiroCode (nur Überweisung):
- Parser (`App\Providers\BankStatementParseProvider`), `BankStatementRuleset` und `BankTransaction` liegen außerhalb
dieser Schicht — sie sind zahlartneutral.
## SEPA-Lastschrift (`SepaDirectDebitPaymentModule`, Slug `PAYMENT_SEPA_DIRECT_DEBIT`)
Keine Bankschnittstelle: mareike erzeugt eine Datei **pain.008.001.08** (ISO 20022, SEPA-Basislastschrift CORE, DK
DFÜ-Abkommen Anlage 3), die im Online-Banking hochgeladen wird. Bis dahin bleibt der Beitrag offen; danach gilt er als
ausgeglichen — unabhängig von Rücklastschriften.
- **Admin-Config:** `account_owner`/`iban`/`bic` (aus den Bankdaten des Stammes synchronisiert), `creditor_id`
(Gläubiger-ID, geprüft über `App\Support\CreditorId` — Mod 97-10 ohne Geschäftsbereichskennung; Testwert
`DE98ZZZ09999999999`), `pre_notification_days` (2–14, Default 5), `icon` (`file-signature`).
- **Bestandsdaten:** Migration `2026_10_04_140010` legt die Zahlungsart je Stamm **inaktiv** mit vorbefüllten
Bankdaten an (nur wenn schon Stämme existieren — bei Neuinstallation übernimmt der Seeder).
- **Abgestimmte Prozessentscheidungen** (für die nächsten Phasen):
- Mandat online per Checkbox im Anmeldeformular; Mandatsreferenz + Datum werden gespeichert. Nur IBANs aus EU/EWR,
dann sind ab 15.11.2026 keine (strukturierten) Adressen nötig.
- Anmeldemail zeigt einen Zeitraum: frühestens Anmeldetag + N, spätestens `registration_final_end` + N.
- Button „SEPA-Lastschriftdatei erzeugen" in der Event-Übersicht (`Overview.vue`): Einzugsdatum = heute + N
(nächster TARGET-Tag), Mail an jede*n Zahler*in mit genauem Datum, Betrag, Mandatsreferenz, Gläubiger-ID und
„Achte auf entsprechende Deckung"; Beitrag wird ausgeglichen. Datei bleibt gespeichert und erneut herunterladbar.
- **Offen:** Phase 2 (Teilnehmer-Optionen/Mandat, Pflicht-Checkbox muss `true` sein — heute gilt `false` als befüllt,
`registrationSummary()`, `getRefundData()` → `Known`), Phase 3 (Datei, Lauf-Protokoll, Mails).
## Anmelde-Zusammenfassung / Mail-Anzeige
- `registrationSummary(RegistrationSummaryRequest): RegistrationSummaryResponse` liefert den zahlungsspezifischen
@@ -180,7 +217,8 @@ Live-Inbetriebnahme einmal gegen die Produktionsdatenbank ausführen — ersetzt
`tests/Unit/PaymentMethodOptionsTest`, `tests/Unit/EventPaymentModuleRegistryTest`,
`tests/Unit/RegistrationSummaryTest`, `tests/Unit/BankStatementParseTest`, `tests/Unit/BankStatementMatchTest`,
`tests/Unit/BankStatementRulesetTest`, `tests/Unit/RefundDataTest`, `tests/Feature/PaymentMethodConfigurationTest`,
`tests/Unit/BankStatementRulesetTest`, `tests/Unit/RefundDataTest`, `tests/Unit/CreditorIdTest`,
`tests/Feature/PaymentMethodConfigurationTest`, `tests/Feature/SignUpPaymentOptionsTest`,
`tests/Feature/EventParticipantPaymentSummaryTest`, `tests/Feature/BankStatementImportTest`,
`tests/Feature/RefundKnownAccountTest`, `tests/Feature/RefundCashPayerTest`.
@@ -3,6 +3,7 @@
namespace App\EventPaymentModules;
use App\EventPaymentModules\Modules\AccountTransferPaymentModule;
use App\EventPaymentModules\Modules\SepaDirectDebitPaymentModule;
use App\EventPaymentModules\Modules\UndefinedPaymentModule;
/**
@@ -19,6 +20,7 @@ class EventPaymentModuleRegistry
private const MODULES = [
AccountTransferPaymentModule::class,
UndefinedPaymentModule::class,
SepaDirectDebitPaymentModule::class,
];
/** @var array<string, EventPaymentModule>|null Lazy gecachte Instanzen (slug => Modul). */
@@ -0,0 +1,132 @@
<?php
namespace App\EventPaymentModules\Modules;
use App\EventPaymentModules\AbstractEventPaymentModule;
use App\EventPaymentModules\DTO\CreateInvoiceRequest;
use App\Models\PaymentMethod;
use App\Support\CreditorId;
use App\Support\Iban;
/**
* SEPA-Basislastschrift -- der Beitrag wird auf Grundlage eines Mandats vom Konto der zahlenden Person
* eingezogen.
*
* Eine Schnittstelle zur Bank gibt es nicht: mareike erzeugt eine Lastschriftdatei (pain.008), die im
* Online-Banking hochgeladen wird. Bis dahin bleibt der Beitrag offen.
*
* Das Gläubigerkonto kommt aus den Bankdaten des Stammes (wie bei der Überweisung, synchronisiert in
* {@see \App\Domains\Admin\Actions\UpdateTenantPayment\UpdateTenantPaymentAction}); dazu kommen die
* Gläubiger-ID und der Vorlauf bis zum Einzug.
*/
class SepaDirectDebitPaymentModule extends AbstractEventPaymentModule
{
public const string OPTION_CREDITOR_ID = 'creditor_id';
public const string OPTION_PRE_NOTIFICATION_DAYS = 'pre_notification_days';
/**
* Untergrenze des Vorlaufs: ein Bankarbeitstag, den die Bank für eine Basislastschrift braucht,
* plus der Tag, an dem die Datei hochgeladen wird.
*/
public const int MIN_PRE_NOTIFICATION_DAYS = 2;
/** Obergrenze: die gesetzliche Standardfrist der Vorabankündigung -- mehr verkürzt nichts mehr. */
public const int MAX_PRE_NOTIFICATION_DAYS = 14;
public static function slug(): string
{
return PaymentMethod::PAYMENT_SEPA_DIRECT_DEBIT;
}
public function defaultName(): string
{
return 'SEPA-Lastschrift';
}
public function defaultDescription(): ?string
{
return 'Der Beitrag wird auf Grundlage eines SEPA-Lastschriftmandats vom angegebenen Konto eingezogen.';
}
public function defaultConfiguration(): array
{
return [
'icon' => 'file-signature',
self::OPTION_PRE_NOTIFICATION_DAYS => 5,
];
}
public function getOptions(): array
{
$fromTenant = 'Wird aus den Bankdaten des Stammes übernommen.';
return [
['name' => 'account_owner', 'label' => 'Kontoinhaber', 'type' => 'string', 'required' => true, 'hint' => $fromTenant],
['name' => 'iban', 'label' => 'IBAN', 'type' => 'string', 'required' => true, 'hint' => $fromTenant],
['name' => 'bic', 'label' => 'BIC', 'type' => 'string', 'required' => false, 'hint' => $fromTenant],
[
'name' => self::OPTION_CREDITOR_ID,
'label' => 'Gläubiger-ID',
'type' => 'string',
'required' => true,
'hint' => 'Die Gläubiger-Identifikationsnummer wird kostenlos bei der Deutschen Bundesbank beantragt '
. '(glaeubiger-id.bundesbank.de), z. B. DE98ZZZ09999999999.',
],
[
'name' => self::OPTION_PRE_NOTIFICATION_DAYS,
'label' => 'Vorlauf bis zum Einzug (Tage)',
'type' => 'number',
'required' => true,
'hint' => sprintf(
'So viele Tage nach dem Erzeugen der Lastschriftdatei wird eingezogen (%d bis %d). '
. 'Die Frist steht als verkürzte Vorabankündigung im Mandatstext.',
self::MIN_PRE_NOTIFICATION_DAYS,
self::MAX_PRE_NOTIFICATION_DAYS,
),
],
['name' => 'icon', 'label' => 'Symbol', 'type' => 'icon', 'required' => false],
];
}
/**
* Ein Fehler in diesen Werten fiele sonst erst der Bank auf -- beim Hochladen der Datei, wenn die
* Vorabankündigungen schon verschickt sind.
*/
public function configurationErrors(array $config): array
{
$errors = [];
$iban = (string) ($config['iban'] ?? '');
if ($iban !== '' && !Iban::isValid($iban)) {
$errors['iban'] = 'Die IBAN ist ungültig.';
}
$creditorId = (string) ($config[self::OPTION_CREDITOR_ID] ?? '');
if ($creditorId !== '' && !CreditorId::isValid($creditorId)) {
$errors[self::OPTION_CREDITOR_ID] = 'Die Gläubiger-ID ist ungültig.';
}
$days = $config[self::OPTION_PRE_NOTIFICATION_DAYS] ?? '';
if ($days !== '' && $days !== null) {
$valid = filter_var($days, FILTER_VALIDATE_INT, ['options' => [
'min_range' => self::MIN_PRE_NOTIFICATION_DAYS,
'max_range' => self::MAX_PRE_NOTIFICATION_DAYS,
]]);
if ($valid === false) {
$errors[self::OPTION_PRE_NOTIFICATION_DAYS] = sprintf(
'Der Vorlauf muss eine ganze Zahl von %d bis %d Tagen sein.',
self::MIN_PRE_NOTIFICATION_DAYS,
self::MAX_PRE_NOTIFICATION_DAYS,
);
}
}
return $errors;
}
protected function invoiceClosingStatement(CreateInvoiceRequest $request): string
{
return sprintf('Der Betrag von %s wird per SEPA-Lastschrift eingezogen.', $request->amount->toString());
}
}
+34
View File
@@ -5,6 +5,7 @@ namespace App\Models;
use App\Casts\AmountCast;
use App\Enumerations\EatingHabit;
use App\Enumerations\ParticipantGroupType;
use App\Enumerations\ParticipationFeeType;
use App\RelationModels\EventParticipationFee;
use App\RelationModels\EventPaymentMethods;
@@ -13,6 +14,7 @@ use DateTime;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;
/**
* @property string $tenant
@@ -49,7 +51,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
* @property boolean $archived
* @property boolean $short_registration
* @property boolean $swimming_permission_required
* @property boolean $coc_check_required
* @property string|null $invoice_key
* @property string $participant_group_type
*/
class Event extends InstancedModel
{
@@ -99,8 +103,10 @@ class Event extends InstancedModel
'short_registration',
'swimming_permission_required',
'coc_check_required',
'invoice_key',
'participant_group_type',
];
protected $casts = [
@@ -133,6 +139,7 @@ class Event extends InstancedModel
'short_registration' => 'boolean',
'swimming_permission_required' => 'boolean',
'coc_check_required' => 'boolean',
];
/**
@@ -186,6 +193,33 @@ class Event extends InstancedModel
return $this->belongsToMany(Tenant::class, 'event_local_groups', 'event_id', 'local_group_id');
}
public function participantGroupType() : ParticipantGroupType {
return ParticipantGroupType::fromStored($this->participant_group_type);
}
public function asksForParentGroup() : bool {
return $this->participantGroupType() === ParticipantGroupType::ParentGroup;
}
/**
* Was bei der Anmeldung zur Auswahl steht: die teilnehmenden Local Groups oder -- fragt die Veranstaltung nach der
* Parent Group -- deren Parent Groups, jede nur einmal (alphabetisch, „Ohne Zuordnung" zuletzt).
* Einzige Quelle für Anzeige und Prüfung der Auswahl.
*
* @return Collection<int, Tenant>|Collection<int, ParentGroup>
*/
public function participantGroupOptions() : Collection {
$localGroups = $this->localGroups()->with('parentGroup')->get();
if (!$this->asksForParentGroup()) {
return $localGroups;
}
return ParentGroup::sortForDisplay(
$localGroups->pluck('parentGroup')->filter()->unique('id')
);
}
public function eatingHabits() : BelongsToMany{
return $this->belongsToMany(EatingHabit::class, 'event_allowed_eating_habits', 'event_id', 'eating_habit_id');
}
+17
View File
@@ -38,6 +38,7 @@ class EventParticipant extends InstancedModel
'fee_type',
'sibling_reduction',
'local_group',
'parent_group_id',
'birthday',
'address_1',
@@ -143,6 +144,22 @@ class EventParticipant extends InstancedModel
return $this->belongsTo(Tenant::class, 'local_group', 'slug');
}
/** Parent Group -- nur bei Veranstaltungen gesetzt, die danach statt nach der Local Group fragen. */
public function parentGroup()
{
return $this->belongsTo(ParentGroup::class, 'parent_group_id');
}
/** Anzeigename der bei der Anmeldung gewählten Gruppe, je nachdem, wonach die Veranstaltung fragt. */
public function participantGroupName(Event $event) : string
{
if ($event->asksForParentGroup()) {
return $this->parentGroup?->name ?? 'Keine Angabe';
}
return $this->localGroup?->name ?? 'Nicht im LV';
}
public function participationType()
{
return $this->belongsTo(ParticipationType::class, 'participation_type', 'slug');
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use App\Scopes\CommonModel;
/**
* App-weite Einstellung als Schlüssel/Wert-Paar (z. B. die Bezeichnungen „Stamm"/„Bund").
* Nicht mandantengebunden; gelesen wird über {@see \App\Repositories\GlobalSettingRepository}.
*
* @property string $key
* @property string $value
*/
class GlobalSetting extends CommonModel
{
public const string LOCAL_GROUP_LABEL = 'local_group_label';
public const string LOCAL_GROUP_LABEL_PLURAL = 'local_group_label_plural';
public const string PARENT_GROUP_LABEL = 'parent_group_label';
public const string PARENT_GROUP_LABEL_PLURAL = 'parent_group_label_plural';
protected $table = 'global_settings';
protected $primaryKey = 'key';
protected $keyType = 'string';
public $incrementing = false;
protected $fillable = [
'key',
'value',
];
}
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace App\Models;
use App\Scopes\CommonModel;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;
/**
* Übergeordnete Gruppe (Parent Group, im UI z. B. „Bund"). Mehrere Mandanten (Local Groups) gehören zur selben
* Parent Group. Nicht mandantengebunden -- die Liste gilt app-weit.
*
* @property int $id
* @property string $name
* @property boolean $is_fallback
*/
class ParentGroup extends CommonModel
{
protected $table = 'parent_groups';
protected $fillable = [
'name',
'is_fallback',
];
protected $casts = [
'is_fallback' => 'boolean',
];
/** Die Gruppe „Ohne Zuordnung" -- Vorgabe für Mandanten, denen keine Gruppe zugewiesen wurde. */
public static function fallback() : self {
return self::where('is_fallback', true)->orderBy('id')->firstOrFail();
}
/** Anzeigereihenfolge: alphabetisch, „Ohne Zuordnung" (Fallback) immer zuletzt. */
public function scopeOrdered(Builder $query) : Builder {
return $query->orderBy('is_fallback')->orderBy('name');
}
/**
* Dieselbe Reihenfolge wie {@see scopeOrdered()} für bereits geladene Gruppen.
*
* @param Collection<int, self> $parentGroups
* @return Collection<int, self>
*/
public static function sortForDisplay(Collection $parentGroups) : Collection {
return $parentGroups
->sort(static fn (self $a, self $b): int =>
[$a->is_fallback, mb_strtolower($a->name)] <=> [$b->is_fallback, mb_strtolower($b->name)])
->values();
}
public function tenants() : HasMany {
return $this->hasMany(Tenant::class, 'parent_group_id');
}
public function eventParticipants() : HasMany {
return $this->hasMany(EventParticipant::class, 'parent_group_id');
}
}
+13 -1
View File
@@ -23,6 +23,7 @@ class PaymentMethod extends CommonModel
public const string PAYMENT_ACCOUNT_TRANSACTION = 'PAYMENT_ACCOUNT_TRANSACTION';
public const string PAYMENT_NOT_DEFINED = 'PAYMENT_NOT_DEFINED';
public const string PAYMENT_SEPA_DIRECT_DEBIT = 'PAYMENT_SEPA_DIRECT_DEBIT';
protected $fillable = [
'slug',
@@ -105,7 +106,7 @@ class PaymentMethod extends CommonModel
}
/**
* Prüft, ob alle Pflicht-Optionen eines Slugs in der Konfiguration befüllt (non-empty) sind.
* Prüft, ob alle Pflicht-Optionen eines Slugs befüllt (non-empty) und alle Werte gültig sind.
* Unbekannte Slugs (kein Modul) gelten als vollständig -- kein Modul, keine Pflichtfelder.
*
* @param array<string, mixed> $config
@@ -114,4 +115,15 @@ class PaymentMethod extends CommonModel
{
return EventPaymentModuleRegistry::forSlug($slug)?->isConfigurationComplete($config) ?? true;
}
/**
* Ungültige Werte einer Konfiguration (Optionsname => Meldung), etwa eine falsche Prüfziffer.
*
* @param array<string, mixed> $config
* @return array<string, string>
*/
public static function configurationErrors(string $slug, array $config): array
{
return EventPaymentModuleRegistry::forSlug($slug)?->configurationErrors($config) ?? [];
}
}
+9
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Scopes\CommonModel;
use App\Support\Text;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property string $slug
@@ -35,6 +36,7 @@ use App\Support\Text;
* @property string|null $tax_exemption_reason
* @property string|null $tax_exemption_note
* @property string $vat_pricing_mode
* @property int $parent_group_id
*/
class Tenant extends CommonModel
{
@@ -46,9 +48,15 @@ class Tenant extends CommonModel
{
static::creating(static function (self $tenant): void {
$tenant->invoice_prefix ??= strtoupper((string) $tenant->slug);
// Die Parent Group ist Pflicht; ohne Angabe landet der Mandant bei „Ohne Zuordnung".
$tenant->parent_group_id ??= ParentGroup::fallback()->id;
});
}
public function parentGroup() : BelongsTo {
return $this->belongsTo(ParentGroup::class, 'parent_group_id');
}
public static function getTempDirectory() : string {
return currentTenant()->slug . '/temp-data/';
}
@@ -95,6 +103,7 @@ class Tenant extends CommonModel
'tax_number',
'vat_id',
'invoice_prefix',
'parent_group_id',
];
protected $casts = [
+3 -1
View File
@@ -2,6 +2,7 @@
namespace App\Providers;
use App\Repositories\GlobalSettingRepository;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\ServiceProvider;
@@ -12,7 +13,8 @@ class AppServiceProvider extends ServiceProvider
*/
public function register(): void
{
//
// Eine Instanz je Request, damit die Einstellungen nur einmal gelesen werden.
$this->app->scoped(GlobalSettingRepository::class);
}
/**
+5
View File
@@ -4,6 +4,7 @@ namespace App\Providers;
use App\Enumerations\EatingHabit;
use App\Enumerations\InvoiceType;
use App\Enumerations\ParticipantGroupType;
use App\Enumerations\RefundReason;
use App\Enumerations\RetentionReason;
use App\Enumerations\TravelReason;
@@ -45,6 +46,8 @@ class GlobalDataProvider {
'currentEvent' => $this->getCurrentEventData(),
'canAccessAdmin' => $canAccessAdmin,
'isMainAdmin' => $isMainAdmin,
// Bezeichnungen der Gruppen-Ebenen (z. B. Stamm/Stämme, Bund/Bünde) aus den globalen Einstellungen.
'groupLabels' => ParticipantGroupType::labels(),
]);
}
@@ -222,6 +225,8 @@ class GlobalDataProvider {
[
'localGroups' => Tenant::where(['is_active_local_group' => true])->get(),
'eatingHabits' => EatingHabit::all(),
'participantGroupTypes' => ParticipantGroupType::options(),
'localGroupLabelPlural' => ParticipantGroupType::LocalGroup->pluralLabel(),
'paymentMethods' => AvailablePaymentMethod::where('active', true)->get()
->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)),
]);
+23 -7
View File
@@ -172,9 +172,13 @@ class CostUnitRepository {
* damit immer dieselbe Gliederung, und eine fehlende Zeile lässt sich nicht mit einer vergessenen
* verwechseln.
*
* Gespendete Auslagen zählen hier mit: Für die Einnahmen-Überschuss-Rechnung ist die Spende eine Ausgabe
* ihres Typs und zugleich eine Einnahme. Mit `$donationsOnly` liefert die Methode genau diesen Spendenanteil
* in derselben Gliederung -- die Gegenbuchungen lassen sich so ihrer Ausgabenkategorie zuordnen.
*
* @return array<string, array{type: InvoiceType, invoices: array<int, Invoice>, sum: Amount}>
*/
public function groupExpensesByType(CostUnit $costUnit) : array {
public function groupExpensesByType(CostUnit $costUnit, bool $donationsOnly = false) : array {
$groups = [];
foreach (InvoiceType::countingAsExpense() as $invoiceType) {
@@ -186,7 +190,11 @@ class CostUnitRepository {
}
foreach ($costUnit->invoices()->orderBy('invoice_number')->get() as $invoice) {
if (!self::countsAsExpense($invoice) || !isset($groups[$invoice->type])) {
if (
!self::isBooked($invoice) ||
!isset($groups[$invoice->type]) ||
($donationsOnly && !$invoice->donation)
) {
continue;
}
@@ -201,14 +209,22 @@ class CostUnitRepository {
* Ob ein Beleg als Ausgabe zählt.
*
* Abgelehnt und gelöscht sind keine Ausgabe, weil kein Geld fließt. Dasselbe gilt für eine gespendete
* Auslage: Auf die Auszahlung wurde verzichtet, die Kostenstelle gibt nichts aus.
* Auslage: Auf die Auszahlung wurde verzichtet, die Kostenstelle gibt nichts aus. Die Einnahmen-Überschuss-
* Rechnung sieht das anders und bucht die Spende als Ausgabe und Einnahme, siehe
* {@see self::groupExpensesByType()}.
*/
private static function countsAsExpense(Invoice $invoice) : bool {
return self::isBooked($invoice) && !$invoice->donation;
}
/**
* Ob ein Beleg überhaupt gebucht ist -- abgelehnt und gelöscht sind es nicht.
*/
private static function isBooked(Invoice $invoice) : bool {
return !in_array($invoice->status, [
InvoiceStatus::INVOICE_STATUS_DENIED,
InvoiceStatus::INVOICE_STATUS_DELETED,
], true)
&& !$invoice->donation;
InvoiceStatus::INVOICE_STATUS_DENIED,
InvoiceStatus::INVOICE_STATUS_DELETED,
], true);
}
public function sumupEstimatedByInvoiceType(CostUnit $costUnit, InvoiceType $invoiceType) : Amount {
@@ -73,12 +73,18 @@ class EventParticipantRepository {
->first();
}
public function groupByLocalGroup(Event $event, Request $request, ?string $filter = null) : array {
/** Ob es zur Veranstaltung schon Anmeldungen gibt -- abgemeldete eingeschlossen. */
public function existsForEvent(Event $event) : bool {
return EventParticipant::where('event_id', $event->id)->exists();
}
/** Gruppiert nach der bei der Anmeldung gewählten Gruppe (Local oder Parent Group, je nach Veranstaltung). */
public function groupByParticipantGroup(Event $event, Request $request, ?string $filter = null) : array {
$allParticipants = $this->getForList($event, $request);
$participants = [];
foreach ($allParticipants as $participant) {
if ($filter === null || $participant['localgroup'] === $filter) {
$participants[$participant['localgroup']][] = $participant;
if ($filter === null || $participant['participantGroup'] === $filter) {
$participants[$participant['participantGroup']][] = $participant;
}
}
@@ -0,0 +1,35 @@
<?php
namespace App\Repositories;
use App\Models\GlobalSetting;
/**
* Zugriff auf die app-weiten Einstellungen. Im Container als `scoped` registriert -- über
* `app(GlobalSettingRepository::class)` beziehen, dann werden die Werte nur einmal pro Request gelesen
* (die Bezeichnungen werden je Teili-Zeile einer Liste gebraucht).
*/
class GlobalSettingRepository {
/** @var array<string, string>|null */
private ?array $values = null;
public function get(string $key, string $default) : string {
$value = $this->all()[$key] ?? null;
return ($value === null || trim($value) === '') ? $default : $value;
}
/** @param array<string, string> $values */
public function setMany(array $values) : void {
foreach ($values as $key => $value) {
GlobalSetting::updateOrCreate(['key' => $key], ['value' => $value]);
}
$this->values = null;
}
/** @return array<string, string> */
private function all() : array {
return $this->values ??= GlobalSetting::pluck('value', 'key')->all();
}
}
@@ -5,6 +5,8 @@ declare(strict_types=1);
namespace App\Repositories;
use App\Models\AvailablePaymentMethod;
use App\Models\Event;
use App\Models\PaymentMethod;
/**
* Zugriff auf die Zahlungsmethoden-Instanzen des Mandanten.
@@ -24,4 +26,22 @@ class PaymentMethodRepository
{
return (array) (AvailablePaymentMethod::where('slug', $slug)->first()?->configuration ?? []);
}
/**
* Darf bei dieser Veranstaltung mit dieser Zahlungsart angemeldet werden?
*
* Nur wenn sie der Veranstaltung zugewiesen ist, beim Mandanten aktiv ist und ihre Config am Event
* vollständig und gültig ist. Sonst ließe sich über einen manipulierten Request eine Zahlungsart
* wählen, für die die Angaben zur Zahlung fehlen -- bei der Lastschrift etwa die Gläubiger-ID.
*/
public function isUsableForSignUp(Event $event, string $slug): bool
{
$method = $event->paymentMethods()->where('available_payment_methods.slug', $slug)->first();
if ($method === null || !$method->active) {
return false;
}
return PaymentMethod::isConfigurationComplete($slug, (array) ($method->pivot->configuration ?? []));
}
}
+6 -1
View File
@@ -51,7 +51,12 @@ class EventParticipantResource extends JsonResource
'unregisteredAt' => $this->resource->unregistered_at?->format('d.m.Y'),
'fullname' => $this->resource->getFullName(),
'age' => new Age($this->resource->birthday)->getAge(),
'localgroup' => $this->resource->localGroup()?->first()?->name ?? 'Nicht im LV',
// Die bei der Anmeldung gewählte Gruppe: Local Group oder Parent Group, je nach Veranstaltung.
'participantGroup' => $this->resource->participantGroupName($event),
// Wert für die Auswahl in der Verwaltung: Slug der Local Group bzw. ID der Parent Group.
'participantGroupValue' => $event->asksForParentGroup()
? ($this->resource->parent_group_id !== null ? (string) $this->resource->parent_group_id : '')
: ($this->resource->local_group ?? ''),
// Die Zuordnungen sind nullable: die Kurzanmeldung erhebt nicht alles, und in der Verwaltung
// lassen sich Werte leeren. Ohne Fallback fielen Teilnehmerliste und Detailansicht komplett aus.
'swimmingPermission' => $this->resource->swimmingPermission()->first()?->short ?? 'Unbekannt',
+15
View File
@@ -6,6 +6,7 @@ use App\Enumerations\ParticipationFeeType;
use App\Enumerations\ParticipationType;
use App\Enumerations\VatPricingMode;
use App\Models\Event;
use App\Models\ParentGroup;
use App\Support\DateRange;
use App\ValueObjects\Amount;
use DateTime;
@@ -84,6 +85,7 @@ class EventResource extends JsonResource{
// Steuert im Frontend, welcher Anmelde-Wizard gerendert wird, und ob die Badeerlaubnis abgefragt wird.
$returnArray['shortRegistration'] = (bool)$this->event->short_registration;
$returnArray['swimmingPermissionRequired'] = (bool)$this->event->swimming_permission_required;
$returnArray['cocCheckRequired'] = (bool)$this->event->coc_check_required;
$returnArray['siblingReduction'] = $this->event->sibling_reduction ?? true;
$returnArray['costUnit'] = new CostUnitResource($this->event->costUnit()->first())->toArray(true);
@@ -149,6 +151,19 @@ class EventResource extends JsonResource{
$returnArray['contributingLocalGroups'] = $this->event->localGroups
->map(fn ($localGroup) => new LocalGroupResource($localGroup)->toArray($request))
->toArray();
// Wonach bei der Anmeldung gefragt wird (Local oder Parent Group), mit Bezeichnung und Auswahl.
// `id` wird bei der Anmeldung übermittelt, `value` ist der in der Verwaltung gepflegte Wert
// (Slug der Local Group bzw. ID der Parent Group).
$returnArray['participantGroupType'] = $this->event->participantGroupType()->value;
$returnArray['participantGroupLabel'] = $this->event->participantGroupType()->label();
$returnArray['participantGroupOptions'] = $this->event->participantGroupOptions()
->map(fn ($group) => [
'id' => $group->id,
'name' => $group->name,
'value' => $group instanceof ParentGroup ? (string) $group->id : $group->slug,
])
->values()
->toArray();
$returnArray['eatingHabits'] = $this->event->eatingHabits()->get()->map(
fn($eatingHabit) => new EatingHabitResource($eatingHabit))->toArray();
+6
View File
@@ -2,6 +2,7 @@
namespace App\Scopes;
use App\Domains\Admin\Repositories\AdminParentGroupRepository;
use App\Domains\Admin\Repositories\AdminTenantRepository;
use App\Domains\Admin\Repositories\AdminUserRepository;
use App\Models\Tenant;
@@ -10,6 +11,7 @@ use App\Repositories\CostUnitRepository;
use App\Repositories\EstimatesRepository;
use App\Repositories\EventParticipantRepository;
use App\Repositories\EventRepository;
use App\Repositories\GlobalSettingRepository;
use App\Repositories\InvoiceRepository;
use App\Repositories\PageTextRepository;
use App\Repositories\ParticipantRefundRepository;
@@ -31,6 +33,8 @@ abstract class CommonController {
protected PaymentMethodRepository $paymentMethods;
protected AdminUserRepository $adminUsers;
protected AdminTenantRepository $adminTenants;
protected AdminParentGroupRepository $adminParentGroups;
protected GlobalSettingRepository $globalSettings;
public function __construct() {
$this->tenant = currentTenant();
@@ -45,6 +49,8 @@ abstract class CommonController {
$this->paymentMethods = new PaymentMethodRepository();
$this->adminUsers = new AdminUserRepository();
$this->adminTenants = new AdminTenantRepository();
$this->adminParentGroups = new AdminParentGroupRepository();
$this->globalSettings = app(GlobalSettingRepository::class);
}
protected function checkAuth() {
+66
View File
@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace App\Support;
/**
* Zustandslose Helfer für die SEPA-Gläubiger-Identifikationsnummer (Creditor Identifier).
*
* Aufbau nach EPC262-08: Ländercode, zwei Prüfziffern, drei Zeichen Geschäftsbereichskennung, dann die
* nationale Kennung. In Deutschland vergibt die Bundesbank sie mit 18 Zeichen (`DE98ZZZ09999999999`).
*
* Die Prüfziffer ist der Teil, auf den es ankommt: Eine Lastschriftdatei mit falscher Gläubiger-ID lehnt
* die Bank als Ganzes ab -- und zwar erst beim Hochladen, wenn die Vorabankündigungen schon verschickt
* sind.
*/
final class CreditorId
{
/** Länge der Gläubiger-ID je Ländercode, soweit sie national festgelegt ist. */
private const array LENGTHS = [
'DE' => 18,
];
/** Leerzeichen raus, Großbuchstaben -- die kanonische Form, die gespeichert wird. */
public static function normalize(string $creditorId): string
{
return strtoupper(preg_replace('/\s+/', '', $creditorId) ?? '');
}
public static function isValid(string $creditorId): bool
{
$creditorId = self::normalize($creditorId);
if (preg_match('/^[A-Z]{2}[0-9]{2}[A-Z0-9]{3}[A-Z0-9]{1,28}$/', $creditorId) !== 1) {
return false;
}
$expected = self::LENGTHS[substr($creditorId, 0, 2)] ?? null;
if ($expected !== null && strlen($creditorId) !== $expected) {
return false;
}
return self::checksum($creditorId) === 1;
}
/**
* Mod 97-10 wie bei der IBAN, aber ohne die Geschäftsbereichskennung (Stellen 5 bis 7): Sie darf
* der Gläubiger frei wählen, ohne dass sich die Prüfziffer ändert. Geprüft wird deshalb die nationale
* Kennung, gefolgt von Ländercode und Prüfziffern; Buchstaben zählen als Position + 9 (A = 10 … Z = 35).
*/
private static function checksum(string $creditorId): int
{
$rearranged = substr($creditorId, 7) . substr($creditorId, 0, 4);
$remainder = 0;
foreach (str_split($rearranged) as $char) {
$value = ctype_digit($char) ? $char : (string) (ord($char) - 55);
foreach (str_split($value) as $digit) {
$remainder = ($remainder * 10 + (int) $digit) % 97;
}
}
return $remainder;
}
}
@@ -0,0 +1,102 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Übergeordnete Gruppen (Parent Groups, im UI z. B. „Bund"): jeder Mandant (Local Group) gehört zu genau einer.
* Eine Veranstaltung fragt bei der Anmeldung entweder nach der Local Group oder nach der Parent Group.
*
* Die Vorbelegung steht hier und nicht im Seeder: der Fremdschlüssel am Tenant ist Pflicht, bestehende
* Installationen brauchen die Fallback-Gruppe also schon beim Migrieren.
*
* Dazu die globalen Einstellungen mit den Bezeichnungen der beiden Ebenen -- aus demselben Grund vorbelegt.
*/
public function up(): void
{
Schema::create('parent_groups', function (Blueprint $table) {
$table->id();
$table->string('name');
// Die Gruppe für Mandanten ohne Zuordnung; sie ist umbenennbar, aber nie löschbar.
$table->boolean('is_fallback')->default(false);
$table->timestamps();
});
$now = now();
$fallbackId = DB::table('parent_groups')->insertGetId([
'name' => 'Ohne Zuordnung',
'is_fallback' => true,
'created_at' => $now,
'updated_at' => $now,
]);
foreach (['BdP', 'DPV', 'DPSG', 'VCP'] as $name) {
DB::table('parent_groups')->insert([
'name' => $name,
'is_fallback' => false,
'created_at' => $now,
'updated_at' => $now,
]);
}
Schema::table('tenants', function (Blueprint $table) {
$table->foreignId('parent_group_id')->nullable()->constrained('parent_groups')->restrictOnDelete();
});
DB::table('tenants')->update(['parent_group_id' => $fallbackId]);
Schema::table('tenants', function (Blueprint $table) {
$table->foreignId('parent_group_id')->nullable(false)->change();
});
Schema::table('events', function (Blueprint $table) {
$table->string('participant_group_type')->default('local_group');
});
Schema::table('event_participants', function (Blueprint $table) {
$table->foreignId('parent_group_id')->nullable()->constrained('parent_groups')->restrictOnDelete();
});
Schema::create('global_settings', function (Blueprint $table) {
$table->string('key')->primary();
$table->text('value');
$table->timestamps();
});
foreach ([
'local_group_label' => 'Stamm',
'local_group_label_plural' => 'Stämme',
'parent_group_label' => 'Bund',
'parent_group_label_plural' => 'Bünde',
] as $key => $value) {
DB::table('global_settings')->insert([
'key' => $key,
'value' => $value,
'created_at' => $now,
'updated_at' => $now,
]);
}
}
public function down(): void
{
Schema::dropIfExists('global_settings');
Schema::table('event_participants', function (Blueprint $table) {
$table->dropConstrainedForeignId('parent_group_id');
});
Schema::table('events', function (Blueprint $table) {
$table->dropColumn('participant_group_type');
});
Schema::table('tenants', function (Blueprint $table) {
$table->dropConstrainedForeignId('parent_group_id');
});
Schema::dropIfExists('parent_groups');
}
};
@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('events', function (Blueprint $table) {
// Ob bei Anmeldungen das erweiterte Führungszeugnis geprüft wird. Ist die Prüfung aus, erhalten neue
// Anmeldungen immer „Nicht erforderlich". Default true, damit bestehende Veranstaltungen sich
// unverändert verhalten.
$table->boolean('coc_check_required')->default(true);
});
}
public function down(): void
{
Schema::table('events', function (Blueprint $table) {
$table->dropColumn('coc_check_required');
});
}
};
@@ -0,0 +1,73 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
/**
* Zahlungsart SEPA-Lastschrift für bestehende Installationen.
*
* Eine Neuinstallation legt `payment_methods` über den ProductionDataSeeder an (er iteriert die
* Modul-Registry) und neue Stämme ihre Instanzen über CreateTenantAction. Beides läuft auf einer
* bestehenden Datenbank nicht noch einmal -- ohne diese Migration gäbe es die Zahlungsart dort nicht.
*
* Gibt es noch keinen Stamm, ist es eine frische Installation: Dann bleibt alles dem Seeder überlassen,
* der sonst an der bereits vorhandenen Zeile scheitern würde.
*
* Jeder Stamm bekommt die Zahlungsart **inaktiv**, vorbefüllt mit seinen Bankdaten. Aktiv wird sie erst,
* wenn eine gültige Gläubiger-ID gepflegt ist (Guard in UpdateAvailablePaymentMethodAction).
*/
return new class extends Migration {
private const string SLUG = 'PAYMENT_SEPA_DIRECT_DEBIT';
public function up(): void
{
$tenants = DB::table('tenants')->get(['slug', 'account_name', 'account_iban', 'account_bic']);
if ($tenants->isEmpty()) {
return;
}
if (!DB::table('payment_methods')->where('slug', self::SLUG)->exists()) {
DB::table('payment_methods')->insert([
'id' => (string) Str::uuid(),
'slug' => self::SLUG,
'created_at' => now(),
'updated_at' => now(),
]);
}
foreach ($tenants as $tenant) {
$exists = DB::table('available_payment_methods')
->where('tenant', $tenant->slug)
->where('slug', self::SLUG)
->exists();
if ($exists) {
continue;
}
DB::table('available_payment_methods')->insert([
'tenant' => $tenant->slug,
'slug' => self::SLUG,
'name' => 'SEPA-Lastschrift',
'description' => 'Der Beitrag wird auf Grundlage eines SEPA-Lastschriftmandats vom angegebenen Konto eingezogen.',
'active' => false,
'configuration' => json_encode([
'account_owner' => (string) $tenant->account_name,
'iban' => (string) $tenant->account_iban,
'bic' => (string) $tenant->account_bic,
'pre_notification_days' => 5,
'icon' => 'file-signature',
]),
'created_at' => now(),
'updated_at' => now(),
]);
}
}
public function down(): void
{
DB::table('available_payment_methods')->where('slug', self::SLUG)->delete();
DB::table('payment_methods')->where('slug', self::SLUG)->delete();
}
};
+34
View File
@@ -13,6 +13,13 @@
set -euo pipefail
MAREIKE_BASE="${MAREIKE_BASE:-/opt/mareike}"
# Server-spezifische Einstellungen, z. B. MAREIKE_DB_SOCKET_DIR=/var/lib/mysql
if [[ -f "$MAREIKE_BASE/shared/deploy.conf" ]]; then
# shellcheck source=/dev/null
source "$MAREIKE_BASE/shared/deploy.conf"
fi
MAREIKE_USER="${MAREIKE_USER:-mareike-docker}"
SRC="$MAREIKE_BASE/src"
@@ -48,6 +55,28 @@ if [[ ! -f "$MAREIKE_ENV_FILE" ]]; then
exit 1
fi
# Der Container läuft als $MAREIKE_USER und muss die eingebundene .env lesen können.
# Ist sie unlesbar, ignoriert Laravel sie still und fällt z. B. auf SQLite zurück.
chown "root:$MAREIKE_GID" "$MAREIKE_ENV_FILE"
chmod 0640 "$MAREIKE_ENV_FILE"
# Der Container erreicht die KeyHelp-MariaDB nur über den Socket im eingebundenen Verzeichnis /run/mysqld.
DB_SOCKET="$( (grep -E '^DB_SOCKET=' "$MAREIKE_ENV_FILE" || true) | tail -n 1 | cut -d= -f2- | tr -d "\"' \r")"
if [[ -z "$DB_SOCKET" ]]; then
echo "DB_SOCKET fehlt in $MAREIKE_ENV_FILE (erwartet: DB_SOCKET=/run/mysqld/mysqld.sock)." >&2
exit 1
fi
if [[ "$(dirname "$DB_SOCKET")" != "/run/mysqld" ]]; then
echo "DB_SOCKET muss in /run/mysqld/ liegen (Mount-Punkt im Container), ist aber: $DB_SOCKET" >&2
exit 1
fi
if [[ ! -S "$MAREIKE_DB_SOCKET_DIR/$(basename "$DB_SOCKET")" ]]; then
echo "Kein MariaDB-Socket unter $MAREIKE_DB_SOCKET_DIR/$(basename "$DB_SOCKET")." >&2
echo "Pfad prüfen mit: mysql -NBe 'SELECT @@socket;'" >&2
echo "Liegt er woanders, MAREIKE_DB_SOCKET_DIR in $MAREIKE_BASE/shared/deploy.conf setzen." >&2
exit 1
fi
echo "==> Quellcode auf '$REF' bringen"
git -C "$SRC" fetch --tags --prune --force origin
if git -C "$SRC" show-ref --verify --quiet "refs/remotes/origin/$REF"; then
@@ -70,6 +99,11 @@ done
echo "==> Images bauen"
compose build --pull
if ! compose run --rm --no-deps app php -r 'exit(is_readable(".env") ? 0 : 1);'; then
echo ".env ist im Container nicht lesbar – Besitzer/Rechte von $MAREIKE_ENV_FILE prüfen." >&2
exit 1
fi
echo "==> Datenbank migrieren"
compose run --rm --no-deps app php artisan migrate --force
+2 -2
View File
@@ -7,8 +7,8 @@ APP_ENV=production
APP_DEBUG=false
# Erzeugen mit: echo "base64:$(openssl rand -base64 32)" – danach NIE mehr ändern (verschlüsselte Daten!)
APP_KEY=
# Domain des Dach-Tenants "lv"
APP_URL=https://<lv-subdomain>.meine-anmeldung.digital
# Die Hauptdomain ist der Dach-Tenant "lv"; Gruppen laufen als <gruppe>.meine-anmeldung.digital
APP_URL=https://meine-anmeldung.digital
# Kein ASSET_URL: Assets kommen von der jeweiligen Tenant-Domain selbst.
APP_LOCALE=de
+4
View File
@@ -17,6 +17,10 @@ server {
index index.php;
server_tokens off;
# nginx sieht hinter dem Proxy nur http. Eigene Redirects (z. B. /tinymce → /tinymce/) daher relativ halten,
# sonst landet der Browser auf http://.
absolute_redirect off;
client_max_body_size 70m;
location / {
+75 -22
View File
@@ -51,7 +51,8 @@ Browser ──HTTPS──▶ KeyHelp-Webserver (Apache/nginx, Let's Encrypt, ein
/opt/mareike/
├── bin/deploy.sh Kopie von docker/endeavour/deploy.sh
├── src/ Git-Checkout (wird bei jedem Deploy aktualisiert)
├── shared/.env Konfiguration mit Zugangsdaten (nur root lesbar)
├── shared/.env Konfiguration mit Zugangsdaten (root, Gruppe mareike-docker lesbar, 0640)
├── shared/deploy.conf optional: Server-Einstellungen für deploy.sh (z. B. MAREIKE_DB_SOCKET_DIR)
└── storage/ Laravel-storage/ (Logs, Sessions, erzeugte PDFs/ZIPs) – persistent
```
@@ -152,8 +153,18 @@ install -m 0750 /opt/mareike/src/docker/endeavour/deploy.sh /opt/mareike/bin/dep
mysql -e "SELECT @@socket;" # erwartet: /run/mysqld/mysqld.sock
```
Liegt der Socket woanders, in `/opt/mareike/bin/deploy.sh` die Variable `MAREIKE_DB_SOCKET_DIR` auf das Verzeichnis
setzen und `DB_SOCKET` in der `.env` anpassen.
Liegt der Socket woanders, z. B. unter `/var/lib/mysql/mysql.sock`, das **Verzeichnis** in
`/opt/mareike/shared/deploy.conf` eintragen:
```bash
echo 'MAREIKE_DB_SOCKET_DIR=/var/lib/mysql' > /opt/mareike/shared/deploy.conf
```
In der `.env` bleibt das Verzeichnis `/run/mysqld`, denn so heißt der Mount-Punkt im Container. Nur der Dateiname
wird übernommen, im Beispiel also `DB_SOCKET=/run/mysqld/mysql.sock`.
`deploy.sh` prüft vor jedem Build, ob `DB_SOCKET` gesetzt ist und der Socket auf dem Host existiert. Wenn nicht,
bricht es mit einem Hinweis ab.
Weil die Datenbank von KeyHelp verwaltet wird, ist sie automatisch im **KeyHelp-Backup** enthalten.
@@ -162,7 +173,7 @@ Weil die Datenbank von KeyHelp verwaltet wird, ist sie automatisch im **KeyHelp-
## 5. `.env` anlegen
```bash
install -m 0600 /opt/mareike/src/docker/endeavour/env.production.example /opt/mareike/shared/.env
install -m 0640 -o root -g mareike-docker /opt/mareike/src/docker/endeavour/env.production.example /opt/mareike/shared/.env
echo "base64:$(openssl rand -base64 32)" # Ergebnis als APP_KEY eintragen
nano /opt/mareike/shared/.env
```
@@ -225,7 +236,7 @@ angelegt wird.
App\Models\Tenant::create([
'slug' => 'lv',
'name' => '<Name des Verbands>',
'url' => '<lv-subdomain>.meine-anmeldung.digital',
'url' => 'meine-anmeldung.digital',
'email' => '<kontakt@…>',
'email_finance' => '<finanzen@…>',
'account_name' => '<Kontoinhaber>',
@@ -249,7 +260,7 @@ global und werden für jeden aktiven Tenant ausgeführt.
### 6.4 Erste Administratorin / ersten Administrator
1. Auf `https://<lv-subdomain>.meine-anmeldung.digital` ganz normal registrieren. Voraussetzung: Abschnitt 7 ist
1. Auf `https://meine-anmeldung.digital` ganz normal registrieren. Voraussetzung: Abschnitt 7 ist
erledigt und der Mailversand funktioniert.
2. Das Konto zur Administration hochstufen:
@@ -261,20 +272,36 @@ global und werden für jeden aktiven Tenant ausgeführt.
## 7. Tenant-Domain in KeyHelp einrichten (je Tenant)
Diesen Ablauf für den Dach-Tenant `lv` und später für jede weitere Gruppe wiederholen.
Domain-Schema:
### 7.1 Einmalig: Proxy-Module aktivieren (Apache)
- Dach-Tenant `lv`: die **Hauptdomain** `meine-anmeldung.digital`. Sie existiert in KeyHelp bereits samt
Let's-Encrypt-Zertifikat.
- Gruppen: `<gruppe>.meine-anmeldung.digital`, jede als eigene Domain in KeyHelp mit eigenem Zertifikat.
Den folgenden Ablauf für die Hauptdomain und später für jede Gruppe wiederholen.
> **Wichtig:** Nicht die KeyHelp-Funktion **„Weiterleitung“** benutzen. Sie schickt den *Browser* auf
> `http://127.0.0.1:8080`, und das kann nicht funktionieren. Gebraucht wird ein **Proxy**: KeyHelp holt die Seite
> intern vom Container ab und liefert sie selbst per HTTPS mit seinem Zertifikat aus. Das geschieht ausschließlich über
> die Webserver-Direktiven unten.
### 7.1 Einmalig: Module aktivieren (Apache)
```bash
a2enmod proxy proxy_http headers
a2enmod proxy proxy_http headers rewrite
systemctl reload apache2
```
### 7.2 Domain anlegen
### 7.2 Domain einrichten
1. KeyHelp → **Domains** → neue Domain für das mareike-Konto, z. B. `wilde-moehre.meine-anmeldung.digital`.
Den DNS-Eintrag (A/AAAA) auf endeavour setzen, falls KeyHelp den DNS nicht selbst verwaltet.
2. **SSL/TLS:** Let's Encrypt aktivieren und **HTTPS erzwingen** einschalten.
1. **Hauptdomain:** In KeyHelp die vorhandene Domain `meine-anmeldung.digital` öffnen. Eine eventuell eingerichtete
*Weiterleitung* entfernen.
**Gruppe:** KeyHelp → **Domains** → neue Domain für das mareike-Konto anlegen, z. B.
`wilde-moehre.meine-anmeldung.digital`. Den DNS-Eintrag (A/AAAA) auf endeavour setzen, falls KeyHelp den DNS nicht
selbst verwaltet.
2. **SSL/TLS:** Let's Encrypt aktiv und **HTTPS erzwingen** eingeschaltet. Bei der Hauptdomain muss
`www.meine-anmeldung.digital` im Zertifikat enthalten sein, sonst gibt es beim www-Redirect eine
Zertifikatswarnung.
3. PHP wird für diese Domain nicht gebraucht.
4. In den Domain-Einstellungen im Feld für **individuelle Webserver-Direktiven** (nur als Admin sichtbar, die
Bezeichnung variiert je nach KeyHelp-Version) Folgendes eintragen:
@@ -282,17 +309,34 @@ systemctl reload apache2
**Apache** (KeyHelp-Standard):
```apache
RewriteEngine On
# Let's Encrypt von KeyHelp nicht anfassen
RewriteRule ^/?\.well-known/acme-challenge/ - [L]
# www → ohne www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^/?(.*)$ https://%1/$1 [R=301,L,NE]
# alles ohne TLS auf https umleiten
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/$1 [R=301,L,NE]
# unter https an den Container durchreichen
RewriteRule ^/?(.*)$ http://127.0.0.1:8080/$1 [P,L,NE]
ProxyPreserveHost On
ProxyRequests Off
RequestHeader set X-Forwarded-Proto "https"
ProxyPass /.well-known/acme-challenge/ !
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
RequestHeader set X-Forwarded-Proto "https"
Header always set Strict-Transport-Security "max-age=31536000" "expr=%{HTTPS} == 'on'"
```
Die Regeln funktionieren unabhängig davon, ob KeyHelp die Direktiven in den Port-80- oder den Port-443-vHost
schreibt. Ohne TLS wird immer auf `https://` umgeleitet, nur unter HTTPS wird an den Container weitergereicht. Das
`http://127.0.0.1:8080` ist dabei die **interne** Verbindung zum Container, der Browser sieht sie nie.
**nginx** (falls KeyHelp auf nginx läuft):
```nginx
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
@@ -301,9 +345,6 @@ systemctl reload apache2
client_max_body_size 70m;
}
```
Die Ausnahme für `/.well-known/acme-challenge/` sorgt dafür, dass KeyHelp die Zertifikate weiter selbst verlängern
kann.
5. Speichern und die Domain aufrufen. Solange der Tenant noch nicht existiert, zeigt mareike **404 „Tenant not
found“**. Das ist ein gutes Zeichen, denn der Proxy funktioniert.
@@ -324,7 +365,7 @@ Tenants:
```bash
cat > /etc/cron.d/mareike <<'EOF'
* * * * * root curl -fsS -o /dev/null -H "Host: <lv-subdomain>.meine-anmeldung.digital" http://127.0.0.1:8080/execute-crons
* * * * * root curl -fsS -o /dev/null -H "Host: meine-anmeldung.digital" http://127.0.0.1:8080/execute-crons
EOF
```
@@ -378,14 +419,26 @@ Enthält ein Release Datenbankänderungen, deshalb vorher ein DB-Backup ziehen.
| Symptom | Ursache / Lösung |
|---|---|
| `Database file at path […database.sqlite] does not exist` | Die `.env` wird im Container nicht gelesen, Laravel fällt dann auf SQLite zurück. Rechte prüfen (0640, Gruppe `mareike-docker`) und ob `MAREIKE_ENV_FILE` auf die richtige Datei zeigt. |
| Browser landet auf `http://` | In KeyHelp ist eine *Weiterleitung* statt der Proxy-Direktiven eingerichtet, oder es sind noch die alten `ProxyPass`-Direktiven ohne HTTPS-Umleitung aktiv (Abschnitt 7.2). Woher die http-Umleitung kommt, zeigen die drei `curl`-Befehle darunter. |
| 404 „Tenant not found“ | Der Host passt nicht zu `tenants.url` (Tippfehler, `https://` oder `/` im Eintrag), der Tenant ist nicht `has_active_instance`, oder der Proxy reicht den Host nicht durch (`ProxyPreserveHost On` fehlt). |
| 502/503 vom KeyHelp-Webserver | Container laufen nicht (`deploy.sh compose ps`) oder die Firewall wurde neu geladen, dann hilft `systemctl restart docker`. |
| Seite lädt ohne CSS, Mixed Content | `ASSET_URL` ist gesetzt oder die nginx-Config im Container wurde nicht übernommen (`fastcgi_param HTTPS on`). |
| `SQLSTATE[HY000] [2002]` | Socket nicht erreichbar. `SELECT @@socket` prüfen, `MAREIKE_DB_SOCKET_DIR` bzw. `DB_SOCKET` anpassen, nach einem MariaDB-Neustart den Stack mit `deploy.sh compose restart app` neu starten. |
| `SQLSTATE[HY000] [2002] No such file or directory` | Im Container liegt kein Socket unter `DB_SOCKET`. Entweder fehlt `DB_SOCKET` in der `.env`, oder der Socket liegt auf dem Host nicht in `/run/mysqld`. Pfad mit `mysql -NBe "SELECT @@socket;"` prüfen und ggf. `MAREIKE_DB_SOCKET_DIR` in `shared/deploy.conf` setzen (Abschnitt 4). Nach einem MariaDB-Neustart hilft oft `deploy.sh compose restart app`. |
| `Permission denied` in storage/ | Besitzer von `/opt/mareike/storage` muss `mareike-docker` sein, der nächste `deploy.sh`-Lauf korrigiert das. |
| Upload bricht ab | Grenzen prüfen: `MAX_INVOICE_FILE_SIZE` in der `.env`, 64 MB in `php.ini`, 70 MB in `nginx.conf`. |
| Mails kommen nicht an | `MAIL_*` prüfen, Log in `storage/logs/`. Absenderadresse muss zum Postfach passen (SPF/DKIM der Domain in KeyHelp). |
Woher kommt eine Umleitung auf `http://`?
```bash
curl -sI http://meine-anmeldung.digital/ | grep -iE '^(HTTP|Location)' # erwartet: 301 → https://meine-anmeldung.digital/
curl -sI https://meine-anmeldung.digital/ | grep -iE '^(HTTP|Location)' # erwartet: 302 → https://meine-anmeldung.digital/login
curl -sI -H 'Host: meine-anmeldung.digital' http://127.0.0.1:8080/ | grep -i '^Location' # Container direkt: https://…/login
```
Zeigt der dritte Befehl `https://`, der zweite aber `http://`, liegt es an den KeyHelp-Einstellungen, nicht an mareike.
Logs:
```bash
@@ -3,6 +3,7 @@
// beim Build gebündelt (kein Netzwerk-Load). value === icon (FA-Solid-Name im kebab-case).
export const PAYMENT_METHOD_ICONS = [
{value: 'building-columns', label: 'Bank / Überweisung', icon: 'building-columns'},
{value: 'file-signature', label: 'Lastschrift / Mandat', icon: 'file-signature'},
{value: 'money-bill-wave', label: 'Bargeld', icon: 'money-bill-wave'},
{value: 'credit-card', label: 'Kreditkarte', icon: 'credit-card'},
{value: 'wallet', label: 'Geldbörse', icon: 'wallet'},
+8 -1
View File
@@ -15,6 +15,7 @@ const globalProps = reactive({
message: '',
currentEvent: null,
version: '',
groupLabels: {localGroupPlural: 'Stämme', parentGroupPlural: 'Bünde'},
});
const sidebarOpen = ref(false);
@@ -107,7 +108,10 @@ const props = defineProps({
</ul>
<ul class="nav-links">
<li v-if="globalProps.tenant.slug === 'lv'">
<a href="/admin/tenants" @click="closeSidebar">Stämme</a>
<a href="/admin/tenants" @click="closeSidebar">{{ globalProps.groupLabels.localGroupPlural }}</a>
</li>
<li v-if="globalProps.tenant.slug === 'lv'">
<a href="/admin/parent-groups" @click="closeSidebar">{{ globalProps.groupLabels.parentGroupPlural }}</a>
</li>
<li>
<a href="/admin/users" @click="closeSidebar">Benutzer*innen</a>
@@ -117,6 +121,9 @@ const props = defineProps({
<li>
<a href="/admin/document-templates" @click="closeSidebar">Rechnungsvorlage</a>
</li>
<li>
<a href="/admin/settings" @click="closeSidebar">Einstellungen</a>
</li>
</ul>
</nav>
</div>
Loaded 100 of 119 files, more files were not shown because too many files have changed in this diff. Show more