Theme-System mit Basis-Theme Ostsee-Licht, Bausteinen und saisonalen Erscheinungsbildern

- Sites (Domain, Theme, Farben; mehrfähig für weitere Vermieter), Seiten aus Bausteinen mit Menüs, Erscheinungsbilder mit jährlichem Zeitplan, Priorität und signierter Vorschau
- Theme-Kern (app/Themes): Manifest, Registry, Vererbung (Child-Themes), Token-Farben als CSS-Variablen, Bausteinkatalog als Registry (config/themes.php)
- 15 Bausteine: Titelbereich mit Suche, Eckdaten, Text mit Bildern, Galerie, Ausstattung, Lage, Preise, Angebote, Kalender & Anfrage, Bewertungen, Gastgeber, FAQ, Abschluss, Kontakt, Fließtext
- Theme Ostsee-Licht: Layout, Kopf/Fuß, Banner, mobile Buchungsleiste, Lightbox, selbst gehostete Schriften, Reduced Motion
- Seiten Start, Wohnung, Kühlungsborn, Preise & Buchung, Kontakt, Impressum, Datenschutz; Sitemap, robots.txt, JSON-LD
- Admin: Seiten-Baukasten, Erscheinungsbilder, Websites
- Dokumentation docs/THEMES.md inkl. Übergabe für die Design-Sitzung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 15:04:21 +02:00
1 parent f2c48013ad
commit 66e82d61f5
119 files changed
+4066 -481

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ # Ferienwohnung Stommer
- Business operations live in `app/Actions` (CreateReservation, ConfirmBooking, …); Filament pages and Livewire components call them instead of changing bookings directly.
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts.
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
- Git remote: Gitea `https://gitea.stommer.de/Lars/fewo-stommer.git`, branch `main`.
+1
View File
@@ -12,6 +12,7 @@ # Ferienwohnung Stommer
- Business operations live in `app/Actions` (CreateReservation, ConfirmBooking, …); Filament pages and Livewire components call them instead of changing bookings directly.
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts.
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
- Git remote: Gitea `https://gitea.stommer.de/Lars/fewo-stommer.git`, branch `main`.
+1 -1
View File
@@ -39,7 +39,7 @@ class EditContent extends Page
protected static ?string $slug = 'texte';
protected static ?int $navigationSort = 2;
protected static ?int $navigationSort = 3;
/** @var array<string, ?string> */
public array $data = [];
@@ -27,7 +27,7 @@ class AmenityResource extends Resource
protected static ?string $pluralModelLabel = 'Ausstattung';
protected static ?int $navigationSort = 3;
protected static ?int $navigationSort = 4;
public static function form(Schema $schema): Schema
{
@@ -0,0 +1,57 @@
<?php
namespace App\Filament\Resources\Appearances;
use App\Filament\Resources\Appearances\Pages\CreateAppearance;
use App\Filament\Resources\Appearances\Pages\EditAppearance;
use App\Filament\Resources\Appearances\Pages\ListAppearances;
use App\Filament\Resources\Appearances\Schemas\AppearanceForm;
use App\Filament\Resources\Appearances\Tables\AppearancesTable;
use App\Models\Appearance;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
class AppearanceResource extends Resource
{
protected static ?string $model = Appearance::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSwatch;
protected static string|UnitEnum|null $navigationGroup = 'Webseite';
protected static ?string $modelLabel = 'Erscheinungsbild';
protected static ?string $pluralModelLabel = 'Erscheinungsbilder';
protected static ?int $navigationSort = 1;
public static function form(Schema $schema): Schema
{
return AppearanceForm::configure($schema);
}
public static function table(Table $table): Table
{
return AppearancesTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListAppearances::route('/'),
'create' => CreateAppearance::route('/create'),
'edit' => EditAppearance::route('/{record}/edit'),
];
}
}
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Appearances\Pages;
use App\Filament\Resources\Appearances\AppearanceResource;
use Filament\Resources\Pages\CreateRecord;
class CreateAppearance extends CreateRecord
{
protected static string $resource = AppearanceResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Appearances\Pages;
use App\Filament\Resources\Appearances\AppearanceResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditAppearance extends EditRecord
{
protected static string $resource = AppearanceResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Appearances\Pages;
use App\Filament\Resources\Appearances\AppearanceResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListAppearances extends ListRecords
{
protected static string $resource = AppearanceResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}
@@ -0,0 +1,110 @@
<?php
namespace App\Filament\Resources\Appearances\Schemas;
use App\Models\Appearance;
use App\Models\Photo;
use App\Models\Site;
use App\Models\SpecialOffer;
use App\Themes\ThemeRegistry;
use Closure;
use Filament\Forms\Components\ColorPicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
class AppearanceForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(2)
->components([
Section::make('Zeitraum')
->description('Wiederholt sich jedes Jahr. Überschneiden sich Zeiträume, gilt die höhere Priorität (z. B. Silvester vor Winter). Ohne Zeitraum greift das Standard-Erscheinungsbild.')
->columns(2)
->schema([
TextInput::make('name')->label('Name')->placeholder('z. B. Weihnachten')->required()->maxLength(60),
Select::make('site_id')
->label('Website')
->options(fn (): array => Site::query()->pluck('name', 'id')->all())
->default(fn (): ?int => Site::query()->where('is_default', true)->value('id'))
->required(),
self::dayField('starts_md', 'Von (TT.MM.)'),
self::dayField('ends_md', 'Bis einschließlich (TT.MM.)'),
TextInput::make('priority')->label('Priorität')->integer()->minValue(0)->default(10),
Toggle::make('is_default')->label('Standard (wenn kein Zeitraum passt)')->inline(false),
Toggle::make('is_active')->label('Aktiv')->default(true)->inline(false),
]),
Section::make('Bild & Angebot')
->columns(2)
->schema([
Select::make('hero_photo_id')
->label('Titelbild')
->options(fn (): array => Photo::query()->orderBy('category')->orderBy('sort_order')->pluck('alt_text', 'id')->all())
->searchable()
->placeholder('Bild der Seite verwenden'),
Select::make('featured_offer_id')
->label('Hervorgehobenes Sonderangebot')
->options(fn (): array => SpecialOffer::query()->where('is_active', true)->pluck('name', 'id')->all())
->placeholder('keins'),
]),
Section::make('Texte')
->description('Leer lassen = Text der Seite bzw. kein Banner.')
->columns(2)
->collapsible()
->schema(collect(Appearance::OVERRIDABLE)
->map(fn (string $label, string $key) => TextInput::make('overrides.'.$key)->label($label)->maxLength(255))
->values()
->all()),
Section::make('Farben')
->description('Nur ändern, was anders aussehen soll; leere Felder übernehmen die Farben des Themes.')
->columns(3)
->collapsible()
->collapsed()
->schema(fn (Get $get): array => self::tokenFields($get('site_id'))),
]);
}
/**
* @return list<ColorPicker>
*/
public static function tokenFields(int|string|null $siteId, string $statePath = 'tokens'): array
{
$theme = Site::find($siteId)?->theme ?? config('themes.base');
return collect(app(ThemeRegistry::class)->get($theme)->tokens)
->map(fn (array $token, string $key): ColorPicker => ColorPicker::make("{$statePath}.{$key}")->label($token['label'])->placeholder($token['default']))
->values()
->all();
}
/**
* Day of the year entered as "TT.MM." and stored as "MM-DD".
*/
private static function dayField(string $name, string $label): TextInput
{
return TextInput::make($name)
->label($label)
->placeholder('24.12.')
->formatStateUsing(fn (?string $state): ?string => $state ? substr($state, 3, 2).'.'.substr($state, 0, 2).'.' : null)
->dehydrateStateUsing(fn (?string $state): ?string => self::toMonthDay($state))
->rule(fn (): Closure => function (string $attribute, mixed $value, Closure $fail): void {
if (filled($value) && self::toMonthDay((string) $value) === null) {
$fail('Bitte als TT.MM. eingeben, z. B. 24.12.');
}
});
}
private static function toMonthDay(?string $value): ?string
{
if (blank($value) || ! preg_match('/^\s*(\d{1,2})\.(\d{1,2})\.?\s*$/', $value, $match)) {
return null;
}
return checkdate((int) $match[2], (int) $match[1], 2024) ? sprintf('%02d-%02d', $match[2], $match[1]) : null;
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Filament\Resources\Appearances\Tables;
use App\Models\Appearance;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
use Illuminate\Support\Facades\URL;
class AppearancesTable
{
public static function configure(Table $table): Table
{
return $table
->defaultSort('priority', 'desc')
->description('Die Webseite wechselt automatisch nach Datum. Mit „Vorschau“ sehen Sie ein Erscheinungsbild schon vorher.')
->columns([
TextColumn::make('name')->label('Erscheinungsbild')->weight('medium'),
TextColumn::make('period')
->label('Zeitraum')
->state(fn (Appearance $record): string => $record->is_default && ! $record->starts_md ? 'Standard' : self::day($record->starts_md).' – '.self::day($record->ends_md)),
TextColumn::make('priority')->label('Priorität')->sortable(),
IconColumn::make('current')
->label('Jetzt aktiv')
->boolean()
->state(fn (Appearance $record): bool => $record->site?->appearanceOn(today())?->is($record) ?? false),
ToggleColumn::make('is_active')->label('Aktiv'),
])
->recordActions([
Action::make('preview')
->label('Vorschau')
->icon(Heroicon::OutlinedEye)
->color('gray')
->url(fn (Appearance $record): string => URL::temporarySignedRoute('home', now()->addDay(), ['vorschau' => $record->id]), shouldOpenInNewTab: true),
EditAction::make(),
DeleteAction::make()->visible(fn (Appearance $record): bool => ! $record->is_default),
]);
}
private static function day(?string $monthDay): string
{
return $monthDay ? substr($monthDay, 3, 2).'.'.substr($monthDay, 0, 2).'.' : '?';
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ class FaqResource extends Resource
protected static ?string $pluralModelLabel = 'Häufige Fragen';
protected static ?int $navigationSort = 4;
protected static ?int $navigationSort = 5;
public static function form(Schema $schema): Schema
{
@@ -27,7 +27,7 @@ class NoticeResource extends Resource
protected static ?string $pluralModelLabel = 'Hinweis-Banner';
protected static ?int $navigationSort = 5;
protected static ?int $navigationSort = 6;
public static function form(Schema $schema): Schema
{
@@ -0,0 +1,57 @@
<?php
namespace App\Filament\Resources\Pages;
use App\Filament\Resources\Pages\Pages\CreatePage;
use App\Filament\Resources\Pages\Pages\EditPage;
use App\Filament\Resources\Pages\Pages\ListPages;
use App\Filament\Resources\Pages\Schemas\PageForm;
use App\Filament\Resources\Pages\Tables\PagesTable;
use App\Models\Page;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
class PageResource extends Resource
{
protected static ?string $model = Page::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentDuplicate;
protected static string|UnitEnum|null $navigationGroup = 'Webseite';
protected static ?string $modelLabel = 'Seite';
protected static ?string $pluralModelLabel = 'Seiten';
protected static ?int $navigationSort = 0;
public static function form(Schema $schema): Schema
{
return PageForm::configure($schema);
}
public static function table(Table $table): Table
{
return PagesTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListPages::route('/'),
'create' => CreatePage::route('/create'),
'edit' => EditPage::route('/{record}/edit'),
];
}
}
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Pages\Pages;
use App\Filament\Resources\Pages\PageResource;
use Filament\Resources\Pages\CreateRecord;
class CreatePage extends CreateRecord
{
protected static string $resource = PageResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Pages\Pages;
use App\Filament\Resources\Pages\PageResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditPage extends EditRecord
{
protected static string $resource = PageResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Pages\Pages;
use App\Filament\Resources\Pages\PageResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListPages extends ListRecords
{
protected static string $resource = PageResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}
@@ -0,0 +1,67 @@
<?php
namespace App\Filament\Resources\Pages\Schemas;
use App\Models\Page;
use App\Models\Site;
use App\Themes\SectionRegistry;
use Filament\Forms\Components\Builder;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Illuminate\Validation\Rules\Unique;
class PageForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(3)
->components([
Section::make('Bausteine')
->description('Die Seite besteht aus Bausteinen. Reihenfolge per Ziehen, Inhalte je Baustein. Wie sie aussehen, bestimmt das Theme.')
->columnSpan(2)
->schema([
Builder::make('sections')
->hiddenLabel()
->blocks(fn (): array => app(SectionRegistry::class)->blocks())
->addActionLabel('Baustein hinzufügen')
->collapsible()
->collapsed()
->cloneable()
->blockNumbers(false)
->blockPickerColumns(2),
]),
Section::make('Seite')
->columnSpan(1)
->schema([
Hidden::make('site_id')->default(fn (): ?int => Site::query()->where('is_default', true)->value('id') ?? Site::query()->value('id')),
TextInput::make('title')->label('Titel')->required()->maxLength(120),
TextInput::make('slug')
->label('Adresse')
->prefix('/')
->helperText('Die Startseite heißt „start“.')
->required()
->alphaDash()
->maxLength(80)
->disabled(fn (?Page $record): bool => $record?->isHome() ?? false)
->dehydrated()
->unique(ignoreRecord: true, modifyRuleUsing: fn (Unique $rule, callable $get) => $rule->where('site_id', $get('site_id'))),
TextInput::make('menu_label')->label('Name im Menü (optional)')->maxLength(60),
Select::make('menu_location')->label('Menü')->options(Page::MENU_LOCATIONS)->default('main')->required(),
Toggle::make('is_published')->label('Veröffentlicht')->default(true),
]),
Section::make('Suchmaschinen')
->columnSpan(1)
->collapsed()
->schema([
TextInput::make('seo_title')->label('Seitentitel (Google)')->maxLength(70),
Textarea::make('seo_description')->label('Beschreibung (Google)')->rows(3)->maxLength(170),
]),
]);
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Filament\Resources\Pages\Tables;
use App\Models\Page;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
class PagesTable
{
public static function configure(Table $table): Table
{
return $table
->reorderable('sort_order')
->defaultSort('sort_order')
->paginated(false)
->description('Reihenfolge per Ziehen = Reihenfolge im Menü.')
->columns([
TextColumn::make('title')->label('Seite')->weight('medium')->description(fn (Page $record): string => $record->isHome() ? '/' : '/'.$record->slug),
TextColumn::make('menu_location')->label('Menü')->formatStateUsing(fn (string $state): string => Page::MENU_LOCATIONS[$state] ?? $state)->badge(),
TextColumn::make('sections')->label('Bausteine')->state(fn (Page $record): int => count($record->sections ?? [])),
ToggleColumn::make('is_published')->label('Veröffentlicht'),
])
->recordActions([
Action::make('open')
->label('Ansehen')
->icon(Heroicon::OutlinedArrowTopRightOnSquare)
->color('gray')
->url(fn (Page $record): string => $record->url(), shouldOpenInNewTab: true),
EditAction::make(),
DeleteAction::make()->visible(fn (Page $record): bool => ! $record->isHome()),
]);
}
}
@@ -27,7 +27,7 @@ class PhotoResource extends Resource
protected static ?string $pluralModelLabel = 'Bilder';
protected static ?int $navigationSort = 1;
protected static ?int $navigationSort = 2;
public static function form(Schema $schema): Schema
{
@@ -3,6 +3,8 @@
namespace App\Filament\Resources\Properties\Schemas;
use App\Filament\Forms\Components\EuroInput;
use App\Models\Site;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\TimePicker;
use Filament\Forms\Components\Toggle;
@@ -46,6 +48,10 @@ public static function configure(Schema $schema): Schema
TimePicker::make('check_out_time')
->label('Abreise bis')
->seconds(false),
Select::make('site_id')
->label('Website')
->options(fn (): array => Site::query()->pluck('name', 'id')->all())
->placeholder('keine'),
Toggle::make('is_active')
->label('Aktiv (auf der Webseite buchbar)')
->default(true),
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Sites\Pages;
use App\Filament\Resources\Sites\SiteResource;
use Filament\Resources\Pages\CreateRecord;
class CreateSite extends CreateRecord
{
protected static string $resource = SiteResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Sites\Pages;
use App\Filament\Resources\Sites\SiteResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditSite extends EditRecord
{
protected static string $resource = SiteResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Sites\Pages;
use App\Filament\Resources\Sites\SiteResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListSites extends ListRecords
{
protected static string $resource = SiteResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Filament\Resources\Sites\Schemas;
use App\Filament\Resources\Appearances\Schemas\AppearanceForm;
use App\Models\Site;
use App\Themes\ThemeRegistry;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
class SiteForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(2)
->components([
Section::make('Website')
->columns(2)
->schema([
TextInput::make('name')->label('Name')->required()->maxLength(120),
TextInput::make('domain')
->label('Domain')
->placeholder('www.fewo-stommer.de')
->helperText('Leer = Standard-Website für alle Adressen ohne eigene Zuordnung.')
->unique(ignoreRecord: true)
->maxLength(190),
Select::make('theme')->label('Theme')->options(fn (): array => app(ThemeRegistry::class)->options())->default(config('themes.base'))->required()->live(),
Toggle::make('is_default')->label('Standard-Website')->inline(false),
]),
Section::make('Farben des Themes')
->description('Grundfarben dieser Website; saisonale Erscheinungsbilder können einzelne Farben zusätzlich ändern.')
->columns(3)
->collapsible()
->schema(fn (Get $get, ?Site $record): array => AppearanceForm::tokenFields($record?->id, 'theme_settings.tokens')),
]);
}
}
@@ -0,0 +1,57 @@
<?php
namespace App\Filament\Resources\Sites;
use App\Filament\Resources\Sites\Pages\CreateSite;
use App\Filament\Resources\Sites\Pages\EditSite;
use App\Filament\Resources\Sites\Pages\ListSites;
use App\Filament\Resources\Sites\Schemas\SiteForm;
use App\Filament\Resources\Sites\Tables\SitesTable;
use App\Models\Site;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
class SiteResource extends Resource
{
protected static ?string $model = Site::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedGlobeAlt;
protected static string|UnitEnum|null $navigationGroup = 'System';
protected static ?string $modelLabel = 'Website';
protected static ?string $pluralModelLabel = 'Websites';
protected static ?int $navigationSort = 2;
public static function form(Schema $schema): Schema
{
return SiteForm::configure($schema);
}
public static function table(Table $table): Table
{
return SitesTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListSites::route('/'),
'create' => CreateSite::route('/create'),
'edit' => EditSite::route('/{record}/edit'),
];
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Filament\Resources\Sites\Tables;
use App\Themes\ThemeRegistry;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class SitesTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('name')->label('Website')->weight('medium'),
TextColumn::make('domain')->label('Domain')->placeholder('alle übrigen Adressen'),
TextColumn::make('theme')->label('Theme')->formatStateUsing(fn (string $state): string => app(ThemeRegistry::class)->get($state)->name),
TextColumn::make('properties_count')->label('Wohnungen')->counts('properties'),
IconColumn::make('is_default')->label('Standard')->boolean(),
])
->recordActions([
EditAction::make(),
]);
}
}
+97
View File
@@ -0,0 +1,97 @@
<?php
namespace App\Http\Controllers;
use App\Models\Page;
use App\Support\Content;
use App\Themes\SectionRegistry;
use App\Themes\Theme;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Response;
/**
* Renders the website pages of the current site with the active theme.
*/
class PageController extends Controller
{
public function __construct(private SectionRegistry $sections) {}
/**
* Resolved per call: the controller is built before the middleware has determined site and appearance.
*/
private function theme(): Theme
{
return app(Theme::class);
}
public function home(): View
{
return $this->show(Page::HOME);
}
public function show(string $slug): View
{
abort_unless($this->theme()->site->exists, 404);
$page = $this->theme()->site->pages()
->where('slug', $slug)
->where('is_published', true)
->firstOrFail();
return view('theme::page', [
'page' => $page,
'sections' => $this->sections->render($this->theme(), $page->sections),
'title' => $page->isHome() ? null : ($page->seo_title ?: $page->title),
'description' => $page->seo_description ?: ($page->isHome() ? Content::get('seo.home.description') : null),
'ogImage' => $this->theme()->heroPhoto()?->url('lg') ?: null,
'structuredData' => $page->isHome() ? $this->structuredData() : null,
]);
}
public function sitemap(): Response
{
$pages = $this->theme()->site->exists
? $this->theme()->site->pages()->where('is_published', true)->get()
: collect();
return response()->view('sitemap', ['pages' => $pages], 200, ['Content-Type' => 'application/xml']);
}
public function robots(): Response
{
return response(implode("\n", [
'User-agent: *',
'Disallow: /admin',
'Disallow: /livewire',
'Disallow: /automation',
'Disallow: /bewertung',
'Disallow: /angebote',
'Sitemap: '.route('sitemap'),
'',
]), 200, ['Content-Type' => 'text/plain; charset=UTF-8']);
}
/**
* schema.org data of the property for search engines.
*
* @return array<string, mixed>|null
*/
private function structuredData(): ?array
{
$property = $this->theme()->property();
if ($property === null) {
return null;
}
return array_filter([
'@context' => 'https://schema.org',
'@type' => 'VacationRental',
'name' => $property->name,
'url' => route('home'),
'image' => $this->theme()->heroPhoto()?->url('lg') ?: null,
'address' => ['@type' => 'PostalAddress', 'streetAddress' => str($property->address)->before(',')->trim()->toString(), 'addressLocality' => 'Kühlungsborn', 'postalCode' => '18225', 'addressCountry' => 'DE'],
'containsPlace' => ['@type' => 'Accommodation', 'floorSize' => ['@type' => 'QuantitativeValue', 'value' => $property->size_sqm, 'unitCode' => 'MTK'], 'occupancy' => ['@type' => 'QuantitativeValue', 'maxValue' => $property->max_guests]],
'telephone' => config('fewo.owner.phone'),
]);
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use App\Themes\Theme;
use App\Themes\ThemeFactory;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Determines site, theme and appearance for the website and activates the "theme::" views.
*/
class ResolveTheme
{
public function __construct(private ThemeFactory $factory) {}
public function handle(Request $request, Closure $next): Response
{
app()->instance(Theme::class, $this->factory->forRequest($request)->activate());
return $next($request);
}
}
+21
View File
@@ -84,6 +84,7 @@ public function mount(?Property $property = null): void
{
$this->propertyId = ($property ?? Property::query()->where('is_active', true)->firstOrFail())->id;
$this->month = CarbonImmutable::today()->format('Y-m');
$this->prefillFromSearch();
$this->utm = collect(request()->only(['utm_source', 'utm_medium', 'utm_campaign']))
->filter(fn ($value): bool => is_string($value) && $value !== '')
->map(fn (string $value): string => mb_substr($value, 0, 100))
@@ -314,6 +315,26 @@ private function stayRequest(): StayRequest
);
}
/**
* Dates and guests from the availability search of the hero section (?anreise=…&abreise=…&personen=…).
*/
private function prefillFromSearch(): void
{
$arrival = rescue(fn () => CarbonImmutable::createFromFormat('!Y-m-d', (string) request()->query('anreise')) ?: null, null, false);
$departure = rescue(fn () => CarbonImmutable::createFromFormat('!Y-m-d', (string) request()->query('abreise')) ?: null, null, false);
if ($arrival && $departure && $departure->greaterThan($arrival) && $arrival->greaterThanOrEqualTo(CarbonImmutable::today())) {
$this->arrival = $arrival->toDateString();
$this->departure = $departure->toDateString();
$this->month = $arrival->format('Y-m');
}
$guests = (int) request()->query('personen');
if ($guests >= 1 && $guests <= $this->property->max_guests) {
$this->guests = $guests;
}
}
private function firstMonth(): CarbonImmutable
{
return CarbonImmutable::createFromFormat('!Y-m', $this->month);
+95
View File
@@ -0,0 +1,95 @@
<?php
namespace App\Models;
use Carbon\CarbonInterface;
use Database\Factories\AppearanceFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* A seasonal look of a site (e.g. summer, winter, Christmas, New Year's Eve): colour tokens, hero photo,
* texts and banner change – the page structure does not. The period recurs every year ("MM-DD" to "MM-DD",
* inclusive; a period may run over the turn of the year). The default appearance applies when none matches.
*/
#[Fillable(['site_id', 'name', 'starts_md', 'ends_md', 'priority', 'is_default', 'is_active', 'tokens', 'overrides', 'hero_photo_id', 'featured_offer_id'])]
class Appearance extends Model
{
/** @use HasFactory<AppearanceFactory> */
use HasFactory;
/**
* Texts an appearance can replace, with their admin labels. Sections read them through Theme::text().
*/
public const OVERRIDABLE = [
'banner.text' => 'Banner: Text',
'banner.link_label' => 'Banner: Link-Text',
'banner.link_url' => 'Banner: Link-Ziel',
'hero.eyebrow' => 'Titelbereich: kleine Überschrift',
'hero.title' => 'Titelbereich: Überschrift',
'hero.text' => 'Titelbereich: Text',
'cta.title' => 'Abschluss: Überschrift',
'cta.text' => 'Abschluss: Text',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_default' => 'boolean',
'is_active' => 'boolean',
'tokens' => 'array',
'overrides' => 'array',
];
}
/**
* @return BelongsTo<Site, $this>
*/
public function site(): BelongsTo
{
return $this->belongsTo(Site::class);
}
/**
* @return BelongsTo<Photo, $this>
*/
public function heroPhoto(): BelongsTo
{
return $this->belongsTo(Photo::class, 'hero_photo_id');
}
/**
* @return BelongsTo<SpecialOffer, $this>
*/
public function featuredOffer(): BelongsTo
{
return $this->belongsTo(SpecialOffer::class, 'featured_offer_id');
}
public function covers(CarbonInterface $date): bool
{
if ($this->starts_md === null || $this->ends_md === null) {
return false;
}
$day = $date->format('m-d');
return $this->starts_md <= $this->ends_md
? $day >= $this->starts_md && $day <= $this->ends_md
: $day >= $this->starts_md || $day <= $this->ends_md;
}
public function override(string $key): ?string
{
$value = data_get($this->overrides, $key);
return filled($value) ? (string) $value : null;
}
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace App\Models;
use Database\Factories\PageFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* A page of a site, composed of sections from the catalogue (App\Themes\Sections).
* sections = list of {type: string, data: array} as stored by the Filament builder.
* The home page has the slug "start" and is served at "/".
*/
#[Fillable(['site_id', 'slug', 'title', 'menu_label', 'menu_location', 'sort_order', 'is_published', 'sections', 'seo_title', 'seo_description'])]
class Page extends Model
{
/** @use HasFactory<PageFactory> */
use HasFactory;
public const HOME = 'start';
/** Menu locations a page can appear in. */
public const MENU_LOCATIONS = ['main' => 'Hauptmenü', 'footer' => 'Fußzeile', 'none' => 'Nicht im Menü'];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_published' => 'boolean',
'sections' => 'array',
];
}
/**
* @return BelongsTo<Site, $this>
*/
public function site(): BelongsTo
{
return $this->belongsTo(Site::class);
}
public function isHome(): bool
{
return $this->slug === self::HOME;
}
public function url(): string
{
return $this->isHome() ? route('home') : route('page', ['slug' => $this->slug]);
}
public function label(): string
{
return $this->menu_label ?: $this->title;
}
}
+1
View File
@@ -13,6 +13,7 @@
* A rentable holiday apartment. All money amounts are stored in euro cents.
*/
#[Fillable([
'site_id',
'name',
'slug',
'address',
+81
View File
@@ -0,0 +1,81 @@
<?php
namespace App\Models;
use Carbon\CarbonInterface;
use Database\Factories\SiteFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* A website: domain, theme with its settings, pages and appearances, and the properties it shows.
* Today there is one site; more sites allow other landlords to use the system under their own domain.
*/
#[Fillable(['name', 'domain', 'is_default', 'theme', 'theme_settings', 'locale'])]
class Site extends Model
{
/** @use HasFactory<SiteFactory> */
use HasFactory;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_default' => 'boolean',
'theme_settings' => 'array',
];
}
/**
* @return HasMany<Page, $this>
*/
public function pages(): HasMany
{
return $this->hasMany(Page::class)->orderBy('sort_order');
}
/**
* @return HasMany<Appearance, $this>
*/
public function appearances(): HasMany
{
return $this->hasMany(Appearance::class);
}
/**
* @return HasMany<Property, $this>
*/
public function properties(): HasMany
{
return $this->hasMany(Property::class);
}
/**
* The property sections show when they do not name one (the first active property).
*/
public function primaryProperty(): ?Property
{
return $this->properties()->where('is_active', true)->orderBy('id')->first()
?? Property::query()->where('is_active', true)->whereNull('site_id')->orderBy('id')->first();
}
/**
* The appearance in effect on $date: the active seasonal one with the highest priority, else the default.
*/
public function appearanceOn(CarbonInterface $date): ?Appearance
{
$appearances = $this->appearances()->where('is_active', true)->get();
return $appearances
->filter(fn (Appearance $appearance): bool => $appearance->covers($date))
->sortByDesc('priority')
->first()
?? $appearances->firstWhere('is_default', true);
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Policies;
use App\Enums\UserRole;
class AppearancePolicy extends RolePolicy
{
protected function roles(): array
{
return [UserRole::Content];
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Policies;
use App\Enums\UserRole;
class PagePolicy extends RolePolicy
{
protected function roles(): array
{
return [UserRole::Content];
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace App\Policies;
class SitePolicy extends RolePolicy
{
protected function roles(): array
{
return [];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Providers;
use App\Themes\SectionRegistry;
use App\Themes\Theme;
use App\Themes\ThemeFactory;
use App\Themes\ThemeRegistry;
use Illuminate\Support\ServiceProvider;
class ThemeServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton(ThemeRegistry::class);
$this->app->singleton(SectionRegistry::class);
// Outside web requests (console, tests, mails) the default site's theme is used.
$this->app->singleton(Theme::class, fn ($app): Theme => $app->make(ThemeFactory::class)
->forSite($app->make(ThemeFactory::class)->site())
->activate());
}
}
+3 -1
View File
@@ -32,7 +32,9 @@ public static function get(string $key): ?string
*/
public static function html(string $key): HtmlString
{
return new HtmlString(RichContentRenderer::make(self::get($key) ?? '')->toHtml());
$value = self::get($key);
return new HtmlString(filled($value) ? RichContentRenderer::make($value)->toHtml() : '');
}
public static function photo(string $key): ?Photo
+71
View File
@@ -0,0 +1,71 @@
<?php
namespace App\Themes;
use App\Themes\Sections\Section;
use Filament\Forms\Components\Builder\Block;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\View as ViewFactory;
/**
* The section catalogue from config/themes.php: builder blocks for the admin and rendering for the website.
*/
class SectionRegistry
{
/**
* @return array<string, class-string<Section>>
*/
public function all(): array
{
return collect(config('themes.sections'))
->mapWithKeys(fn (string $class): array => [$class::key() => $class])
->all();
}
public function get(string $key): ?Section
{
$class = $this->all()[$key] ?? null;
return $class ? app($class) : null;
}
/**
* @return list<Block>
*/
public function blocks(): array
{
return array_values(array_map(
fn (string $class): Block => Block::make($class::key())
->label($class::label())
->icon($class::icon())
->schema($class::schema()),
$this->all(),
));
}
/**
* Renders the stored sections of a page; unknown or failing types are skipped (and reported),
* so a page never breaks because of one section.
*
* @param list<array{type: string, data?: array<string, mixed>}>|null $sections
* @return list<View>
*/
public function render(Theme $theme, ?array $sections): array
{
$views = [];
foreach ($sections ?? [] as $index => $stored) {
$section = $this->get($stored['type'] ?? '');
if ($section === null || ! ViewFactory::exists($section->view())) {
continue;
}
$views[] = ViewFactory::make($section->view(), [
...$section->data($theme, $stored['data'] ?? []),
'theme' => $theme,
'sectionId' => $section::key().'-'.$index,
]);
}
return $views;
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
/**
* The equipment list grouped by room (Admin › Webseite › Ausstattung).
*/
class AmenitiesSection extends Section
{
public static function key(): string
{
return 'amenities';
}
public static function label(): string
{
return 'Ausstattung';
}
public static function icon(): string
{
return 'heroicon-o-list-bullet';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->default('Ausstattung')->maxLength(120),
Toggle::make('highlights_only')->label('Nur Highlights zeigen'),
];
}
public function data(Theme $theme, array $data): array
{
$amenities = $theme->property()?->amenities()
->when($data['highlights_only'] ?? false, fn ($query) => $query->where('is_highlight', true))
->get() ?? collect();
return [
'heading' => $data['heading'] ?? 'Ausstattung',
'groups' => $amenities->groupBy(fn ($amenity): string => $amenity->area->getLabel()),
];
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
/**
* Availability calendar, live price and booking request (Livewire component App\Livewire\BookingRequest).
*/
class BookingSection extends Section
{
public static function key(): string
{
return 'booking';
}
public static function label(): string
{
return 'Kalender & Anfrage';
}
public static function icon(): string
{
return 'heroicon-o-calendar-days';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->default('Preise & Buchung')->maxLength(120),
Textarea::make('text')->label('Text')->rows(2),
];
}
public function data(Theme $theme, array $data): array
{
return [
'heading' => $data['heading'] ?? null,
'text' => $data['text'] ?? null,
'property' => $theme->property(),
];
}
}
@@ -0,0 +1,51 @@
<?php
namespace App\Themes\Sections;
use App\Models\Photo;
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
/**
* Closing invitation with photo and button; seasonal appearances may replace the texts.
*/
class CallToActionSection extends Section
{
public static function key(): string
{
return 'cta';
}
public static function label(): string
{
return 'Abschluss mit Aufruf';
}
public static function icon(): string
{
return 'heroicon-o-cursor-arrow-rays';
}
public static function schema(): array
{
return [
TextInput::make('title')->label('Überschrift')->required()->maxLength(160),
Textarea::make('text')->label('Text')->rows(2),
static::photoSelect('photo_id', 'Hintergrundfoto'),
TextInput::make('button_label')->label('Button-Text')->default('Belegung & Preise')->maxLength(60),
static::pageSelect('button_page', 'Button führt zu'),
];
}
public function data(Theme $theme, array $data): array
{
return [
'title' => $theme->text('cta.title', $data['title'] ?? null),
'text' => $theme->text('cta.text', $data['text'] ?? null),
'photo' => isset($data['photo_id']) ? Photo::find($data['photo_id']) : null,
'buttonLabel' => $data['button_label'] ?? 'Belegung & Preise',
'buttonUrl' => $this->pageUrl($data['button_page'] ?? null) ?? route('booking.create'),
];
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
/**
* Contact details of the landlord and the property address.
*/
class ContactSection extends Section
{
public static function key(): string
{
return 'contact';
}
public static function label(): string
{
return 'Kontakt';
}
public static function icon(): string
{
return 'heroicon-o-envelope';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->default('Kontakt')->maxLength(120),
Textarea::make('text')->label('Text')->rows(2),
];
}
public function data(Theme $theme, array $data): array
{
return [
'heading' => $data['heading'] ?? null,
'text' => $data['text'] ?? null,
'owner' => config('fewo.owner'),
'address' => $theme->property()?->address,
];
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\TextInput;
/**
* Key facts of the property (size, guests, highlights) – taken from the property and its equipment.
*/
class FactsSection extends Section
{
public static function key(): string
{
return 'facts';
}
public static function label(): string
{
return 'Eckdaten';
}
public static function icon(): string
{
return 'heroicon-o-squares-2x2';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift (optional)')->maxLength(120),
];
}
public function data(Theme $theme, array $data): array
{
$property = $theme->property();
return [
'heading' => $data['heading'] ?? null,
'property' => $property,
'highlights' => $property?->amenities()->where('is_highlight', true)->limit(6)->pluck('name') ?? collect(),
'fromPrice' => $property?->seasons()->whereDate('ends_on', '>', today())->min('nightly_rate'),
];
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Themes\Sections;
use App\Models\Faq;
use App\Themes\Theme;
use Filament\Forms\Components\TextInput;
/**
* Frequently asked questions (Admin › Webseite › Häufige Fragen), with FAQ structured data.
*/
class FaqSection extends Section
{
public static function key(): string
{
return 'faq';
}
public static function label(): string
{
return 'Häufige Fragen';
}
public static function icon(): string
{
return 'heroicon-o-question-mark-circle';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->default('Häufige Fragen')->maxLength(120),
];
}
public function data(Theme $theme, array $data): array
{
$faqs = Faq::query()->published()->get();
return [
'heading' => $data['heading'] ?? null,
'faqs' => $faqs,
'answers' => $faqs->mapWithKeys(fn (Faq $faq): array => [$faq->id => $this->html($faq->answer)]),
];
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Themes\Sections;
use App\Enums\PhotoCategory;
use App\Models\Photo;
use App\Themes\Theme;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
/**
* Photo gallery of one category (or all), opened in a lightbox.
*/
class GallerySection extends Section
{
public static function key(): string
{
return 'gallery';
}
public static function label(): string
{
return 'Bildergalerie';
}
public static function icon(): string
{
return 'heroicon-o-rectangle-group';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->maxLength(120),
Select::make('category')->label('Bilder')->options(['all' => 'Alle', ...collect(PhotoCategory::cases())->mapWithKeys(fn (PhotoCategory $category): array => [$category->value => $category->getLabel()])->all()])->default('all'),
TextInput::make('limit')->label('Anzahl (leer = alle)')->integer()->minValue(1),
];
}
public function data(Theme $theme, array $data): array
{
$category = PhotoCategory::tryFrom($data['category'] ?? '');
return [
'heading' => $data['heading'] ?? null,
'photos' => Photo::query()->published()->with('media')
->when($category, fn ($query) => $query->where('category', $category))
->when(filled($data['limit'] ?? null), fn ($query) => $query->limit((int) $data['limit']))
->get(),
];
}
}
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Themes\Sections;
use App\Models\Photo;
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
/**
* Large photo with headline and the availability search. Seasonal appearances replace photo and texts.
*/
class HeroSection extends Section
{
public static function key(): string
{
return 'hero';
}
public static function label(): string
{
return 'Titelbereich mit Suche';
}
public static function icon(): string
{
return 'heroicon-o-photo';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('title')->label('Überschrift')->helperText('*Wort* wird hervorgehoben (kursiv).')->required()->maxLength(160),
Textarea::make('text')->label('Text')->rows(2)->maxLength(400),
static::photoSelect('photo_id', 'Foto (wenn das Erscheinungsbild keins vorgibt)'),
Toggle::make('show_search')->label('Verfügbarkeitssuche anzeigen')->default(true),
];
}
public function data(Theme $theme, array $data): array
{
$fallback = isset($data['photo_id']) ? Photo::find($data['photo_id']) : Photo::query()->published()->first();
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' => $theme->heroPhoto($fallback),
'showSearch' => (bool) ($data['show_search'] ?? true),
'property' => $theme->property(),
];
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Themes\Sections;
use App\Support\Content;
use App\Themes\Theme;
use Filament\Forms\Components\TextInput;
/**
* The host: quote, text and photo from Admin › Texte › Gastgeber.
*/
class HostSection extends Section
{
public static function key(): string
{
return 'host';
}
public static function label(): string
{
return 'Gastgeber';
}
public static function icon(): string
{
return 'heroicon-o-user';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Kleine Überschrift')->default('Ihre Gastgeberin')->maxLength(100),
];
}
public function data(Theme $theme, array $data): array
{
return [
'heading' => $data['heading'] ?? null,
'quote' => Content::get('host.quote'),
'text' => Content::html('host.text'),
'photo' => Content::photo('host.photo'),
'name' => config('fewo.owner.name'),
];
}
}
+57
View File
@@ -0,0 +1,57 @@
<?php
namespace App\Themes\Sections;
use App\Enums\PhotoCategory;
use App\Models\Photo;
use App\Themes\Theme;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
/**
* Location: text, photos of the area and a map link (no embedded third-party map, so no consent needed).
*/
class LocationSection extends Section
{
public static function key(): string
{
return 'location';
}
public static function label(): string
{
return 'Lage & Umgebung';
}
public static function icon(): string
{
return 'heroicon-o-map-pin';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->required()->maxLength(160),
RichEditor::make('text')->label('Text')->toolbarButtons([['bold', 'italic', 'link'], ['bulletList']]),
Toggle::make('show_photos')->label('Bilder der Umgebung zeigen')->default(true),
];
}
public function data(Theme $theme, array $data): array
{
$address = $theme->property()?->address;
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? '',
'text' => $this->html($data['text'] ?? null),
'address' => $address,
'mapUrl' => $address ? 'https://www.openstreetmap.org/search?query='.rawurlencode($address) : null,
'photos' => ($data['show_photos'] ?? true)
? Photo::query()->published()->with('media')->where('category', PhotoCategory::Area)->limit(6)->get()
: collect(),
];
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace App\Themes\Sections;
use App\Models\SpecialOffer;
use App\Themes\Theme;
use Filament\Forms\Components\TextInput;
/**
* Public special offers (active, promoted, without code); the appearance's featured offer comes first.
*/
class OffersSection extends Section
{
public static function key(): string
{
return 'offers';
}
public static function label(): string
{
return 'Sonderangebote';
}
public static function icon(): string
{
return 'heroicon-o-sparkles';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->default('Aktuelle Angebote')->maxLength(120),
];
}
public function data(Theme $theme, array $data): array
{
$offers = $theme->property()?->specialOffers()
->active()
->where('is_public', true)
->whereNull('code')
->where(fn ($query) => $query->whereNull('bookable_until')->orWhere('bookable_until', '>=', now()))
->get() ?? collect();
$featured = $theme->appearance?->featuredOffer;
if ($featured) {
$offers = $offers->reject(fn (SpecialOffer $offer): bool => $offer->is($featured))->prepend($featured);
}
return [
'heading' => $data['heading'] ?? null,
'offers' => $offers,
'featuredId' => $featured?->id,
];
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
/**
* Season prices of the next twelve months, cleaning fee and extras – always the current price list.
*/
class PricesSection extends Section
{
public static function key(): string
{
return 'prices';
}
public static function label(): string
{
return 'Preise & Saisons';
}
public static function icon(): string
{
return 'heroicon-o-currency-euro';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->default('Preise')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->default('Transparent, ohne Überraschungen.')->maxLength(160),
Textarea::make('text')->label('Text')->rows(2),
];
}
public function data(Theme $theme, array $data): array
{
$property = $theme->property();
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? '',
'text' => $data['text'] ?? null,
'property' => $property,
'seasons' => $property?->seasons()->whereDate('ends_on', '>', today())->whereDate('starts_on', '<', today()->addYear())->get() ?? collect(),
'extras' => $property?->extras()->active()->get() ?? collect(),
'featuredSeason' => $theme->appearance?->name,
];
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Themes\Sections;
use App\Models\Review;
use App\Themes\Theme;
use Filament\Forms\Components\TextInput;
/**
* Approved guest reviews with average ratings and the legally required note on verification (§ 5b UWG).
*/
class ReviewsSection extends Section
{
public static function key(): string
{
return 'reviews';
}
public static function label(): string
{
return 'Gästebewertungen';
}
public static function icon(): string
{
return 'heroicon-o-star';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->default('Das sagen unsere Gäste')->maxLength(120),
TextInput::make('limit')->label('Anzahl')->integer()->minValue(1)->default(6),
];
}
public function data(Theme $theme, array $data): array
{
$published = Review::query()->published()
->when($theme->property(), fn ($query, $property) => $query->whereBelongsTo($property));
return [
'heading' => $data['heading'] ?? null,
'reviews' => (clone $published)->limit((int) ($data['limit'] ?? 6))->get(),
'count' => (clone $published)->count(),
'average' => round((float) (clone $published)->avg('rating'), 1),
'categories' => collect(Review::CATEGORIES)
->map(fn (string $label, string $field): array => ['label' => $label, 'average' => round((float) (clone $published)->avg($field), 1)])
->filter(fn (array $category): bool => $category['average'] > 0)
->values(),
];
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
namespace App\Themes\Sections;
use App\Support\Content;
use App\Themes\Theme;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Utilities\Get;
/**
* Plain text page content – own text or one of the central texts (imprint, privacy policy, house rules …).
*/
class RichTextSection extends Section
{
/** Central texts that can be shown by reference, so they are maintained in one place. */
public const SOURCES = [
'own' => 'Eigener Text',
'legal.imprint' => 'Impressum (Texte › Rechtliches)',
'legal.privacy' => 'Datenschutzerklärung (Texte › Rechtliches)',
'stay.house_rules' => 'Hausregeln (Texte › Aufenthalt)',
'stay.cancellation' => 'Stornobedingungen (Texte › Aufenthalt)',
];
public static function key(): string
{
return 'rich_text';
}
public static function label(): string
{
return 'Fließtext';
}
public static function icon(): string
{
return 'heroicon-o-bars-3-bottom-left';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->maxLength(160),
Select::make('source')->label('Inhalt')->options(self::SOURCES)->default('own')->live(),
RichEditor::make('text')
->label('Text')
->visible(fn (Get $get): bool => ($get('source') ?? 'own') === 'own')
->toolbarButtons([['bold', 'italic', 'link'], ['h2', 'h3'], ['bulletList', 'orderedList']]),
];
}
public function data(Theme $theme, array $data): array
{
$source = $data['source'] ?? 'own';
return [
'heading' => $data['heading'] ?? null,
'text' => $source === 'own' || ! array_key_exists($source, self::SOURCES)
? $this->html($data['text'] ?? null)
: (filled(Content::get($source)) ? Content::html($source) : null),
];
}
}
+109
View File
@@ -0,0 +1,109 @@
<?php
namespace App\Themes\Sections;
use App\Models\Page;
use App\Models\Photo;
use App\Themes\Theme;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Filament\Forms\Components\Select;
use Filament\Schemas\Components\Component;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\HtmlString;
/**
* A building block of pages. A section prepares data; how it looks is up to the theme's
* view "theme::sections.<key>". Register new sections in config/themes.php.
*/
abstract class Section
{
abstract public static function key(): string;
abstract public static function label(): string;
/**
* Heroicon name shown in the page builder.
*/
public static function icon(): string
{
return 'heroicon-o-square-3-stack-3d';
}
/**
* Admin fields of the section (builder block schema). Field names are keys of $data in data().
*
* @return list<Component>
*/
public static function schema(): array
{
return [];
}
/**
* Variables for the view.
*
* @param array<string, mixed> $data what the admin entered
* @return array<string, mixed>
*/
abstract public function data(Theme $theme, array $data): array;
public function view(): string
{
return 'theme::sections.'.static::key();
}
/**
* Sanitised HTML of a rich text field.
*/
protected function html(?string $value): ?HtmlString
{
return filled($value) ? new HtmlString(RichContentRenderer::make($value)->toHtml()) : null;
}
/**
* @param list<int|string>|null $ids
* @return Collection<int, Photo>
*/
protected function photos(?array $ids): Collection
{
if (blank($ids)) {
return new Collection;
}
$photos = Photo::query()->published()->whereKey($ids)->with('media')->get()->keyBy('id');
return new Collection(array_values(array_filter(array_map(fn ($id) => $photos->get((int) $id), $ids))));
}
protected function pageUrl(?string $slug): ?string
{
if (blank($slug)) {
return null;
}
return $slug === Page::HOME ? route('home') : route('page', ['slug' => $slug]);
}
/**
* Select field listing the website photos.
*/
protected static function photoSelect(string $name, string $label, bool $multiple = false): Select
{
return Select::make($name)
->label($label)
->options(fn (): array => Photo::query()->orderBy('category')->orderBy('sort_order')->pluck('alt_text', 'id')->all())
->multiple($multiple)
->searchable();
}
/**
* Select field listing the pages of the site, for links.
*/
protected static function pageSelect(string $name, string $label): Select
{
return Select::make($name)
->label($label)
->options(fn (): array => Page::query()->orderBy('sort_order')->pluck('title', 'slug')->all())
->searchable();
}
}
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
/**
* Heading and text next to up to three photos, optionally with a link to another page.
*/
class TextImageSection extends Section
{
public static function key(): string
{
return 'text_image';
}
public static function label(): string
{
return 'Text mit Bildern';
}
public static function icon(): string
{
return 'heroicon-o-document-text';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->required()->maxLength(160),
RichEditor::make('text')->label('Text')->toolbarButtons([['bold', 'italic', 'link'], ['bulletList', 'orderedList']]),
static::photoSelect('photo_ids', 'Bilder (bis zu 3)', multiple: true)->maxItems(3),
Select::make('image_position')->label('Bilder')->options(['right' => 'rechts', 'left' => 'links'])->default('right'),
TextInput::make('link_label')->label('Link-Text')->maxLength(80),
static::pageSelect('link_page', 'Link zur Seite'),
];
}
public function data(Theme $theme, array $data): array
{
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? '',
'text' => $this->html($data['text'] ?? null),
'photos' => $this->photos($data['photo_ids'] ?? []),
'imagePosition' => $data['image_position'] ?? 'right',
'linkLabel' => $data['link_label'] ?? null,
'linkUrl' => $this->pageUrl($data['link_page'] ?? null),
];
}
}
+142
View File
@@ -0,0 +1,142 @@
<?php
namespace App\Themes;
use App\Models\Appearance;
use App\Models\Page;
use App\Models\Photo;
use App\Models\Property;
use App\Models\Site;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\View;
/**
* The theme context of the current request: site, theme chain and appearance. Activating it registers the
* view namespace "theme::" with the theme's own views first, then its parents, then the base theme.
*/
class Theme
{
private ?Property $property = null;
private bool $propertyResolved = false;
/** @var array<string, Collection<int, Page>> */
private array $menus = [];
public function __construct(
private ThemeRegistry $registry,
public readonly Site $site,
public readonly ?Appearance $appearance,
public readonly bool $isPreview = false,
) {}
public function activate(): self
{
$paths = array_map(fn (ThemeManifest $theme): string => $theme->viewsPath(), $this->chain());
View::replaceNamespace('theme', $paths);
return $this;
}
public function manifest(): ThemeManifest
{
return $this->registry->get($this->site->theme ?: config('themes.base'));
}
/**
* @return list<ThemeManifest>
*/
public function chain(): array
{
return $this->registry->chain($this->manifest()->key);
}
/**
* Colour tokens: theme defaults (base first, then children), site settings, appearance.
*
* @return array<string, string>
*/
public function tokens(): array
{
$tokens = [];
foreach (array_reverse($this->chain()) as $theme) {
foreach ($theme->tokens as $key => $token) {
$tokens[$key] = $token['default'];
}
}
$overrides = [...($this->site->theme_settings['tokens'] ?? []), ...($this->appearance?->tokens ?? [])];
foreach ($overrides as $key => $value) {
if (isset($tokens[$key]) && is_string($value) && preg_match('/^#[0-9a-fA-F]{3,8}$/', $value)) {
$tokens[$key] = $value;
}
}
return $tokens;
}
/**
* ":root{--ground:#F6F2EA;…}" for an inline <style> in the layout.
*/
public function cssVariables(): string
{
return ':root{'.collect($this->tokens())->map(fn (string $value, string $key): string => "--{$key}:{$value}")->implode(';').'}';
}
/**
* The appearance's replacement for a text, else $fallback.
*/
public function text(string $key, ?string $fallback = null): ?string
{
return $this->appearance?->override($key) ?? $fallback;
}
public function heroPhoto(?Photo $fallback = null): ?Photo
{
return $this->appearance?->heroPhoto ?? $fallback;
}
public function appearanceKey(): string
{
return $this->appearance ? str($this->appearance->name)->slug()->toString() : 'standard';
}
public function property(): ?Property
{
if (! $this->propertyResolved) {
$this->property = $this->site->exists ? $this->site->primaryProperty() : Property::query()->where('is_active', true)->first();
$this->propertyResolved = true;
}
return $this->property;
}
/**
* Published pages of a menu location ("main" or "footer").
*
* @return Collection<int, Page>
*/
public function menu(string $location): Collection
{
return $this->menus[$location] ??= $this->site->exists
? $this->site->pages()->where('is_published', true)->where('menu_location', $location)->get()
: collect();
}
/**
* Vite entry points of the active theme (a child theme without own assets uses its parent's).
*
* @return list<string>
*/
public function assets(): array
{
foreach ($this->chain() as $theme) {
$assets = array_values(array_filter([$theme->assets['css'] ?? null, $theme->assets['js'] ?? null]));
if ($assets !== []) {
return $assets;
}
}
return [];
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace App\Themes;
use App\Models\Appearance;
use App\Models\Site;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Schema;
/**
* Builds the theme context: the site by host name (else the default site), the appearance in effect today –
* or the one named in a signed preview link (?vorschau=<id>).
*/
class ThemeFactory
{
public function __construct(private ThemeRegistry $registry) {}
public function forRequest(Request $request): Theme
{
$site = $this->site($request->getHost());
$preview = null;
if ($request->query('vorschau') && $request->hasValidSignature()) {
$preview = $site->appearances()->find($request->query('vorschau'));
}
return $this->forSite($site, $preview);
}
public function forSite(Site $site, ?Appearance $preview = null): Theme
{
return new Theme(
$this->registry,
$site,
$preview ?? ($site->exists ? $site->appearanceOn(today()) : null),
isPreview: $preview !== null,
);
}
public function site(?string $host = null): Site
{
if (! Schema::hasTable('sites')) {
return $this->fallbackSite();
}
return ($host ? Site::query()->where('domain', $host)->first() : null)
?? Site::query()->where('is_default', true)->first()
?? Site::query()->orderBy('id')->first()
?? $this->fallbackSite();
}
private function fallbackSite(): Site
{
return new Site(['name' => config('app.name'), 'theme' => config('themes.base')]);
}
}
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace App\Themes;
use InvalidArgumentException;
/**
* The contents of a theme's theme.json.
*/
final readonly class ThemeManifest
{
/**
* @param array<string, array{label: string, default: string}> $tokens colour tokens, exposed as CSS variables --<key>
* @param array{css?: string, js?: string} $assets Vite entry points relative to the project root
*/
public function __construct(
public string $key,
public string $name,
public string $version,
public ?string $parent,
public string $description,
public array $tokens,
public array $assets,
public string $path,
) {}
public static function fromFile(string $file): self
{
$data = json_decode((string) file_get_contents($file), true, flags: JSON_THROW_ON_ERROR);
if (! is_array($data) || blank($data['key'] ?? null) || blank($data['name'] ?? null)) {
throw new InvalidArgumentException("Invalid theme manifest [{$file}]: key and name are required.");
}
return new self(
key: $data['key'],
name: $data['name'],
version: $data['version'] ?? '0.0.0',
parent: $data['parent'] ?? null,
description: $data['description'] ?? '',
tokens: $data['tokens'] ?? [],
assets: $data['assets'] ?? [],
path: dirname($file),
);
}
public function viewsPath(): string
{
return $this->path.DIRECTORY_SEPARATOR.'views';
}
}
+67
View File
@@ -0,0 +1,67 @@
<?php
namespace App\Themes;
/**
* Discovers the themes below config('themes.paths').
*/
class ThemeRegistry
{
/** @var array<string, ThemeManifest>|null */
private ?array $themes = null;
/**
* @return array<string, ThemeManifest>
*/
public function all(): array
{
if ($this->themes === null) {
$this->themes = [];
foreach (config('themes.paths') as $path) {
foreach (glob(rtrim($path, '/\\').'/*/theme.json') ?: [] as $file) {
$manifest = ThemeManifest::fromFile($file);
$this->themes[$manifest->key] = $manifest;
}
}
}
return $this->themes;
}
public function get(string $key): ThemeManifest
{
return $this->all()[$key] ?? $this->all()[config('themes.base')];
}
/**
* The theme followed by its ancestors, ending with the base theme.
*
* @return list<ThemeManifest>
*/
public function chain(string $key): array
{
$chain = [];
$current = $this->get($key);
while (! isset($chain[$current->key])) {
$chain[$current->key] = $current;
if ($current->parent === null || ! isset($this->all()[$current->parent])) {
break;
}
$current = $this->all()[$current->parent];
}
$base = $this->get(config('themes.base'));
$chain[$base->key] ??= $base;
return array_values($chain);
}
/**
* @return array<string, string>
*/
public function options(): array
{
return array_map(fn (ThemeManifest $theme): string => "{$theme->name} ({$theme->version})", $this->all());
}
}
+2 -1
View File
@@ -1,5 +1,6 @@
<?php
use App\Http\Middleware\ResolveTheme;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
@@ -12,7 +13,7 @@
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
$middleware->web(append: [ResolveTheme::class]);
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->shouldRenderJsonWhen(
+7 -2
View File
@@ -1,6 +1,11 @@
<?php
use App\Providers\AppServiceProvider;
use App\Providers\Filament\AdminPanelProvider;
use App\Providers\ThemeServiceProvider;
return [
App\Providers\AppServiceProvider::class,
App\Providers\Filament\AdminPanelProvider::class,
AppServiceProvider::class,
AdminPanelProvider::class,
ThemeServiceProvider::class,
];
+2 -31
View File
@@ -5,6 +5,8 @@
| Editable website texts
|--------------------------------------------------------------------------
|
| Central texts used in several places (mails, contract, legal pages, SEO).
| Page texts live in the page sections (Admin › Webseite › Seiten).
| Every field becomes an input on the admin page "Webseiten-Texte", grouped
| by section. Types: text, textarea, richtext (sanitised HTML), photo (id of
| a Photo). The default is shown until a value has been saved.
@@ -13,37 +15,6 @@
return [
'home' => [
'label' => 'Startseite',
'fields' => [
'home.hero.eyebrow' => ['label' => 'Kleine Überschrift', 'type' => 'text', 'default' => 'Ostseebad Kühlungsborn'],
'home.hero.title' => ['label' => 'Hauptüberschrift', 'type' => 'text', 'default' => 'Ihr Zuhause zwischen Garten und Meer'],
'home.hero.text' => ['label' => 'Einleitungstext', 'type' => 'textarea', 'default' => '53 m² im Erdgeschoss, eigene Terrasse mit Blick auf Teich und Garten – ruhig gelegen in der Strandstraße.'],
'home.hero.photo' => ['label' => 'Titelbild', 'type' => 'photo'],
'home.intro.title' => ['label' => 'Abschnitt „Die Wohnung“: Überschrift', 'type' => 'text', 'default' => 'Ankommen, Tür auf, Terrasse – und durchatmen.'],
'home.intro.text' => ['label' => 'Abschnitt „Die Wohnung“: Text', 'type' => 'richtext', 'default' => '<p>Helles Wohnzimmer mit Ledersofa und Schrankbett, ein ruhiges Schlafzimmer mit Verdunkelung, eine voll ausgestattete Küche mit Geschirrspüler und ein Bad mit bodennaher Dusche.</p>'],
'home.location.title' => ['label' => 'Abschnitt „Lage“: Überschrift', 'type' => 'text', 'default' => 'Kühlungsborn – Strand, Hafen und Bäderarchitektur.'],
'home.location.text' => ['label' => 'Abschnitt „Lage“: Text', 'type' => 'richtext', 'default' => '<p>Zu Fuß an die Ostsee, zum Bootshafen in Kühlungsborn Ost oder mit der Dampflok „Molli“ nach Bad Doberan.</p>'],
],
],
'apartment' => [
'label' => 'Die Wohnung',
'fields' => [
'apartment.title' => ['label' => 'Überschrift', 'type' => 'text', 'default' => 'Die Wohnung'],
'apartment.text' => ['label' => 'Beschreibung', 'type' => 'richtext', 'default' => '<p>Unsere 53 m² große Ferienwohnung liegt im Erdgeschoss und bietet Platz für ein bis drei Personen. Wohnzimmer, Schlafzimmer, Küche mit Essbereich, Diele, Bad und eine eigene Terrasse mit Blick auf Teich und Garten.</p>'],
'apartment.floorplan' => ['label' => 'Grundriss', 'type' => 'photo'],
],
],
'area' => [
'label' => 'Kühlungsborn',
'fields' => [
'area.title' => ['label' => 'Überschrift', 'type' => 'text', 'default' => 'Kühlungsborn & Umgebung'],
'area.text' => ['label' => 'Text', 'type' => 'richtext', 'default' => '<p>Kühlungsborn ist eines der schönsten Ostseebäder – mit breitem Sandstrand, Strandpromenade, Bootshafen und prachtvoller Bäderarchitektur.</p>'],
],
],
'host' => [
'label' => 'Gastgeber',
'fields' => [
+54
View File
@@ -0,0 +1,54 @@
<?php
use App\Themes\Sections;
return [
/*
|--------------------------------------------------------------------------
| Themes
|--------------------------------------------------------------------------
|
| Every folder below one of these paths that contains a theme.json is a
| theme. A theme may name a parent; views it does not provide are taken
| from the parent and finally from the base theme. See docs/THEMES.md.
|
*/
'paths' => [
resource_path('themes'),
],
// Complete theme every other theme falls back to; also used when a site names an unknown theme.
'base' => 'ostsee-licht',
/*
|--------------------------------------------------------------------------
| Section catalogue
|--------------------------------------------------------------------------
|
| The building blocks pages are composed of. Each class describes its
| admin form and prepares the data its view (theme::sections.<key>) needs.
| Plugins add sections by appending their class here.
|
*/
'sections' => [
Sections\HeroSection::class,
Sections\FactsSection::class,
Sections\TextImageSection::class,
Sections\GallerySection::class,
Sections\AmenitiesSection::class,
Sections\LocationSection::class,
Sections\PricesSection::class,
Sections\OffersSection::class,
Sections\BookingSection::class,
Sections\ReviewsSection::class,
Sections\HostSection::class,
Sections\FaqSection::class,
Sections\CallToActionSection::class,
Sections\ContactSection::class,
Sections\RichTextSection::class,
],
];
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace Database\Factories;
use App\Models\Appearance;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Appearance>
*/
class AppearanceFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'site_id' => Site::factory(),
'name' => fake()->word(),
'priority' => 0,
'is_default' => false,
'is_active' => true,
];
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Database\Factories;
use App\Models\Page;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Page>
*/
class PageFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'site_id' => Site::factory(),
'slug' => fake()->unique()->slug(2),
'title' => fake()->words(2, true),
'menu_location' => 'main',
'is_published' => true,
'sections' => [],
];
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Database\Factories;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Site>
*/
class SiteFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->company(),
'domain' => null,
'is_default' => false,
'theme' => 'ostsee-licht',
];
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('sites', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('domain')->nullable()->unique();
$table->boolean('is_default')->default(false);
$table->string('theme');
$table->json('theme_settings')->nullable();
$table->string('locale', 5)->default('de');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sites');
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pages', function (Blueprint $table) {
$table->id();
$table->foreignId('site_id')->constrained()->cascadeOnDelete();
$table->string('slug');
$table->string('title');
$table->string('menu_label')->nullable();
$table->string('menu_location')->default('main');
$table->unsignedSmallInteger('sort_order')->default(0);
$table->boolean('is_published')->default(true);
$table->json('sections')->nullable();
$table->string('seo_title')->nullable();
$table->string('seo_description')->nullable();
$table->timestamps();
$table->unique(['site_id', 'slug']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pages');
}
};
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('appearances', function (Blueprint $table) {
$table->id();
$table->foreignId('site_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->string('starts_md', 5)->nullable();
$table->string('ends_md', 5)->nullable();
$table->unsignedSmallInteger('priority')->default(0);
$table->boolean('is_default')->default(false);
$table->boolean('is_active')->default(true);
$table->json('tokens')->nullable();
$table->json('overrides')->nullable();
$table->foreignId('hero_photo_id')->nullable()->constrained('photos')->nullOnDelete();
$table->foreignId('featured_offer_id')->nullable()->constrained('special_offers')->nullOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('appearances');
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('properties', function (Blueprint $table) {
$table->foreignId('site_id')->nullable()->after('id')->constrained()->nullOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('properties', function (Blueprint $table) {
$table->dropConstrainedForeignId('site_id');
});
}
};
+1 -1
View File
@@ -22,6 +22,6 @@ public function run(): void
'role' => UserRole::Admin,
]);
$this->call([PropertySeeder::class, WebsiteContentSeeder::class]);
$this->call([PropertySeeder::class, WebsiteContentSeeder::class, SiteSeeder::class]);
}
}
+184
View File
@@ -0,0 +1,184 @@
<?php
namespace Database\Seeders;
use App\Models\Page;
use App\Models\Property;
use App\Models\Site;
use Illuminate\Database\Seeder;
use Illuminate\Support\Arr;
/**
* The website: one site with the theme "Ostsee-Licht", its pages built from sections and the seasonal appearances.
* Texts are taken over from the previous website and the approved design draft.
*/
class SiteSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$site = Site::create([
'name' => 'Ferienwohnung Stommer',
'domain' => null,
'is_default' => true,
'theme' => 'ostsee-licht',
]);
Property::query()->whereNull('site_id')->update(['site_id' => $site->id]);
foreach ($this->pages() as $sort => $page) {
$site->pages()->create([...$page, 'sort_order' => $sort]);
}
foreach ($this->appearances() as $appearance) {
$site->appearances()->create([...$appearance, 'overrides' => Arr::undot($appearance['overrides'] ?? [])]);
}
}
/**
* @return list<array<string, mixed>>
*/
private function pages(): array
{
$cta = ['type' => 'cta', 'data' => ['title' => 'Ihr Wunschtermin ist frei?', 'text' => 'Termin wählen, Preis sehen, unverbindlich vormerken – wir bestätigen kurzfristig.', 'button_label' => 'Belegung & Preise', 'button_page' => 'buchen']];
return [
[
'slug' => Page::HOME,
'title' => 'Startseite',
'menu_location' => 'none',
'sections' => [
['type' => 'hero', 'data' => ['eyebrow' => 'Ostseebad Kühlungsborn', 'title' => 'Ihr Zuhause zwischen *Garten* und Meer', 'text' => '53 m² im Erdgeschoss, eigene Terrasse mit Blick auf Teich und Garten – ruhig gelegen in der Strandstraße.', 'show_search' => true]],
['type' => 'facts', 'data' => []],
['type' => 'text_image', 'data' => ['eyebrow' => 'Die Wohnung', 'heading' => 'Ankommen, Tür auf, Terrasse – und durchatmen.', 'text' => '<p>Helles Wohnzimmer mit Ledersofa und Schrankbett, ein ruhiges Schlafzimmer mit Verdunkelung, eine voll ausgestattete Küche mit Geschirrspüler und ein Bad mit bodennaher Dusche. Seit über 20 Jahren vermieten wir unsere Wohnung – mit Liebe zum Detail.</p>', 'image_position' => 'right', 'link_label' => 'Wohnung & Ausstattung ansehen', 'link_page' => 'wohnung']],
['type' => 'location', 'data' => ['eyebrow' => 'Die Lage', 'heading' => 'Kühlungsborn – Strand, Hafen und Bäderarchitektur.', 'text' => '<p>Zu Fuß an die Ostsee, zum Bootshafen in Kühlungsborn Ost oder mit der Dampflok „Molli“ nach Bad Doberan.</p>', 'show_photos' => true]],
['type' => 'prices', 'data' => ['eyebrow' => 'Preise', 'heading' => 'Transparent, ohne Überraschungen.', 'text' => 'Endreinigung einmalig, Bettwäsche und Handtücher auf Wunsch. Ihren Gesamtpreis sehen Sie sofort im Kalender.']],
['type' => 'offers', 'data' => ['heading' => 'Aktuelle Angebote']],
['type' => 'reviews', 'data' => ['heading' => 'Das sagen unsere Gäste', 'limit' => 3]],
['type' => 'host', 'data' => ['heading' => 'Ihre Gastgeberin']],
$cta,
],
'seo_title' => null,
],
[
'slug' => 'wohnung',
'title' => 'Die Wohnung',
'menu_location' => 'main',
'sections' => [
['type' => 'text_image', 'data' => ['eyebrow' => 'Die Wohnung', 'heading' => '53 m² zum Wohlfühlen – ebenerdig mit eigener Terrasse.', 'text' => '<p>Unsere Ferienwohnung liegt im Erdgeschoss und bietet Platz für ein bis drei Personen: Wohnzimmer mit Schrankbett, Schlafzimmer mit Kingsize-Bett, Küche mit Essbereich, Diele, Bad und eine eigene Terrasse mit Blick auf Teich und Garten.</p>', 'image_position' => 'right']],
['type' => 'gallery', 'data' => ['heading' => 'Ein Blick hinein', 'category' => 'apartment']],
['type' => 'amenities', 'data' => ['heading' => 'Ausstattung']],
['type' => 'gallery', 'data' => ['heading' => 'Terrasse & Garten', 'category' => 'outdoor']],
$cta,
],
'seo_description' => 'Fotos und Ausstattung der 53 m² großen Ferienwohnung mit Terrasse in Kühlungsborn: Wohnzimmer, Schlafzimmer, Küche, Bad.',
],
[
'slug' => 'kuehlungsborn',
'title' => 'Kühlungsborn',
'menu_location' => 'main',
'sections' => [
['type' => 'text_image', 'data' => ['eyebrow' => 'Kühlungsborn & Umgebung', 'heading' => 'Eines der schönsten Ostseebäder.', 'text' => '<p>Breiter Sandstrand, Strandpromenade, Bootshafen und prachtvolle Bäderarchitektur – und mit der Dampflok „Molli“ geht es nach Heiligendamm und Bad Doberan.</p>']],
['type' => 'gallery', 'data' => ['heading' => null, 'category' => 'area']],
['type' => 'location', 'data' => ['eyebrow' => 'Anfahrt', 'heading' => 'So finden Sie uns', 'show_photos' => false]],
],
'seo_description' => 'Kühlungsborn an der Ostsee: Strand, Hafen, Molli und Bäderarchitektur – und unsere Ferienwohnung mittendrin.',
],
[
'slug' => 'buchen',
'title' => 'Preise & Buchung',
'menu_label' => 'Preise & Buchung',
'menu_location' => 'main',
'sections' => [
['type' => 'booking', 'data' => ['heading' => 'Preise & Buchung', 'text' => 'Wählen Sie im Kalender Ihren Anreise- und Abreisetag. Sie sehen sofort den Gesamtpreis inklusive aller Nebenkosten. Ihre Anfrage ist unverbindlich – wir halten den Termin für Sie vor und bestätigen kurzfristig.']],
['type' => 'prices', 'data' => ['eyebrow' => 'Saisonpreise', 'heading' => 'Preise pro Nacht']],
['type' => 'offers', 'data' => ['heading' => 'Aktuelle Angebote']],
['type' => 'faq', 'data' => ['heading' => 'Häufige Fragen']],
],
'seo_description' => 'Freie Termine, Preise und unverbindliche Buchungsanfrage für die Ferienwohnung Stommer in Kühlungsborn.',
],
[
'slug' => 'kontakt',
'title' => 'Kontakt',
'menu_location' => 'main',
'sections' => [
['type' => 'contact', 'data' => ['heading' => 'Kontakt', 'text' => 'Sie erreichen uns persönlich per Telefon oder E-Mail – wir freuen uns auf Ihre Nachricht.']],
['type' => 'host', 'data' => ['heading' => 'Ihre Gastgeberin']],
],
],
[
'slug' => 'impressum',
'title' => 'Impressum',
'menu_location' => 'footer',
'sections' => [['type' => 'rich_text', 'data' => ['heading' => 'Impressum', 'source' => 'legal.imprint']]],
],
[
'slug' => 'datenschutz',
'title' => 'Datenschutz',
'menu_location' => 'footer',
'sections' => [['type' => 'rich_text', 'data' => ['heading' => 'Datenschutzerklärung', 'source' => 'legal.privacy']]],
],
];
}
/**
* @return list<array<string, mixed>>
*/
private function appearances(): array
{
return [
['name' => 'Standard', 'is_default' => true, 'priority' => 0],
[
'name' => 'Sommer',
'starts_md' => '06-01', 'ends_md' => '08-31', 'priority' => 10,
'overrides' => [
'banner.text' => 'Sommer an der Ostsee – jetzt freie Termine prüfen.',
'banner.link_label' => 'Termine ansehen',
'hero.eyebrow' => 'Sommer in Kühlungsborn',
'hero.text' => '53 m² im Erdgeschoss, eigene Terrasse mit Blick auf Teich und Garten – ein paar Schritte, und Sie stehen im Sand.',
'cta.title' => 'Ihr Sommertermin ist frei?',
],
],
[
'name' => 'Winter',
'starts_md' => '11-01', 'ends_md' => '03-31', 'priority' => 10,
'tokens' => ['ground' => '#EEF1F3', 'line' => '#D5DCE1', 'accent' => '#3D5A6C', 'band' => '#22303A', 'band-muted' => '#C3CCD3', 'banner' => '#3D5A6C'],
'overrides' => [
'hero.eyebrow' => 'Winter in Kühlungsborn',
'hero.title' => 'Raue See, weiter Himmel – und ein *warmes* Zuhause',
'hero.text' => 'Lange Spaziergänge am leeren Strand, Wind im Gesicht, und danach Tee auf dem Ledersofa.',
'cta.title' => 'Winterpause gefällig?',
],
],
[
'name' => 'Weihnachten',
'starts_md' => '12-01', 'ends_md' => '12-25', 'priority' => 20,
'tokens' => ['ground' => '#F7F1EA', 'line' => '#E6D8C8', 'accent' => '#8C2F39', 'band' => '#3A2424', 'band-ink' => '#F7F1EA', 'band-muted' => '#E3D3C2', 'banner' => '#8C2F39'],
'overrides' => [
'banner.text' => 'Weihnachten an der Ostsee: 19.–26.12. · Mindestaufenthalt 4 Nächte.',
'banner.link_label' => 'Verfügbarkeit prüfen',
'hero.eyebrow' => 'Weihnachten in Kühlungsborn',
'hero.title' => 'Besinnliche Tage *am Meer*',
'hero.text' => 'Kerzenlicht, ein Spaziergang am Winterstrand und Zeit für die Familie – Weihnachten ganz ohne Trubel.',
'cta.title' => 'Weihnachten am Meer?',
'cta.text' => 'Die Weihnachtstage sind schnell vergeben – jetzt Termin prüfen.',
],
],
[
'name' => 'Silvester',
'starts_md' => '12-26', 'ends_md' => '01-03', 'priority' => 20,
'tokens' => ['ground' => '#141B24', 'surface' => '#1D2633', 'ink' => '#F2EEE6', 'muted' => '#B9C0C8', 'line' => '#2E3A49', 'accent' => '#C9A227', 'accent-ink' => '#141B24', 'band' => '#0D1219', 'band-ink' => '#F2EEE6', 'band-muted' => '#AEB6BF', 'banner' => '#C9A227', 'banner-ink' => '#141B24'],
'overrides' => [
'banner.text' => 'Silvester & Neujahr: 26.12.–03.01. · Mindestaufenthalt 6 Nächte.',
'banner.link_label' => 'Noch frei?',
'hero.eyebrow' => 'Silvester in Kühlungsborn',
'hero.title' => 'Ins neue Jahr *mit Meerblick*',
'hero.text' => 'Feuerwerk über der Ostsee, Neujahrsspaziergang an der Promenade – und eine Wohnung, in der Sie danach ausschlafen.',
'cta.title' => 'Silvester schon geplant?',
],
],
];
}
}
+2 -2
View File
@@ -44,7 +44,7 @@ ## 4. Öffentliche Webseite
- Kontakt, Impressum, Datenschutz, Mietbedingungen.
- Spätere Erweiterung: Gästebereich (Buchung einsehen, Anreiseinfos).
## 4a. Theme- und Vorlagensystem (Entscheidungen vom 22.10.2026, noch nicht gebaut)
## 4a. Theme- und Vorlagensystem (Entscheidungen vom 22.10.2026 – umgesetzt, Details: docs/THEMES.md)
- **Themes** (Design) als Code-Pakete mit Manifest, eigenen Vorlagen und eigenem CSS; was ein Theme nicht mitbringt, kommt aus einem vollständigen **Basis-Theme** (Child-Theme-Prinzip). Erstes Theme: **„Ostsee-Licht“** (Entwurf A, orientiert an der bisherigen Webseite). Die Entwürfe B/C können später als weitere Themes folgen.
- **Bausteinsystem (geführt):** Seiten werden aus einem festen Katalog von Abschnitten zusammengestellt (Reihenfolge, Sichtbarkeit); Seiten und Menüs können je Ausrichtung unterschiedlich sein. Keine freie Seitengestaltung.
@@ -158,7 +158,7 @@ ## 10. Umsetzungsphasen
1. **Fundament:** Laravel + Filament, Datenmodell, Saisons/Preise, Preisberechnung (mit Tests). ✅
2. **Kalender & Anfrage:** Belegung, Anfrageformular, Auto-Angebot per Mail, Vorreservierung mit Haltezeit, Sonderangebote, Sperrzeiten, Buchungsverwaltung. ✅
3. **Buchungsworkflow:** Bestätigung, Mietvertrag-PDF, Zahlungsfristen & Erinnerungen, Anreiseinfos. ✅ (Mietbedingungen/Storno noch als Muster)
4. **Webseite:** Design, Inhalte, Galerie, SEO, Barrierefreiheit.
4. **Webseite:** Theme-System, Bausteine, Erscheinungsbilder, Seiten, SEO ✅ · Basis-Theme „Ostsee-Licht“ funktionsfähig; gestalterische Überarbeitung offen (Übergabe: docs/THEMES.md §10).
5. **Connectoren:** iCal-Import/-Export, Sync-Log, Konfliktwarnung.
6. **Go-Live:** Strato-Deployment, Umleitungen, Inhalte/Rechtstexte, Testbuchungen.
+174
View File
@@ -0,0 +1,174 @@
# Theme-System – Architektur, Vorlagen-Vertrag, Übergabe Design
Stand: 22.10.2026 · Basis-Theme: **„Ostsee-Licht“** (`resources/themes/ostsee-licht`) · Entscheidungen: `docs/KONZEPT.md` §4a
> **Kurz:** Logik, Daten und Admin sind fertig und getestet. Ein Theme ist **nur Optik**: Blade-Vorlagen, CSS, ein wenig JS und Farb-Tokens. Für ein neues Design wird ausschließlich unter `resources/themes/<theme>/` gearbeitet.
---
## 1. Überblick
```
Anfrage ──► ResolveTheme (Middleware)
│ Site per Domain (sonst Standard-Site)
│ Erscheinungsbild per Datum (oder signierte Vorschau ?vorschau=<id>)
│ Theme-Kette: Theme → Eltern-Theme → Basis-Theme ⇒ View-Namespace "theme::"
▼
PageController ──► Seite (Admin › Webseite › Seiten) = Liste von Bausteinen
│ └─ je Baustein: App\Themes\Sections\<X>Section::data() → theme::sections.<key>
▼
theme::page (@extends theme::layouts.app)
```
| Begriff | Wo | Was |
|---|---|---|
| **Site** | `sites`, Admin › System › Websites | Domain, Theme, Grundfarben, zugeordnete Wohnungen. Heute eine; weitere = weitere Vermieter mit eigener Domain. |
| **Theme** | `resources/themes/<key>/` | Manifest `theme.json`, Vorlagen `views/`, `theme.css`, `theme.js` |
| **Seite** | `pages`, Admin › Webseite › Seiten | Adresse, Menü (Haupt/Fuß/keins), SEO, **Bausteine** (Builder) |
| **Baustein** (Section) | `app/Themes/Sections/*`, Katalog in `config/themes.php` | Admin-Formular + Datenaufbereitung; Darstellung: `theme::sections.<key>` |
| **Erscheinungsbild** (Appearance) | `appearances`, Admin › Webseite › Erscheinungsbilder | Jährlicher Zeitraum + Priorität; ersetzt Farben (Tokens), Titelbild, ausgewählte Texte, Banner, hervorgehobenes Angebot – **nicht** den Aufbau |
Code: `app/Themes/` (Theme, ThemeFactory, ThemeRegistry, ThemeManifest, SectionRegistry, Sections/), `app/Http/Middleware/ResolveTheme.php`, `app/Http/Controllers/PageController.php`, `app/Providers/ThemeServiceProvider.php`.
## 2. Aufbau eines Themes
```
resources/themes/ostsee-licht/
├── theme.json Manifest
├── theme.css Tailwind v4 + Schriften + Token-Mapping
├── theme.js kleine Verbesserungen (Lightbox, Suche)
└── views/
├── layouts/app.blade.php Grundgerüst: <head>, Banner, Kopf, @yield('content'), Fuß, Lightbox
├── page.blade.php rendert die Bausteine einer Seite
├── partials/ header, footer, banner, image, mobile-booking-bar
└── sections/<key>.blade.php eine Vorlage je Baustein (siehe §5)
```
### theme.json
```json
{
"key": "ostsee-licht", // eindeutig, = Ordnername empfohlen
"name": "Ostsee-Licht",
"version": "0.1.0",
"parent": null, // Child-Theme: Key des Eltern-Themes
"description": "…",
"assets": { "css": "resources/themes/ostsee-licht/theme.css", "js": "resources/themes/ostsee-licht/theme.js" },
"tokens": { "accent": { "label": "Akzent", "default": "#2C5F7C" }, … }
}
```
- **Vererbung:** Vorlagen, die ein Theme nicht hat, kommen vom Eltern-Theme, zuletzt vom Basis-Theme (`config('themes.base')`). Ein Child-Theme kann also mit einer einzigen Datei beginnen (z. B. nur `sections/hero.blade.php`). Hat ein Child-Theme keine eigenen `assets`, werden die des Eltern-Themes geladen.
- **Neues Theme anlegen:** Ordner `resources/themes/<key>/` mit `theme.json` (+ optional eigene Assets) → erscheint automatisch in Admin › System › Websites › Theme. `npm run build` baut alle Themes (`vite.config.js` liest die Ordner).
- **Plugins:** Ein Theme-Paket legt seinen Ordner unter einen Pfad aus `config('themes.paths')`. Themes werden **nie** über den Admin hochgeladen (Vorlagen sind ausführbarer Code).
## 3. Design-Tokens (Farben)
- Definiert in `theme.json › tokens`; das Layout gibt sie als CSS-Variablen aus: `:root{--accent:#2C5F7C;…}`.
- Reihenfolge: Theme-Standard → Site (Admin › Websites › Farben) → Erscheinungsbild (Admin › Erscheinungsbilder › Farben). Nur gültige Hex-Werte werden übernommen.
- In `theme.css` sind die Tokens als Tailwind-Farben gemappt (`@theme inline`): `bg-ground`, `bg-surface`, `text-ink`, `text-muted`, `border-line`, `bg-accent`, `text-accent-ink`, `bg-band`, `text-band-ink`, `text-band-muted`, `bg-banner`, `text-banner-ink` – inkl. Deckkraft (`bg-accent/10`).
- **Regel:** In Vorlagen keine festen Farben (`#…`, `text-blue-700`), immer Tokens – sonst funktionieren Saisons (z. B. dunkles Silvester) nicht.
- Die Buchungs- und Bewertungsformulare (`resources/views/livewire/*.blade.php`) sind theme-neutral und nutzen nur diese Token-Klassen.
- Neue Tokens: in `theme.json` ergänzen und in `theme.css › @theme inline` mappen; sie erscheinen automatisch als Farbfelder im Admin.
## 4. Was Layout und Vorlagen zur Verfügung haben
`$theme` (`App\Themes\Theme`, im Layout via `app(\App\Themes\Theme::class)`, in Bausteinen als Variable):
| Methode / Eigenschaft | Liefert |
|---|---|
| `$theme->site` | `Site` (Name, Locale, Einstellungen) |
| `$theme->appearance` | aktuelles `Appearance` oder `null` |
| `$theme->isPreview` | Vorschau-Modus (Layout setzt `noindex` und zeigt einen Hinweis) |
| `$theme->appearanceKey()` | z. B. `weihnachten` – steht als `data-appearance` am `<html>`; für saisonale CSS-Details nutzbar: `[data-appearance=silvester] .hero {…}` |
| `$theme->text($key, $fallback)` | Text des Erscheinungsbilds oder Fallback (Schlüssel: `Appearance::OVERRIDABLE`) |
| `$theme->heroPhoto($fallback)` | Titelbild des Erscheinungsbilds oder Fallback |
| `$theme->property()` | Hauptwohnung der Site |
| `$theme->menu('main' \| 'footer')` | veröffentlichte Seiten des Menüs (`->url()`, `->label()`) |
| `$theme->tokens()`, `cssVariables()`, `assets()` | für das Layout |
Weitere Helfer: `@include('theme::partials.image', ['photo' => $photo, 'sizes' => '…', 'class' => '…', 'eager' => bool])` (responsives WebP mit `srcset` 640/1280/2048 px, Platzhalter wenn kein Bild), `\App\Support\Money::format($cents)`, `\App\Support\Content::get()/html()/photo()` (zentrale Texte, Admin › Texte), `route('booking.create')`, `route('home')`, `route('page', ['slug' => …])`.
Layout-Variablen von `PageController`: `$title`, `$description`, `$ogImage`, `$structuredData` (JSON-LD), `$page`, `$sections`. Weitere Daten für `<head>` per `@push('head')`.
## 5. Bausteinkatalog – Vertrag der Vorlagen
Jede Vorlage `views/sections/<key>.blade.php` bekommt **immer** `$theme` und `$sectionId` (eindeutige ID für `aria-labelledby`) und zusätzlich:
| Key | Admin-Name | Variablen |
|---|---|---|
| `hero` | Titelbereich mit Suche | `$eyebrow`, `$title` (Text, `*Wort*` = Hervorhebung), `$text`, `$photo`, `$showSearch`, `$property` – 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>) |
| `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`, `$offers` (öffentlich, ohne Code), `$featuredId` |
| `booking` | Kalender & Anfrage | `$heading`, `$text`, `$property` – bindet `<livewire:booking-request :property="$property" />` ein |
| `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 |
| `cta` | Abschluss mit Aufruf | `$title`, `$text`, `$photo`, `$buttonLabel`, `$buttonUrl` |
| `contact` | Kontakt | `$heading`, `$text`, `$owner` (name, street, city, phone, email), `$address` |
| `rich_text` | Fließtext | `$heading`, `$text` (HtmlString\|null; eigener Text oder zentraler Text wie Impressum) |
Rich-Text-Variablen sind bereits bereinigt (HtmlString) und werden mit `{{ $text }}` ausgegeben.
**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.
## 6. Erscheinungsbilder
- Felder: Name, Zeitraum `TT.MM.`–`TT.MM.` (jährlich, darf über Silvester laufen), Priorität, Standard, aktiv, Titelbild, hervorgehobenes Angebot, Texte (`banner.text`, `banner.link_label`, `banner.link_url`, `hero.eyebrow`, `hero.title`, `hero.text`, `cta.title`, `cta.text`), Farben.
- Startset (Seeder): Standard · Sommer 01.06.–31.08. · Winter 01.11.–31.03. · Weihnachten 01.12.–25.12. (Prio 20) · Silvester 26.12.–03.01. (Prio 20).
- **Vorschau:** Admin › Erscheinungsbilder › „Vorschau“ = signierter Link (24 h), `noindex`.
- Ohne Erscheinungsbild-Banner wird der neueste aktive Hinweis (Admin › Hinweis-Banner) gezeigt.
## 7. Assets, Schriften, Build
- `npm run build` (bzw. `npm run dev`) baut je Theme `theme.css` + `theme.js` nach `public/build`. Auf Strato läuft kein Node: **Build lokal, Ergebnis mit deployen.**
- Schriften werden **selbst gehostet** (npm `@fontsource/*`, Import in `theme.css`) – keine Anfragen an Google (DSGVO, kein Cookie-Banner nötig). Das Vite-Font-Plugin ist bewusst entfernt (Firmen-Proxy, DSGVO).
- Keine externen Skripte/Iframes/CDNs ohne Einwilligungskonzept.
## 8. Qualitätsanforderungen (gelten für jedes Theme)
- **Mobil zuerst**, ab 360 px nutzbar; Buchung immer erreichbar (mobile Buchungsleiste `partials/mobile-booking-bar`).
- **Ladezeit:** Hauptbild mit `eager`/`fetchpriority`, alle übrigen `loading="lazy"`; LCP < 2,5 s; Video nur mit Standbild-Poster, stumm, nicht bei „Datensparen“.
- **Barrierefreiheit (WCAG 2.2 AA):** Kontraste ≥ 4,5:1 (auch in allen Erscheinungsbildern!), sinnvolle Überschriften (h1 je Seite genau einmal), Fokus sichtbar, alles per Tastatur, `prefers-reduced-motion` respektieren (siehe `theme.css`).
- **Bewegung** nur mit Zweck: progressive Enhancement (`@supports (animation-timeline: view())`), ohne JS/Animation muss alles funktionieren.
- **SEO:** `$title`/`$description` ausgeben, JSON-LD beibehalten, sprechende `alt`-Texte kommen aus dem Admin.
## 9. Lokal starten und prüfen
```powershell
php artisan migrate:fresh --seed
php artisan photos:import "<Ordner mit Fotos>" # optional
npm run dev # oder: npm run build
php artisan serve # http://localhost:8000 · Admin: /admin (admin@example.com / password)
php artisan test --compact # muss grün bleiben
vendor/bin/pint --dirty --format agent # nur bei PHP-Änderungen
```
Saisons ansehen: Admin › Webseite › Erscheinungsbilder › „Vorschau“.
## 10. Übergabe: Auftrag für die Design-Sitzung (privater Rechner, Plugin `frontend-design`)
**Ziel:** Das Basis-Theme „Ostsee-Licht“ gestalterisch auf ein wirklich herausragendes Niveau heben (Recherche & Ideen: Chat vom 22.10.2026, Zusammenfassung unten), oder ein neues Theme als Child bzw. eigenständiges Theme anlegen und im Admin umschalten.
**Arbeitsbereich:** nur `resources/themes/<theme>/**` – dazu bei Bedarf die theme-neutralen Livewire-Formulare `resources/views/livewire/*.blade.php` (nur Klassen, keine Logik).
**Nicht anfassen:** `app/**` (außer ein neuer Baustein wird bewusst gebraucht – dann §5), Datenbank, Admin, `config/**`.
**Leitideen aus der Recherche** (zur Auswahl/Kombination):
1. *„Ein Tag an der Ostsee“* – Startseite erzählt beim Scrollen einen Tag (Morgen Strand → Mittag Terrasse → Abend Hafen → Nacht Promenade), Licht/Farben wandern mit; Tag/Nacht-Stimmung nach Sonnenuntergang. (Live-Wetter/Wassertemperatur als späterer Baustein – Datenquelle mit kommerzieller Lizenz klären, z. B. DWD Open Data.)
2. *„Brigittes Kühlungsborn“* – redaktioneller Magazin-Stil, große Typografie, Gastgeber-Tipps.
3. *„Die Wohnung zum Anfassen“* – interaktiver Grundriss (SVG, Räume antippen), Drohnen-Video im Titelbereich, Preis-Kalender als Gestaltungselement.
Vorbilder: Awwwards › Hotel & Restaurant (Tengile, White Desert, Explore Primland, Vander Hotel, Villa Aurelia), Sawday's, onefinestay.
**Checkliste vor Abschluss:**
- [ ] Alle 15 Bausteine gestaltet; alle Seiten (`/`, `/wohnung`, `/kuehlungsborn`, `/buchen`, `/kontakt`, `/impressum`, `/datenschutz`) auf Handy (360 px), Tablet und Desktop geprüft
- [ ] Alle 5 Erscheinungsbilder per Vorschau geprüft (Kontraste! Silvester ist dunkel)
- [ ] Nur Token-Farben in Vorlagen; neue Tokens in `theme.json` + `theme.css`
- [ ] Reduced Motion, Tastaturbedienung, Fokus, Alt-Texte
- [ ] `npm run build` fehlerfrei, `php artisan test --compact` grün
- [ ] Neue Schriften selbst gehostet (`@fontsource/*`), keine externen Requests
+22
View File
@@ -5,6 +5,8 @@
"packages": {
"": {
"devDependencies": {
"@fontsource/cormorant-garamond": "^5.3.0",
"@fontsource/figtree": "^5.3.0",
"@tailwindcss/vite": "^4.0.0",
"concurrently": "^10.0.3",
"laravel-vite-plugin": "^3.1",
@@ -42,6 +44,26 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/@fontsource/cormorant-garamond": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@fontsource/cormorant-garamond/-/cormorant-garamond-5.3.0.tgz",
"integrity": "sha512-weuGsCirGVWBWqpt6YUp0yLThTe4G8YO45noq8wxeJCRvEpq5lFrxNMFSTxcyOyV5k5otzJ8guDzYegdYlcLMQ==",
"dev": true,
"license": "OFL-1.1",
"funding": {
"url": "https://github.com/sponsors/ayuhito"
}
},
"node_modules/@fontsource/figtree": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@fontsource/figtree/-/figtree-5.3.0.tgz",
"integrity": "sha512-/iTcTXL1eRBGhvD7NN9dnKzXzWqDLVZVEUFI9xIxAC1G/hXU8tCyYeXCAuPOuvSYPInFUP7H6KLGgygmDfy1SA==",
"dev": true,
"license": "OFL-1.1",
"funding": {
"url": "https://github.com/sponsors/ayuhito"
}
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+2
View File
@@ -7,6 +7,8 @@
"dev": "vite"
},
"devDependencies": {
"@fontsource/cormorant-garamond": "^5.3.0",
"@fontsource/figtree": "^5.3.0",
"@tailwindcss/vite": "^4.0.0",
"concurrently": "^10.0.3",
"laravel-vite-plugin": "^3.1",
-2
View File
@@ -1,2 +0,0 @@
User-agent: *
Disallow:
-37
View File
@@ -1,37 +0,0 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@theme {
--font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
--color-sea-50: oklch(0.97 0.015 230);
--color-sea-100: oklch(0.93 0.035 230);
--color-sea-700: oklch(0.45 0.11 235);
--color-sea-800: oklch(0.38 0.1 237);
--color-sea-900: oklch(0.3 0.08 240);
--color-sand-50: oklch(0.985 0.008 85);
}
@layer base {
input:not([type='checkbox']):not([type='radio']),
select,
textarea {
border-width: 1px;
padding: 0.5rem 0.75rem;
background-color: white;
}
input[type='checkbox'] {
width: 1rem;
height: 1rem;
accent-color: var(--color-sea-700);
}
:focus-visible {
outline: 2px solid var(--color-sea-700);
outline-offset: 2px;
}
}
-1
View File
@@ -1 +0,0 @@
//
+146
View File
@@ -0,0 +1,146 @@
@import 'tailwindcss';
/* Self-hosted fonts (no request to Google – GDPR). */
@import '@fontsource/cormorant-garamond/500.css';
@import '@fontsource/cormorant-garamond/500-italic.css';
@import '@fontsource/cormorant-garamond/600.css';
@import '@fontsource/figtree/400.css';
@import '@fontsource/figtree/500.css';
@import '@fontsource/figtree/600.css';
@source './views';
@source '../../views/livewire';
/*
* Colour tokens come from theme.json and can be changed per site and per appearance; the layout prints them
* as CSS variables. Tailwind classes such as bg-accent or text-muted refer to these variables.
*/
@theme inline {
--color-ground: var(--ground);
--color-surface: var(--surface);
--color-ink: var(--ink);
--color-muted: var(--muted);
--color-line: var(--line);
--color-accent: var(--accent);
--color-accent-ink: var(--accent-ink);
--color-band: var(--band);
--color-band-ink: var(--band-ink);
--color-band-muted: var(--band-muted);
--color-banner: var(--banner);
--color-banner-ink: var(--banner-ink);
--font-display: 'Cormorant Garamond', Georgia, serif;
--font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif;
}
@layer base {
html {
scroll-behavior: smooth;
}
body {
background: var(--ground);
color: var(--ink);
transition: background-color 0.4s, color 0.4s;
}
input:not([type='checkbox']):not([type='radio']),
select,
textarea {
border-width: 1px;
border-color: var(--line);
padding: 0.6rem 0.8rem;
background-color: var(--surface);
color: var(--ink);
}
input[type='checkbox'] {
width: 1rem;
height: 1rem;
accent-color: var(--accent);
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
}
@layer components {
.eyebrow {
@apply mb-3 text-xs font-semibold tracking-[0.24em] text-accent uppercase;
}
.heading-display {
@apply font-display text-4xl leading-[1.08] font-medium sm:text-[2.875rem];
}
.btn-primary {
@apply inline-flex min-h-11 items-center justify-center rounded-full bg-ink px-6 py-3 text-[15px] font-semibold text-ground transition hover:opacity-90;
}
.btn-accent {
@apply inline-flex min-h-11 items-center justify-center rounded-full bg-accent px-6 py-3 text-[15px] font-semibold text-accent-ink transition hover:opacity-90;
}
.prose-theme {
@apply text-muted;
}
.prose-theme p {
@apply mb-4;
}
.prose-theme ul,
.prose-theme ol {
@apply mb-4 ml-5 list-outside;
}
.prose-theme ul {
@apply list-disc;
}
.prose-theme ol {
@apply list-decimal;
}
.prose-theme a {
@apply text-accent underline;
}
.prose-theme h2,
.prose-theme h3 {
@apply mt-6 mb-2 font-display text-2xl text-ink;
}
}
/* Gentle reveal while scrolling – only where supported and only without "reduce motion". */
@media (prefers-reduced-motion: no-preference) {
@supports (animation-timeline: view()) {
.reveal {
animation: reveal linear both;
animation-timeline: view();
animation-range: entry 0% entry 35%;
}
@keyframes reveal {
from {
opacity: 0;
transform: translateY(24px);
}
}
}
}
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
*,
*::before,
*::after {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}
+45
View File
@@ -0,0 +1,45 @@
/**
* Theme "Ostsee-Licht": small progressive enhancements. Everything works without JavaScript.
*/
// Lightbox for galleries: links with data-lightbox open the large image in a <dialog>.
document.addEventListener('click', (event) => {
const link = event.target.closest('a[data-lightbox]');
if (!link) {
return;
}
const dialog = document.getElementById('lightbox');
if (!dialog || typeof dialog.showModal !== 'function') {
return;
}
event.preventDefault();
const image = dialog.querySelector('img');
image.src = link.href;
image.alt = link.dataset.alt ?? '';
dialog.querySelector('[data-caption]').textContent = link.dataset.alt ?? '';
dialog.showModal();
});
document.addEventListener('click', (event) => {
const dialog = event.target.closest('dialog#lightbox');
if (dialog && (event.target === dialog || event.target.closest('[data-close]'))) {
dialog.close();
}
});
// Availability search in the hero: forwards the dates to the booking page.
document.addEventListener('submit', (event) => {
const form = event.target.closest('form[data-availability-search]');
if (!form) {
return;
}
const arrival = form.querySelector('[name=anreise]').value;
const departure = form.querySelector('[name=abreise]').value;
if (!arrival || !departure) {
event.preventDefault();
form.querySelector('[name=anreise]').focus();
}
});
+25
View File
@@ -0,0 +1,25 @@
{
"key": "ostsee-licht",
"name": "Ostsee-Licht",
"version": "0.1.0",
"parent": null,
"description": "Basis-Theme: hell und elegant, Serifen-Überschriften, große Fotos – angelehnt an die bisherige Webseite. Enthält Vorlagen für alle Bausteine.",
"assets": {
"css": "resources/themes/ostsee-licht/theme.css",
"js": "resources/themes/ostsee-licht/theme.js"
},
"tokens": {
"ground": { "label": "Hintergrund", "default": "#F6F2EA" },
"surface": { "label": "Flächen (Karten, Formulare)", "default": "#FFFFFF" },
"ink": { "label": "Text", "default": "#1D2A33" },
"muted": { "label": "Text, gedämpft", "default": "#4E5C66" },
"line": { "label": "Linien", "default": "#E2DACB" },
"accent": { "label": "Akzent (Buttons, Hervorhebungen)", "default": "#2C5F7C" },
"accent-ink": { "label": "Text auf Akzent", "default": "#FFFFFF" },
"band": { "label": "Dunkles Band (z. B. Lage)", "default": "#1D2A33" },
"band-ink": { "label": "Text auf dunklem Band", "default": "#F6F2EA" },
"band-muted": { "label": "Text auf dunklem Band, gedämpft", "default": "#C9D2D8" },
"banner": { "label": "Hinweis-Banner", "default": "#2C5F7C" },
"banner-ink": { "label": "Text im Banner", "default": "#FFFFFF" }
}
}
@@ -0,0 +1,58 @@
@php
/** @var \App\Themes\Theme $theme */
$theme = app(\App\Themes\Theme::class);
$pageTitle = isset($title) && $title ? $title.' · '.$theme->site->name : $theme->site->name;
@endphp
<!DOCTYPE html>
<html lang="{{ $theme->site->locale ?? 'de' }}" data-appearance="{{ $theme->appearanceKey() }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ $pageTitle }}</title>
@isset($description)
<meta name="description" content="{{ $description }}">
<meta property="og:description" content="{{ $description }}">
@endisset
<meta property="og:title" content="{{ $pageTitle }}">
<meta property="og:type" content="website">
<meta property="og:url" content="{{ url()->current() }}">
@isset($ogImage)
<meta property="og:image" content="{{ $ogImage }}">
@endisset
<link rel="canonical" href="{{ url()->current() }}">
@if ($theme->isPreview)
<meta name="robots" content="noindex">
@endif
@vite($theme->assets())
<style>{!! $theme->cssVariables() !!}</style>
@livewireStyles
@stack('head')
</head>
<body class="min-h-screen font-sans text-[17px] leading-relaxed antialiased">
<a href="#inhalt" class="sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50 focus:rounded focus:bg-surface focus:px-4 focus:py-2">Zum Inhalt springen</a>
@if ($theme->isPreview)
<div class="bg-ink py-2 text-center text-sm text-ground">Vorschau des Erscheinungsbilds „{{ $theme->appearance?->name }}“</div>
@endif
@include('theme::partials.banner')
@include('theme::partials.header')
<main id="inhalt">
@yield('content')
</main>
@include('theme::partials.footer')
@include('theme::partials.mobile-booking-bar')
<dialog id="lightbox" class="m-auto max-h-[92vh] max-w-[92vw] bg-transparent p-0 backdrop:bg-black/80" aria-label="Bild vergrößert">
<figure class="relative">
<img src="" alt="" class="max-h-[85vh] max-w-[92vw] object-contain">
<figcaption data-caption class="mt-2 text-center text-sm text-white"></figcaption>
<button type="button" data-close class="absolute top-2 right-2 rounded-full bg-black/60 px-3 py-1 text-white" aria-label="Schließen">✕</button>
</figure>
</dialog>
@livewireScripts
</body>
</html>
@@ -0,0 +1,18 @@
@extends('theme::layouts.app')
@if ($structuredData)
@push('head')
<script type="application/ld+json">{!! json_encode($structuredData, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG) !!}</script>
@endpush
@endif
@section('content')
@forelse ($sections as $section)
{!! $section->render() !!}
@empty
<div class="mx-auto max-w-3xl px-4 py-24 text-center sm:px-8">
<h1 class="heading-display">{{ $page->title }}</h1>
<p class="mt-4 text-muted">Diese Seite hat noch keine Inhalte.</p>
</div>
@endforelse
@endsection
@@ -0,0 +1,11 @@
@php($bannerText = $theme->text('banner.text', \App\Models\Notice::query()->visible()->latest()->value('text')))
@if ($bannerText)
<div class="bg-banner text-banner-ink" role="status">
<div class="mx-auto flex max-w-7xl flex-wrap items-center justify-center gap-x-5 gap-y-1 px-4 py-2.5 text-center text-[15px] font-medium sm:px-8">
<span>{{ $bannerText }}</span>
@if ($theme->text('banner.link_label'))
<a href="{{ $theme->text('banner.link_url', route('booking.create')) }}" class="font-semibold underline">{{ $theme->text('banner.link_label') }}</a>
@endif
</div>
</div>
@endif
@@ -0,0 +1,19 @@
<footer class="mt-8 border-t border-line">
<div class="mx-auto flex max-w-7xl flex-wrap justify-between gap-x-16 gap-y-6 px-4 py-14 text-sm text-muted sm:px-8">
<div>
<span class="font-display text-2xl text-ink">{{ $theme->site->name }}</span><br>
{{ $theme->property()?->address }}
</div>
<div>
{{ config('fewo.owner.name') }} · <a href="tel:{{ preg_replace('/[^0-9+]/', '', (string) config('fewo.owner.phone')) }}" class="hover:text-accent">{{ config('fewo.owner.phone') }}</a><br>
<a href="mailto:{{ config('fewo.owner.email') }}" class="hover:text-accent">{{ config('fewo.owner.email') }}</a>
</div>
<nav aria-label="Rechtliches">
<ul class="flex flex-wrap gap-6">
@foreach ($theme->menu('footer') as $item)
<li><a href="{{ $item->url() }}" class="hover:text-accent">{{ $item->label() }}</a></li>
@endforeach
</ul>
</nav>
</div>
</footer>
@@ -0,0 +1,29 @@
<header class="relative z-20">
<div class="mx-auto flex max-w-7xl items-center justify-between gap-6 px-4 py-5 sm:px-8">
<a href="{{ route('home') }}" class="flex flex-col leading-tight">
<span class="font-display text-[1.875rem] font-semibold tracking-wide">{{ str($theme->site->name)->afterLast(' ') }}</span>
<span class="text-[11px] tracking-[0.24em] text-muted uppercase">Ferienwohnung · Kühlungsborn</span>
</a>
<nav aria-label="Hauptnavigation" class="hidden lg:block">
<ul class="flex gap-8 text-[15px] font-medium">
@foreach ($theme->menu('main') as $item)
<li><a href="{{ $item->url() }}" @class(['hover:text-accent', 'text-accent' => url()->current() === $item->url()]) @if (url()->current() === $item->url()) aria-current="page" @endif>{{ $item->label() }}</a></li>
@endforeach
</ul>
</nav>
<div class="flex items-center gap-3">
<a href="{{ route('booking.create') }}" class="btn-primary hidden sm:inline-flex">Verfügbarkeit prüfen</a>
<details class="relative lg:hidden">
<summary class="flex min-h-11 cursor-pointer list-none items-center rounded-full border border-line px-4 font-medium" aria-label="Menü">Menü</summary>
<ul class="absolute right-0 mt-2 w-56 rounded-lg border border-line bg-surface p-2 shadow-lg">
@foreach ($theme->menu('main') as $item)
<li><a href="{{ $item->url() }}" class="block rounded px-3 py-2.5 hover:bg-accent/10">{{ $item->label() }}</a></li>
@endforeach
</ul>
</details>
</div>
</div>
</header>
@@ -0,0 +1,14 @@
{{--
Responsive photo. Variables: $photo (App\Models\Photo|null), $class, $sizes (default 100vw), $eager (bool).
--}}
@if ($photo && $photo->url('md'))
<img src="{{ $photo->url('md') }}"
srcset="{{ $photo->srcset() }}"
sizes="{{ $sizes ?? '100vw' }}"
alt="{{ $photo->alt_text }}"
@if ($eager ?? false) fetchpriority="high" @else loading="lazy" @endif
decoding="async"
class="{{ $class ?? '' }}">
@else
<div class="{{ $class ?? '' }} flex items-center justify-center bg-line/60 text-sm text-muted" role="img" aria-label="Bild folgt">Bild folgt</div>
@endif
@@ -0,0 +1,6 @@
@unless (request()->routeIs('booking.create'))
<div class="fixed inset-x-0 bottom-0 z-30 border-t border-line bg-surface/95 p-3 backdrop-blur sm:hidden">
<a href="{{ route('booking.create') }}" class="btn-accent w-full">Freie Termine &amp; Preise</a>
</div>
<div class="h-20 sm:hidden" aria-hidden="true"></div>
@endunless
@@ -0,0 +1,17 @@
@if ($groups->isNotEmpty())
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
<h2 id="{{ $sectionId }}-title" class="heading-display mb-10">{{ $heading }}</h2>
<div class="grid gap-10 sm:grid-cols-2 lg:grid-cols-3">
@foreach ($groups as $area => $amenities)
<div class="reveal">
<h3 class="mb-3 border-b border-line pb-2 text-sm font-semibold tracking-[0.18em] text-accent uppercase">{{ $area }}</h3>
<ul class="space-y-1.5 text-muted">
@foreach ($amenities as $amenity)
<li class="flex gap-2"><span aria-hidden="true" class="text-accent">·</span>{{ $amenity->name }}</li>
@endforeach
</ul>
</div>
@endforeach
</div>
</section>
@endif
@@ -0,0 +1,11 @@
<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
<div class="mt-8">
@if ($property)
<livewire:booking-request :property="$property" />
@else
<p class="text-muted">Derzeit ist keine Wohnung buchbar.</p>
@endif
</div>
</section>
@@ -0,0 +1,22 @@
<section class="mx-auto max-w-4xl px-4 py-16 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
<h1 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h1>
@if ($text)<p class="mt-4 text-muted">{{ $text }}</p>@endif
<div class="mt-10 grid gap-8 sm:grid-cols-2">
<div class="rounded bg-surface p-7">
<h2 class="eyebrow">Gastgeberin</h2>
<p class="font-semibold">{{ $owner['name'] }}</p>
<p class="text-muted">{{ $owner['street'] }}<br>{{ $owner['city'] }}</p>
<p class="mt-4">
<a href="tel:{{ preg_replace('/[^0-9+]/', '', (string) $owner['phone']) }}" class="block font-semibold hover:text-accent">{{ $owner['phone'] }}</a>
<a href="mailto:{{ $owner['email'] }}" class="block font-semibold hover:text-accent">{{ $owner['email'] }}</a>
</p>
</div>
@if ($address)
<div class="rounded bg-surface p-7">
<h2 class="eyebrow">Ferienwohnung</h2>
<p class="text-muted">{{ $address }}</p>
<a href="{{ route('booking.create') }}" class="btn-accent mt-6">Freie Termine &amp; Preise</a>
</div>
@endif
</div>
</section>
@@ -0,0 +1,10 @@
<section class="relative" aria-labelledby="{{ $sectionId }}-title">
@include('theme::partials.image', ['photo' => $photo, 'class' => 'h-[28rem] w-full object-cover sm:h-[32rem]'])
<div class="absolute inset-0 flex items-center justify-center p-4">
<div class="max-w-xl bg-ground/95 px-8 py-10 text-center sm:px-14 sm:py-12">
<h2 id="{{ $sectionId }}-title" class="font-display text-4xl leading-tight font-medium">{{ $title }}</h2>
@if ($text)<p class="mt-3 mb-7 text-muted">{{ $text }}</p>@endif
<a href="{{ $buttonUrl }}" class="btn-primary">{{ $buttonLabel }}</a>
</div>
</div>
</section>
@@ -0,0 +1,17 @@
<section class="mx-auto max-w-7xl px-4 pt-16 pb-6 sm:px-8 sm:pt-20" @if ($heading) aria-labelledby="{{ $sectionId }}-title" @else aria-label="Eckdaten" @endif>
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display mb-8">{{ $heading }}</h2>@endif
<ul class="reveal grid grid-cols-2 gap-6 border-y border-line lg:grid-cols-4">
@if ($property?->size_sqm)
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">{{ $property->size_sqm }} m²</span><span class="text-sm text-muted">Wohnfläche</span></li>
@endif
@if ($property)
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">1–{{ $property->max_guests }}</span><span class="text-sm text-muted">Gäste</span></li>
@endif
@if ($fromPrice)
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">ab {{ \App\Support\Money::format((int) $fromPrice) }}</span><span class="text-sm text-muted">pro Nacht</span></li>
@endif
@if ($highlights->isNotEmpty())
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">inklusive</span><span class="text-sm text-muted">{{ $highlights->take(3)->implode(', ') }}</span></li>
@endif
</ul>
</section>
@@ -0,0 +1,24 @@
@if ($faqs->isNotEmpty())
<section class="mx-auto max-w-4xl px-4 py-16 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
<h2 id="{{ $sectionId }}-title" class="heading-display mb-8">{{ $heading }}</h2>
<div class="divide-y divide-line border-y border-line">
@foreach ($faqs as $faq)
<details class="group py-5">
<summary class="flex cursor-pointer list-none items-center justify-between gap-6 text-lg font-semibold">
{{ $faq->question }}
<span aria-hidden="true" class="text-2xl text-accent transition group-open:rotate-45">+</span>
</summary>
<div class="prose-theme mt-3">{{ $answers[$faq->id] }}</div>
</details>
@endforeach
</div>
</section>
@push('head')
<script type="application/ld+json">{!! json_encode([
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => $faqs->map(fn ($faq) => ['@type' => 'Question', 'name' => $faq->question, 'acceptedAnswer' => ['@type' => 'Answer', 'text' => strip_tags($faq->answer)]])->values(),
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG) !!}</script>
@endpush
@endif
@@ -0,0 +1,18 @@
@if ($photos->isNotEmpty())
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8" @if ($heading) aria-labelledby="{{ $sectionId }}-title" @else aria-label="Bildergalerie" @endif>
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display mb-8">{{ $heading }}</h2>@endif
<ul class="grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4">
@foreach ($photos as $index => $photo)
<li @class(['reveal', 'col-span-2 row-span-2' => $index === 0])>
<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}" class="group block overflow-hidden rounded-sm">
@include('theme::partials.image', [
'photo' => $photo,
'sizes' => $index === 0 ? '(min-width: 1024px) 50vw, 100vw' : '(min-width: 1024px) 25vw, 50vw',
'class' => ($index === 0 ? 'h-full min-h-64 ' : 'h-40 sm:h-56 ').'w-full object-cover transition duration-500 group-hover:scale-[1.03]',
])
</a>
</li>
@endforeach
</ul>
</section>
@endif
@@ -0,0 +1,32 @@
<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])
<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>
@if ($text)<p class="mt-4 text-muted">{{ $text }}</p>@endif
</div>
</div>
</section>
@if ($showSearch)
<section class="relative mx-auto mt-4 max-w-5xl px-4 sm:-mt-11 sm:px-6" aria-label="Verfügbarkeit prüfen">
<form action="{{ route('booking.create') }}" method="get" data-availability-search
class="grid grid-cols-1 items-end gap-4 rounded bg-surface p-5 shadow-[0_18px_40px_rgba(0,0,0,0.10)] sm:grid-cols-2 lg:grid-cols-4">
<label class="flex flex-col gap-1.5 text-[13px] font-semibold text-muted">Anreise
<input type="date" name="anreise" min="{{ today()->toDateString() }}" class="rounded text-base font-medium" required>
</label>
<label class="flex flex-col gap-1.5 text-[13px] font-semibold text-muted">Abreise
<input type="date" name="abreise" min="{{ today()->addDay()->toDateString() }}" class="rounded text-base font-medium" required>
</label>
<label class="flex flex-col gap-1.5 text-[13px] font-semibold text-muted">Personen
<select name="personen" class="rounded text-base font-medium">
@for ($count = 1; $count <= ($property?->max_guests ?? 3); $count++)
<option value="{{ $count }}" @selected($count === 2)>{{ $count }} {{ $count === 1 ? 'Person' : 'Personen' }}</option>
@endfor
</select>
</label>
<button type="submit" class="min-h-12 rounded bg-accent px-5 font-semibold text-accent-ink hover:opacity-90">Preis berechnen</button>
</form>
</section>
@endif
@@ -0,0 +1,13 @@
<section class="mx-auto flex max-w-7xl flex-wrap items-center gap-14 px-4 py-20 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
@if ($photo)
<div class="w-full max-w-sm flex-[0_1_22rem]">
@include('theme::partials.image', ['photo' => $photo, 'sizes' => '22rem', 'class' => 'aspect-[4/5] w-full rounded object-cover'])
</div>
@endif
<div class="min-w-0 flex-[1_1_28rem]">
@if ($heading)<p class="eyebrow" id="{{ $sectionId }}-title">{{ $heading }}</p>@endif
@if ($quote)<blockquote class="font-display text-3xl leading-snug sm:text-[2.375rem]">„{{ $quote }}“</blockquote>@endif
<p class="mt-5 font-semibold">{{ $name }}</p>
@if ($text)<div class="prose-theme mt-2">{{ $text }}</div>@endif
</div>
</section>
@@ -0,0 +1,24 @@
<section class="bg-band text-band-ink" aria-labelledby="{{ $sectionId }}-title">
<div class="mx-auto flex max-w-7xl flex-wrap items-center gap-14 px-4 py-20 sm:px-8 sm:py-24">
<div class="min-w-0 flex-[1_1_22rem]">
@if ($eyebrow)<p class="mb-3 text-xs font-semibold tracking-[0.24em] text-band-muted uppercase">{{ $eyebrow }}</p>@endif
<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>
@if ($text)<div class="mt-6 text-band-muted [&_a]:underline [&_p]:mb-4">{{ $text }}</div>@endif
@if ($address)
<p class="mt-6 text-band-muted">{{ $address }}<br>
<a href="{{ $mapUrl }}" class="font-semibold text-band-ink underline" rel="noopener" target="_blank">Auf der Karte ansehen</a>
</p>
@endif
</div>
@if ($photos->isNotEmpty())
<div class="grid min-w-0 flex-[1_1_36rem] grid-cols-2 gap-4 sm:grid-cols-3">
@foreach ($photos->take(3) as $photo)
<figure class="reveal">
@include('theme::partials.image', ['photo' => $photo, 'sizes' => '(min-width: 1024px) 18vw, 45vw', 'class' => 'h-48 w-full rounded-sm object-cover sm:h-64'])
<figcaption class="mt-2 text-sm text-band-muted">{{ $photo->caption ?: $photo->alt_text }}</figcaption>
</figure>
@endforeach
</div>
@endif
</div>
</section>
@@ -0,0 +1,17 @@
@if ($offers->isNotEmpty())
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8" aria-labelledby="{{ $sectionId }}-title">
<h2 id="{{ $sectionId }}-title" class="heading-display mb-8">{{ $heading }}</h2>
<ul class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
@foreach ($offers as $offer)
<li @class(['reveal rounded bg-surface p-7', 'ring-2 ring-accent' => $offer->id === $featuredId])>
<p class="font-display text-2xl">{{ $offer->name }}</p>
@if ($offer->public_description)<p class="mt-2 text-muted">{{ $offer->public_description }}</p>@endif
@if ($offer->stay_from || $offer->stay_until)
<p class="mt-3 text-sm text-muted">Reisezeitraum {{ $offer->stay_from?->format('d.m.Y') ?? 'ab sofort' }} – {{ $offer->stay_until?->format('d.m.Y') ?? 'offen' }}</p>
@endif
</li>
@endforeach
</ul>
<p class="mt-4 text-sm text-muted">Angebote werden bei der Preisberechnung automatisch berücksichtigt.</p>
</section>
@endif
Loaded 100 of 119 files, more files were not shown because too many files have changed in this diff. Show more