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>
This commit is contained in:
1 parent
f5f18cd984
commit
d42c42059c
38 files changed
+1279
-23
No files matched your search
@@ -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() ?? [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user