Titelvideo, Rundgang und Buchungsseite zusammenfuehren
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m4s

This commit is contained in:
Lars committed 2026-10-30 11:01:52 +01:00
commit b5ff837dcd
38 files changed
+1279 -23

No files matched your search

+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;
}
}
@@ -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'),
];
}
}
+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;
}
}
+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,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');
}
};
+2
View File
@@ -1,5 +1,7 @@
# 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.
+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 ([
+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.