From d42c42059c8fc1407945b0c8567b5d2fa20a3587 Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 30 Oct 2026 11:01:33 +0100 Subject: [PATCH] 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 --- app/Availability/NextFreeStays.php | 103 ++++++++++ .../Resources/Videos/Pages/CreateVideo.php | 11 ++ .../Resources/Videos/Pages/EditVideo.php | 19 ++ .../Resources/Videos/Pages/ListVideos.php | 32 ++++ .../Resources/Videos/Schemas/VideoForm.php | 101 ++++++++++ .../Resources/Videos/Tables/VideosTable.php | 40 ++++ .../Resources/Videos/VideoResource.php | 57 ++++++ app/Models/Video.php | 146 +++++++++++++++ app/Policies/VideoPolicy.php | 13 ++ app/Themes/Sections/BookingSection.php | 17 +- app/Themes/Sections/FloorPlanSection.php | 3 + app/Themes/Sections/HeroSection.php | 31 ++- app/Themes/Sections/Section.php | 22 +++ app/Themes/Sections/TourSection.php | 72 +++++++ config/livewire.php | 30 +++ config/media-library.php | 2 +- config/themes.php | 1 + database/factories/VideoFactory.php | 25 +++ .../2026_10_30_104510_create_videos_table.php | 29 +++ docs/STATUS.md | 2 + docs/THEMES.md | 9 +- docs/ZUSAMMENARBEIT.md | 1 + resources/themes/ostsee-licht/theme.js | 95 ++++++++++ .../views/partials/free-stays.blade.php | 18 ++ .../views/partials/video-loop.blade.php | 15 ++ .../views/sections/booking.blade.php | 11 ++ .../views/sections/floor_plan.blade.php | 7 +- .../views/sections/hero.blade.php | 9 +- .../views/sections/tour.blade.php | 34 ++++ resources/themes/seebad/theme.css | 55 ++++++ .../views/partials/free-stays.blade.php | 19 ++ .../seebad/views/sections/booking.blade.php | 17 +- .../views/sections/floor_plan.blade.php | 3 + .../seebad/views/sections/hero.blade.php | 14 +- .../seebad/views/sections/tour.blade.php | 50 +++++ .../views/livewire/booking-request.blade.php | 13 +- tests/Feature/VideoTourTest.php | 176 ++++++++++++++++++ tests/Fixtures/video.mp4 | Bin 0 -> 2127 bytes 38 files changed, 1279 insertions(+), 23 deletions(-) create mode 100644 app/Availability/NextFreeStays.php create mode 100644 app/Filament/Resources/Videos/Pages/CreateVideo.php create mode 100644 app/Filament/Resources/Videos/Pages/EditVideo.php create mode 100644 app/Filament/Resources/Videos/Pages/ListVideos.php create mode 100644 app/Filament/Resources/Videos/Schemas/VideoForm.php create mode 100644 app/Filament/Resources/Videos/Tables/VideosTable.php create mode 100644 app/Filament/Resources/Videos/VideoResource.php create mode 100644 app/Models/Video.php create mode 100644 app/Policies/VideoPolicy.php create mode 100644 app/Themes/Sections/TourSection.php create mode 100644 config/livewire.php create mode 100644 database/factories/VideoFactory.php create mode 100644 database/migrations/2026_10_30_104510_create_videos_table.php create mode 100644 resources/themes/ostsee-licht/views/partials/free-stays.blade.php create mode 100644 resources/themes/ostsee-licht/views/partials/video-loop.blade.php create mode 100644 resources/themes/ostsee-licht/views/sections/tour.blade.php create mode 100644 resources/themes/seebad/views/partials/free-stays.blade.php create mode 100644 resources/themes/seebad/views/sections/tour.blade.php create mode 100644 tests/Feature/VideoTourTest.php create mode 100644 tests/Fixtures/video.mp4 diff --git a/app/Availability/NextFreeStays.php b/app/Availability/NextFreeStays.php new file mode 100644 index 0000000..fe37f15 --- /dev/null +++ b/app/Availability/NextFreeStays.php @@ -0,0 +1,103 @@ + + */ + 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 + */ + 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 $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; + } +} diff --git a/app/Filament/Resources/Videos/Pages/CreateVideo.php b/app/Filament/Resources/Videos/Pages/CreateVideo.php new file mode 100644 index 0000000..641ef1e --- /dev/null +++ b/app/Filament/Resources/Videos/Pages/CreateVideo.php @@ -0,0 +1,11 @@ +where(fn (Builder $query) => $query->where('property_id', $property->id)->orWhereNull('property_id')); + } + + protected function getHeaderActions(): array + { + return [ + CreateAction::make(), + ]; + } +} diff --git a/app/Filament/Resources/Videos/Schemas/VideoForm.php b/app/Filament/Resources/Videos/Schemas/VideoForm.php new file mode 100644 index 0000000..efb40e5 --- /dev/null +++ b/app/Filament/Resources/Videos/Schemas/VideoForm.php @@ -0,0 +1,101 @@ +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 + */ + 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() ?? []; + } +} diff --git a/app/Filament/Resources/Videos/Tables/VideosTable.php b/app/Filament/Resources/Videos/Tables/VideosTable.php new file mode 100644 index 0000000..dd87a42 --- /dev/null +++ b/app/Filament/Resources/Videos/Tables/VideosTable.php @@ -0,0 +1,40 @@ +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(), + ]); + } +} diff --git a/app/Filament/Resources/Videos/VideoResource.php b/app/Filament/Resources/Videos/VideoResource.php new file mode 100644 index 0000000..e8ca3aa --- /dev/null +++ b/app/Filament/Resources/Videos/VideoResource.php @@ -0,0 +1,57 @@ + ListVideos::route('/'), + 'create' => CreateVideo::route('/create'), + 'edit' => EditVideo::route('/{record}/edit'), + ]; + } +} diff --git a/app/Models/Video.php b/app/Models/Video.php new file mode 100644 index 0000000..da87861 --- /dev/null +++ b/app/Models/Video.php @@ -0,0 +1,146 @@ +|null $chapters + */ +#[Fillable(['property_id', 'title', 'chapters'])] +class Video extends Model implements HasMedia +{ + /** @use HasFactory */ + 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 + */ + 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 + */ + 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 + */ + 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; + } +} diff --git a/app/Policies/VideoPolicy.php b/app/Policies/VideoPolicy.php new file mode 100644 index 0000000..520468e --- /dev/null +++ b/app/Policies/VideoPolicy.php @@ -0,0 +1,13 @@ + 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(), ]; } diff --git a/app/Themes/Sections/FloorPlanSection.php b/app/Themes/Sections/FloorPlanSection.php index 2853ac2..f49710a 100644 --- a/app/Themes/Sections/FloorPlanSection.php +++ b/app/Themes/Sections/FloorPlanSection.php @@ -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(), ]), ]; } diff --git a/app/Themes/Sections/HeroSection.php b/app/Themes/Sections/HeroSection.php index 80a5782..a5c41ba 100644 --- a/app/Themes/Sections/HeroSection.php +++ b/app/Themes/Sections/HeroSection.php @@ -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, ]; } } diff --git a/app/Themes/Sections/Section.php b/app/Themes/Sections/Section.php index cbdd31e..7dd4b4c 100644 --- a/app/Themes/Sections/Section.php +++ b/app/Themes/Sections/Section.php @@ -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. */ diff --git a/app/Themes/Sections/TourSection.php b/app/Themes/Sections/TourSection.php new file mode 100644 index 0000000..75a9bb9 --- /dev/null +++ b/app/Themes/Sections/TourSection.php @@ -0,0 +1,72 @@ + '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', + ]; + } +} diff --git a/config/livewire.php b/config/livewire.php new file mode 100644 index 0000000..bf54d9e --- /dev/null +++ b/config/livewire.php @@ -0,0 +1,30 @@ + [ + '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, + ], + +]; diff --git a/config/media-library.php b/config/media-library.php index df8aad6..cef4d74 100644 --- a/config/media-library.php +++ b/config/media-library.php @@ -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. diff --git a/config/themes.php b/config/themes.php index 0036819..7599f7b 100644 --- a/config/themes.php +++ b/config/themes.php @@ -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, diff --git a/database/factories/VideoFactory.php b/database/factories/VideoFactory.php new file mode 100644 index 0000000..d00effd --- /dev/null +++ b/database/factories/VideoFactory.php @@ -0,0 +1,25 @@ + + */ +class VideoFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + 'title' => fake()->sentence(3), + 'chapters' => null, + ]; + } +} diff --git a/database/migrations/2026_10_30_104510_create_videos_table.php b/database/migrations/2026_10_30_104510_create_videos_table.php new file mode 100644 index 0000000..f04809e --- /dev/null +++ b/database/migrations/2026_10_30_104510_create_videos_table.php @@ -0,0 +1,29 @@ +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'); + } +}; diff --git a/docs/STATUS.md b/docs/STATUS.md index 8d82433..0e0a8f3 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -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. diff --git a/docs/THEMES.md b/docs/THEMES.md index f5b196a..94669ea 100644 --- a/docs/THEMES.md +++ b/docs/THEMES.md @@ -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), `$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: `` | | `amenities` | Ausstattung | `$heading`, `$groups` (Bereich ⇒ Collection) | -| `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, `amenities` – Collection). 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, `amenities` – Collection). `videoChapter` – Kapitel eines Rundgang-Videos mit diesem Raum: `seconds`, `time`, `label` oder null → Link ` +@endif diff --git a/resources/themes/ostsee-licht/views/partials/video-loop.blade.php b/resources/themes/ostsee-licht/views/partials/video-loop.blade.php new file mode 100644 index 0000000..12df3dd --- /dev/null +++ b/resources/themes/ostsee-licht/views/partials/video-loop.blade.php @@ -0,0 +1,15 @@ +{{-- + Silent video loop in place of a photo (hero). Variables: $video (App\Models\Video), $class (sizes the