- Special offers: kinds (rule, fixed dates, gap filler), package price, priority, highlight;
GapFinder detects calendar gaps (optionally waiving the minimum stay); OfferShowcase decides
what the website advertises and prices fixed dates/gaps with PriceCalculator; offers section
shows them side by side, as a list or rotating; hero can show the top offer. Appearances no
longer carry a featured offer.
- Sections get stable ids; appearances set photos per section ("Bilder je Baustein") and
sections can be limited to appearances. Photo pickers show thumbnails everywhere.
- Themes: themes:make (scaffold, never overwrites), themes:check (contract, build, markup,
colours, external resources, WCAG contrast), themes:preview (signed links per page and
appearance), signed ?theme= preview and preview action in the site form, inherited colour
tokens in the admin. Base CSS split into theme.css + reusable theme-base.css.
- docs/THEME-ERSTELLUNG.md: binding guide for building additional themes elsewhere.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
1.9 KiB
PHP
61 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Themes\Sections;
|
|
|
|
use App\Pricing\OfferShowcase;
|
|
use App\Themes\Theme;
|
|
use Filament\Forms\Components\Radio;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Components\Toggle;
|
|
|
|
/**
|
|
* The offers OfferShowcase advertises right now (independent of the appearance), shown side by side,
|
|
* as a list or one after another (rotating). The section disappears when there is no current offer.
|
|
*/
|
|
class OffersSection extends Section
|
|
{
|
|
public const DISPLAYS = [
|
|
'grid' => 'Nebeneinander (Kacheln)',
|
|
'list' => 'Untereinander (Liste)',
|
|
'rotating' => 'Rollierend (eins nach dem anderen)',
|
|
];
|
|
|
|
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),
|
|
Radio::make('display')->label('Darstellung, wenn mehrere Angebote gelten')->options(self::DISPLAYS)->default('grid'),
|
|
TextInput::make('limit')->label('Höchstens anzeigen')->integer()->minValue(1)->maxValue(12)->default(6),
|
|
Toggle::make('featured_only')->label('Nur hervorgehobene Angebote')->default(false),
|
|
];
|
|
}
|
|
|
|
public function data(Theme $theme, array $data): array
|
|
{
|
|
$property = $theme->property();
|
|
|
|
return [
|
|
'heading' => $data['heading'] ?? null,
|
|
'display' => array_key_exists($data['display'] ?? '', self::DISPLAYS) ? $data['display'] : 'grid',
|
|
'offers' => $property
|
|
? app(OfferShowcase::class)->current($property, limit: (int) ($data['limit'] ?? 6) ?: 6, featuredOnly: (bool) ($data['featured_only'] ?? false))
|
|
: collect(),
|
|
];
|
|
}
|
|
}
|