- 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>
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?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,
|
|
];
|
|
}
|
|
}
|