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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 11:01:52 +01:00

75 lines
3.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Themes\Sections;
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;
use Illuminate\Support\Str;
/**
* Interactive floor plan of the apartment (Admin › Webseite › Grundriss): guests tap a room and see its
* photos, equipment and accessibility hint. Without JavaScript the rooms are listed below the plan.
*/
class FloorPlanSection extends Section
{
public static function key(): string
{
return 'floor_plan';
}
public static function label(): string
{
return 'Grundriss (interaktiv)';
}
public static function icon(): string
{
return 'heroicon-o-map';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->default('Der Grundriss')->maxLength(120)
->helperText('Bild und Räume pflegen Sie unter Webseite › Grundriss.'),
Textarea::make('text')->label('Text')->rows(2)->maxLength(300)
->default('Tippen Sie auf einen Raum, um Fotos und Ausstattung zu sehen.'),
];
}
public function data(Theme $theme, array $data): array
{
$plan = $theme->property()?->floorPlan()->with('photo')->first();
$rooms = $plan?->photo ? $plan->visibleRooms() : collect();
$photos = Photo::query()->published()->with('media')
->whereIn('id', $rooms->flatMap(fn (array $room): array => $room['photo_ids'] ?? [])->unique()->all())
->get()->keyBy('id');
$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',
'text' => $data['text'] ?? null,
'photo' => $plan?->photo,
'rooms' => $rooms->map(fn (array $room, int $index): array => [
'key' => 'raum-'.Str::slug($room['name']).'-'.($index + 1),
'name' => $room['name'],
'description' => $room['description'] ?? null,
'hint' => $room['hint'] ?? null,
'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(),
]),
];
}
}