Compare commits

..
Author SHA1 Message Date
LarsandClaude Opus 5.5 d42c42059c Titelvideo, Rundgang mit Kapiteln, naechste freie Termine, ruhigere Buchungsseite
- Webseite > Videos (Datei, Standbild, Kapitel mit Raum im Grundriss); Upload bis 100 MB
- Titelbereich: Video statt Foto (stumme Schleife, respektiert Bewegung reduzieren/Save-Data)
  und naechste freie Termine mit Gesamtpreis (NextFreeStays)
- Neuer Baustein Rundgang (Video) mit waehlbarer Anordnung; Grundriss springt ins Video
- Buchungsseite: Preis unter dem Kalender, Formular rechts, Ablauf als Grafik
- Seebad: Fahrkarten, Fahrplan-Kapitel, Sonnenaufgang als einmaliges Ereignis

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 11:01:52 +01:00
Lars f5f18cd984 Erinnerungen und Zusammenfassungen zusammenfuehren
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m4s
2026-10-30 10:11:15 +01:00
LarsandClaude Opus 5.5 1c757f7429 Erinnerungsabstand und taegliche/woechentliche Zusammenfassung einstellbar
System > Betrieb > Benachrichtigungen: offene Meldungen (Doppelbuchungen im
Postfach, Portal-Aufgaben) nur einmal oder alle 1/2/3/7 Tage erneut senden;
Tages- und/oder Wochenuebersicht mit waehlbarer Uhrzeit, Wochentag und Inhalt
(Postfach, Anfragen, Neues, An-/Abreisen, Zahlungen, Portale, Bewertungen).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:11:15 +01:00
Lars 70a39315e2 Postfach und einmalige Doppelbuchungsmeldungen zusammenfuehren
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m58s
2026-10-30 09:52:36 +01:00
57 changed files with 2121 additions and 45 deletions

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ # Ferienwohnung Stommer
- 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 every account. 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`.
- Strato specifics: `public/index.php` strips the internal `/releases/<v>/public` prefix from `REQUEST_URI` (signed URLs); `URL::forceRootUrl(APP_URL)` outside local/testing; mail routing: `App\Support\Settings` (admin page System › Betrieb, stored on the tenant) – test mode (default) sends every mail to the test recipient only, live delivers normally; `FEWO_MAIL_REDIRECT_TO` is a hard override. Landlord data, bank, addresses and periods are columns of `tenants`: `App\Tenancy\TenantConfig` lays them over `config('fewo.*')` and `mail.from` whenever the tenant context changes, so views and mails keep reading the config keys. Send notifications to `Settings::notificationRecipients()` (never `config('fewo.notification_email')` directly). Retention periods and bot-protection counters can only be tightened against the `.env` baseline. The booking form is protected against bots (`config('fewo.spam')`: honeypot, time trap, rate limits, max open holds per e-mail) – tests that submit it instantly set `fewo.spam.min_seconds` to 0.
- Strato specifics: `public/index.php` strips the internal `/releases/<v>/public` prefix from `REQUEST_URI` (signed URLs); `URL::forceRootUrl(APP_URL)` outside local/testing; mail routing: `App\Support\Settings` (admin page System › Betrieb, stored on the tenant) – test mode (default) sends every mail to the test recipient only, live delivers normally; `FEWO_MAIL_REDIRECT_TO` is a hard override. Landlord data, bank, addresses and periods are columns of `tenants`: `App\Tenancy\TenantConfig` lays them over `config('fewo.*')` and `mail.from` whenever the tenant context changes, so views and mails keep reading the config keys. Send notifications to `Settings::notificationRecipients()` (never `config('fewo.notification_email')` directly). Findings detected repeatedly (e.g. by the 5-minute sync) go through `AppSupportInbox` (admin Postfach, fingerprint per tenant, repeated only per the tenant's `reminder_interval_days`), never straight to mail; daily/weekly summaries: `SendDigests` + `DigestReport` (sections `DigestSection`). Retention periods and bot-protection counters can only be tightened against the `.env` baseline. The booking form is protected against bots (`config('fewo.spam')`: honeypot, time trap, rate limits, max open holds per e-mail) – tests that submit it instantly set `fewo.spam.min_seconds` to 0.
- 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`.
+8 -2
View File
@@ -5,18 +5,24 @@
use App\Mail\ChannelTasksNotification;
use App\Models\ChannelTask;
use App\Support\Settings;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Mail;
/**
* Reminds the landlord once about blocking tasks that are still open after the reminder time.
* Reminds the landlord about blocking tasks that are still open after the reminder time, and again after
* the landlord's reminder interval while they stay open (Settings::reminderIntervalDays(), 0 = only once).
*/
class RemindChannelTasks
{
public function handle(): int
{
$interval = Settings::reminderIntervalDays();
$tasks = ChannelTask::query()
->open()
->whereNull('reminded_at')
->where(fn (Builder $query) => $query
->whereNull('reminded_at')
->when($interval > 0, fn (Builder $query) => $query->orWhere('reminded_at', '<=', now()->subDays($interval))))
->where('created_at', '<=', now()->subMinutes(config('fewo.channels.task_reminder_after_minutes')))
->with('channel')
->get();
+10 -6
View File
@@ -14,7 +14,8 @@
/**
* Reports possible double bookings found while importing portal occupations (calendar sync or portal
* e-mail). Every conflict lands in the admin inbox once; only conflicts not reported before are e-mailed,
* so a lasting overlap does not trigger a mail on every sync.
* so a lasting overlap does not trigger a mail on every sync. Unread ones are repeated after the landlord's
* reminder interval while the overlap persists (App\Support\Inbox).
*/
class ReportChannelConflicts
{
@@ -22,11 +23,12 @@ public function __construct(private Inbox $inbox) {}
/**
* @param array<string, CarbonInterface> $conflicts description => first night of the portal occupation
* @return list<string> the conflicts reported for the first time
* @return list<string> the conflicts e-mailed now (new ones and due reminders)
*/
public function handle(Channel $channel, array $conflicts): array
{
$new = [];
$reminders = [];
foreach ($conflicts as $description => $startsOn) {
$message = $this->inbox->post(
InboxMessageKind::ChannelConflict,
@@ -36,15 +38,17 @@ public function handle(Channel $channel, array $conflicts): array
$channel,
OccupancyCalendar::getUrl(['monat' => $startsOn->format('Y-m'), 'wohnung' => $channel->property_id]),
);
if ($message) {
if ($message?->wasRecentlyCreated) {
$new[] = $description;
} elseif ($message) {
$reminders[] = $description;
}
}
if ($new !== []) {
rescue(fn () => Mail::to(Settings::notificationRecipients())->send(new ChannelConflict($channel, $new)));
if ($new !== [] || $reminders !== []) {
rescue(fn () => Mail::to(Settings::notificationRecipients())->send(new ChannelConflict($channel, $new, $reminders)));
}
return $new;
return [...$new, ...$reminders];
}
}
+67
View File
@@ -0,0 +1,67 @@
<?php
namespace App\Actions;
use App\Enums\DigestSection;
use App\Mail\Digest;
use App\Models\Tenant;
use App\Support\DigestReport;
use App\Support\Settings;
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\Mail;
/**
* Sends the landlord's daily and/or weekly summary once the chosen hour has come (System › Betrieb ›
* Benachrichtigungen). On the weekly day only the weekly summary goes out, never both. Runs per landlord
* from the scheduler; the sent dates on the landlord make every summary go out at most once a day.
*/
class SendDigests
{
public function __construct(private DigestReport $report) {}
/**
* @return 'daily'|'weekly'|null which summary was due (also when it was skipped for being empty)
*/
public function handle(Tenant $tenant): ?string
{
$now = CarbonImmutable::now();
$today = $now->startOfDay();
if ($now->hour < $tenant->digest_hour) {
return null;
}
$weekly = $tenant->digest_weekly && $today->isoWeekday() === $tenant->digest_weekday && ! $tenant->digest_weekly_sent_on?->isSameDay($today);
$daily = $tenant->digest_daily && ! $tenant->digest_daily_sent_on?->isSameDay($today);
if (! $weekly && ! $daily) {
return null;
}
$this->send($tenant, $weekly);
$tenant->forceFill([
'digest_daily_sent_on' => $today->toDateString(),
...($weekly ? ['digest_weekly_sent_on' => $today->toDateString()] : []),
])->save();
return $weekly ? 'weekly' : 'daily';
}
/**
* Builds and mails one summary. Without anything to report it is skipped unless the landlord wants it
* anyway or $force is set (button „Zusammenfassung jetzt senden“).
*
* @return bool whether a mail was sent
*/
public function send(Tenant $tenant, bool $weekly, bool $force = false): bool
{
$since = CarbonImmutable::now()->sub($weekly ? '7 days' : '1 day');
$sections = $this->report->build(DigestSection::chosen($tenant->digest_sections), $weekly, $since);
if ($sections === [] && ! $tenant->digest_when_empty && ! $force) {
return false;
}
Mail::to(Settings::notificationRecipients())->send(new Digest($weekly, $sections));
return true;
}
}
+103
View File
@@ -0,0 +1,103 @@
<?php
namespace App\Availability;
use App\Models\Property;
use App\Pricing\PriceCalculator;
use App\Pricing\PriceQuote;
use App\Pricing\QuoteException;
use App\Pricing\StayRequest;
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\Cache;
/**
* The next bookable stays from tomorrow on, for the "next free dates" in the hero section: free nights
* that the PriceCalculator accepts (minimum stay, offers applied), at least $nights long, not overlapping.
* Cached briefly per apartment because each candidate is a full price calculation (dates as strings: the cache
* does not unserialize objects).
*/
class NextFreeStays
{
public const HORIZON_DAYS = 120;
public const MAX_NIGHTS = 7;
public function __construct(
private AvailabilityChecker $availability,
private PriceCalculator $calculator,
) {}
/**
* @return list<array{arrival: CarbonImmutable, departure: CarbonImmutable, nights: int, total: int, url: string}>
*/
public function for(Property $property, int $count = 3, int $nights = 3, int $guests = 2): array
{
$key = "next-free-stays:{$property->id}:{$count}:{$nights}:{$guests}:".today()->toDateString();
$stays = Cache::remember($key, now()->addMinutes(10), fn (): array => $this->find($property, $count, $nights, min($guests, $property->max_guests)));
return array_map(fn (array $stay): array => [
...$stay,
'arrival' => CarbonImmutable::parse($stay['arrival']),
'departure' => CarbonImmutable::parse($stay['departure']),
], $stays);
}
/**
* @return list<array{arrival: string, departure: string, nights: int, total: int, url: string}>
*/
private function find(Property $property, int $count, int $nights, int $guests): array
{
$from = CarbonImmutable::tomorrow();
$until = $from->addDays(self::HORIZON_DAYS + self::MAX_NIGHTS);
$occupied = $this->availability->occupiedNights($property, $from, $until);
$stays = [];
for ($arrival = $from; count($stays) < $count && $arrival->lessThan($from->addDays(self::HORIZON_DAYS)); $arrival = $arrival->addDay()) {
if (isset($occupied[$arrival->toDateString()])) {
continue;
}
$quote = $this->firstPricedStay($property, $arrival, $nights, $guests, $occupied);
if ($quote === null) {
continue;
}
$stays[] = [
'arrival' => $quote->arrival->toDateString(),
'departure' => $quote->departure->toDateString(),
'nights' => $quote->nights(),
'total' => $quote->total(),
'url' => route('booking.create', ['anreise' => $quote->arrival->toDateString(), 'abreise' => $quote->departure->toDateString(), 'personen' => $guests]),
];
$arrival = $quote->departure->subDay();
}
return $stays;
}
/**
* The shortest stay of at least $nights from $arrival that is free and priceable, if any.
*
* @param array<string, true> $occupied
*/
private function firstPricedStay(Property $property, CarbonImmutable $arrival, int $nights, int $guests, array $occupied): ?PriceQuote
{
for ($length = 1; $length <= self::MAX_NIGHTS; $length++) {
if (isset($occupied[$arrival->addDays($length - 1)->toDateString()])) {
return null;
}
if ($length < $nights) {
continue;
}
try {
return $this->calculator->calculate($property, new StayRequest($arrival, $arrival->addDays($length), $guests));
} catch (QuoteException) {
continue;
}
}
return null;
}
}
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Enums;
use Filament\Support\Contracts\HasDescription;
use Filament\Support\Contracts\HasLabel;
/**
* The parts of the daily/weekly summary a landlord can choose (System › Betrieb › Benachrichtigungen).
*/
enum DigestSection: string implements HasDescription, HasLabel
{
case Inbox = 'inbox';
case Requests = 'requests';
case News = 'news';
case Stays = 'stays';
case Payments = 'payments';
case Portals = 'portals';
case Reviews = 'reviews';
public function getLabel(): string
{
return match ($this) {
self::Inbox => 'Postfach',
self::Requests => 'Offene Anfragen und Angebote',
self::News => 'Neu seit der letzten Übersicht',
self::Stays => 'An- und Abreisen',
self::Payments => 'Überfällige Zahlungen',
self::Portals => 'Portale: Aufgaben und Klärungsfälle',
self::Reviews => 'Bewertungen zur Freigabe',
};
}
public function getDescription(): string
{
return match ($this) {
self::Inbox => 'Ungelesene Meldungen, z. B. mögliche Doppelbuchungen',
self::Requests => 'Anfragen und Angebote, die auf Sie oder den Gast warten, mit Frist',
self::News => 'Neue Anfragen, Buchungen, Stornierungen und Portalbuchungen',
self::Stays => 'Heute und morgen, in der Wochenübersicht die nächsten 7 Tage',
self::Payments => 'Anzahlungen und Restzahlungen nach Fälligkeit',
self::Portals => 'Offene Portal-Aufgaben, zu prüfende Portal-Mails und Kalendereinträge, Abgleichsfehler',
self::Reviews => 'Neue Bewertungen, die noch nicht freigegeben sind',
};
}
/**
* @param list<string>|null $values stored choice; null = everything
* @return list<self>
*/
public static function chosen(?array $values): array
{
return $values === null ? self::cases() : array_values(array_filter(self::cases(), fn (self $section): bool => in_array($section->value, $values, true)));
}
}
+84 -1
View File
@@ -2,6 +2,8 @@
namespace App\Filament\Pages;
use App\Actions\SendDigests;
use App\Enums\DigestSection;
use App\Enums\TenantServiceKey;
use App\Enums\UserRole;
use App\Filament\Concerns\FollowsAdminMode;
@@ -11,10 +13,12 @@
use App\Tenancy\TenantFeatures;
use BackedEnum;
use Filament\Actions\Action;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TagsInput;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
use Filament\Schemas\Components\Actions;
@@ -30,7 +34,7 @@
/**
* Operating data of the landlord: operating mode (test mode sends every e-mail to one test recipient only;
* live delivers to the real recipients), the addresses of the internal communication, the landlord's own
* address and bank details, and the periods. Administrators only.
* address and bank details, reminders and summaries, and the periods. Administrators only.
*/
class Operations extends Page
{
@@ -53,6 +57,11 @@ class Operations extends Page
'channel_task_reminder_after_minutes' => 'Erinnerung an Portal-Aufgaben nach (Minuten)',
];
/** Choices for repeating open findings (days => label). */
public const REMINDER_INTERVALS = [0 => 'Nur einmal', 1 => 'Täglich', 2 => 'Alle 2 Tage', 3 => 'Alle 3 Tage', 7 => 'Wöchentlich'];
public const WEEKDAYS = [1 => 'Montag', 2 => 'Dienstag', 3 => 'Mittwoch', 4 => 'Donnerstag', 5 => 'Freitag', 6 => 'Samstag', 7 => 'Sonntag'];
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPower;
protected static string|UnitEnum|null $navigationGroup = 'System';
@@ -99,6 +108,13 @@ public function mount(): void
'mailbox_password' => $tenant->mailbox_password,
'mailbox_encryption' => $tenant->mailbox_encryption,
'mailbox_folder' => $tenant->mailbox_folder,
'reminder_interval_days' => $tenant->reminder_interval_days,
'digest_daily' => $tenant->digest_daily,
'digest_weekly' => $tenant->digest_weekly,
'digest_weekday' => $tenant->digest_weekday,
'digest_hour' => $tenant->digest_hour,
'digest_sections' => array_map(fn (DigestSection $section): string => $section->value, DigestSection::chosen($tenant->digest_sections)),
'digest_when_empty' => $tenant->digest_when_empty,
...$this->periodValues($tenant),
]);
}
@@ -181,6 +197,43 @@ public function form(Schema $schema): Schema
->maxLength(255)
->columnSpanFull(),
]),
Section::make('Benachrichtigungen')
->description('Wie oft offene Meldungen wiederholt werden und welche Zusammenfassungen Sie per E-Mail erhalten. Empfänger sind die Adressen unter „Benachrichtigungen an“.')
->columns(2)
->schema([
Select::make('reminder_interval_days')
->label('Offene Meldungen erneut senden')
->helperText('Gilt für mögliche Doppelbuchungen (solange sie im Postfach ungelesen sind und weiter bestehen) und offene Portal-Aufgaben.')
->options(self::REMINDER_INTERVALS)
->selectablePlaceholder(false)
->required()
->columnSpanFull(),
Toggle::make('digest_daily')->label('Tägliche Zusammenfassung'),
Toggle::make('digest_weekly')->label('Wöchentliche Zusammenfassung')->live(),
Select::make('digest_hour')
->label('Versand ab')
->options(collect(range(5, 21))->mapWithKeys(fn (int $hour): array => [$hour => sprintf('%02d:00 Uhr', $hour)])->all())
->selectablePlaceholder(false)
->required(),
Select::make('digest_weekday')
->label('Wochentag der Wochenübersicht')
->helperText('An diesem Tag kommt nur die Wochenübersicht, nicht zusätzlich die tägliche.')
->options(self::WEEKDAYS)
->selectablePlaceholder(false)
->visible(fn (Get $get): bool => (bool) $get('digest_weekly'))
->required(),
CheckboxList::make('digest_sections')
->label('Inhalt der Zusammenfassung')
->options(DigestSection::class)
->descriptions(collect(DigestSection::cases())->mapWithKeys(fn (DigestSection $section): array => [$section->value => $section->getDescription()])->all())
->columns(2)
->required()
->columnSpanFull(),
Toggle::make('digest_when_empty')
->label('Auch senden, wenn nichts ansteht')
->helperText('Sonst entfällt die Zusammenfassung an Tagen ohne offene Punkte.')
->columnSpanFull(),
]),
Section::make('Portal-Postfach')
->description('Aus diesem Postfach werden die Buchungsmails der Portale gelesen, damit ein Termin sofort gesperrt wird. Leerer Server = ausgeschaltet. Das Passwort liegt verschlüsselt in der Datenbank.')
->columns(2)
@@ -215,6 +268,29 @@ public function content(Schema $schema): Schema
]);
}
protected function getHeaderActions(): array
{
return [
Action::make('sendDigest')
->label('Zusammenfassung jetzt senden')
->icon(Heroicon::OutlinedPaperAirplane)
->color('gray')
->modalDescription('Schickt die Zusammenfassung mit den gespeicherten Einstellungen sofort an die Benachrichtigungsadressen – auch wenn nichts ansteht. Der reguläre Versand bleibt unverändert.')
->schema([
Radio::make('weekly')
->label('Welche?')
->options([0 => 'Tagesübersicht', 1 => 'Wochenübersicht'])
->default(0)
->required(),
])
->action(function (array $data): void {
app(SendDigests::class)->send($this->tenant(), (bool) $data['weekly'], force: true);
Notification::make()->title('Zusammenfassung gesendet')->body(Settings::isLive() ? null : 'Testbetrieb: Sie geht an die Testadresse.')->success()->send();
}),
];
}
public function save(): void
{
$data = $this->form->getState();
@@ -243,6 +319,13 @@ public function save(): void
'mailbox_password' => $data['mailbox_password'] ?? null,
'mailbox_encryption' => $data['mailbox_encryption'] ?? null,
'mailbox_folder' => $data['mailbox_folder'] ?? null,
'reminder_interval_days' => (int) $data['reminder_interval_days'],
'digest_daily' => (bool) $data['digest_daily'],
'digest_weekly' => (bool) $data['digest_weekly'],
'digest_weekday' => (int) ($data['digest_weekday'] ?? $tenant->digest_weekday),
'digest_hour' => (int) $data['digest_hour'],
'digest_sections' => count($data['digest_sections']) === count(DigestSection::cases()) ? null : array_values($data['digest_sections']),
'digest_when_empty' => (bool) $data['digest_when_empty'],
...array_map(fn (mixed $value): ?int => filled($value) ? (int) $value : null, $this->periodInput($data)),
]);
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Videos\Pages;
use App\Filament\Resources\Videos\VideoResource;
use Filament\Resources\Pages\CreateRecord;
class CreateVideo extends CreateRecord
{
protected static string $resource = VideoResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Videos\Pages;
use App\Filament\Resources\Videos\VideoResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditVideo extends EditRecord
{
protected static string $resource = VideoResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Filament\Resources\Videos\Pages;
use App\Filament\Concerns\ListsCurrentProperty;
use App\Filament\Resources\Videos\VideoResource;
use App\Models\Property;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;
class ListVideos extends ListRecords
{
use ListsCurrentProperty;
protected static string $resource = VideoResource::class;
/**
* Videos of the chosen apartment and those without one (e.g. the area).
*/
protected function scopeToProperty(Builder $query, Property $property): Builder
{
return $query->where(fn (Builder $query) => $query->where('property_id', $property->id)->orWhereNull('property_id'));
}
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}
@@ -0,0 +1,101 @@
<?php
namespace App\Filament\Resources\Videos\Schemas;
use App\Models\FloorPlan;
use App\Models\Property;
use App\Models\Video;
use App\Support\CurrentProperty;
use Closure;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
class VideoForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(2)
->components([
SpatieMediaLibraryFileUpload::make('file')
->label('Videodatei')
->collection(Video::COLLECTION)
->disk('public')
->acceptedFileTypes(['video/mp4', 'application/mp4', 'video/webm'])
->maxSize(Video::MAX_KB)
->helperText('MP4 (H.264) oder WebM bis 100 MB. Für den Titelbereich reicht eine kurze stumme Schleife von 6–10 Sekunden und 2–4 MB – sie lädt auf jedem Handy mit.')
->required()
->columnSpanFull(),
SpatieMediaLibraryFileUpload::make('poster')
->label('Standbild')
->collection(Video::POSTER)
->disk('public')
->image()
->maxSize(25 * 1024)
->helperText('Wird gezeigt, bis das Video läuft, und statt des Videos, wenn Besucher „Bewegung reduzieren“ eingestellt haben. Am besten ein Bild aus dem Video.')
->required()
->columnSpanFull(),
TextInput::make('title')
->label('Titel')
->helperText('Für Sie zur Auswahl in den Bausteinen und für Screenreader („Video: …“).')
->required()
->maxLength(160),
Select::make('property_id')
->label('Wohnung')
->options(fn (): array => Property::query()->pluck('name', 'id')->all())
->default(fn (): ?int => app(CurrentProperty::class)->id())
->placeholder('– keine (z. B. Umgebung) –')
->live(),
Section::make('Kapitel')
->description('Für den Rundgang: Besucher springen per Knopf zu einem Raum. Ist ein Raum aus dem Grundriss gewählt, bietet der Grundriss bei diesem Raum „Im Video ansehen“ an.')
->collapsible()
->columnSpanFull()
->schema([
Repeater::make('chapters')
->hiddenLabel()
->addActionLabel('Kapitel hinzufügen')
->columns(3)
->defaultItems(0)
->reorderable(false)
->itemLabel(fn (array $state): ?string => trim(($state['at'] ?? '').' '.($state['label'] ?? '')) ?: null)
->schema([
TextInput::make('at')
->label('Ab (Min:Sek)')
->placeholder('0:16')
->required()
->rules([fn (): Closure => function (string $attribute, mixed $value, Closure $fail): void {
if (Video::seconds($value) === null) {
$fail('Bitte als Minuten:Sekunden angeben, z. B. 0:16 oder 1:05.');
}
}]),
TextInput::make('label')
->label('Bezeichnung')
->placeholder('Wohnzimmer')
->required()
->maxLength(60),
Select::make('room')
->label('Raum im Grundriss')
->options(fn (Get $get): array => self::roomOptions($get('../../property_id')))
->placeholder('– keiner –'),
]),
]),
]);
}
/**
* Names of the visible floor plan rooms of the apartment (name => name).
*
* @return array<string, string>
*/
public static function roomOptions(mixed $propertyId): array
{
$plan = filled($propertyId) ? FloorPlan::query()->where('property_id', $propertyId)->first() : null;
return $plan?->visibleRooms()->pluck('name', 'name')->all() ?? [];
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Filament\Resources\Videos\Tables;
use App\Models\Video;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\SpatieMediaLibraryImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class VideosTable
{
public static function configure(Table $table): Table
{
return $table
->defaultSort('title')
->emptyStateHeading('Noch keine Videos')
->emptyStateDescription('Laden Sie ein Video hoch und wählen Sie es danach im Titelbereich oder im Baustein „Rundgang (Video)“ aus.')
->columns([
SpatieMediaLibraryImageColumn::make('poster')
->label('')
->collection(Video::POSTER)
->conversion('poster')
->imageHeight(64),
TextColumn::make('title')->label('Titel')->searchable()->weight('medium'),
TextColumn::make('property.name')->label('Wohnung')->placeholder('–'),
TextColumn::make('chapters')
->label('Kapitel')
->state(fn (Video $record): string => (string) count($record->chapterList())),
TextColumn::make('size')
->label('Größe')
->state(fn (Video $record): ?string => $record->getFirstMedia(Video::COLLECTION)?->human_readable_size),
])
->recordActions([
EditAction::make(),
DeleteAction::make(),
]);
}
}
@@ -0,0 +1,57 @@
<?php
namespace App\Filament\Resources\Videos;
use App\Filament\Concerns\FollowsAdminMode;
use App\Filament\Concerns\SelectsRecordProperty;
use App\Filament\Resources\Videos\Pages\CreateVideo;
use App\Filament\Resources\Videos\Pages\EditVideo;
use App\Filament\Resources\Videos\Pages\ListVideos;
use App\Filament\Resources\Videos\Schemas\VideoForm;
use App\Filament\Resources\Videos\Tables\VideosTable;
use App\Models\Video;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
/**
* Website videos: chosen in the hero section (silent loop) and in the tour section (with chapters).
*/
class VideoResource extends Resource
{
use FollowsAdminMode, SelectsRecordProperty;
protected static ?string $model = Video::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedFilm;
protected static string|UnitEnum|null $navigationGroup = 'Webseite';
protected static ?string $modelLabel = 'Video';
protected static ?string $pluralModelLabel = 'Videos';
protected static ?int $navigationSort = 3;
public static function form(Schema $schema): Schema
{
return VideoForm::configure($schema);
}
public static function table(Table $table): Table
{
return VideosTable::configure($table);
}
public static function getPages(): array
{
return [
'index' => ListVideos::route('/'),
'create' => CreateVideo::route('/create'),
'edit' => EditVideo::route('/{record}/edit'),
];
}
}
+8 -4
View File
@@ -10,19 +10,23 @@
use Illuminate\Queue\SerializesModels;
/**
* Reports overlaps between a newly imported portal occupation and occupations from elsewhere.
* Reports overlaps between an imported portal occupation and occupations from elsewhere: new ones and
* reminders about ones that are still open.
*/
class ChannelConflict extends Mailable
{
use Queueable, SerializesModels;
/** @param list<string> $conflicts */
public function __construct(public Channel $channel, public array $conflicts) {}
/**
* @param list<string> $conflicts reported for the first time
* @param list<string> $reminders reported before, still unread and still detected
*/
public function __construct(public Channel $channel, public array $conflicts, public array $reminders = []) {}
public function envelope(): Envelope
{
return new Envelope(
subject: 'Achtung: mögliche Doppelbuchung über '.$this->channel->name,
subject: ($this->conflicts === [] ? 'Erinnerung' : 'Achtung').': mögliche Doppelbuchung über '.$this->channel->name,
);
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Mail;
use App\Enums\DigestSection;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
/**
* The landlord's daily or weekly summary of open points and news (SendDigests, DigestReport).
*/
class Digest extends Mailable
{
use Queueable, SerializesModels;
/**
* @param list<array{section: DigestSection, title: string, items: list<string>, more: int, url: string, link: string}> $sections
*/
public function __construct(public bool $weekly, public array $sections) {}
public function envelope(): Envelope
{
$title = $this->weekly ? 'Wochenübersicht KW '.now()->isoWeek() : 'Tagesübersicht '.now()->format('d.m.Y');
$count = array_sum(array_map(fn (array $section): int => count($section['items']) + $section['more'], $this->sections));
return new Envelope(
subject: $title.($count === 0 ? ': nichts Neues' : ": {$count} ".($count === 1 ? 'Punkt' : 'Punkte')),
);
}
public function content(): Content
{
return new Content(
markdown: 'mail.digest',
);
}
}
+3 -1
View File
@@ -16,7 +16,7 @@
* A message in the admin inbox ("Postfach"). The fingerprint identifies the finding, so the same
* finding is posted – and e-mailed – only once per landlord (App\Support\Inbox).
*/
#[Fillable(['property_id', 'channel_id', 'kind', 'fingerprint', 'subject', 'body', 'action_url', 'read_at'])]
#[Fillable(['property_id', 'channel_id', 'kind', 'fingerprint', 'subject', 'body', 'action_url', 'notified_at', 'last_seen_at', 'read_at'])]
class InboxMessage extends Model
{
/** @use HasFactory<InboxMessageFactory> */
@@ -31,6 +31,8 @@ protected function casts(): array
{
return [
'kind' => InboxMessageKind::class,
'notified_at' => 'immutable_datetime',
'last_seen_at' => 'immutable_datetime',
'read_at' => 'immutable_datetime',
];
}
+21
View File
@@ -26,12 +26,24 @@
'retention_portal_email_excerpt_days', 'retention_attribution_months',
'spam_min_seconds', 'spam_per_ip_per_hour', 'spam_per_email_per_day', 'spam_open_requests_per_email', 'spam_max_links',
'channel_stale_after_minutes', 'channel_task_reminder_after_minutes',
'reminder_interval_days', 'digest_daily', 'digest_weekly', 'digest_weekday', 'digest_hour', 'digest_sections',
'digest_when_empty', 'digest_daily_sent_on', 'digest_weekly_sent_on',
])]
class Tenant extends Model
{
/** @use HasFactory<TenantFactory> */
use HasFactory;
/** Reminder and summary defaults: repeat nothing, a daily summary from 7 a.m., the weekly one on Mondays. */
protected $attributes = [
'reminder_interval_days' => 0,
'digest_daily' => true,
'digest_weekly' => false,
'digest_weekday' => 1,
'digest_hour' => 7,
'digest_when_empty' => false,
];
/**
* The landlord the existing single-website data belongs to.
*/
@@ -56,6 +68,15 @@ protected function casts(): array
'bank_name' => 'encrypted',
'tax_note' => 'encrypted',
'mailbox_password' => 'encrypted',
'reminder_interval_days' => 'integer',
'digest_daily' => 'boolean',
'digest_weekly' => 'boolean',
'digest_weekday' => 'integer',
'digest_hour' => 'integer',
'digest_sections' => 'array',
'digest_when_empty' => 'boolean',
'digest_daily_sent_on' => 'immutable_date',
'digest_weekly_sent_on' => 'immutable_date',
];
}
+146
View File
@@ -0,0 +1,146 @@
<?php
namespace App\Models;
use App\Models\Concerns\BelongsToTenant;
use Database\Factories\VideoFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Spatie\Image\Enums\Fit;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
/**
* A website video: a short silent loop for the hero section or a tour with chapters (TourSection).
* Chapters link a moment to a floor plan room by its name, so the floor plan can jump into the video.
*
* @property list<array{at?: string, label?: string, room?: string|null}>|null $chapters
*/
#[Fillable(['property_id', 'title', 'chapters'])]
class Video extends Model implements HasMedia
{
/** @use HasFactory<VideoFactory> */
use BelongsToTenant, HasFactory, InteractsWithMedia;
public const COLLECTION = 'video';
public const POSTER = 'poster';
/** Largest accepted video file in KB (Strato allows uploads up to 128 MB). */
public const MAX_KB = 100 * 1024;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'chapters' => 'array',
];
}
public function registerMediaCollections(): void
{
$this->addMediaCollection(self::COLLECTION)
->useDisk('public')
->singleFile()
->acceptsMimeTypes(['video/mp4', 'application/mp4', 'video/webm']);
$this->addMediaCollection(self::POSTER)
->useDisk('public')
->singleFile()
->acceptsMimeTypes(['image/jpeg', 'image/png', 'image/webp']);
}
public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('poster')
->fit(Fit::Max, 1920, 1920)
->format('webp')
->quality(80)
->performOnCollections(self::POSTER);
}
/**
* @return BelongsTo<Property, $this>
*/
public function property(): BelongsTo
{
return $this->belongsTo(Property::class);
}
public function url(): ?string
{
return $this->getFirstMediaUrl(self::COLLECTION) ?: null;
}
public function mimeType(): string
{
return $this->getFirstMedia(self::COLLECTION)?->mime_type ?? 'video/mp4';
}
public function posterUrl(): ?string
{
return $this->getFirstMediaUrl(self::POSTER, 'poster') ?: null;
}
/**
* Chapters in time order with the start in seconds; entries without a valid time or label are left out.
*
* @return list<array{seconds: int, time: string, label: string, room: string|null}>
*/
public function chapterList(): array
{
$chapters = [];
foreach ($this->chapters ?? [] as $chapter) {
$seconds = self::seconds($chapter['at'] ?? null);
if ($seconds === null || blank($chapter['label'] ?? null)) {
continue;
}
$chapters[] = [
'seconds' => $seconds,
'time' => sprintf('%d:%02d', intdiv($seconds, 60), $seconds % 60),
'label' => (string) $chapter['label'],
'room' => filled($chapter['room'] ?? null) ? (string) $chapter['room'] : null,
];
}
usort($chapters, fn (array $a, array $b): int => $a['seconds'] <=> $b['seconds']);
return $chapters;
}
/**
* The chapter showing a floor plan room (matched by name), if any.
*
* @return array{seconds: int, time: string, label: string, room: string|null}|null
*/
public function chapterForRoom(string $room): ?array
{
foreach ($this->chapterList() as $chapter) {
if ($chapter['room'] !== null && mb_strtolower($chapter['room']) === mb_strtolower($room)) {
return $chapter;
}
}
return null;
}
/**
* "1:05" or "65" → 65; anything else → null.
*/
public static function seconds(mixed $value): ?int
{
$value = trim((string) $value);
if (preg_match('/^(\d{1,3}):([0-5]\d)$/', $value, $match)) {
return (int) $match[1] * 60 + (int) $match[2];
}
return preg_match('/^\d{1,4}$/', $value) ? (int) $value : null;
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Policies;
use App\Enums\Permission;
class VideoPolicy extends RolePolicy
{
protected function permission(): Permission
{
return Permission::Content;
}
}
+218
View File
@@ -0,0 +1,218 @@
<?php
namespace App\Support;
use App\Enums\BookingStatus;
use App\Enums\DigestSection;
use App\Enums\PortalEmailStatus;
use App\Enums\ReviewStatus;
use App\Filament\Pages\OccupancyCalendar;
use App\Filament\Resources\Bookings\BookingResource;
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
use App\Filament\Resources\InboxMessages\InboxMessageResource;
use App\Filament\Resources\PortalOccupations\PortalOccupationResource;
use App\Filament\Resources\Reviews\ReviewResource;
use App\Models\BlockedPeriod;
use App\Models\Booking;
use App\Models\Channel;
use App\Models\ChannelTask;
use App\Models\InboxMessage;
use App\Models\PortalEmail;
use App\Models\Property;
use App\Models\Review;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
/**
* Collects what the landlord should know for the daily or weekly summary (SendDigests). Each section lists
* at most MAX_ITEMS lines and says how many more there are; empty sections are left out. Lines are Markdown
* with HTML-escaped data, so the mail renders them unescaped.
*/
class DigestReport
{
public const MAX_ITEMS = 10;
private bool $namesProperty = false;
/**
* @param list<DigestSection> $sections
* @return list<array{section: DigestSection, title: string, items: list<string>, more: int, url: string, link: string}>
*/
public function build(array $sections, bool $weekly, CarbonImmutable $since): array
{
$this->namesProperty = Property::query()->count() > 1;
$report = [];
foreach ($sections as $section) {
[$title, $lines, $url, $link] = match ($section) {
DigestSection::Inbox => ['Postfach: ungelesene Meldungen', $this->inbox(), InboxMessageResource::getUrl('index'), 'Postfach öffnen'],
DigestSection::Requests => ['Offene Anfragen und Angebote', $this->requests(), BookingResource::getUrl('index'), 'Buchungen öffnen'],
DigestSection::News => ['Neu seit '.$since->format('d.m. H:i').' Uhr', $this->news($since), BookingResource::getUrl('index'), 'Buchungen öffnen'],
DigestSection::Stays => [$weekly ? 'An- und Abreisen der nächsten 7 Tage' : 'An- und Abreisen heute und morgen', $this->stays($weekly ? 7 : 2), OccupancyCalendar::getUrl(), 'Belegungsplan öffnen'],
DigestSection::Payments => ['Überfällige Zahlungen', $this->payments(), BookingResource::getUrl('index'), 'Buchungen öffnen'],
DigestSection::Portals => ['Portale: Aufgaben und Klärungsfälle', $this->portals(), ChannelTaskResource::getUrl('index'), 'Portal-Aufgaben öffnen'],
DigestSection::Reviews => ['Bewertungen zur Freigabe', $this->reviews(), ReviewResource::getUrl('index'), 'Bewertungen öffnen'],
};
if ($lines->isEmpty()) {
continue;
}
$report[] = [
'section' => $section,
'title' => $title,
'items' => $lines->take(self::MAX_ITEMS)->values()->all(),
'more' => max(0, $lines->count() - self::MAX_ITEMS),
'url' => $url,
'link' => $link,
];
}
return $report;
}
/**
* @return Collection<int, string>
*/
private function inbox(): Collection
{
return InboxMessage::query()->unread()->latest()->get()
->map(fn (InboxMessage $message): string => $message->created_at->format('d.m.').' · '.e($message->subject).': '.e($message->body));
}
/**
* @return Collection<int, string>
*/
private function requests(): Collection
{
return Booking::query()->whereIn('status', BookingStatus::holding())->with(['guest', 'property'])->orderBy('hold_expires_at')->get()
->map(fn (Booking $booking): string => $this->booking($booking).' – '.$booking->status->getLabel().$this->deadline($booking));
}
/**
* @return Collection<int, string>
*/
private function news(CarbonImmutable $since): Collection
{
$created = Booking::query()->where('created_at', '>=', $since)->with(['guest', 'property'])->oldest()->get()
->map(fn (Booking $booking): string => 'Neu: '.$this->booking($booking).' – '.$booking->status->getLabel());
$cancelled = Booking::query()->where('status', BookingStatus::Cancelled)->where('created_at', '<', $since)->where('updated_at', '>=', $since)->with(['guest', 'property'])->get()
->map(fn (Booking $booking): string => 'Storniert: '.$this->booking($booking));
$portal = BlockedPeriod::query()->reservations()->occupying()->where('created_at', '>=', $since)->with(['channel', 'originChannel', 'guest'])->oldest()->get()
->map(fn (BlockedPeriod $block): string => 'Portalbuchung '.e($block->bookingChannelLabel()).': '.$this->period($block->starts_on, $block->ends_on).($block->guestName() ? ', '.e($block->guestName()) : ''));
return $created->concat($cancelled)->concat($portal)->values();
}
/**
* Arrivals and departures from today on, $days days long, sorted by day (departures first).
*
* @return Collection<int, string>
*/
private function stays(int $days): Collection
{
$from = CarbonImmutable::today();
$last = $from->addDays($days - 1);
$within = fn (string $start, string $end) => fn (Builder $query) => $query
->where(fn (Builder $query) => $query->whereDate($start, '>=', $from)->whereDate($start, '<=', $last))
->orWhere(fn (Builder $query) => $query->whereDate($end, '>=', $from)->whereDate($end, '<=', $last));
$events = [];
foreach (Booking::query()->whereIn('status', BookingStatus::occupying())->where($within('arrival', 'departure'))->with(['guest', 'property'])->get() as $booking) {
$this->stayEvents($events, $from, $last, $booking->arrival, $booking->departure, $this->booking($booking));
}
foreach (BlockedPeriod::query()->reservations()->occupying()->where($within('starts_on', 'ends_on'))->with(['channel', 'originChannel', 'guest'])->get() as $block) {
$this->stayEvents($events, $from, $last, $block->starts_on, $block->ends_on, e(trim($block->bookingChannelLabel().' '.($block->guestName() ?? ''))));
}
ksort($events);
return collect(array_values($events));
}
/**
* @param array<string, string> $events
*/
private function stayEvents(array &$events, CarbonImmutable $from, CarbonImmutable $last, CarbonImmutable $arrival, CarbonImmutable $departure, string $label): void
{
if ($departure->betweenIncluded($from, $last)) {
$events[$departure->toDateString().'-0-'.count($events)] = $this->day($departure).': Abreise '.$label;
}
if ($arrival->betweenIncluded($from, $last)) {
$events[$arrival->toDateString().'-1-'.count($events)] = $this->day($arrival).': Anreise '.$label.' (bis '.$departure->format('d.m.').')';
}
}
/**
* @return Collection<int, string>
*/
private function payments(): Collection
{
return Booking::query()->whereIn('status', [BookingStatus::Confirmed, BookingStatus::DepositPaid])->with(['guest', 'property', 'payments'])->orderBy('arrival')->get()
->map(fn (Booking $booking): ?string => match (true) {
$booking->status === BookingStatus::Confirmed && $booking->deposit_due_on?->isPast() && $booking->openDeposit() > 0 => $this->booking($booking).' – Anzahlung '.Money::format($booking->openDeposit()).' seit '.$booking->deposit_due_on->format('d.m.').' fällig',
$booking->balance_due_on?->isPast() && $booking->openAmount() > 0 => $this->booking($booking).' – offen '.Money::format($booking->openAmount()).' seit '.$booking->balance_due_on->format('d.m.').' fällig',
default => null,
})
->filter()
->values();
}
/**
* @return Collection<int, string>
*/
private function portals(): Collection
{
$tasks = ChannelTask::query()->open()->with('channel')->oldest()->get()
->map(fn (ChannelTask $task): string => 'Aufgabe '.e($task->channel->name).': '.$task->action->getLabel().' '.$task->period());
$mails = PortalEmail::query()->where('status', PortalEmailStatus::NeedsReview)->with('channel')->latest('received_at')->get()
->map(fn (PortalEmail $mail): string => 'Portal-Mail prüfen ('.e($mail->channel->name).'): '.e($mail->subject));
$unclear = BlockedPeriod::query()->unclear()->whereDate('ends_on', '>', today())->with('channel')->orderBy('starts_on')->get()
->map(fn (BlockedPeriod $block): string => 'Kalendereintrag klären ('.e($block->channel->name ?? 'Portal').'): '.$this->period($block->starts_on, $block->ends_on)
.' · [ansehen]('.PortalOccupationResource::getUrl('view', ['record' => $block->id]).')');
$channels = Channel::query()->active()->get()->filter(fn (Channel $channel): bool => $channel->isStale() || filled($channel->last_error))
->map(fn (Channel $channel): string => 'Kalenderabgleich '.e($channel->name).': '.e($channel->last_error ?: 'seit längerem kein erfolgreicher Abruf'));
return $tasks->concat($mails)->concat($unclear)->concat($channels)->values();
}
/**
* @return Collection<int, string>
*/
private function reviews(): Collection
{
return Review::query()->where('status', ReviewStatus::Pending)->oldest()->get()
->map(fn (Review $review): string => $review->rating.'/5'.($review->title ? ' „'.e($review->title).'“' : '').($review->display_name ? ' von '.e($review->display_name) : ''));
}
private function booking(Booking $booking): string
{
return '['.$booking->reference.']('.BookingResource::getUrl('view', ['record' => $booking]).') '
.e($booking->guest?->full_name ?? 'Gast').', '.$this->period($booking->arrival, $booking->departure)
.($this->namesProperty ? ' ('.e($booking->property->name).')' : '');
}
private function deadline(Booking $booking): string
{
if ($booking->hold_expires_at === null) {
return '';
}
return ', Frist bis '.$booking->hold_expires_at->format('d.m. H:i').' Uhr'.($booking->hold_expires_at->isPast() ? ' (abgelaufen)' : '');
}
private function period(CarbonImmutable $from, CarbonImmutable $until): string
{
return $from->format('d.m.').'–'.$until->format('d.m.Y');
}
private function day(CarbonImmutable $date): string
{
return match (true) {
$date->isToday() => 'Heute',
$date->isTomorrow() => 'Morgen',
default => $date->locale('de')->isoFormat('dd DD.MM.'),
};
}
}
+24 -4
View File
@@ -9,19 +9,25 @@
/**
* Posts findings to the admin inbox ("Postfach"). Each finding has a fingerprint and arrives only once
* per landlord, so a check that runs every few minutes reports a lasting problem a single time.
* per landlord, so a check that runs every few minutes does not report a lasting problem again and again.
* While the finding is still detected and the message is unread, it is repeated after the landlord's
* reminder interval (Settings::reminderIntervalDays(), 0 = never).
*/
class Inbox
{
/**
* @return InboxMessage|null the new message, or null when this finding was posted before
* @return InboxMessage|null the message to e-mail now – new (wasRecentlyCreated) or due for a reminder – else null
*/
public function post(InboxMessageKind $kind, string $fingerprint, string $subject, string $body, ?Channel $channel = null, ?string $actionUrl = null): ?InboxMessage
{
$fingerprint = $kind->value.':'.$fingerprint;
if (InboxMessage::query()->where('fingerprint', $fingerprint)->exists()) {
return null;
$existing = InboxMessage::query()->where('fingerprint', $fingerprint)->first();
if ($existing) {
$due = $this->reminderDue($existing);
$existing->forceFill(['last_seen_at' => now(), ...($due ? ['notified_at' => now()] : [])])->save();
return $due ? $existing : null;
}
try {
@@ -33,9 +39,23 @@ public function post(InboxMessageKind $kind, string $fingerprint, string $subjec
'channel_id' => $channel?->id,
'property_id' => $channel?->property_id,
'action_url' => $actionUrl,
'notified_at' => now(),
'last_seen_at' => now(),
]);
} catch (UniqueConstraintViolationException) {
return null;
}
}
/**
* Unread messages are repeated once the reminder interval has passed; reading one ends its reminders.
*/
public function reminderDue(InboxMessage $message): bool
{
$days = Settings::reminderIntervalDays($message->tenant);
return $days > 0
&& ! $message->isRead()
&& ($message->notified_at === null || $message->notified_at->lessThanOrEqualTo(now()->subDays($days)));
}
}
+8
View File
@@ -80,6 +80,14 @@ public static function mailRedirectFor(?Tenant $tenant): ?string
return $tenant?->test_recipient ?: ($recipients[0] ?? null);
}
/**
* After how many days an unread, still detected finding is e-mailed again; 0 = only once.
*/
public static function reminderIntervalDays(?Tenant $tenant = null): int
{
return (int) (($tenant ?? self::tenant())?->reminder_interval_days ?? 0);
}
/**
* Applies the redirect of the current landlord to the mailer; called after saving.
*/
+16 -1
View File
@@ -5,12 +5,21 @@
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
/**
* Availability calendar, live price and booking request (Livewire component App\Livewire\BookingRequest).
* Availability calendar, live price and booking request (Livewire component App\Livewire\BookingRequest), optionally
* with the three steps of the booking path (request → offer → acceptance) as a graphic.
*/
class BookingSection extends Section
{
/** Booking path 1 (KONZEPT §6a) in the guest's words: title => explanation. */
public const STEPS = [
'Anfrage senden' => 'Kostenlos und unverbindlich. Wir halten den Termin sofort für Sie frei.',
'Angebot erhalten' => 'Per E-Mail mit Gesamtpreis und Mietvertrag – in Ruhe prüfen.',
'Annehmen' => 'Mit einem Klick im Angebot. Erst dann ist die Buchung verbindlich.',
];
public static function key(): string
{
return 'booking';
@@ -31,6 +40,10 @@ public static function schema(): array
return [
TextInput::make('heading')->label('Überschrift')->default('Preise & Buchung')->maxLength(120),
Textarea::make('text')->label('Text')->rows(2),
Toggle::make('show_steps')
->label('Ablauf als Grafik zeigen')
->helperText('Anfrage → Angebot per E-Mail → Annahme, über dem Kalender.')
->default(true),
];
}
@@ -39,6 +52,8 @@ public function data(Theme $theme, array $data): array
return [
'heading' => $data['heading'] ?? null,
'text' => $data['text'] ?? null,
'showSteps' => (bool) ($data['show_steps'] ?? true),
'steps' => self::STEPS,
'property' => $theme->property(),
];
}
+3
View File
@@ -5,6 +5,7 @@
use App\Models\Amenity;
use App\Models\FloorPlan;
use App\Models\Photo;
use App\Models\Video;
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
@@ -52,6 +53,7 @@ public function data(Theme $theme, array $data): array
$amenities = Amenity::query()
->whereIn('id', $rooms->flatMap(fn (array $room): array => $room['amenity_ids'] ?? [])->unique()->all())
->pluck('name', 'id');
$videos = $rooms->isEmpty() ? collect() : Video::query()->where('property_id', $plan->property_id)->whereNotNull('chapters')->get();
return [
'heading' => $data['heading'] ?? 'Der Grundriss',
@@ -65,6 +67,7 @@ public function data(Theme $theme, array $data): array
'points' => collect(FloorPlan::points($room['points']))->map(fn (array $point): string => $point[0].','.$point[1])->implode(' '),
'photos' => collect($room['photo_ids'] ?? [])->map(fn ($id) => $photos->get((int) $id))->filter()->values(),
'amenities' => collect($room['amenity_ids'] ?? [])->map(fn ($id) => $amenities->get((int) $id))->filter()->values(),
'videoChapter' => $videos->map(fn (Video $video): ?array => $video->chapterForRoom($room['name']))->filter()->first(),
]),
];
}
+27 -4
View File
@@ -2,14 +2,18 @@
namespace App\Themes\Sections;
use App\Availability\NextFreeStays;
use App\Pricing\OfferShowcase;
use App\Themes\Theme;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Utilities\Get;
/**
* Large photo with headline and the availability search. Seasonal appearances replace photo and texts.
* Large photo (or a silent video loop) with headline, the availability search and the next free dates.
* Seasonal appearances replace photo and texts.
*/
class HeroSection extends Section
{
@@ -36,7 +40,20 @@ public static function schema(): array
Textarea::make('text')->label('Text')->rows(2)->maxLength(400),
static::photoSelect('photo_ids', 'Fotos', multiple: true)
->helperText('Gezeigt wird das erste Foto, das zum Erscheinungsbild passt; leer = automatisch ein Foto der Wohnung. '.self::SEASON_HINT),
static::videoSelect('video_id', 'Video statt Foto')
->helperText('Läuft stumm in Schleife an der Stelle des Fotos (Webseite › Videos). Bei „Bewegung reduzieren“ und langsamer Verbindung bleibt das Standbild des Videos stehen.'),
Toggle::make('show_search')->label('Verfügbarkeitssuche anzeigen')->default(true),
Toggle::make('show_free_dates')
->label('Nächste freie Termine zeigen')
->helperText('Bis zu drei buchbare Zeiträume mit Gesamtpreis; ein Klick öffnet die Anfrage mit diesen Daten.')
->default(true)
->live(),
Select::make('free_dates_nights')
->label('Mindestens … Nächte')
->options(array_combine(range(2, 7), array_map(fn (int $nights): string => "{$nights} Nächte", range(2, 7))))
->default(3)
->selectablePlaceholder(false)
->visible(fn (Get $get): bool => (bool) $get('show_free_dates')),
Toggle::make('show_offer')
->label('Hervorgehobenes Sonderangebot im Titelbereich zeigen')
->helperText('Das wichtigste als „hervorgehoben“ markierte Angebot, sofern gerade eins gilt.')
@@ -46,18 +63,24 @@ public static function schema(): array
public function data(Theme $theme, array $data): array
{
$featuredOffer = ($data['show_offer'] ?? true) && $theme->property()
? app(OfferShowcase::class)->current($theme->property(), limit: 1, featuredOnly: true)->first()
$property = $theme->property();
$featuredOffer = ($data['show_offer'] ?? true) && $property
? app(OfferShowcase::class)->current($property, limit: 1, featuredOnly: true)->first()
: null;
$freeStays = ($data['show_free_dates'] ?? false) && $property
? app(NextFreeStays::class)->for($property, nights: (int) ($data['free_dates_nights'] ?? 3))
: [];
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' => $this->chosenPhotos($theme, $data['photo_ids'] ?? [])->first() ?? $this->automaticPhotos($theme, limit: 1)->first(),
'video' => $this->video($data['video_id'] ?? null),
'freeStays' => $freeStays,
'featuredOffer' => $featuredOffer,
'showSearch' => (bool) ($data['show_search'] ?? true),
'property' => $theme->property(),
'property' => $property,
];
}
}
+22
View File
@@ -6,6 +6,7 @@
use App\Filament\Forms\Components\PhotoSelect;
use App\Models\Page;
use App\Models\Photo;
use App\Models\Video;
use App\Themes\Theme;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
@@ -173,6 +174,27 @@ protected static function photoSelect(string $name, string $label, bool $multipl
->multiple($multiple);
}
/**
* Select field listing the website videos (Admin › Webseite › Videos).
*/
protected static function videoSelect(string $name, string $label): Select
{
return Select::make($name)
->label($label)
->options(fn (): array => Video::query()->orderBy('title')->pluck('title', 'id')->all())
->placeholder('– kein Video –');
}
/**
* The chosen video, if it still exists and has a file.
*/
protected function video(mixed $id): ?Video
{
$video = filled($id) ? Video::query()->with('media')->find($id) : null;
return $video?->url() ? $video : null;
}
/**
* Select field listing the pages of the site, for links.
*/
+72
View File
@@ -0,0 +1,72 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
/**
* A video tour through the apartment: plays only when a guest starts it, chapters jump to a room. Floor plan
* rooms named in a chapter offer "Im Video ansehen" when the tour is on the same page.
*/
class TourSection extends Section
{
public const LAYOUTS = [
'wide' => 'Video in voller Breite, Text darüber',
'left' => 'Video links, Text und Kapitel rechts',
'right' => 'Video rechts, Text und Kapitel links',
];
public static function key(): string
{
return 'tour';
}
public static function label(): string
{
return 'Rundgang (Video)';
}
public static function icon(): string
{
return 'heroicon-o-film';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->default('Ein Rundgang durch die Wohnung')->maxLength(160),
Textarea::make('text')->label('Text')->rows(3)->maxLength(600),
static::videoSelect('video_id', 'Video')
->helperText('Webseite › Videos. Das Video lädt erst, wenn Besucher es starten – die Seite bleibt schnell.')
->required(),
Radio::make('layout')
->label('Anordnung')
->options(self::LAYOUTS)
->default('left')
->required(),
Toggle::make('show_chapters')
->label('Kapitel als Knöpfe zeigen')
->helperText('Die Kapitel pflegen Sie am Video.')
->default(true),
];
}
public function data(Theme $theme, array $data): array
{
$video = $this->video($data['video_id'] ?? null);
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? null,
'text' => $data['text'] ?? null,
'video' => $video,
'chapters' => ($data['show_chapters'] ?? true) && $video ? $video->chapterList() : [],
'layout' => array_key_exists($data['layout'] ?? '', self::LAYOUTS) ? $data['layout'] : 'left',
];
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
/*
|--------------------------------------------------------------------------
| Livewire – only what differs from the package defaults
|--------------------------------------------------------------------------
|
| Livewire merges this file over its own config key by key. Uploads in the admin (photos up to 25 MB,
| videos up to 100 MB, see App\Models\Video::MAX_KB) need a larger temporary upload than the 12 MB default;
| each form field still sets its own, smaller limit. Strato accepts request bodies up to 128 MB.
|
*/
return [
'temporary_file_upload' => [
'disk' => env('LIVEWIRE_TEMPORARY_FILE_UPLOAD_DISK'),
'rules' => ['required', 'file', 'max:102400'],
'directory' => null,
'middleware' => null,
'preview_mimes' => [
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
],
'max_upload_time' => 15,
'cleanup' => true,
],
];
+1 -1
View File
@@ -50,7 +50,7 @@
* The maximum file size of an item in bytes.
* Adding a larger file will result in an exception.
*/
'max_file_size' => 1024 * 1024 * 10, // 10MB
'max_file_size' => 1024 * 1024 * 100, // 100MB: website videos (App\Models\Video::MAX_KB); Strato accepts uploads up to 128 MB
/*
* Uploads whose file name contains any of these extensions will be rejected.
+1
View File
@@ -40,6 +40,7 @@
Sections\GallerySection::class,
Sections\AmenitiesSection::class,
Sections\FloorPlanSection::class,
Sections\TourSection::class,
Sections\LocationSection::class,
Sections\PricesSection::class,
Sections\OffersSection::class,
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Database\Factories;
use App\Models\Video;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Video>
*/
class VideoFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'title' => fake()->sentence(3),
'chapters' => null,
];
}
}
@@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Landlords choose how often an open finding is repeated by e-mail and whether they get a daily and/or
* weekly summary. Inbox messages remember when they were last mailed and last detected.
*/
public function up(): void
{
Schema::table('tenants', function (Blueprint $table) {
$table->unsignedSmallInteger('reminder_interval_days')->default(0);
$table->boolean('digest_daily')->default(true);
$table->boolean('digest_weekly')->default(false);
$table->unsignedTinyInteger('digest_weekday')->default(1);
$table->unsignedTinyInteger('digest_hour')->default(7);
$table->json('digest_sections')->nullable();
$table->boolean('digest_when_empty')->default(false);
$table->date('digest_daily_sent_on')->nullable();
$table->date('digest_weekly_sent_on')->nullable();
});
Schema::table('inbox_messages', function (Blueprint $table) {
$table->timestamp('notified_at')->nullable()->after('action_url');
$table->timestamp('last_seen_at')->nullable()->after('notified_at');
});
DB::table('inbox_messages')->update(['notified_at' => DB::raw('created_at'), 'last_seen_at' => DB::raw('created_at')]);
}
public function down(): void
{
Schema::table('inbox_messages', function (Blueprint $table) {
$table->dropColumn(['notified_at', 'last_seen_at']);
});
Schema::table('tenants', function (Blueprint $table) {
$table->dropColumn(['reminder_interval_days', 'digest_daily', 'digest_weekly', 'digest_weekday', 'digest_hour',
'digest_sections', 'digest_when_empty', 'digest_daily_sent_on', 'digest_weekly_sent_on']);
});
}
};
@@ -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
{
/**
* Website videos (Admin › Webseite › Videos): the file and a poster image live in the media library;
* chapters ("0:16 Wohnzimmer") let guests jump to a room, also from the floor plan.
*/
public function up(): void
{
Schema::create('videos', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
$table->foreignId('property_id')->nullable()->constrained()->nullOnDelete();
$table->string('title');
$table->json('chapters')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('videos');
}
};
+4
View File
@@ -1,5 +1,9 @@
# Projektstand
**Titelvideo, Rundgang, freie Termine, Buchungsseite (30.10.2026, Branch `feature/titelvideo-rundgang`):** Neue Verwaltung **Webseite › Videos** (`Video`: Datei bis 100 MB, Standbild, Kapitel mit Raum aus dem Grundriss; Upload-Grenzen von Livewire/Medienbibliothek auf 100 MB angehoben – vorher scheiterten schon Fotos über 10 MB). **Titelbereich:** „Video statt Foto“ (stumme Schleife, lädt nur ohne „Bewegung reduzieren“/Save-Data, Pause-Knopf) und „Nächste freie Termine“ (`App\Availability\NextFreeStays`: bis zu 3 buchbare, nicht überlappende Zeiträume mit Gesamtpreis, 10 Min. zwischengespeichert, Klick füllt die Anfrage vor; Seebad: Fahrkarten). **Neuer Baustein „Rundgang (Video)“** (Anordnung wählbar: volle Breite/Video links/rechts; Kapitel als Fahrplan; lädt erst beim Start); Grundriss-Räume mit Kapitel bieten „Im Rundgang ansehen“. **Buchungsseite:** Preis links unter dem Kalender, Formular rechts (auf großen Bildschirmen mitlaufend) – keine halbleere Seite mehr; Ablauf „Anfrage → Angebot → Annahme“ als Grafik (abschaltbar). **Seebad:** Sonnenaufgang des Trenners einmal beim Hinscrollen statt unmerklicher Dauerbewegung. Aus dem Agenturvideo (41,7 MB, Rechte bei Stommers) geschnitten: Titelschleife „Garten und Meer“ (9 s, 3,5 MB) und Rundgang (58 s, 14,5 MB) – liegen nicht im Repo, Upload über den Admin. Lokal mit Bildschirmfotos (Desktop/Handy) geprüft. Tests: **526 Feature-Tests grün**, Pint, `themes:check` beide Themes.
**Erinnerungen und Zusammenfassungen einstellbar (30.10.2026, Branch `feature/erinnerungen-zusammenfassung`):** Neuer Abschnitt System › Betrieb › **Benachrichtigungen** (Spalten auf `tenants`). „Offene Meldungen erneut senden“: nur einmal (Vorgabe), täglich, alle 2/3 Tage, wöchentlich – gilt für mögliche Doppelbuchungen (solange im Postfach ungelesen und weiter festgestellt; Lesen beendet die Erinnerung, `Inbox::reminderDue`) und offene Portal-Aufgaben (`RemindChannelTasks`). **Tägliche und/oder wöchentliche Zusammenfassung** (`SendDigests`, Scheduler alle 15 Minuten, ab wählbarer Uhrzeit, Wochentag wählbar; am Wochentag nur die Wochenübersicht) mit wählbaren Teilen (`DigestSection`, `DigestReport`): Postfach, offene Anfragen/Angebote mit Frist, Neues seit der letzten Übersicht (Anfragen, Buchungen, Stornierungen, Portalbuchungen), An-/Abreisen (heute+morgen bzw. 7 Tage), überfällige Zahlungen, Portal-Aufgaben/zu prüfende Portal-Mails/Kalender-Klärungsfälle/Abgleichsfehler, Bewertungen zur Freigabe. Leere Übersichten entfallen (abschaltbar), Knopf „Zusammenfassung jetzt senden“. Vorgabe: täglich 7 Uhr an, wöchentlich aus. Tests: **520 Feature-Tests / 2725 Assertions grün**, Pint. Seite nicht im Browser angesehen.
**Doppelbuchungs-Mails nur noch einmal, neues Postfach in der Verwaltung (30.10.2026, Branch `feature/postfach`):** Ursache der Mailflut: `SyncChannel` prüfte bei jedem Abgleich (alle 5 Minuten) alle importierten Belegungen erneut und schickte jede fortbestehende Überschneidung wieder per Mail. Jetzt meldet `ReportChannelConflicts` (Kalenderabgleich und Portal-Mail) jede Überschneidung einmal: Sie landet im neuen **Postfach** (Vermietung › Postfach, `InboxMessage`, Zähler der ungelesenen im Menü, gelesen/ungelesen, „Ansehen“ öffnet den Belegungsplan im betroffenen Monat) und nur neue Meldungen gehen per Mail. Doppelte Meldungen verhindert ein Fingerabdruck je Mandant (`App\Support\Inbox`, eindeutiger Index). Ändern sich Termine, ist es eine neue Meldung. Das Synchronisationsprotokoll zählt offene Konflikte weiter. Nach dem Deployment kommt jede noch bestehende Überschneidung einmal neu (Postfach war leer). Tests: **513 Feature-Tests grün**, Pint.
**Wohnungen, Bilder und Banner neu geordnet (29.10.2026, Branch `feature/wohnungs-kontext`):**
+5 -4
View File
@@ -101,16 +101,17 @@ ## 5. Bausteinkatalog – Vertrag der Vorlagen
| Key | Admin-Name | Variablen |
|---|---|---|
| `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` |
| `hero` | Titelbereich mit Suche | `$eyebrow`, `$title` (Text, `*Wort*` = Hervorhebung), `$text`, `$photo`, `$video` (`App\Models\Video`\|null: stumme Schleife statt des Fotos – `@include('theme::partials.video-loop', ['video' => $video, 'class' => …])`), `$freeStays` (Liste `arrival`, `departure` (CarbonImmutable), `nights`, `total` (Cent), `url` – `@include('theme::partials.free-stays')`), `$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>) |
| `floor_plan` | Grundriss (interaktiv) | `$heading`, `$text`, `$photo` (Grundriss-Bild, `Photo`), `$rooms` (Collection von Arrays: `key` – Anker-ID, `name`, `description`, `hint` – Barrierefreiheit, `points` – „x,y x,y …“ in **Prozent** des Bildes → SVG `viewBox="0 0 100 100" preserveAspectRatio="none"` über dem Bild, `photos` – Collection<Photo>, `amenities` – Collection<string>). Rendert nichts ohne Bild oder Räume. Daten: Admin › Webseite › Grundriss (`FloorPlan`) |
| `floor_plan` | Grundriss (interaktiv) | `$heading`, `$text`, `$photo` (Grundriss-Bild, `Photo`), `$rooms` (Collection von Arrays: `key` – Anker-ID, `name`, `description`, `hint` – Barrierefreiheit, `points` – „x,y x,y …“ in **Prozent** des Bildes → SVG `viewBox="0 0 100 100" preserveAspectRatio="none"` über dem Bild, `photos` – Collection<Photo>, `amenities` – Collection<string>). `videoChapter` – Kapitel eines Rundgang-Videos mit diesem Raum: `seconds`, `time`, `label` oder null → Link `<a href="#" hidden data-tour-link="{{ seconds }}">`, den theme.js nur zeigt, wenn ein Rundgang auf derselben Seite ist). Rendert nichts ohne Bild oder Räume. Daten: Admin › Webseite › Grundriss (`FloorPlan`) |
| `tour` | Rundgang (Video) | `$eyebrow`, `$heading`, `$text`, `$video` (`Video`\|null – ohne Video rendert nichts), `$chapters` (Liste `seconds`, `time` „0:16“, `label`, `room`), `$layout` (`wide`\|`left`\|`right`). Pflicht-Markup für theme.js: `data-tour` am Abschnitt, `<video controls preload="none">` (lädt erst beim Start), `[data-tour-start]` (Start-Overlay, `hidden`), `[data-tour-chapters]` (`hidden`, ohne JS unsichtbar), `[data-tour-seek="<Sekunden>"]` je Kapitel (aktuelles bekommt `aria-current="true"`). Daten: Admin › Webseite › Videos |
| `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`, `$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 |
| `booking` | Kalender & Anfrage | `$heading`, `$text`, `$property`, `$showSteps` (bool), `$steps` (Titel ⇒ Erklärung: Anfrage → Angebot → Annahme, eine echte Abfolge) – bindet `<livewire:booking-request :property="$property" />` ein (links Kalender, Daten und Preis, rechts das Anfrageformular) |
| `reviews` | Gästebewertungen | `$heading`, `$reviews`, `$count`, `$average`, `$categories` – **Pflichthinweis** zur Echtheit (§ 5b UWG) muss sichtbar bleiben |
| `host` | Gastgeber | `$heading`, `$quote`, `$text`, `$photo`, `$name` |
| `faq` | Häufige Fragen | `$heading`, `$faqs`, `$answers` (ID ⇒ HtmlString) – erzeugt FAQ-JSON-LD |
@@ -120,7 +121,7 @@ ## 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). **Bilder in Bausteinen** (Basisklasse): `chosenPhotos()` = ausgewählte Fotos in ihrer Reihenfolge, nur veröffentlichte und zur Saison passende; `automaticPhotos()` = `Photo::automatic()` (Fotos der Wohnung des Bausteins und solche ohne Wohnung, nie Kategorie „Grundriss & Pläne“, zur Saison passend, Saisonfotos zuerst); `photoSourceFields()`/`sourcedPhotos()` = Wahl „automatisch“ oder „eigene Auswahl“ (`data.photo_source`, `data.photo_ids`). Titelbereich und Abschluss halten eine Liste `photo_ids`, gezeigt wird das erste passende Foto. Ein Foto gehört zu keinem (= ganzjährig) oder mehreren Erscheinungsbildern; dann erscheint es nur dort und vor den ganzjährigen. Alle Bildauswahlen nutzen `App\Filament\Forms\Components\PhotoSelect` (Vorschaubild + Beschreibung, nach Kategorie gruppiert).
**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). **Bilder in Bausteinen** (Basisklasse): `chosenPhotos()` = ausgewählte Fotos in ihrer Reihenfolge, nur veröffentlichte und zur Saison passende; `automaticPhotos()` = `Photo::automatic()` (Fotos der Wohnung des Bausteins und solche ohne Wohnung, nie Kategorie „Grundriss & Pläne“, zur Saison passend, Saisonfotos zuerst); `photoSourceFields()`/`sourcedPhotos()` = Wahl „automatisch“ oder „eigene Auswahl“ (`data.photo_source`, `data.photo_ids`). Titelbereich und Abschluss halten eine Liste `photo_ids`, gezeigt wird das erste passende Foto. Ein Foto gehört zu keinem (= ganzjährig) oder mehreren Erscheinungsbildern; dann erscheint es nur dort und vor den ganzjährigen. Alle Bildauswahlen nutzen `App\Filament\Forms\Components\PhotoSelect` (Vorschaubild + Beschreibung, nach Kategorie gruppiert). **Videos** (`App\Models\Video`, Admin › Webseite › Videos: Datei MP4/WebM bis 100 MB, Standbild, Kapitel „Min:Sek – Bezeichnung – Raum im Grundriss“) wählen Bausteine mit `videoSelect()` und holen sie mit `video()`. **Einmaliges Einblenden:** `data-reveal` an einem Element → theme.js setzt `ready` und beim Hinscrollen `shown`; das Theme gestaltet beide Zustände in `@media (prefers-reduced-motion: no-preference)` (Seebad: Sonnenaufgang des Trenners). Ohne JS oder mit „Bewegung reduzieren“ bleibt der Endzustand.
**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.
+1
View File
@@ -84,6 +84,7 @@ ## 6. Änderungsprotokoll Vorlagen-Vertrag
| Datum | Änderung | Betrifft |
|---|---|---|
| 30.10.2026 | **Video, freie Termine, Rundgang, Ablauf:** `hero` bekommt `$video` und `$freeStays` (Partials `video-loop`, `free-stays` im Basis-Theme, Seebad: Fahrkarten). **Neuer Baustein `tour`** (Rundgang mit Kapiteln) mit Basis-Vorlage; `floor_plan`-Räume tragen `videoChapter`. `booking`: `$showSteps`/`$steps`; das Livewire-Formular steht jetzt rechts allein, der Preis links unter dem Kalender. Neu in theme.js (Basis): `[data-video-loop]`, `[data-tour*]`, `[data-reveal]`. Seebad: Sonnenaufgang statt Dauer-Drift am Trenner unter dem Titel. Vertrag: THEMES.md §5. | sections/hero, tour, floor_plan, booking; partials/video-loop, free-stays |
| 29.10.2026 | **Banner:** `partials/banner` liest `$theme->banner()` (`text`, `linkLabel`, `linkUrl`, `tone` → `data-tone`) statt `Notice::visible()` und `$theme->text('banner.*')`; die Schlüssel `banner.*` gibt es am Erscheinungsbild nicht mehr. Beide Themes angepasst. | partials/banner |
| 29.10.2026 | **Fotos und Saisons:** Variablen der Vorlagen unverändert (`$photo`, `$photos`). Entfallen: `$theme->heroPhoto()`, `sectionPhotoIds()`, `sectionPhotoMode()`, `Section::photoSlots()` und die Saison-Helfer `seasonalPhoto(s)`/`withSeasonalPhotos`; neu `$theme->sharePhoto($sections)`, `chosenPhotos()`, `automaticPhotos()`, `sourcedPhotos()`. Titelbereich/Abschluss: `data.photo_ids` statt `photo_id`. Neue Fotokategorie `plan` erscheint nie automatisch. | nur Bausteinklassen; Vorlagen nicht betroffen |
| 26.10.2026 | **Mandantenabschluss:** Beide Themes beziehen Logo und Favicon ausschließlich aus der Website-Marke; ohne Marke bleibt die Darstellung neutral. Dekoration und Bild-Platzhalter kommen aus Bildwelt-Plätzen. `partials/brand` bleibt als kompatible Platz-Zuordnung erhalten; Seebads `partials/motif` nutzt die Bildwelt-API. Bestehende Stommer-Marken werden vor Aktivierung ausdrücklich für diese Website importiert. | layouts/app, partials/brand, partials/logo, partials/motif, partials/image, header |
+95
View File
@@ -68,3 +68,98 @@ document.querySelectorAll('[data-rotator]').forEach((rotator) => {
setInterval(() => { if (!paused && !document.hidden) show(current + 1); }, 7000);
}
});
const reducedMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;
// Silent video loops (partials/video-loop): loaded only with motion allowed and without Save-Data, playing while
// visible; the button pauses and resumes. Otherwise the poster stays and nothing is downloaded.
document.querySelectorAll('[data-video-loop]').forEach((box) => {
const video = box.querySelector('video');
const toggle = box.querySelector('[data-video-toggle]');
if (!video?.dataset.src || reducedMotion() || navigator.connection?.saveData) {
return;
}
let stopped = false;
const play = () => video.play().catch(() => {});
video.src = video.dataset.src;
video.preload = 'auto';
toggle.hidden = false;
toggle.addEventListener('click', () => {
stopped = !stopped;
stopped ? video.pause() : play();
const label = stopped ? 'Video abspielen' : 'Video anhalten';
toggle.setAttribute('aria-pressed', String(stopped));
toggle.setAttribute('aria-label', label);
toggle.title = label;
toggle.querySelector('[data-icon-pause]').classList.toggle('hidden', stopped);
toggle.querySelector('[data-icon-play]').classList.toggle('hidden', !stopped);
});
new IntersectionObserver(([entry]) => {
entry.isIntersecting && !stopped ? play() : video.pause();
}).observe(video);
});
// Video tour (sections/tour): start overlay, chapter buttons, highlighting the current chapter; floor plan rooms
// with [data-tour-link] jump into the tour on the same page. Without JavaScript the native controls remain.
const tour = document.querySelector('[data-tour]');
if (tour) {
const video = tour.querySelector('video');
const start = tour.querySelector('[data-tour-start]');
const seeks = [...tour.querySelectorAll('[data-tour-seek]')];
const playFrom = (seconds) => {
start.hidden = true;
const go = () => {
if (seconds !== null) {
video.currentTime = seconds;
}
video.play().catch(() => {});
};
video.readyState >= 1 ? go() : video.addEventListener('loadedmetadata', go, { once: true });
if (video.readyState < 1) {
video.load();
}
};
start.hidden = false;
start.addEventListener('click', () => playFrom(null));
video.addEventListener('play', () => { start.hidden = true; });
tour.querySelector('[data-tour-chapters]')?.removeAttribute('hidden');
seeks.forEach((button) => button.addEventListener('click', () => playFrom(Number(button.dataset.tourSeek))));
video.addEventListener('timeupdate', () => {
const current = seeks.filter((button) => Number(button.dataset.tourSeek) <= video.currentTime + 0.25).pop();
seeks.forEach((button) => (button === current ? button.setAttribute('aria-current', 'true') : button.removeAttribute('aria-current')));
});
document.querySelectorAll('[data-tour-link]').forEach((link) => {
link.hidden = false;
link.addEventListener('click', (event) => {
event.preventDefault();
tour.scrollIntoView({ behavior: reducedMotion() ? 'auto' : 'smooth', block: 'center' });
playFrom(Number(link.dataset.tourLink));
});
});
}
// One-time reveal of a graphic when it scrolls into view (e.g. the sunrise of theme Seebad): the theme's CSS
// styles [data-reveal="ready"] (start) and the transition to [data-reveal="shown"]. Without JavaScript or with
// reduced motion the graphic is simply shown.
if (!reducedMotion() && 'IntersectionObserver' in window) {
const reveal = new IntersectionObserver((entries) => {
entries.filter((entry) => entry.isIntersecting).forEach((entry) => {
entry.target.dataset.reveal = 'shown';
reveal.unobserve(entry.target);
});
}, { threshold: 0.6 });
document.querySelectorAll('[data-reveal]').forEach((element) => {
if (element.getBoundingClientRect().top < window.innerHeight * 0.85) {
element.dataset.reveal = 'ready';
requestAnimationFrame(() => requestAnimationFrame(() => { element.dataset.reveal = 'shown'; }));
return;
}
element.dataset.reveal = 'ready';
reveal.observe(element);
});
}
@@ -0,0 +1,18 @@
{{--
Next free dates of the hero section. Variables: $freeStays (list of arrival, departure, nights, total, url).
--}}
@if ($freeStays !== [])
<div>
<h2 class="text-sm font-semibold text-muted">Nächste freie Termine</h2>
<ul class="mt-2 flex flex-wrap gap-2">
@foreach ($freeStays as $stay)
<li>
<a href="{{ $stay['url'] }}" class="inline-flex min-h-12 flex-col justify-center rounded border border-line bg-surface px-4 py-1.5 hover:border-accent">
<span class="font-semibold">{{ $stay['arrival']->format('d.m.') }}–{{ $stay['departure']->format('d.m.') }}</span>
<span class="text-sm text-muted">{{ $stay['nights'] }} Nächte · {{ \App\Support\Money::format($stay['total']) }}</span>
</a>
</li>
@endforeach
</ul>
</div>
@endif
@@ -0,0 +1,15 @@
{{--
Silent video loop in place of a photo (hero). Variables: $video (App\Models\Video), $class (sizes the <video>),
$wrapperClass and $buttonClass (optional: sizes the wrapper, positions the pause button). theme.js loads and
plays it; with "reduce motion", Save-Data or without JavaScript only the poster is shown – nothing is downloaded.
--}}
<div class="relative {{ $wrapperClass ?? '' }}" data-video-loop>
<video class="{{ $class ?? '' }}" muted loop playsinline disablepictureinpicture preload="none"
poster="{{ $video->posterUrl() }}" data-src="{{ $video->url() }}" data-type="{{ $video->mimeType() }}"
aria-label="Video: {{ $video->title }}"></video>
<button type="button" data-video-toggle hidden aria-pressed="false" aria-label="Video anhalten" title="Video anhalten"
class="{{ $buttonClass ?? 'absolute right-4 bottom-4' }} inline-flex size-12 items-center justify-center rounded-full bg-ink/70 text-ground backdrop-blur-sm hover:bg-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ground">
<x-heroicon-s-pause class="size-5" data-icon-pause aria-hidden="true" />
<x-heroicon-s-play class="hidden size-5" data-icon-play aria-hidden="true" />
</button>
</div>
@@ -1,6 +1,17 @@
<section class="mx-auto max-w-7xl px-4 py-12 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
@if ($heading)<h1 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h1>@endif
@if ($text)<p class="mt-3 max-w-2xl text-muted">{{ $text }}</p>@endif
@if ($showSteps ?? false)
<ol class="mt-8 grid gap-4 sm:grid-cols-3" aria-label="So läuft Ihre Buchung ab">
@foreach ($steps as $title => $explanation)
<li class="rounded border border-line bg-surface p-4">
<span class="font-display text-2xl text-accent">{{ $loop->iteration }}</span>
<strong class="mt-1 block">{{ $title }}</strong>
<span class="text-sm text-muted">{{ $explanation }}</span>
</li>
@endforeach
</ol>
@endif
<div class="mt-8">
@if ($property)
<livewire:booking-request :property="$property" />
@@ -1,6 +1,8 @@
{{--
Contract: $heading, $text, $photo (App\Models\Photo, the plan picture), $rooms (Collection of arrays: key, name,
description, hint, points = "x,y x,y …" in percent of the picture, photos = Collection<Photo>, amenities = Collection<string>).
description, hint, points = "x,y x,y …" in percent of the picture, photos = Collection<Photo>, amenities = Collection<string>,
videoChapter = chapter of a tour video showing the room: seconds, time, label – or null). The link [data-tour-link] stays
hidden unless a tour section (data-tour) is on the same page.
Base version without JavaScript: the areas on the plan jump to the room descriptions below.
--}}
@if ($photo && $rooms->isNotEmpty())
@@ -35,6 +37,9 @@
</ul>
@endif
@if ($room['hint'])<p class="mt-3 border-l-2 border-accent pl-3 text-sm">{{ $room['hint'] }}</p>@endif
@if ($room['videoChapter'] ?? null)
<a href="#" hidden data-tour-link="{{ $room['videoChapter']['seconds'] }}" class="mt-3 inline-flex min-h-12 items-center gap-2 font-semibold underline underline-offset-4"><x-heroicon-s-play class="size-5" aria-hidden="true" />Im Rundgang ansehen ({{ $room['videoChapter']['time'] }})</a>
@endif
</li>
@endforeach
</ul>
@@ -1,6 +1,10 @@
<section class="mx-auto max-w-[86rem] px-4" aria-labelledby="{{ $sectionId }}-title">
<div class="relative overflow-hidden rounded">
@include('theme::partials.image', ['photo' => $photo, 'class' => 'h-[30rem] w-full object-cover sm:h-[40rem]', 'eager' => true])
@if ($video ?? null)
@include('theme::partials.video-loop', ['video' => $video, 'class' => 'h-[30rem] w-full object-cover sm:h-[40rem]', 'buttonClass' => 'absolute top-4 right-4'])
@else
@include('theme::partials.image', ['photo' => $photo, 'class' => 'h-[30rem] w-full object-cover sm:h-[40rem]', 'eager' => true])
@endif
<div class="bg-ground p-7 sm:absolute sm:bottom-12 sm:left-12 sm:max-w-xl sm:p-11 sm:pb-9">
@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>
@@ -16,6 +20,9 @@
</span>
</a>
@endif
@if ($freeStays ?? [])
<div class="mt-5">@include('theme::partials.free-stays', ['freeStays' => $freeStays])</div>
@endif
</div>
</div>
</section>
@@ -0,0 +1,34 @@
{{--
Contract: $eyebrow, $heading, $text, $video (App\Models\Video|null), $chapters (list: seconds, time, label, room),
$layout (wide|left|right). The video has native controls and loads only when started (preload="none").
theme.js (initTours): [data-tour], [data-tour-start] (start overlay), [data-tour-seek="<seconds>"] (chapter buttons,
hidden without JavaScript). Floor plan rooms link here with [data-tour-link="<seconds>"].
--}}
@if ($video)
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8" aria-labelledby="{{ $sectionId }}-title" data-tour>
<div @class(['grid items-center gap-10', 'lg:grid-cols-[3fr_2fr]' => $layout === 'left', 'lg:grid-cols-[2fr_3fr]' => $layout === 'right'])>
<div @class(['relative overflow-hidden rounded bg-ink', 'lg:order-2' => $layout === 'right'])>
<video class="aspect-video w-full" controls playsinline preload="none" poster="{{ $video->posterUrl() }}" aria-label="Video: {{ $video->title }}">
<source src="{{ $video->url() }}" type="{{ $video->mimeType() }}">
</video>
<button type="button" data-tour-start hidden class="absolute inset-0 flex items-center justify-center bg-ink/20 hover:bg-ink/30">
<span class="inline-flex min-h-14 items-center gap-3 rounded-full bg-ground px-7 font-semibold text-ink"><x-heroicon-s-play class="size-6" aria-hidden="true" />Rundgang starten</span>
</button>
</div>
<div @class(['lg:order-1' => $layout === 'right', 'order-first' => $layout === 'wide'])>
@if ($eyebrow)<p class="eyebrow">{{ $eyebrow }}</p>@endif
@if ($heading)<h2 id="{{ $sectionId }}-title" class="font-display text-[2rem] leading-tight sm:text-[2.5rem]">{{ $heading }}</h2>@endif
@if ($text)<p class="mt-4 max-w-[60ch] text-muted">{{ $text }}</p>@endif
@if ($chapters !== [])
<ul class="mt-6 flex flex-wrap gap-2" hidden data-tour-chapters aria-label="Kapitel">
@foreach ($chapters as $chapter)
<li><button type="button" data-tour-seek="{{ $chapter['seconds'] }}" class="inline-flex min-h-12 items-center gap-2 rounded border border-line bg-surface px-4 hover:border-accent aria-[current=true]:border-accent aria-[current=true]:bg-accent aria-[current=true]:text-accent-ink">
<span class="text-sm tabular-nums text-muted">{{ $chapter['time'] }}</span> {{ $chapter['label'] }}
</button></li>
@endforeach
</ul>
@endif
</div>
</div>
</section>
@endif
+55
View File
@@ -105,6 +105,33 @@ @layer components {
}
}
/*
* Fahrkarte der Bäderbahn: nächste freie Termine im Titelbereich. Seitliche Kerben und Perforation
* machen aus einem Link eine Karte, die man „lösen“ möchte.
*/
.ticket {
@apply relative flex min-h-14 flex-wrap items-baseline gap-x-4 gap-y-0.5 border-2 border-ink bg-surface py-3 pr-4 pl-7 transition hover:bg-ink/5 focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-accent;
mask: radial-gradient(circle 0.5rem at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
radial-gradient(circle 0.5rem at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
}
.ticket::before {
@apply absolute top-2 bottom-2 left-3.5 border-l-2 border-dashed border-[var(--brand-reed)] content-[''];
}
/* Fahrplan: Kapitel des Rundgangs mit Uhrzeit, Punktlinie und Halt. */
.timetable-stop {
@apply flex min-h-12 w-full items-baseline gap-3 py-2 text-left text-lg hover:text-accent;
}
.timetable-stop::after {
@apply order-2 min-w-6 flex-1 border-b-2 border-dotted border-line content-[''];
}
.timetable-stop[aria-current='true'] {
@apply font-semibold text-accent;
}
/* Kartusche: Doppelrahmen, Rundbogengaube als Kopf, Kopfbänder der Terrassen als Eckkonsolen. */
.cartouche {
@apply relative border-2 border-ink bg-surface outline outline-1 -outline-offset-[10px] outline-[var(--brand-reed)];
@@ -113,6 +140,34 @@ @layer components {
/* Ruhige Bewegung der Bildwelt – nur ohne „Bewegung reduzieren“. */
@media (prefers-reduced-motion: no-preference) {
/*
* Sonnenaufgang (Trenner unter dem Titelbereich), einmal beim Hinscrollen: theme.js setzt data-reveal="ready"
* und später "shown". Ohne JavaScript steht die Grafik fertig da.
*/
/* cy, not transform: the horizon clip-path lives in the circle's own coordinates and would move along. */
[data-reveal='ready'] .motif-sunrise circle {
cy: 150px;
}
[data-reveal='ready'] .motif-sunrise > path {
clip-path: inset(0 50% 0 50%);
}
[data-reveal='ready'] .motif-sunrise g {
opacity: 0;
}
[data-reveal] .motif-sunrise circle {
transition: cy 2.4s cubic-bezier(0.22, 1, 0.36, 1) 0.5s;
}
[data-reveal] .motif-sunrise > path {
transition: clip-path 1.8s cubic-bezier(0.65, 0, 0.35, 1);
}
[data-reveal] .motif-sunrise g {
transition: opacity 1.2s ease 1.6s;
}
.motif-drift {
animation: motif-drift 16s ease-in-out infinite alternate;
}
@@ -0,0 +1,19 @@
{{--
Next free dates as tickets of the Bäderbahn (seebad). Variables: $freeStays (list of arrival, departure, nights, total, url).
--}}
@if ($freeStays !== [])
<div>
<h2 class="text-lg font-semibold">Nächste freie Termine</h2>
<ul class="mt-3 grid gap-2.5">
@foreach ($freeStays as $stay)
<li class="@container">
<a href="{{ $stay['url'] }}" class="ticket" aria-label="{{ $stay['arrival']->format('d.m.') }} bis {{ $stay['departure']->format('d.m.Y') }}, {{ $stay['nights'] }} Nächte, {{ \App\Support\Money::format($stay['total']) }} – anfragen">
<span class="font-display text-[1.375rem] leading-tight whitespace-nowrap">{{ $stay['arrival']->format('d.m.') }}–{{ $stay['departure']->format('d.m.') }}</span>
<span class="order-3 basis-full text-muted @sm:order-none @sm:basis-auto">{{ $stay['nights'] }} Nächte</span>
<span class="ml-auto font-semibold whitespace-nowrap">{{ \App\Support\Money::format($stay['total']) }}</span>
</a>
</li>
@endforeach
</ul>
</div>
@endif
@@ -8,7 +8,22 @@
<a href="tel:{{ preg_replace('/[^0-9+]/', '', $phone) }}" class="inline-flex items-center gap-2 font-semibold underline underline-offset-4 hover:text-accent"><x-heroicon-o-phone class="size-5" aria-hidden="true" />{{ $phone }}</a>
</p>
@endif
<div class="mt-10">
@if ($showSteps ?? false)
{{-- The booking path as a line with three stations – a real sequence, so the numbers carry meaning. --}}
<ol class="relative mt-10 grid gap-7 sm:grid-cols-3 sm:gap-6" aria-label="So läuft Ihre Buchung ab">
<span class="absolute top-7 right-[16.66%] left-[16.66%] hidden h-1.5 border-y-2 border-ink sm:block" aria-hidden="true"></span>
@foreach ($steps as $title => $explanation)
<li class="relative flex gap-4 sm:flex-col sm:items-center sm:text-center">
<span class="flex size-14 shrink-0 items-center justify-center rounded-full border-2 border-ink bg-surface font-display text-[1.75rem] leading-none outline outline-1 -outline-offset-[6px] outline-[var(--brand-reed)]">{{ $loop->iteration }}</span>
<span>
<strong class="block text-lg">{{ $title }}</strong>
<span class="block max-w-[32ch] text-muted">{{ $explanation }}</span>
</span>
</li>
@endforeach
</ol>
@endif
<div class="mt-12">
@if ($property)
<livewire:booking-request :property="$property" />
@else
@@ -52,6 +52,9 @@ class="inline-flex min-h-12 items-center rounded-full border-2 border-ink bg-sur
</ul>
@endif
@if ($room['hint'])<p class="mt-5 border-l-[3px] border-accent bg-ground px-4 py-3">{{ $room['hint'] }}</p>@endif
@if ($room['videoChapter'] ?? null)
<a href="#" hidden data-tour-link="{{ $room['videoChapter']['seconds'] }}" class="btn-outline mt-5 gap-2"><x-heroicon-s-play class="size-5" aria-hidden="true" />Im Rundgang ansehen <span class="font-normal tabular-nums">{{ $room['videoChapter']['time'] }}</span></a>
@endif
@if ($room['photos']->count() > 1)
<ul class="mt-5 grid grid-cols-3 gap-2">
@foreach ($room['photos']->skip(1) as $more)
@@ -1,6 +1,10 @@
<section class="mx-auto flex max-w-7xl flex-wrap items-stretch gap-x-12 gap-y-7 px-4 pt-2 pb-6 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
<div class="relative min-w-0 flex-[999_1_28rem] p-2">
@include('theme::partials.image', ['photo' => $photo, 'sizes' => '(min-width: 1024px) 60vw, 100vw', 'class' => 'arch h-[21rem] w-full object-cover sm:h-[30rem] lg:h-[38rem]', 'eager' => true])
<div class="relative flex min-w-0 flex-[999_1_28rem] flex-col p-2">
@if ($video ?? null)
@include('theme::partials.video-loop', ['video' => $video, 'class' => 'arch block h-[21rem] w-full object-cover sm:h-[30rem] lg:h-full lg:min-h-[38rem]', 'wrapperClass' => 'lg:flex-1', 'buttonClass' => 'absolute right-5 bottom-5'])
@else
@include('theme::partials.image', ['photo' => $photo, 'sizes' => '(min-width: 1024px) 60vw, 100vw', 'class' => 'arch h-[21rem] w-full object-cover sm:h-[30rem] lg:h-auto lg:min-h-[38rem] lg:flex-1', 'eager' => true])
@endif
<span class="keystone" aria-hidden="true"></span>
</div>
@@ -21,6 +25,8 @@
</a>
@endif
@include('theme::partials.free-stays', ['freeStays' => $freeStays ?? []])
@if ($showSearch)
<form action="{{ route('booking.create') }}" method="get" data-availability-search aria-label="Verfügbarkeit prüfen"
class="relative grid grid-cols-2 items-end gap-3.5 border-2 border-ink bg-surface p-5 pt-7 sm:p-7 sm:pt-8">
@@ -45,6 +51,6 @@ class="relative grid grid-cols-2 items-end gap-3.5 border-2 border-ink bg-surfac
</div>
</section>
<div class="overflow-hidden" aria-hidden="true">
@include('theme::partials.motif', ['slot' => 'divider', 'class' => 'motif-drift -ml-[40%] block h-auto w-[180%] max-w-none sm:mx-auto sm:w-full sm:max-w-7xl'])
<div class="overflow-hidden" aria-hidden="true" data-reveal>
@include('theme::partials.motif', ['slot' => 'divider', 'class' => 'motif-sunrise -ml-[40%] block h-auto w-[180%] max-w-none sm:mx-auto sm:w-full sm:max-w-7xl'])
</div>
@@ -0,0 +1,50 @@
{{--
Contract: see ostsee-licht/views/sections/tour.blade.php. Seebad: heading and text span the width, below them the
video in the double frame of the house next to the chapters as a timetable of the Bäderbahn (stop, dots, time) –
both about the same height, so neither column leaves a gap.
--}}
@if ($video)
<section class="mx-auto max-w-7xl px-4 py-14 sm:px-8 sm:py-20" aria-labelledby="{{ $sectionId }}-title" data-tour>
<div class="flex flex-wrap items-end gap-x-14 gap-y-4">
<div class="min-w-0 flex-[1_1_26rem]">
@if ($eyebrow)<p class="eyebrow">{{ $eyebrow }}</p>@endif
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>@endif
</div>
@if ($text)<p class="min-w-0 max-w-[52ch] flex-[1_1_22rem] text-muted">{{ $text }}</p>@endif
</div>
<div class="mt-10 flex flex-wrap items-start gap-x-12 gap-y-8">
<div @class(['relative min-w-0 border-2 border-ink bg-surface p-2.5 sm:p-3.5', 'flex-[999_1_34rem]' => $layout !== 'wide', 'w-full' => $layout === 'wide', 'order-2' => $layout === 'right'])>
<span class="absolute -top-0.5 -left-0.5 z-10" aria-hidden="true">@include('theme::partials.motif', ['slot' => 'bracket', 'class' => 'size-10'])</span>
<span class="absolute -top-0.5 -right-0.5 z-10 -scale-x-100" aria-hidden="true">@include('theme::partials.motif', ['slot' => 'bracket', 'class' => 'size-10'])</span>
<div class="relative bg-ink">
<video class="block aspect-video w-full" controls playsinline preload="none" poster="{{ $video->posterUrl() }}" aria-label="Video: {{ $video->title }}">
<source src="{{ $video->url() }}" type="{{ $video->mimeType() }}">
</video>
<button type="button" data-tour-start hidden class="group absolute inset-0 flex flex-col items-center justify-center gap-4 bg-ink/25 text-ground transition hover:bg-ink/35">
<span class="flex size-20 items-center justify-center rounded-full bg-ground text-ink shadow-lg transition group-hover:scale-105 sm:size-24">
<x-heroicon-s-play class="ml-1 size-9 sm:size-11" aria-hidden="true" />
</span>
<span class="sr-only rounded-full bg-ink/75 px-5 py-2 text-lg font-semibold sm:not-sr-only">Rundgang starten</span>
</button>
</div>
</div>
@if ($chapters !== [])
<div @class(['min-w-0', 'flex-[1_1_18rem]' => $layout !== 'wide', 'w-full' => $layout === 'wide']) hidden data-tour-chapters>
<h3 class="text-base font-semibold text-muted">Springen Sie zu</h3>
<ol @class(['mt-2 border-t-2 border-ink', 'gap-x-10 sm:columns-2 lg:columns-3' => $layout === 'wide'])>
@foreach ($chapters as $chapter)
<li class="break-inside-avoid border-b border-line">
<button type="button" class="timetable-stop" data-tour-seek="{{ $chapter['seconds'] }}">
<span class="order-1">{{ $chapter['label'] }}</span>
<span class="order-3 font-display tabular-nums">{{ $chapter['time'] }}</span>
</button>
</li>
@endforeach
</ol>
</div>
@endif
</div>
</section>
@endif
@@ -93,11 +93,9 @@
</div>
@error('arrival') <p class="mt-2 text-sm text-rose-700" role="alert">{{ $message }}</p> @enderror
@error('departure') <p class="mt-2 text-sm text-rose-700" role="alert">{{ $message }}</p> @enderror
</section>
{{-- Price and form --}}
<section class="lg:col-span-2" aria-labelledby="price-heading">
<div class="rounded border border-line bg-surface p-5" aria-live="polite">
{{-- Price next to the calendar it depends on; the form fills the other column (no half-empty page). --}}
<div class="mt-6 rounded border border-line bg-surface p-5" aria-live="polite">
<h2 id="price-heading" class="text-lg font-semibold text-ink">Ihr Preis</h2>
@php($pricing = $this->pricing)
@@ -157,9 +155,12 @@
<input type="text" wire:model.live.debounce.600ms="promoCode" autocomplete="off" class="mt-1 w-full rounded-lg border-line">
</label>
</div>
</section>
<form wire:submit="submit" class="mt-6 rounded border border-line bg-surface p-5" novalidate>
<h2 class="text-lg font-semibold text-ink">Unverbindlich anfragen</h2>
{{-- Request form --}}
<section class="lg:sticky lg:top-6 lg:col-span-2 lg:self-start" aria-labelledby="request-heading">
<form wire:submit="submit" class="rounded border border-line bg-surface p-5" novalidate>
<h2 id="request-heading" class="text-lg font-semibold text-ink">Unverbindlich anfragen</h2>
<div class="mt-4 grid gap-4 sm:grid-cols-2">
@foreach ([
@@ -1,15 +1,29 @@
<x-mail::message :site="$channel->property?->site" :message="$message ?? null">
# Mögliche Doppelbuchung
# {{ $conflicts === [] ? 'Noch offen: mögliche Doppelbuchung' : 'Mögliche Doppelbuchung' }}
Beim Kalender-Abgleich mit **{{ $channel->name }}** wurde eine neue Belegung gefunden, die sich mit einer bestehenden Belegung überschneidet:
@if ($conflicts !== [])
Beim Kalender-Abgleich mit **{{ $channel->name }}** wurde eine Belegung gefunden, die sich mit einer bestehenden Belegung überschneidet:
@foreach ($conflicts as $conflict)
- {{ $conflict }}
@endforeach
@endif
@if ($reminders !== [])
@if ($conflicts === [])
Diese Überschneidung mit **{{ $channel->name }}** besteht weiterhin und ist im Postfach noch ungelesen:
@else
Weiterhin offen und im Postfach noch ungelesen:
@endif
@foreach ($reminders as $reminder)
- {{ $reminder }}
@endforeach
@endif
Bitte prüfen Sie das umgehend im Portal und in der Verwaltung. Falls es sich um eine echte Doppelbuchung handelt, sollte einer der Gäste so früh wie möglich informiert werden.
Diese Meldung steht auch im Postfach der Verwaltung. Sie kommt nur einmal, auch wenn die Überschneidung bei weiteren Abgleichen bestehen bleibt.
Die Meldung steht auch im Postfach der Verwaltung. Solange sie dort ungelesen ist und die Überschneidung besteht, erinnern wir im eingestellten Abstand daran (System › Betrieb › Benachrichtigungen).
<x-mail::button :url="\App\Filament\Resources\InboxMessages\InboxMessageResource::getUrl('index')">
Postfach öffnen
+23
View File
@@ -0,0 +1,23 @@
<x-mail::message :message="$message ?? null">
# {{ $weekly ? 'Ihre Wochenübersicht' : 'Ihre Tagesübersicht' }}
@if ($sections === [])
Es steht nichts an: keine offenen Anfragen, Meldungen oder Aufgaben.
@endif
@foreach ($sections as $section)
## {{ $section['title'] }}
@foreach ($section['items'] as $item)
- {!! $item !!}
@endforeach
@if ($section['more'] > 0)
- … und {{ $section['more'] }} weitere
@endif
[{{ $section['link'] }}]({{ $section['url'] }})
@endforeach
---
Was in dieser Übersicht steht und wann sie kommt, stellen Sie in der Verwaltung unter System › Betrieb › Benachrichtigungen ein.
</x-mail::message>
+7
View File
@@ -5,6 +5,8 @@
use App\Actions\RemindChannelTasks;
use App\Actions\RequestReviews;
use App\Actions\SendBookingReminders;
use App\Actions\SendDigests;
use App\Models\Tenant;
use App\Tenancy\TenantRunner;
use Illuminate\Support\Facades\Schedule;
@@ -28,6 +30,11 @@
->everyFifteenMinutes()
->withoutOverlapping();
Schedule::call(fn (TenantRunner $runner, SendDigests $sendDigests) => $runner->each(fn (Tenant $tenant) => $sendDigests->handle($tenant)))
->name('digests:send')
->everyFifteenMinutes()
->withoutOverlapping();
Schedule::call(fn (TenantRunner $runner, SendBookingReminders $sendBookingReminders) => $runner->each(fn () => $sendBookingReminders->handle()))
->name('bookings:reminders')
->dailyAt('09:00')
+43
View File
@@ -25,6 +25,7 @@
use App\Models\InboxMessage;
use App\Models\Property;
use App\Models\User;
use App\Tenancy\TenantContext;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Filament\Actions\CreateAction;
@@ -149,6 +150,48 @@ public function test_a_lasting_double_booking_is_reported_once_however_often_the
$this->assertSame(2, InboxMessage::count());
}
public function test_an_unread_double_booking_is_repeated_after_the_chosen_interval_until_it_is_read(): void
{
$this->property->tenant->update(['reminder_interval_days' => 3]);
Booking::factory()->for($this->property)->create(['arrival' => '2026-11-08', 'departure' => '2026-11-12', 'status' => BookingStatus::Confirmed]);
$channel = $this->channel('FeWo-direkt');
$this->fakeFeed([['x1', '20261107', '20261110']]);
(new SyncChannel)->handle($channel);
$this->travel(2)->days();
(new SyncChannel)->handle($channel);
Mail::assertSentCount(1);
$this->travel(1)->days();
(new SyncChannel)->handle($channel);
(new SyncChannel)->handle($channel);
Mail::assertSentCount(2);
Mail::assertSent(ChannelConflict::class, fn (ChannelConflict $mail): bool => $mail->conflicts === [] && count($mail->reminders) === 1
&& str_starts_with($mail->envelope()->subject, 'Erinnerung'));
InboxMessage::sole()->update(['read_at' => now()]);
$this->travel(4)->days();
(new SyncChannel)->handle($channel);
Mail::assertSentCount(2);
}
public function test_open_portal_tasks_are_repeated_after_the_chosen_interval(): void
{
config(['fewo.channels.task_reminder_after_minutes' => 30]);
$this->property->tenant->update(['reminder_interval_days' => 1]);
app(TenantContext::class)->set($this->property->tenant);
ChannelTask::factory()->for($this->channel('Ostseeklar', manual: true))->create(['created_at' => now()->subHour()]);
$this->assertSame(1, app(RemindChannelTasks::class)->handle());
$this->assertSame(0, app(RemindChannelTasks::class)->handle());
$this->travel(1)->days();
$this->assertSame(1, app(RemindChannelTasks::class)->handle());
$this->property->tenant->update(['reminder_interval_days' => 0]);
$this->travel(5)->days();
$this->assertSame(0, app(RemindChannelTasks::class)->handle());
}
public function test_failed_import_is_logged_and_alerted_once_until_it_works_again(): void
{
$channel = $this->channel('Ostseeklar');
+156
View File
@@ -0,0 +1,156 @@
<?php
namespace Tests\Feature;
use App\Actions\SendDigests;
use App\Enums\BookingStatus;
use App\Enums\DigestSection;
use App\Filament\Pages\Operations;
use App\Mail\Digest;
use App\Models\Booking;
use App\Models\Guest;
use App\Models\InboxMessage;
use App\Models\Property;
use App\Models\Tenant;
use App\Models\User;
use App\Tenancy\TenantConfig;
use App\Tenancy\TenantContext;
use Carbon\CarbonImmutable;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Mail;
use Livewire\Livewire;
use Tests\TestCase;
class DigestTest extends TestCase
{
use RefreshDatabase;
private Tenant $tenant;
private Property $property;
protected function setUp(): void
{
parent::setUp();
config(['fewo.mail_redirect_to' => null]);
$this->travelTo(CarbonImmutable::parse('2026-11-02 06:30'));
$this->tenant = Tenant::factory()->create(['notification_emails' => 'vermieterin@example.com']);
app(TenantContext::class)->set($this->tenant);
app(TenantConfig::class)->refresh();
$this->property = Property::factory()->create();
Mail::fake();
}
public function test_daily_summary_goes_out_once_from_the_chosen_hour(): void
{
$this->openRequest();
$digests = app(SendDigests::class);
$this->assertNull($digests->handle($this->tenant));
$this->travelTo(CarbonImmutable::parse('2026-11-02 07:00'));
$this->assertSame('daily', $digests->handle($this->tenant->fresh()));
$this->assertNull($digests->handle($this->tenant->fresh()));
Mail::assertSent(Digest::class, 1);
Mail::assertSent(Digest::class, fn (Digest $mail): bool => $mail->hasTo('vermieterin@example.com') && ! $mail->weekly
&& str_starts_with($mail->envelope()->subject, 'Tagesübersicht 02.11.2026: 2 Punkte'));
}
public function test_on_the_weekly_day_only_the_weekly_summary_goes_out(): void
{
$this->openRequest();
$this->tenant->update(['digest_weekly' => true, 'digest_weekday' => 1, 'digest_hour' => 6]);
$this->assertSame('weekly', app(SendDigests::class)->handle($this->tenant));
$this->assertNull(app(SendDigests::class)->handle($this->tenant->fresh()));
Mail::assertSent(Digest::class, fn (Digest $mail): bool => $mail->weekly && str_starts_with($mail->envelope()->subject, 'Wochenübersicht KW 45'));
Mail::assertSent(Digest::class, 1);
$this->travel(1)->days();
$this->assertSame('daily', app(SendDigests::class)->handle($this->tenant->fresh()));
}
public function test_nothing_to_report_sends_nothing_unless_wanted(): void
{
$this->tenant->update(['digest_hour' => 6]);
$this->assertSame('daily', app(SendDigests::class)->handle($this->tenant));
Mail::assertNothingSent();
$this->tenant->update(['digest_when_empty' => true, 'digest_daily_sent_on' => null]);
app(SendDigests::class)->handle($this->tenant->fresh());
Mail::assertSent(Digest::class, fn (Digest $mail): bool => $mail->sections === [] && str_ends_with($mail->envelope()->subject, 'nichts Neues'));
}
public function test_summary_lists_requests_stays_payments_and_inbox_and_only_the_chosen_sections(): void
{
$this->openRequest();
$this->booking(['arrival' => '2026-11-03', 'departure' => '2026-11-07'], 'Erika Mustermann');
$this->booking(['arrival' => '2026-12-01', 'departure' => '2026-12-05', 'balance_due_on' => '2026-10-20', 'created_at' => now()->subWeek()], 'Hans Säumig');
InboxMessage::factory()->create(['subject' => 'Mögliche Doppelbuchung über FeWo-direkt', 'body' => '<b>Ostsee</b>']);
app(SendDigests::class)->send($this->tenant, weekly: false);
Mail::assertSent(Digest::class, function (Digest $mail): bool {
$html = $mail->render();
$titles = array_column($mail->sections, 'title');
return in_array('Offene Anfragen und Angebote', $titles, true)
&& in_array('An- und Abreisen heute und morgen', $titles, true)
&& in_array('Überfällige Zahlungen', $titles, true)
&& str_contains($html, 'Morgen: Anreise')
&& str_contains($html, 'Erika Mustermann')
&& str_contains($html, 'Hans Säumig')
&& str_contains($html, 'Frist bis')
&& str_contains($html, '&lt;b&gt;Ostsee&lt;/b&gt;')
&& ! str_contains($html, '<b>Ostsee</b>');
});
Mail::fake();
$this->tenant->update(['digest_sections' => [DigestSection::Inbox->value]]);
app(SendDigests::class)->send($this->tenant->fresh(), weekly: false);
Mail::assertSent(Digest::class, fn (Digest $mail): bool => array_column($mail->sections, 'section') === [DigestSection::Inbox]);
}
public function test_settings_are_saved_on_the_operations_page_and_a_summary_can_be_sent_right_away(): void
{
$this->actingAs(User::factory()->create());
Livewire::test(Operations::class)
->assertSet('data.reminder_interval_days', 0)
->assertSet('data.digest_daily', true)
->set('data.reminder_interval_days', 3)
->set('data.digest_weekly', true)
->set('data.digest_weekday', 5)
->set('data.digest_hour', 18)
->set('data.digest_sections', [DigestSection::Inbox->value, DigestSection::Portals->value])
->call('save')
->assertHasNoErrors()
->callAction('sendDigest', ['weekly' => 1]);
$tenant = $this->tenant->fresh();
$this->assertSame([3, true, 5, 18], [$tenant->reminder_interval_days, $tenant->digest_weekly, $tenant->digest_weekday, $tenant->digest_hour]);
$this->assertSame(['inbox', 'portals'], $tenant->digest_sections);
Mail::assertSent(Digest::class, fn (Digest $mail): bool => $mail->weekly);
}
private function openRequest(): Booking
{
return Booking::factory()->for($this->property)->reserved()->create(['guest_id' => Guest::factory()->create(['first_name' => 'Anna', 'last_name' => 'Anfrage'])->id]);
}
/**
* @param array<string, mixed> $attributes
*/
private function booking(array $attributes, string $name): Booking
{
[$first, $last] = explode(' ', $name);
return Booking::factory()->for($this->property)->create([
'status' => BookingStatus::Confirmed,
'guest_id' => Guest::factory()->create(['first_name' => $first, 'last_name' => $last])->id,
...$attributes,
]);
}
}
+176
View File
@@ -0,0 +1,176 @@
<?php
namespace Tests\Feature;
use App\Availability\NextFreeStays;
use App\Enums\BookingStatus;
use App\Enums\UserRole;
use App\Filament\Resources\Videos\Pages\EditVideo;
use App\Filament\Resources\Videos\VideoResource;
use App\Models\Booking;
use App\Models\FloorPlan;
use App\Models\Page;
use App\Models\Photo;
use App\Models\Property;
use App\Models\Site;
use App\Models\User;
use App\Models\Video;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Database\Seeders\SiteSeeder;
use Database\Seeders\WebsiteContentSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Livewire\Livewire;
use Tests\TestCase;
class VideoTourTest extends TestCase
{
use RefreshDatabase;
private Property $property;
protected function setUp(): void
{
parent::setUp();
Storage::fake('public');
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed([PropertySeeder::class, WebsiteContentSeeder::class, SiteSeeder::class]);
$this->withoutVite();
$this->property = Property::sole();
}
public function test_chapters_are_read_as_minutes_and_seconds_sorted_and_matched_to_rooms(): void
{
$video = Video::factory()->for($this->property)->create(['chapters' => [
['at' => '0:42', 'label' => 'Schlafzimmer', 'room' => 'Schlafzimmer'],
['at' => '16', 'label' => 'Wohnzimmer', 'room' => null],
['at' => 'gleich', 'label' => 'Ungültig'],
['at' => '1:05', 'label' => ''],
]]);
$this->assertSame([16, 42], array_column($video->chapterList(), 'seconds'));
$this->assertSame(['0:16', '0:42'], array_column($video->chapterList(), 'time'));
$this->assertSame(42, $video->chapterForRoom('schlafzimmer')['seconds']);
$this->assertNull($video->chapterForRoom('Bad'));
$this->assertSame(65, Video::seconds('1:05'));
$this->assertNull(Video::seconds('1:75'));
}
public function test_hero_plays_a_silent_loop_instead_of_the_photo_and_shows_the_next_free_dates(): void
{
$loop = $this->videoWithFiles('Garten und Meer');
Booking::factory()->for($this->property)->create(['arrival' => '2026-10-23', 'departure' => '2026-10-27', 'status' => BookingStatus::Confirmed]);
$this->updateSection('start', 'hero', ['video_id' => $loop->id, 'show_free_dates' => true, 'free_dates_nights' => 3]);
$stays = app(NextFreeStays::class)->for($this->property, nights: 3);
$this->assertCount(3, $stays);
$this->assertSame('2026-10-27', $stays[0]['arrival']->toDateString(), 'starts after the occupied nights');
$this->assertTrue($stays[1]['arrival']->greaterThanOrEqualTo($stays[0]['departure']), 'stays do not overlap');
$this->assertGreaterThanOrEqual(3, $stays[0]['nights']);
$this->get('/')
->assertOk()
->assertSee('data-video-loop', false)
->assertSee('data-src="'.$loop->url().'"', false)
->assertSee('aria-label="Video: Garten und Meer"', false)
->assertSee('Nächste freie Termine')
->assertSee(e($stays[0]['url']), false);
}
public function test_tour_section_offers_chapters_and_floor_plan_rooms_jump_into_it(): void
{
$tour = $this->videoWithFiles('Rundgang', [['at' => '0:16', 'label' => 'Wohnzimmer', 'room' => 'Wohnzimmer'], ['at' => '0:34', 'label' => 'Bad']]);
FloorPlan::factory()->for($this->property)->create([
'photo_id' => Photo::factory()->create()->id,
'rooms' => [['id' => 'a', 'name' => 'Wohnzimmer', 'points' => '10,10 40,10 40,40', 'is_visible' => true]],
]);
$page = Site::sole()->pages()->where('slug', 'wohnung')->sole();
$page->update(['sections' => [...$page->sections,
['type' => 'tour', 'data' => ['heading' => 'Kommen Sie herein', 'video_id' => $tour->id, 'layout' => 'right', 'show_chapters' => true]],
['type' => 'floor_plan', 'data' => ['heading' => 'Der Grundriss']],
]]);
$this->get('/wohnung')
->assertOk()
->assertSee('Kommen Sie herein')
->assertSee('preload="none"', false)
->assertSee('data-tour-seek="16"', false)
->assertSee('data-tour-seek="34"', false)
->assertSee('data-tour-link="16"', false)
->assertSee('Im Rundgang ansehen');
}
public function test_booking_section_shows_the_three_steps_unless_switched_off(): void
{
$this->get('/buchen')->assertOk()->assertSeeInOrder(['Anfrage senden', 'Angebot erhalten', 'Annehmen']);
$this->updateSection('buchen', 'booking', ['show_steps' => false]);
$this->get('/buchen')->assertOk()->assertDontSee('So läuft Ihre Buchung ab');
}
public function test_content_editor_uploads_a_video_with_poster_and_chapters(): void
{
$this->actingAs(User::factory()->role(UserRole::Content)->create());
$video = Video::factory()->for($this->property)->create(['title' => 'Rundgang']);
$this->get(VideoResource::getUrl('index'))->assertOk()->assertSee('Rundgang');
Livewire::test(EditVideo::class, ['record' => $video->id])
->fillForm([
'file' => UploadedFile::fake()->createWithContent('rundgang.mp4', (string) file_get_contents(base_path('tests/Fixtures/video.mp4'))),
'poster' => UploadedFile::fake()->image('standbild.jpg', 1280, 720),
'chapters' => [['at' => '0:7', 'label' => 'Garten']],
])
->call('save')
->assertHasFormErrors(['chapters.0.at']);
Livewire::test(EditVideo::class, ['record' => $video->id])
->fillForm([
'file' => UploadedFile::fake()->createWithContent('rundgang.mp4', (string) file_get_contents(base_path('tests/Fixtures/video.mp4'))),
'poster' => UploadedFile::fake()->image('standbild.jpg', 1280, 720),
'chapters' => [['at' => '0:07', 'label' => 'Garten', 'room' => null]],
])
->call('save')
->assertHasNoFormErrors();
$video->refresh();
$this->assertNotNull($video->url());
$this->assertNotNull($video->posterUrl());
$this->assertSame(7, $video->chapterList()[0]['seconds']);
}
public function test_uploads_allow_videos_up_to_100_mb(): void
{
$this->assertContains('max:102400', config('livewire.temporary_file_upload.rules'));
$this->assertSame(100 * 1024 * 1024, config('media-library.max_file_size'));
}
/**
* @param list<array<string, mixed>>|null $chapters
*/
private function videoWithFiles(string $title, ?array $chapters = null): Video
{
$video = Video::factory()->for($this->property)->create(['title' => $title, 'chapters' => $chapters]);
$video->addMedia(UploadedFile::fake()->createWithContent('video.mp4', (string) file_get_contents(base_path('tests/Fixtures/video.mp4'))))->toMediaCollection(Video::COLLECTION);
$video->addMedia(UploadedFile::fake()->image('poster.jpg', 640, 360))->toMediaCollection(Video::POSTER);
return $video->fresh();
}
/**
* @param array<string, mixed> $data
*/
private function updateSection(string $slug, string $type, array $data): void
{
$page = Site::sole()->pages()->where('slug', $slug)->sole();
$page->update(['sections' => array_map(
fn (array $section): array => $section['type'] === $type ? [...$section, 'data' => [...$section['data'], ...$data]] : $section,
$page->sections,
)]);
$this->assertInstanceOf(Page::class, $page);
}
}
Binary file not shown.