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:
1 parent
bc77b64ea7
commit
7d0bc93abc
50 files changed
+2805
-259
No files matched your search
@@ -3,10 +3,13 @@
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\DiscountType;
|
||||
use App\Enums\OfferKind;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Property;
|
||||
use App\Models\Season;
|
||||
use App\Models\SpecialOffer;
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\QuoteException;
|
||||
use App\Pricing\StayRequest;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -118,6 +121,59 @@ public function test_deposit_is_calculated_on_the_discounted_rent(): void
|
||||
$this->assertSame(20000 - 2000 + 10000, $quote->total());
|
||||
}
|
||||
|
||||
public function test_from_three_nights_ten_percent(): void
|
||||
{
|
||||
$this->offer(['name' => 'Ab 3 Nächten', 'min_nights' => 3, 'discount_value' => 10]);
|
||||
|
||||
$this->assertSame(0, $this->calculator->calculate($this->property, $this->stay('2026-02-10', '2026-02-12'))->discount());
|
||||
$this->assertSame(1500, $this->calculator->calculate($this->property, $this->stay('2026-02-10', '2026-02-13'))->discount());
|
||||
}
|
||||
|
||||
public function test_fixed_dates_package_applies_only_to_exactly_these_dates(): void
|
||||
{
|
||||
$this->offer([
|
||||
'name' => 'Ostsee-Woche',
|
||||
'kind' => OfferKind::FixedDates,
|
||||
'stay_from' => '2026-02-07',
|
||||
'stay_until' => '2026-02-14',
|
||||
'discount_type' => DiscountType::FixedStayPrice,
|
||||
'discount_value' => 29900,
|
||||
]);
|
||||
|
||||
$exact = $this->calculator->calculate($this->property, $this->stay('2026-02-07', '2026-02-14'));
|
||||
$shifted = $this->calculator->calculate($this->property, $this->stay('2026-02-08', '2026-02-14'));
|
||||
|
||||
$this->assertSame(7 * 5000 - 29900, $exact->discount());
|
||||
$this->assertSame(29900 + 10000, $exact->total());
|
||||
$this->assertSame(0, $shifted->discount());
|
||||
}
|
||||
|
||||
public function test_gap_filler_applies_inside_a_short_gap_and_may_waive_the_minimum_stay(): void
|
||||
{
|
||||
$this->property->seasons()->update(['min_nights' => 5]);
|
||||
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-02-01', 'ends_on' => '2026-02-10']);
|
||||
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-02-13', 'ends_on' => '2026-02-20']);
|
||||
$this->offer(['name' => 'Lückenfüller', 'kind' => OfferKind::GapFiller, 'max_gap_nights' => 4, 'waives_min_stay' => true, 'discount_value' => 20]);
|
||||
|
||||
$inGap = $this->calculator->calculate($this->property, $this->stay('2026-02-10', '2026-02-13'));
|
||||
|
||||
$this->assertSame(3000, $inGap->discount());
|
||||
$this->expectException(QuoteException::class);
|
||||
$this->calculator->calculate($this->property, $this->stay('2026-02-21', '2026-02-24'));
|
||||
}
|
||||
|
||||
public function test_gap_filler_ignores_gaps_longer_than_allowed_and_open_ended_free_periods(): void
|
||||
{
|
||||
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-02-01', 'ends_on' => '2026-02-10']);
|
||||
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-02-20', 'ends_on' => '2026-02-25']);
|
||||
$this->offer(['name' => 'Lückenfüller', 'kind' => OfferKind::GapFiller, 'max_gap_nights' => 4, 'discount_value' => 20]);
|
||||
|
||||
$longGap = $this->calculator->calculate($this->property, $this->stay('2026-02-10', '2026-02-13'));
|
||||
$openEnded = $this->calculator->calculate($this->property, $this->stay('2026-02-25', '2026-02-28'));
|
||||
|
||||
$this->assertSame([0, 0], [$longGap->discount(), $openEnded->discount()]);
|
||||
}
|
||||
|
||||
public function test_inactive_offers_are_ignored(): void
|
||||
{
|
||||
$this->offer(['is_active' => false]);
|
||||
|
||||
Reference in new issue
Block a user