Compare commits
18
Commits
No files matched your search
@@ -0,0 +1,63 @@
|
||||
# Production settings – copy to <DEPLOY_PATH>/shared/.env on the server and fill in.
|
||||
# Generate APP_KEY locally once: php artisan key:generate --show
|
||||
|
||||
APP_NAME="Ferienwohnung Stommer"
|
||||
APP_ENV=production
|
||||
APP_KEY=
|
||||
APP_DEBUG=false
|
||||
APP_URL=https://www.fewo-stommer.de
|
||||
APP_TIMEZONE=Europe/Berlin
|
||||
APP_LOCALE=de
|
||||
APP_FALLBACK_LOCALE=de
|
||||
APP_FAKER_LOCALE=de_DE
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
|
||||
LOG_CHANNEL=daily
|
||||
LOG_LEVEL=warning
|
||||
|
||||
# Strato MariaDB 11.8 (Kundenlogin › Datenbanken und Webspace › Datenbanken verwalten)
|
||||
DB_CONNECTION=mariadb
|
||||
DB_HOST=
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=
|
||||
DB_USERNAME=
|
||||
DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_SECURE_COOKIE=true
|
||||
CACHE_STORE=database
|
||||
QUEUE_CONNECTION=sync
|
||||
FILESYSTEM_DISK=local
|
||||
|
||||
# Strato mailbox fewo@stommer.de
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=smtp.strato.de
|
||||
MAIL_PORT=465
|
||||
MAIL_SCHEME=smtps
|
||||
MAIL_USERNAME=fewo@stommer.de
|
||||
MAIL_PASSWORD=
|
||||
MAIL_FROM_ADDRESS="fewo@stommer.de"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
FEWO_OWNER_NAME="Brigitte Stommer"
|
||||
FEWO_OWNER_EMAIL=fewo@stommer.de
|
||||
FEWO_NOTIFICATION_EMAIL=fewo@stommer.de
|
||||
FEWO_BANK_ACCOUNT_HOLDER=
|
||||
FEWO_BANK_IBAN=
|
||||
FEWO_BANK_BIC=
|
||||
FEWO_BANK_NAME=
|
||||
|
||||
# Portal booking e-mails (fast path)
|
||||
FEWO_MAILBOX_HOST=imap.strato.de
|
||||
FEWO_MAILBOX_PORT=993
|
||||
FEWO_MAILBOX_ENCRYPTION=ssl
|
||||
FEWO_MAILBOX_USERNAME=fewo@stommer.de
|
||||
FEWO_MAILBOX_PASSWORD=
|
||||
FEWO_MAILBOX_FOLDER=INBOX
|
||||
|
||||
# Monitoring / automation (long random values, e.g. php -r "echo bin2hex(random_bytes(24));")
|
||||
FEWO_HEALTH_TOKEN=
|
||||
FEWO_SCHEDULER_TOKEN=
|
||||
FEWO_AUTOMATION_SECRET=
|
||||
FEWO_AUTOMATION_WEBHOOK_URL=
|
||||
@@ -0,0 +1,105 @@
|
||||
# Tests on every push; deployment to Strato for tags "v*" or by hand (Gitea › Actions › Deploy › Run workflow).
|
||||
# Needs a Gitea act_runner (e.g. on the private server) and these repository secrets:
|
||||
# DEPLOY_SSH_KEY private key whose public key is stored at Strato (SFTP & SSH)
|
||||
# DEPLOY_HOST package-specific SSH server, e.g. 51539426.ssh.w1.strato.hosting (not ssh.strato.de)
|
||||
# DEPLOY_USER SSH user from the Strato customer login
|
||||
# DEPLOY_PATH e.g. fewo-production
|
||||
# DEPLOY_PHP e.g. /opt/RZphp84/bin/php-cli
|
||||
# DEPLOY_URL e.g. https://www.fewo-stommer.de
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: Ziel
|
||||
type: choice
|
||||
options: [production, staging]
|
||||
default: production
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:11.8
|
||||
env:
|
||||
MARIADB_DATABASE: fewo_test
|
||||
MARIADB_ROOT_PASSWORD: test
|
||||
ports: ['3306:3306']
|
||||
options: >-
|
||||
--health-cmd="healthcheck.sh --connect --innodb_initialized"
|
||||
--health-interval=5s --health-timeout=5s --health-retries=20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.4'
|
||||
extensions: mbstring, intl, gd, exif, zip, pdo_sqlite, sqlite3, pdo_mysql, fileinfo, openssl
|
||||
tools: composer:v2
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: npm
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
composer install --no-interaction --no-progress --prefer-dist
|
||||
npm ci --no-audit --no-fund
|
||||
npm run build
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
|
||||
- name: Tests (SQLite)
|
||||
run: php artisan test --compact
|
||||
|
||||
- name: Tests (MariaDB 11.8, wie auf Strato)
|
||||
env:
|
||||
DB_CONNECTION: mariadb
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: '3306'
|
||||
DB_DATABASE: fewo_test
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: test
|
||||
run: php artisan test --compact
|
||||
|
||||
deploy:
|
||||
needs: test
|
||||
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.4'
|
||||
extensions: mbstring, intl, gd, exif, zip, fileinfo, openssl
|
||||
tools: composer:v2
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: npm
|
||||
|
||||
- name: SSH key
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
printf '%s\n' "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Deploy
|
||||
env:
|
||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||
DEPLOY_PHP: ${{ secrets.DEPLOY_PHP }}
|
||||
DEPLOY_URL: ${{ secrets.DEPLOY_URL }}
|
||||
run: |
|
||||
export DEPLOY_SSH_KEY="$HOME/.ssh/deploy_key"
|
||||
bash scripts/deploy.sh "${{ inputs.environment || 'production' }}" deploy
|
||||
@@ -28,3 +28,7 @@ _ide_helper.php
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
|
||||
# Deployment settings with access data
|
||||
/scripts/deploy.*.env
|
||||
!/scripts/deploy.example.env
|
||||
@@ -10,9 +10,11 @@ # Ferienwohnung Stommer
|
||||
- Portals must be integrated through a pluggable channel-connector system (see concept §7), never hard-coded.
|
||||
- Bookings/blocks use nights: `arrival <= night < departure`; same-day changeover is allowed. Reservations with an elapsed hold never occupy the calendar (scope `Booking::occupying()`), cron only updates status.
|
||||
- Business operations live in `app/Actions` (CreateReservation, ConfirmBooking, …); Filament pages and Livewire components call them instead of changing bookings directly.
|
||||
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts.
|
||||
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts. Kinds (`OfferKind`): rule, fixed dates, gap filler (`App\Availability\GapFinder`). Which offers the website advertises is decided by `App\Pricing\OfferShowcase` (not by appearances); it prices fixed dates/gaps with `PriceCalculator`.
|
||||
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
|
||||
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
|
||||
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo/photos per section (stable `data.id` per placed section) and sections can be limited to appearances. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). New designs are **additional** themes: `php artisan themes:make <key>`, `themes:check`, `themes:preview` – never edit `ostsee-licht` for a new design; authoring rules in `docs/THEME-ERSTELLUNG.md`. Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
|
||||
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for admins via `RequireTwoFactorForAdmins`. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
|
||||
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
|
||||
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
|
||||
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
|
||||
- Git remote: Gitea `https://gitea.stommer.de/Lars/fewo-stommer.git`, branch `main`.
|
||||
|
||||
@@ -10,9 +10,11 @@ # Ferienwohnung Stommer
|
||||
- Portals must be integrated through a pluggable channel-connector system (see concept §7), never hard-coded.
|
||||
- Bookings/blocks use nights: `arrival <= night < departure`; same-day changeover is allowed. Reservations with an elapsed hold never occupy the calendar (scope `Booking::occupying()`), cron only updates status.
|
||||
- Business operations live in `app/Actions` (CreateReservation, ConfirmBooking, …); Filament pages and Livewire components call them instead of changing bookings directly.
|
||||
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts.
|
||||
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts. Kinds (`OfferKind`): rule, fixed dates, gap filler (`App\Availability\GapFinder`). Which offers the website advertises is decided by `App\Pricing\OfferShowcase` (not by appearances); it prices fixed dates/gaps with `PriceCalculator`.
|
||||
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
|
||||
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
|
||||
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo/photos per section (stable `data.id` per placed section) and sections can be limited to appearances. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). New designs are **additional** themes: `php artisan themes:make <key>`, `themes:check`, `themes:preview` – never edit `ostsee-licht` for a new design; authoring rules in `docs/THEME-ERSTELLUNG.md`. Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
|
||||
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for admins via `RequireTwoFactorForAdmins`. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
|
||||
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
|
||||
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
|
||||
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
|
||||
- Git remote: Gitea `https://gitea.stommer.de/Lars/fewo-stommer.git`, branch `main`.
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Availability;
|
||||
|
||||
use App\Models\Property;
|
||||
use Carbon\CarbonImmutable;
|
||||
|
||||
/**
|
||||
* Free gaps in the calendar: runs of free nights with an occupied night (booking or block) directly
|
||||
* before and after. Open-ended free periods (nothing booked behind them yet) are not gaps.
|
||||
*/
|
||||
class GapFinder
|
||||
{
|
||||
/** How far around a stay we look for the neighbouring occupations. */
|
||||
private const LOOKAROUND_NIGHTS = 60;
|
||||
|
||||
public function __construct(private AvailabilityChecker $availability = new AvailabilityChecker) {}
|
||||
|
||||
/**
|
||||
* Length in nights of the gap that contains the whole stay, or null if the stay is not inside a gap
|
||||
* (because a night is occupied or the free period is not closed on both sides).
|
||||
*/
|
||||
public function gapContaining(Property $property, CarbonImmutable $arrival, CarbonImmutable $departure): ?int
|
||||
{
|
||||
$from = $arrival->subDays(self::LOOKAROUND_NIGHTS);
|
||||
$until = $departure->addDays(self::LOOKAROUND_NIGHTS);
|
||||
$occupied = $this->availability->occupiedNights($property, $from, $until);
|
||||
|
||||
for ($night = $arrival; $night->lessThan($departure); $night = $night->addDay()) {
|
||||
if (isset($occupied[$night->toDateString()])) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$start = $arrival;
|
||||
while (! isset($occupied[$start->subDay()->toDateString()])) {
|
||||
$start = $start->subDay();
|
||||
if ($start->lessThanOrEqualTo($from)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$end = $departure;
|
||||
while (! isset($occupied[$end->toDateString()])) {
|
||||
$end = $end->addDay();
|
||||
if ($end->greaterThanOrEqualTo($until)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (int) $start->diffInDays($end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gaps of 1 … $maxNights nights starting within [$from, $until), as [arrival, departure] pairs.
|
||||
*
|
||||
* @return list<array{0: CarbonImmutable, 1: CarbonImmutable}>
|
||||
*/
|
||||
public function gaps(Property $property, CarbonImmutable $from, CarbonImmutable $until, int $maxNights): array
|
||||
{
|
||||
$occupied = $this->availability->occupiedNights($property, $from->subDay(), $until->addDays($maxNights + 1));
|
||||
|
||||
$gaps = [];
|
||||
$night = $from;
|
||||
while ($night->lessThan($until)) {
|
||||
$isGapStart = ! isset($occupied[$night->toDateString()]) && isset($occupied[$night->subDay()->toDateString()]);
|
||||
if (! $isGapStart) {
|
||||
$night = $night->addDay();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$end = $night;
|
||||
while (! isset($occupied[$end->toDateString()]) && $night->diffInDays($end) <= $maxNights) {
|
||||
$end = $end->addDay();
|
||||
}
|
||||
|
||||
if (isset($occupied[$end->toDateString()]) && $night->diffInDays($end) <= $maxNights) {
|
||||
$gaps[] = [$night, $end];
|
||||
}
|
||||
|
||||
$night = $end->addDay();
|
||||
}
|
||||
|
||||
return $gaps;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Themes\ThemeChecker;
|
||||
use App\Themes\ThemeRegistry;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
#[Signature('themes:check {theme? : Key des Themes (leer = alle)}')]
|
||||
#[Description('Check themes against the theme contract (docs/THEME-ERSTELLUNG.md): manifest, build, required markup, colours, contrast')]
|
||||
class CheckTheme extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(ThemeRegistry $registry, ThemeChecker $checker): int
|
||||
{
|
||||
$key = $this->argument('theme');
|
||||
if ($key !== null && ! isset($registry->all()[$key])) {
|
||||
$this->error("Theme „{$key}“ nicht gefunden. Installiert: ".implode(', ', array_keys($registry->all())));
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$themes = $key !== null ? [$registry->all()[$key]] : array_values($registry->all());
|
||||
$failed = false;
|
||||
|
||||
foreach ($themes as $theme) {
|
||||
['errors' => $errors, 'warnings' => $warnings] = $checker->check($theme);
|
||||
$this->line('');
|
||||
$this->line("<options=bold>{$theme->name}</> ({$theme->key} {$theme->version}".($theme->parent ? ", Eltern-Theme {$theme->parent}" : '').')');
|
||||
|
||||
foreach ($errors as $error) {
|
||||
$this->line(" <fg=red>✗</> {$error}");
|
||||
}
|
||||
foreach ($warnings as $warning) {
|
||||
$this->line(" <fg=yellow>!</> {$warning}");
|
||||
}
|
||||
if ($errors === [] && $warnings === []) {
|
||||
$this->line(' <fg=green>✓</> Alles in Ordnung.');
|
||||
}
|
||||
|
||||
$failed = $failed || $errors !== [];
|
||||
}
|
||||
|
||||
$this->line('');
|
||||
|
||||
return $failed ? self::FAILURE : self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
|
||||
use function Laravel\Prompts\password;
|
||||
use function Laravel\Prompts\select;
|
||||
use function Laravel\Prompts\text;
|
||||
|
||||
#[Signature('users:create {email? : E-Mail-Adresse} {--name= : Name} {--role= : admin, rentals oder content}')]
|
||||
#[Description('Create an admin panel account (the password is entered interactively and never passed as an argument)')]
|
||||
class CreateUser extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$email = $this->argument('email') ?? text('E-Mail-Adresse', required: true, validate: ['email' => 'email']);
|
||||
$email = mb_strtolower(trim($email));
|
||||
|
||||
if (User::where('email', $email)->exists()) {
|
||||
$this->error("Es gibt bereits einen Benutzer mit {$email}.");
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$name = $this->option('name') ?? text('Name', required: true);
|
||||
|
||||
$role = $this->option('role') !== null
|
||||
? UserRole::tryFrom($this->option('role'))
|
||||
: UserRole::from(select('Rolle', collect(UserRole::cases())->mapWithKeys(fn (UserRole $role): array => [$role->value => "{$role->getLabel()} – {$role->getDescription()}"])->all(), default: UserRole::Admin->value));
|
||||
|
||||
if ($role === null) {
|
||||
$this->error('Unbekannte Rolle. Erlaubt: '.implode(', ', array_column(UserRole::cases(), 'value')));
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$password = password('Passwort (mind. 12 Zeichen)', required: true, validate: ['password' => Password::min(12)]);
|
||||
|
||||
if (password('Passwort wiederholen', required: true) !== $password) {
|
||||
$this->error('Die Passwörter stimmen nicht überein.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
User::create(['name' => $name, 'email' => $email, 'role' => $role, 'password' => $password]);
|
||||
|
||||
$this->info("Benutzer {$email} ({$role->getLabel()}) angelegt.");
|
||||
|
||||
if ($role === UserRole::Admin) {
|
||||
$this->line('Bei der ersten Anmeldung wird die Zwei-Faktor-Anmeldung mit einer Authenticator-App eingerichtet.');
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -8,41 +8,111 @@
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Signature('photos:import {directory : Folder with JPG/PNG/WebP files} {--category=apartment : apartment, outdoor or area}')]
|
||||
#[Description('Import all images of a folder as website photos (e.g. when migrating from the old website)')]
|
||||
#[Signature('photos:import {directory : Folder with JPG/PNG/WebP files} {--category=apartment : apartment, outdoor or area} {--manifest= : CSV "file;category;alt_text" with paths relative to the folder (chooses and describes the photos)}')]
|
||||
#[Description('Import images as website photos (e.g. when migrating from the old website); the source files are only read')]
|
||||
class ImportPhotos extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$directory = rtrim((string) $this->argument('directory'), '/\\');
|
||||
$entries = $this->option('manifest') !== null
|
||||
? $this->manifestEntries((string) $this->option('manifest'), $directory)
|
||||
: $this->folderEntries($directory);
|
||||
|
||||
if ($entries === null) {
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$propertyId = Property::query()->value('id');
|
||||
$sort = (int) Photo::max('sort_order');
|
||||
$imported = 0;
|
||||
|
||||
foreach ($entries as ['file' => $file, 'category' => $category, 'alt_text' => $altText]) {
|
||||
$source = str_replace('\\', '/', substr($file, strlen($directory) + 1));
|
||||
|
||||
if (! is_file($file)) {
|
||||
$this->warn("Fehlt: {$source}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Media::query()->where('collection_name', Photo::COLLECTION)->where('custom_properties->source', $source)->exists()) {
|
||||
$this->line("– bereits vorhanden: {$source}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$photo = Photo::create([
|
||||
'property_id' => $category === PhotoCategory::Area ? null : $propertyId,
|
||||
'category' => $category,
|
||||
'alt_text' => $altText,
|
||||
'sort_order' => ++$sort,
|
||||
]);
|
||||
$photo->addMedia($file)
|
||||
->preservingOriginal()
|
||||
->withCustomProperties(['source' => $source])
|
||||
->toMediaCollection(Photo::COLLECTION);
|
||||
|
||||
$imported++;
|
||||
$this->line("✓ {$photo->alt_text}");
|
||||
}
|
||||
|
||||
$this->info("{$imported} Bilder importiert.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{file: string, category: PhotoCategory, alt_text: string}>|null
|
||||
*/
|
||||
private function folderEntries(string $directory): ?array
|
||||
{
|
||||
$category = PhotoCategory::tryFrom((string) $this->option('category'));
|
||||
if ($category === null) {
|
||||
$this->error('Unbekannte Kategorie. Erlaubt: '.implode(', ', array_column(PhotoCategory::cases(), 'value')));
|
||||
|
||||
return self::FAILURE;
|
||||
return null;
|
||||
}
|
||||
|
||||
$files = glob(rtrim((string) $this->argument('directory'), '/\\').'/*.{jpg,jpeg,png,webp,JPG,JPEG,PNG,WEBP}', GLOB_BRACE) ?: [];
|
||||
$propertyId = $category === PhotoCategory::Area ? null : Property::query()->value('id');
|
||||
$sort = (int) Photo::max('sort_order');
|
||||
$files = glob($directory.'/*.{jpg,jpeg,png,webp,JPG,JPEG,PNG,WEBP}', GLOB_BRACE) ?: [];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$photo = Photo::create([
|
||||
'property_id' => $propertyId,
|
||||
'category' => $category,
|
||||
'alt_text' => str(pathinfo($file, PATHINFO_FILENAME))->replace(['_', '-'], ' ')->squish()->ucfirst()->toString(),
|
||||
'sort_order' => ++$sort,
|
||||
]);
|
||||
$photo->addMedia($file)->preservingOriginal()->toMediaCollection(Photo::COLLECTION);
|
||||
return array_map(fn (string $file): array => [
|
||||
'file' => $file,
|
||||
'category' => $category,
|
||||
'alt_text' => str(pathinfo($file, PATHINFO_FILENAME))->replace(['_', '-'], ' ')->squish()->ucfirst()->toString(),
|
||||
], $files);
|
||||
}
|
||||
|
||||
$this->line("✓ {$photo->alt_text}");
|
||||
/**
|
||||
* @return list<array{file: string, category: PhotoCategory, alt_text: string}>|null
|
||||
*/
|
||||
private function manifestEntries(string $manifest, string $directory): ?array
|
||||
{
|
||||
if (! is_file($manifest)) {
|
||||
$this->error("Liste nicht gefunden: {$manifest}");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->info(count($files).' Bilder importiert.');
|
||||
$entries = [];
|
||||
foreach (array_slice(file($manifest, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [], 1) as $number => $line) {
|
||||
[$file, $category, $altText] = array_pad(str_getcsv($line, ';', '"', ''), 3, '');
|
||||
$category = PhotoCategory::tryFrom(trim($category));
|
||||
|
||||
return self::SUCCESS;
|
||||
if ($category === null || trim($file) === '' || trim($altText) === '') {
|
||||
$this->error('Ungültige Zeile '.($number + 2).": {$line}");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$entries[] = ['file' => $directory.'/'.ltrim(trim($file), '/'), 'category' => $category, 'alt_text' => trim($altText)];
|
||||
}
|
||||
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Themes\ThemeManifest;
|
||||
use App\Themes\ThemeRegistry;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
#[Signature('themes:make {key : Ordner/Key, z. B. ostsee-nacht} {--name= : Anzeigename} {--parent= : Eltern-Theme (Standard: Basis-Theme)} {--description= : Beschreibung für die Theme-Auswahl}')]
|
||||
#[Description('Create a new theme next to the existing ones (never overwrites) – inherits everything until views are added')]
|
||||
class MakeTheme extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(ThemeRegistry $registry): int
|
||||
{
|
||||
$key = (string) $this->argument('key');
|
||||
$parent = (string) ($this->option('parent') ?: config('themes.base'));
|
||||
$themesPath = rtrim((string) (config('themes.paths')[0] ?? resource_path('themes')), '/\\');
|
||||
$path = "{$themesPath}/{$key}";
|
||||
$folder = str_replace('\\', '/', ltrim(substr($path, strlen(base_path())), '/\\'));
|
||||
|
||||
if (! preg_match('/^[a-z0-9]+(-[a-z0-9]+)*$/', $key)) {
|
||||
$this->error('Key: nur Kleinbuchstaben, Ziffern und Bindestriche, z. B. ostsee-nacht.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
if (File::exists($path) || isset($registry->all()[$key])) {
|
||||
$this->error("Theme „{$key}“ gibt es schon – es wird nichts überschrieben.");
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
if (! isset($registry->all()[$parent])) {
|
||||
$this->error("Eltern-Theme „{$parent}“ ist nicht installiert.");
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$name = (string) ($this->option('name') ?: str($key)->replace('-', ' ')->title());
|
||||
$manifest = [
|
||||
'key' => $key,
|
||||
'name' => $name,
|
||||
'version' => '0.1.0',
|
||||
'parent' => $parent,
|
||||
'description' => (string) ($this->option('description') ?: "Neues Theme auf Basis von „{$registry->get($parent)->name}“."),
|
||||
'assets' => ['css' => "{$folder}/theme.css", 'js' => "{$folder}/theme.js"],
|
||||
'tokens' => $registry->tokens($parent),
|
||||
];
|
||||
|
||||
File::ensureDirectoryExists("{$path}/views/sections");
|
||||
File::ensureDirectoryExists("{$path}/views/partials");
|
||||
File::put("{$path}/views/sections/.gitkeep", '');
|
||||
File::put("{$path}/views/partials/.gitkeep", '');
|
||||
File::put("{$path}/theme.json", json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n");
|
||||
File::put("{$path}/theme.css", $this->css($name, $parent, $path, $registry));
|
||||
File::put("{$path}/theme.js", $this->js($name, ThemeManifest::relativePath($path, $registry->get($parent)->path).'/theme.js'));
|
||||
File::put("{$path}/README.md", $this->readme($name, $key, $parent));
|
||||
|
||||
$this->info("Theme „{$name}“ angelegt: {$folder}");
|
||||
$this->line('Es erbt zunächst alles von „'.$parent.'“. Vorlagen nach views/ kopieren und umgestalten – Anleitung: docs/THEME-ERSTELLUNG.md');
|
||||
$this->line("Prüfen: php artisan themes:check {$key} · Bauen: npm run build · Auswählen: Admin › System › Websites › Theme (dort „Vorschau“).");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Child theme CSS: Tailwind, the reusable styles of the nearest ancestor that has a theme-base.css,
|
||||
* and the template sources of all ancestors, the booking forms and the theme itself.
|
||||
*/
|
||||
private function css(string $name, string $parent, string $path, ThemeRegistry $registry): string
|
||||
{
|
||||
$ancestors = $registry->chain($parent);
|
||||
$base = collect($ancestors)->first(fn (ThemeManifest $theme): bool => is_file($theme->path.'/theme-base.css')) ?? $ancestors[0];
|
||||
$import = ThemeManifest::relativePath($path, $base->path).'/theme-base.css';
|
||||
$sources = collect($ancestors)
|
||||
->map(fn (ThemeManifest $theme): string => "@source '".ThemeManifest::relativePath($path, $theme->viewsPath())."';")
|
||||
->push("@source '".ThemeManifest::relativePath($path, resource_path('views/livewire'))."';")
|
||||
->push("@source './views';")
|
||||
->implode("\n");
|
||||
|
||||
return <<<CSS
|
||||
/*
|
||||
* Theme „{$name}“ – Child von „{$parent}“ (Anleitung: docs/THEME-ERSTELLUNG.md).
|
||||
* theme-base.css des Eltern-Themes bringt Schriften, Token-Mapping und Basis-Klassen (.eyebrow,
|
||||
* .heading-display, .btn-primary, .btn-accent, .prose-theme, .reveal). Hier nur Abweichungen ergänzen.
|
||||
*/
|
||||
@import 'tailwindcss';
|
||||
@import '{$import}';
|
||||
|
||||
/* Eigene Schriften selbst hosten: npm install @fontsource/<schrift> und hier importieren, z. B.
|
||||
@import '@fontsource/fraunces/400.css';
|
||||
*/
|
||||
|
||||
/* Vorlagen, deren Klassen gebaut werden: geerbte, Buchungsformulare, eigene. */
|
||||
{$sources}
|
||||
|
||||
@theme inline {
|
||||
/* --font-display: 'Fraunces', Georgia, serif; */
|
||||
/* --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif; */
|
||||
}
|
||||
|
||||
@layer components {
|
||||
}
|
||||
|
||||
CSS;
|
||||
}
|
||||
|
||||
private function js(string $name, string $import): string
|
||||
{
|
||||
return <<<JS
|
||||
/**
|
||||
* Theme „{$name}“: übernimmt Lightbox, Verfügbarkeitssuche und rollierende Angebote vom Eltern-Theme.
|
||||
* Eigene Verbesserungen darunter – alles muss auch ohne JavaScript funktionieren.
|
||||
*/
|
||||
import '{$import}';
|
||||
|
||||
JS;
|
||||
}
|
||||
|
||||
private function readme(string $name, string $key, string $parent): string
|
||||
{
|
||||
return <<<MD
|
||||
# Theme „{$name}“ (`{$key}`)
|
||||
|
||||
Child-Theme von `{$parent}`. Vorlagen, die hier fehlen, kommen vom Eltern-Theme.
|
||||
|
||||
- Anleitung und Vorlagen-Vertrag: `docs/THEME-ERSTELLUNG.md`, `docs/THEMES.md` §5
|
||||
- Prüfen: `php artisan themes:check {$key}`
|
||||
- Ansehen ohne Umschalten: Admin › System › Websites › Theme „{$name}“ wählen › „Vorschau“ (erst danach speichern)
|
||||
|
||||
## Eigene Vorlagen
|
||||
|
||||
| Datei | Zweck |
|
||||
|---|---|
|
||||
| | |
|
||||
|
||||
MD;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Page;
|
||||
use App\Themes\ThemeFactory;
|
||||
use App\Themes\ThemeRegistry;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
#[Signature('themes:preview {theme : Key des Themes} {--hours=24 : Gültigkeit der Links}')]
|
||||
#[Description('Print signed preview links: every page of the site with the theme, in every appearance – without switching the site')]
|
||||
class PreviewTheme extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(ThemeRegistry $registry, ThemeFactory $factory): int
|
||||
{
|
||||
$key = (string) $this->argument('theme');
|
||||
if (! isset($registry->all()[$key])) {
|
||||
$this->error("Theme „{$key}“ nicht gefunden. Installiert: ".implode(', ', array_keys($registry->all())));
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$site = $factory->site();
|
||||
$expires = now()->addHours((int) $this->option('hours'));
|
||||
$pages = $site->exists ? $site->pages()->where('is_published', true)->orderBy('sort_order')->get() : collect();
|
||||
$appearances = $site->exists ? $site->appearances()->orderByDesc('is_default')->orderBy('starts_md')->get() : collect();
|
||||
|
||||
$this->info("Vorschau „{$registry->get($key)->name}“ für {$site->name} (gültig bis {$expires->format('d.m.Y H:i')}):");
|
||||
foreach ($pages as $page) {
|
||||
$this->line('');
|
||||
$this->line("<options=bold>{$page->title}</>");
|
||||
$this->line(' heute: '.$this->url($page, ['theme' => $key], $expires));
|
||||
foreach ($appearances as $appearance) {
|
||||
$this->line(str_pad(" {$appearance->name}:", 16).$this->url($page, ['theme' => $key, 'vorschau' => $appearance->id], $expires));
|
||||
}
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $parameters
|
||||
*/
|
||||
private function url(Page $page, array $parameters, \DateTimeInterface $expires): string
|
||||
{
|
||||
return $page->isHome()
|
||||
? URL::temporarySignedRoute('home', $expires, $parameters)
|
||||
: URL::temporarySignedRoute('page', $expires, ['slug' => $page->slug, ...$parameters]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use App\Filament\Resources\Reviews\ReviewResource;
|
||||
use Filament\Support\Contracts\HasDescription;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
/**
|
||||
* How much of the admin a user sees. It only shapes the menu – what a user may do is decided by the role.
|
||||
*/
|
||||
enum AdminMode: string implements HasDescription, HasLabel
|
||||
{
|
||||
case Simple = 'simple';
|
||||
case Expert = 'expert';
|
||||
|
||||
/**
|
||||
* Menu entries of the simple mode: day-to-day work with requests, bookings, contracts and the calendar.
|
||||
*
|
||||
* @var list<class-string>
|
||||
*/
|
||||
public const SIMPLE_NAVIGATION = [
|
||||
BookingResource::class,
|
||||
BlockedPeriodResource::class,
|
||||
GuestResource::class,
|
||||
ChannelTaskResource::class,
|
||||
ReviewResource::class,
|
||||
];
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Simple => 'Einfache Ansicht',
|
||||
self::Expert => 'Expertenansicht',
|
||||
};
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Simple => 'Nur das Tägliche: Anfragen, Buchungen und Verträge, Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen',
|
||||
self::Expert => 'Alle Einstellungen: Preise, Angebote, Portale, Webseite, System',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a resource or page appears in the menu in this mode.
|
||||
*
|
||||
* @param class-string $class
|
||||
*/
|
||||
public function shows(string $class): bool
|
||||
{
|
||||
return $this === self::Expert || in_array($class, self::SIMPLE_NAVIGATION, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Label of the user menu entry that switches to this mode.
|
||||
*/
|
||||
public function switchLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Simple => 'Zur einfachen Ansicht wechseln',
|
||||
self::Expert => 'Zur Expertenansicht wechseln',
|
||||
};
|
||||
}
|
||||
|
||||
public function other(): self
|
||||
{
|
||||
return $this === self::Simple ? self::Expert : self::Simple;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ enum DiscountType: string implements HasLabel
|
||||
/** discount_value = number of cheapest nights that are free */
|
||||
case FreeNights = 'free_nights';
|
||||
|
||||
/** discount_value = package price in euro cents for all nights of the stay */
|
||||
case FixedStayPrice = 'fixed_stay_price';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
@@ -25,6 +28,12 @@ public function getLabel(): string
|
||||
self::AmountPerStay => 'Rabatt in € pro Aufenthalt',
|
||||
self::NightlyRate => 'Sonderpreis pro Nacht',
|
||||
self::FreeNights => 'Gratis-Nächte',
|
||||
self::FixedStayPrice => 'Pauschalpreis für den Aufenthalt',
|
||||
};
|
||||
}
|
||||
|
||||
public function isMoney(): bool
|
||||
{
|
||||
return in_array($this, [self::AmountPerStay, self::NightlyRate, self::FixedStayPrice], true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasDescription;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
/**
|
||||
* How an offer finds its stays. All kinds are priced by PriceCalculator and advertised by OfferShowcase.
|
||||
*/
|
||||
enum OfferKind: string implements HasDescription, HasLabel
|
||||
{
|
||||
/** Conditions only (last minute, early bird, from N nights, weekend …). */
|
||||
case Rule = 'rule';
|
||||
|
||||
/** One fixed arrival and departure (stay_from / stay_until), e.g. a week as a package. */
|
||||
case FixedDates = 'fixed_dates';
|
||||
|
||||
/** Free gaps of at most max_gap_nights between two occupations, found automatically. */
|
||||
case GapFiller = 'gap_filler';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Rule => 'Rabattaktion (nach Bedingungen)',
|
||||
self::FixedDates => 'Fester Termin',
|
||||
self::GapFiller => 'Lückenfüller (Kalenderlücken)',
|
||||
};
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Rule => 'Gilt für jeden Aufenthalt, der die Bedingungen erfüllt, z. B. Last Minute oder „ab 3 Nächten −10 %“.',
|
||||
self::FixedDates => 'Ein bestimmter Zeitraum, z. B. „7 Nächte vom 07. bis 14.11.“ – wird nur beworben, solange er frei ist.',
|
||||
self::GapFiller => 'Findet freie Lücken zwischen zwei Buchungen automatisch und bewirbt sie mit konkreten Terminen.',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Concerns;
|
||||
|
||||
use App\Enums\AdminMode;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
|
||||
/**
|
||||
* Hides the menu entry in the simple admin mode unless it is part of AdminMode::SIMPLE_NAVIGATION.
|
||||
* The page stays reachable by URL; access is governed by the policies.
|
||||
*/
|
||||
trait FollowsAdminMode
|
||||
{
|
||||
public static function shouldRegisterNavigation(): bool
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
$mode = $user instanceof User ? $user->adminMode() : AdminMode::Expert;
|
||||
|
||||
return parent::shouldRegisterNavigation() && $mode->shows(static::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Forms\Components;
|
||||
|
||||
use App\Models\Photo;
|
||||
use Filament\Forms\Components\Select;
|
||||
|
||||
/**
|
||||
* Chooses website photos with a thumbnail next to each description, grouped by category,
|
||||
* so editors see what they insert.
|
||||
*/
|
||||
class PhotoSelect extends Select
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this
|
||||
->options(fn (): array => self::photoOptions())
|
||||
->allowHtml()
|
||||
->searchable()
|
||||
->native(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, string>>
|
||||
*/
|
||||
public static function photoOptions(): array
|
||||
{
|
||||
return Photo::query()->with('media')->orderBy('category')->orderBy('sort_order')->get()
|
||||
->groupBy(fn (Photo $photo): string => $photo->category->getLabel())
|
||||
->map(fn ($photos): array => $photos->mapWithKeys(fn (Photo $photo): array => [$photo->id => self::optionLabel($photo)])->all())
|
||||
->all();
|
||||
}
|
||||
|
||||
public static function optionLabel(Photo $photo): string
|
||||
{
|
||||
$thumbnail = $photo->url('sm');
|
||||
$image = $thumbnail !== ''
|
||||
? '<img src="'.e($thumbnail).'" alt="" loading="lazy" style="width:4.5rem;height:3rem;object-fit:cover;border-radius:.25rem;flex-shrink:0">'
|
||||
: '<span style="width:4.5rem;height:3rem;border-radius:.25rem;background:#e5e7eb;flex-shrink:0"></span>';
|
||||
$hidden = $photo->is_published ? '' : ' <em style="opacity:.6">(ausgeblendet)</em>';
|
||||
|
||||
return '<span style="display:flex;align-items:center;gap:.75rem">'.$image.'<span>'.e($photo->alt_text).$hidden.'</span></span>';
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,8 @@
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Models\Photo;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Forms\Components\PhotoSelect;
|
||||
use App\Support\Content;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
@@ -29,6 +30,8 @@
|
||||
*/
|
||||
class EditContent extends Page
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPencilSquare;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Webseite';
|
||||
@@ -120,10 +123,8 @@ private function field(string $key, array $field): TextInput|Textarea|RichEditor
|
||||
'richtext' => RichEditor::make($name)
|
||||
->label($field['label'])
|
||||
->toolbarButtons([['bold', 'italic', 'link'], ['h2', 'h3'], ['bulletList', 'orderedList'], ['undo', 'redo']]),
|
||||
'photo' => Select::make($name)
|
||||
'photo' => PhotoSelect::make($name)
|
||||
->label($field['label'])
|
||||
->options(fn (): array => Photo::query()->orderBy('category')->orderBy('sort_order')->pluck('alt_text', 'id')->all())
|
||||
->searchable()
|
||||
->placeholder('Kein Bild gewählt')
|
||||
->helperText('Bilder verwalten Sie unter „Webseite › Bilder“.'),
|
||||
default => TextInput::make($name)->label($field['label'])->maxLength(255),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Amenities;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Amenities\Pages\CreateAmenity;
|
||||
use App\Filament\Resources\Amenities\Pages\EditAmenity;
|
||||
use App\Filament\Resources\Amenities\Pages\ListAmenities;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class AmenityResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Amenity::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedListBullet;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Appearances;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Appearances\Pages\CreateAppearance;
|
||||
use App\Filament\Resources\Appearances\Pages\EditAppearance;
|
||||
use App\Filament\Resources\Appearances\Pages\ListAppearances;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class AppearanceResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Appearance::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSwatch;
|
||||
|
||||
@@ -2,17 +2,23 @@
|
||||
|
||||
namespace App\Filament\Resources\Appearances\Schemas;
|
||||
|
||||
use App\Filament\Forms\Components\PhotoSelect;
|
||||
use App\Models\Appearance;
|
||||
use App\Models\Photo;
|
||||
use App\Models\Page;
|
||||
use App\Models\Site;
|
||||
use App\Models\SpecialOffer;
|
||||
use App\Themes\SectionRegistry;
|
||||
use App\Themes\Sections\Section as SectionBlock;
|
||||
use App\Themes\ThemeRegistry;
|
||||
use Closure;
|
||||
use Filament\Forms\Components\ColorPicker;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Component;
|
||||
use Filament\Schemas\Components\Fieldset;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Text;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
@@ -39,19 +45,18 @@ public static function configure(Schema $schema): Schema
|
||||
Toggle::make('is_default')->label('Standard (wenn kein Zeitraum passt)')->inline(false),
|
||||
Toggle::make('is_active')->label('Aktiv')->default(true)->inline(false),
|
||||
]),
|
||||
Section::make('Bild & Angebot')
|
||||
->columns(2)
|
||||
Section::make('Titelbild')
|
||||
->description('Gilt für alle Titelbereiche und als Vorschaubild beim Teilen in sozialen Medien – einzelne Bausteine können unten ein eigenes Bild bekommen. Sonderangebote werden unabhängig vom Erscheinungsbild beworben (Wohnung › Sonderangebote).')
|
||||
->schema([
|
||||
Select::make('hero_photo_id')
|
||||
PhotoSelect::make('hero_photo_id')
|
||||
->label('Titelbild')
|
||||
->options(fn (): array => Photo::query()->orderBy('category')->orderBy('sort_order')->pluck('alt_text', 'id')->all())
|
||||
->searchable()
|
||||
->placeholder('Bild der Seite verwenden'),
|
||||
Select::make('featured_offer_id')
|
||||
->label('Hervorgehobenes Sonderangebot')
|
||||
->options(fn (): array => SpecialOffer::query()->where('is_active', true)->pluck('name', 'id')->all())
|
||||
->placeholder('keins'),
|
||||
]),
|
||||
Section::make('Bilder je Baustein')
|
||||
->description('Für jeden Baustein mit Bildern ein eigenes Saisonbild wählen. Leer = Bild aus der Seite. Neue Bilder laden Sie unter Webseite › Fotos hoch.')
|
||||
->collapsible()
|
||||
->columnSpanFull()
|
||||
->schema(fn (Get $get): array => self::sectionPhotoFields($get('site_id'))),
|
||||
Section::make('Texte')
|
||||
->description('Leer lassen = Text der Seite bzw. kein Banner.')
|
||||
->columns(2)
|
||||
@@ -69,14 +74,68 @@ public static function configure(Schema $schema): Schema
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* One group per page and one field set per placed section that has photo slots
|
||||
* (see Section::photoSlots); stored in section_photos[<section id>][<slot>].
|
||||
*
|
||||
* @return list<Component>
|
||||
*/
|
||||
public static function sectionPhotoFields(int|string|null $siteId): array
|
||||
{
|
||||
$registry = app(SectionRegistry::class);
|
||||
$pages = Page::query()->where('site_id', $siteId)->orderBy('sort_order')->get();
|
||||
|
||||
$groups = [];
|
||||
foreach ($pages as $page) {
|
||||
$fieldsets = [];
|
||||
foreach ($page->sections ?? [] as $stored) {
|
||||
$class = $registry->all()[$stored['type'] ?? ''] ?? null;
|
||||
$sectionId = $stored['data']['id'] ?? null;
|
||||
if ($class === null || blank($sectionId) || $class::photoSlots() === []) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields = [];
|
||||
foreach ($class::photoSlots() as $slot => $definition) {
|
||||
$field = PhotoSelect::make("section_photos.{$sectionId}.{$slot}")
|
||||
->label($definition['label'])
|
||||
->placeholder('Standard (Bild aus der Seite)')
|
||||
->multiple($definition['type'] !== SectionBlock::SLOT_SINGLE);
|
||||
if (isset($definition['max'])) {
|
||||
$field->maxItems($definition['max']);
|
||||
}
|
||||
$fields[] = $field;
|
||||
|
||||
if ($definition['type'] === SectionBlock::SLOT_COLLECTION) {
|
||||
$fields[] = Radio::make("section_photos.{$sectionId}.mode")
|
||||
->label('Saisonbilder')
|
||||
->options(['replace' => 'ersetzen die Bilder des Bausteins', 'prepend' => 'kommen zuerst, danach die übrigen'])
|
||||
->default('replace')
|
||||
->inline();
|
||||
}
|
||||
}
|
||||
|
||||
$fieldsets[] = Fieldset::make(collect([$class::label(), $class::summary($stored['data'] ?? [])])->filter()->implode(' · '))
|
||||
->columns(1)
|
||||
->schema($fields);
|
||||
}
|
||||
|
||||
if ($fieldsets !== []) {
|
||||
$groups[] = Section::make($page->title)->compact()->collapsible()->schema($fieldsets);
|
||||
}
|
||||
}
|
||||
|
||||
return $groups ?: [Text::make('Auf den Seiten gibt es noch keine Bausteine mit Bildern.')];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<ColorPicker>
|
||||
*/
|
||||
public static function tokenFields(int|string|null $siteId, string $statePath = 'tokens'): array
|
||||
public static function tokenFields(int|string|null $siteId, string $statePath = 'tokens', ?string $themeKey = null): array
|
||||
{
|
||||
$theme = Site::find($siteId)?->theme ?? config('themes.base');
|
||||
$theme = $themeKey ?: (Site::find($siteId)?->theme ?? config('themes.base'));
|
||||
|
||||
return collect(app(ThemeRegistry::class)->get($theme)->tokens)
|
||||
return collect(app(ThemeRegistry::class)->tokens($theme))
|
||||
->map(fn (array $token, string $key): ColorPicker => ColorPicker::make("{$statePath}.{$key}")->label($token['label'])->placeholder($token['default']))
|
||||
->values()
|
||||
->all();
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BlockedPeriods;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\BlockedPeriods\Pages\ManageBlockedPeriods;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Property;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use UnitEnum;
|
||||
|
||||
/**
|
||||
* All blocked periods of all apartments in one place (own use, renovation, portal occupations).
|
||||
* Portal and e-mail blocks are maintained by the sync and can only be viewed here.
|
||||
*/
|
||||
class BlockedPeriodResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = BlockedPeriod::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedNoSymbol;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
|
||||
|
||||
protected static ?string $modelLabel = 'Sperrzeit';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Sperrzeiten';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(2)
|
||||
->components([
|
||||
Select::make('property_id')
|
||||
->label('Wohnung')
|
||||
->options(fn (): array => Property::query()->orderBy('name')->pluck('name', 'id')->all())
|
||||
->default(fn (): ?int => Property::query()->where('is_active', true)->value('id'))
|
||||
->required()
|
||||
->columnSpanFull()
|
||||
->hidden(fn (): bool => Property::query()->count() <= 1)
|
||||
->dehydratedWhenHidden(),
|
||||
DatePicker::make('starts_on')->label('Von (erste gesperrte Nacht)')->required(),
|
||||
DatePicker::make('ends_on')->label('Bis (erster freier Tag)')->after('starts_on')->required(),
|
||||
TextInput::make('reason')
|
||||
->label('Grund')
|
||||
->placeholder('z. B. Eigennutzung, Renovierung')
|
||||
->maxLength(255)
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->description('Zeiträume, in denen die Wohnung nicht vermietet wird. Belegungen aus Portalen erscheinen hier automatisch.')
|
||||
->defaultSort('starts_on')
|
||||
->columns([
|
||||
TextColumn::make('starts_on')->label('Von')->date('D, d.m.Y')->sortable(),
|
||||
TextColumn::make('ends_on')->label('Bis')->date('D, d.m.Y'),
|
||||
TextColumn::make('reason')->label('Grund')->placeholder('–'),
|
||||
TextColumn::make('property.name')->label('Wohnung')->visible(fn (): bool => Property::query()->count() > 1),
|
||||
TextColumn::make('source')
|
||||
->label('Quelle')
|
||||
->formatStateUsing(fn (string $state): string => match ($state) {
|
||||
'manual' => 'von Hand',
|
||||
'channel' => 'Portal-Kalender',
|
||||
'email' => 'Portal-E-Mail',
|
||||
default => $state,
|
||||
})
|
||||
->badge(),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('upcoming')
|
||||
->label('Nur kommende')
|
||||
->default()
|
||||
->query(fn (Builder $query): Builder => $query->whereDate('ends_on', '>=', today())),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->visible(fn (BlockedPeriod $record): bool => $record->source === 'manual'),
|
||||
DeleteAction::make()->visible(fn (BlockedPeriod $record): bool => $record->source === 'manual'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageBlockedPeriods::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BlockedPeriods\Pages;
|
||||
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageBlockedPeriods extends ManageRecords
|
||||
{
|
||||
protected static string $resource = BlockedPeriodResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()->label('Zeitraum sperren')->mutateDataUsing(fn (array $data): array => [...$data, 'source' => 'manual']),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Bookings;
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Bookings\Pages\CreateBooking;
|
||||
use App\Filament\Resources\Bookings\Pages\ListBookings;
|
||||
use App\Filament\Resources\Bookings\Pages\ViewBooking;
|
||||
@@ -20,6 +21,8 @@
|
||||
|
||||
class BookingResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Booking::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCalendarDays;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\ChannelTasks;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\ChannelTasks\Pages\ListChannelTasks;
|
||||
use App\Filament\Resources\ChannelTasks\Tables\ChannelTasksTable;
|
||||
use App\Models\ChannelTask;
|
||||
@@ -13,6 +14,8 @@
|
||||
|
||||
class ChannelTaskResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = ChannelTask::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedClipboardDocumentCheck;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Faqs;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Faqs\Pages\CreateFaq;
|
||||
use App\Filament\Resources\Faqs\Pages\EditFaq;
|
||||
use App\Filament\Resources\Faqs\Pages\ListFaqs;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class FaqResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Faq::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedQuestionMarkCircle;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Guests;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Guests\Pages\CreateGuest;
|
||||
use App\Filament\Resources\Guests\Pages\EditGuest;
|
||||
use App\Filament\Resources\Guests\Pages\ListGuests;
|
||||
@@ -18,6 +19,8 @@
|
||||
|
||||
class GuestResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Guest::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Notices;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Notices\Pages\CreateNotice;
|
||||
use App\Filament\Resources\Notices\Pages\EditNotice;
|
||||
use App\Filament\Resources\Notices\Pages\ListNotices;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class NoticeResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Notice::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedMegaphone;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Pages;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Pages\Pages\CreatePage;
|
||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||
use App\Filament\Resources\Pages\Pages\ListPages;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class PageResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Page::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentDuplicate;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Photos;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Photos\Pages\CreatePhoto;
|
||||
use App\Filament\Resources\Photos\Pages\EditPhoto;
|
||||
use App\Filament\Resources\Photos\Pages\ListPhotos;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class PhotoResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Photo::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPhoto;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\PortalEmails;
|
||||
|
||||
use App\Enums\PortalEmailStatus;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\PortalEmails\Pages\ListPortalEmails;
|
||||
use App\Filament\Resources\PortalEmails\Tables\PortalEmailsTable;
|
||||
use App\Models\PortalEmail;
|
||||
@@ -14,6 +15,8 @@
|
||||
|
||||
class PortalEmailResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = PortalEmail::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedEnvelopeOpen;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Properties;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Properties\Pages\CreateProperty;
|
||||
use App\Filament\Resources\Properties\Pages\EditProperty;
|
||||
use App\Filament\Resources\Properties\Pages\ListProperties;
|
||||
@@ -22,6 +23,8 @@
|
||||
|
||||
class PropertyResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Property::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedHomeModern;
|
||||
|
||||
+94
-19
@@ -3,8 +3,8 @@
|
||||
namespace App\Filament\Resources\Properties\RelationManagers;
|
||||
|
||||
use App\Enums\DiscountType;
|
||||
use App\Enums\OfferKind;
|
||||
use App\Models\SpecialOffer;
|
||||
use App\Support\Money;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
@@ -12,12 +12,14 @@
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@@ -33,10 +35,48 @@ class SpecialOffersRelationManager extends RelationManager
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Sonderangebote';
|
||||
|
||||
/**
|
||||
* Starting points for typical offers in the create form.
|
||||
*
|
||||
* @var array<string, array{label: string, values: array<string, mixed>}>
|
||||
*/
|
||||
private const PRESETS = [
|
||||
'last_minute' => ['label' => 'Last Minute (−15 %, bis 14 Tage vor Anreise)', 'values' => ['kind' => 'rule', 'name' => 'Last Minute', 'discount_type' => 'percent', 'discount_value' => 15, 'max_days_before_arrival' => 14]],
|
||||
'early_bird' => ['label' => 'Frühbucher (−5 %, ab 180 Tage vor Anreise)', 'values' => ['kind' => 'rule', 'name' => 'Frühbucher', 'discount_type' => 'percent', 'discount_value' => 5, 'min_days_before_arrival' => 180]],
|
||||
'long_stay' => ['label' => 'Längerer Aufenthalt (ab 3 Nächten −10 %)', 'values' => ['kind' => 'rule', 'name' => 'Ab 3 Nächten', 'discount_type' => 'percent', 'discount_value' => 10, 'min_nights' => 3]],
|
||||
'week' => ['label' => '7 = 6 (eine Nacht gratis ab 7 Nächten)', 'values' => ['kind' => 'rule', 'name' => '7 Nächte bleiben, 6 bezahlen', 'discount_type' => 'free_nights', 'discount_value' => 1, 'min_nights' => 7]],
|
||||
'weekend' => ['label' => 'Special Weekend (Anreise Freitag, 2 Nächte)', 'values' => ['kind' => 'rule', 'name' => 'Special Weekend', 'discount_type' => 'percent', 'discount_value' => 10, 'arrival_weekdays' => [5], 'min_nights' => 2, 'max_nights' => 2]],
|
||||
'gap' => ['label' => 'Lückenfüller (Lücken bis 4 Nächte −20 %)', 'values' => ['kind' => 'gap_filler', 'name' => 'Kurzfristige Lücke', 'discount_type' => 'percent', 'discount_value' => 20, 'max_gap_nights' => 4, 'waives_min_stay' => true]],
|
||||
'fixed_week' => ['label' => 'Fester Termin (eine Woche zum Pauschalpreis)', 'values' => ['kind' => 'fixed_dates', 'name' => 'Ostsee-Woche', 'discount_type' => 'fixed_stay_price']],
|
||||
];
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Art des Angebots')
|
||||
->columns(2)
|
||||
->schema([
|
||||
Select::make('preset')
|
||||
->label('Vorlage (optional)')
|
||||
->helperText('Füllt typische Einstellungen vor – alles bleibt änderbar.')
|
||||
->options(collect(self::PRESETS)->map(fn (array $preset): string => $preset['label'])->all())
|
||||
->dehydrated(false)
|
||||
->live()
|
||||
->afterStateUpdated(function (?string $state, Set $set): void {
|
||||
foreach (self::PRESETS[$state]['values'] ?? [] as $field => $value) {
|
||||
$set($field, $value);
|
||||
}
|
||||
})
|
||||
->visibleOn('create'),
|
||||
Radio::make('kind')
|
||||
->label('Art')
|
||||
->options(OfferKind::class)
|
||||
->default(OfferKind::Rule)
|
||||
->live()
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
Section::make('Angebot')
|
||||
->columns(2)
|
||||
->schema([
|
||||
@@ -60,24 +100,54 @@ public function form(Schema $schema): Schema
|
||||
DiscountType::AmountPerStay => 'Rabatt pro Aufenthalt',
|
||||
DiscountType::NightlyRate => 'Sonderpreis pro Nacht',
|
||||
DiscountType::FreeNights => 'Anzahl Gratis-Nächte',
|
||||
DiscountType::FixedStayPrice => 'Pauschalpreis für alle Nächte',
|
||||
})
|
||||
->suffix(fn (Get $get): string => match ($this->discountType($get)) {
|
||||
DiscountType::Percent => '%',
|
||||
DiscountType::FreeNights => 'Nächte',
|
||||
default => '€',
|
||||
})
|
||||
->helperText(fn (Get $get): ?string => $this->discountType($get) === DiscountType::FreeNights ? 'Die günstigsten Nächte des Aufenthalts sind gratis.' : null)
|
||||
->helperText(fn (Get $get): ?string => match ($this->discountType($get)) {
|
||||
DiscountType::FreeNights => 'Die günstigsten Nächte des Aufenthalts sind gratis.',
|
||||
DiscountType::FixedStayPrice => 'Übernachtungen zusammen; Endreinigung und Extras kommen dazu.',
|
||||
default => null,
|
||||
})
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->required()
|
||||
->formatStateUsing(fn (?int $state, ?SpecialOffer $record): int|string|null => $state !== null && $this->isMoney($record?->discount_type) ? number_format($state / 100, 2, '.', '') : $state)
|
||||
->dehydrateStateUsing(fn (string|int|float|null $state, Get $get): int => $this->isMoney($this->discountType($get)) ? (int) round((float) $state * 100) : (int) $state),
|
||||
->formatStateUsing(fn (?int $state, ?SpecialOffer $record): int|string|null => $state !== null && $record?->discount_type?->isMoney() ? number_format($state / 100, 2, '.', '') : $state)
|
||||
->dehydrateStateUsing(fn (string|int|float|null $state, Get $get): int => $this->discountType($get)->isMoney() ? (int) round((float) $state * 100) : (int) $state),
|
||||
Toggle::make('is_active')->label('Aktiv')->default(true),
|
||||
Toggle::make('is_public')->label('Auf der Webseite bewerben')->default(true),
|
||||
Toggle::make('is_combinable')
|
||||
->label('Mit anderen kombinierbaren Angeboten kombinierbar')
|
||||
->helperText('Sonst erhält der Gast automatisch das für ihn beste Einzelangebot.')
|
||||
->columnSpanFull(),
|
||||
->helperText('Sonst erhält der Gast automatisch das für ihn beste Einzelangebot.'),
|
||||
]),
|
||||
Section::make('Bewerbung auf der Webseite')
|
||||
->description('Welche Angebote gerade erscheinen, ergibt sich automatisch: aktiv, ohne Aktionscode, im Buchungszeitraum, feste Termine nur solange frei, Lückenfüller je gefundener Lücke. Mehrere gleichzeitig werden im Baustein „Sonderangebote“ nebeneinander, als Liste oder rollierend gezeigt.')
|
||||
->columns(3)
|
||||
->schema([
|
||||
Toggle::make('is_public')->label('Auf der Webseite bewerben')->default(true),
|
||||
Toggle::make('is_featured')->label('Hervorheben')->helperText('Steht vorne, ist farbig markiert und erscheint im Titelbereich.'),
|
||||
TextInput::make('priority')->label('Priorität')->helperText('Höher = weiter vorne')->integer()->default(0),
|
||||
]),
|
||||
Section::make('Termin')
|
||||
->description('Der Gast muss genau diesen Zeitraum buchen. Beworben wird er nur, solange er frei ist.')
|
||||
->columns(2)
|
||||
->visible(fn (Get $get): bool => $this->kind($get) === OfferKind::FixedDates)
|
||||
->schema([
|
||||
DatePicker::make('stay_from')->label('Anreise')->required(),
|
||||
DatePicker::make('stay_until')->label('Abreise')->after('stay_from')->required(),
|
||||
]),
|
||||
Section::make('Kalenderlücken')
|
||||
->description('Freie Zeiträume zwischen zwei Buchungen oder Sperrzeiten. Die Webseite zeigt bis zu drei gefundene Lücken mit Termin und Preis.')
|
||||
->columns(2)
|
||||
->visible(fn (Get $get): bool => $this->kind($get) === OfferKind::GapFiller)
|
||||
->schema([
|
||||
TextInput::make('max_gap_nights')->label('Lücken bis höchstens … Nächte')->integer()->minValue(1)->default(4)->required(),
|
||||
Toggle::make('waives_min_stay')
|
||||
->label('Mindestaufenthalt der Saison aufheben')
|
||||
->helperText('Damit auch kurze Lücken (z. B. 2 Nächte bei 5 Nächten Mindestaufenthalt) buchbar werden.')
|
||||
->default(true),
|
||||
]),
|
||||
Section::make('Bedingungen')
|
||||
->description('Leere Felder bedeuten: keine Einschränkung.')
|
||||
@@ -103,15 +173,15 @@ public function form(Schema $schema): Schema
|
||||
->helperText('Frühbucher, z. B. 180')
|
||||
->integer()
|
||||
->minValue(0),
|
||||
TextInput::make('min_nights')->label('Mindestens Nächte')->integer()->minValue(1),
|
||||
TextInput::make('max_nights')->label('Höchstens Nächte')->integer()->minValue(1),
|
||||
TextInput::make('min_nights')->label('Mindestens Nächte')->integer()->minValue(1)->hidden(fn (Get $get): bool => $this->kind($get) === OfferKind::FixedDates),
|
||||
TextInput::make('max_nights')->label('Höchstens Nächte')->integer()->minValue(1)->hidden(fn (Get $get): bool => $this->kind($get) === OfferKind::FixedDates),
|
||||
CheckboxList::make('arrival_weekdays')
|
||||
->label('Anreise nur am')
|
||||
->options([1 => 'Mo', 2 => 'Di', 3 => 'Mi', 4 => 'Do', 5 => 'Fr', 6 => 'Sa', 7 => 'So'])
|
||||
->columns(7)
|
||||
->columnSpanFull(),
|
||||
DatePicker::make('stay_from')->label('Aufenthalt frühestens ab'),
|
||||
DatePicker::make('stay_until')->label('Abreise spätestens am'),
|
||||
DatePicker::make('stay_from')->label('Aufenthalt frühestens ab')->hidden(fn (Get $get): bool => $this->kind($get) === OfferKind::FixedDates),
|
||||
DatePicker::make('stay_until')->label('Abreise spätestens am')->hidden(fn (Get $get): bool => $this->kind($get) === OfferKind::FixedDates),
|
||||
DateTimePicker::make('bookable_from')->label('Buchbar ab')->seconds(false),
|
||||
DateTimePicker::make('bookable_until')->label('Buchbar bis')->seconds(false),
|
||||
]),
|
||||
@@ -122,19 +192,22 @@ public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->defaultSort('priority', 'desc')
|
||||
->description('Sonderangebote werden bei jeder Preisberechnung automatisch geprüft und angewendet.')
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label('Angebot')
|
||||
->description(fn (SpecialOffer $record): ?string => $record->public_description),
|
||||
TextColumn::make('kind')->label('Art')->badge(),
|
||||
TextColumn::make('discount')
|
||||
->label('Vorteil')
|
||||
->state(fn (SpecialOffer $record): string => match ($record->discount_type) {
|
||||
DiscountType::Percent => "−{$record->discount_value} %",
|
||||
DiscountType::AmountPerStay => '−'.Money::format($record->discount_value),
|
||||
DiscountType::NightlyRate => Money::format($record->discount_value).' / Nacht',
|
||||
DiscountType::FreeNights => "{$record->discount_value} Nacht/Nächte gratis",
|
||||
}),
|
||||
->state(fn (SpecialOffer $record): string => $record->advantageLabel()),
|
||||
TextColumn::make('conditions')
|
||||
->label('Bedingungen')
|
||||
->state(fn (SpecialOffer $record): string => implode(' · ', $record->conditionSummary()) ?: '–')
|
||||
->wrap(),
|
||||
IconColumn::make('is_featured')->label('Hervorgehoben')->boolean(),
|
||||
TextColumn::make('priority')->label('Priorität')->sortable(),
|
||||
TextColumn::make('code')->label('Code')->placeholder('automatisch')->badge(),
|
||||
TextColumn::make('season_names')->label('Saisons')->badge()->placeholder('alle'),
|
||||
IconColumn::make('is_combinable')->label('Kombinierbar')->boolean(),
|
||||
@@ -157,8 +230,10 @@ private function discountType(Get $get): DiscountType
|
||||
return $type instanceof DiscountType ? $type : (DiscountType::tryFrom((string) $type) ?? DiscountType::Percent);
|
||||
}
|
||||
|
||||
private function isMoney(?DiscountType $type): bool
|
||||
private function kind(Get $get): OfferKind
|
||||
{
|
||||
return in_array($type, [DiscountType::AmountPerStay, DiscountType::NightlyRate], true);
|
||||
$kind = $get('kind');
|
||||
|
||||
return $kind instanceof OfferKind ? $kind : (OfferKind::tryFrom((string) $kind) ?? OfferKind::Rule);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Reviews;
|
||||
|
||||
use App\Enums\ReviewStatus;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Reviews\Pages\CreateReview;
|
||||
use App\Filament\Resources\Reviews\Pages\EditReview;
|
||||
use App\Filament\Resources\Reviews\Pages\ListReviews;
|
||||
@@ -18,6 +19,8 @@
|
||||
|
||||
class ReviewResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Review::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedStar;
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
use App\Filament\Resources\Appearances\Schemas\AppearanceForm;
|
||||
use App\Models\Site;
|
||||
use App\Themes\ThemeRegistry;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class SiteForm
|
||||
{
|
||||
@@ -29,14 +31,26 @@ public static function configure(Schema $schema): Schema
|
||||
->helperText('Leer = Standard-Website für alle Adressen ohne eigene Zuordnung.')
|
||||
->unique(ignoreRecord: true)
|
||||
->maxLength(190),
|
||||
Select::make('theme')->label('Theme')->options(fn (): array => app(ThemeRegistry::class)->options())->default(config('themes.base'))->required()->live(),
|
||||
Select::make('theme')
|
||||
->label('Theme')
|
||||
->options(fn (): array => app(ThemeRegistry::class)->options())
|
||||
->default(config('themes.base'))
|
||||
->required()
|
||||
->live()
|
||||
->helperText(fn (Get $get): ?string => filled($get('theme')) ? app(ThemeRegistry::class)->get($get('theme'))->description : null)
|
||||
->hintAction(
|
||||
Action::make('previewTheme')
|
||||
->label('Vorschau')
|
||||
->icon('heroicon-o-eye')
|
||||
->url(fn (Get $get): string => URL::temporarySignedRoute('home', now()->addDay(), ['theme' => $get('theme') ?: config('themes.base')]), shouldOpenInNewTab: true),
|
||||
),
|
||||
Toggle::make('is_default')->label('Standard-Website')->inline(false),
|
||||
]),
|
||||
Section::make('Farben des Themes')
|
||||
->description('Grundfarben dieser Website; saisonale Erscheinungsbilder können einzelne Farben zusätzlich ändern.')
|
||||
->columns(3)
|
||||
->collapsible()
|
||||
->schema(fn (Get $get, ?Site $record): array => AppearanceForm::tokenFields($record?->id, 'theme_settings.tokens')),
|
||||
->schema(fn (Get $get, ?Site $record): array => AppearanceForm::tokenFields($record?->id, 'theme_settings.tokens', $get('theme'))),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Sites;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Sites\Pages\CreateSite;
|
||||
use App\Filament\Resources\Sites\Pages\EditSite;
|
||||
use App\Filament\Resources\Sites\Pages\ListSites;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class SiteResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = Site::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedGlobeAlt;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Users\Schemas;
|
||||
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\UserRole;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -26,9 +27,15 @@ public static function configure(Schema $schema): Schema
|
||||
->maxLength(255),
|
||||
Radio::make('role')
|
||||
->label('Rolle')
|
||||
->helperText('Bestimmt, was die Person darf.')
|
||||
->options(UserRole::class)
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
Radio::make('admin_mode')
|
||||
->label('Ansicht')
|
||||
->helperText('Bestimmt nur, was im Menü erscheint. Leer = Administratoren Expertenansicht, alle anderen einfache Ansicht. Jederzeit umschaltbar über das Benutzermenü oben rechts.')
|
||||
->options(AdminMode::class)
|
||||
->columnSpanFull(),
|
||||
TextInput::make('password')
|
||||
->label(fn (string $operation): string => $operation === 'create' ? 'Passwort' : 'Neues Passwort (leer lassen = unverändert)')
|
||||
->password()
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources\Users\Tables;
|
||||
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
@@ -16,9 +21,23 @@ public static function configure(Table $table): Table
|
||||
TextColumn::make('name')->label('Name')->searchable(),
|
||||
TextColumn::make('email')->label('E-Mail')->searchable(),
|
||||
TextColumn::make('role')->label('Rolle')->badge(),
|
||||
TextColumn::make('mode')->label('Ansicht')->state(fn (User $record): string => $record->adminMode()->getLabel()),
|
||||
IconColumn::make('two_factor')->label('2FA')->state(fn (User $record): bool => filled($record->getAppAuthenticationSecret()))->boolean(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
Action::make('resetTwoFactor')
|
||||
->label('2FA zurücksetzen')
|
||||
->icon(Heroicon::OutlinedKey)
|
||||
->color('warning')
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Zum Beispiel bei verlorenem Handy: Die Person richtet die Zwei-Faktor-Anmeldung bei der nächsten Anmeldung neu ein.')
|
||||
->visible(fn (User $record): bool => filled($record->getAppAuthenticationSecret()))
|
||||
->action(function (User $record): void {
|
||||
$record->saveAppAuthenticationSecret(null);
|
||||
$record->saveAppAuthenticationRecoveryCodes(null);
|
||||
Notification::make()->title('2FA zurückgesetzt')->success()->send();
|
||||
}),
|
||||
DeleteAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Users;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Users\Pages\CreateUser;
|
||||
use App\Filament\Resources\Users\Pages\EditUser;
|
||||
use App\Filament\Resources\Users\Pages\ListUsers;
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = User::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUserGroup;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/**
|
||||
@@ -63,6 +64,19 @@ public function health(Request $request): JsonResponse
|
||||
], $ok ? 200 : 503);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the task scheduler once (fallback for hosting without suitable cron jobs).
|
||||
*/
|
||||
public function scheduler(Request $request): JsonResponse
|
||||
{
|
||||
$token = config('fewo.scheduler_token');
|
||||
abort_if(blank($token) || ! hash_equals($token, (string) $request->query('token')), 404);
|
||||
|
||||
Artisan::call('schedule:run');
|
||||
|
||||
return response()->json(['ran_at' => now()->toIso8601String(), 'output' => trim(Artisan::output())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push variant of the e-mail fast path, e.g. from an n8n IMAP trigger:
|
||||
* JSON {message_id, from, subject, text, received_at}, signed like the automation webhook.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
use Filament\Auth\MultiFactor\Http\Middleware\EnsureMultiFactorAuthenticationIsEnabled;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Filament evaluates "two-factor required" once per panel; this narrows it to administrators.
|
||||
* Other roles may set it up voluntarily in their profile.
|
||||
*/
|
||||
class RequireTwoFactorForAdmins extends EnsureMultiFactorAuthenticationIsEnabled
|
||||
{
|
||||
public function handle(Request $request, Closure $next): mixed
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
if (! $user instanceof User || ! $user->hasRole(UserRole::Admin)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return parent::handle($request, $next);
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,11 @@
|
||||
|
||||
/**
|
||||
* A seasonal look of a site (e.g. summer, winter, Christmas, New Year's Eve): colour tokens, hero photo,
|
||||
* texts and banner change – the page structure does not. The period recurs every year ("MM-DD" to "MM-DD",
|
||||
* photos per section, texts and banner change – the page structure does not (sections may be limited to
|
||||
* appearances, see SectionRegistry). Offers are advertised by their own rules (OfferShowcase). The period recurs every year ("MM-DD" to "MM-DD",
|
||||
* inclusive; a period may run over the turn of the year). The default appearance applies when none matches.
|
||||
*/
|
||||
#[Fillable(['site_id', 'name', 'starts_md', 'ends_md', 'priority', 'is_default', 'is_active', 'tokens', 'overrides', 'hero_photo_id', 'featured_offer_id'])]
|
||||
#[Fillable(['site_id', 'name', 'starts_md', 'ends_md', 'priority', 'is_default', 'is_active', 'tokens', 'overrides', 'hero_photo_id', 'section_photos'])]
|
||||
class Appearance extends Model
|
||||
{
|
||||
/** @use HasFactory<AppearanceFactory> */
|
||||
@@ -46,6 +47,7 @@ protected function casts(): array
|
||||
'is_active' => 'boolean',
|
||||
'tokens' => 'array',
|
||||
'overrides' => 'array',
|
||||
'section_photos' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -65,14 +67,6 @@ public function heroPhoto(): BelongsTo
|
||||
return $this->belongsTo(Photo::class, 'hero_photo_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<SpecialOffer, $this>
|
||||
*/
|
||||
public function featuredOffer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SpecialOffer::class, 'featured_offer_id');
|
||||
}
|
||||
|
||||
public function covers(CarbonInterface $date): bool
|
||||
{
|
||||
if ($this->starts_md === null || $this->ends_md === null) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* A page of a site, composed of sections from the catalogue (App\Themes\Sections).
|
||||
@@ -59,4 +60,34 @@ public function label(): string
|
||||
{
|
||||
return $this->menu_label ?: $this->title;
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saving(function (Page $page): void {
|
||||
$page->sections = self::assignSectionIds($page->sections ?? []);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives every placed section a stable id (data.id) – new and duplicated sections get a fresh one –
|
||||
* so appearances can address sections independently of their order.
|
||||
*
|
||||
* @param list<array{type: string, data?: array<string, mixed>}> $sections
|
||||
* @return list<array{type: string, data: array<string, mixed>}>
|
||||
*/
|
||||
public static function assignSectionIds(array $sections): array
|
||||
{
|
||||
$seen = [];
|
||||
|
||||
return array_values(array_map(function (array $section) use (&$seen): array {
|
||||
$data = $section['data'] ?? [];
|
||||
$id = $data['id'] ?? null;
|
||||
if (! is_string($id) || $id === '' || isset($seen[$id])) {
|
||||
$id = (string) Str::uuid();
|
||||
}
|
||||
$seen[$id] = true;
|
||||
|
||||
return [...$section, 'data' => [...$data, 'id' => $id]];
|
||||
}, $sections));
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\DiscountType;
|
||||
use App\Enums\OfferKind;
|
||||
use App\Pricing\StayRequest;
|
||||
use App\Support\Money;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Factories\SpecialOfferFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
@@ -14,16 +16,19 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* A discount rule such as last minute, early bird, long stay, special weekends or a code for regular guests.
|
||||
* Every condition left empty means "no restriction".
|
||||
* A discount rule such as last minute, early bird, long stay, special weekends or a code for regular guests,
|
||||
* a fixed date package or a gap filler (see OfferKind). Every condition left empty means "no restriction".
|
||||
*/
|
||||
#[Fillable([
|
||||
'property_id',
|
||||
'name',
|
||||
'kind',
|
||||
'public_description',
|
||||
'is_active',
|
||||
'is_public',
|
||||
'is_combinable',
|
||||
'priority',
|
||||
'is_featured',
|
||||
'code',
|
||||
'discount_type',
|
||||
'discount_value',
|
||||
@@ -35,6 +40,8 @@
|
||||
'max_days_before_arrival',
|
||||
'min_nights',
|
||||
'max_nights',
|
||||
'max_gap_nights',
|
||||
'waives_min_stay',
|
||||
'arrival_weekdays',
|
||||
'season_names',
|
||||
])]
|
||||
@@ -54,6 +61,9 @@ protected function casts(): array
|
||||
'is_active' => 'boolean',
|
||||
'is_public' => 'boolean',
|
||||
'is_combinable' => 'boolean',
|
||||
'is_featured' => 'boolean',
|
||||
'waives_min_stay' => 'boolean',
|
||||
'kind' => OfferKind::class,
|
||||
'discount_type' => DiscountType::class,
|
||||
'stay_from' => 'immutable_date',
|
||||
'stay_until' => 'immutable_date',
|
||||
@@ -84,13 +94,23 @@ protected function active(Builder $query): Builder
|
||||
|
||||
/**
|
||||
* Whether all conditions are met. Offers with a code only apply when the guest entered that code.
|
||||
* $gapNights is the length of the calendar gap containing the stay (null = not inside a gap); it only
|
||||
* matters for gap fillers.
|
||||
*/
|
||||
public function appliesTo(StayRequest $stay, string $arrivalSeasonName, CarbonImmutable $bookedAt): bool
|
||||
public function appliesTo(StayRequest $stay, string $arrivalSeasonName, CarbonImmutable $bookedAt, ?int $gapNights = null): bool
|
||||
{
|
||||
$nights = $stay->nights();
|
||||
$daysBeforeArrival = (int) $bookedAt->startOfDay()->diffInDays($stay->arrival, false);
|
||||
|
||||
$kindMatches = match ($this->kind ?? OfferKind::Rule) {
|
||||
OfferKind::Rule => true,
|
||||
OfferKind::FixedDates => $this->stay_from !== null && $this->stay_until !== null
|
||||
&& $stay->arrival->isSameDay($this->stay_from) && $stay->departure->isSameDay($this->stay_until),
|
||||
OfferKind::GapFiller => $gapNights !== null && ($this->max_gap_nights === null || $gapNights <= $this->max_gap_nights),
|
||||
};
|
||||
|
||||
return $this->is_active
|
||||
&& $kindMatches
|
||||
&& ($this->code === null || strcasecmp($this->code, (string) $stay->promoCode) === 0)
|
||||
&& ($this->stay_from === null || $stay->arrival->greaterThanOrEqualTo($this->stay_from))
|
||||
&& ($this->stay_until === null || $stay->departure->lessThanOrEqualTo($this->stay_until))
|
||||
@@ -118,11 +138,55 @@ public function discountFor(array $nightlyRates): int
|
||||
DiscountType::AmountPerStay => $this->discount_value,
|
||||
DiscountType::NightlyRate => array_sum(array_map(fn (int $rate): int => max(0, $rate - $this->discount_value), $nightlyRates)),
|
||||
DiscountType::FreeNights => array_sum(array_slice($this->sortedAscending($nightlyRates), 0, $this->discount_value)),
|
||||
DiscountType::FixedStayPrice => max(0, $accommodation - $this->discount_value),
|
||||
};
|
||||
|
||||
return min($discount, $accommodation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Short label of the advantage, e.g. "−10 %", "59,00 € / Nacht" or "Pauschal 560,00 €".
|
||||
*/
|
||||
public function advantageLabel(): string
|
||||
{
|
||||
return match ($this->discount_type) {
|
||||
DiscountType::Percent => "−{$this->discount_value} %",
|
||||
DiscountType::AmountPerStay => '−'.Money::format($this->discount_value),
|
||||
DiscountType::NightlyRate => Money::format($this->discount_value).' / Nacht',
|
||||
DiscountType::FreeNights => $this->discount_value === 1 ? '1 Nacht gratis' : "{$this->discount_value} Nächte gratis",
|
||||
DiscountType::FixedStayPrice => 'Pauschal '.Money::format($this->discount_value),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The conditions in plain German for guests, e.g. ["ab 3 Nächten", "Anreise freitags", "bis 14 Tage vor Anreise"].
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function conditionSummary(): array
|
||||
{
|
||||
$weekdays = [1 => 'montags', 2 => 'dienstags', 3 => 'mittwochs', 4 => 'donnerstags', 5 => 'freitags', 6 => 'samstags', 7 => 'sonntags'];
|
||||
|
||||
return array_values(array_filter([
|
||||
match (true) {
|
||||
$this->kind === OfferKind::FixedDates => null,
|
||||
$this->min_nights !== null && $this->max_nights !== null && $this->min_nights === $this->max_nights => "genau {$this->min_nights} Nächte",
|
||||
$this->min_nights !== null && $this->max_nights !== null => "{$this->min_nights} bis {$this->max_nights} Nächte",
|
||||
$this->min_nights !== null => "ab {$this->min_nights} Nächten",
|
||||
$this->max_nights !== null => "bis {$this->max_nights} Nächte",
|
||||
default => null,
|
||||
},
|
||||
empty($this->arrival_weekdays) ? null : 'Anreise '.collect($this->arrival_weekdays)->map(fn ($day): string => $weekdays[(int) $day] ?? '')->implode(' oder '),
|
||||
$this->max_days_before_arrival !== null ? "Buchung bis {$this->max_days_before_arrival} Tage vor Anreise" : null,
|
||||
$this->min_days_before_arrival !== null ? "Buchung mindestens {$this->min_days_before_arrival} Tage vor Anreise" : null,
|
||||
empty($this->season_names) ? null : 'Anreise in: '.implode(', ', $this->season_names),
|
||||
$this->kind !== OfferKind::FixedDates && ($this->stay_from || $this->stay_until)
|
||||
? 'Reisezeitraum '.($this->stay_from?->format('d.m.Y') ?? 'ab sofort').' – '.($this->stay_until?->format('d.m.Y') ?? 'offen')
|
||||
: null,
|
||||
$this->bookable_until !== null ? 'buchbar bis '.$this->bookable_until->format('d.m.Y') : null,
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<int> $rates
|
||||
* @return list<int>
|
||||
|
||||
+17
-3
@@ -3,8 +3,13 @@
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\UserRole;
|
||||
use Database\Factories\UserFactory;
|
||||
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthentication;
|
||||
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthenticationRecovery;
|
||||
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
|
||||
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
@@ -13,12 +18,12 @@
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
#[Fillable(['name', 'email', 'role', 'password'])]
|
||||
#[Fillable(['name', 'email', 'role', 'admin_mode', 'password'])]
|
||||
#[Hidden(['password', 'remember_token'])]
|
||||
class User extends Authenticatable implements FilamentUser
|
||||
class User extends Authenticatable implements FilamentUser, HasAppAuthentication, HasAppAuthenticationRecovery
|
||||
{
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
use HasFactory, InteractsWithAppAuthentication, InteractsWithAppAuthenticationRecovery, Notifiable;
|
||||
|
||||
/**
|
||||
* Accounts are created by administrators only; an account without a role has no access.
|
||||
@@ -28,6 +33,14 @@ public function canAccessPanel(Panel $panel): bool
|
||||
return $this->role !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The admin menu this user sees; without an explicit choice administrators get the expert mode.
|
||||
*/
|
||||
public function adminMode(): AdminMode
|
||||
{
|
||||
return $this->admin_mode ?? ($this->hasRole(UserRole::Admin) ? AdminMode::Expert : AdminMode::Simple);
|
||||
}
|
||||
|
||||
public function hasRole(UserRole ...$roles): bool
|
||||
{
|
||||
return in_array($this->role, $roles, true);
|
||||
@@ -44,6 +57,7 @@ protected function casts(): array
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'role' => UserRole::class,
|
||||
'admin_mode' => AdminMode::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
|
||||
class BlockedPeriodPolicy extends RolePolicy
|
||||
{
|
||||
protected function roles(): array
|
||||
{
|
||||
return [UserRole::Rentals];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Pricing;
|
||||
|
||||
use App\Models\SpecialOffer;
|
||||
use Carbon\CarbonImmutable;
|
||||
|
||||
/**
|
||||
* An offer as the website shows it: for fixed dates and gap fillers with concrete dates and an example price.
|
||||
*/
|
||||
final readonly class AdvertisedOffer
|
||||
{
|
||||
/**
|
||||
* @param list<string> $conditions
|
||||
*/
|
||||
public function __construct(
|
||||
public SpecialOffer $offer,
|
||||
public string $title,
|
||||
public ?string $description,
|
||||
public string $advantage,
|
||||
public array $conditions,
|
||||
public ?CarbonImmutable $arrival = null,
|
||||
public ?CarbonImmutable $departure = null,
|
||||
public ?PriceQuote $quote = null,
|
||||
) {}
|
||||
|
||||
public function nights(): ?int
|
||||
{
|
||||
return $this->arrival && $this->departure ? (int) $this->arrival->diffInDays($this->departure) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Price before the discount (accommodation, extra guests, cleaning) – for "statt …".
|
||||
*/
|
||||
public function regularTotal(): ?int
|
||||
{
|
||||
return $this->quote ? $this->quote->total() + $this->quote->discount() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to the booking page, with the dates filled in when the offer has concrete dates.
|
||||
*/
|
||||
public function bookingUrl(): string
|
||||
{
|
||||
return route('booking.create', array_filter([
|
||||
'anreise' => $this->arrival?->toDateString(),
|
||||
'abreise' => $this->departure?->toDateString(),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stable key for the view (an offer can appear several times with different gaps).
|
||||
*/
|
||||
public function key(): string
|
||||
{
|
||||
return $this->offer->id.'-'.($this->arrival?->toDateString() ?? 'rule');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace App\Pricing;
|
||||
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Availability\GapFinder;
|
||||
use App\Enums\OfferKind;
|
||||
use App\Enums\QuoteLineType;
|
||||
use App\Models\Property;
|
||||
use App\Models\SpecialOffer;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Which offers the website advertises right now – independent of the seasonal appearance.
|
||||
*
|
||||
* Shown are active, public offers without a code whose booking window is open. Fixed dates only while they
|
||||
* are still free; gap fillers once per free gap found in the calendar. Fixed dates and gaps are priced
|
||||
* with PriceCalculator, so the advertised price is exactly what the guest is quoted. Order: highlighted
|
||||
* first, then priority, then the earliest date.
|
||||
*/
|
||||
class OfferShowcase
|
||||
{
|
||||
/** Gap fillers without a lead time limit look this many days ahead. */
|
||||
public const GAP_HORIZON_DAYS = 60;
|
||||
|
||||
/** At most this many gaps per gap filler. */
|
||||
public const GAPS_PER_OFFER = 3;
|
||||
|
||||
public function __construct(
|
||||
private PriceCalculator $calculator,
|
||||
private AvailabilityChecker $availability = new AvailabilityChecker,
|
||||
private GapFinder $gaps = new GapFinder,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return Collection<int, AdvertisedOffer>
|
||||
*/
|
||||
public function current(Property $property, ?CarbonImmutable $now = null, ?int $limit = null, bool $featuredOnly = false): Collection
|
||||
{
|
||||
$now ??= CarbonImmutable::now();
|
||||
$today = $now->startOfDay();
|
||||
|
||||
$offers = $property->specialOffers()
|
||||
->active()
|
||||
->where('is_public', true)
|
||||
->whereNull('code')
|
||||
->when($featuredOnly, fn ($query) => $query->where('is_featured', true))
|
||||
->where(fn ($query) => $query->whereNull('bookable_from')->orWhere('bookable_from', '<=', $now))
|
||||
->where(fn ($query) => $query->whereNull('bookable_until')->orWhere('bookable_until', '>=', $now))
|
||||
->get();
|
||||
|
||||
$advertised = $offers->flatMap(fn (SpecialOffer $offer): array => match ($offer->kind ?? OfferKind::Rule) {
|
||||
OfferKind::Rule => $this->rule($offer, $today),
|
||||
OfferKind::FixedDates => $this->fixedDates($property, $offer, $now),
|
||||
OfferKind::GapFiller => $this->gapFiller($property, $offer, $now),
|
||||
});
|
||||
|
||||
$sorted = $advertised->sortBy([
|
||||
fn (AdvertisedOffer $a, AdvertisedOffer $b): int => $b->offer->is_featured <=> $a->offer->is_featured,
|
||||
fn (AdvertisedOffer $a, AdvertisedOffer $b): int => $b->offer->priority <=> $a->offer->priority,
|
||||
fn (AdvertisedOffer $a, AdvertisedOffer $b): int => ($a->arrival?->getTimestamp() ?? PHP_INT_MAX) <=> ($b->arrival?->getTimestamp() ?? PHP_INT_MAX),
|
||||
])->values();
|
||||
|
||||
return $limit ? $sorted->take($limit)->values() : $sorted;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<AdvertisedOffer>
|
||||
*/
|
||||
private function rule(SpecialOffer $offer, CarbonImmutable $today): array
|
||||
{
|
||||
if ($offer->stay_until !== null && $offer->stay_until->lessThanOrEqualTo($today)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [$this->advertised($offer)];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<AdvertisedOffer>
|
||||
*/
|
||||
private function fixedDates(Property $property, SpecialOffer $offer, CarbonImmutable $now): array
|
||||
{
|
||||
if ($offer->stay_from === null || $offer->stay_until === null || $offer->stay_from->lessThanOrEqualTo($now->startOfDay())) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (! $this->availability->isAvailable($property, $offer->stay_from, $offer->stay_until)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$quote = $this->pricedWith($property, $offer, $offer->stay_from, $offer->stay_until, $now);
|
||||
|
||||
return $quote ? [$this->advertised($offer, $offer->stay_from, $offer->stay_until, $quote)] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<AdvertisedOffer>
|
||||
*/
|
||||
private function gapFiller(Property $property, SpecialOffer $offer, CarbonImmutable $now): array
|
||||
{
|
||||
$today = $now->startOfDay();
|
||||
$from = $today->addDays(max(1, $offer->min_days_before_arrival ?? 1));
|
||||
$until = $today->addDays($offer->max_days_before_arrival ?? self::GAP_HORIZON_DAYS)->addDay();
|
||||
if ($offer->stay_from !== null && $offer->stay_from->greaterThan($from)) {
|
||||
$from = $offer->stay_from;
|
||||
}
|
||||
|
||||
$advertised = [];
|
||||
foreach ($this->gaps->gaps($property, $from, $until, $offer->max_gap_nights ?? 7) as [$arrival, $departure]) {
|
||||
$quote = $this->pricedWith($property, $offer, $arrival, $departure, $now);
|
||||
if ($quote !== null) {
|
||||
$advertised[] = $this->advertised($offer, $arrival, $departure, $quote);
|
||||
}
|
||||
|
||||
if (count($advertised) >= self::GAPS_PER_OFFER) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $advertised;
|
||||
}
|
||||
|
||||
/**
|
||||
* The quote for the stay, if the offer is actually applied to it (it may lose against a better offer
|
||||
* or fail a condition such as the minimum stay); priced for the number of guests included in the rent.
|
||||
*/
|
||||
private function pricedWith(Property $property, SpecialOffer $offer, CarbonImmutable $arrival, CarbonImmutable $departure, CarbonImmutable $now): ?PriceQuote
|
||||
{
|
||||
$quote = rescue(
|
||||
fn (): PriceQuote => $this->calculator->calculate($property, new StayRequest($arrival, $departure, max(1, $property->included_guests)), $now),
|
||||
null,
|
||||
false,
|
||||
);
|
||||
|
||||
$applied = $quote !== null && collect($quote->lines)
|
||||
->contains(fn (QuoteLine $line): bool => $line->type === QuoteLineType::Discount && $line->label === $offer->name);
|
||||
|
||||
return $applied ? $quote : null;
|
||||
}
|
||||
|
||||
private function advertised(SpecialOffer $offer, ?CarbonImmutable $arrival = null, ?CarbonImmutable $departure = null, ?PriceQuote $quote = null): AdvertisedOffer
|
||||
{
|
||||
return new AdvertisedOffer(
|
||||
offer: $offer,
|
||||
title: $offer->name,
|
||||
description: $offer->public_description,
|
||||
advantage: $offer->advantageLabel(),
|
||||
conditions: $offer->conditionSummary(),
|
||||
arrival: $arrival,
|
||||
departure: $departure,
|
||||
quote: $quote,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Pricing;
|
||||
|
||||
use App\Availability\GapFinder;
|
||||
use App\Enums\ExtraPricing;
|
||||
use App\Enums\OfferKind;
|
||||
use App\Enums\QuoteLineType;
|
||||
use App\Models\Extra;
|
||||
use App\Models\Property;
|
||||
@@ -13,6 +15,8 @@
|
||||
|
||||
class PriceCalculator
|
||||
{
|
||||
public function __construct(private GapFinder $gaps = new GapFinder) {}
|
||||
|
||||
/**
|
||||
* Price a stay. Special offers are applied automatically; $bookedAt (default: now) decides
|
||||
* time-dependent offers such as last minute or early bird.
|
||||
@@ -32,14 +36,18 @@ public function calculate(Property $property, StayRequest $stay, ?CarbonImmutabl
|
||||
$nights = $stay->nights();
|
||||
$nightSeasons = $this->seasonPerNight($property, $stay);
|
||||
|
||||
$bookedAt ??= CarbonImmutable::now();
|
||||
$offers = $this->applicableOffers($property, $stay, $nightSeasons, $bookedAt);
|
||||
|
||||
$arrivalSeason = $nightSeasons[0];
|
||||
if ($nights < $arrivalSeason->min_nights) {
|
||||
$minimumStayWaived = $offers->contains(fn (SpecialOffer $offer): bool => $offer->waives_min_stay && $offer->kind === OfferKind::GapFiller);
|
||||
if ($nights < $arrivalSeason->min_nights && ! $minimumStayWaived) {
|
||||
throw QuoteException::minimumStay($arrivalSeason->min_nights, $arrivalSeason->name);
|
||||
}
|
||||
|
||||
$lines = $this->accommodationLines($nightSeasons);
|
||||
|
||||
$appliedOffers = $this->bestOffers($property, $stay, $nightSeasons, $bookedAt ?? CarbonImmutable::now());
|
||||
$appliedOffers = $this->bestOffers($offers, $nightSeasons);
|
||||
foreach ($appliedOffers as ['offer' => $offer, 'discount' => $discount]) {
|
||||
$lines[] = new QuoteLine(QuoteLineType::Discount, $offer->name, 1, -$discount, -$discount);
|
||||
}
|
||||
@@ -117,20 +125,37 @@ private function accommodationLines(array $nightSeasons): array
|
||||
), $runs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Active offers whose conditions the stay meets. The calendar gap is only looked up if a gap filler exists.
|
||||
*
|
||||
* @param non-empty-list<Season> $nightSeasons
|
||||
* @return Collection<int, SpecialOffer>
|
||||
*/
|
||||
private function applicableOffers(Property $property, StayRequest $stay, array $nightSeasons, CarbonImmutable $bookedAt): Collection
|
||||
{
|
||||
$offers = $property->specialOffers()->active()->get();
|
||||
|
||||
$gapNights = $offers->contains(fn (SpecialOffer $offer): bool => $offer->kind === OfferKind::GapFiller)
|
||||
? $this->gaps->gapContaining($property, $stay->arrival, $stay->departure)
|
||||
: null;
|
||||
|
||||
return $offers->filter(fn (SpecialOffer $offer): bool => $offer->appliesTo($stay, $nightSeasons[0]->name, $bookedAt, $gapNights))->values();
|
||||
}
|
||||
|
||||
/**
|
||||
* The guest gets whichever is cheaper for them: the single best non-combinable offer,
|
||||
* or all combinable offers together (capped at the accommodation price).
|
||||
*
|
||||
* @param Collection<int, SpecialOffer> $offers
|
||||
* @param non-empty-list<Season> $nightSeasons
|
||||
* @return list<array{offer: SpecialOffer, discount: int}>
|
||||
*/
|
||||
private function bestOffers(Property $property, StayRequest $stay, array $nightSeasons, CarbonImmutable $bookedAt): array
|
||||
private function bestOffers(Collection $offers, array $nightSeasons): array
|
||||
{
|
||||
$nightlyRates = array_map(fn (Season $season): int => $season->nightly_rate, $nightSeasons);
|
||||
$accommodation = array_sum($nightlyRates);
|
||||
|
||||
$candidates = $property->specialOffers()->active()->get()
|
||||
->filter(fn (SpecialOffer $offer): bool => $offer->appliesTo($stay, $nightSeasons[0]->name, $bookedAt))
|
||||
$candidates = $offers
|
||||
->map(fn (SpecialOffer $offer): array => ['offer' => $offer, 'discount' => $offer->discountFor($nightlyRates)])
|
||||
->filter(fn (array $candidate): bool => $candidate['discount'] > 0);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@@ -19,6 +20,11 @@ public function register(): void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
// On Strato the domain points at the deployment folder and .htaccess forwards to current/public;
|
||||
// without a fixed root, some URLs (e.g. /sitemap.xml) would be generated with /current/public.
|
||||
if (! $this->app->environment('local', 'testing')) {
|
||||
URL::forceRootUrl(config('app.url'));
|
||||
URL::forceScheme(parse_url((string) config('app.url'), PHP_URL_SCHEME) ?: 'https');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Enums\AdminMode;
|
||||
use App\Http\Middleware\RequireTwoFactorForAdmins;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
@@ -10,6 +16,7 @@
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Widgets\AccountWidget;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
@@ -20,6 +27,13 @@
|
||||
|
||||
class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
private static function currentUser(): ?User
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
return $user instanceof User ? $user : null;
|
||||
}
|
||||
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
return $panel
|
||||
@@ -27,6 +41,24 @@ public function panel(Panel $panel): Panel
|
||||
->id('admin')
|
||||
->path('admin')
|
||||
->login()
|
||||
->profile(isSimple: false)
|
||||
// Two-factor login with an authenticator app (TOTP) and recovery codes; mandatory for administrators.
|
||||
->multiFactorAuthentication(
|
||||
[AppAuthentication::make()->brandName('FeWo Stommer')->recoverable()],
|
||||
isRequired: true,
|
||||
)
|
||||
->multiFactorAuthenticationRequiredMiddlewareName(RequireTwoFactorForAdmins::class)
|
||||
->userMenuItems([
|
||||
'admin-mode' => Action::make('switchAdminMode')
|
||||
->label(fn (): string => (self::currentUser()?->adminMode() ?? AdminMode::Expert)->other()->switchLabel())
|
||||
->icon(fn (): Heroicon => self::currentUser()?->adminMode() === AdminMode::Simple ? Heroicon::OutlinedAdjustmentsHorizontal : Heroicon::OutlinedSparkles)
|
||||
->action(function () {
|
||||
$user = self::currentUser();
|
||||
$user?->forceFill(['admin_mode' => $user->adminMode()->other()])->save();
|
||||
|
||||
return redirect(url()->previous());
|
||||
}),
|
||||
])
|
||||
->brandName('FeWo Stommer · Verwaltung')
|
||||
->navigationGroups(['Vermietung', 'Webseite', 'System'])
|
||||
->colors([
|
||||
|
||||
@@ -2,13 +2,19 @@
|
||||
|
||||
namespace App\Themes;
|
||||
|
||||
use App\Models\Appearance;
|
||||
use App\Themes\Sections\Section;
|
||||
use Filament\Forms\Components\Builder\Block;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\View as ViewFactory;
|
||||
|
||||
/**
|
||||
* The section catalogue from config/themes.php: builder blocks for the admin and rendering for the website.
|
||||
*
|
||||
* Every placed section carries data.id (a stable UUID, see Page::assignSectionIds) so appearances can
|
||||
* address it, and data.appearances (appearance ids; empty = always shown).
|
||||
*/
|
||||
class SectionRegistry
|
||||
{
|
||||
@@ -36,13 +42,33 @@ public function blocks(): array
|
||||
{
|
||||
return array_values(array_map(
|
||||
fn (string $class): Block => Block::make($class::key())
|
||||
->label($class::label())
|
||||
->label(fn (?array $state): string => $this->blockLabel($class, $state))
|
||||
->icon($class::icon())
|
||||
->schema($class::schema()),
|
||||
->schema([
|
||||
Hidden::make('id'),
|
||||
...$class::schema(),
|
||||
Select::make('appearances')
|
||||
->label('Nur anzeigen im Erscheinungsbild')
|
||||
->helperText('Leer = immer anzeigen. Z. B. ein Weihnachts-Baustein nur im Erscheinungsbild „Weihnachten“.')
|
||||
->options(fn (): array => Appearance::query()->orderByDesc('is_default')->orderBy('name')->pluck('name', 'id')->all())
|
||||
->multiple(),
|
||||
]),
|
||||
$this->all(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a placed section is shown with the active appearance.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public function isVisible(Theme $theme, array $data): bool
|
||||
{
|
||||
$appearances = array_map('intval', array_filter((array) ($data['appearances'] ?? [])));
|
||||
|
||||
return $appearances === [] || ($theme->appearance !== null && in_array($theme->appearance->id, $appearances, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the stored sections of a page; unknown or failing types are skipped (and reported),
|
||||
* so a page never breaks because of one section.
|
||||
@@ -55,7 +81,7 @@ public function render(Theme $theme, ?array $sections): array
|
||||
$views = [];
|
||||
foreach ($sections ?? [] as $index => $stored) {
|
||||
$section = $this->get($stored['type'] ?? '');
|
||||
if ($section === null || ! ViewFactory::exists($section->view())) {
|
||||
if ($section === null || ! ViewFactory::exists($section->view()) || ! $this->isVisible($theme, $stored['data'] ?? [])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -68,4 +94,22 @@ public function render(Theme $theme, ?array $sections): array
|
||||
|
||||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Text mit Bild · Ihr Zuhause an der Ostsee · nur: Winter" for the collapsed builder item.
|
||||
*
|
||||
* @param class-string<Section> $class
|
||||
* @param array<string, mixed>|null $state
|
||||
*/
|
||||
private function blockLabel(string $class, ?array $state): string
|
||||
{
|
||||
if ($state === null) {
|
||||
return $class::label();
|
||||
}
|
||||
|
||||
$appearances = array_filter((array) ($state['appearances'] ?? []));
|
||||
$only = $appearances === [] ? null : 'nur: '.Appearance::query()->whereKey($appearances)->pluck('name')->implode(', ');
|
||||
|
||||
return collect([$class::label(), $class::summary($state), $only])->filter()->implode(' · ');
|
||||
}
|
||||
}
|
||||
@@ -38,12 +38,17 @@ public static function schema(): array
|
||||
];
|
||||
}
|
||||
|
||||
public static function photoSlots(): array
|
||||
{
|
||||
return ['photo_id' => ['label' => 'Hintergrundfoto', 'type' => self::SLOT_SINGLE]];
|
||||
}
|
||||
|
||||
public function data(Theme $theme, array $data): array
|
||||
{
|
||||
return [
|
||||
'title' => $theme->text('cta.title', $data['title'] ?? null),
|
||||
'text' => $theme->text('cta.text', $data['text'] ?? null),
|
||||
'photo' => isset($data['photo_id']) ? Photo::find($data['photo_id']) : null,
|
||||
'photo' => $this->seasonalPhoto($theme, $data, 'photo_id') ?? (isset($data['photo_id']) ? Photo::find($data['photo_id']) : null),
|
||||
'buttonLabel' => $data['button_label'] ?? 'Belegung & Preise',
|
||||
'buttonUrl' => $this->pageUrl($data['button_page'] ?? null) ?? route('booking.create'),
|
||||
];
|
||||
|
||||
@@ -37,16 +37,21 @@ public static function schema(): array
|
||||
];
|
||||
}
|
||||
|
||||
public static function photoSlots(): array
|
||||
{
|
||||
return ['photo_ids' => ['label' => 'Galerie', 'type' => self::SLOT_COLLECTION]];
|
||||
}
|
||||
|
||||
public function data(Theme $theme, array $data): array
|
||||
{
|
||||
$category = PhotoCategory::tryFrom($data['category'] ?? '');
|
||||
|
||||
return [
|
||||
'heading' => $data['heading'] ?? null,
|
||||
'photos' => Photo::query()->published()->with('media')
|
||||
'photos' => $this->withSeasonalPhotos($theme, $data, 'photo_ids', Photo::query()->published()->with('media')
|
||||
->when($category, fn ($query) => $query->where('category', $category))
|
||||
->when(filled($data['limit'] ?? null), fn ($query) => $query->limit((int) $data['limit']))
|
||||
->get(),
|
||||
->get()),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Themes\Sections;
|
||||
|
||||
use App\Models\Photo;
|
||||
use App\Pricing\OfferShowcase;
|
||||
use App\Themes\Theme;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -36,18 +37,31 @@ public static function schema(): array
|
||||
Textarea::make('text')->label('Text')->rows(2)->maxLength(400),
|
||||
static::photoSelect('photo_id', 'Foto (wenn das Erscheinungsbild keins vorgibt)'),
|
||||
Toggle::make('show_search')->label('Verfügbarkeitssuche anzeigen')->default(true),
|
||||
Toggle::make('show_offer')
|
||||
->label('Hervorgehobenes Sonderangebot im Titelbereich zeigen')
|
||||
->helperText('Das wichtigste als „hervorgehoben“ markierte Angebot, sofern gerade eins gilt.')
|
||||
->default(true),
|
||||
];
|
||||
}
|
||||
|
||||
public static function photoSlots(): array
|
||||
{
|
||||
return ['photo_id' => ['label' => 'Foto', 'type' => self::SLOT_SINGLE]];
|
||||
}
|
||||
|
||||
public function data(Theme $theme, array $data): array
|
||||
{
|
||||
$fallback = isset($data['photo_id']) ? Photo::find($data['photo_id']) : Photo::query()->published()->first();
|
||||
$featuredOffer = ($data['show_offer'] ?? true) && $theme->property()
|
||||
? app(OfferShowcase::class)->current($theme->property(), limit: 1, featuredOnly: true)->first()
|
||||
: null;
|
||||
|
||||
return [
|
||||
'eyebrow' => $theme->text('hero.eyebrow', $data['eyebrow'] ?? null),
|
||||
'title' => $theme->text('hero.title', $data['title'] ?? $theme->site->name),
|
||||
'text' => $theme->text('hero.text', $data['text'] ?? null),
|
||||
'photo' => $theme->heroPhoto($fallback),
|
||||
'photo' => $this->seasonalPhoto($theme, $data, 'photo_id') ?? $theme->heroPhoto($fallback),
|
||||
'featuredOffer' => $featuredOffer,
|
||||
'showSearch' => (bool) ($data['show_search'] ?? true),
|
||||
'property' => $theme->property(),
|
||||
];
|
||||
|
||||
@@ -39,6 +39,11 @@ public static function schema(): array
|
||||
];
|
||||
}
|
||||
|
||||
public static function photoSlots(): array
|
||||
{
|
||||
return ['photo_ids' => ['label' => 'Bilder der Umgebung', 'type' => self::SLOT_COLLECTION]];
|
||||
}
|
||||
|
||||
public function data(Theme $theme, array $data): array
|
||||
{
|
||||
$address = $theme->property()?->address;
|
||||
@@ -50,7 +55,7 @@ public function data(Theme $theme, array $data): array
|
||||
'address' => $address,
|
||||
'mapUrl' => $address ? 'https://www.openstreetmap.org/search?query='.rawurlencode($address) : null,
|
||||
'photos' => ($data['show_photos'] ?? true)
|
||||
? Photo::query()->published()->with('media')->where('category', PhotoCategory::Area)->limit(6)->get()
|
||||
? $this->withSeasonalPhotos($theme, $data, 'photo_ids', Photo::query()->published()->with('media')->where('category', PhotoCategory::Area)->limit(6)->get())
|
||||
: collect(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2,15 +2,24 @@
|
||||
|
||||
namespace App\Themes\Sections;
|
||||
|
||||
use App\Models\SpecialOffer;
|
||||
use App\Pricing\OfferShowcase;
|
||||
use App\Themes\Theme;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
|
||||
/**
|
||||
* Public special offers (active, promoted, without code); the appearance's featured offer comes first.
|
||||
* The offers OfferShowcase advertises right now (independent of the appearance), shown side by side,
|
||||
* as a list or one after another (rotating). The section disappears when there is no current offer.
|
||||
*/
|
||||
class OffersSection extends Section
|
||||
{
|
||||
public const DISPLAYS = [
|
||||
'grid' => 'Nebeneinander (Kacheln)',
|
||||
'list' => 'Untereinander (Liste)',
|
||||
'rotating' => 'Rollierend (eins nach dem anderen)',
|
||||
];
|
||||
|
||||
public static function key(): string
|
||||
{
|
||||
return 'offers';
|
||||
@@ -30,27 +39,22 @@ public static function schema(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('heading')->label('Überschrift')->default('Aktuelle Angebote')->maxLength(120),
|
||||
Radio::make('display')->label('Darstellung, wenn mehrere Angebote gelten')->options(self::DISPLAYS)->default('grid'),
|
||||
TextInput::make('limit')->label('Höchstens anzeigen')->integer()->minValue(1)->maxValue(12)->default(6),
|
||||
Toggle::make('featured_only')->label('Nur hervorgehobene Angebote')->default(false),
|
||||
];
|
||||
}
|
||||
|
||||
public function data(Theme $theme, array $data): array
|
||||
{
|
||||
$offers = $theme->property()?->specialOffers()
|
||||
->active()
|
||||
->where('is_public', true)
|
||||
->whereNull('code')
|
||||
->where(fn ($query) => $query->whereNull('bookable_until')->orWhere('bookable_until', '>=', now()))
|
||||
->get() ?? collect();
|
||||
|
||||
$featured = $theme->appearance?->featuredOffer;
|
||||
if ($featured) {
|
||||
$offers = $offers->reject(fn (SpecialOffer $offer): bool => $offer->is($featured))->prepend($featured);
|
||||
}
|
||||
$property = $theme->property();
|
||||
|
||||
return [
|
||||
'heading' => $data['heading'] ?? null,
|
||||
'offers' => $offers,
|
||||
'featuredId' => $featured?->id,
|
||||
'display' => array_key_exists($data['display'] ?? '', self::DISPLAYS) ? $data['display'] : 'grid',
|
||||
'offers' => $property
|
||||
? app(OfferShowcase::class)->current($property, limit: (int) ($data['limit'] ?? 6) ?: 6, featuredOnly: (bool) ($data['featured_only'] ?? false))
|
||||
: collect(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Themes\Sections;
|
||||
|
||||
use App\Filament\Forms\Components\PhotoSelect;
|
||||
use App\Models\Page;
|
||||
use App\Models\Photo;
|
||||
use App\Themes\Theme;
|
||||
@@ -17,6 +18,15 @@
|
||||
*/
|
||||
abstract class Section
|
||||
{
|
||||
/** One photo (field holds a photo id). */
|
||||
public const SLOT_SINGLE = 'single';
|
||||
|
||||
/** Several chosen photos (field holds a list of ids). */
|
||||
public const SLOT_MULTIPLE = 'multiple';
|
||||
|
||||
/** Photos picked automatically (e.g. by category); an appearance may replace or precede them. */
|
||||
public const SLOT_COLLECTION = 'collection';
|
||||
|
||||
abstract public static function key(): string;
|
||||
|
||||
abstract public static function label(): string;
|
||||
@@ -39,6 +49,28 @@ public static function schema(): array
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Photo places an appearance can fill with seasonal photos ("Bilder je Baustein").
|
||||
*
|
||||
* @return array<string, array{label: string, type: string, max?: int}>
|
||||
*/
|
||||
public static function photoSlots(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Short text identifying a placed section in admin lists, e.g. its heading.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public static function summary(array $data): ?string
|
||||
{
|
||||
$text = $data['heading'] ?? $data['title'] ?? null;
|
||||
|
||||
return filled($text) ? str(strip_tags((string) $text))->replace('*', '')->limit(50)->toString() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Variables for the view.
|
||||
*
|
||||
@@ -75,6 +107,55 @@ protected function photos(?array $ids): Collection
|
||||
return new Collection(array_values(array_filter(array_map(fn ($id) => $photos->get((int) $id), $ids))));
|
||||
}
|
||||
|
||||
/**
|
||||
* The seasonal photo the active appearance sets for a single slot of this placed section.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
protected function seasonalPhoto(Theme $theme, array $data, string $slot): ?Photo
|
||||
{
|
||||
return $this->seasonalPhotos($theme, $data, $slot)?->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* The seasonal photos the active appearance sets for a slot of this placed section, null if none.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return Collection<int, Photo>|null
|
||||
*/
|
||||
protected function seasonalPhotos(Theme $theme, array $data, string $slot): ?Collection
|
||||
{
|
||||
$ids = $theme->sectionPhotoIds($data['id'] ?? null, $slot);
|
||||
if ($ids === []) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$photos = $this->photos($ids);
|
||||
|
||||
return $photos->isEmpty() ? null : $photos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Photos of a collection slot: the automatic photos, replaced or preceded by the seasonal ones.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @param Collection<int, Photo> $automatic
|
||||
* @return Collection<int, Photo>
|
||||
*/
|
||||
protected function withSeasonalPhotos(Theme $theme, array $data, string $slot, Collection $automatic): Collection
|
||||
{
|
||||
$seasonal = $this->seasonalPhotos($theme, $data, $slot);
|
||||
if ($seasonal === null) {
|
||||
return $automatic;
|
||||
}
|
||||
|
||||
if ($theme->sectionPhotoMode($data['id'] ?? null) === 'prepend') {
|
||||
return $seasonal->merge($automatic)->unique('id')->values();
|
||||
}
|
||||
|
||||
return $seasonal;
|
||||
}
|
||||
|
||||
protected function pageUrl(?string $slug): ?string
|
||||
{
|
||||
if (blank($slug)) {
|
||||
@@ -85,15 +166,13 @@ protected function pageUrl(?string $slug): ?string
|
||||
}
|
||||
|
||||
/**
|
||||
* Select field listing the website photos.
|
||||
* Select field listing the website photos with thumbnails.
|
||||
*/
|
||||
protected static function photoSelect(string $name, string $label, bool $multiple = false): Select
|
||||
{
|
||||
return Select::make($name)
|
||||
return PhotoSelect::make($name)
|
||||
->label($label)
|
||||
->options(fn (): array => Photo::query()->orderBy('category')->orderBy('sort_order')->pluck('alt_text', 'id')->all())
|
||||
->multiple($multiple)
|
||||
->searchable();
|
||||
->multiple($multiple);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,13 +40,18 @@ public static function schema(): array
|
||||
];
|
||||
}
|
||||
|
||||
public static function photoSlots(): array
|
||||
{
|
||||
return ['photo_ids' => ['label' => 'Bilder', 'type' => self::SLOT_MULTIPLE, 'max' => 3]];
|
||||
}
|
||||
|
||||
public function data(Theme $theme, array $data): array
|
||||
{
|
||||
return [
|
||||
'eyebrow' => $data['eyebrow'] ?? null,
|
||||
'heading' => $data['heading'] ?? '',
|
||||
'text' => $this->html($data['text'] ?? null),
|
||||
'photos' => $this->photos($data['photo_ids'] ?? []),
|
||||
'photos' => $this->seasonalPhotos($theme, $data, 'photo_ids') ?? $this->photos($data['photo_ids'] ?? []),
|
||||
'imagePosition' => $data['image_position'] ?? 'right',
|
||||
'linkLabel' => $data['link_label'] ?? null,
|
||||
'linkUrl' => $this->pageUrl($data['link_page'] ?? null),
|
||||
|
||||
@@ -34,6 +34,7 @@ public function activate(): self
|
||||
{
|
||||
$paths = array_map(fn (ThemeManifest $theme): string => $theme->viewsPath(), $this->chain());
|
||||
View::replaceNamespace('theme', $paths);
|
||||
View::getFinder()->flush();
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -96,6 +97,32 @@ public function heroPhoto(?Photo $fallback = null): ?Photo
|
||||
return $this->appearance?->heroPhoto ?? $fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Photo ids the active appearance sets for a slot of a placed section ("Bilder je Baustein").
|
||||
*
|
||||
* @return list<int>
|
||||
*/
|
||||
public function sectionPhotoIds(?string $sectionId, string $slot): array
|
||||
{
|
||||
if (blank($sectionId) || $this->appearance === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$ids = $this->appearance->section_photos[$sectionId][$slot] ?? null;
|
||||
|
||||
return array_values(array_map('intval', array_filter((array) $ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether seasonal photos replace the automatic photos of a section ('replace') or come first ('prepend').
|
||||
*/
|
||||
public function sectionPhotoMode(?string $sectionId): string
|
||||
{
|
||||
$mode = $sectionId ? ($this->appearance?->section_photos[$sectionId]['mode'] ?? null) : null;
|
||||
|
||||
return $mode === 'prepend' ? 'prepend' : 'replace';
|
||||
}
|
||||
|
||||
public function appearanceKey(): string
|
||||
{
|
||||
return $this->appearance ? str($this->appearance->name)->slug()->toString() : 'standard';
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
|
||||
namespace App\Themes;
|
||||
|
||||
use App\Models\Appearance;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
/**
|
||||
* Checks a theme against the theme contract (docs/THEME-ERSTELLUNG.md) so a theme built elsewhere – e.g. by a
|
||||
* design session – can be verified before it is selected: manifest, inheritance, build entry points, required
|
||||
* markup of overridden views, token-only colours, no external resources and WCAG contrast of the colour tokens
|
||||
* (theme defaults and every appearance).
|
||||
*/
|
||||
class ThemeChecker
|
||||
{
|
||||
/** Pairs [text token, background token] that must reach WCAG AA for normal text (4.5:1). */
|
||||
public const CONTRAST_PAIRS = [
|
||||
['ink', 'ground'], ['muted', 'ground'], ['accent', 'ground'],
|
||||
['ink', 'surface'], ['muted', 'surface'], ['accent', 'surface'],
|
||||
['accent-ink', 'accent'], ['band-ink', 'band'], ['band-muted', 'band'], ['banner-ink', 'banner'],
|
||||
];
|
||||
|
||||
public const MIN_CONTRAST = 4.5;
|
||||
|
||||
/** View files a theme may provide besides sections/<key> (custom partials are allowed in partials/). */
|
||||
private const KNOWN_VIEWS = ['layouts/app', 'page', 'partials/banner', 'partials/header', 'partials/footer', 'partials/image', 'partials/mobile-booking-bar'];
|
||||
|
||||
/**
|
||||
* Markup an overridden view must keep, with the reason shown when it is missing.
|
||||
*
|
||||
* @var array<string, array<string, string>>
|
||||
*/
|
||||
private const REQUIRED_MARKUP = [
|
||||
'layouts/app' => [
|
||||
"@yield('content')" => 'Seiteninhalt fehlt (@yield(\'content\')).',
|
||||
"@stack('head')" => 'Bausteine können nichts in <head> ergänzen (JSON-LD) – @stack(\'head\') fehlt.',
|
||||
'$theme->assets()' => 'CSS/JS werden nicht geladen – @vite($theme->assets()) fehlt.',
|
||||
'$theme->cssVariables()' => 'Farb-Tokens werden nicht ausgegeben – $theme->cssVariables() fehlt.',
|
||||
'@livewireStyles' => 'Buchungsformular braucht @livewireStyles.',
|
||||
'@livewireScripts' => 'Buchungsformular braucht @livewireScripts.',
|
||||
'noindex' => 'Vorschau und Testbetrieb müssen noindex setzen.',
|
||||
'id="lightbox"' => 'Galerie-Lightbox fehlt (<dialog id="lightbox"> mit img, [data-caption], [data-close]).',
|
||||
'data-appearance' => 'data-appearance am <html> fehlt (saisonale CSS-Regeln).',
|
||||
],
|
||||
'page' => [
|
||||
'$sections' => 'Die Bausteine der Seite werden nicht ausgegeben.',
|
||||
'$structuredData' => 'JSON-LD der Startseite fehlt ($structuredData).',
|
||||
],
|
||||
'partials/header' => ["menu('main')" => 'Hauptmenü fehlt ($theme->menu(\'main\')).'],
|
||||
'partials/footer' => ["menu('footer')" => 'Fußmenü (Impressum/Datenschutz) fehlt ($theme->menu(\'footer\')).'],
|
||||
'sections/hero' => [
|
||||
'name="anreise"' => 'Verfügbarkeitssuche: Feld name="anreise" fehlt.',
|
||||
'name="abreise"' => 'Verfügbarkeitssuche: Feld name="abreise" fehlt.',
|
||||
"route('booking.create')" => 'Verfügbarkeitssuche muss an route(\'booking.create\') senden.',
|
||||
],
|
||||
'sections/booking' => ['livewire:booking-request' => 'Kalender/Anfrage fehlt (<livewire:booking-request :property="$property" />).'],
|
||||
'sections/gallery' => ['data-lightbox' => 'Galerie-Links brauchen data-lightbox und data-alt.'],
|
||||
'sections/faq' => ['application/ld+json' => 'FAQ-JSON-LD fehlt.'],
|
||||
'sections/reviews' => ['nur Gäste' => 'Pflichthinweis zur Echtheit der Bewertungen (§ 5b UWG) fehlt.'],
|
||||
'sections/offers' => ['$display' => 'Darstellung (nebeneinander/Liste/rollierend) wird nicht berücksichtigt.'],
|
||||
];
|
||||
|
||||
public function __construct(private ThemeRegistry $registry) {}
|
||||
|
||||
/**
|
||||
* @return array{errors: list<string>, warnings: list<string>}
|
||||
*/
|
||||
public function check(ThemeManifest $theme): array
|
||||
{
|
||||
$errors = [];
|
||||
$warnings = [];
|
||||
|
||||
$this->checkManifest($theme, $errors, $warnings);
|
||||
$this->checkAssets($theme, $errors, $warnings);
|
||||
$this->checkViews($theme, $errors, $warnings);
|
||||
$this->checkContrast($theme, $errors, $warnings);
|
||||
|
||||
return ['errors' => $errors, 'warnings' => $warnings];
|
||||
}
|
||||
|
||||
/**
|
||||
* WCAG contrast ratio of two hex colours (1 … 21).
|
||||
*/
|
||||
public static function contrast(string $foreground, string $background): float
|
||||
{
|
||||
$luminance = function (string $hex): float {
|
||||
$hex = ltrim($hex, '#');
|
||||
if (strlen($hex) === 3) {
|
||||
$hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
|
||||
}
|
||||
$channels = array_map(function (string $pair): float {
|
||||
$value = hexdec($pair) / 255;
|
||||
|
||||
return $value <= 0.03928 ? $value / 12.92 : (($value + 0.055) / 1.055) ** 2.4;
|
||||
}, str_split(substr($hex, 0, 6), 2));
|
||||
|
||||
return 0.2126 * $channels[0] + 0.7152 * $channels[1] + 0.0722 * $channels[2];
|
||||
};
|
||||
|
||||
[$lighter, $darker] = [max($luminance($foreground), $luminance($background)), min($luminance($foreground), $luminance($background))];
|
||||
|
||||
return round(($lighter + 0.05) / ($darker + 0.05), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $errors
|
||||
* @param list<string> $warnings
|
||||
*/
|
||||
private function checkManifest(ThemeManifest $theme, array &$errors, array &$warnings): void
|
||||
{
|
||||
if (! preg_match('/^[a-z0-9]+(-[a-z0-9]+)*$/', $theme->key)) {
|
||||
$errors[] = "Key „{$theme->key}“: nur Kleinbuchstaben, Ziffern und Bindestriche.";
|
||||
}
|
||||
if (basename($theme->path) !== $theme->key) {
|
||||
$errors[] = 'Ordnername ('.basename($theme->path).") und key ({$theme->key}) müssen gleich sein – sonst baut Vite die Assets nicht.";
|
||||
}
|
||||
if (! preg_match('/^\d+\.\d+\.\d+$/', $theme->version)) {
|
||||
$errors[] = "version „{$theme->version}“ ist keine Versionsnummer (z. B. 0.1.0).";
|
||||
}
|
||||
if (blank($theme->description)) {
|
||||
$warnings[] = 'description fehlt – sie wird im Admin bei der Theme-Auswahl angezeigt.';
|
||||
}
|
||||
if ($theme->parent !== null) {
|
||||
if ($theme->parent === $theme->key) {
|
||||
$errors[] = 'parent verweist auf das Theme selbst.';
|
||||
} elseif (! isset($this->registry->all()[$theme->parent])) {
|
||||
$errors[] = "Eltern-Theme „{$theme->parent}“ ist nicht installiert.";
|
||||
}
|
||||
}
|
||||
foreach ($theme->tokens as $key => $token) {
|
||||
if (! is_array($token) || blank($token['label'] ?? null) || ! preg_match('/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/', (string) ($token['default'] ?? ''))) {
|
||||
$errors[] = "Token „{$key}“ braucht label und default als Hex-Farbe (#RRGGBB).";
|
||||
}
|
||||
}
|
||||
$missing = array_diff(array_keys($this->registry->tokens(config('themes.base'))), array_keys($this->registry->tokens($theme->key)));
|
||||
if ($missing !== []) {
|
||||
$errors[] = 'Basis-Tokens fehlen in der Theme-Kette: '.implode(', ', $missing).' (die Basis-Vorlagen und Formulare nutzen sie).';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $errors
|
||||
* @param list<string> $warnings
|
||||
*/
|
||||
private function checkAssets(ThemeManifest $theme, array &$errors, array &$warnings): void
|
||||
{
|
||||
$css = $theme->assets['css'] ?? null;
|
||||
$js = $theme->assets['js'] ?? null;
|
||||
if ($css === null && $js === null) {
|
||||
if (is_dir($theme->viewsPath()) && Finder::create()->files()->name('*.blade.php')->in($theme->viewsPath())->hasResults()) {
|
||||
$errors[] = 'Eigene Vorlagen ohne eigene Assets: deren Tailwind-Klassen werden nicht gebaut – theme.css/theme.js anlegen (themes:make macht das) und in assets eintragen.';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$folder = str_replace('\\', '/', ltrim(substr($theme->path, strlen(base_path())), '/\\'));
|
||||
if (! str_starts_with($folder, 'resources/themes/')) {
|
||||
$warnings[] = 'Theme liegt nicht unter resources/themes – vite.config.js baut seine Assets dort nicht automatisch.';
|
||||
}
|
||||
|
||||
foreach (['css' => 'theme.css', 'js' => 'theme.js'] as $type => $file) {
|
||||
$expected = "{$folder}/{$file}";
|
||||
$declared = $theme->assets[$type] ?? null;
|
||||
if ($declared === null) {
|
||||
$errors[] = "assets.{$type} fehlt: Ein Theme mit eigenen Assets ersetzt CSS und JS des Eltern-Themes vollständig – {$file} anlegen (darf das Eltern-Theme importieren).";
|
||||
} elseif ($declared !== $expected) {
|
||||
$errors[] = "assets.{$type} muss „{$expected}“ heißen – nur diese Datei baut Vite (vite.config.js).";
|
||||
} elseif (! is_file(base_path($declared))) {
|
||||
$errors[] = "{$declared} fehlt.";
|
||||
}
|
||||
}
|
||||
|
||||
$cssFile = $css !== null ? base_path($css) : null;
|
||||
if ($cssFile !== null && is_file($cssFile)) {
|
||||
$content = (string) file_get_contents($cssFile);
|
||||
$resolved = $this->withLocalImports($cssFile);
|
||||
|
||||
if (preg_match("~@import\s+['\"]\.\./[a-z0-9-]+/theme\.css['\"]~", $content)) {
|
||||
$warnings[] = 'theme.css importiert das theme.css eines anderen Themes – besser dessen theme-base.css importieren und die Quellen selbst angeben (siehe Anleitung).';
|
||||
}
|
||||
if (! str_contains($content, "@import 'tailwindcss'") && ! str_contains($content, '@import "tailwindcss"')) {
|
||||
$errors[] = "theme.css muss mit @import 'tailwindcss'; beginnen.";
|
||||
}
|
||||
foreach ($this->registry->chain($theme->key) as $ancestor) {
|
||||
$source = ThemeManifest::relativePath($theme->path, $ancestor->viewsPath());
|
||||
if ($ancestor->key !== $theme->key && ! str_contains($resolved, $source)) {
|
||||
$errors[] = "theme.css scannt die Vorlagen von „{$ancestor->key}“ nicht (@source '{$source}') – geerbte Bausteine wären ungestylt.";
|
||||
}
|
||||
}
|
||||
if (is_dir($theme->viewsPath()) && ! preg_match("~@source\s+['\"]\./views['\"]~", $content)) {
|
||||
$errors[] = "theme.css scannt die eigenen Vorlagen nicht (@source './views').";
|
||||
}
|
||||
if (! str_contains($resolved, 'views/livewire')) {
|
||||
$errors[] = "theme.css scannt die Buchungsformulare nicht (@source '".ThemeManifest::relativePath($theme->path, resource_path('views/livewire'))."').";
|
||||
}
|
||||
foreach (array_keys($this->registry->tokens($theme->key)) as $token) {
|
||||
if (! str_contains($resolved, "--color-{$token}:")) {
|
||||
$errors[] = "Token „{$token}“ ist nicht gemappt (@theme inline { --color-{$token}: var(--{$token}); }) – Klassen wie bg-{$token} fehlen.";
|
||||
}
|
||||
}
|
||||
$this->scanExternal($resolved, 'theme.css', $errors);
|
||||
}
|
||||
|
||||
$jsFile = $js !== null ? base_path($js) : null;
|
||||
if ($jsFile !== null && is_file($jsFile)) {
|
||||
$content = (string) file_get_contents($jsFile);
|
||||
if (! preg_match("~import\s+['\"]\.\./[a-z0-9-]+/theme\.js['\"]~", $content) && ! str_contains($content, 'data-rotator')) {
|
||||
$warnings[] = "theme.js importiert kein anderes Theme (import '../ostsee-licht/theme.js') – Lightbox, Suche und rollierende Angebote müssen dann selbst umgesetzt sein.";
|
||||
}
|
||||
$this->scanExternal($content, 'theme.js', $errors);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $errors
|
||||
* @param list<string> $warnings
|
||||
*/
|
||||
private function checkViews(ThemeManifest $theme, array &$errors, array &$warnings): void
|
||||
{
|
||||
if (! is_dir($theme->viewsPath())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sections = array_keys(app(SectionRegistry::class)->all());
|
||||
foreach (Finder::create()->files()->in($theme->viewsPath()) as $file) {
|
||||
$name = str_replace('\\', '/', $file->getRelativePathname());
|
||||
if (! str_ends_with($name, '.blade.php')) {
|
||||
if ($name !== '.gitkeep') {
|
||||
$warnings[] = "views/{$name}: keine Blade-Datei (wird ignoriert).";
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$view = substr($name, 0, -strlen('.blade.php'));
|
||||
$isSection = str_starts_with($view, 'sections/');
|
||||
if ($isSection && ! in_array(substr($view, 9), $sections, true)) {
|
||||
$errors[] = "views/{$name}: unbekannter Baustein (erlaubt: ".implode(', ', $sections).').';
|
||||
} elseif (! $isSection && ! in_array($view, self::KNOWN_VIEWS, true) && ! str_starts_with($view, 'partials/')) {
|
||||
$warnings[] = "views/{$name}: wird vom System nicht aufgerufen (nur eigene Includes).";
|
||||
}
|
||||
|
||||
$content = $file->getContents();
|
||||
foreach (self::REQUIRED_MARKUP[$view] ?? [] as $needle => $reason) {
|
||||
if (str_contains($content, $needle)) {
|
||||
continue;
|
||||
}
|
||||
if ($view === 'sections/offers') {
|
||||
$warnings[] = "views/{$name}: {$reason}";
|
||||
} else {
|
||||
$errors[] = "views/{$name}: {$reason}";
|
||||
}
|
||||
}
|
||||
if ($isSection && ! str_contains($content, '$sectionId')) {
|
||||
$warnings[] = "views/{$name}: \$sectionId nicht genutzt (eindeutige IDs für aria-labelledby).";
|
||||
}
|
||||
if (preg_match('/\b(?:bg|text|border|ring|fill|stroke|from|via|to|outline|decoration|divide|shadow)-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|[1-9]00|950)\b|-\[(?:#|rgb)/', $content, $match)) {
|
||||
$errors[] = "views/{$name}: feste Farbe „{$match[0]}“ – nur Token-Klassen verwenden (bg-accent, text-muted …), sonst wirken Erscheinungsbilder nicht.";
|
||||
}
|
||||
if (preg_match('/style="[^"]*(?:#[0-9a-fA-F]{3,8}\b|rgba?\()/', $content)) {
|
||||
$errors[] = "views/{$name}: feste Farbe im style-Attribut – var(--token) verwenden.";
|
||||
}
|
||||
if (str_contains($content, '<iframe')) {
|
||||
$warnings[] = "views/{$name}: <iframe> eingebettet – Drittanbieter brauchen ein Einwilligungskonzept (DSGVO).";
|
||||
}
|
||||
$this->scanExternal($content, "views/{$name}", $errors);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $errors
|
||||
* @param list<string> $warnings
|
||||
*/
|
||||
private function checkContrast(ThemeManifest $theme, array &$errors, array &$warnings): void
|
||||
{
|
||||
$defaults = array_map(fn (array $token): string => (string) ($token['default'] ?? ''), $this->registry->tokens($theme->key));
|
||||
$variants = ['Theme-Standard' => $defaults];
|
||||
|
||||
if (Schema::hasTable('appearances')) {
|
||||
foreach (Appearance::query()->where('is_active', true)->get() as $appearance) {
|
||||
$variants["Erscheinungsbild „{$appearance->name}“"] = [...$defaults, ...array_filter($appearance->tokens ?? [], fn ($value): bool => is_string($value) && preg_match('/^#[0-9a-fA-F]{3,8}$/', $value) === 1)];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($variants as $label => $tokens) {
|
||||
foreach (self::CONTRAST_PAIRS as [$text, $background]) {
|
||||
if (! isset($tokens[$text], $tokens[$background]) || ! preg_match('/^#/', $tokens[$text]) || ! preg_match('/^#/', $tokens[$background])) {
|
||||
continue;
|
||||
}
|
||||
$ratio = self::contrast($tokens[$text], $tokens[$background]);
|
||||
if ($ratio < self::MIN_CONTRAST) {
|
||||
$message = "{$label}: Kontrast {$text} auf {$background} nur {$ratio}:1 (mind. ".self::MIN_CONTRAST.':1).';
|
||||
if ($label === 'Theme-Standard') {
|
||||
$errors[] = $message;
|
||||
} else {
|
||||
$warnings[] = $message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The CSS file with its relative @imports (theme-base.css etc.) inlined, for checks across files.
|
||||
*/
|
||||
private function withLocalImports(string $file, int $depth = 0): string
|
||||
{
|
||||
$content = (string) file_get_contents($file);
|
||||
if ($depth > 3) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
return preg_replace_callback("~@import\s+['\"](\.{1,2}/[^'\"]+\.css)['\"]\s*;~", function (array $match) use ($file, $depth): string {
|
||||
$imported = dirname($file).DIRECTORY_SEPARATOR.$match[1];
|
||||
|
||||
return is_file($imported) ? $this->withLocalImports($imported, $depth + 1) : $match[0];
|
||||
}, $content) ?? $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $errors
|
||||
*/
|
||||
private function scanExternal(string $content, string $file, array &$errors): void
|
||||
{
|
||||
if (preg_match('~https?://(?:fonts\.googleapis|fonts\.gstatic|use\.typekit|[a-z0-9.-]*cdn[a-z0-9.-]*|unpkg\.com|cdnjs)[^\s"\')]*~i', $content, $match)) {
|
||||
$errors[] = "{$file}: externe Quelle „{$match[0]}“ – Schriften und Skripte selbst hosten (DSGVO, kein Cookie-Banner).";
|
||||
}
|
||||
if (preg_match('~<script[^>]+src=["\']https?://~i', $content)) {
|
||||
$errors[] = "{$file}: externes Skript – nicht erlaubt.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,22 +18,28 @@ public function __construct(private ThemeRegistry $registry) {}
|
||||
public function forRequest(Request $request): Theme
|
||||
{
|
||||
$site = $this->site($request->getHost());
|
||||
$isSigned = ($request->query('vorschau') || $request->query('theme')) && $request->hasValidSignature();
|
||||
|
||||
$preview = null;
|
||||
if ($request->query('vorschau') && $request->hasValidSignature()) {
|
||||
$preview = $site->appearances()->find($request->query('vorschau'));
|
||||
$preview = $isSigned && $request->query('vorschau') ? $site->appearances()->find($request->query('vorschau')) : null;
|
||||
|
||||
// Theme preview: the site is shown with another installed theme without changing it (not saved).
|
||||
$previewTheme = $isSigned ? (string) $request->query('theme') : '';
|
||||
if ($previewTheme !== '' && isset($this->registry->all()[$previewTheme])) {
|
||||
$site = (clone $site)->setAttribute('theme', $previewTheme);
|
||||
|
||||
return $this->forSite($site, $preview, isPreview: true);
|
||||
}
|
||||
|
||||
return $this->forSite($site, $preview);
|
||||
}
|
||||
|
||||
public function forSite(Site $site, ?Appearance $preview = null): Theme
|
||||
public function forSite(Site $site, ?Appearance $preview = null, bool $isPreview = false): Theme
|
||||
{
|
||||
return new Theme(
|
||||
$this->registry,
|
||||
$site,
|
||||
$preview ?? ($site->exists ? $site->appearanceOn(today()) : null),
|
||||
isPreview: $preview !== null,
|
||||
isPreview: $isPreview || $preview !== null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,4 +48,22 @@ public function viewsPath(): string
|
||||
{
|
||||
return $this->path.DIRECTORY_SEPARATOR.'views';
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative path with forward slashes from one directory to another, as used in CSS @import/@source
|
||||
* and JS imports, e.g. "../ostsee-licht/views".
|
||||
*/
|
||||
public static function relativePath(string $fromDirectory, string $to): string
|
||||
{
|
||||
$normalise = fn (string $path): array => array_values(array_filter(explode('/', str_replace('\\', '/', realpath($path) ?: $path)), fn (string $part): bool => $part !== ''));
|
||||
$from = $normalise($fromDirectory);
|
||||
$target = $normalise($to);
|
||||
|
||||
while ($from !== [] && $target !== [] && strcasecmp($from[0], $target[0]) === 0) {
|
||||
array_shift($from);
|
||||
array_shift($target);
|
||||
}
|
||||
|
||||
return implode('/', [...array_fill(0, count($from), '..'), ...$target]) ?: '.';
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,21 @@ public function chain(string $key): array
|
||||
return array_values($chain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Colour tokens of a theme including the inherited ones (base first, the theme's own definitions win).
|
||||
*
|
||||
* @return array<string, array{label: string, default: string}>
|
||||
*/
|
||||
public function tokens(string $key): array
|
||||
{
|
||||
$tokens = [];
|
||||
foreach (array_reverse($this->chain($key)) as $theme) {
|
||||
$tokens = [...$tokens, ...$theme->tokens];
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
|
||||
@@ -76,6 +76,12 @@
|
||||
'stale_after_minutes' => (int) env('FEWO_MAILBOX_STALE_AFTER_MINUTES', 15),
|
||||
],
|
||||
|
||||
/*
|
||||
| Fallback trigger for the task scheduler (e.g. from n8n every minute) if the hosting's cron jobs
|
||||
| are not available or not frequent enough: GET /automation/scheduler?token=… . Empty = disabled.
|
||||
*/
|
||||
'scheduler_token' => env('FEWO_SCHEDULER_TOKEN'),
|
||||
|
||||
/*
|
||||
| Optional external automation (e.g. a browser bot on a private server) that carries out
|
||||
| manual blocking tasks. Tasks are POSTed signed with HMAC-SHA256 of the body.
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
file;category;alt_text
|
||||
2024/05/IMG_4041-scaled.jpg;apartment;Wohnzimmer mit blauer Ledercouch und Blick in die Küche
|
||||
2024/05/IMG_4046-scaled.jpg;apartment;Wohnzimmer mit Fensterfront zur Terrasse
|
||||
2023/11/01_wohn_web.jpg;apartment;Wohn- und Essbereich
|
||||
2023/11/02_wohn_web.jpg;apartment;Esstisch mit vier Stühlen im Wohnbereich
|
||||
2023/11/03_wohn_web.jpg;apartment;Sitzecke mit Relaxsessel und Fernseher
|
||||
2023/11/06_wohn_web.jpg;apartment;Ledersofa vor der Terrassentür
|
||||
2023/11/08_wohn_web.jpg;apartment;Blick vom Wohnbereich in Küche und Flur
|
||||
2023/11/10_kueche_web.jpg;apartment;Einbauküche mit Essplatz
|
||||
2023/11/11_kueche_web.jpg;apartment;Küchenzeile mit Backofen und Mikrowelle
|
||||
2023/11/12_kueche_web.jpg;apartment;Küche mit Ceranfeld und Dunstabzug
|
||||
2023/11/09_kueche_web.jpg;apartment;Flur mit Garderobe und offener Küche
|
||||
2023/02/DSC00181-scaled.jpg;apartment;Schlafzimmer mit Boxspringbett
|
||||
2023/11/14_schlaf_web.jpg;apartment;Schlafzimmer mit Doppelbett und Leseecke
|
||||
2023/11/16_schlaf_web.jpg;apartment;Doppelbett im Schlafzimmer
|
||||
2023/11/13_schlaf_web.jpg;apartment;Flur mit Blick ins Schlafzimmer und Bad
|
||||
2023/12/Bad-scaled.jpg;apartment;Bad mit bodenebener Glasdusche
|
||||
2023/11/18_bad_web.jpg;apartment;Bad mit Waschtisch und WC
|
||||
2023/11/19_bad_web.jpg;apartment;Waschtisch mit Spiegelschrank
|
||||
2025/02/Schreibtisch-1-2-scaled.jpg;apartment;Arbeitsplatz mit Schreibtisch
|
||||
2023/02/bild_bg_9_gr.jpg;apartment;Grundriss der Wohnung
|
||||
2024/05/IMG_4052-scaled.jpg;outdoor;Überdachte Terrasse mit Hortensien
|
||||
2024/06/IMG_4045.jpg;outdoor;Terrasse mit Sitzgruppe und Blumen
|
||||
2023/11/20_garten_web.jpg;outdoor;Sitzplatz im Garten der Wohnanlage
|
||||
2023/11/21_garten_web.jpg;outdoor;Gartenweg zwischen den Häusern
|
||||
2023/11/22_garten_web.jpg;outdoor;Garten mit Rhododendren vor den Terrassen
|
||||
2023/11/23_garten_web.jpg;outdoor;Gartenteich in der Wohnanlage
|
||||
2023/02/Sauna_gr.jpg;outdoor;Ruhebereich der Sauna im Haus
|
||||
2024/05/DJI_0047-scaled.jpg;outdoor;Luftbild der Wohnanlage
|
||||
2024/05/DJI_0050-scaled.jpg;outdoor;Luftbild mit Wald und Ostsee
|
||||
2024/05/DJI_0054-scaled.jpg;outdoor;Luftbild von Kühlungsborn Richtung Ostsee
|
||||
2023/02/bild_bg_10_gr.jpg;area;Strandkörbe am Ostseestrand
|
||||
2023/02/fjord-gro.jpg;area;Bootshafen Kühlungsborn
|
||||
2023/02/bild_bg_11_gr.jpg;area;Dampflok der Bäderbahn Molli
|
||||
2023/02/geisterwald-gro.jpg;area;Gespensterwald bei Nienhagen
|
||||
2023/02/hausostsee-gro.jpg;area;Villa in Bäderarchitektur
|
||||
2023/02/bder4stil-gro.jpg;area;Strand mit Bäderarchitektur
|
||||
2023/02/ostseealle-gro.jpg;area;Ostseeallee mit Villen
|
||||
2023/02/kirche-gro.jpg;area;Backsteinkirche Kühlungsborn
|
||||
2023/02/Einkaufen_gr.jpg;area;Einkaufen in Kühlungsborn
|
||||
|
@@ -32,9 +32,18 @@ public function definition(): array
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
'role' => UserRole::Admin,
|
||||
'app_authentication_secret' => 'JBSWY3DPEHPK3PXP',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the user has not set up two-factor authentication yet.
|
||||
*/
|
||||
public function withoutTwoFactor(): static
|
||||
{
|
||||
return $this->state(fn (): array => ['app_authentication_secret' => null]);
|
||||
}
|
||||
|
||||
public function role(?UserRole $role): static
|
||||
{
|
||||
return $this->state(fn (): array => ['role' => $role]);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->text('app_authentication_secret')->nullable()->after('password');
|
||||
$table->text('app_authentication_recovery_codes')->nullable()->after('app_authentication_secret');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['app_authentication_secret', 'app_authentication_recovery_codes']);
|
||||
});
|
||||
}
|
||||
};
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('special_offers', function (Blueprint $table) {
|
||||
$table->string('kind', 20)->default('rule')->after('name');
|
||||
$table->unsignedSmallInteger('max_gap_nights')->nullable()->after('max_nights');
|
||||
$table->boolean('waives_min_stay')->default(false)->after('max_gap_nights');
|
||||
$table->integer('priority')->default(0)->after('is_combinable');
|
||||
$table->boolean('is_featured')->default(false)->after('priority');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('special_offers', function (Blueprint $table) {
|
||||
$table->dropColumn(['kind', 'max_gap_nights', 'waives_min_stay', 'priority', 'is_featured']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Offers are advertised by their own rules now (OfferShowcase) instead of per appearance;
|
||||
* appearances get photos per section instead.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('appearances', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('featured_offer_id');
|
||||
$table->json('section_photos')->nullable()->after('hero_photo_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('appearances', function (Blueprint $table) {
|
||||
$table->dropColumn('section_photos');
|
||||
$table->foreignId('featured_offer_id')->nullable()->constrained('special_offers')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Page;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Existing pages: every placed section gets its stable id (see Page::assignSectionIds).
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('pages')->orderBy('id')->each(function (object $page): void {
|
||||
$sections = json_decode((string) $page->sections, true);
|
||||
if (! is_array($sections)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::table('pages')->where('id', $page->id)->update(['sections' => json_encode(Page::assignSectionIds($sections))]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ids are harmless when rolling back; nothing to undo.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('admin_mode', 20)->nullable()->after('role');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('admin_mode');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -16,7 +16,7 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
User::factory()->create([
|
||||
User::factory()->withoutTwoFactor()->create([
|
||||
'name' => 'Admin',
|
||||
'email' => 'admin@example.com',
|
||||
'role' => UserRole::Admin,
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Site;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
/**
|
||||
* Initial data for a fresh production installation (no test data, no factories – they are not deployed).
|
||||
* Run once: scripts/deploy.sh production artisan db:seed --class=ProductionSeeder --force
|
||||
* Create the first administrator afterwards: scripts/deploy.sh production artisan make:filament-user
|
||||
*/
|
||||
class ProductionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
if (Site::query()->exists()) {
|
||||
$this->command?->warn('Es gibt bereits eine Website – Ersteinrichtung übersprungen.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->call([PropertySeeder::class, WebsiteContentSeeder::class, SiteSeeder::class]);
|
||||
}
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
# Betrieb: Umgebungen, Zugänge, Einrichtung
|
||||
|
||||
Stand: 22.10.2026. Dieses Dokument beschreibt den **tatsächlichen Stand** der Installationen, damit jede neue Arbeitssitzung (Mensch oder KI) ohne Vorwissen weitermachen kann. Allgemeine Abläufe des Deployments stehen in [DEPLOYMENT.md](DEPLOYMENT.md), das fachliche Konzept in [KONZEPT.md](KONZEPT.md).
|
||||
|
||||
> **Geheimnisse stehen nie im Repository und nie im Chat.** Passwörter (Datenbank, E-Mail), `APP_KEY`, Tokens und private SSH-Schlüssel liegen nur in `shared/.env` auf dem Server bzw. im Vaultwarden von Lars. Hier ist nur dokumentiert, *wo* sie liegen.
|
||||
|
||||
## 1. Überblick
|
||||
|
||||
| | Testbetrieb (staging) | Produktion |
|
||||
|---|---|---|
|
||||
| Adresse | **https://stommer.info** | später https://www.fewo-stommer.de (heute noch WordPress) |
|
||||
| Ordner auf dem Webspace | `test.fewo-stommer.de/` | noch nicht angelegt (Vorschlag: `fewo-production/`) |
|
||||
| Deploy-Konfiguration (lokal, nicht committet) | `scripts/deploy.staging.env` | `scripts/deploy.production.env` (anlegen aus `deploy.example.env`) |
|
||||
| Datenbank | MariaDB 11.8, siehe §3 | eigene Datenbank anlegen |
|
||||
| E-Mail | `MAIL_MAILER=log` – **verschickt nichts** | Strato-SMTP |
|
||||
| Postfach-Abruf (Portal-Mails) | aus (`FEWO_MAILBOX_HOST` leer) | `imap.strato.de` |
|
||||
| Suchmaschinen | `noindex` (alles außer `APP_ENV=production`) | indexiert |
|
||||
| Cronjob | **noch offen** (§6) | einrichten |
|
||||
|
||||
Git: `https://gitea.stommer.de/Lars/fewo-stommer.git`, Branch `main`. Gebaut und ausgeliefert wird immer der **letzte Commit**.
|
||||
|
||||
## 2. Strato-Paket (Hosting Pro)
|
||||
|
||||
- **SSH/SFTP-Server:** `51539426.ssh.w1.strato.hosting` (paketspezifisch, *nicht* `ssh.strato.de` – der lehnt ab). Port 22.
|
||||
- **SSH-Benutzer:** `stu100093250` (Kundenlogin › Datenbanken und Webspace › SFTP & SSH › Details). Startverzeichnis `/` = Webspace-Wurzel.
|
||||
- **Absoluter Pfad des Webspace:** `/mnt/web508/e3/26/51539426/htdocs/` (für Cronjobs).
|
||||
- **PHP-CLI:** `/opt/RZphp84/bin/php-cli` (8.4). Die Web-PHP-Version des Pakets ist eine andere (8.3); die `.htaccess` im Deploy-Ordner setzt per `AddType application/x-httpd-php84 .php` 8.4 **nur für diesen Ordner**.
|
||||
- **Andere Inhalte im Webspace nicht anfassen:** u. a. `www.fewo-stommer.de/` (bestehendes WordPress), `fewo`, Karate-Wiki, Moodle. Das Deploy-Skript arbeitet ausschließlich unterhalb von `DEPLOY_PATH`.
|
||||
- **Domains:** SSL-Zertifikate gibt es im Paket nur für Hauptdomains, nicht für Subdomains. Deshalb läuft der Test unter `stommer.info` (Ziel: Ordner `test.fewo-stommer.de`, SSL aktiv, `www.stommer.info` ebenso). Die Subdomain `test.fewo-stommer.de` wird nicht mehr gebraucht.
|
||||
- **Domain-Ziel = Deploy-Ordner selbst** (Strato kann kein Symlink-Ziel wählen). Die dort vom Skript geschriebene `.htaccess` leitet auf `releases/<aktive Version>/public` und sperrt alles Interne mit 403.
|
||||
|
||||
## 3. Datenbank (staging)
|
||||
|
||||
- Host `database-5021719836.webspace-host.com`, Port 3306, Datenbank `dbs16257975`, Benutzer `dbu2231025`, `DB_CONNECTION=mariadb`.
|
||||
- Passwort: nur in `test.fewo-stommer.de/shared/.env` (und Vaultwarden).
|
||||
|
||||
## 4. SSH-Zugang einrichten (neuer Rechner, z. B. privater PC)
|
||||
|
||||
1. Schlüssel erzeugen: `ssh-keygen -t ed25519 -f ~/.ssh/strato_fewo -C "fewo-deploy <rechner>"`.
|
||||
2. Öffentlichen Schlüssel beim Server eintragen (fragt einmal das SSH-Passwort des Strato-Benutzers ab):
|
||||
`ssh-copy-id -i ~/.ssh/strato_fewo.pub stu100093250@51539426.ssh.w1.strato.hosting`
|
||||
(Windows ohne `ssh-copy-id`: Inhalt von `strato_fewo.pub` per SSH an `~/.ssh/authorized_keys` anhängen.)
|
||||
3. Test: `ssh -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting "ls"`.
|
||||
4. Den privaten Schlüssel nur im Vaultwarden sichern, nie committen oder weitergeben.
|
||||
5. **Aufräumen:** Der Schlüssel des Firmen-Laptops (Kommentar in `~/.ssh/authorized_keys` auf dem Server) wird entfernt, sobald der private PC eingerichtet ist.
|
||||
|
||||
Lokale Werkzeuge: PHP 8.4 CLI, Composer, Node/npm, Git, Bash (Windows: Git Bash). Danach `scripts/deploy.example.env` nach `scripts/deploy.staging.env` kopieren und mit den Werten aus §2 füllen (`DEPLOY_PATH=test.fewo-stommer.de`, `DEPLOY_URL=https://stommer.info`, `DEPLOY_SSH_KEY=~/.ssh/strato_fewo`; unter Windows ggf. `COMPOSER_BIN="php /c/…/composer.phar"`).
|
||||
|
||||
## 5. Konfiguration auf dem Server (`shared/.env`)
|
||||
|
||||
Vorlage: [.env.production.example](../.env.production.example). Bearbeiten nur direkt auf dem Server, damit Passwörter nicht durch Chat oder Repository laufen:
|
||||
|
||||
```bash
|
||||
ssh -t -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting "nano test.fewo-stommer.de/shared/.env"
|
||||
bash scripts/deploy.sh staging artisan optimize # danach Konfiguration neu einlesen
|
||||
```
|
||||
|
||||
Gesetzte Werte im Testbetrieb (Geheimnisse ausgelassen):
|
||||
|
||||
| Schlüssel | Wert | Bemerkung |
|
||||
|---|---|---|
|
||||
| `APP_ENV` | `staging` | nicht `production` → `noindex` |
|
||||
| `APP_DEBUG` | `false` | |
|
||||
| `APP_URL` | `https://stommer.info` | alle erzeugten Links bauen darauf auf (`URL::forceRootUrl`) |
|
||||
| `APP_KEY` | gesetzt | **nie ändern** – sonst sind 2FA-Schlüssel und Sitzungen unlesbar |
|
||||
| `DB_*` | siehe §3 | |
|
||||
| `SESSION_DRIVER` / `CACHE_STORE` | `database` | |
|
||||
| `SESSION_SECURE_COOKIE` | `true` | Anmeldung nur über HTTPS |
|
||||
| `QUEUE_CONNECTION` | `sync` | keine Worker auf Shared Hosting |
|
||||
| `MAIL_MAILER` | `log` | Testbetrieb verschickt **keine** E-Mails (landen in `shared/storage/logs`) |
|
||||
| `FEWO_MAILBOX_HOST` | leer | Testbetrieb liest **kein** echtes Postfach |
|
||||
| `FEWO_BANK_*` | leer | für Verträge/Angebote noch einzutragen |
|
||||
| `FEWO_HEALTH_TOKEN`, `FEWO_SCHEDULER_TOKEN`, `FEWO_AUTOMATION_SECRET` | gesetzt | für n8n (Überwachung, Scheduler-Ersatz, Webhooks) |
|
||||
|
||||
## 6. Erledigt / offen im Testbetrieb
|
||||
|
||||
Erledigt (22.10.2026): Ordnerstruktur, `shared/.env`, Migrationen, Grunddaten (`ProductionSeeder`: Wohnung, Saisons 2026, Inhalte, Seiten, Erscheinungsbilder), HTTPS unter stommer.info, Gesundheitscheck mit automatischem Rollback.
|
||||
|
||||
Offen:
|
||||
- **Admin-Benutzer anlegen** (§7) und 2FA einrichten.
|
||||
- **Cronjob** (Kundenlogin › Cronjobs), jede Minute:
|
||||
`/opt/RZphp84/bin/php-cli /mnt/web508/e3/26/51539426/htdocs/test.fewo-stommer.de/current/artisan schedule:run`
|
||||
Falls Strato nicht minütlich erlaubt: n8n ruft jede Minute `https://stommer.info/automation/scheduler?token=<FEWO_SCHEDULER_TOKEN>` auf.
|
||||
- Bankdaten, Vertrags- und AGB-Texte, Rechtstexte prüfen.
|
||||
|
||||
### Fotos aus dem alten WordPress übernehmen
|
||||
|
||||
Die Auswahl (39 aktuelle Fotos: Wohnung, Garten/Terrasse/Luftbilder, Umgebung – ohne Theme-Platzhalter, Logos, Vorschaugrößen und veraltete Einrichtung) mit Kategorie und Bildbeschreibung steht in [database/data/wordpress-photos.csv](../database/data/wordpress-photos.csv). Der Import **liest** die Dateien nur aus dem WordPress-Ordner (dort wird nichts verändert), legt Original + WebP-Größen in `shared/storage/app/public` ab und überspringt bereits importierte Fotos (wiederholbar):
|
||||
|
||||
```bash
|
||||
bash scripts/deploy.sh staging artisan photos:import /mnt/web508/e3/26/51539426/htdocs/www.fewo-stommer.de/wp-content/uploads --manifest=database/data/wordpress-photos.csv
|
||||
```
|
||||
|
||||
Danach in der Verwaltung (Webseite › Fotos) Reihenfolge, Sichtbarkeit und Texte prüfen.
|
||||
- Gitea-Runner für automatisches Deployment (DEPLOYMENT.md §5).
|
||||
|
||||
## 7. Zugang zur Verwaltung (`/admin`)
|
||||
|
||||
**Benutzer anlegen** – der erste Administrator per Befehl (das Passwort wird verdeckt im eigenen Terminal eingegeben, nie als Argument):
|
||||
|
||||
```bash
|
||||
ssh -t -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting \
|
||||
"cd test.fewo-stommer.de/current && /opt/RZphp84/bin/php-cli artisan users:create lars@stommer.com --name='Lars Stommer' --role=admin"
|
||||
```
|
||||
|
||||
Weitere Benutzer legt ein Administrator in der Verwaltung an (System › Benutzer): Name, E-Mail, **Rolle** (was die Person darf) und **Ansicht** (was das Menü zeigt), Passwort. Rollen: `admin` (alles inkl. Benutzer), `rentals` (Vermietung), `content` (Inhalte); ohne Rolle kein Zugang. Empfehlung: Lars `admin`, Brigitte `rentals` mit einfacher Ansicht.
|
||||
|
||||
**Ansichten:** *Einfache Ansicht* – nur Anfragen & Buchungen (inkl. Bestätigen, Mietvertrag, Zahlungen), Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen. *Expertenansicht* – alle Einstellungen, die die Rolle erlaubt (Preise, Angebote, Portale, Webseite, System). Ohne Auswahl: Administratoren Experten-, alle anderen einfache Ansicht. Umschalten jederzeit über das Benutzermenü oben rechts („Zur … Ansicht wechseln“). Die Ansicht blendet nur Menüpunkte aus; Rechte regelt allein die Rolle.
|
||||
|
||||
**Passwort vergessen:** Ein Administrator vergibt unter System › Benutzer › Bearbeiten ein neues Passwort (eine Selbst-Zurücksetzung per E-Mail gibt es bewusst nicht). **Handy verloren:** dort Aktion „2FA zurücksetzen“ – die Person richtet die 2FA bei der nächsten Anmeldung neu ein.
|
||||
|
||||
**Zwei-Faktor-Anmeldung (2FA):** Filament-eigene Lösung mit Authenticator-App (TOTP, z. B. Bitwarden/Vaultwarden, Google oder Microsoft Authenticator) und Wiederherstellungscodes.
|
||||
- **Pflicht für Administratoren:** Nach der ersten Anmeldung wird man auf die Einrichtungsseite geleitet (QR-Code scannen, Code bestätigen, Wiederherstellungscodes sichern). Umgesetzt mit `App\Http\Middleware\RequireTwoFactorForAdmins`.
|
||||
- **Freiwillig für andere Rollen:** im Profil (Avatar oben rechts › Profil).
|
||||
- Schlüssel und Codes liegen verschlüsselt (mit `APP_KEY`) in `users.app_authentication_secret` / `app_authentication_recovery_codes`.
|
||||
- **Handy verloren:** Anmeldung mit einem Wiederherstellungscode. Sind auch die weg, setzt ein Administrator mit Serverzugang die 2FA zurück:
|
||||
```bash
|
||||
bash scripts/deploy.sh staging artisan tinker --execute='App\Models\User::where("email", "lars@stommer.com")->update(["app_authentication_secret" => null, "app_authentication_recovery_codes" => null]);'
|
||||
```
|
||||
Danach bei der nächsten Anmeldung neu einrichten.
|
||||
|
||||
Lokal (nur Entwicklung, `php artisan migrate:fresh --seed`): `admin@example.com` / `password`, 2FA wird bei der ersten Anmeldung eingerichtet.
|
||||
|
||||
## 8. Bekannte Eigenheiten und Lösungen
|
||||
|
||||
| Problem | Ursache | Lösung (umgesetzt) |
|
||||
|---|---|---|
|
||||
| Nach dem Umschalten lief die alte Version weiter | Strato-OPcache speichert Skripte unter dem Symlink-Pfad `current/…` | `.htaccess` zeigt auf den konkreten Ordner `releases/<version>/public` und wird bei jedem Umschalten neu geschrieben |
|
||||
| Links mit `/current/public` (z. B. Sitemap) | Laravel leitet den Basis-Pfad aus dem Skript-Pfad ab | `URL::forceRootUrl(APP_URL)` außerhalb von local/testing (`AppServiceProvider`) |
|
||||
| HTTP 500 „Composer platform“ | Web-PHP des Pakets ist 8.3 | `AddType application/x-httpd-php84 .php` in der Ordner-`.htaccess` |
|
||||
| SSH „connection closed“ | falscher Server `ssh.strato.de` | paketspezifischer Server (§2) |
|
||||
| Domain-Ziel `current/public` nicht wählbar | Strato erlaubt kein Symlink-Ziel | Domain auf den Deploy-Ordner, `.htaccess` leitet weiter |
|
||||
| Ersteinrichtung mit Factories schlägt fehl | Produktion ohne Dev-Pakete | `ProductionSeeder` |
|
||||
| Kein SSL für Subdomain | Paket erlaubt SSL nur für Hauptdomains | Testbetrieb auf `stommer.info` |
|
||||
| `Disk quota exceeded` beim Hochladen / Hinweis „zu viele Dateien“ | Webspace-Kontingent voll (geteilt mit allen anderen Seiten/Backups im Paket); jede Version belegt ~136 MB | Es ist die **Anzahl der Dateien** (Inode-Limit), nicht der Platz. Der Server behält nur die aktive Version (Geschichte als Git-Tags in Gitea), `vendor` wird beim Build ausgedünnt (~15.000 statt ~19.500 Dateien je Version); Reste abgebrochener Läufe räumt das nächste Deployment selbst weg. **Ordner außerhalb des Deploy-Ordners entscheidet nur Lars** (teils produktiv). |
|
||||
| Windows: Symlinks, `php` nicht im PATH | Git Bash | Deploy nur gegen Strato testen; `export PATH="<php-ordner>:$PATH"` |
|
||||
|
||||
## 9. Nützliche Befehle
|
||||
|
||||
```bash
|
||||
bash scripts/deploy.sh staging deploy # ausliefern (letzter Commit)
|
||||
bash scripts/deploy.sh staging releases # aktive Version + Deploy-Tags in Git
|
||||
bash scripts/deploy.sh staging deploy deploy/staging/<zeitstempel> # frühere Version erneut ausliefern
|
||||
bash scripts/deploy.sh staging artisan about # Zustand der Installation
|
||||
bash scripts/deploy.sh staging artisan migrate:status
|
||||
ssh -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting \
|
||||
"tail -n 50 test.fewo-stommer.de/shared/storage/logs/laravel-$(date +%F).log" # Fehlerprotokoll
|
||||
```
|
||||
@@ -0,0 +1,89 @@
|
||||
# BUCHUNGSPROZESS – Vertrags-, Zahlungs- und Stornierungsablauf
|
||||
|
||||
> **Hinweis (22.10.2026):** Von einem Analyse-Agenten erstellt. Die als „verbindlich“ bezeichneten Entscheidungen (E1–E7) sind Annahmen des Agenten, keine Festlegungen der Betreiber. Maßgeblich sind die Entscheidungen in [KONZEPT.md §6a/6b](KONZEPT.md) (u. a. Buchungsweg 1 über Angebot + Annahme, Weg 2 Direktbuchung später; Kurabgabe vor Ort durch Ferienservice Balu).
|
||||
|
||||
Stand: 22.10.2026 · **Entwurf zur Freigabe.** Keine Umsetzung. Juristische Einordnung (u. a. §§ 312j, 312k BGB) ist **offener Prüfpunkt** – nichts hier ist als rechtskonform bestätigt.
|
||||
|
||||
## 1. Ist-Stand (im Code belegt)
|
||||
|
||||
`Reserved` (Anfrage = zugleich zeitlich begrenzte Vorreservierung, `hold_hours`) → `Confirmed` (Vermieterin bestätigt: Vertrag-PDF + Mail, Anzahlungsfrist) → `DepositPaid` → `Paid` → `Completed`; Nebenpfade `Declined`, `Expired`, `Cancelled`. Alle Statuswechsel laufen manuell (Admin) oder per Zeitjob; Zahlungen werden manuell erfasst (`RecordPayment`). Quellen: `app/Enums/BookingStatus.php`, `app/Actions/*`.
|
||||
|
||||
Nicht vorhanden: Angebot als eigener Schritt, Annahme durch Gast, Nachweis des Vertragsschlusses, Stornokostenberechnung, Gäste-Storno, Erstattungsworkflow, Empfangsbestätigung mit Vertragstext.
|
||||
|
||||
## 2. Ziel-Statusmodell
|
||||
|
||||
| Status | Bedeutung | Belegt Kalender? | Übergang durch | Mail an Gast |
|
||||
|---|---|---|---|---|
|
||||
| `inquiry` | Unverbindliche Anfrage (nur Daten) | nein | Gast (Formular) | Eingangsbestätigung (nicht verbindlich) |
|
||||
| `reserved` | Vorreservierung, befristet gehalten | ja (Hold) | Vermieterin/Automatik | Info zur Frist |
|
||||
| `offer_sent` | Ausdrückliches Angebot mit Preis, Bedingungen, Frist | ja (bis `offer_expires_at`) | Vermieterin (später KI-Entwurf + Freigabe) | Angebot + Annahme-Link |
|
||||
| `offer_expired` / `offer_declined` | Frist verstrichen / Gast lehnt ab | nein | Zeitjob / Gast | Info |
|
||||
| `confirmed` | **Annahme durch Gast** → verbindliche Buchung (Vertrag geschlossen) | ja | Gast (Annahme) | Vertragsunterlagen + Zahlungsaufforderung |
|
||||
| `deposit_paid`, `paid`, `completed` | wie bisher | ja | Zahlung/Zeit | Quittungen/Hinweise |
|
||||
| `cancel_requested` | Stornierung/Kündigung vom Gast erklärt | ja bis Entscheidung | Gast | Eingangsbestätigung |
|
||||
| `cancelled` | Storniert, Kosten berechnet | nein | Vermieterin/Automatik | Stornobeleg |
|
||||
| `declined` | Vermieterin lehnt Anfrage ab | nein | Vermieterin | Absage |
|
||||
| `no_show` (optional) | Nichtanreise | – | Vermieterin | – |
|
||||
|
||||
Bestehende Werte bleiben gültig (Spalte `status` ist String): `Reserved` bleibt, `Confirmed` wird semantisch auf „Annahme erfolgt“ geschärft. Migrationspfad: bestehende `Confirmed`-Buchungen gelten als angenommen (Entscheidung nötig).
|
||||
|
||||
**Zahlungspflicht:** Nur im Übergang `offer_sent → confirmed` durch eindeutigen Button (Beschriftung z. B. „zahlungspflichtig buchen“, ⚖ Wortlaut § 312j (3) BGB prüfen) wird sie begründet; alle übrigen Schritte sind ausdrücklich nicht zahlungspflichtig.
|
||||
|
||||
## 3. Ablauf Direktbuchung
|
||||
|
||||
1. **Anfrage** (Formular, bestehend `BookingRequest`): Pflichtfelder wie heute, Hinweis „unverbindlich“, Datenschutzhinweis (Art. 13). Eingangsbestätigung per Mail (bestehend `ReservationReceived`).
|
||||
2. **Vorreservierung**: Datumshold wie `hold_expires_at`; Ablauf durch bestehenden Job.
|
||||
3. **Angebot**: Vermieterin erstellt/prüft Angebot aus `PriceQuote` (bestehend) + Stornobedingungen + Kurabgabe-Hinweis + AGB/Datenschutz; Angebotsdokument als PDF (`documents.type=offer`), Hash gespeichert. Gültigkeit `offer_expires_at`.
|
||||
4. **Annahme durch Gast** (ohne Konto): Mail mit **signiertem, befristeten, einmal nutzbaren Link** (Muster wie `URL::temporarySignedRoute` bei Newsletter/Bewertung) → Seite zeigt Angebot vollständig (Preis, Leistungen, Bedingungen) und Zusammenfassung; Bestätigung per Button. Zusätzlich möglich: Rückbestätigung per Mail-Link (Double-Check), falls ⚖ erforderlich.
|
||||
5. **Verbindliche Buchung**: System setzt `accepted_at`, speichert **Annahmenachweis** (Zeitpunkt, Angebots-Hash, Angebotsversion, Bedingungenversion, IP-Hash/User-Agent – nur wenn zwingend nötig und ⚖ datenschutzrechtlich geprüft, sonst weglassen), Kalender belegt, Portal-Sperr-Aufgaben laufen (bestehender Observer).
|
||||
6. **Vertragsunterlagen per E-Mail**: Bestätigungsmail + Vertrag/AGB/Stornobedingungen als PDF (bestehend `RentalContract`, `BookingConfirmed`) = **elektronische Empfangsbestätigung** des Annahme-Eingangs (⚖ § 312i BGB).
|
||||
7. **Zahlung**: Anzahlung/Restzahlung wie `SendBookingReminders`/`RecordPayment`.
|
||||
8. **Abschluss**: `Completed`; Bewertungsanfrage (bestehend).
|
||||
|
||||
Die Akteure „Vermieterin“ und später „KI-Agent“ sind getrennt: Angebotserstellung/Annahme-Prüfung dürfen automatisiert **vorbereiten**; Versand von Preis/Angebot/Absage erfordert zunächst menschliche Freigabe (offene Entscheidung zur späteren Autonomiestufe).
|
||||
|
||||
## 4. Technische Voraussetzungen (Prüfung Ist/Soll)
|
||||
|
||||
| Voraussetzung | Ist | Soll |
|
||||
|---|---|---|
|
||||
| Eindeutige Kennzeichnung der Zahlungspflicht | ❌ | Angebotsseite/Button; Text und Reihenfolge ⚖ |
|
||||
| Dokumentation des Vertragsschlusses | ❌ (nur `confirmed_at`) | `accepted_at`, Angebots-/AGB-Version, Hash, Audit-Event |
|
||||
| Vertragsunterlagen per E-Mail | ✅ (PDF bei Bestätigung) | Beibehalten, um Angebot/AGB-Hash ergänzen |
|
||||
| Sichere Storno-/Kündigungserklärung ohne Konto | ❌ | Signierter Link in jeder Buchungsmail → Formular (Grund optional, Pflicht: Buchungsreferenz via Link-Token); Bestätigungsmail mit Zeitstempel; Alternative: Antwort-Mail; ⚖ ob Pflicht zur elektronischen Erklärung/Button nach § 312k BGB besteht (vermutlich Dauerschuldverhältnis-bezogen, **offen**) |
|
||||
| Nachvollziehbare Stornokosten | ❌ (Freitext) | Staffel als Daten (`cancellation_policy`: ab Tag X vor Anreise Y % vom Mietpreis), Berechnung im `Action`, Anzeige im Angebot und Storno-Beleg; ⚖ Zulässigkeit der Pauschalen (§ 309 Nr. 5 BGB, ggf. Angemessenheit) |
|
||||
| Rückerstattungen | ⚠ negative `Payment` möglich | Erstattungs-Action: Betrag aus Policy, Grund, Beleg, Zahlungsweg (Überweisung), Status in `payments` |
|
||||
| Elektronische Empfangsbestätigung | ⚠ Anfragebestätigung ✅, Annahmebestätigung ❌ | Unmittelbare Mail nach Annahme/Storno |
|
||||
| Zahlungsarten | Überweisung/bar | Keine Online-Zahlung geplant (damit PCI-DSS/PSD2-Thema nicht berührt) |
|
||||
|
||||
## 5. Stornierung (Entwurf)
|
||||
|
||||
1. Gast klickt Link → sieht Buchung, **berechnete Stornokosten** (Policy + Datum), erklärt Storno (Button).
|
||||
2. System setzt `cancel_requested`/`cancelled`, speichert Zeitpunkt (`cancelled_at`, bestehend), `cancelled_by=guest`, berechnet `cancellation_fee`; sendet Bestätigung; Admin-Hinweismail; Observer erzeugt Portal-Entsperraufgaben (bestehend).
|
||||
3. Erstattung: Differenz aus Zahlungen − Kosten → Erstattungsbuchung; Beleg als Dokument.
|
||||
4. Storno durch Vermieterin: wie heute möglich, aber mit Grund, Gast-Mail, automatischer Erstattung (heute nur Statuswechsel).
|
||||
5. Portalbuchungen: Storno läuft über das Portal; System importiert Stornomail (bestehend `PortalEmailType::Cancellation`) und gibt Block frei; Stornokosten/Erstattung nach Portalregeln (manuell, ggf. Portalabrechnung).
|
||||
|
||||
## 6. Kurabgabe, Küstenkarte, Gästemeldung (Kühlungsborn)
|
||||
|
||||
**Trennung der Rechtsgrundlagen (Prüfannahme, ⚖):**
|
||||
- **Bundesrechtlich:** Meldepflicht Beherbergungsstätten (Bundesmeldegesetz, §§ 29 f. BMG; Länder-/Ortsregelungen zu elektronischer Meldung beachten). Zweck: Gästemeldung/Meldeschein; Daten laut Gesetz (u. a. Name, Anschrift, Ankunft/Abreise, Zahl und Staatsangehörigkeit Mitreisender – exakter Umfang ⚖). Aufbewahrungs- und Vernichtungsfristen: **gesetzlich**, nicht frei wählbar.
|
||||
- **Kommunal:** Kurabgabe (Kommunalabgabengesetz M-V + Kurabgabesatzung Ostseebad Kühlungsborn): Abgabepflichtige Personen, Befreiungen, Erhebung durch Beherbergungsbetrieb, Abführung, ggf. Aufwandsentschädigung. Erforderliche Daten (je Person: Alter/Befreiung, Aufenthaltstage) und Fristen ⚖ der Satzung.
|
||||
- **Küstenkarte** (digitale Gästekarte): Ausgabe an Gäste über das lokale System; Leistungen/Daten ⚖ bei Tourist-Information klären.
|
||||
- **feratel MeldeClient:** Laut `docs/PORTALE.md` Schnittstelle für Software-Partner (Testbetrieb); Konditionen, Datenumfang, Rolle (Auftragsverarbeitung oder eigene Verantwortung der Gemeinde) ❓ offen.
|
||||
|
||||
**Datenfluss (Soll, vorbehaltlich Klärung):** Gast liefert Meldedaten (Pre-Check-In-Link, ohne Konto) → Daten **getrennt** vom Buchungs-CRM gespeichert (Tabellen `registrations`, `registration_guests`) → Übermittlung an feratel/Gemeinde → Löschung nach gesetzlicher Frist. Portalgäste: Meldedaten gesondert beim Gast erfragen, nicht aus Portalmails raten.
|
||||
|
||||
**Technische Datenfelder (Entwurf):** je Person Vorname, Nachname, Geburtsdatum/Altersgruppe, Anschrift/Staatsangehörigkeit (nur soweit gesetzlich), An-/Abreise, Befreiungsgrund; je Buchung Kurabgabebetrag (`tourist_tax_amount`) und Erhebungsstatus (`collected_by_host`/`portal`/`on_site`).
|
||||
|
||||
**Offen:** Formal Erhebung der Kurabgabe bei Portalbuchungen (Portal zieht ggf. ein), Abrechnungsweg mit Gemeinde, Rolle Tourist-Information (⚖).
|
||||
|
||||
## 7. Offene Rechtsfragen (Buchungsprozess)
|
||||
|
||||
1. Geltung und Ausgestaltung von § 312j BGB (Button, Informationspflichten) für Beherbergung/Ferienwohnung.
|
||||
2. Anwendbarkeit von § 312k BGB (Kündigungsbutton) auf Ferienwohnungsmietverträge.
|
||||
3. Widerrufsrecht bzw. gesetzliche Ausnahme bei Beherbergung zu bestimmtem Termin (§ 312g BGB).
|
||||
4. Wirksamkeit/Angemessenheit der Stornopauschalen und AGB-Einbeziehung.
|
||||
5. Beweisanforderungen an den Annahmenachweis; Umfang zulässiger Protokolldaten (IP).
|
||||
6. Preisangaben-Pflichten (PAngV) bei Pflichtkosten/Kurabgabe.
|
||||
7. Einbeziehung der Gäste-Informationspflichten (Art. 13/14) in Angebot/Vertrag.
|
||||
8. Zulässigkeit automatisierter Entscheidungen bei Ablehnung/Preisbildung durch KI (Art. 22 DSGVO).
|
||||
@@ -0,0 +1,95 @@
|
||||
# DATENMODELL-KONZEPT – Zielarchitektur Gäste, Buchungen, Portale
|
||||
|
||||
> **Hinweis (22.10.2026):** Von einem Analyse-Agenten erstellt. Die als „verbindlich“ bezeichneten Entscheidungen (E1–E7) sind Annahmen des Agenten, keine Festlegungen der Betreiber. Maßgeblich sind die Entscheidungen in [KONZEPT.md §6a/6b](KONZEPT.md) (u. a. Buchungsweg 1 über Angebot + Annahme, Weg 2 Direktbuchung später; Kurabgabe vor Ort durch Ferienservice Balu).
|
||||
|
||||
Stand: 22.10.2026 · **Entwurf zur Freigabe.** Keine Migration erstellt oder ausgeführt. Grundprinzipien: Datenminimierung, Quellenkennzeichnung, keine geratenen Daten, möglichst Wiederverwendung des Bestands.
|
||||
|
||||
## 1. Bestandsaufnahme (Implementiert?)
|
||||
|
||||
| Anforderung | Bestand | Status |
|
||||
|---|---|---|
|
||||
| Portalübergreifende Gästekartei, interne ID | `guests.id` ✅; aber nur Direktgäste, Dublette nur exakt per E-Mail | Teilweise |
|
||||
| Herkunftsportal | `bookings.source` (Text, z. B. `website`), `referral_source` (Marketing), `blocked_periods.channel_id` + `source` | Teilweise (Portal nur am Block) |
|
||||
| Externe Buchungsreferenz | `blocked_periods.external_uid`, `portal_emails.reference`; nicht am Buchungsdatensatz | Teilweise |
|
||||
| Reservierungs-/Buchungsstatus | `BookingStatus` (8 Werte) ✅; kein Angebot/Annahme | Teilweise |
|
||||
| Mietpreis | `bookings.total/deposit`, `quote` JSON ✅ (nur Direkt) | Teilweise |
|
||||
| Portalgebühren | – | Fehlt |
|
||||
| Kurtaxe | nur Hinweistext | Fehlt |
|
||||
| Zahlungen | `payments` ✅ (Überweisung/bar/sonstige; Erstattung = negativer Betrag) | Vorhanden |
|
||||
| Steuerrelevante Nachweise | Vertrags-PDF (`contract_path`) ✅; keine Rechnungen/Belege/Portalabrechnungen | Teilweise |
|
||||
| Ein-/ausgehende Portalnachrichten | `portal_emails` (nur eingehende Benachrichtigungen, Auszug) | Teilweise |
|
||||
| Dublettenprüfung / Zusammenführung | – | Fehlt |
|
||||
| Datenquelle + Importzeitpunkt | `channel_sync_logs`, `portal_emails.received_at`; nicht am Gast/Buchung | Teilweise |
|
||||
|
||||
## 2. Leitentscheidung (Annahme)
|
||||
|
||||
**Portalbuchungen werden als `Booking` geführt** (nicht länger nur als `BlockedPeriod`), mit `source = <Kanal>`, optionalem Gast und leeren Feldern, wo keine Daten vorliegen. `BlockedPeriod` bleibt für Eigenbelegung, Wartung und rein per iCal bekannte Sperren. Zuordnung `BlockedPeriod` → `Booking` über neue FK, sobald eine Portal-Mail/API die Buchung identifiziert. Vorteil: ein Reporting, ein Zahlungs-/Belegmodell; bestehende `Booking::occupying()`-Logik und Observer greifen weiter. *(Entscheidung/Alternative zu bestätigen.)*
|
||||
|
||||
## 3. Zielmodell (Änderungen am Bestand, kursiv = neu)
|
||||
|
||||
### 3.1 `guests` (Erweiterung)
|
||||
| Feld | Zweck |
|
||||
|---|---|
|
||||
| `id` (intern, bleibt) | eindeutige Gäste-ID |
|
||||
| *`data_source`* (`direct`, `portal_mail`, `portal_api`, `manual`) | Herkunft der Stammdaten |
|
||||
| *`imported_at`* | Importzeitpunkt |
|
||||
| *`merged_into_id`* (nullable FK) | Zusammenführung, Quelle bleibt als „gemergt“ erhalten |
|
||||
| *`address_verified`* / Feldquellen | Kennzeichnung, ob Daten vom Gast selbst stammen |
|
||||
| bestehende Felder | unverändert; `email` darf bei Portalgästen **NULL** sein (Portale liefern oft maskierte Adressen) |
|
||||
|
||||
### 3.2 *`guest_identities`* (optional, später)
|
||||
Mehrere Kennungen je Gast (E-Mail, Portal-Alias, Telefon) mit Quelle – Grundlage der Dublettenprüfung ohne Überschreiben (löst D8).
|
||||
|
||||
### 3.3 `bookings` (Erweiterung)
|
||||
| Feld | Zweck |
|
||||
|---|---|
|
||||
| `source` (bestehend) | Kanal-Schlüssel (`website`, `fewo_direkt`, …) – mit `channels` verknüpfbar |
|
||||
| *`channel_id`* (nullable) | exakte Portalzuordnung |
|
||||
| *`external_reference`* (nullable, unique je Kanal) | Portal-Buchungsnummer, nur wenn belegt |
|
||||
| *`imported_at`*, *`import_source`* (`ical`, `email`, `api`, `manual`) | Quelle/Zeitpunkt |
|
||||
| *`offer_sent_at`, `offer_expires_at`, `accepted_at`, `acceptance_evidence`* (JSON) | Angebot/Annahme, s. BUCHUNGSPROZESS.md |
|
||||
| *`rent_amount`* (bestehend `total` weiterverwendbar), *`portal_fee`*, *`tourist_tax_amount`*, *`tourist_tax_collected_by`* | Beträge in Euro-Cent |
|
||||
| *`cancellation_fee`*, *`cancelled_by`*, *`cancellation_reason`* | Storno |
|
||||
| `contract_path` (bestehend) | wird durch `documents` abgelöst (§3.5) |
|
||||
|
||||
Beträge unverändert als Integer-Cent (Projektregel).
|
||||
|
||||
### 3.4 `payments` (Erweiterung)
|
||||
`type` (`deposit`, `balance`, `refund`, `portal_payout`, `tourist_tax`), `external_reference`, `currency` (EUR). Erstattungen weiter als negativer Betrag oder Typ `refund` (Entscheidung offen).
|
||||
|
||||
### 3.5 *`documents`* (neu) – steuerrelevante Nachweise
|
||||
`booking_id`, `type` (`contract`, `offer`, `invoice`, `receipt`, `portal_statement`, `registration_form`, `correspondence`), `path`, `sha256` (Unveränderbarkeitsnachweis), `created_at`, `retain_until` (aus Löschkonzept), `contains_personal_data`. Dateien auf privatem Disk, nicht öffentlich. Ablösung des Einzelfelds `contract_path`.
|
||||
|
||||
### 3.6 *`messages`* (neu) – Portal-/Gästekommunikation
|
||||
`booking_id`/`guest_id`, `direction` (`in`/`out`), `channel` (`email`, `portal`), `external_id` (z. B. Message-ID, bereits in `portal_emails.message_id`), `subject`, `body` (optional, **mit kurzer Frist**), `received_at`/`sent_at`, `source`. Bestehende `portal_emails` bleibt als Parsing-Protokoll; Auszug (`excerpt`) wird gekürzt/entfernt (D6).
|
||||
|
||||
### 3.7 *`guest_merge_candidates`* (neu, optional)
|
||||
`guest_a_id`, `guest_b_id`, `score`, `reasons` (z. B. gleiche E-Mail, gleicher Name + Zeitraum), `status` (`open`, `merged`, `rejected`). Zusammenführung nur manuell im Admin.
|
||||
|
||||
### 3.8 *`audit_events`* (neu)
|
||||
Wer/Was/Wann für Statuswechsel, Zusammenführung, Export, Anonymisierung, Dokumentabruf – ohne Inhalte, mit Löschfrist.
|
||||
|
||||
## 4. Datenquellen je Feld
|
||||
|
||||
| Feld | iCal | Portal-E-Mail | Autorisierte API | Direkt (Formular) |
|
||||
|---|---|---|---|---|
|
||||
| Zeitraum | ✅ | ✅ (Parser) | ✅ | ✅ |
|
||||
| Portal/Kanal | ✅ (über Channel) | ✅ (Absender) | ✅ | – |
|
||||
| Externe Referenz | UID (nicht Buchungsnr.) | ✅ falls im Text | ✅ | – |
|
||||
| Gastname/E-Mail/Tel. | ❌ | ❓ nur wenn Mail sie enthält | ✅ (vertragsabhängig) | ✅ |
|
||||
| Preis/Gebühren | ❌ | ❓ | ✅ | ✅ (Quote) |
|
||||
| Zahlungen | ❌ | ❌ | ❓ | manuell |
|
||||
| Nachrichten | ❌ | eingeschränkt | ✅ | ✅ (Mail) |
|
||||
|
||||
Regel: Importer schreiben **nur** belegte Felder; Unbekanntes = `NULL` + Kennzeichnung; Parser-Unsicherheit → `needs_review` (bereits so umgesetzt).
|
||||
|
||||
## 5. Dublettenprüfung und Zusammenführung
|
||||
|
||||
1. Exakter Treffer: normalisierte E-Mail (bestehend) → vorschlagen, **nicht** stillschweigend überschreiben.
|
||||
2. Weiche Treffer: Name + Zeitraum/Portal-Referenz, Telefonnummer normalisiert → nur als Kandidat.
|
||||
3. Zusammenführung manuell: Zielgast wählen, Felder einzeln übernehmen, Buchungen umhängen, Quellgast `merged_into_id`, Audit-Eintrag; keine Löschung der Historie.
|
||||
4. Direktanfragen mit bekannter E-Mail aktualisieren Stammdaten **nur nach Bestätigung** (Fix für D8).
|
||||
|
||||
## 6. Wiederverwendung / Umsetzungsreihenfolge (nach Freigabe)
|
||||
|
||||
1. Felder/Migrationen (additiv, rückwärtskompatibel). 2. `documents` + Umzug von `contract_path`. 3. Importpfad Portal-Mail → `Booking` (Parser bleibt). 4. Merge-Kandidaten + Admin-Aktion. 5. Finanzfelder (Gebühren, Kurtaxe). 6. API-Connector über `ChannelConnector` (nur nach Anbieter-/AVV-Klärung).
|
||||
@@ -0,0 +1,224 @@
|
||||
# Datenschutz- und Datenfluss-Audit – Ferienwohnung Stommer
|
||||
|
||||
> **Hinweis (22.10.2026):** Von einem Analyse-Agenten erstellt. Die als „verbindlich“ bezeichneten Entscheidungen (E1–E7) sind Annahmen des Agenten, keine Festlegungen der Betreiber. Maßgeblich sind die Entscheidungen in [KONZEPT.md §6a/6b](KONZEPT.md) (u. a. Buchungsweg 1 über Angebot + Annahme, Weg 2 Direktbuchung später; Kurabgabe vor Ort durch Ferienservice Balu).
|
||||
|
||||
Stand: 22.10.2026 · Art: **Read-only-Codeaudit** (Repository-Stand `main` + lokale, noch nicht committete Änderungen) · Verantwortliche: Brigitte Stommer
|
||||
|
||||
> **Hinweis zur Verwendung:** Dies ist eine technische Bestandsaufnahme, keine Rechtsberatung. Alle Rechtsgrundlagen sind *Prüfannahmen*. Vor Veröffentlichung der Datenschutzerklärung ist eine juristische Prüfung (ggf. Datenschutzbeauftragte/r bzw. Rechtsberatung) erforderlich. Der Bericht ist vor Weitergabe an Dritte zu prüfen und zu validieren.
|
||||
|
||||
**Methodik und Grenzen**
|
||||
- Untersucht: Quellcode, Konfiguration (`config/*`), Migrationen, Views, Routen, Tests-Namen, Betriebsdokumentation (`docs/*`).
|
||||
- **Nicht durchgeführt:** Zugriff auf Staging/Produktion, Browser-/Netzwerkanalyse, Test-Buchungen, Einsicht in Server-`.env`, Strato-Verträge/-Einstellungen. Es gibt daher **kein „tatsächlich beobachtetes Browserverhalten“** – alle Aussagen zu Cookies/Requests sind Codebefunde.
|
||||
- Es wurden keine Zugangsdaten, Tokens oder echten Gästedaten in diesen Bericht übernommen.
|
||||
|
||||
**Statuskennzeichnung:** ✅ Implementiert und im Code belegt · 📄 Nur konfiguriert/dokumentiert · 🗓 Geplant · ❓ Unbekannt / zu prüfen
|
||||
|
||||
---
|
||||
|
||||
## 1. Executive Summary
|
||||
|
||||
**Gesamtbild:** Die Anwendung ist datensparsam aufgebaut. Es gibt **keine Analyse-/Marketing-Dienste, keine externen Skripte/CDNs/Schriften, keine eingebettete Karte, kein Kundenkonto**. Nach Code-Lage setzt die Seite nur technisch notwendige Cookies (Session, XSRF). Gästedaten liegen in einer MySQL/MariaDB bei STRATO; E-Mail-Versand läuft über den Strato-SMTP (Produktion geplant).
|
||||
|
||||
**Positiv (✅):** selbst gehostete Schriften; Double-Opt-in für Angebots-E-Mails mit signiertem Abmeldelink; automatische Anonymisierung nach Aufbewahrungsfrist (Standard 10 Jahre, Steuerberatung zu bestätigen); Honeypot + IP-Rate-Limit am Buchungsformular; Admin-Rollen mit Policies; Pflicht-2FA für Admins; HMAC-signierte Webhooks; iCal-Feed ohne Gästedaten; Mietvertrag-PDF nicht öffentlich abgelegt.
|
||||
|
||||
**Wichtigste Lücken (Details §5):**
|
||||
1. **Datenschutzerklärung und Impressum sind leer** (`legal.privacy`/`legal.imprint` ohne Default) – Blocker für die Produktivsetzung.
|
||||
2. **Anonymisierung ist unvollständig:** Vertrags-PDFs, `portal_emails.excerpt`, `bookings.internal_notes`, Bewertungen (Name, privates Feedback), UTM-Daten, Sitzungs-IPs und Logs werden nicht mitgelöscht/anonymisiert.
|
||||
3. **Kein dokumentiertes Löschkonzept für Nicht-Buchungen:** Abgelaufene/abgelehnte Anfragen bleiben (Guest + Booking) bis zur 10-Jahres-Anonymisierung gespeichert – Frist vermutlich zu lang für Anfragen ohne Vertragsabschluss (juristisch prüfen).
|
||||
4. **Backups:** Datenbank-Backups sind nur im Konzept („täglich“) erwähnt, im Code/Deployment nicht belegt (❓).
|
||||
5. **Geheimnisse in URL-Query** (`?token=` für `/health/sync`, `/automation/scheduler`) landen in Server-/Proxy-Logs; Betrieb über n8n auf einem „privaten Server“ ist eine Auftragsverarbeitungs-/Drittlandfrage, falls dort Gästedaten fließen.
|
||||
6. **Kein Angebot/Annahme-Schritt im System:** Der Prozess kennt nur *Anfrage (Reserved) → vom Vermieter bestätigt (Confirmed)*; die Gast-Annahme ist nicht abgebildet. Das ist für Datenschutzerklärung (Vertragsanbahnung) und AGB relevant.
|
||||
7. **KI:** Keine KI-Komponente im Code vorhanden (🗓 nur perspektivisch). Vor Einführung sind AVV, Drittlandtransfer, Art. 22 DSGVO und DSFA zu klären.
|
||||
8. **Fehlende Security-Header** (CSP, HSTS, X-Frame-Options etc.) im Anwendungscode; ggf. nur über Strato/.htaccess (❓).
|
||||
|
||||
---
|
||||
|
||||
## 2. Systemübersicht und Datenflussdiagramm
|
||||
|
||||
### 2.1 Technik (alle ✅ soweit nicht anders vermerkt)
|
||||
|
||||
| Bereich | Befund | Quelle |
|
||||
|---|---|---|
|
||||
| Framework | Laravel 13 (PHP 8.4), Livewire, Filament 5 (Admin `/admin`), Blade-Theme-System, Tailwind/Vite (lokal gebaut) | `composer.json`, `CLAUDE.md` |
|
||||
| Hosting | STRATO Shared Webhosting (Hosting Pro), kein Node zur Laufzeit; Atomic Releases, nur aktive Version auf dem Server | `docs/BETRIEB.md` §2, `docs/DEPLOYMENT.md` |
|
||||
| Datenbank | MariaDB (STRATO) in Staging 📄; lokal SQLite. Enthält Gäste, Buchungen, Zahlungen, Sessions, Cache, Jobs | `docs/BETRIEB.md` §3, `database/migrations/*` |
|
||||
| Dateispeicher | `storage/app` (privat: Vertrags-PDFs) und `storage/app/public` (Fotos, WebP-Größen); Spatie Media Library | `app/Documents/RentalContract.php`, `config/filesystems.php`, `config/media-library.php` |
|
||||
| Sessions/Cache/Queue | `database`-Treiber; Queue `sync` (kein Worker) | `config/session.php`, `docs/BETRIEB.md` §5 |
|
||||
| Mail | Staging: `MAIL_MAILER=log` (E-Mails landen im Logfile!); Produktion: Strato-SMTP 🗓/📄 | `docs/BETRIEB.md` §1/§5, `config/mail.php` |
|
||||
| Postfach-Abruf | IMAP (Strato) für Portal-Benachrichtigungen, Staging aus, Produktion 🗓 | `app/Channels/Mail/MailboxReader.php`, `config/fewo.php` |
|
||||
| Logging | Laravel-Log (Datei `storage/logs`, Level `debug` als Default); Slack/Papertrail-Kanäle nur als Framework-Defaults, nicht aktiv konfiguriert (❓ Produktiv-`.env`) | `config/logging.php` |
|
||||
| Monitoring | Eigener Endpoint `/health/sync` (Token), geplant n8n als externer Wächter 📄 | `ChannelController::health`, `docs/KONZEPT.md` |
|
||||
| Fehlerberichte | Kein Sentry/Bugsnag o. Ä. (nicht in `composer.json`) | `composer.json` |
|
||||
| Drittanbieter-Pakete (lokal ausgeführt) | dompdf (PDF), webklex/php-imap, Filament, Spatie Media Library – keine ausgehenden Aufrufe an Dritte außer IMAP/SMTP | `composer.json` |
|
||||
| Backups | ❓ Nicht belegt (Konzept: „Datenbank-Backups täglich“ 🗓); Strato-eigene Backups unbekannt | `docs/KONZEPT.md` Z. 153 |
|
||||
|
||||
### 2.2 Datenflussdiagramm
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
G[Gast / Besucher<br/>Browser] -->|HTTPS| W[stommer.info bzw. fewo-stommer.de<br/>Laravel auf STRATO]
|
||||
W -->|Anfrage-Formular: Name, E-Mail, Adresse, Telefon, Nachricht| DB[(MariaDB bei STRATO<br/>guests, bookings, payments,<br/>reviews, sessions, cache)]
|
||||
W -->|SMTP| SM[STRATO Mail-Server]
|
||||
SM -->|Bestätigungen, Erinnerungen, Vertrag| G
|
||||
SM -->|Benachrichtigung neue Anfrage| V[Vermieterin<br/>fewo@… Postfach]
|
||||
A[Admin /admin<br/>Rollen + 2FA] --> W
|
||||
W --- FS[(storage: Vertrags-PDFs,<br/>Fotos, Logs)]
|
||||
P1[FeWo-direkt u. a. Portale] -->|iCal-Import: Belegung ohne Gästedaten| W
|
||||
W -->|iCal-Export 'Belegt'<br/>Token-URL, ohne Gästedaten| P1
|
||||
P1 -->|Buchungs-E-Mail inkl. ggf. Gästedaten| PM[Postfach bei STRATO]
|
||||
PM -->|IMAP jede Minute| W
|
||||
N8N[n8n auf privatem Server 📄/🗓] -->|GET health / scheduler mit Token| W
|
||||
W -->|optional Webhook, HMAC-signiert 📄| N8N
|
||||
KI[KI-Agent 🗓] -.nicht implementiert.-> W
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Verarbeitungstätigkeiten
|
||||
|
||||
Rechtsgrundlagen sind **Prüfannahmen** (juristisch zu bestätigen).
|
||||
|
||||
| # | Verarbeitung | Datenkategorien | Zweck | Quelle → Empfänger | Speicherort | Aufbewahrung / Löschung | Prüfannahme Rechtsgrundlage | Sicherheit | Status |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| V1 | Buchungsanfrage / Vorreservierung | Vor-/Nachname, E-Mail, Telefon (opt.), Anschrift (opt.), Reisedaten, Personenzahl, Extras, Preisangebot (JSON), freier Nachrichtentext, Herkunft (`referral_source`, `utm_*`) | Vertragsanbahnung, Verfügbarkeit halten | Gast → Vermieterin, STRATO (Hosting, SMTP) | Tabellen `guests`, `bookings` | Keine Löschung nach Ablauf/Ablehnung; nur Nachricht-Nullung + Anonymisierung nach `guest_retention_years` (10 J.) seit letztem Aufenthalt/Anlage, monatlicher Job `guests:anonymize` | Art. 6 (1) b; Herkunft/UTM ggf. Art. 6 (1) f | HTTPS (📄), Honeypot, IP-Rate-Limit 5/h, CSRF (Livewire), Validierung | ✅ `app/Livewire/BookingRequest.php`, `app/Actions/CreateReservation.php`, `app/Actions/AnonymizeGuests.php` |
|
||||
| V2 | Eingangs-/Bestätigungs-E-Mails | Gästedaten, Preisangebot, Nachricht | Information, Vermieter-Benachrichtigung | Anwendung → Gast, Vermieterin | Strato-SMTP; Staging: Logfile | Mailversand-Kopien: ❓ (Strato-Postfach); Log-Rotation ❓ | Art. 6 (1) b | SMTP-Transportverschlüsselung ❓ | ✅ `app/Mail/*`, `resources/views/mail/*` |
|
||||
| V3 | Bestätigung / verbindliche Buchung + Mietvertrag (PDF) | Gäste- und Buchungsdaten, Preise, Zahlungstermine | Vertragserfüllung, Abrechnung | Vermieterin → Gast | `storage/app/private/contracts/…pdf` (Disk `local`), Pfad in `bookings.contract_path` | **Nicht** durch Anonymisierung gelöscht (PDF enthält Namen/Anschrift) | Art. 6 (1) b, c (§ 147 AO) | Nicht öffentlich erreichbar; Download nur Admin | ✅ `app/Actions/ConfirmBooking.php`, `app/Documents/RentalContract.php` |
|
||||
| V4 | Zahlungserfassung & -erinnerungen | Zahlbeträge, Datum, Methode, Notiz, erfassende Person; Bankdaten des Vermieters in Mail | Zahlungsabwicklung (manuell, Überweisung) | Vermieterin → Gast | `payments`; `FEWO_BANK_*` in `.env` | Buchhaltungsaufbewahrung (Steuerberater klären) | Art. 6 (1) b, c | Kein Zahlungsdienstleister, keine Kartendaten (**PCI-DSS nicht berührt**) | ✅ `app/Actions/RecordPayment.php`, `SendBookingReminders.php` |
|
||||
| V5 | Ankunftsinformation, Bewertungsanfrage | E-Mail, Name, Reisedaten | Gästeservice | Anwendung → Gast | `bookings.*_sent_at` | s. V1 | Art. 6 (1) b bzw. (1) f (Bewertungsmail: juristisch prüfen, § 7 UWG) | Signierter, 90 Tage gültiger Link | ✅ `app/Actions/RequestReviews.php`, `app/Mail/ReviewRequest.php` |
|
||||
| V6 | Bewertungen | Anzeigename, Bewertungstext, privates Feedback, Einwilligung zur Veröffentlichung, Aufenthaltsdatum | Qualitätssicherung, Veröffentlichung nach Freigabe | Gast → Vermieterin → öffentlich (bei Einwilligung) | `reviews` | **Keine** Löschung/Anonymisierung (nicht in `Guest::anonymize`) | Art. 6 (1) a (Veröffentlichung), (1) f | Moderation (Status Pending) | ✅ `app/Actions/SubmitReview.php`, `app/Livewire/ReviewForm.php` |
|
||||
| V7 | Newsletter / Angebots-E-Mails | E-Mail, Name, Einwilligungszeitpunkt | Marketing | Gast (Opt-in im Formular) → Vermieterin | `guests.marketing_consent_at` | Widerruf per Abmeldelink; Anonymisierung entfernt Consent | Art. 6 (1) a, § 7 (2) UWG (DOI) | Signierte Links, DOI (14 Tage). **Hinweis:** Versandfunktion von Angebots-Mails selbst im Code nicht gefunden – nur Consent + CSV-Export | ✅ (Consent) / ❓ (Versand) `MarketingConsentController`, `RequestMarketingConsent`, `ListGuests` Export |
|
||||
| V8 | Gästekartei (CRM) | Stammdaten, Notizen, Tags, Aufenthalte | Kundenpflege | Vermieterin | `guests` (Notizen, Tags) | s. V1; Notizen/Tags bei Anonymisierung gelöscht ✅ | Art. 6 (1) f | Policy: nur Rolle `rentals` (+admin) | ✅ `app/Models/Guest.php`, `app/Filament/Resources/Guests` |
|
||||
| V9 | CSV-Export Gäste | Alle Stammdaten nicht anonymisierter Gäste | Mailing/Verwaltung | Admin-Download | Browser des Admins | Verantwortung beim Nutzer; kein Export-Log | Art. 6 (1) f | Nur eingeloggte Rolle; kein Audit-Log ❓ | ✅ `app/Filament/Resources/Guests/Pages/ListGuests.php` |
|
||||
| V10 | Portal-Kalenderabgleich (iCal) | Nur Zeiträume („Belegt“); keine Gästedaten | Doppelbuchungen vermeiden | Portal ↔ Anwendung | `blocked_periods`, `channels`, `channel_sync_logs` | – | Art. 6 (1) b/f (kein Personenbezug im Feed) | Token-URL (`export_token`), Throttle 60/min | ✅ `app/Channels/ICal/*`, `ChannelController::feed` |
|
||||
| V11 | Portal-Buchungs-E-Mails (Schnellpfad) | Absender, Betreff, **500-Zeichen-Auszug des Mailtextes** (kann Gästedaten enthalten), Referenz, Zeitraum | Sofortige Sperre | Portal → IMAP-Postfach → Anwendung → Vermieterin | `portal_emails`; Postfach | **Keine Löschfrist, keine Anonymisierung** | Art. 6 (1) b/f | IMAP über SSL, Zertifikatsprüfung; Parsing, „nie raten“ | ✅ Code / 🗓 Produktivbetrieb. `ProcessPortalMail`, `MailboxReader` |
|
||||
| V12 | Admin-Konten | Name, E-Mail, Passwort-Hash, Rolle, 2FA-Secret (verschlüsselt), Sessions | Zugriff Verwaltung | Admin | `users`, `sessions` | bis Löschung durch Admin | Art. 6 (1) f | bcrypt, Pflicht-2FA (Admins), Session `AuthenticateSession` | ✅ `AdminPanelProvider`, `RequireTwoFactorForAdmins` |
|
||||
| V13 | Server-/Anwendungs-Logs & Sessions | IP-Adresse, User-Agent (Tabelle `sessions`), Zeit, Fehler-Stacktraces (ggf. mit Daten), Rate-Limit-Schlüssel mit IP (Cache) | Betrieb, Sicherheit, Missbrauchsschutz | Besucher → Hosting | `sessions`, `cache`, `storage/logs`, STRATO-Webserver-Logs (❓) | Session-Lifetime 120 min, aber Zeilen werden bis Garbage-Collection vorgehalten; Log-Rotation ❓ | Art. 6 (1) f | – | ✅ `0001_01_01_000000_create_users_table.php`, `config/session.php`; Webserver-Logs ❓ |
|
||||
| V14 | Analyse / Tracking | – | – | – | – | – | – | – | ✅ **nicht vorhanden** (kein Matomo/GA/Pixel) |
|
||||
| V15 | Automation/Webhook (n8n) | Aufgabeninhalte (Sperr-Aufgaben: Zeiträume, ggf. Referenz), Health-Status | Portalsperre, Überwachung | Anwendung ↔ privater Server | extern ❓ | ❓ | ❓ | HMAC-SHA256, Token | 📄 `config/fewo.php` (`automation`), `docs/PORTALE.md` |
|
||||
| V16 | KI-gestützte Buchungsbearbeitung | – | – | – | – | – | – | – | 🗓 **kein Code vorhanden** |
|
||||
|
||||
---
|
||||
|
||||
## 4. Externe Dienste und Empfänger
|
||||
|
||||
| Dienst | Rolle | Daten | Belegt in | Status | Offene Punkte |
|
||||
|---|---|---|---|---|---|
|
||||
| **STRATO AG** (Hosting, DB, SMTP/IMAP, Domains) | Auftragsverarbeiter (vermutlich) | Alle Anwendungsdaten, E-Mails, Logs | `docs/BETRIEB.md` | ✅/📄 | AVV-Abschluss prüfen; Serverstandort/Backup-Verhalten ❓; Mail-Kanal TLS ❓ |
|
||||
| **OpenStreetMap** | Nur *Verlinkung* (kein Einbetten) | Adresse als URL-Parameter nur bei Klick des Besuchers auf `https://www.openstreetmap.org/search?query=…`; **keine Tile-Server-Anfragen** beim Seitenaufruf | `app/Themes/Sections/LocationSection.php`, `resources/themes/ostsee-licht/views/sections/location.blade.php` | ✅ | Bei Klick Übermittlung IP an OSMF (Datenschutzerklärung erwähnen). Falls später eingebettete Karte: Einwilligung/2-Klick |
|
||||
| **Schriftarten** | Selbst gehostet (`@fontsource`, vom Build gebündelt) | – | `resources/themes/ostsee-licht/theme.css`, `docs/THEMES.md` | ✅ | Im gebauten Output stichprobenartig prüfen (kein `fonts.googleapis`) |
|
||||
| **Externe Skripte/CDNs/Bilder** | Keine gefunden (`grep` über `resources/`, nur `schema.org`-Kennung und `sitemaps.org`-Namespace als Bezeichner, keine Abrufe) | – | `resources/**` | ✅ | Browser-Verifikation nötig (❓) |
|
||||
| **FeWo-direkt / Vrbo / weitere Portale** | Eigenständig Verantwortliche für ihre Gästedaten; Empfänger/Absender von iCal | iCal: nur Zeiträume. Portal-Mails: ggf. Gästedaten | `app/Channels/*`, `docs/PORTALE.md` | ✅ iCal / 📄 Portal-Mail | Prüfen, welche Gästedaten die Portal-Mails tatsächlich enthalten |
|
||||
| **n8n / privater Server (FastAPI, Playwright)** | Unabhängiger Wächter / Browser-Bot | Health-Status; ggf. Sperr-Aufgaben | `docs/KONZEPT.md` Z. 139, `docs/PORTALE.md` Z. 89 | 📄/🗓 | Standort, Betreiber, Logs, AVV ❓ (privat betrieben → Haushaltsausnahme gilt hier nicht automatisch) |
|
||||
| **Gitea (gitea.stommer.de)** | Code-Repository/CI | Kein Gästedatenfluss (Repo enthält keine `.env`; Fotolisten-CSV) | `CLAUDE.md`, `.gitignore` | ✅ | Prüfen, dass nie Echtdaten/DB-Dumps committet werden |
|
||||
| **KI-Anbieter** | – | – | – | 🗓 nicht vorhanden | s. §5/§6 |
|
||||
| **Slack/Papertrail/AWS/Postmark/Resend** | Nur Framework-Platzhalter in Configs, nicht aktiv | – | `config/logging.php`, `config/services.php` | 📄 | Sicherstellen, dass Produktiv-`.env` sie nicht aktiviert |
|
||||
|
||||
---
|
||||
|
||||
## 5. Gap-Analyse mit Risikopriorität
|
||||
|
||||
Priorität: **K** = kritisch (Blocker für Go-Live), **H** = hoch, **M** = mittel, **N** = niedrig.
|
||||
|
||||
| ID | Prio | Befund | Beleg | Empfehlung |
|
||||
|---|---|---|---|---|
|
||||
| G1 | **K** | Datenschutzerklärung und Impressum haben keinen Inhalt (`default => null`); Link-Pflicht Art. 13 DSGVO / § 5 DDG | `config/content.php` Z. 48–49, `SiteSeeder.php` | Texte erstellen/juristisch prüfen lassen, bevor Produktion indexiert wird; Faktenbasis siehe §8 |
|
||||
| G2 | **K** | Einwilligungstext im Formular ist ein Einverständnis zur Speicherung „(siehe Datenschutzerklärung)“ – Verlinkung/Art. 13-Information unklar; Rechtsgrundlage Vertragsanbahnung braucht eigentlich keine Einwilligung | `resources/views/livewire/booking-request.blade.php` Z. 204–207 | Text auf Information umstellen, Link auf Datenschutzerklärung und Hinweis auf Pflichtfelder; juristisch prüfen |
|
||||
| G3 | **H** | Anonymisierung unvollständig: Vertrags-PDFs, `portal_emails.excerpt`, `bookings.internal_notes`, `bookings.utm_*`, Reviews (`display_name`, `private_feedback`), Zahlungsnotizen | `app/Models/Guest.php::anonymize` | Löschkonzept: je Datenkategorie Frist definieren (§ 147 AO: 6/8/10 Jahre – nur steuerlich relevante Unterlagen); PDFs nach Frist löschen; Auszüge/Notizen leeren; Reviews anonymisieren |
|
||||
| G4 | **H** | Keine Löschung von Anfragen ohne Vertragsabschluss (Reserved/Expired/Declined) vor 10 Jahren | `AnonymizeGuests`, `ExpireReservations` | Eigene, kürzere Frist (z. B. Monate bis wenige Jahre – juristisch festlegen) und Job |
|
||||
| G5 | **H** | Backups nicht belegt; Wiederherstellbarkeit, Verschlüsselung, Aufbewahrung, Löschung aus Backups ❓ | `docs/KONZEPT.md` | Backup-Verfahren dokumentieren (Strato-Backup oder eigener `mysqldump`), Retention an Löschkonzept koppeln |
|
||||
| G6 | **H** | Betriebsgeheimnisse als Query-Parameter (`?token=`) → Logs/Proxys | `ChannelController::health/scheduler` | Token per Header (`Authorization`/`X-Token`) statt Query; Webserver-Logs auf Tokens prüfen |
|
||||
| G7 | **H** | n8n/privater Server mit Zugriff auf Betriebsdaten und evtl. Gästedaten; Rolle (Auftragsverarbeiter/eigenverantwortlich) und Absicherung unklar | `docs/PORTALE.md` Z. 89 | Datenfluss minimieren (keine Gästedaten in Webhooks), Standort/Logs dokumentieren, ggf. AVV/TOMs |
|
||||
| G8 | **H** | Logfile als Mailkanal in Staging; im Produktivbetrieb `LOG_LEVEL=debug`-Default; Logs können personenbezogene Daten enthalten (Exceptions, Mails) | `config/logging.php`, `docs/BETRIEB.md` | Produktiv: `LOG_LEVEL=warning`/`error`, `LOG_CHANNEL=daily` mit Rotation (`LOG_DAILY_DAYS`), `MAIL_MAILER=smtp`; keine Daten in Exception-Meldungen |
|
||||
| G9 | **M** | Cookies: nach Code (Standard-Laravel-`web`-Stack) werden `…-session` und `XSRF-TOKEN` bei jedem Seitenaufruf gesetzt (technisch notwendig → i. d. R. kein Banner, aber Information in DSE und TDDDG-Prüfung). **Nicht im Browser verifiziert** | `bootstrap/app.php`, `config/session.php` | Browser-Test (DevTools), Cookie-Tabelle für DSE; Local/Session Storage: im eigenen JS nicht genutzt ✅ |
|
||||
| G10 | **M** | Session-Tabelle speichert IP + User-Agent aller Besucher (mit Session) | `0001_01_01_000000_create_users_table.php` | Gesetzten Zweck/Löschfrist dokumentieren; ggf. Session nur für Seiten mit Formular starten |
|
||||
| G11 | **M** | Sicherheits-Header nicht im Code gesetzt (CSP, HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy) | Grep über `app/`, `bootstrap/`, `public/.htaccess` | Per Middleware oder `.htaccess` ergänzen; HSTS erst nach HTTPS-Prüfung |
|
||||
| G12 | **M** | Review-Link (signiert, 90 Tage) ohne Throttle; Signatur schützt, aber Brute-Force/Spam auf Formular begrenzen | `routes/web.php` | `throttle` ergänzen |
|
||||
| G13 | **M** | Zugriff ohne Kundenkonto: Gäste erhalten keine Online-Einsicht – Auskunfts-/Löschwünsche laufen manuell; Löschung eines einzelnen Gastes nur über „Anonymisieren“ (Aktion im Admin, Code `Guest::anonymize`) | `app/Models/Guest.php` | Prozess für Betroffenenrechte (Art. 15–21) dokumentieren, Frist 1 Monat |
|
||||
| G14 | **M** | Kein Audit-Log für Admin-Zugriffe/Exporte/Statuswechsel (nur Zahlungs-`recorded_by`, Sync-Logs) | – | Minimal-Protokoll für Export, Anonymisierung, Statuswechsel erwägen |
|
||||
| G15 | **M** | Admin-Rollen: `rentals` darf Gäste exportieren; 2FA nur für `admin` verpflichtend | `GuestPolicy`, `AdminPanelProvider` | 2FA für `rentals` ebenfalls verpflichtend erwägen |
|
||||
| G16 | **M** | Selbstregistrierung/Passwort-Reset: Reset-Mails und Passwortrichtlinie nicht geprüft | – | Prüfen (❓) |
|
||||
| G17 | **M** | Dev-Zugangsdaten (`admin@example.com`/`password`) in Doku für lokale Entwicklung; Sicherstellen, dass Seeder nie in Produktion läuft | `docs/BETRIEB.md` §7 | In Produktion nur `ProductionSeeder` (bereits dokumentiert ✅) |
|
||||
| G18 | **M** | Prozessbeschreibung Angebot/Annahme fehlt: Status kennen weder „Angebot versandt“ noch „vom Gast angenommen“; „Bestätigt“ = Verbindlichkeit durch Vermieterin, Mail „Erst mit unserer Bestätigung ist die Buchung verbindlich“ | `BookingStatus`, `reservation-received.blade.php` | Vertragsmechanik (Annahme durch Gast) rechtlich klären und – falls gewünscht – implementieren; DSE-Text entsprechend |
|
||||
| G19 | **N** | OSM-Link überträgt Adresse nur bei Klick | `LocationSection.php` | In DSE erwähnen |
|
||||
| G20 | **N** | UTM-/Herkunftsdaten werden zusammen mit Buchung gespeichert | `BookingRequest.php`, `CreateReservation.php` | Zweck/Rechtsgrundlage in DSE; Löschfrist festlegen |
|
||||
| G21 | **N** | Fotos: Kein EXIF-Stripping im Code gefunden (GPS-Daten in Fotos möglich) | Grep `exif` negativ | Prüfen, ob WebP-Konvertierung Metadaten entfernt |
|
||||
| G22 | **N** | Review-Anonymität: `display_name` Freitext; Veröffentlichung nur bei `publish_consent` | `ReviewForm` | Hinweis im Formular auf Pseudonym |
|
||||
|
||||
### KI-spezifische Lücken (🗓, vorausschauend)
|
||||
- **K (vor Einführung):** Anbieter, Modell, Region (EU/EWR vs. Drittland), AVV, Zero-Data-Retention/Opt-out vom Training, Subprozessoren – alle ❓.
|
||||
- **H:** Art. 22 DSGVO: Preise/Angebote/Ablehnungen nicht vollautomatisch ohne menschliche Freigabe; aktuell hat kein Code KI-Entscheidungsbefugnisse (✅ Entscheidungen manuell in Admin: `ConfirmBooking`, `DeclineBooking`).
|
||||
- **H:** Datenminimierung: Pseudonymisierung vor Übergabe an KI (keine Namen/Anschriften), Prompt-/Antwort-Logging mit Löschfrist, Audit-Log je KI-Aktion.
|
||||
- **M:** DSFA-Pflicht prüfen (Datenschutzbeauftragte/r / Rechtsberatung); KI-Transparenz (Art. 13 (2) f.).
|
||||
|
||||
---
|
||||
|
||||
## 6. Offene Fragen
|
||||
|
||||
1. Wer ist Hosting-Vertragspartner (Strato-Vertrag, AVV abgeschlossen?) und wo liegen Server/Backups?
|
||||
2. Wird für die Produktion ein Cookie-/TDDDG-Konzept benötigt, oder bleibt es bei rein technischen Cookies? (Browserverifikation fehlt)
|
||||
3. Welche Gästedaten enthalten die FeWo-direkt-/Vrbo-Buchungsmails tatsächlich (Name, E-Mail, Telefon)? Werden diese in `portal_emails.excerpt` gespeichert?
|
||||
4. Welche Aufbewahrungsfristen gelten für: Anfragen ohne Vertrag, Verträge/Rechnungen, Zahlungsnachweise, Bewertungen, Marketing-Einwilligungen? (Steuerberatung/Rechtsberatung)
|
||||
5. Wie wird der Versand der Angebots-/Newsletter-Mails technisch erfolgen? (Im Code nur Einwilligung + CSV-Export gefunden – wird extern versendet? Dann Dienstleister/AVV.)
|
||||
6. Wo läuft n8n (Standort, Betreiber), welche Daten erhält es, wie wird abgesichert?
|
||||
7. Welcher Anbieter/welches Modell soll für die KI-gestützte Buchungsbearbeitung genutzt werden, mit welchen Daten, in welcher Region, mit welcher menschlichen Freigabe?
|
||||
8. Werden Server-Zugriffslogs bei Strato geführt, wie lange, und sind IP-Adressen gekürzt?
|
||||
9. Wie wird ein Backup/Restore getestet, und wie werden Löschungen in Backups umgesetzt?
|
||||
10. Ist ein Verarbeitungsverzeichnis (Art. 30) vorhanden? Ist die Benennung eines Datenschutzbeauftragten erforderlich?
|
||||
11. Gibt es weitere Empfänger (Steuerberater, Buchhaltung, Kurverwaltung/Meldeschein, Kurtaxe)?
|
||||
12. Soll es einen verbindlichen Angebots-/Annahmeprozess im System geben (G18)?
|
||||
13. Wird in der Produktion ein eigener Cookie-Banner/Einwilligungs-Mechanismus benötigt (derzeit **kein** Mechanismus vorhanden)?
|
||||
|
||||
---
|
||||
|
||||
## 7. Maßnahmenplan für die Produktivsetzung
|
||||
|
||||
**Vor Go-Live (Blocker)**
|
||||
1. Impressum und Datenschutzerklärung erstellen und rechtlich prüfen lassen; Verlinkung im Footer und im Formular (G1, G2).
|
||||
2. AVV mit STRATO prüfen/abschließen; Verarbeitungsverzeichnis anlegen.
|
||||
3. Produktiv-`.env`: `APP_ENV=production`, `APP_DEBUG=false`, `LOG_LEVEL` ≥ warning, `LOG_CHANNEL=daily`, `MAIL_MAILER=smtp` mit TLS, `SESSION_SECURE_COOKIE=true` (G8).
|
||||
4. Backup-Verfahren einrichten und Restore testen (G5).
|
||||
5. Löschkonzept festlegen und umsetzen (G3, G4); Datenschutzerklärung entsprechend ausrichten.
|
||||
6. Browser-Verifikation: Netzwerk-/Cookie-Analyse auf Staging (G9), Ergebnis in DSE übernehmen.
|
||||
7. Security-Header ergänzen (G11); Tokens aus der Query in Header verlegen (G6).
|
||||
|
||||
**Kurzfristig nach Go-Live**
|
||||
8. 2FA auch für Rolle `rentals` (G15); Audit-Log für Export/Anonymisierung (G14); Throttle Review-Route (G12).
|
||||
9. Betroffenenrechte-Prozess dokumentieren (G13).
|
||||
10. n8n-Datenfluss dokumentieren und minimieren (G7).
|
||||
|
||||
**Vor KI-Einsatz**
|
||||
11. DSFA-/Risikoprüfung, Anbieterwahl, AVV, Drittlandfrage, Pseudonymisierung, menschliche Freigabe bei Preis/Angebot/Annahme/Ablehnung, Audit-Log (KI-Abschnitt §5).
|
||||
|
||||
---
|
||||
|
||||
## 8. Faktenbasis für die neue Datenschutzerklärung
|
||||
|
||||
*(Faktenlage aus dem Code – Text und Rechtsgrundlagen juristisch zu formulieren.)*
|
||||
|
||||
| Thema | Faktenbasis | Status |
|
||||
|---|---|---|
|
||||
| Verantwortliche | Brigitte Stommer (Name/Anschrift/Kontakt aus `config/fewo.php`, `legal.imprint`) | 📄 |
|
||||
| Hosting | STRATO (Webspace, Datenbank, E-Mail) | 📄 |
|
||||
| Server-Logfiles | Beim Aufruf fallen technisch IP, Zeit, URL, User-Agent im Hosting an (Strato-Standard, ❓) | ❓ |
|
||||
| Cookies | Session-Cookie und XSRF-Token (technisch notwendig), Laufzeit bis Ende der Session/120 Minuten; kein Tracking | ✅ Code / ❓ Browser |
|
||||
| Local/Session Storage | Von der Anwendung nicht verwendet | ✅ |
|
||||
| Schriftarten | Lokal eingebunden | ✅ |
|
||||
| Karten | Nur Link zu OpenStreetMap (Klick); keine Einbettung | ✅ |
|
||||
| Analyse/Marketing-Tracking | Keine | ✅ |
|
||||
| Buchungsanfrage | Pflichtfelder: Anreise, Abreise, Personen, Vorname, Nachname, E-Mail, Zustimmung; optional: Telefon, Anschrift, Nachricht, Herkunft, Newsletter | ✅ |
|
||||
| Speicherung | Datenbank bei STRATO; Anonymisierung nach `guest_retention_years` (Standard 10 Jahre) | ✅ / Frist juristisch ❓ |
|
||||
| E-Mails | Eingangsbestätigung, Buchungsbestätigung mit Vertrag (PDF), Zahlungserinnerung, Ankunftsinfo, Bewertungsanfrage, ggf. Ablehnung | ✅ |
|
||||
| Newsletter | Opt-in im Formular + Double-Opt-in-Link (14 Tage), Abmeldelink in Mails; Widerruf jederzeit | ✅ |
|
||||
| Bewertungen | Freiwillig, Veröffentlichung nur bei Einwilligung und Freigabe | ✅ |
|
||||
| Zahlungen | Überweisung, manuelle Erfassung; kein Zahlungsdienstleister | ✅ |
|
||||
| Portale | Kalenderabgleich per iCal ohne Gästedaten; Auswertung von Portal-Benachrichtigungs-E-Mails (nur 500 Zeichen Auszug, Zeiträume) | ✅ Code / 🗓 Produktiv |
|
||||
| Empfänger | STRATO (Hosting/Mail); ggf. Portalbetreiber; ggf. Steuerberater | ❓ |
|
||||
| Drittlandübermittlung | Keine bekannt (✅ nach Code) – Strato-Subunternehmer ❓ | ❓ |
|
||||
| KI | Derzeit **keine** KI-Verarbeitung; bei Einführung DSE aktualisieren | 🗓 |
|
||||
| Betroffenenrechte | Art. 15–21, Beschwerderecht – Texte juristisch zu formulieren | ❓ |
|
||||
| Automatisierte Entscheidungen | Keine (alle Statuswechsel manuell durch Vermieterin) | ✅ |
|
||||
|
||||
---
|
||||
|
||||
### Anhang: wichtigste Quelldateien
|
||||
`app/Livewire/BookingRequest.php`, `app/Actions/{CreateReservation,ConfirmBooking,DeclineBooking,ExpireReservations,RecordPayment,AnonymizeGuests,RequestMarketingConsent,SubmitReview,RequestReviews,SendBookingReminders,ProcessPortalMail}.php`, `app/Models/Guest.php`, `app/Channels/**`, `app/Http/Controllers/{ChannelController,MarketingConsentController}.php`, `routes/web.php`, `routes/console.php`, `config/{fewo,channels,session,logging,mail,filesystems,content}.php`, `database/migrations/*`, `resources/themes/ostsee-licht/**`, `docs/{BETRIEB,DEPLOYMENT,KONZEPT,PORTALE,THEMES}.md`.
|
||||
@@ -0,0 +1,54 @@
|
||||
# DATENSCHUTZ-FAKTENBASIS – Grundlage für die Datenschutzerklärung
|
||||
|
||||
> **Hinweis (22.10.2026):** Von einem Analyse-Agenten erstellt. Die als „verbindlich“ bezeichneten Entscheidungen (E1–E7) sind Annahmen des Agenten, keine Festlegungen der Betreiber. Maßgeblich sind die Entscheidungen in [KONZEPT.md §6a/6b](KONZEPT.md) (u. a. Buchungsweg 1 über Angebot + Annahme, Weg 2 Direktbuchung später; Kurabgabe vor Ort durch Ferienservice Balu).
|
||||
|
||||
Stand: 22.10.2026 · **Kein Erklärungstext, sondern strukturierte Faktenlage.** Rechtsgrundlagen sind *vorgeschlagen* (Prüfannahme) und juristisch zu bestätigen. Grundlage: Code-Audit ([DATENSCHUTZ-AUDIT.md](DATENSCHUTZ-AUDIT.md)), [LOESCHKONZEPT.md](LOESCHKONZEPT.md), [BUCHUNGSPROZESS.md](BUCHUNGSPROZESS.md).
|
||||
|
||||
Status: ✅ im Code belegt · 📄 dokumentiert/konfiguriert · 🗓 geplant · ❓ unbekannt · ⚖ rechtlich zu prüfen. **Browserverhalten wurde nicht beobachtet** (nur Codebefund).
|
||||
|
||||
**Verantwortliche:** Brigitte Stommer (Kontaktdaten aus `config/fewo.php`/Impressum). Datenschutzbeauftragte/r: ❓ Pflicht ⚖ prüfen.
|
||||
|
||||
## Verarbeitungsvorgänge
|
||||
|
||||
| # | Vorgang | Datenkategorien | Zweck | Vorgeschlagene Rechtsgrundlage ⚖ | Herkunft | Empfänger | Drittland | Speicher-/Löschregel | Technische Schutzmaßnahmen | Offene Rechtsfragen | Status |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 1 | Besuch der Website / Server-Logs | IP, Zeit, URL, User-Agent | Auslieferung, Sicherheit | Art. 6 (1) f | Besucher | STRATO (Hosting) | keins bekannt ❓ | Strato-Logs ❓; Anwendungslog: Rotation geplant | HTTPS, Throttling | Log-Dauer; AVV Strato | ❓ |
|
||||
| 2 | Technisch notwendige Cookies | Session-Cookie, XSRF-Token (Session-ID, IP/UA in `sessions`) | Formularschutz, Session | Art. 6 (1) f; § 25 (2) Nr. 2 TDDDG | Besucher | STRATO | – | Lifetime 120 Min. (`config/session.php`) | httpOnly, SameSite=lax, Secure auf Staging gesetzt | Banner-Pflicht verneint? Browserprüfung | ✅ Code / ❓ Browser |
|
||||
| 3 | Externe Ressourcen | – (keine Drittanfragen im Code) | – | – | – | – | – | – | Schriften lokal | Verifikation im Browser | ✅ Code |
|
||||
| 4 | Link zu OpenStreetMap | beim Klick: IP, Referrer, Adresse als Suchparameter an OSMF | Orientierung | Art. 6 (1) f | Besucher (Klick) | OpenStreetMap Foundation (UK) | ⚖ Drittland UK (Angemessenheitsbeschluss prüfen) | – | Kein Einbetten, kein Laden bei Seitenaufruf | Hinweis in DSE | ✅ |
|
||||
| 5 | Buchungsanfrage (Direkt) | Name, E-Mail, Telefon*, Anschrift*, Zeitraum, Personen, Extras, Nachricht*, Herkunft*, UTM* (*optional) | Vertragsanbahnung | Art. 6 (1) b; Herkunft/UTM: Art. 6 (1) f | Gast | Vermieterin; STRATO (Datenbank, SMTP) | keins bekannt | Anfragen ohne Vertrag: Frist vorgeschlagen 3–6 Monate (⚖); heute 10 J. | Rate-Limit, Honeypot, CSRF, Validierung | Fristen; Einwilligungstext im Formular | ✅ |
|
||||
| 6 | Vorreservierung/Angebot/Annahme | Buchungsdaten, Preise, Angebotsversion, Annahmezeit (+ Nachweisdaten) | Vertragsabschluss | Art. 6 (1) b | Gast/Vermieterin | wie 5 | – | Beleg bis Steuerfrist ⚖ | Signierter, befristeter Annahme-Link | § 312i/j/k BGB; Umfang Nachweisdaten | 🗓 (Annahme nicht implementiert) |
|
||||
| 7 | Vertrag & Rechnung/Quittung | Gast-, Buchungs-, Zahlungsdaten | Vertragserfüllung, steuerl. Pflichten | Art. 6 (1) b, c | Vermieterin/Gast | Gast; Steuerberater ❓ | – | steuerliche Frist ⚖ | privater Speicher, Rollenzugriff | Frist, Anonymisierung der Belege | ✅ PDF / 🗓 Rechnungen |
|
||||
| 8 | Zahlungsabwicklung | Betrag, Datum, Methode, Notiz | Zahlungsverwaltung | Art. 6 (1) b, c | Vermieterin (manuell) | Bank der Vermieterin | – | steuerliche Frist ⚖ | Kein Zahlungsdienstleister im System | Banken als eigene Verantwortliche | ✅ |
|
||||
| 9 | Transaktions-E-Mails | E-Mail, Name, Buchungsdaten | Information zur Buchung | Art. 6 (1) b | Anwendung | STRATO SMTP; Gast | – | Mail-Archiv ❓ | TLS ❓ | Mail-Aufbewahrung | ✅ Code / 📄 Betrieb |
|
||||
| 10 | Bewertungsanfrage + Bewertung | E-Mail, Name, Bewertung, Anzeigename, Einwilligung | Qualitätssicherung, Veröffentlichung | Anfrage: Art. 6 (1) f (⚖ § 7 UWG); Veröffentlichung: Art. 6 (1) a | Gast | Öffentlichkeit (nach Freigabe) | – | siehe LOESCHKONZEPT | Signierter Link 90 Tage, Moderation | Zulässigkeit Anfrage-Mail | ✅ |
|
||||
| 11 | Angebots-/Newsletter-Einwilligung | E-Mail, Name, Consent-Zeitpunkt | Marketing | Art. 6 (1) a; § 7 UWG | Gast | Vermieterin; Versanddienst ❓ | ❓ | Bis Widerruf; Nachweis ⚖ | DOI, signierte Links | Versandweg/Dienstleister | ✅ Consent / ❓ Versand |
|
||||
| 12 | Gästekartei/CRM | Stammdaten, Notizen, Tags, Aufenthalte | Kundenpflege | Art. 6 (1) f | Gast/Portal | Vermieterin | – | 3 J.-Stufe vorgeschlagen ⚖ | Policy-Rollen, 2FA für Admin | Berechtigtes Interesse; Frist | ✅ |
|
||||
| 13 | CSV-Export Gäste | Stammdaten | Verwaltung/Mailing | Art. 6 (1) f | Admin | Lokaler Rechner der/des Admins | – | Verantwortung Nutzer | Rollenschutz, Audit-Log 🗓 | Auditpflicht | ✅ |
|
||||
| 14 | Portal-Kalenderabgleich (iCal) | nur Zeiträume; ggf. Portal-SUMMARY | Doppelbuchung vermeiden | Art. 6 (1) b/f | Portal | Portale (nur „Belegt“) | Portalbetreiber ❓ (z. B. Vrbo/Expedia → ⚖ Drittland) | Sperren bis Zeitraumende + Frist | Token-URL, Throttle | Inhalt SUMMARY | ✅ |
|
||||
| 15 | Portal-Buchungsmails | Absender, Betreff, Auszug (500 Z.), Zeitraum, Referenz; Gästedaten *nur wenn in Mail* | Sofortige Sperre, Verwaltung | Art. 6 (1) b/f | Portal (E-Mail) | STRATO (Postfach), Vermieterin | Portalbetreiber ❓ | Auszug kurz; Referenz/Zeitraum bis Steuerfrist ⚖ | IMAP/SSL, Parser „nie raten“ | Art. 14-Information | ✅ Code / 🗓 Produktiv |
|
||||
| 16 | Portalbuchungen als Gast (geplant) | Gastdaten laut Portal, Preise, Gebühren | zentrale Verwaltung, Steuer | Art. 6 (1) b, c, f | Portal (E-Mail/API) | wie oben | ❓ | wie 7/12 | s. DATENMODELL-KONZEPT | Art. 14, AVV mit Channel-Manager | 🗓 |
|
||||
| 17 | Gästemeldung / Kurabgabe | Meldedaten je Person, Aufenthalt, Befreiung | gesetzliche Meldung, Abgabe | Art. 6 (1) c (BMG), Art. 6 (1) e/c (Kurabgabesatzung) ⚖ | Gast | Gemeinde/Tourist-Info, feratel ❓ | ❓ | gesetzliche Frist ⚖ | getrennte Speicherung (Soll) | Bund/Kommune trennen; Rolle feratel | 🗓 |
|
||||
| 18 | Admin-Zugang | Name, E-Mail, Rolle, 2FA | Verwaltung | Art. 6 (1) f | Admins | – | – | bis Ausscheiden | Passwort-Hash, TOTP-2FA, Rollen | – | ✅ |
|
||||
| 19 | Monitoring/Automation (n8n, Webhook) | Betriebsstatus, Aufgaben | Überwachung, Portalsperre | Art. 6 (1) f | Anwendung | Privater Server ❓ | ❓ | ❓ | HMAC, Tokens (Query ⚠) | Auftragsverarbeitung, Standort | 📄 |
|
||||
| 20 | KI-Agent | – | – | – | – | – | – | – | – | Anbieter, EU/EWR, Training, Art. 22 | 🗓 nicht implementiert |
|
||||
| 21 | Backups | gesamter Datenbestand | Verfügbarkeit | Art. 6 (1) f, Art. 32 | – | STRATO/Eigenbetrieb ❓ | ❓ | rollierend (Vorschlag 30 T.) | ❓ | Retention vs. Löschung | ❓ |
|
||||
|
||||
## Empfänger-/Dienstleisterliste (für DSE)
|
||||
|
||||
STRATO AG (Hosting, DB, E-Mail) – AVV ❓ · OpenStreetMap Foundation (nur bei Klick) · Portalbetreiber (FeWo-direkt/Vrbo/Expedia u. a.) als eigene Verantwortliche – ❓ · Steuerberater ❓ · Gemeinde/Tourist-Information/feratel (nur bei Meldepflicht) ❓ · n8n-Betreiber ❓ · KI-Anbieter 🗓.
|
||||
|
||||
## Rechte und Pflichttexte (⚖ ausformulieren)
|
||||
|
||||
Auskunft (Art. 15), Berichtigung, Löschung, Einschränkung, Übertragbarkeit, Widerspruch (Art. 21), Widerruf Einwilligung, Beschwerde bei Aufsichtsbehörde, Pflichtangaben vs. freiwillige Angaben, automatisierte Entscheidungen (derzeit keine ✅).
|
||||
|
||||
## Querschnitts-Fragen für Rechtsberatung / Datenschutzbeauftragte
|
||||
|
||||
1. DSB-Pflicht, Verarbeitungsverzeichnis (Art. 30), AVVs (Strato, n8n-Betreiber, ggf. Channel-Manager/KI).
|
||||
2. TDDDG/Cookie-Einordnung der technisch notwendigen Cookies.
|
||||
3. Art. 14-Information für Portalgäste und Ausnahmen.
|
||||
4. Rechtsgrundlage und Fristen für Anfragen, Bewertungen, Marketing-Nachweis.
|
||||
5. Drittlandbezug der Portalbetreiber und der KI-Anbieter.
|
||||
6. Beweis-/Annahmeprotokoll beim Vertragsschluss (Datenumfang).
|
||||
|
||||
*Vor externer Verwendung (Veröffentlichung/Weitergabe) bitte durch fachkundige Stelle prüfen.*
|
||||
@@ -0,0 +1,92 @@
|
||||
# Deployment auf Strato
|
||||
|
||||
Stand: 22.10.2026 · Skript: `scripts/deploy.sh` · CI: `.gitea/workflows/deploy.yml`
|
||||
|
||||
## 1. Prinzip
|
||||
|
||||
```
|
||||
Gitea (main/Tag) ──► Build (CI oder lokal): git-Stand · composer --no-dev · npm run build
|
||||
│ tar.gz
|
||||
▼ SSH
|
||||
Strato <DEPLOY_PATH>/
|
||||
releases/20261022…/ ◄─ entpackt
|
||||
shared/.env ◄─ einmalig von Hand
|
||||
shared/storage/ ◄─ Uploads, Logs, Sessions (bleiben)
|
||||
current ──► releases/… ◄─ atomar umgeschaltet nach migrate + optimize
|
||||
.htaccess ──► releases/<aktiv>/public (Domain-Zielverzeichnis = <DEPLOY_PATH>)
|
||||
│
|
||||
▼ https://…/up – Gesundheitscheck, bei Fehler automatischer Rollback
|
||||
```
|
||||
|
||||
Auf dem Server werden nur **bash, tar und PHP-CLI** gebraucht – kein Composer, kein Node, kein Git, kein rsync.
|
||||
|
||||
## 2. SSH oder SFTP?
|
||||
|
||||
**Empfehlung: SSH.** Das Skript führt nach dem Hochladen Befehle auf dem Server aus (Archiv entpacken, Datenbank migrieren, Caches erzeugen, Version umschalten, ggf. zurückschalten). Das geht nur mit SSH.
|
||||
|
||||
Nur mit SFTP wäre ein Deployment möglich, aber deutlich schwächer:
|
||||
- Kein Entpacken auf dem Server → jede Datei einzeln übertragen (über 10.000 Dateien, mehrere Minuten pro Update, unterbrechungsanfällig).
|
||||
- Migrationen und Caches müssten über einen gesicherten Web-Aufruf angestoßen werden; kein `artisan` für Wartung und Fehlersuche.
|
||||
- Umschalten wäre per SFTP-Symlink möglich, aber ohne sauberen Rückfall bei Fehlern.
|
||||
|
||||
Strato richtet beide Zugänge im selben Menü ein (Kundenlogin › Datenbanken und Webspace › **SFTP & SSH**). Bei Hosting Pro sollte SSH enthalten sein – bitte dort prüfen. Falls nicht: Bescheid geben, dann ergänze ich einen SFTP-Modus.
|
||||
|
||||
## 3. Einmalige Einrichtung bei Strato
|
||||
|
||||
1. **PHP-Version** auf 8.4 stellen (Datenbanken und Webspace › PHP-Version).
|
||||
2. **SSH-Zugang** anlegen (SFTP & SSH, Protokoll „SFTP + SSH“); **Benutzername und Server** aus „Details“ notieren – der Server ist paketspezifisch (z. B. `12345678.ssh.w1.strato.hosting`), nicht `ssh.strato.de`. Eigenen SSH-Schlüssel hinterlegen oder einmalig `ssh-copy-id -i ~/.ssh/strato_fewo.pub <benutzer>@<server>`.
|
||||
3. Per SSH prüfen:
|
||||
```bash
|
||||
ssh <benutzer>@<server>
|
||||
ls /opt | grep RZphp # PHP-CLI-Pfad, z. B. /opt/RZphp84/bin/php-cli
|
||||
/opt/RZphp84/bin/php-cli -v
|
||||
```
|
||||
4. **Datenbank MariaDB 11.8** anlegen (Datenbanken verwalten; nicht MySQL 8.0 – Support endete im April 2026); Host, Name, Benutzer, Passwort notieren. In `shared/.env`: `DB_CONNECTION=mariadb`.
|
||||
5. Lokal `scripts/deploy.example.env` nach `scripts/deploy.production.env` kopieren und ausfüllen (wird nicht committet).
|
||||
6. `bash scripts/deploy.sh production setup` – legt die Ordner an und zeigt die PHP-Version.
|
||||
7. `.env.production.example` ausfüllen (u. a. `APP_KEY` via `php artisan key:generate --show`, Datenbank, SMTP/IMAP-Passwort, Tokens) und auf den Server nach `<DEPLOY_PATH>/shared/.env` kopieren (z. B. per SFTP).
|
||||
8. Erstes Deployment: `bash scripts/deploy.sh production deploy`
|
||||
9. Ersteinrichtung der Daten und erster Admin:
|
||||
```bash
|
||||
bash scripts/deploy.sh production artisan db:seed --class=ProductionSeeder --force
|
||||
bash scripts/deploy.sh production artisan make:filament-user
|
||||
```
|
||||
10. **Domain-Zielverzeichnis** auf den Ordner `<DEPLOY_PATH>` selbst setzen (Strato kann kein Symlink-Ziel wählen). Die `.htaccess` dort (von `setup` und bei jedem Umschalten neu geschrieben) leitet alles intern nach `releases/<aktive Version>/public` – bewusst **nicht** über den Symlink `current`, weil der OPcache von Strato Skripte unter dem Symlink-Pfad zwischenspeichert und sonst nach dem Umschalten die alte Version ausliefert. Sie sperrt interne Dateien (403) und setzt per `AddType application/x-httpd-php84 .php` die Web-PHP-Version **nur für diesen Ordner** auf die CLI-Version – andere Anwendungen im Paket bleiben unberührt. SSL-Zertifikat für die Domain aktivieren.
|
||||
11. **Cronjob** (Kundenlogin › Cronjobs), jede Minute:
|
||||
```
|
||||
/opt/RZphp84/bin/php-cli <home>/<DEPLOY_PATH>/current/artisan schedule:run
|
||||
```
|
||||
Falls Cronjobs nicht minütlich möglich sind: `FEWO_SCHEDULER_TOKEN` setzen und n8n jede Minute `GET https://…/automation/scheduler?token=…` aufrufen lassen.
|
||||
12. Überwachung: n8n alle 5 Min. `GET https://…/health/sync?token=<FEWO_HEALTH_TOKEN>` (200 = ok, 503 = Störung).
|
||||
|
||||
**Testbetrieb zuerst:** Für eine Subdomain (z. B. `test.fewo-stommer.de`) eine zweite Konfiguration `scripts/deploy.staging.env` mit eigenem `DEPLOY_PATH`, eigener Datenbank und eigenem `shared/.env` anlegen; `bash scripts/deploy.sh staging deploy`.
|
||||
|
||||
## 4. Tägliche Nutzung
|
||||
|
||||
| Aufgabe | Befehl |
|
||||
|---|---|
|
||||
| Neue Version ausliefern | `bash scripts/deploy.sh production deploy` (baut den **letzten Commit**) |
|
||||
| Bestimmten Stand ausliefern | `bash scripts/deploy.sh production deploy <commit oder tag>` |
|
||||
| Zurück zu einer früheren Version | `bash scripts/deploy.sh production releases` zeigt die Deploy-Tags; dann `bash scripts/deploy.sh production deploy deploy/production/<zeitstempel>` (Migrationen werden nicht zurückgenommen) |
|
||||
| Sofort zurück, solange die alte Version noch auf dem Server liegt (nur während eines laufenden Deployments) | `bash scripts/deploy.sh production rollback` |
|
||||
|
||||
**Versionsgeschichte in Gitea statt auf Strato:** Strato begrenzt die Anzahl der Dateien im Paket (eine Version ≈ 15.000 Dateien). Auf dem Server liegt deshalb nur die **aktive** Version, während eines Deployments kurz zusätzlich die neue. Die alte wird erst gelöscht, wenn die neue den Gesundheitscheck bestanden hat – schlägt er fehl, wird automatisch zurückgeschaltet. Jede erfolgreiche Auslieferung wird als Tag `deploy/<umgebung>/<zeitstempel>` in Gitea festgehalten; ein Build ist durch `composer.lock`/`package-lock.json` reproduzierbar. Außerdem entfernt der Build Sprachdateien außer de/en sowie Tests/Doku aus `vendor` (~4.800 Dateien weniger).
|
||||
| Artisan auf dem Server | `bash scripts/deploy.sh production artisan about` |
|
||||
|
||||
Windows: in Git Bash ausführen; `COMPOSER_BIN="php /c/…/composer.phar"` in der `.env`-Datei des Deployments setzen, falls `composer` nicht im PATH ist.
|
||||
|
||||
## 5. Automatisch über Gitea Actions
|
||||
|
||||
- Workflow `.gitea/workflows/deploy.yml`: **Tests bei jedem Push**; **Deployment** bei Tags `v*` (z. B. `git tag v1.0.0 && git push --tags`) oder per Knopfdruck (Actions › Deploy › Run workflow, Ziel production/staging).
|
||||
- Voraussetzung: Gitea Actions aktiviert und ein **act_runner** registriert – passt gut auf den privaten Server (Docker). Anleitung: Gitea-Doku „Act Runner“.
|
||||
- Repository-Secrets: `DEPLOY_SSH_KEY` (privater Schlüssel, dessen öffentlicher Teil bei Strato hinterlegt ist), `DEPLOY_HOST`, `DEPLOY_USER`, `DEPLOY_PATH`, `DEPLOY_PHP`, `DEPLOY_URL`.
|
||||
|
||||
## 6. Getestet / offen
|
||||
|
||||
- Lokal im Testmodus (`DEPLOY_HOST=local`) erfolgreich: Build (~19 MB), Upload, Entpacken, alle Migrationen auf frischer Datenbank, `optimize`, Ersteinrichtung per `ProductionSeeder`, alle Seiten und Admin-Login liefern 200.
|
||||
- **Nicht** unter Windows prüfbar: der Symlink-Wechsel von `current` (Git Bash legt Kopien statt Symlinks an). Unter Linux (Strato) ist das Standardverhalten; der erste Lauf auf dem Testbetrieb bestätigt es – bei Fehler greift der automatische Rollback.
|
||||
- **Auf Strato erfolgreich (22.10.2026, test.fewo-stommer.de):** SSH mit Schlüssel (paketspezifischer Server), PHP-CLI `/opt/RZphp84/bin/php-cli`, Migrationen auf MariaDB, Symlink-Umschaltung, `.htaccess`-Weiterleitung, Web-PHP 8.4 per `AddType`, `ProductionSeeder`; alle Seiten 200.
|
||||
- Testbetrieb läuft unter **https://stommer.info** (Domain-Ziel: Ordner `test.fewo-stommer.de`; SSL für Subdomains ist im Paket nicht verfügbar). Gesundheitscheck über HTTPS mit automatischem Rollback funktioniert.
|
||||
- Behoben: OPcache lieferte nach dem Umschalten die alte Version (→ `.htaccess` zeigt auf den konkreten Release-Ordner); URLs mit `/current/public` (→ `URL::forceRootUrl(APP_URL)` außerhalb von local/testing).
|
||||
- Noch offen: Cronjob.
|
||||
- Erstes Deployment auf ein neues Ziel: `SKIP_HEALTH_CHECK=1 bash scripts/deploy.sh <env> deploy` (die Domain zeigt da noch nicht auf die neue Installation).
|
||||
@@ -0,0 +1,54 @@
|
||||
# GAP-DELTA – Ergänzungen zum Datenschutz-Audit
|
||||
|
||||
> **Hinweis (22.10.2026):** Von einem Analyse-Agenten erstellt. Die als „verbindlich“ bezeichneten Entscheidungen (E1–E7) sind Annahmen des Agenten, keine Festlegungen der Betreiber. Maßgeblich sind die Entscheidungen in [KONZEPT.md §6a/6b](KONZEPT.md) (u. a. Buchungsweg 1 über Angebot + Annahme, Weg 2 Direktbuchung später; Kurabgabe vor Ort durch Ferienservice Balu).
|
||||
|
||||
Stand: 22.10.2026 · Ergänzt [DATENSCHUTZ-AUDIT.md](DATENSCHUTZ-AUDIT.md) um die verbindlichen Produktentscheidungen (Folgeauftrag). **Reine Analyse – keine Codeänderung, keine Migration, kein Deployment.** Rechtliche Punkte sind Prüfannahmen und mit ⚖ „rechtlich zu prüfen“ markiert.
|
||||
|
||||
Legende: ✅ implementiert und im Code belegt · 📄 nur konfiguriert/dokumentiert · 🗓 geplant · ❓ unbekannt · ⚖ juristische Prüfung nötig
|
||||
|
||||
## 1. Verbindliche Entscheidungen und ihr Umsetzungsstand
|
||||
|
||||
| # | Entscheidung | Ist-Stand | Status |
|
||||
|---|---|---|---|
|
||||
| E1 | Laravel-System führend für alle Buchungen und Gäste | Direktbuchungen ✅ (`bookings`, `guests`). **Portalbuchungen sind keine `Booking`-Datensätze**, sondern `BlockedPeriod` (Sperre, ohne Gast, ohne Preis) bzw. `PortalEmail` (Auszug). Damit ist das System nur für die *Belegung* führend, nicht für Portalgäste und -umsätze | ⚠ Lücke |
|
||||
| E2 | Portalbuchungen zentral verwalten | Nur Kalenderblock + Hinweis-Mail; keine Gäste-, Preis-, Gebühren-, Zahlungsdaten | ⚠ Lücke |
|
||||
| E3 | Buchungs-/Zahlungsnachweise steuerlich verfügbar | Direkt: `payments`, `bookings.quote` (JSON), Vertrags-PDF ✅. Keine Rechnung/Beleg-Dokumente, keine Portalabrechnungen, keine Unveränderbarkeit/Revisionssicherheit | ⚠ Teilweise |
|
||||
| E4 | Kein Gästekonto | ✅ (signierte Links für Bewertung/Newsletter). Für Annahme/Storno fehlt ein Äquivalent | ⚠ Lücke |
|
||||
| E5 | Anfrage → Vorreservierung → Angebot → Annahme → Buchung | Status: `Reserved` (Anfrage+Vorreservierung vermischt) → `Confirmed` durch Vermieterin. **Kein Angebot, keine Gast-Annahme** | ⚠ Lücke |
|
||||
| E6 | KI später | Kein KI-Code (✅ belegt: keine KI-Pakete/Aufrufe) | 🗓 |
|
||||
| E7 | Privacy by Design / Datenminimierung | Teilweise (Honeypot, Rate-Limit, Anonymisierung, signierte Links); Lücken in Löschung, Logs, Sessions | ⚠ Teilweise |
|
||||
|
||||
## 2. Neue/präzisierte Befunde (Delta zum Audit)
|
||||
|
||||
| ID | Prio | Befund | Beleg | Folge |
|
||||
|---|---|---|---|---|
|
||||
| D1 | **K** | Portalgäste existieren im System nicht (nur Zeitraum). Entscheidung E1/E2 erfordert Erweiterung des Datenmodells | `app/Models/BlockedPeriod.php`, `ProcessPortalMail`, `SyncChannel` | → DATENMODELL-KONZEPT.md |
|
||||
| D2 | **K** | Kein Angebot-/Annahme-Mechanismus, keine Dokumentation des Vertragsschlusses (Zeitpunkt, Inhalt, IP/Nachweis) | `BookingStatus`, `ConfirmBooking` | → BUCHUNGSPROZESS.md |
|
||||
| D3 | **H** | Stornierung = reiner Statuswechsel im Admin (`ViewBooking`), ohne Stornokosten-Berechnung, Gast-Benachrichtigung, Rückerstattungsbuchung, Beleg | `ViewBooking.php` Z. ~112; `RecordPayment` erlaubt negative Beträge als Erstattung (nur Hinweis im Docblock) | → BUCHUNGSPROZESS.md |
|
||||
| D4 | **H** | Stornobedingungen nur als optionaler Freitext (`stay.cancellation`, Default `null`), nicht maschinenlesbar | `config/content.php` | Staffel als Daten modellieren |
|
||||
| D5 | **H** | iCal-`SUMMARY` wird in `blocked_periods.reason` übernommen („Portalname: Summary“). Falls ein Portal Namen im SUMMARY liefert, würden Gästenamen ungeplant gespeichert; keine Löschung | `app/Actions/SyncChannel.php` Z. ~67, `ICalParser` | Prüfen, was FeWo-direkt tatsächlich liefert (❓); ggf. SUMMARY nicht speichern |
|
||||
| D6 | **H** | `portal_emails.excerpt` (500 Zeichen) kann Namen/Kontaktdaten enthalten; keine Frist, keine Anonymisierung | `ProcessPortalMail` | Löschfrist (z. B. kurz nach Verarbeitung) oder Felder gezielt extrahieren |
|
||||
| D7 | **H** | Dublettenprüfung nur exakt über E-Mail (`firstOrNew` auf `email`, kleingeschrieben). Keine Zusammenführung, keine Mehrfach-Identitäten, keine Quelle/Importzeitpunkt am Gast | `CreateReservation` Z. ~52, `Guest` | → DATENMODELL-KONZEPT.md |
|
||||
| D8 | **H** | Bei Anfrage über E-Mail-Adresse eines bestehenden Gastes werden dessen Stammdaten per `fill()` **überschrieben** (Adresse/Telefon) – fremde Person könnte mit bekannter E-Mail Daten verändern | `CreateReservation` | Stammdaten versionieren/Bestätigung vor Überschreiben |
|
||||
| D9 | **M** | Kurtaxe/Kurabgabe nur als Textinfo; keine Daten (Personen, Alter, Befreiung), keine Meldung, keine Abführung | `PricesSection`, Mail-Views; `docs/PORTALE.md` | → BUCHUNGSPROZESS.md §Kurabgabe |
|
||||
| D10 | **M** | feratel-Meldeschein-Anbindung nur als Plan (Schnittstelle für Software-Partner, Konditionen offen) | `docs/PORTALE.md` | Klärung mit Tourist-Information; ⚖ |
|
||||
| D11 | **M** | Portalgebühren/Provisionen: nicht modelliert | – | Felder in Buchung/Finanzposten |
|
||||
| D12 | **M** | Nachrichtenhistorie (ein-/ausgehend) wird nicht gespeichert; versendete System-Mails nur im Mail-Log/Postfach | `app/Mail/*` | Nachrichtenprotokoll ohne Volltext oder mit Frist |
|
||||
| D13 | **M** | Quelle: `bookings.source` (string, z. B. `website`); `referral_source` ist Marketing-Herkunft. Keine externe Buchungsreferenz an `Booking`; `BlockedPeriod.external_uid` und `PortalEmail.reference` existieren | Migrationen | Bestehende Felder wiederverwenden |
|
||||
| D14 | **M** | Art. 14 DSGVO (Portalgäste): Informationspflicht gegenüber Gästen, deren Daten aus Portalen kommen, ist nicht umgesetzt | – | Information im Erstkontakt/Vertragsmail; ⚖ Ausnahme Art. 14 (5) prüfen |
|
||||
| D15 | **M** | Staging-Mailer `log`: Gästemails (Vertrag, Preis, Namen) im Logfile; Log-Level `debug` per Default | `docs/BETRIEB.md` | Nur Testdaten verwenden; Produktiv-Logging härten |
|
||||
|
||||
## 3. Was bereits wiederverwendbar ist
|
||||
|
||||
- `Guest` (Stammdaten, Anonymisierung, Marketing-Consent), `Booking` (Status, `quote`, Beträge, Zahlungstermine, `contract_path`), `Payment` (negative Beträge möglich), `PortalEmail` (Typ, Status, Referenz, Zeitraum), `Channel`/`ChannelTask`/`ChannelSyncLog`, Actions-Muster in `app/Actions`, Observer-Mechanik, signierte URLs, Rate-Limiter, Rollen-Policies, Pflicht-2FA für Admins.
|
||||
- `PriceQuote`/`bookings.quote`: Preisaufschlüsselung als JSON → Basis für Angebots- und Rechnungsdarstellung.
|
||||
|
||||
## 4. Quellenlage Portaldaten (nichts raten)
|
||||
|
||||
| Quelle | Verfügbare Daten | Gästedaten | Status |
|
||||
|---|---|---|---|
|
||||
| iCal | Zeitraum, UID, SUMMARY (portalabhängig) | keine zugesichert | ✅ implementiert |
|
||||
| Portal-E-Mail | Typ, Zeitraum, Referenz (heuristisch geparst); Mailtext enthält ggf. Gast-/Preisdaten | Nur nachweislich im Text vorhandene Daten; Parser extrahiert aktuell **nur** Typ/Zeitraum/Referenz | ✅ Code, ❓ reale Mails |
|
||||
| Autorisierte API (Channel-Manager/Partner) | Gast, Preis, Gebühren, Nachrichten (je Anbieter) | ja (vertragsabhängig) | 🗓 nicht implementiert |
|
||||
|
||||
Regel: Felder ohne belegte Quelle bleiben leer (`NULL`) mit Kennzeichnung `unbekannt`; keine Ableitung aus Nachnamen, Telefonnummern o. Ä.
|
||||
@@ -0,0 +1,58 @@
|
||||
# GO-LIVE-CHECKLISTE – priorisierte Maßnahmen
|
||||
|
||||
> **Hinweis (22.10.2026):** Von einem Analyse-Agenten erstellt. Die als „verbindlich“ bezeichneten Entscheidungen (E1–E7) sind Annahmen des Agenten, keine Festlegungen der Betreiber. Maßgeblich sind die Entscheidungen in [KONZEPT.md §6a/6b](KONZEPT.md) (u. a. Buchungsweg 1 über Angebot + Annahme, Weg 2 Direktbuchung später; Kurabgabe vor Ort durch Ferienservice Balu).
|
||||
|
||||
Stand: 22.10.2026 · Priorität: **P0** Blocker (ohne diese nicht produktiv) · **P1** unmittelbar nach Go-Live bzw. vor Portalintegration · **P2** Ausbau. Die Checkliste ist eine *Maßnahmenplanung*; Konformität ist **nicht** nachgewiesen. Umsetzung nur nach Freigabe. Verweise: [GAP-DELTA.md](GAP-DELTA.md), [DATENSCHUTZ-AUDIT.md](DATENSCHUTZ-AUDIT.md).
|
||||
|
||||
## P0 – Blocker
|
||||
|
||||
| ☐ | Maßnahme | Bezug | Wer |
|
||||
|---|---|---|---|
|
||||
| ☐ | Impressum und Datenschutzerklärung erstellen, juristisch prüfen, im Footer + Buchungsformular verlinken | G1, G2 | Rechtsberatung/Betreiberin |
|
||||
| ☐ | AVV mit STRATO prüfen/abschließen; Verarbeitungsverzeichnis anlegen; DSB-Pflicht prüfen | Faktenbasis | Betreiberin/DSB |
|
||||
| ☐ | Produktiv-`.env` härten: `APP_ENV=production`, `APP_DEBUG=false`, `MAIL_MAILER=smtp` (TLS), `LOG_CHANNEL=daily`, `LOG_LEVEL` ≥ warning, `SESSION_SECURE_COOKIE=true` | G8 | Technik |
|
||||
| ☐ | Browser-Verifikation Staging: Netzwerk/Cookies/Storage; Ergebnis in DSE | G9 | Technik |
|
||||
| ☐ | Backup-Verfahren festlegen, Restore testen, Aufbewahrung dokumentieren | G5 | Technik |
|
||||
| ☐ | Fristen des Löschkonzepts bestätigen lassen (Steuerberatung/Recht) | LOESCHKONZEPT | Steuerberatung/Recht |
|
||||
| ☐ | Stornobedingungen, AGB, Widerrufs-/Verbraucherhinweise rechtlich klären (§§ 312g, 312i, 312j, 312k BGB) | BUCHUNGSPROZESS §7 | Recht |
|
||||
| ☐ | Entscheidung: Direktbuchung vorerst als „Anfrage → Bestätigung“ betreiben (ohne Angebot/Annahme-Funktion) **oder** Go-Live erst nach Umsetzung des Angebot-/Annahmeprozesses | D2 | Betreiberin |
|
||||
| ☐ | Staging mit Testdaten betreiben (kein Echtdaten-Import); Mail-Log nur Testadressen | D15 | Technik |
|
||||
|
||||
## P1 – Kurzfristig (Go-Live / vor Portal-Echtbetrieb)
|
||||
|
||||
| ☐ | Maßnahme | Bezug |
|
||||
|---|---|---|
|
||||
| ☐ | Löschjobs: Anfragen ohne Vertrag, `portal_emails.excerpt`, UTM, privates Review-Feedback; `anonymize()` um `internal_notes`, Review-Anzeigename erweitern | G3, G4, D6 |
|
||||
| ☐ | Tokens aus Query-Parametern in Header verlegen (`/health/sync`, `/automation/scheduler`) | G6 |
|
||||
| ☐ | Security-Header (HSTS, CSP, X-Frame-Options, Referrer-Policy, Permissions-Policy) | G11 |
|
||||
| ☐ | Pflicht-2FA auch für Rolle `rentals`; Audit-Log für Export/Anonymisierung/Statuswechsel | G14, G15 |
|
||||
| ☐ | Throttle für Bewertungs-/Annahme-/Storno-Routen | G12 |
|
||||
| ☐ | iCal-`SUMMARY` prüfen (Portal liefert Namen?) und ggf. nicht speichern | D5 |
|
||||
| ☐ | Gästestammdaten bei bekannter E-Mail nicht stillschweigend überschreiben | D8 |
|
||||
| ☐ | Prozess Betroffenenrechte (Auskunft/Löschung) dokumentieren, Frist 1 Monat | G13 |
|
||||
| ☐ | Art. 14-Information für Portalgäste (erste Mail + DSE-Abschnitt) | D14 |
|
||||
| ☐ | n8n/Privatserver: Standort, Betreiber, Datenumfang dokumentieren; keine Gästedaten in Webhooks | G7 |
|
||||
| ☐ | Cron/Scheduler produktiv einrichten und überwachen | `docs/BETRIEB.md` |
|
||||
|
||||
## P2 – Ausbau (Entscheidungen E1–E5)
|
||||
|
||||
| ☐ | Maßnahme | Bezug |
|
||||
|---|---|---|
|
||||
| ☐ | Datenmodell: `documents`, `messages`, Gebühren/Kurtaxe, Quelle/Importzeitpunkt (additiv, ohne Migrationsausführung vor Freigabe) | DATENMODELL-KONZEPT |
|
||||
| ☐ | Portalbuchungen als `Booking` führen (Importpfad Portal-Mail); Merge-Kandidaten + manuelle Zusammenführung | DATENMODELL §5 |
|
||||
| ☐ | Angebot + Annahme (signierter Link), Annahmenachweis, Empfangsbestätigung | BUCHUNGSPROZESS §3 |
|
||||
| ☐ | Stornoformular ohne Konto, Stornokosten-Policy als Daten, Erstattungs-Action | BUCHUNGSPROZESS §5 |
|
||||
| ☐ | Kurabgabe/Gästemeldung: Klärung mit Tourist-Information/feratel; getrennte Tabellen mit eigener Löschfrist | BUCHUNGSPROZESS §6 |
|
||||
| ☐ | Steuerliche Nachweise: Rechnungen/Belege, Hash, `retain_until`, Export für Steuerberater | LOESCHKONZEPT |
|
||||
| ☐ | Channel-Manager/API-Connector (nur nach AVV-/Anbieterprüfung) | PORTALE.md |
|
||||
| ☐ | KI-Agent: Anbieter/Region/Training-Opt-out, Pseudonymisierung, Freigabe bei Preis/Angebot/Absage, Audit-Log, DSFA-Prüfung | Audit §5 |
|
||||
|
||||
## Entscheidungsbedarf (offen)
|
||||
|
||||
1. Portalbuchungen als `Booking` (empfohlener Entwurf) – bestätigen?
|
||||
2. Angebot/Annahme **vor** oder **nach** Go-Live?
|
||||
3. Gästedaten-Frist: 3 Jahre + Beleg (Vorschlag) – bestätigen nach Rechtsprüfung.
|
||||
4. Bestehende `Confirmed`-Buchungen: als „angenommen“ migrieren?
|
||||
5. Soll Annahmenachweis IP/User-Agent speichern (⚖) oder nur Zeitpunkt + Versionshash?
|
||||
6. Kurabgabe/Gästemeldung: selbst erfassen oder über feratel/Tourist-Information?
|
||||
7. Freigabe zur Umsetzung der Punkte P0/P1 (Code, Migrationen, Deployments erst auf Zuruf).
|
||||
+22
-1
@@ -48,7 +48,7 @@ ## 4a. Theme- und Vorlagensystem (Entscheidungen vom 22.10.2026 – umgesetzt, D
|
||||
|
||||
- **Themes** (Design) als Code-Pakete mit Manifest, eigenen Vorlagen und eigenem CSS; was ein Theme nicht mitbringt, kommt aus einem vollständigen **Basis-Theme** (Child-Theme-Prinzip). Erstes Theme: **„Ostsee-Licht“** (Entwurf A, orientiert an der bisherigen Webseite). Die Entwürfe B/C können später als weitere Themes folgen.
|
||||
- **Bausteinsystem (geführt):** Seiten werden aus einem festen Katalog von Abschnitten zusammengestellt (Reihenfolge, Sichtbarkeit); Seiten und Menüs können je Ausrichtung unterschiedlich sein. Keine freie Seitengestaltung.
|
||||
- **Saisonale Erscheinungsbilder:** wechseln Fotos, Texte, Farben/Akzente, Banner und hervorgehobene Angebote – nicht den Aufbau. Zeitplan jährlich wiederkehrend mit Priorität und Standard; Vorschau-Link vor Aktivierung. Startset: **Sommer** (Strand, Baden), **Winter** (raue See, stimmungsvoller Himmel), **Weihnachten** (gemütlich, besinnlich), **Silvester** (Party, Feuerwerk). Klickbare Vorschau: lokale HTML-Datei (Scratchpad der Sitzung).
|
||||
- **Saisonale Erscheinungsbilder:** wechseln Fotos (Titelbild und **Bilder je Baustein**), Texte, Farben/Akzente und Banner – nicht den Aufbau. Bausteine können **nur in bestimmten Erscheinungsbildern** erscheinen (z. B. ein Weihnachts-Baustein). Sonderangebote werden seit 22.10.2026 **unabhängig** davon nach eigenen Regeln beworben (5a). Zeitplan jährlich wiederkehrend mit Priorität und Standard; Vorschau-Link vor Aktivierung. Startset: **Sommer** (Strand, Baden), **Winter** (raue See, stimmungsvoller Himmel), **Weihnachten** (gemütlich, besinnlich), **Silvester** (Party, Feuerwerk). Klickbare Vorschau: lokale HTML-Datei (Scratchpad der Sitzung).
|
||||
- **Mehrfähigkeit offen halten:** „Site“ = Domain + Theme/Erscheinungsbilder + angezeigte Wohnungen; kein Portal, aber andere Vermieter könnten die Funktionen über eine eigene Domain nutzen (Mandantenfähigkeit vorbereiten, nicht ausbauen).
|
||||
- **Plugins:** Theme- und Baustein-Plugins als Composer-Pakete (Registry wie bei den Portal-Connectoren); Auslieferung per Deployment – kein Upload von Vorlagen im Admin (Sicherheit).
|
||||
- **Strato:** CSS aller Themes wird beim Deployment gebaut; Seiten-Cache je Erscheinungsbild.
|
||||
@@ -88,6 +88,10 @@ ## 5a. Sonderangebote & Sonderkonditionen
|
||||
|
||||
Rabatte gelten auf den Übernachtungspreis (nicht auf Endreinigung/Extras); die Anzahlung wird auf den rabattierten Mietpreis berechnet. Treffen mehrere Angebote zu, erhält der Gast automatisch die günstigere Variante: das beste Einzelangebot **oder** die Summe aller als „kombinierbar“ markierten Angebote.
|
||||
|
||||
**Angebotsarten** (Entscheidung 22.10.2026): **Rabattaktion** (nur Bedingungen, z. B. Last Minute, „ab 3 Nächten −10 %“, 7 = 6, Special Weekend) · **Fester Termin** (genau diese An-/Abreise, z. B. „Ostsee-Woche 07.–14.11.“, oft mit **Pauschalpreis** für alle Nächte) · **Lückenfüller** (freie Lücken bis N Nächte zwischen zwei Belegungen, automatisch erkannt; kann den Mindestaufenthalt der Saison aufheben). Im Admin gibt es Vorlagen für die typischen Fälle.
|
||||
|
||||
**Bewerbung unabhängig vom Erscheinungsbild** (`App\Pricing\OfferShowcase`): gezeigt werden aktive, öffentliche Angebote ohne Code im Buchungszeitraum; feste Termine nur solange frei; Lückenfüller mit bis zu drei konkreten Lücken. Feste Termine und Lücken werden mit dem `PriceCalculator` gerechnet – der beworbene Preis ist exakt der spätere Angebotspreis („499 € statt 640 €“, Link mit vorausgefüllten Daten). Reihenfolge: hervorgehoben → Priorität → frühestes Datum. Gelten mehrere gleichzeitig, zeigt der Baustein sie wahlweise **nebeneinander, als Liste oder rollierend**; das wichtigste hervorgehobene Angebot erscheint optional im Titelbereich.
|
||||
|
||||
## 6. Workflows
|
||||
|
||||
```
|
||||
@@ -108,6 +112,23 @@ ## 6. Workflows
|
||||
|
||||
Zahlungseingang wird manuell im Admin abgehakt (später optional: Abgleich über Bank-CSV-Import).
|
||||
|
||||
### 6a. Buchungswege (Entscheidung Lars Stommer, 22.10.2026)
|
||||
|
||||
**Weg 1 – über ein unverbindliches Angebot (jetzt umsetzen):** Der Gast fragt unverbindlich an → der Zeitraum wird vorgemerkt → die Vermieterin erstellt ein **Angebot** (heute manuell im Admin, später mit KI-Entwurf und menschlicher Freigabe) → das Angebot geht per **E-Mail** an den Gast → **nimmt der Gast das Angebot an** (signierter, befristeter Link ohne Gästekonto), ist die Buchung abgeschlossen → Bestätigung + Mietvertrag, Zahlungsfristen laufen. Läuft die Angebotsfrist ab oder lehnt der Gast ab, wird der Kalender wieder frei.
|
||||
|
||||
**Weg 2 – verbindliche Direktbuchung (Zukunft):** Der Gast bucht direkt verbindlich, die Bestätigung geht sofort raus, Stornierungsfristen laufen an. Voraussetzung: sehr verlässliche, nahezu sofortige Synchronität mit den anderen Buchungssystemen mit Sofortbuchung (v. a. FeWo-direkt), damit keine Doppelbuchungen entstehen. Erst nach Lösung dieser Voraussetzung (z. B. Channel-Manager-API, siehe PORTALE.md).
|
||||
|
||||
Rechtliche Ausgestaltung (Wortlaut des Annahme-Buttons, Informationspflichten, Storno-Regeln, AGB) wird fachkundig geprüft; Impressum und Datenschutzerklärung werden separat erstellt.
|
||||
|
||||
### 6b. Weitere Festlegungen (22.10.2026)
|
||||
|
||||
- **Kurabgabe** wird vor Ort durch den **Ferienservice Balu** erledigt – das System erhebt und meldet sie nicht. (Offen: ob Balu auch den Meldeschein übernimmt.)
|
||||
- **Lösch- und Aufbewahrungsfristen** nach allgemeiner Rechtsauffassung festlegen (fachkundig bestätigen lassen); technisch als Einstellungen umsetzen (Vorschläge: docs/LOESCHKONZEPT.md).
|
||||
- **Auftragsverarbeitung mit Strato:** Strato stellt dafür nach unserem Kenntnisstand einen Standardvertrag im Kundenbereich bereit – dort prüfen/abschließen.
|
||||
- **Portalgäste** = Gäste, die über ein Buchungsportal (FeWo-direkt u. a.) buchen; ihre Daten erreichen uns nur über die Portal-Benachrichtigungen. Wir betreiben selbst kein Portal.
|
||||
- **Verwaltung:** mehrere Verwalter-Konten (mindestens Lars und Brigitte Stommer); **einfache Ansicht** (Anfragen/Buchungen/Verträge, Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen) und **Expertenansicht** (alle Einstellungen), umschaltbar je Benutzer – umgesetzt.
|
||||
- Die Dokumente BUCHUNGSPROZESS, DATENMODELL-KONZEPT, GAP-DELTA, GO-LIVE-CHECKLISTE, LOESCHKONZEPT und DATENSCHUTZ-* wurden von einem Analyse-Agenten erstellt; die dort genannten „verbindlichen Entscheidungen E1–E7“ sind **dessen Annahmen**. Maßgeblich sind die Festlegungen in diesem Dokument.
|
||||
|
||||
## 7. Connector-/Plugin-System für Portale
|
||||
|
||||
Portale wechseln → jedes Portal ist ein eigenständiger **Channel-Connector** hinter einer gemeinsamen Schnittstelle:
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
# LOESCHKONZEPT – Datenkategorien und Fristen
|
||||
|
||||
> **Hinweis (22.10.2026):** Von einem Analyse-Agenten erstellt. Die als „verbindlich“ bezeichneten Entscheidungen (E1–E7) sind Annahmen des Agenten, keine Festlegungen der Betreiber. Maßgeblich sind die Entscheidungen in [KONZEPT.md §6a/6b](KONZEPT.md) (u. a. Buchungsweg 1 über Angebot + Annahme, Weg 2 Direktbuchung später; Kurabgabe vor Ort durch Ferienservice Balu).
|
||||
|
||||
Stand: 22.10.2026 · **Entwurf.** Alle Fristen sind **Vorschläge bzw. Prüfannahmen und rechtlich zu bestätigen** (Steuerberatung, Rechtsberatung, ggf. Datenschutzbeauftragte/r), sofern nicht „im Code belegt“. Kein Code geändert.
|
||||
|
||||
## 1. Prinzipien
|
||||
|
||||
1. **Trennung** operativer personenbezogener Daten (Gäste-Kommunikation, Marketing, Anfragen) von **archivierungspflichtigen Nachweisen** (Buchungs-/Zahlungsbelege, Verträge/Rechnungen).
|
||||
2. Nach Ablauf des operativen Zwecks: Löschung bzw. Anonymisierung; Nachweise bleiben, werden aber auf das Nötige reduziert und nur noch zugriffsbeschränkt (Einschränkung der Verarbeitung, Art. 18 / Art. 17 (3) b).
|
||||
3. Steuerliche Aufbewahrung geht der Löschung vor (Art. 17 (3) b DSGVO); Löschung erfolgt unverzüglich nach Fristende.
|
||||
4. Jede Frist ist maschinell konfigurierbar (`config/fewo.php`) und im Verfahrensverzeichnis dokumentiert.
|
||||
|
||||
## 2. Frist-Übersicht
|
||||
|
||||
Fristbeginn, wo nicht anders genannt: Ende des Kalenderjahres, in dem das Ereignis eintrat (⚖ je Rechtsnorm bestätigen). Steuerliche Fristen laut AO (§ 147: Buchungsbelege und Handels-/Geschäftsbriefe mit unterschiedlicher Dauer; Änderungen durch das Bürokratieentlastungsgesetz IV ⚖ aktuell prüfen).
|
||||
|
||||
| Datenkategorie | Tabelle/Ort | Typ | Vorschlag Frist | Mechanismus Ist | Mechanismus Soll | Status |
|
||||
|---|---|---|---|---|---|---|
|
||||
| Unverbindliche Anfrage ohne Folgebuchung | `guests`, `bookings` (Status `reserved`) | operativ | z. B. 3–6 Monate nach Ablauf/Ablehnung ⚖ (Zweck: Rückfragen, Abwehr Ansprüche) | Keine; erst 10-Jahre-Anonymisierung | Job `inquiries:purge` löscht Anfrage + ggf. verwaisten Gast | ❌ Lücke |
|
||||
| Abgelaufene/abgelehnte Vorreservierung | `bookings` (`expired`/`declined`) | operativ | wie oben ⚖ | Statusjob (`bookings:expire-holds`), keine Löschung | wie oben | ❌ Lücke |
|
||||
| Verbindliche Buchung – Stammdaten Gast | `guests`, `bookings` | operativ + Nachweis | Gastdaten operativ bis Ende der Gewährleistungs-/Verjährungsfrist (3 Jahre, ⚖ BGB § 195); danach Anonymisierung des Gastes, Buchung bleibt als Beleg | Anonymisierung nach `guest_retention_years` = 10 J. (im Code belegt, ✅ `AnonymizeGuests`) | Zweistufig: Gast nach 3 J. anonymisieren, Beleg bis Steuerfrist | ⚠ zu lang/gebündelt |
|
||||
| Vertrags-/Rechnungsdokumente | `storage/app/private/contracts` | Nachweis | Steuerliche Aufbewahrung (Prüfannahme 6–10 Jahre, ⚖) | Nicht gelöscht, **nicht** anonymisiert | `documents.retain_until`, Job löscht Datei nach Fristende; Zugriff auf Rolle begrenzen | ❌ Lücke |
|
||||
| Zahlungen und Belege | `payments` | Nachweis | steuerliche Frist ⚖ | Bleiben (keine Löschung) ✅ gewollt | `retain_until`; `note`/`recorded_by` minimieren | ⚠ |
|
||||
| Portalnachrichten (E-Mail-Auszug) | `portal_emails.excerpt` | operativ | kurz, z. B. 30–90 Tage nach Verarbeitung ⚖; Referenz/Zeitraum bleiben | Keine | Job leert `excerpt`; Mail im IMAP-Postfach löschen | ❌ Lücke |
|
||||
| Portal-E-Mails im Postfach | IMAP bei STRATO | operativ/Beleg | Mails mit Buchungsbeleg-Charakter ggf. Geschäftsbrief-Frist ⚖ | Mails werden nur gelesen (`leaveUnread`) | Ablage-/Löschregel im Postfach | ❓ |
|
||||
| Iterative iCal-Sperren | `blocked_periods.reason` | operativ | Sperren bis Zeitraumende + Frist; `reason` ohne Personenbezug | Behalten | `reason` nicht speichern, wenn Namen enthalten (D5) | ❓ |
|
||||
| Bewertungen | `reviews` | operativ/Veröffentlichung | Veröffentlichte Bewertung bis Widerruf der Einwilligung; privates Feedback kurz (z. B. 12 Monate) ⚖ | Nicht von `anonymize` erfasst | Bei Gast-Anonymisierung `display_name` neutralisieren, `private_feedback` löschen | ❌ Lücke |
|
||||
| Marketing-Einwilligungen | `guests.marketing_consent_at` | Nachweis Einwilligung | Bis Widerruf, **Nachweis** der Einwilligung ggf. 3 J. über Widerruf hinaus ⚖ | Widerruf per Link setzt `NULL` (✅); Nachweis geht verloren | Nachweis-Log (Zeitpunkt, DOI-Bestätigung, ohne IP) separat | ⚠ |
|
||||
| Gästekartei (Notizen, Tags) | `guests.notes/tags` | operativ | mit Gast-Anonymisierung | ✅ bei `anonymize()` | – | ✅ |
|
||||
| `bookings.message` (Gastnachricht) | `bookings` | operativ | mit Gast-Anonymisierung | ✅ | früher möglich | ✅ |
|
||||
| `bookings.internal_notes` | `bookings` | operativ | mit Gast-Anonymisierung | ❌ nicht erfasst | in `anonymize()` aufnehmen | ❌ Lücke |
|
||||
| Herkunft/UTM | `bookings.utm_*`, `referral_source` | operativ (Statistik) | kurz (z. B. 12–24 Monate) oder aggregieren ⚖ | Behalten | Job nullt UTM nach Frist | ❌ Lücke |
|
||||
| Kurabgabe-/Meldedaten | s. BUCHUNGSPROZESS.md §Kühlungsborn | gesetzlich | Meldeschein: kurz (⚖ BMG § 30: ca. 1 Jahr, danach Vernichtung); Kurabgabe-Nachweise nach Satzung/Steuerrecht ⚖ | nicht implementiert | getrennte Tabelle mit eigener Frist | 🗓 |
|
||||
| Admin-Konten | `users` | operativ | bis Ausscheiden | manuell | Offboarding-Prozess | ⚠ |
|
||||
| Sessions | `sessions` (IP, UA) | technisch | Lifetime 120 Min.; Tabellenbereinigung | Laravel-Lotterie-GC (✅ Standard) | täglicher Job + nur bei Bedarf Session starten | ⚠ |
|
||||
| Rate-Limit-Schlüssel | `cache` (IP-Hash im Key) | technisch | 1 Stunde (✅ im Code `RateLimiter::hit(…, 3600)`) | Laufzeit | – | ✅ |
|
||||
| Anwendungs-Logs | `storage/logs` | technisch | z. B. 14 Tage (`LOG_DAILY_DAYS` Default) | Default `single` ohne Rotation ❌ | `LOG_CHANNEL=daily` | ❌ Lücke |
|
||||
| Webserver-Logs STRATO | Hosting | technisch | Anbieterabhängig | ❓ | Strato-Info/AVV | ❓ |
|
||||
| Audit-Log (neu) | `audit_events` | Nachweis Sicherheit | z. B. 12 Monate ⚖ | existiert nicht | einführen | 🗓 |
|
||||
| Fehlgeschlagene Jobs | `failed_jobs` | technisch | 30 Tage | Standard behalten | Job `queue:prune-failed` | ⚠ |
|
||||
| Datenbank-Backups | Strato/eigen | technisch | z. B. 30 Tage rollierend ⚖ | ❓ nicht belegt | dokumentieren; Restore-Test; Löschung aus Backups via Frist | ❓ |
|
||||
|
||||
## 3. Löschmechanik (Soll)
|
||||
|
||||
- **Zeitgesteuerte Jobs** (Laravel-Scheduler, bereits genutzt: `guests:anonymize` monatlich) je Kategorie, mit Zähler-Log (ohne personenbezogene Inhalte).
|
||||
- **Zwei Stufen** für Gäste: (1) operative Daten entfernen, (2) Beleg-Datensatz anonymisieren; Buchungsnummer, Beträge, Zeitraum, Steuerdaten bleiben.
|
||||
- **Dokumente:** Datei und Datensatz am `retain_until` löschen; vorher Dokumentenhash prüfen/protokollieren.
|
||||
- **Betroffenenrechte:** manuelle Aktion „Gast löschen/anonymisieren“ prüft steuerliche Sperre (offene Fristen) und führt Teil-Löschung durch; Rückmeldung innerhalb eines Monats (⚖ Art. 12).
|
||||
- **Backups:** Löschung wirkt über Rotation; keine Wiederherstellung gelöschter Daten ohne erneute Löschung (Verfahrensvorgabe).
|
||||
|
||||
## 4. Informationspflichten bei Datenherkunft (Art. 13/14)
|
||||
|
||||
| Fall | Pflicht | Umsetzungsvorschlag | Status |
|
||||
|---|---|---|---|
|
||||
| Direkt erhoben (Formular) | Art. 13: Identität, Zwecke, Rechtsgrundlage, Empfänger, Dauer, Rechte, Beschwerde | Datenschutzerklärung verlinkt am Formular; Kurzinfo in Bestätigungsmail | ❌ DSE leer |
|
||||
| Aus Portal übernommen (E-Mail/API) | Art. 14: Herkunft, Kategorien; Information binnen 1 Monat, spätestens beim ersten Kontakt | Hinweis in erster Gästemail + DSE-Abschnitt „Portalbuchungen“; ⚖ Ausnahme Art. 14 (5) a (Gast ist bereits durch Portal informiert) prüfen | ❌ offen |
|
||||
| iCal ohne Gästedaten | keine Gästedaten → keine Pflicht | – | ✅ |
|
||||
| Marketing (DOI) | Art. 13 + § 7 UWG | Hinweis im Opt-in; Widerruf in jeder Mail | ✅ teilweise |
|
||||
|
||||
## 5. Offene Rechtsfragen (Löschkonzept)
|
||||
|
||||
1. Konkrete steuerliche Fristen je Dokumentart und Fristbeginn (Steuerberatung).
|
||||
2. Zulässige Dauer der Speicherung von Anfragen ohne Vertragsschluss.
|
||||
3. Verjährungs-/Beweiszweck als Grundlage für 3-Jahres-Speicherung von Gästedaten.
|
||||
4. Nachweis der Einwilligung nach Widerruf (Dauer).
|
||||
5. Meldeschein-/Kurabgabe-Fristen (Satzung Ostseebad Kühlungsborn; BMG).
|
||||
6. Ob Portal-E-Mails im Postfach als Handelsbriefe aufbewahrungspflichtig sind.
|
||||
7. Backup-Retention-Dauer als zulässiges Maß.
|
||||
@@ -0,0 +1,244 @@
|
||||
# Neues Theme erstellen – verbindliche Bauanleitung
|
||||
|
||||
Stand: 22.10.2026 · gilt für jede Design-Sitzung (z. B. auf dem privaten Rechner mit dem Skill/Plugin `frontend-design`) · Architektur und Datenverträge: [THEMES.md](THEMES.md)
|
||||
|
||||
> **Kurz:** Ein neues Design entsteht als **zusätzliches Theme** in einem eigenen Ordner `resources/themes/<key>/`. Das vorhandene Theme **„Ostsee-Licht“ wird nicht verändert**. Das neue Theme erbt alles, was es nicht selbst mitbringt, wird mit `php artisan themes:check <key>` geprüft, per Vorschau-Link angesehen und erst dann im Admin für die Website ausgewählt. Zurück geht es jederzeit durch Auswahl des alten Themes.
|
||||
|
||||
---
|
||||
|
||||
## 1. Grundregeln (nicht verhandelbar)
|
||||
|
||||
1. **Nur im eigenen Ordner arbeiten:** `resources/themes/<key>/**`. Zusätzlich erlaubt: `package.json`/`package-lock.json` für **selbst gehostete Schriften** (`@fontsource/*`). Alles andere bleibt unangetastet, insbesondere `resources/themes/ostsee-licht/**`, `app/**`, `config/**`, `database/**`, `routes/**`, `resources/views/livewire/**`.
|
||||
2. **Neues Theme immer mit `php artisan themes:make <key>` anlegen.** Der Befehl erzeugt das korrekte Format und überschreibt nie einen vorhandenen Ordner.
|
||||
3. **Nur Optik:** Blade-Vorlagen, CSS, etwas JavaScript, Farb-Tokens. Keine Datenbankabfragen, keine Geschäftslogik und keine neuen PHP-Klassen in Vorlagen. Daten kommen fertig aufbereitet aus den Bausteinen (Variablen siehe [THEMES.md §4–5](THEMES.md)).
|
||||
4. **Farben nur über Tokens** (`bg-accent`, `text-muted` …), nie fest (`#123456`, `text-blue-700`, `bg-[#…]`, `style="color:#…"`). Sonst wirken die saisonalen Erscheinungsbilder nicht. Ausnahme ohne Saisonbezug: `text-white`/`bg-black` auf Fotos und Overlays.
|
||||
5. **Nichts von fremden Servern laden:** keine Google Fonts, CDNs, externen Skripte, eingebetteten Karten oder Videos von Drittanbietern. Grund: DSGVO, und die Seite kommt so ohne Cookie-Banner aus.
|
||||
6. **Pflicht-Markup erhalten** (§6): Verfügbarkeitssuche, Buchungsformular, Lightbox, rollierende Angebote, Echtheitshinweis der Bewertungen, JSON-LD, `noindex` in der Vorschau.
|
||||
7. **Fertig ist ein Theme erst, wenn** `php artisan themes:check <key>` ohne Fehler, `npm run build` fehlerfrei und `php artisan test --compact` grün ist und die Checkliste in §10 abgehakt ist.
|
||||
|
||||
## 2. Schnellstart
|
||||
|
||||
```bash
|
||||
git pull # aktuellen Stand holen
|
||||
composer install && npm ci # einmalig auf dem Rechner
|
||||
cp .env.example .env && php artisan key:generate # einmalig, lokale SQLite-Datenbank …
|
||||
touch database/database.sqlite # … als leere Datei anlegen (PowerShell: New-Item database/database.sqlite)
|
||||
php artisan migrate:fresh --seed # Testdaten: Wohnung, Seiten, 5 Erscheinungsbilder
|
||||
php artisan photos:import <Ordner> --manifest=database/data/wordpress-photos.csv # optional: echte Fotos (siehe BETRIEB.md)
|
||||
|
||||
php artisan themes:make ostsee-nacht --name="Ostsee-Nacht" --description="Dunkel, ruhig, großformatige Fotos"
|
||||
# → resources/themes/ostsee-nacht/ (erbt zunächst alles von Ostsee-Licht)
|
||||
|
||||
npm run dev # oder npm run build
|
||||
php artisan serve # http://localhost:8000 · Admin: /admin (admin@example.com / password, 2FA beim ersten Login einrichten)
|
||||
php artisan themes:preview ostsee-nacht # Vorschau-Links: jede Seite × jedes Erscheinungsbild
|
||||
php artisan themes:check ostsee-nacht # Prüfung gegen diese Anleitung
|
||||
```
|
||||
|
||||
**Key wählen:** Kleinbuchstaben, Ziffern und Bindestriche; Ordnername gleich Key, z. B. `ostsee-nacht`, `kuestenmagazin`. Der Key ist dauerhaft, weil die Website ihn speichert. Der Anzeigename (`name`) darf sich ändern.
|
||||
|
||||
## 3. Aufbau eines Themes
|
||||
|
||||
```
|
||||
resources/themes/<key>/
|
||||
├── theme.json Manifest (Pflicht)
|
||||
├── theme.css Vite-Einstiegspunkt CSS (Pflicht, sobald das Theme eigenes CSS hat – themes:make legt es an)
|
||||
├── theme.js Vite-Einstiegspunkt JS (Pflicht zusammen mit theme.css)
|
||||
├── README.md kurze Beschreibung, welche Vorlagen überschrieben sind
|
||||
└── views/
|
||||
├── layouts/app.blade.php optional: Grundgerüst (<head>, Banner, Kopf, Inhalt, Fuß, Lightbox)
|
||||
├── page.blade.php optional: Ausgabe der Bausteine einer Seite
|
||||
├── partials/ optional: banner, header, footer, image, mobile-booking-bar + eigene Includes
|
||||
└── sections/<baustein>.blade.php optional: je Baustein eine Vorlage (Liste in §5)
|
||||
```
|
||||
|
||||
**Vererbung:** Jede Vorlage, die im Theme fehlt, kommt vom Eltern-Theme (`parent`) und zuletzt vom Basis-Theme „Ostsee-Licht“. Ein frisch angelegtes Theme sieht daher genauso aus wie Ostsee-Licht. Man überschreibt Schritt für Schritt nur, was anders werden soll. Für ein komplett neues Design werden in der Regel alle Vorlagen überschrieben. Ausgangspunkt ist dann jeweils die gleichnamige Datei aus `resources/themes/ostsee-licht/views/`: in den eigenen Ordner **kopieren** und umgestalten, das Original nicht ändern.
|
||||
|
||||
### 3.1 `theme.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "ostsee-nacht",
|
||||
"name": "Ostsee-Nacht",
|
||||
"version": "0.1.0",
|
||||
"parent": "ostsee-licht",
|
||||
"description": "Dunkel, ruhig, großformatige Fotos",
|
||||
"assets": {
|
||||
"css": "resources/themes/ostsee-nacht/theme.css",
|
||||
"js": "resources/themes/ostsee-nacht/theme.js"
|
||||
},
|
||||
"tokens": {
|
||||
"ground": { "label": "Hintergrund", "default": "#0F1A22" },
|
||||
"accent": { "label": "Akzent (Buttons, Hervorhebungen)", "default": "#E8B04A" }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Feld | Regel |
|
||||
|---|---|
|
||||
| `key` | = Ordnername, `^[a-z0-9]+(-[a-z0-9]+)*$` |
|
||||
| `name`, `description` | erscheinen im Admin bei der Theme-Auswahl |
|
||||
| `version` | `MAJOR.MINOR.PATCH`; bei jeder Auslieferung erhöhen |
|
||||
| `parent` | in der Regel `ostsee-licht`; auch ein anderes installiertes Theme ist möglich |
|
||||
| `assets.css` / `assets.js` | **genau** `resources/themes/<key>/theme.css` bzw. `theme.js`: Nur diese Dateien baut `vite.config.js` automatisch. Hat ein Theme eigene Assets, ersetzen sie die des Eltern-Themes **vollständig** (deshalb importieren beide Dateien das Eltern-Theme, §3.2/3.3). |
|
||||
| `tokens` | Farbwerte als `#RRGGBB` mit deutschem `label`. `themes:make` übernimmt alle geerbten Tokens; die Defaults sind neu zu setzen. Alle 12 Basis-Tokens müssen in der Kette vorhanden sein. Neue Tokens sind erlaubt (§4). |
|
||||
|
||||
### 3.2 `theme.css` (so legt `themes:make` sie an)
|
||||
|
||||
```css
|
||||
@import 'tailwindcss';
|
||||
@import '../ostsee-licht/theme-base.css'; /* Schriften, Token-Mapping, Basis-Klassen des Eltern-Themes */
|
||||
|
||||
/* eigene Schriften – selbst gehostet */
|
||||
@import '@fontsource/fraunces/400.css';
|
||||
|
||||
/* Vorlagen, deren Tailwind-Klassen gebaut werden – alle drei Zeilen sind Pflicht */
|
||||
@source '../ostsee-licht/views'; /* geerbte Vorlagen */
|
||||
@source '../../views/livewire'; /* Buchungs- und Bewertungsformular */
|
||||
@source './views'; /* eigene Vorlagen */
|
||||
|
||||
@theme inline {
|
||||
--font-display: 'Fraunces', Georgia, serif;
|
||||
--font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
|
||||
/* neues Token: */
|
||||
--color-glow: var(--glow);
|
||||
}
|
||||
|
||||
@layer components {
|
||||
.heading-display { /* Basis-Klassen dürfen neu definiert werden */ }
|
||||
}
|
||||
```
|
||||
|
||||
- **Tailwind v4** (kein `tailwind.config.js`, keine `@apply` auf eigene Klassen).
|
||||
- `theme-base.css` des Eltern-Themes liefert: Schriften von Ostsee-Licht, das Mapping aller Tokens auf Tailwind-Farben (`--color-<token>: var(--<token>)`), Formular-Grundstile, Fokusrahmen, `prefers-reduced-motion`. Dazu kommen die Klassen, die geerbte Vorlagen und die Formulare nutzen: `.eyebrow`, `.heading-display`, `.btn-primary`, `.btn-accent`, `.prose-theme`, `.reveal`. **Wer `theme-base.css` nicht importiert, muss all das selbst bereitstellen.** `themes:check` prüft Mapping und Quellen.
|
||||
- **Nicht** `../ostsee-licht/theme.css` importieren, sondern `theme-base.css`. Die Quellen gibt das neue Theme selbst an.
|
||||
|
||||
### 3.3 `theme.js`
|
||||
|
||||
```js
|
||||
import '../ostsee-licht/theme.js'; // Lightbox, Verfügbarkeitssuche, rollierende Angebote
|
||||
|
||||
// eigene, kleine Verbesserungen – progressive enhancement: ohne JS muss alles funktionieren
|
||||
```
|
||||
|
||||
Kein Framework (React/Vue/Alpine-Komponenten), keine externen Skripte. Livewire/Alpine lädt das Layout bereits für das Buchungsformular.
|
||||
|
||||
## 4. Farben und Tokens
|
||||
|
||||
- Das Layout gibt die Tokens als CSS-Variablen aus (`:root{--accent:#…}`). Die Reihenfolge ist: Theme-Standard → Website (Admin › System › Websites › Farben) → Erscheinungsbild (Admin › Webseite › Erscheinungsbilder › Farben).
|
||||
- Basis-Tokens (Bedeutung **nicht** umdeuten, nur neu einfärben):
|
||||
|
||||
| Token | Tailwind | Verwendung |
|
||||
|---|---|---|
|
||||
| `ground` | `bg-ground` | Seitenhintergrund |
|
||||
| `surface` | `bg-surface` | Karten, Formulare |
|
||||
| `ink` | `text-ink` | Haupttext |
|
||||
| `muted` | `text-muted` | Nebentext |
|
||||
| `line` | `border-line` | Linien, Rahmen |
|
||||
| `accent` / `accent-ink` | `bg-accent` / `text-accent-ink` | Buttons, Hervorhebungen / Text darauf |
|
||||
| `band` / `band-ink` / `band-muted` | `bg-band` … | dunkles Band (z. B. Lage) |
|
||||
| `banner` / `banner-ink` | `bg-banner` … | Hinweis-Banner oben |
|
||||
|
||||
- **Kontraste (WCAG 2.2 AA, ≥ 4,5 : 1)** werden von `themes:check` für die Theme-Standards (Fehler) und für jedes aktive Erscheinungsbild der Datenbank (Warnung) geprüft. Paare: ink/muted/accent auf ground und surface, accent-ink auf accent, band-ink/band-muted auf band, banner-ink auf banner. Bei Warnungen in den Erscheinungsbildern die Saisonfarben im Admin anpassen oder die Theme-Standards so wählen, dass die Saisons passen.
|
||||
- Saisonale Feinheiten im CSS: `<html data-appearance="weihnachten">`, also etwa `[data-appearance=silvester] .hero-overlay { … }`. Schlüssel: `standard`, `sommer`, `winter`, `weihnachten`, `silvester` (Slug des Namens).
|
||||
- **Neues Token:** in `theme.json › tokens` (mit `label`, `default`) und in `theme.css › @theme inline` als `--color-<token>: var(--<token>);` mappen. Es erscheint dann automatisch als Farbfeld im Admin.
|
||||
|
||||
## 5. Bausteine und Vorlagen
|
||||
|
||||
Jede Seite ist eine Liste von Bausteinen, die die Vermieterin im Admin anordnet. Für jeden Baustein rendert das System `theme::sections.<key>` mit fertigen Variablen. **Welche Variablen es gibt, steht verbindlich in [THEMES.md](THEMES.md) §5.** Die Vorlagen von Ostsee-Licht sind die Referenz-Implementierung.
|
||||
|
||||
| Datei (`views/…`) | Baustein / Zweck |
|
||||
|---|---|
|
||||
| `sections/hero` | Titelbereich mit Verfügbarkeitssuche, optional Top-Angebot |
|
||||
| `sections/facts` | Eckdaten |
|
||||
| `sections/text_image` | Text mit bis zu 3 Bildern |
|
||||
| `sections/gallery` | Bildergalerie mit Lightbox |
|
||||
| `sections/amenities` | Ausstattung |
|
||||
| `sections/location` | Lage & Umgebung |
|
||||
| `sections/prices` | Preise & Saisons |
|
||||
| `sections/offers` | Sonderangebote (nebeneinander / Liste / rollierend) |
|
||||
| `sections/booking` | Kalender & Anfrage (Livewire) |
|
||||
| `sections/reviews` | Gästebewertungen |
|
||||
| `sections/host` | Gastgeberin |
|
||||
| `sections/faq` | Häufige Fragen |
|
||||
| `sections/cta` | Abschluss mit Aufruf |
|
||||
| `sections/contact` | Kontakt |
|
||||
| `sections/rich_text` | Fließtext (Impressum, Datenschutz …) |
|
||||
| `layouts/app`, `page`, `partials/*` | Grundgerüst, Kopf, Fuß, Banner, Bild-Helfer, mobile Buchungsleiste |
|
||||
|
||||
Regeln für Vorlagen:
|
||||
|
||||
- **Immer vorhanden:** `$theme` und `$sectionId`. `$sectionId` für `id`/`aria-labelledby` verwenden, weil ein Baustein mehrfach auf einer Seite stehen kann.
|
||||
- **Leere Daten abfangen:** Bausteine ohne Inhalt (keine Angebote, keine Bewertungen, kein Foto) rendern nichts bzw. einen ruhigen Platzhalter. Nie mit Fehlern abbrechen.
|
||||
- **Bilder** immer über `@include('theme::partials.image', ['photo' => $photo, 'sizes' => '(min-width: 1024px) 50vw, 100vw', 'class' => '…', 'eager' => false])`. Das liefert responsives WebP (640/1280/2048 px) und Alt-Text aus dem Admin. `eager => true` nur für das erste große Bild der Seite.
|
||||
- **Saisonbilder je Baustein** und **Bausteine nur in bestimmten Erscheinungsbildern** regelt das System. Vorlagen nehmen einfach `$photo`/`$photos`.
|
||||
- **Texte** kommen aus dem Admin. Feste Texte in Vorlagen nur für Bedienelemente („Preis berechnen“, „Schließen“); auf Deutsch, per „Sie“.
|
||||
- **Eigene Teil-Vorlagen** nach `views/partials/<name>.blade.php` legen und mit `@include('theme::partials.<name>')` einbinden.
|
||||
- **Buchungs- und Bewertungsformular** (`resources/views/livewire/*.blade.php`) sind für alle Themes gemeinsam und nicht änderbar. Sie nutzen nur Token-Klassen und `.btn-*`; ein Theme passt sie über Tokens und die Basis-Klassen an.
|
||||
|
||||
## 6. Pflicht-Markup (wird von `themes:check` geprüft)
|
||||
|
||||
| Vorlage | Muss enthalten | Warum |
|
||||
|---|---|---|
|
||||
| `layouts/app` | `@vite($theme->assets())`, `{!! $theme->cssVariables() !!}` in `<style>`, `@livewireStyles`, `@livewireScripts`, `@stack('head')`, `@yield('content')`, `data-appearance="{{ $theme->appearanceKey() }}"` am `<html>`, `<meta name="robots" content="noindex">` wenn `$theme->isPreview \|\| ! app()->isProduction()`, Vorschau-Hinweis, `<dialog id="lightbox">` mit `img`, `[data-caption]`, `[data-close]`, Sprunglink `#inhalt` | Assets, Farben, Buchung, SEO-Schutz, Lightbox, Barrierefreiheit |
|
||||
| `page` | Ausgabe von `$sections` (`{!! $section->render() !!}`) und JSON-LD aus `$structuredData` per `@push('head')` | Inhalt, Google |
|
||||
| `partials/header` | `$theme->menu('main')` (Links `->url()`, Text `->label()`), Button zur Buchung | Navigation |
|
||||
| `partials/footer` | `$theme->menu('footer')` (Impressum, Datenschutz) | Rechtspflicht |
|
||||
| `sections/hero` | GET-Formular an `route('booking.create')` mit `data-availability-search` und Feldern `name="anreise"`, `name="abreise"` (Y-m-d), `name="personen"` | Suche → Buchungsseite |
|
||||
| `sections/booking` | `<livewire:booking-request :property="$property" />` | Kalender, Preis, Anfrage |
|
||||
| `sections/gallery` | Links `<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}">` | Lightbox |
|
||||
| `sections/offers` | Umsetzung von `$display`: bei `rotating` die Attribute `data-rotator` (Container), `data-rotator-slide` (je Angebot, außer dem ersten `hidden`), `data-rotator-prev`/`-next`, `data-rotator-dot="<index>"` mit `aria-selected` | rollierende Angebote (theme.js) |
|
||||
| `sections/reviews` | Hinweis: „Bewertungen über unsere Webseite können nur Gäste mit einer Buchung bei uns abgeben …“ (Wortlaut sinngemäß, muss „nur Gäste“ enthalten) | § 5b UWG |
|
||||
| `sections/faq` | FAQ-JSON-LD per `@push('head')` | Google |
|
||||
| `partials/mobile-booking-bar` | auf dem Handy immer erreichbarer Buchungs-Button | Konversion |
|
||||
|
||||
## 7. Schriften, Bilder, Icons, Bewegung
|
||||
|
||||
- **Schriften:** `npm install @fontsource/<schrift>` (oder `@fontsource-variable/<schrift>`), in `theme.css` importieren, in `@theme inline` als `--font-display` / `--font-sans` setzen. Höchstens zwei Familien und wenige Schnitte (Ladezeit). Lizenz: nur Open-Font-Lizenzen (Fontsource sind OFL).
|
||||
- **Bilder:** nur Fotos aus dem Admin (Webseite › Fotos). Dekorative Grafiken als Inline-SVG in der Vorlage oder als Datei im Theme-Ordner, eingebunden über `{{ Vite::asset('resources/themes/<key>/img/…') }}`. Damit Vite diese Dateien baut, in `theme.js` einmal `import.meta.glob(['./img/**'], { eager: true, query: '?url' });` ergänzen. Keine Bild-URLs von fremden Servern.
|
||||
- **Icons:** Inline-SVG; Heroicons sind über Blade verfügbar (`<x-heroicon-o-sparkles class="size-5" />`, kommt mit Filament).
|
||||
- **Bewegung:** nur mit Zweck; `@media (prefers-reduced-motion: no-preference)` und `@supports (animation-timeline: view())` als Verbesserung. Ohne Animation und ohne JS muss alles vollständig funktionieren. Kein Autoplay-Video mit Ton; Video nur stumm, mit Standbild und nicht bei `prefers-reduced-data`.
|
||||
|
||||
## 8. Qualität
|
||||
|
||||
Es gelten [THEMES.md](THEMES.md) §8:
|
||||
- Mobil zuerst (ab 360 px).
|
||||
- LCP unter 2,5 s.
|
||||
- WCAG 2.2 AA mit Kontrasten, Tastaturbedienung, sichtbarem Fokus und genau einem `h1` je Seite.
|
||||
- Reduced Motion wird respektiert.
|
||||
- SEO-Ausgaben bleiben erhalten.
|
||||
|
||||
## 9. Prüfen, ansehen, einbinden
|
||||
|
||||
1. **Prüfen:** `php artisan themes:check <key>`. Rote Punkte (✗) sind Fehler und müssen behoben werden, gelbe (!) sind Hinweise.
|
||||
2. **Ansehen, ohne etwas umzuschalten:** `php artisan themes:preview <key>` gibt für jede Seite signierte Links aus: „heute“ und je Erscheinungsbild (Standard, Sommer, Winter, Weihnachten, Silvester). Im Admin geht das auch unter System › Websites › Theme: Theme wählen, dann **„Vorschau“** (öffnet einen neuen Tab), noch nicht speichern. Vorschauseiten sind `noindex`. Klickt man in der Vorschau auf einen Menülink, verlässt man sie; deshalb für jede Seite den eigenen Link verwenden.
|
||||
3. **Bauen und testen:** `npm run build` und `php artisan test --compact`. Der Test `test_installed_themes_fulfil_the_theme_contract` lässt die Suite rot werden, wenn ein Theme die Prüfung nicht besteht.
|
||||
4. **Einreichen:** Commit (nur `resources/themes/<key>/**`, ggf. `package*.json`) und Push nach Gitea.
|
||||
5. **Ausliefern:** `bash scripts/deploy.sh staging deploy` (Testbetrieb https://stommer.info, siehe [BETRIEB.md](BETRIEB.md)). Die Vorschau-Links funktionieren dort genauso (`php artisan themes:preview <key>` über `bash scripts/deploy.sh staging artisan themes:preview <key>`).
|
||||
6. **Auswählen:** Admin › System › Websites › Website bearbeiten › **Theme** wählen › Speichern. Die Farbfelder darunter zeigen jetzt die Tokens des neuen Themes.
|
||||
7. **Zurück:** dort das vorherige Theme wählen. Alle Themes bleiben installiert; es wird nichts überschrieben.
|
||||
|
||||
## 10. Checkliste vor Abschluss
|
||||
|
||||
- [ ] Theme mit `themes:make` angelegt; `resources/themes/ostsee-licht/**` unverändert (`git status`)
|
||||
- [ ] `themes:check <key>` ohne Fehler; Warnungen bewertet
|
||||
- [ ] Alle Seiten (`/`, `/wohnung`, `/kuehlungsborn`, `/buchen`, `/kontakt`, `/impressum`, `/datenschutz`) auf Handy (360 px), Tablet und Desktop geprüft
|
||||
- [ ] Alle 5 Erscheinungsbilder über `themes:preview` geprüft (Silvester ist dunkel, Kontraste!)
|
||||
- [ ] Buchungsablauf in der Vorschau durchgespielt: Termin wählen → Preis erscheint → Anfrage absenden
|
||||
- [ ] Sonderangebote in allen drei Darstellungen (Baustein-Einstellung) angesehen
|
||||
- [ ] Tastatur: alles erreichbar, Fokus sichtbar; Reduced Motion an → keine Animation
|
||||
- [ ] Nur selbst gehostete Schriften, keine externen Anfragen (Browser-Netzwerkanalyse)
|
||||
- [ ] `npm run build` fehlerfrei, `php artisan test --compact` grün
|
||||
- [ ] `README.md` des Themes: welche Vorlagen überschrieben sind, Schriften, Besonderheiten; `version` erhöht
|
||||
|
||||
## 11. Gut zu wissen
|
||||
|
||||
- **Tailwind-Klassen werden themeübergreifend gesammelt:** Das Vite-Plugin sammelt beim Build die Klassen aller Themes, deshalb kann die CSS-Datei jedes Themes auch Klassen der anderen enthalten. Das ist harmlos (etwas größer). Eigene Schriften, Tokens und Komponenten-Stile bleiben dagegen im jeweiligen Theme, das ist geprüft.
|
||||
- **Strato hat ein Datei-Limit:** Bilder im Theme-Ordner sparsam einsetzen; Fotos gehören in den Admin.
|
||||
- **Ein Theme pro Website:** Weitere Vermieter mit eigener Domain können später ein anderes Theme nutzen (Admin › Websites).
|
||||
|
||||
## 12. Auftrag für die Design-Sitzung (zum Kopieren)
|
||||
|
||||
> Lies `CLAUDE.md`, `docs/THEME-ERSTELLUNG.md` und `docs/THEMES.md` vollständig. Erstelle mit dem Skill `frontend-design` ein **neues, zusätzliches Theme** für die Ferienwohnung Stommer in Kühlungsborn. Lege es mit `php artisan themes:make <key> --name="…" --description="…"` an und arbeite ausschließlich in `resources/themes/<key>/` (plus `package.json` für `@fontsource`-Schriften). Verändere `resources/themes/ostsee-licht` nicht. Kopiere die Referenzvorlagen aus `resources/themes/ostsee-licht/views` in dein Theme und gestalte sie neu. Halte dabei den Vorlagen-Vertrag (THEMES.md §5) und das Pflicht-Markup (THEME-ERSTELLUNG.md §6) ein. Nur Token-Farben, keine externen Quellen, mobil zuerst, WCAG 2.2 AA. Prüfe laufend mit `php artisan themes:check <key>` und sieh jede Seite in allen Erscheinungsbildern über `php artisan themes:preview <key>` an. Abschluss: Checkliste §10, `npm run build`, `php artisan test --compact`, Commit nur der Theme-Dateien.
|
||||
>
|
||||
> Gestalterische Leitideen: siehe THEMES.md §10.
|
||||
+15
-9
@@ -3,6 +3,8 @@ # Theme-System – Architektur, Vorlagen-Vertrag, Übergabe Design
|
||||
Stand: 22.10.2026 · Basis-Theme: **„Ostsee-Licht“** (`resources/themes/ostsee-licht`) · Entscheidungen: `docs/KONZEPT.md` §4a
|
||||
|
||||
> **Kurz:** Logik, Daten und Admin sind fertig und getestet. Ein Theme ist **nur Optik**: Blade-Vorlagen, CSS, ein wenig JS und Farb-Tokens. Für ein neues Design wird ausschließlich unter `resources/themes/<theme>/` gearbeitet.
|
||||
>
|
||||
> **Neues Theme bauen:** verbindliche Schritt-für-Schritt-Anleitung in [THEME-ERSTELLUNG.md](THEME-ERSTELLUNG.md) (`themes:make`, `themes:check`, `themes:preview`).
|
||||
|
||||
---
|
||||
|
||||
@@ -26,7 +28,7 @@ ## 1. Überblick
|
||||
| **Theme** | `resources/themes/<key>/` | Manifest `theme.json`, Vorlagen `views/`, `theme.css`, `theme.js` |
|
||||
| **Seite** | `pages`, Admin › Webseite › Seiten | Adresse, Menü (Haupt/Fuß/keins), SEO, **Bausteine** (Builder) |
|
||||
| **Baustein** (Section) | `app/Themes/Sections/*`, Katalog in `config/themes.php` | Admin-Formular + Datenaufbereitung; Darstellung: `theme::sections.<key>` |
|
||||
| **Erscheinungsbild** (Appearance) | `appearances`, Admin › Webseite › Erscheinungsbilder | Jährlicher Zeitraum + Priorität; ersetzt Farben (Tokens), Titelbild, ausgewählte Texte, Banner, hervorgehobenes Angebot – **nicht** den Aufbau |
|
||||
| **Erscheinungsbild** (Appearance) | `appearances`, Admin › Webseite › Erscheinungsbilder | Jährlicher Zeitraum + Priorität; ersetzt Farben (Tokens), Titelbild, **Bilder je Baustein**, ausgewählte Texte, Banner – **nicht** den Aufbau. Bausteine können auf Erscheinungsbilder beschränkt werden. Sonderangebote sind **unabhängig** davon (`OfferShowcase`) |
|
||||
|
||||
Code: `app/Themes/` (Theme, ThemeFactory, ThemeRegistry, ThemeManifest, SectionRegistry, Sections/), `app/Http/Middleware/ResolveTheme.php`, `app/Http/Controllers/PageController.php`, `app/Providers/ThemeServiceProvider.php`.
|
||||
|
||||
@@ -35,7 +37,8 @@ ## 2. Aufbau eines Themes
|
||||
```
|
||||
resources/themes/ostsee-licht/
|
||||
├── theme.json Manifest
|
||||
├── theme.css Tailwind v4 + Schriften + Token-Mapping
|
||||
├── theme.css Vite-Einstieg: @import 'tailwindcss' + theme-base.css + @source der Vorlagen
|
||||
├── theme-base.css wiederverwendbar: Schriften, Token-Mapping, Basis-Klassen (Child-Themes importieren diese Datei)
|
||||
├── theme.js kleine Verbesserungen (Lightbox, Suche)
|
||||
└── views/
|
||||
├── layouts/app.blade.php Grundgerüst: <head>, Banner, Kopf, @yield('content'), Fuß, Lightbox
|
||||
@@ -58,8 +61,8 @@ ### theme.json
|
||||
}
|
||||
```
|
||||
|
||||
- **Vererbung:** Vorlagen, die ein Theme nicht hat, kommen vom Eltern-Theme, zuletzt vom Basis-Theme (`config('themes.base')`). Ein Child-Theme kann also mit einer einzigen Datei beginnen (z. B. nur `sections/hero.blade.php`). Hat ein Child-Theme keine eigenen `assets`, werden die des Eltern-Themes geladen.
|
||||
- **Neues Theme anlegen:** Ordner `resources/themes/<key>/` mit `theme.json` (+ optional eigene Assets) → erscheint automatisch in Admin › System › Websites › Theme. `npm run build` baut alle Themes (`vite.config.js` liest die Ordner).
|
||||
- **Vererbung:** Vorlagen, die ein Theme nicht hat, kommen vom Eltern-Theme, zuletzt vom Basis-Theme (`config('themes.base')`). Ein Child-Theme kann also mit einer einzigen Datei beginnen (z. B. nur `sections/hero.blade.php`). Hat ein Child-Theme keine eigenen `assets`, werden die des Eltern-Themes geladen – das reicht nur ohne eigene Vorlagen; sobald es Vorlagen gibt, braucht das Theme eigene `theme.css`/`theme.js` (sonst fehlen deren Tailwind-Klassen; `themes:check` meldet das).
|
||||
- **Neues Theme anlegen:** `php artisan themes:make <key>` (überschreibt nie etwas) → erscheint automatisch in Admin › System › Websites › Theme (mit „Vorschau“). `npm run build` baut alle Themes (`vite.config.js` liest die Ordner). Prüfen: `php artisan themes:check`; Vorschau-Links: `php artisan themes:preview <key>` (signiert, `?theme=<key>` und optional `&vorschau=<Erscheinungsbild-ID>`). Details: [THEME-ERSTELLUNG.md](THEME-ERSTELLUNG.md).
|
||||
- **Plugins:** Ein Theme-Paket legt seinen Ordner unter einen Pfad aus `config('themes.paths')`. Themes werden **nie** über den Admin hochgeladen (Vorlagen sind ausführbarer Code).
|
||||
|
||||
## 3. Design-Tokens (Farben)
|
||||
@@ -83,6 +86,7 @@ ## 4. Was Layout und Vorlagen zur Verfügung haben
|
||||
| `$theme->appearanceKey()` | z. B. `weihnachten` – steht als `data-appearance` am `<html>`; für saisonale CSS-Details nutzbar: `[data-appearance=silvester] .hero {…}` |
|
||||
| `$theme->text($key, $fallback)` | Text des Erscheinungsbilds oder Fallback (Schlüssel: `Appearance::OVERRIDABLE`) |
|
||||
| `$theme->heroPhoto($fallback)` | Titelbild des Erscheinungsbilds oder Fallback |
|
||||
| `$theme->sectionPhotoIds($sectionId, $slot)` / `sectionPhotoMode($sectionId)` | Saisonbilder eines platzierten Bausteins (in Bausteinen über `seasonalPhoto()`, `seasonalPhotos()`, `withSeasonalPhotos()` der Basisklasse) |
|
||||
| `$theme->property()` | Hauptwohnung der Site |
|
||||
| `$theme->menu('main' \| 'footer')` | veröffentlichte Seiten des Menüs (`->url()`, `->label()`) |
|
||||
| `$theme->tokens()`, `cssVariables()`, `assets()` | für das Layout |
|
||||
@@ -97,14 +101,14 @@ ## 5. Bausteinkatalog – Vertrag der Vorlagen
|
||||
|
||||
| Key | Admin-Name | Variablen |
|
||||
|---|---|---|
|
||||
| `hero` | Titelbereich mit Suche | `$eyebrow`, `$title` (Text, `*Wort*` = Hervorhebung), `$text`, `$photo`, `$showSearch`, `$property` – Suche als GET-Formular an `route('booking.create')` mit `anreise`, `abreise` (Y-m-d), `personen` |
|
||||
| `hero` | Titelbereich mit Suche | `$eyebrow`, `$title` (Text, `*Wort*` = Hervorhebung), `$text`, `$photo`, `$showSearch`, `$property`, `$featuredOffer` (`AdvertisedOffer`\|null: wichtigstes hervorgehobenes Angebot) – Suche als GET-Formular an `route('booking.create')` mit `anreise`, `abreise` (Y-m-d), `personen` |
|
||||
| `facts` | Eckdaten | `$heading`, `$property`, `$highlights` (Collection<string>), `$fromPrice` (Cent\|null) |
|
||||
| `text_image` | Text mit Bildern | `$eyebrow`, `$heading`, `$text` (HtmlString\|null), `$photos` (≤3), `$imagePosition` (`left`\|`right`), `$linkLabel`, `$linkUrl` |
|
||||
| `gallery` | Bildergalerie | `$heading`, `$photos` – Lightbox: `<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="…">` |
|
||||
| `amenities` | Ausstattung | `$heading`, `$groups` (Bereich ⇒ Collection<Amenity>) |
|
||||
| `location` | Lage & Umgebung | `$eyebrow`, `$heading`, `$text`, `$address`, `$mapUrl` (OpenStreetMap-Link, keine eingebettete Karte), `$photos` |
|
||||
| `prices` | Preise & Saisons | `$eyebrow`, `$heading`, `$text`, `$property`, `$seasons` (nächste 12 Monate), `$extras`, `$featuredSeason` (Name des Erscheinungsbilds) |
|
||||
| `offers` | Sonderangebote | `$heading`, `$offers` (öffentlich, ohne Code), `$featuredId` |
|
||||
| `offers` | Sonderangebote | `$heading`, `$display` (`grid`\|`list`\|`rotating`), `$offers` (Collection<`App\Pricing\AdvertisedOffer`>: `title`, `description`, `advantage`, `conditions`, `arrival`/`departure`/`nights()` bei festen Terminen und Lücken, `quote` + `regularTotal()` für „statt …“, `bookingUrl()`). Rollierend: `data-rotator`, `data-rotator-slide`, `data-rotator-prev/next/dot` (theme.js) |
|
||||
| `booking` | Kalender & Anfrage | `$heading`, `$text`, `$property` – bindet `<livewire:booking-request :property="$property" />` ein |
|
||||
| `reviews` | Gästebewertungen | `$heading`, `$reviews`, `$count`, `$average`, `$categories` – **Pflichthinweis** zur Echtheit (§ 5b UWG) muss sichtbar bleiben |
|
||||
| `host` | Gastgeber | `$heading`, `$quote`, `$text`, `$photo`, `$name` |
|
||||
@@ -115,11 +119,13 @@ ## 5. Bausteinkatalog – Vertrag der Vorlagen
|
||||
|
||||
Rich-Text-Variablen sind bereits bereinigt (HtmlString) und werden mit `{{ $text }}` ausgegeben.
|
||||
|
||||
**Jeder platzierte Baustein** hat `data.id` (feste UUID, `Page::assignSectionIds` beim Speichern; Kopien bekommen eine neue) und `data.appearances` (Erscheinungsbild-IDs; leer = immer sichtbar, sonst nur in diesen – z. B. ein Weihnachts-Baustein). Bausteine mit Bildern melden ihre Bildplätze über `photoSlots()` (`single`, `multiple`, `collection` = automatisch gewählte Bilder, die ein Erscheinungsbild ersetzen oder voranstellen kann); daraus baut das Erscheinungsbild-Formular „Bilder je Baustein“ (`appearances.section_photos[<id>][<slot>]`, bei Sammlungen zusätzlich `mode`). Alle Bildauswahlen nutzen `App\Filament\Forms\Components\PhotoSelect` (Vorschaubild + Beschreibung, nach Kategorie gruppiert).
|
||||
|
||||
**Neuer Baustein** (auch als Plugin): Klasse `extends App\Themes\Sections\Section` (`key()`, `label()`, `icon()`, `schema()` = Admin-Felder, `data()` = Variablen) → in `config/themes.php › sections` eintragen → Vorlage `sections/<key>.blade.php` im Basis-Theme anlegen (Test `test_base_theme_is_discovered_and_provides_a_view_for_every_section` erzwingt das). Unbekannte Bausteine werden auf der Seite übersprungen, nie ein Fehler.
|
||||
|
||||
## 6. Erscheinungsbilder
|
||||
|
||||
- Felder: Name, Zeitraum `TT.MM.`–`TT.MM.` (jährlich, darf über Silvester laufen), Priorität, Standard, aktiv, Titelbild, hervorgehobenes Angebot, Texte (`banner.text`, `banner.link_label`, `banner.link_url`, `hero.eyebrow`, `hero.title`, `hero.text`, `cta.title`, `cta.text`), Farben.
|
||||
- Felder: Name, Zeitraum `TT.MM.`–`TT.MM.` (jährlich, darf über Silvester laufen), Priorität, Standard, aktiv, Titelbild, **Bilder je Baustein** (alle Bausteine mit Bildern auf allen Seiten; leer = Bild aus der Seite), Texte (`banner.text`, `banner.link_label`, `banner.link_url`, `hero.eyebrow`, `hero.title`, `hero.text`, `cta.title`, `cta.text`), Farben.
|
||||
- Startset (Seeder): Standard · Sommer 01.06.–31.08. · Winter 01.11.–31.03. · Weihnachten 01.12.–25.12. (Prio 20) · Silvester 26.12.–03.01. (Prio 20).
|
||||
- **Vorschau:** Admin › Erscheinungsbilder › „Vorschau“ = signierter Link (24 h), `noindex`.
|
||||
- Ohne Erscheinungsbild-Banner wird der neueste aktive Hinweis (Admin › Hinweis-Banner) gezeigt.
|
||||
@@ -153,9 +159,9 @@ ## 9. Lokal starten und prüfen
|
||||
|
||||
## 10. Übergabe: Auftrag für die Design-Sitzung (privater Rechner, Plugin `frontend-design`)
|
||||
|
||||
**Ziel:** Das Basis-Theme „Ostsee-Licht“ gestalterisch auf ein wirklich herausragendes Niveau heben (Recherche & Ideen: Chat vom 22.10.2026, Zusammenfassung unten), oder ein neues Theme als Child bzw. eigenständiges Theme anlegen und im Admin umschalten.
|
||||
**Ziel:** Ein **neues, zusätzliches Theme** auf wirklich herausragendem Niveau (Recherche & Ideen: Chat vom 22.10.2026, Zusammenfassung unten), angelegt mit `themes:make`, auswählbar im Admin – „Ostsee-Licht“ bleibt unverändert als Basis und Rückfall. **Verbindliche Anleitung und Auftragstext: [THEME-ERSTELLUNG.md](THEME-ERSTELLUNG.md).**
|
||||
|
||||
**Arbeitsbereich:** nur `resources/themes/<theme>/**` – dazu bei Bedarf die theme-neutralen Livewire-Formulare `resources/views/livewire/*.blade.php` (nur Klassen, keine Logik).
|
||||
**Arbeitsbereich:** nur `resources/themes/<neues-theme>/**` (+ `package.json` für `@fontsource`-Schriften). Die Livewire-Formulare `resources/views/livewire/*.blade.php` sind für alle Themes gemeinsam und werden nicht verändert.
|
||||
|
||||
**Nicht anfassen:** `app/**` (außer ein neuer Baustein wird bewusst gebraucht – dann §5), Datenbank, Admin, `config/**`.
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/* Reusable styles of "Ostsee-Licht" (fonts, token mapping, base classes) – imported by theme.css and by child themes. */
|
||||
|
||||
/* Self-hosted fonts (no request to Google – GDPR). */
|
||||
@import '@fontsource/cormorant-garamond/500.css';
|
||||
@import '@fontsource/cormorant-garamond/500-italic.css';
|
||||
@import '@fontsource/cormorant-garamond/600.css';
|
||||
@import '@fontsource/figtree/400.css';
|
||||
@import '@fontsource/figtree/500.css';
|
||||
@import '@fontsource/figtree/600.css';
|
||||
|
||||
/*
|
||||
* Colour tokens come from theme.json and can be changed per site and per appearance; the layout prints them
|
||||
* as CSS variables. Tailwind classes such as bg-accent or text-muted refer to these variables.
|
||||
*/
|
||||
@theme inline {
|
||||
--color-ground: var(--ground);
|
||||
--color-surface: var(--surface);
|
||||
--color-ink: var(--ink);
|
||||
--color-muted: var(--muted);
|
||||
--color-line: var(--line);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-ink: var(--accent-ink);
|
||||
--color-band: var(--band);
|
||||
--color-band-ink: var(--band-ink);
|
||||
--color-band-muted: var(--band-muted);
|
||||
--color-banner: var(--banner);
|
||||
--color-banner-ink: var(--banner-ink);
|
||||
|
||||
--font-display: 'Cormorant Garamond', Georgia, serif;
|
||||
--font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--ground);
|
||||
color: var(--ink);
|
||||
transition: background-color 0.4s, color 0.4s;
|
||||
}
|
||||
|
||||
input:not([type='checkbox']):not([type='radio']),
|
||||
select,
|
||||
textarea {
|
||||
border-width: 1px;
|
||||
border-color: var(--line);
|
||||
padding: 0.6rem 0.8rem;
|
||||
background-color: var(--surface);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
input[type='checkbox'] {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
.eyebrow {
|
||||
@apply mb-3 text-xs font-semibold tracking-[0.24em] text-accent uppercase;
|
||||
}
|
||||
|
||||
.heading-display {
|
||||
@apply font-display text-4xl leading-[1.08] font-medium sm:text-[2.875rem];
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
@apply inline-flex min-h-11 items-center justify-center rounded-full bg-ink px-6 py-3 text-[15px] font-semibold text-ground transition hover:opacity-90;
|
||||
}
|
||||
|
||||
.btn-accent {
|
||||
@apply inline-flex min-h-11 items-center justify-center rounded-full bg-accent px-6 py-3 text-[15px] font-semibold text-accent-ink transition hover:opacity-90;
|
||||
}
|
||||
|
||||
.prose-theme {
|
||||
@apply text-muted;
|
||||
}
|
||||
|
||||
.prose-theme p {
|
||||
@apply mb-4;
|
||||
}
|
||||
|
||||
.prose-theme ul,
|
||||
.prose-theme ol {
|
||||
@apply mb-4 ml-5 list-outside;
|
||||
}
|
||||
|
||||
.prose-theme ul {
|
||||
@apply list-disc;
|
||||
}
|
||||
|
||||
.prose-theme ol {
|
||||
@apply list-decimal;
|
||||
}
|
||||
|
||||
.prose-theme a {
|
||||
@apply text-accent underline;
|
||||
}
|
||||
|
||||
.prose-theme h2,
|
||||
.prose-theme h3 {
|
||||
@apply mt-6 mb-2 font-display text-2xl text-ink;
|
||||
}
|
||||
}
|
||||
|
||||
/* Gentle reveal while scrolling – only where supported and only without "reduce motion". */
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
@supports (animation-timeline: view()) {
|
||||
.reveal {
|
||||
animation: reveal linear both;
|
||||
animation-timeline: view();
|
||||
animation-range: entry 0% entry 35%;
|
||||
}
|
||||
|
||||
@keyframes reveal {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(24px);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
transition-duration: 0.01ms !important;
|
||||
animation-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
@@ -1,146 +1,9 @@
|
||||
/*
|
||||
* Entry point of the theme "Ostsee-Licht": Tailwind, the reusable theme styles and the template sources.
|
||||
* Child themes import theme-base.css (not this file) and list their own sources – see docs/THEME-ERSTELLUNG.md.
|
||||
*/
|
||||
@import 'tailwindcss';
|
||||
|
||||
/* Self-hosted fonts (no request to Google – GDPR). */
|
||||
@import '@fontsource/cormorant-garamond/500.css';
|
||||
@import '@fontsource/cormorant-garamond/500-italic.css';
|
||||
@import '@fontsource/cormorant-garamond/600.css';
|
||||
@import '@fontsource/figtree/400.css';
|
||||
@import '@fontsource/figtree/500.css';
|
||||
@import '@fontsource/figtree/600.css';
|
||||
@import './theme-base.css';
|
||||
|
||||
@source './views';
|
||||
@source '../../views/livewire';
|
||||
|
||||
/*
|
||||
* Colour tokens come from theme.json and can be changed per site and per appearance; the layout prints them
|
||||
* as CSS variables. Tailwind classes such as bg-accent or text-muted refer to these variables.
|
||||
*/
|
||||
@theme inline {
|
||||
--color-ground: var(--ground);
|
||||
--color-surface: var(--surface);
|
||||
--color-ink: var(--ink);
|
||||
--color-muted: var(--muted);
|
||||
--color-line: var(--line);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-ink: var(--accent-ink);
|
||||
--color-band: var(--band);
|
||||
--color-band-ink: var(--band-ink);
|
||||
--color-band-muted: var(--band-muted);
|
||||
--color-banner: var(--banner);
|
||||
--color-banner-ink: var(--banner-ink);
|
||||
|
||||
--font-display: 'Cormorant Garamond', Georgia, serif;
|
||||
--font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--ground);
|
||||
color: var(--ink);
|
||||
transition: background-color 0.4s, color 0.4s;
|
||||
}
|
||||
|
||||
input:not([type='checkbox']):not([type='radio']),
|
||||
select,
|
||||
textarea {
|
||||
border-width: 1px;
|
||||
border-color: var(--line);
|
||||
padding: 0.6rem 0.8rem;
|
||||
background-color: var(--surface);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
input[type='checkbox'] {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
.eyebrow {
|
||||
@apply mb-3 text-xs font-semibold tracking-[0.24em] text-accent uppercase;
|
||||
}
|
||||
|
||||
.heading-display {
|
||||
@apply font-display text-4xl leading-[1.08] font-medium sm:text-[2.875rem];
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
@apply inline-flex min-h-11 items-center justify-center rounded-full bg-ink px-6 py-3 text-[15px] font-semibold text-ground transition hover:opacity-90;
|
||||
}
|
||||
|
||||
.btn-accent {
|
||||
@apply inline-flex min-h-11 items-center justify-center rounded-full bg-accent px-6 py-3 text-[15px] font-semibold text-accent-ink transition hover:opacity-90;
|
||||
}
|
||||
|
||||
.prose-theme {
|
||||
@apply text-muted;
|
||||
}
|
||||
|
||||
.prose-theme p {
|
||||
@apply mb-4;
|
||||
}
|
||||
|
||||
.prose-theme ul,
|
||||
.prose-theme ol {
|
||||
@apply mb-4 ml-5 list-outside;
|
||||
}
|
||||
|
||||
.prose-theme ul {
|
||||
@apply list-disc;
|
||||
}
|
||||
|
||||
.prose-theme ol {
|
||||
@apply list-decimal;
|
||||
}
|
||||
|
||||
.prose-theme a {
|
||||
@apply text-accent underline;
|
||||
}
|
||||
|
||||
.prose-theme h2,
|
||||
.prose-theme h3 {
|
||||
@apply mt-6 mb-2 font-display text-2xl text-ink;
|
||||
}
|
||||
}
|
||||
|
||||
/* Gentle reveal while scrolling – only where supported and only without "reduce motion". */
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
@supports (animation-timeline: view()) {
|
||||
.reveal {
|
||||
animation: reveal linear both;
|
||||
animation-timeline: view();
|
||||
animation-range: entry 0% entry 35%;
|
||||
}
|
||||
|
||||
@keyframes reveal {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(24px);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
transition-duration: 0.01ms !important;
|
||||
animation-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
@@ -43,3 +43,28 @@ document.addEventListener('submit', (event) => {
|
||||
form.querySelector('[name=anreise]').focus();
|
||||
}
|
||||
});
|
||||
|
||||
// Rotating offers: one slide at a time, advancing every 7 s; pauses on hover/focus and
|
||||
// does not advance by itself when the visitor prefers reduced motion.
|
||||
document.querySelectorAll('[data-rotator]').forEach((rotator) => {
|
||||
const slides = [...rotator.querySelectorAll('[data-rotator-slide]')];
|
||||
const dots = [...rotator.querySelectorAll('[data-rotator-dot]')];
|
||||
let current = 0;
|
||||
let paused = false;
|
||||
|
||||
const show = (index) => {
|
||||
current = (index + slides.length) % slides.length;
|
||||
slides.forEach((slide, i) => { slide.hidden = i !== current; });
|
||||
dots.forEach((dot, i) => dot.setAttribute('aria-selected', i === current ? 'true' : 'false'));
|
||||
};
|
||||
|
||||
rotator.querySelector('[data-rotator-prev]')?.addEventListener('click', () => show(current - 1));
|
||||
rotator.querySelector('[data-rotator-next]')?.addEventListener('click', () => show(current + 1));
|
||||
dots.forEach((dot, i) => dot.addEventListener('click', () => show(i)));
|
||||
['mouseenter', 'focusin'].forEach((type) => rotator.addEventListener(type, () => { paused = true; }));
|
||||
['mouseleave', 'focusout'].forEach((type) => rotator.addEventListener(type, () => { paused = false; }));
|
||||
|
||||
if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||
setInterval(() => { if (!paused && !document.hidden) show(current + 1); }, 7000);
|
||||
}
|
||||
});
|
||||
@@ -20,7 +20,7 @@
|
||||
<meta property="og:image" content="{{ $ogImage }}">
|
||||
@endisset
|
||||
<link rel="canonical" href="{{ url()->current() }}">
|
||||
@if ($theme->isPreview)
|
||||
@if ($theme->isPreview || ! app()->isProduction())
|
||||
<meta name="robots" content="noindex">
|
||||
@endif
|
||||
@vite($theme->assets())
|
||||
@@ -32,7 +32,7 @@
|
||||
<a href="#inhalt" class="sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50 focus:rounded focus:bg-surface focus:px-4 focus:py-2">Zum Inhalt springen</a>
|
||||
|
||||
@if ($theme->isPreview)
|
||||
<div class="bg-ink py-2 text-center text-sm text-ground">Vorschau des Erscheinungsbilds „{{ $theme->appearance?->name }}“</div>
|
||||
<div class="bg-ink py-2 text-center text-sm text-ground">Vorschau · Theme „{{ $theme->manifest()->name }}“ · Erscheinungsbild „{{ $theme->appearance?->name ?? 'Standard' }}“</div>
|
||||
@endif
|
||||
|
||||
@include('theme::partials.banner')
|
||||
|
||||
@@ -5,6 +5,17 @@
|
||||
@if ($eyebrow)<p class="eyebrow">{{ $eyebrow }}</p>@endif
|
||||
<h1 id="{{ $sectionId }}-title" class="font-display text-[2.5rem] leading-[1.02] font-medium sm:text-[3.5rem]">{!! preg_replace('/\*(.+?)\*/u', '<em>$1</em>', e($title)) !!}</h1>
|
||||
@if ($text)<p class="mt-4 text-muted">{{ $text }}</p>@endif
|
||||
@if ($featuredOffer ?? null)
|
||||
<a href="{{ $featuredOffer->bookingUrl() }}" class="mt-5 flex items-center gap-3 rounded border border-accent p-3 hover:bg-surface">
|
||||
<span class="rounded bg-accent px-2 py-1 text-sm font-semibold whitespace-nowrap text-accent-ink">{{ $featuredOffer->advantage }}</span>
|
||||
<span class="text-sm">
|
||||
<strong>{{ $featuredOffer->title }}</strong>
|
||||
@if ($featuredOffer->arrival)
|
||||
· {{ $featuredOffer->arrival->format('d.m.') }}–{{ $featuredOffer->departure->format('d.m.') }}
|
||||
@endif
|
||||
</span>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,17 +1,74 @@
|
||||
{{-- Contract: $heading, $display (grid|list|rotating), $offers (Collection of App\Pricing\AdvertisedOffer) --}}
|
||||
@if ($offers->isNotEmpty())
|
||||
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
|
||||
<h2 id="{{ $sectionId }}-title" class="heading-display mb-8">{{ $heading }}</h2>
|
||||
<ul class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
@foreach ($offers as $offer)
|
||||
<li @class(['reveal rounded bg-surface p-7', 'ring-2 ring-accent' => $offer->id === $featuredId])>
|
||||
<p class="font-display text-2xl">{{ $offer->name }}</p>
|
||||
@if ($offer->public_description)<p class="mt-2 text-muted">{{ $offer->public_description }}</p>@endif
|
||||
@if ($offer->stay_from || $offer->stay_until)
|
||||
<p class="mt-3 text-sm text-muted">Reisezeitraum {{ $offer->stay_from?->format('d.m.Y') ?? 'ab sofort' }} – {{ $offer->stay_until?->format('d.m.Y') ?? 'offen' }}</p>
|
||||
@endif
|
||||
@php($layout = $display === 'rotating' && $offers->count() === 1 ? 'grid' : $display)
|
||||
@php($rotating = $layout === 'rotating')
|
||||
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8" aria-labelledby="{{ $sectionId }}-title"
|
||||
@if ($rotating) data-rotator aria-roledescription="Karussell" @endif>
|
||||
<div class="mb-8 flex items-end justify-between gap-4">
|
||||
<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>
|
||||
@if ($rotating)
|
||||
<div class="flex gap-2">
|
||||
<button type="button" data-rotator-prev class="rounded border border-line px-3 py-1.5 hover:bg-surface" aria-label="Vorheriges Angebot">←</button>
|
||||
<button type="button" data-rotator-next class="rounded border border-line px-3 py-1.5 hover:bg-surface" aria-label="Nächstes Angebot">→</button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<ul @class([
|
||||
'grid gap-4 sm:grid-cols-2 lg:grid-cols-3' => $layout === 'grid',
|
||||
'grid gap-4' => $layout === 'list',
|
||||
'relative' => $rotating,
|
||||
]) @if ($rotating) data-rotator-track aria-live="polite" @endif>
|
||||
@foreach ($offers as $advertised)
|
||||
<li data-offer="{{ $advertised->key() }}" @class([
|
||||
'reveal flex flex-col rounded bg-surface p-7',
|
||||
'ring-2 ring-accent' => $advertised->offer->is_featured,
|
||||
'sm:flex-row sm:items-center sm:gap-8' => $layout === 'list',
|
||||
]) @if ($rotating) data-rotator-slide @if (! $loop->first) hidden @endif aria-label="Angebot {{ $loop->iteration }} von {{ $offers->count() }}" @endif>
|
||||
<div class="flex-1">
|
||||
<p class="inline-block rounded bg-accent px-2.5 py-1 text-sm font-semibold text-accent-ink">{{ $advertised->advantage }}</p>
|
||||
<p class="mt-3 font-display text-2xl">{{ $advertised->title }}</p>
|
||||
@if ($advertised->arrival)
|
||||
<p class="mt-1 font-semibold">
|
||||
{{ $advertised->arrival->locale('de')->isoFormat('dd DD.MM.') }} – {{ $advertised->departure->locale('de')->isoFormat('dd DD.MM.YYYY') }}
|
||||
· {{ $advertised->nights() }} {{ $advertised->nights() === 1 ? 'Nacht' : 'Nächte' }}
|
||||
</p>
|
||||
@endif
|
||||
@if ($advertised->description)<p class="mt-2 text-muted">{{ $advertised->description }}</p>@endif
|
||||
@if ($advertised->conditions)
|
||||
<ul class="mt-3 flex flex-wrap gap-2 text-sm text-muted">
|
||||
@foreach ($advertised->conditions as $condition)
|
||||
<li class="rounded border border-line px-2 py-0.5">{{ $condition }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</div>
|
||||
<div @class(['mt-5', 'sm:mt-0 sm:text-right' => $layout === 'list'])>
|
||||
@if ($advertised->quote)
|
||||
<p class="text-lg">
|
||||
<strong>{{ \App\Support\Money::format($advertised->quote->total()) }}</strong>
|
||||
@if ($advertised->regularTotal() > $advertised->quote->total())
|
||||
<span class="text-muted">statt <s>{{ \App\Support\Money::format($advertised->regularTotal()) }}</s></span>
|
||||
@endif
|
||||
</p>
|
||||
<p class="text-sm text-muted">für {{ $advertised->quote->guests }} {{ $advertised->quote->guests === 1 ? 'Person' : 'Personen' }} inkl. Endreinigung</p>
|
||||
@endif
|
||||
<a href="{{ $advertised->bookingUrl() }}" class="mt-3 inline-block rounded bg-accent px-5 py-2.5 font-semibold text-accent-ink hover:opacity-90">
|
||||
{{ $advertised->arrival ? 'Diesen Termin anfragen' : 'Preis berechnen' }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<p class="mt-4 text-sm text-muted">Angebote werden bei der Preisberechnung automatisch berücksichtigt.</p>
|
||||
|
||||
@if ($rotating)
|
||||
<div class="mt-4 flex justify-center gap-2" role="tablist" aria-label="Angebote">
|
||||
@foreach ($offers as $advertised)
|
||||
<button type="button" data-rotator-dot="{{ $loop->index }}" role="tab" aria-label="Angebot {{ $loop->iteration }}"
|
||||
aria-selected="{{ $loop->first ? 'true' : 'false' }}" class="size-2.5 rounded-full bg-line aria-selected:bg-accent"></button>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<p class="mt-4 text-sm text-muted">Angebote werden bei der Preisberechnung automatisch berücksichtigt – Sie erhalten immer das für Sie günstigste.</p>
|
||||
</section>
|
||||
@endif
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
Route::get('/kalender/{token}.ics', [ChannelController::class, 'feed'])->name('channels.feed')->middleware('throttle:60,1');
|
||||
Route::get('/health/sync', [ChannelController::class, 'health'])->name('health.sync');
|
||||
Route::get('/automation/scheduler', [ChannelController::class, 'scheduler'])->name('automation.scheduler')->middleware('throttle:10,1');
|
||||
Route::post('/automation/portal-mail', [ChannelController::class, 'portalMail'])
|
||||
->name('channels.portal-mail')
|
||||
->withoutMiddleware(PreventRequestForgery::class)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Copy to scripts/deploy.production.env (or deploy.staging.env) and fill in. These files are not committed.
|
||||
|
||||
# SSH access (Strato: Kundenlogin › Datenbanken und Webspace › SFTP & SSH › Details › "Server", e.g. 12345678.ssh.w1.strato.hosting)
|
||||
DEPLOY_HOST=12345678.ssh.w1.strato.hosting
|
||||
DEPLOY_USER=stu123456789
|
||||
DEPLOY_PORT=22
|
||||
# Optional: private key file (otherwise the SSH agent / default key is used)
|
||||
# DEPLOY_SSH_KEY=~/.ssh/strato_fewo
|
||||
|
||||
# Folder below the SSH start directory. The domain's target directory must be <DEPLOY_PATH>/current/public.
|
||||
DEPLOY_PATH=fewo-production
|
||||
|
||||
# PHP CLI on Strato shared hosting: /opt/RZphp<major><minor>/bin/php-cli (check with: ls /opt)
|
||||
DEPLOY_PHP=/opt/RZphp84/bin/php-cli
|
||||
|
||||
# Public address for the health check after switching (empty = no check, no automatic rollback)
|
||||
DEPLOY_URL=https://www.fewo-stommer.de
|
||||
|
||||
# After a successful deployment, tag the commit as deploy/<environment>/<timestamp> and push the tag to Gitea
|
||||
# (the server keeps only the active release; going back = deploy an older tag). 0 = no tags.
|
||||
DEPLOY_TAG=1
|
||||
|
||||
# Local build: how Composer is called (Windows example: "php /c/path/to/composer.phar")
|
||||
# COMPOSER_BIN=composer
|
||||
@@ -0,0 +1,286 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Deployment to Strato (or any SSH host offering bash, tar and a PHP CLI) with atomic releases.
|
||||
#
|
||||
# scripts/deploy.sh <environment> setup create the folder structure on the server (once)
|
||||
# scripts/deploy.sh <environment> deploy [ref] build a Git commit/tag (default HEAD), upload, migrate, switch,
|
||||
# health check (switch back on failure), tag it in Gitea
|
||||
# scripts/deploy.sh <environment> rollback switch back while the previous release is still on the server
|
||||
# scripts/deploy.sh <environment> releases active release on the server and deployment tags in Git
|
||||
# scripts/deploy.sh <environment> artisan <args> run an artisan command in the active release
|
||||
#
|
||||
# Settings come from scripts/deploy.<environment>.env (not committed, see scripts/deploy.example.env)
|
||||
# or from environment variables (CI). Server layout below DEPLOY_PATH:
|
||||
#
|
||||
# releases/<timestamp>/ the active release (code, vendor, built assets); during a deployment also the new one.
|
||||
# Older releases are not kept (Strato file quota) – history lives in Git as tags
|
||||
# deploy/<environment>/<timestamp>; going back = deploy that tag again.
|
||||
# shared/.env production settings – created by hand once
|
||||
# shared/storage/ uploads, logs, sessions, cache – survive every release
|
||||
# current -> releases/… active release (CLI, cron); the domain points at DEPLOY_PATH, whose .htaccess
|
||||
# forwards to the active release's public folder
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
ENVIRONMENT="${1:?Bitte Umgebung angeben, z. B.: scripts/deploy.sh production deploy}"
|
||||
COMMAND="${2:-deploy}"
|
||||
shift $(($# >= 2 ? 2 : 1))
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
CONFIG="$ROOT/scripts/deploy.$ENVIRONMENT.env"
|
||||
if [[ -f "$CONFIG" ]]; then
|
||||
# shellcheck source=/dev/null
|
||||
source "$CONFIG"
|
||||
fi
|
||||
|
||||
: "${DEPLOY_HOST:?DEPLOY_HOST fehlt (z. B. ssh.strato.de oder local)}"
|
||||
: "${DEPLOY_PATH:?DEPLOY_PATH fehlt (Ordner auf dem Server, z. B. fewo-production)}"
|
||||
DEPLOY_USER="${DEPLOY_USER:-}"
|
||||
DEPLOY_PORT="${DEPLOY_PORT:-22}"
|
||||
DEPLOY_PHP="${DEPLOY_PHP:-/opt/RZphp84/bin/php-cli}"
|
||||
DEPLOY_TAG="${DEPLOY_TAG:-1}"
|
||||
DEPLOY_URL="${DEPLOY_URL:-}"
|
||||
DEPLOY_SSH_KEY="${DEPLOY_SSH_KEY:-}"
|
||||
DEPLOY_SSH_KEY="${DEPLOY_SSH_KEY/#\~/$HOME}"
|
||||
COMPOSER_BIN="${COMPOSER_BIN:-composer}"
|
||||
|
||||
say() { printf '\n\033[1;34m▶ %s\033[0m\n' "$*"; }
|
||||
fail() { printf '\n\033[1;31m✗ %s\033[0m\n' "$*" >&2; exit 1; }
|
||||
|
||||
# The script executed on the server. Arguments: <base path> <php binary> <command> [args…]
|
||||
remote_script() {
|
||||
cat <<'REMOTE'
|
||||
set -euo pipefail
|
||||
base="$1"; php="$2"; cmd="$3"; shift 3
|
||||
mkdir -p "$base"
|
||||
cd "$base"
|
||||
|
||||
# The web is served from the concrete release folder, not through the "current" symlink: Strato's
|
||||
# OPcache keys scripts by the symlinked path and would keep serving the previous release.
|
||||
# Strato: the web server's PHP version can be chosen per folder; use the same version as the CLI.
|
||||
write_htaccess() {
|
||||
local target="$1"
|
||||
local web_php
|
||||
web_php="$(printf '%s' "$php" | grep -oE 'RZphp[0-9]+' | grep -oE '[0-9]+' || true)"
|
||||
{ [[ -n "$web_php" ]] && echo "AddType application/x-httpd-php$web_php .php"; cat <<HTACCESS
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule ^(releases/(?!$target/public/)|shared(/|$)|current(/|$)|\.|upload-) - [F,L]
|
||||
RewriteCond %{REQUEST_URI} !^/releases/$target/public/
|
||||
RewriteRule ^(.*)\$ releases/$target/public/\$1 [L]
|
||||
</IfModule>
|
||||
<IfModule !mod_rewrite.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
HTACCESS
|
||||
} > .htaccess.new
|
||||
mv -f .htaccess.new .htaccess
|
||||
}
|
||||
|
||||
switch_to() {
|
||||
ln -sfn "$1" current.new
|
||||
mv -Tf current.new current
|
||||
write_htaccess "$(basename "$1")"
|
||||
}
|
||||
|
||||
case "$cmd" in
|
||||
setup)
|
||||
mkdir -p releases shared/storage/app/public shared/storage/framework/cache/data shared/storage/framework/sessions shared/storage/framework/views shared/storage/logs
|
||||
# For hosting panels that cannot point a domain at a symlink: the domain points at this folder,
|
||||
# .htaccess forwards to the active release's public folder and blocks all internal files.
|
||||
active="$(readlink current 2>/dev/null || true)"
|
||||
if [[ -n "$active" ]]; then write_htaccess "$(basename "$active")"; else printf 'Require all denied
|
||||
' > .htaccess; fi
|
||||
echo ".htaccess angelegt (Domain-Ziel: $base)."
|
||||
if [[ -f shared/.env ]]; then echo "shared/.env vorhanden."; else echo "HINWEIS: Bitte $base/shared/.env anlegen (Vorlage: .env.production.example)."; fi
|
||||
echo "PHP: $("$php" -v | head -n 1)"
|
||||
;;
|
||||
receive)
|
||||
release="$1"
|
||||
mkdir -p "releases/$release"
|
||||
tar -xzf "upload-$release.tgz" -C "releases/$release" || { rm -rf "releases/$release" "upload-$release.tgz"; exit 1; }
|
||||
rm -f "upload-$release.tgz"
|
||||
;;
|
||||
cleanup)
|
||||
# Everything except the active release: older releases, leftovers of aborted uploads.
|
||||
active="$(basename "$(readlink current 2>/dev/null || echo none)")"
|
||||
for dir in releases/*; do
|
||||
[[ -d "$dir" && "$(basename "$dir")" != "$active" ]] && rm -rf "$dir" && echo "Entfernt: $dir"
|
||||
done
|
||||
rm -f upload-*.tgz
|
||||
;;
|
||||
activate)
|
||||
release="$1"; dir="releases/$release"
|
||||
[[ -f shared/.env ]] || { echo "shared/.env fehlt – erst anlegen (siehe docs/DEPLOYMENT.md)." >&2; exit 1; }
|
||||
rm -rf "$dir/storage"
|
||||
ln -s ../../shared/storage "$dir/storage"
|
||||
ln -sfn ../../shared/.env "$dir/.env"
|
||||
mkdir -p "$dir/bootstrap/cache"
|
||||
ln -sfn ../storage/app/public "$dir/public/storage"
|
||||
(
|
||||
cd "$dir"
|
||||
"$php" artisan migrate --force --no-interaction
|
||||
"$php" artisan optimize --no-interaction
|
||||
"$php" artisan filament:optimize --no-interaction >/dev/null 2>&1 || true
|
||||
)
|
||||
readlink current > .previous_release 2>/dev/null || true
|
||||
switch_to "$dir"
|
||||
echo "Aktiv: $release"
|
||||
;;
|
||||
rollback)
|
||||
active="$(readlink current 2>/dev/null || true)"
|
||||
target="$(cat .previous_release 2>/dev/null || true)"
|
||||
if [[ -z "$target" || "$target" == "$active" || ! -d "$target" ]]; then
|
||||
target="$(ls -1d releases/* | sort | grep -vx "$active" | tail -n 1 || true)"
|
||||
fi
|
||||
[[ -n "$target" && -d "$target" ]] || { echo "Keine frühere Version mehr auf dem Server – stattdessen einen Deploy-Tag erneut ausliefern (siehe: releases)." >&2; exit 1; }
|
||||
switch_to "$target"
|
||||
echo "$active" > .previous_release
|
||||
echo "Zurückgeschaltet auf: $target (Datenbank-Migrationen werden dabei nicht zurückgenommen)"
|
||||
;;
|
||||
releases)
|
||||
echo "Auf dem Server: $(ls -1 releases | tr '\n' ' ')"
|
||||
echo "Aktiv: $(readlink current 2>/dev/null || echo '–')"
|
||||
;;
|
||||
artisan)
|
||||
cd current
|
||||
"$php" artisan "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Unbekannter Befehl: $cmd" >&2; exit 1
|
||||
;;
|
||||
esac
|
||||
REMOTE
|
||||
}
|
||||
|
||||
run_remote() {
|
||||
if [[ "$DEPLOY_HOST" == "local" ]]; then
|
||||
bash -s -- "$DEPLOY_PATH" "$DEPLOY_PHP" "$@"
|
||||
else
|
||||
local ssh_args=(-p "$DEPLOY_PORT" -o BatchMode=yes -o ServerAliveInterval=30)
|
||||
[[ -n "$DEPLOY_SSH_KEY" ]] && ssh_args+=(-i "$DEPLOY_SSH_KEY")
|
||||
ssh "${ssh_args[@]}" "${DEPLOY_USER:+$DEPLOY_USER@}$DEPLOY_HOST" bash -s -- "$DEPLOY_PATH" "$DEPLOY_PHP" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Runs the remote script (sent via stdin) with the given command.
|
||||
remote() {
|
||||
run_remote "$@" < <(remote_script)
|
||||
}
|
||||
|
||||
# Copies the release archive to <DEPLOY_PATH>/upload-<release>.tgz on the server.
|
||||
upload() {
|
||||
local archive="$1" release="$2"
|
||||
if [[ "$DEPLOY_HOST" == "local" ]]; then
|
||||
mkdir -p "$DEPLOY_PATH"
|
||||
cp "$archive" "$DEPLOY_PATH/upload-$release.tgz"
|
||||
else
|
||||
local ssh_args=(-p "$DEPLOY_PORT" -o BatchMode=yes)
|
||||
[[ -n "$DEPLOY_SSH_KEY" ]] && ssh_args+=(-i "$DEPLOY_SSH_KEY")
|
||||
ssh "${ssh_args[@]}" "${DEPLOY_USER:+$DEPLOY_USER@}$DEPLOY_HOST" "mkdir -p '$DEPLOY_PATH' && cat > '$DEPLOY_PATH/upload-$release.tgz'" < "$archive"
|
||||
fi
|
||||
}
|
||||
|
||||
# Strato limits the number of files per package (inode quota), and every release carries ~19,000 files.
|
||||
# Removes what the application never loads at runtime: translations other than de/en, tests and docs.
|
||||
prune_vendor() {
|
||||
local before
|
||||
before="$(find vendor -type f | wc -l)"
|
||||
find vendor -mindepth 5 -maxdepth 5 -type d -path '*/resources/lang/*' ! -name de ! -name en -exec rm -rf {} +
|
||||
find vendor/nesbot/carbon/src/Carbon/Lang -type f ! -name 'de*' ! -name 'en*' -delete 2>/dev/null || true
|
||||
find vendor -mindepth 3 -maxdepth 3 -type d \( -name tests -o -name docs -o -name .github \) -exec rm -rf {} +
|
||||
find vendor -type f \( -iname '*.md' -o -name 'phpunit.xml*' -o -name '.gitattributes' -o -name '.editorconfig' \) -delete
|
||||
echo "vendor: $before → $(find vendor -type f | wc -l) Dateien"
|
||||
}
|
||||
|
||||
build() {
|
||||
REVISION="$(git -C "$ROOT" rev-parse --verify "$REF^{commit}")" || fail "Unbekannter Git-Stand: $REF"
|
||||
say "Baue Version aus Git-Stand $REF (${REVISION:0:7})"
|
||||
if [[ "$REF" == "HEAD" && -n "$(git -C "$ROOT" status --porcelain)" ]]; then
|
||||
echo "Hinweis: Nicht committete Änderungen werden NICHT ausgeliefert (gebaut wird der letzte Commit)."
|
||||
fi
|
||||
|
||||
BUILD_DIR="$(mktemp -d)"
|
||||
git -C "$ROOT" archive --format=tar "$REVISION" | tar -x -C "$BUILD_DIR"
|
||||
(
|
||||
cd "$BUILD_DIR"
|
||||
$COMPOSER_BIN install --no-dev --prefer-dist --optimize-autoloader --no-interaction --no-progress
|
||||
npm ci --no-audit --no-fund
|
||||
npm run build
|
||||
rm -rf node_modules tests docs styles .gitea .github scripts storage .env.example .env.production.example .ai .claude .cursor AGENTS.md CLAUDE.md boost.json phpunit.xml
|
||||
prune_vendor
|
||||
echo "$REVISION" > REVISION
|
||||
)
|
||||
ARCHIVE="$BUILD_DIR.tgz"
|
||||
tar -czf "$ARCHIVE" -C "$BUILD_DIR" .
|
||||
echo "Paket: $(du -h "$ARCHIVE" | cut -f1)"
|
||||
}
|
||||
|
||||
# Records the live version in Git (and Gitea) – the release history, since the server keeps no old releases.
|
||||
tag_release() {
|
||||
[[ "$DEPLOY_TAG" == "1" ]] || return 0
|
||||
local tag="deploy/$ENVIRONMENT/$1"
|
||||
git -C "$ROOT" -c user.name="${GIT_AUTHOR_NAME:-deploy}" -c user.email="${GIT_AUTHOR_EMAIL:-deploy@localhost}" tag -a "$tag" -m "Deployed to $ENVIRONMENT" "$REVISION" || { echo "Hinweis: Git-Tag $tag konnte nicht angelegt werden."; return 0; }
|
||||
git -C "$ROOT" push -q origin "$tag" 2>/dev/null || git -C "$ROOT" push -q origin "$tag" || echo "Hinweis: Tag $tag nur lokal angelegt – bitte später 'git push origin $tag'."
|
||||
echo "Git-Tag: $tag"
|
||||
}
|
||||
|
||||
health_check() {
|
||||
[[ -n "$DEPLOY_URL" ]] || { echo "Kein DEPLOY_URL gesetzt – Gesundheitscheck übersprungen."; return 0; }
|
||||
# First deployment: the domain does not point to current/public yet.
|
||||
[[ "${SKIP_HEALTH_CHECK:-}" == "1" ]] && { echo "SKIP_HEALTH_CHECK=1 – Gesundheitscheck übersprungen."; return 0; }
|
||||
say "Prüfe $DEPLOY_URL/up"
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if curl -fsS --max-time 15 "$DEPLOY_URL/up" > /dev/null; then
|
||||
echo "Webseite antwortet."
|
||||
return 0
|
||||
fi
|
||||
sleep 3
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
case "$COMMAND" in
|
||||
setup)
|
||||
say "Lege Ordnerstruktur in $DEPLOY_PATH an"
|
||||
remote setup
|
||||
;;
|
||||
deploy)
|
||||
REF="${1:-HEAD}"
|
||||
build
|
||||
RELEASE="$(date -u +%Y%m%d%H%M%S)"
|
||||
say "Räume Server auf (nur die aktive Version bleibt)"
|
||||
remote cleanup
|
||||
say "Übertrage Version $RELEASE"
|
||||
upload "$ARCHIVE" "$RELEASE"
|
||||
remote receive "$RELEASE"
|
||||
say "Migrieren, Caches aufwärmen, umschalten"
|
||||
remote activate "$RELEASE"
|
||||
if ! health_check; then
|
||||
say "Gesundheitscheck fehlgeschlagen – schalte zurück"
|
||||
remote rollback
|
||||
remote cleanup
|
||||
fail "Deployment zurückgerollt. Logs: scripts/deploy.sh $ENVIRONMENT artisan about / shared/storage/logs"
|
||||
fi
|
||||
remote cleanup
|
||||
tag_release "$RELEASE"
|
||||
rm -rf "$BUILD_DIR" "$ARCHIVE"
|
||||
say "Fertig: Version $RELEASE ist live."
|
||||
;;
|
||||
rollback)
|
||||
remote rollback
|
||||
health_check || fail "Auch die vorige Version antwortet nicht – bitte Logs prüfen."
|
||||
;;
|
||||
releases)
|
||||
remote releases
|
||||
echo "Deploy-Tags in Git (neueste zuerst; zurück mit: scripts/deploy.sh $ENVIRONMENT deploy <tag>):"
|
||||
git -C "$ROOT" fetch -q --tags origin 2>/dev/null || true
|
||||
git -C "$ROOT" tag -l "deploy/$ENVIRONMENT/*" --sort=-refname | head -n 10
|
||||
;;
|
||||
artisan)
|
||||
remote artisan "$@"
|
||||
;;
|
||||
*)
|
||||
fail "Unbekannter Befehl: $COMMAND (setup | deploy | rollback | releases | artisan …)"
|
||||
;;
|
||||
esac
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 417 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 304 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 830 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 417 KiB |
@@ -0,0 +1,42 @@
|
||||
# Markenelemente FeWo Stommer
|
||||
|
||||
Stand: 22.10.2026
|
||||
|
||||
## Inhalt
|
||||
|
||||
| Ordner/Datei | Status | Verwendung |
|
||||
|---|---|---|
|
||||
| `ChatGPT-Bild …-1.png` … `-5.png` | **Original-Entwürfe** (KI-generiert, transparent) | Vorlage; nicht direkt auf der Webseite einsetzen (300–850 KB) |
|
||||
| `*.svg` im Ordner `styles/` | automatisch nachgezeichnete Entwürfe | **nicht verwenden:** Löcher/Sprenkel in Flächen, treppige Kanten, Icons sind Ausschnitte mit Resten der Nachbarsymbole, 6–170 KB je Datei |
|
||||
| `final/` | **saubere Fassungen zur Verwendung** | siehe unten |
|
||||
|
||||
## `final/` – freigegebene Fassungen
|
||||
|
||||
| Datei | Größe | Zweck |
|
||||
|---|---|---|
|
||||
| `mark.svg` | 1,4 KB | Bildmarke (Haus, Wellen, Sonne) – Kopfzeile, Fußzeile, Ladeanzeigen |
|
||||
| `logo.svg` | 2,3 KB | Bildmarke + Schriftzug „FeWo Stommer“ + Unterzeile. Der Schriftzug ist SVG-Text mit fester Breite (Schrift: Cormorant Garamond, sonst Georgia); auf der Webseite besser Bildmarke + HTML-Text in der Theme-Schrift |
|
||||
| `logo-600.png` | 87 KB | Logo für E-Mails und das Vertrags-PDF (Mail-Programme zeigen SVG nicht zuverlässig) |
|
||||
| `favicon.svg` | 0,8 KB | Browser-Tab; im Dunkelmodus des Browsers mit hellem Dach |
|
||||
| `apple-touch-icon.png` | 11 KB | Symbol beim „Zum Home-Bildschirm“ (180 × 180) |
|
||||
| `icon-apartment.svg`, `icon-sea.svg`, `icon-terrace.svg`, `icon-location.svg` | je ≈ 1 KB | Symbole für Eckdaten, Ausstattung, Lage |
|
||||
| `wave-divider.svg` | 1,6 KB | Trenner zwischen Abschnitten, Abschluss des Titelbereichs (skaliert auf volle Breite) |
|
||||
| `coastal-illustration-1200.webp` | 85 KB | Illustration „Haus in den Dünen“ – Platzhalter ohne Foto, Fehlerseite, Design-Akzent |
|
||||
|
||||
## Farben
|
||||
|
||||
| Variable | Standard | Bedeutung |
|
||||
|---|---|---|
|
||||
| `--brand-navy` | `#0B2E55` | Dach, Schrift, Symbole |
|
||||
| `--brand-teal` | `#0286A2` | Welle (kräftig) |
|
||||
| `--brand-wave` | `#6DBFC2` | Welle (hell) |
|
||||
| `--brand-sun` | `#F2C27A` | Sonne, Spiegelung, Zierlinien |
|
||||
|
||||
Alle SVGs nutzen diese Variablen mit Standardwert. Als `<img>` eingebunden zeigen sie die Markenfarben. **Inline** in einer Blade-Vorlage eingebunden übernehmen sie Werte, die ein Theme oder Erscheinungsbild setzt, z. B. `--brand-navy: var(--ink)`. So bleibt das Logo im dunklen Silvester-Erscheinungsbild sichtbar.
|
||||
|
||||
## Regeln
|
||||
|
||||
- Keine Verzerrung, keine Schatten oder Effekte; Mindestbreite der Bildmarke 24 px, des Logos mit Schriftzug 160 px.
|
||||
- Schutzraum rund um das Logo: mindestens die Höhe des Dachfensters.
|
||||
- Das Logo ist KI-generiert. Vor einer Anmeldung als Marke die Rechtslage fachkundig prüfen lassen.
|
||||
- Einbau in die Webseite: Logo und Favicon gehören zur **Website** (Admin › Websites), nicht zu einem Theme. Wellenband, Symbole und Illustration gehören ins Theme (siehe `docs/THEME-ERSTELLUNG.md`).
|
||||
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user