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:
LarsandClaude Opus 5.5 committed 2026-10-30 11:01:52 +01:00
1 parent f5f18cd984
commit d42c42059c
38 files changed
+1279 -23

No files matched your search

@@ -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'),
];
}
}