Offers by their own rules, seasonal photos per section, theme authoring tooling

- 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>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 18:51:38 +02:00
1 parent bc77b64ea7
commit 7d0bc93abc
50 files changed
+2805 -259

No files matched your search

+19 -15
View File
@@ -2,15 +2,24 @@
namespace App\Themes\Sections;
use App\Models\SpecialOffer;
use App\Pricing\OfferShowcase;
use App\Themes\Theme;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
/**
* Public special offers (active, promoted, without code); the appearance's featured offer comes first.
* 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';
@@ -30,27 +39,22 @@ 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
{
$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);
}
$property = $theme->property();
return [
'heading' => $data['heading'] ?? null,
'offers' => $offers,
'featuredId' => $featured?->id,
'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(),
];
}
}