Compare commits

...
33 changed files with 1208 additions and 89 deletions

No files matched your search

+1 -1
View File
@@ -43,7 +43,7 @@ MAIL_FROM_NAME="${APP_NAME}"
FEWO_OWNER_NAME="Brigitte Stommer"
FEWO_OWNER_EMAIL=fewo@stommer.de
FEWO_NOTIFICATION_EMAIL=fewo@stommer.de
# Nur Testbetrieb: alle E-Mails ausschließlich an diese Adresse (leer = normaler Versand)
# Harte Umleitung aller E-Mails (gilt immer). Normal leer lassen – Testbetrieb/Scharfschalten: Admin › System › Betrieb
FEWO_MAIL_REDIRECT_TO=
FEWO_BANK_ACCOUNT_HOLDER=
FEWO_BANK_IBAN=
+4 -1
View File
@@ -1,6 +1,6 @@
# Ferienwohnung Stommer
Website + booking management for a holiday apartment in Kühlungsborn. Concept and roadmap: `docs/KONZEPT.md`.
Website + booking management for a holiday apartment in Kühlungsborn. Concept and roadmap: `docs/KONZEPT.md`. **Current state and next steps: `docs/STATUS.md` – start there and update it after larger changes.** Parallel sessions (e.g. theme design on another machine): follow `docs/ZUSAMMENARBEIT.md` (branches, file ownership, deploy only from an up-to-date `main`).
- Hosting target: Strato shared webhosting (PHP + MySQL, no Node at runtime) – build assets locally.
- UI and all user-facing texts are German; code, identifiers and PHPDoc are English.
@@ -10,11 +10,14 @@ # Ferienwohnung Stommer
- Portals must be integrated through a pluggable channel-connector system (see concept §7), never hard-coded.
- Bookings/blocks use nights: `arrival <= night < departure`; same-day changeover is allowed. Reservations with an elapsed hold never occupy the calendar (scope `Booking::occupying()`), cron only updates status.
- Business operations live in `app/Actions` (CreateReservation, ConfirmBooking, …); Filament pages and Livewire components call them instead of changing bookings directly.
- Booking path 1 (KONZEPT §6a): request (`Reserved`, hold) → `SendOffer` (`OfferSent`, versioned, contract draft, signed link `offers.show`) → guest `AcceptOffer` (acceptance record, then `ConfirmBooking`) or `RejectOffer`; `ExpireReservations` handles both holding statuses (`BookingStatus::holding()`). Manual price changes are `QuoteLineType::Adjustment` lines.
- Minimum stay: season `min_nights`, relaxed in `PriceCalculator::minimumStayRelaxed` (offer `waives_min_stay`, gap filled completely, departure on the property's `changeover_weekday`, never below `min_stay_absolute`).
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts. Kinds (`OfferKind`): rule, fixed dates, gap filler (`App\Availability\GapFinder`). Which offers the website advertises is decided by `App\Pricing\OfferShowcase` (not by appearances); it prices fixed dates/gaps with `PriceCalculator`.
- 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/photos per section (stable `data.id` per placed section) and sections can be limited to appearances. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). New designs are **additional** themes: `php artisan themes:make <key>`, `themes:check`, `themes:preview` – never edit `ostsee-licht` for a new design; authoring rules in `docs/THEME-ERSTELLUNG.md`. Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for every account. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Strato specifics: `public/index.php` strips the internal `/releases/<v>/public` prefix from `REQUEST_URI` (signed URLs); `URL::forceRootUrl(APP_URL)` outside local/testing; mail routing: `App\Support\Settings` (admin page System › Betrieb) – test mode (default) sends every mail to the test recipient only, live delivers normally; `FEWO_MAIL_REDIRECT_TO` is a hard override. The booking form is protected against bots (`config('fewo.spam')`: honeypot, time trap, rate limits, max open holds per e-mail) – tests that submit it instantly set `fewo.spam.min_seconds` to 0.
- 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`.
+4 -1
View File
@@ -1,6 +1,6 @@
# Ferienwohnung Stommer
Website + booking management for a holiday apartment in Kühlungsborn. Concept and roadmap: `docs/KONZEPT.md`.
Website + booking management for a holiday apartment in Kühlungsborn. Concept and roadmap: `docs/KONZEPT.md`. **Current state and next steps: `docs/STATUS.md` – start there and update it after larger changes.** Parallel sessions (e.g. theme design on another machine): follow `docs/ZUSAMMENARBEIT.md` (branches, file ownership, deploy only from an up-to-date `main`).
- Hosting target: Strato shared webhosting (PHP + MySQL, no Node at runtime) – build assets locally.
- UI and all user-facing texts are German; code, identifiers and PHPDoc are English.
@@ -10,11 +10,14 @@ # Ferienwohnung Stommer
- Portals must be integrated through a pluggable channel-connector system (see concept §7), never hard-coded.
- Bookings/blocks use nights: `arrival <= night < departure`; same-day changeover is allowed. Reservations with an elapsed hold never occupy the calendar (scope `Booking::occupying()`), cron only updates status.
- Business operations live in `app/Actions` (CreateReservation, ConfirmBooking, …); Filament pages and Livewire components call them instead of changing bookings directly.
- Booking path 1 (KONZEPT §6a): request (`Reserved`, hold) → `SendOffer` (`OfferSent`, versioned, contract draft, signed link `offers.show`) → guest `AcceptOffer` (acceptance record, then `ConfirmBooking`) or `RejectOffer`; `ExpireReservations` handles both holding statuses (`BookingStatus::holding()`). Manual price changes are `QuoteLineType::Adjustment` lines.
- Minimum stay: season `min_nights`, relaxed in `PriceCalculator::minimumStayRelaxed` (offer `waives_min_stay`, gap filled completely, departure on the property's `changeover_weekday`, never below `min_stay_absolute`).
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts. Kinds (`OfferKind`): rule, fixed dates, gap filler (`App\Availability\GapFinder`). Which offers the website advertises is decided by `App\Pricing\OfferShowcase` (not by appearances); it prices fixed dates/gaps with `PriceCalculator`.
- 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/photos per section (stable `data.id` per placed section) and sections can be limited to appearances. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). New designs are **additional** themes: `php artisan themes:make <key>`, `themes:check`, `themes:preview` – never edit `ostsee-licht` for a new design; authoring rules in `docs/THEME-ERSTELLUNG.md`. Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for every account. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Strato specifics: `public/index.php` strips the internal `/releases/<v>/public` prefix from `REQUEST_URI` (signed URLs); `URL::forceRootUrl(APP_URL)` outside local/testing; mail routing: `App\Support\Settings` (admin page System › Betrieb) – test mode (default) sends every mail to the test recipient only, live delivers normally; `FEWO_MAIL_REDIRECT_TO` is a hard override. The booking form is protected against bots (`config('fewo.spam')`: honeypot, time trap, rate limits, max open holds per e-mail) – tests that submit it instantly set `fewo.spam.min_seconds` to 0.
- 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`.
+27 -48
View File
@@ -1,58 +1,37 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
# Ferienwohnung Stommer – Webseite und Vermietungsverwaltung
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
Webseite mit Buchungsanfrage und eine Verwaltung (Admin) für die Ferienwohnung Stommer, Strandstraße 15, 18225 Kühlungsborn. Ersetzt die bisherige WordPress-Seite www.fewo-stommer.de. Laravel 13, Filament 5, Livewire 4, Tailwind 4; Hosting bei Strato (Shared Webhosting, Hosting Pro).
## About Laravel
**Testbetrieb:** https://stommer.info · Verwaltung: https://stommer.info/admin (Konto + Zwei-Faktor-Anmeldung, siehe docs/BETRIEB.md §7)
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
## Wo steht was?
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
| Dokument | Inhalt |
|---|---|
| [docs/STATUS.md](docs/STATUS.md) | **Aktueller Stand**: was fertig ist, was offen ist, nächste Schritte – hier anfangen |
| [docs/ZUSAMMENARBEIT.md](docs/ZUSAMMENARBEIT.md) | Regeln für parallele Arbeit (z. B. Theme-Entwicklung auf einem anderen Rechner) – Branches, Dateibereiche, Ausliefern |
| [docs/KONZEPT.md](docs/KONZEPT.md) | Fachliches Konzept und alle Entscheidungen (Buchungswege §6a, Festlegungen §6b) |
| [docs/BETRIEB.md](docs/BETRIEB.md) | Server, Zugänge, Konfiguration, Konten/2FA, Backups, Löschfristen, bekannte Eigenheiten |
| [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) | Auslieferung auf Strato (Skript, Versionen, Gitea Actions) |
| [docs/THEMES.md](docs/THEMES.md) | Theme-System: Architektur, Bausteine und ihre Daten (Vorlagen-Vertrag) |
| [docs/THEME-ERSTELLUNG.md](docs/THEME-ERSTELLUNG.md) | **Verbindliche Anleitung für ein neues Theme** (Design-Sitzung) |
| [docs/PORTALE.md](docs/PORTALE.md) | Buchungsportale, Kalenderabgleich, Portal-E-Mails |
| [styles/README.md](styles/README.md) | Markenelemente (Logo, Favicon, Symbole, Wellenband) |
| docs/DATENSCHUTZ-*, GAP-DELTA, GO-LIVE-CHECKLISTE, LOESCHKONZEPT, BUCHUNGSPROZESS, DATENMODELL-KONZEPT | Analyse eines Datenschutz-Agenten (Annahmen markiert; maßgeblich ist KONZEPT.md) |
| [CLAUDE.md](CLAUDE.md) / [AGENTS.md](AGENTS.md) | Technische Leitplanken für KI-Assistenten (identisch) |
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals.
## Agentic Development
Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow:
## Lokal starten
```bash
composer require laravel/boost --dev
php artisan boost:install
composer install && npm ci
cp .env.example .env && php artisan key:generate
touch database/database.sqlite # PowerShell: New-Item database/database.sqlite
php artisan migrate:fresh --seed # Testdaten: Wohnung, Preise 2026, Seiten, Erscheinungsbilder
npm run build # oder npm run dev
php artisan serve # http://localhost:8000 · /admin: admin@example.com / password (2FA beim ersten Login)
php artisan test --compact # alle Tests müssen grün sein
```
Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices.
## Ausliefern
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
`bash scripts/deploy.sh staging deploy` – baut den **letzten Commit** und spielt ihn auf stommer.info (Details und Regeln: docs/DEPLOYMENT.md, docs/ZUSAMMENARBEIT.md).
+35 -6
View File
@@ -3,26 +3,40 @@
namespace App\Actions;
use App\Models\Property;
use Carbon\CarbonImmutable;
/**
* Copies all seasons starting in a given year to the following year with the same calendar dates,
* so a new price year only needs adjusting instead of re-entering.
* Copies all seasons starting in a given year to the following year, so a new price year only needs adjusting
* instead of re-entering. Optionally every season start is moved to the nearest given weekday (e.g. Saturday
* as changeover day); seasons that were adjacent stay adjacent.
*/
class CopySeasonsToNextYear
{
/**
* @param int|null $alignToWeekday ISO weekday (1 = Monday … 7 = Sunday) or null for the same calendar dates
* @return array{created: int, skipped: int}
*/
public function handle(Property $property, int $year): array
public function handle(Property $property, int $year, ?int $alignToWeekday = null): array
{
$created = 0;
$skipped = 0;
$seasons = $property->seasons()->whereYear('starts_on', $year)->get();
$seasons = $property->seasons()->whereYear('starts_on', $year)->orderBy('starts_on')->get();
// New start per old start date; an end that equals another season's start follows that start.
$moved = [];
foreach ($seasons as $season) {
$moved[$season->starts_on->toDateString()] = $this->shift($season->starts_on, $alignToWeekday);
}
foreach ($seasons as $season) {
$startsOn = $season->starts_on->addYearNoOverflow();
$endsOn = $season->ends_on->addYearNoOverflow();
$startsOn = $moved[$season->starts_on->toDateString()];
$endsOn = $moved[$season->ends_on->toDateString()] ?? $this->shift($season->ends_on, $alignToWeekday);
if ($endsOn->lessThanOrEqualTo($startsOn)) {
$skipped++;
continue;
}
if ($property->seasons()->overlapping($startsOn, $endsOn)->exists()) {
$skipped++;
@@ -40,4 +54,19 @@ public function handle(Property $property, int $year): array
return ['created' => $created, 'skipped' => $skipped];
}
/**
* One year later; with a weekday, moved to the nearest such day (at most 3 days earlier or later).
*/
private function shift(CarbonImmutable $date, ?int $weekday): CarbonImmutable
{
$next = $date->addYearNoOverflow();
if ($weekday === null) {
return $next;
}
$difference = ($weekday - $next->isoWeekday() + 7) % 7;
return $difference <= 3 ? $next->addDays($difference) : $next->subDays(7 - $difference);
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace App\Console\Commands;
use App\Support\Settings;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use Throwable;
#[Signature('mail:test {to? : Empfänger (Standard: Benachrichtigungsadresse)}')]
#[Description('Send a test e-mail through the configured mailer and report delivery errors (e.g. SMTP login)')]
class SendTestMail extends Command
{
/**
* Execute the console command.
*/
public function handle(): int
{
$to = (string) ($this->argument('to') ?: config('fewo.notification_email'));
$mailer = (string) config('mail.default');
$redirect = Settings::mailRedirect();
$this->line("Versandweg: {$mailer}".($mailer === 'smtp' ? ' ('.config('mail.mailers.smtp.host').':'.config('mail.mailers.smtp.port').')' : '').' · Absender: '.config('mail.from.address'));
if (filled($redirect)) {
$this->line("Umleitung aktiv: die Mail geht an {$redirect} statt an {$to}.");
}
if ($mailer === 'log') {
$this->warn('Versandweg "log": es wird nichts zugestellt. Zum echten Versand MAIL_MAILER=smtp und MAIL_PASSWORD setzen (docs/BETRIEB.md §5a).');
}
try {
Mail::raw("Testmail der Ferienwohnung Stommer\n\nGesendet am ".now()->format('d.m.Y H:i:s').' von '.config('app.url').".\nWenn diese Mail ankommt, funktioniert der Versand.", function ($message) use ($to): void {
$message->to($to)->subject('Testmail Ferienwohnung Stommer – '.now()->format('d.m.Y H:i'));
});
} catch (Throwable $exception) {
$this->error('Versand fehlgeschlagen: '.$exception->getMessage());
return self::FAILURE;
}
$this->info('Übergeben an den Mailserver – bitte Posteingang (und Spam-Ordner) prüfen.');
return self::SUCCESS;
}
}
+113
View File
@@ -0,0 +1,113 @@
<?php
namespace App\Filament\Pages;
use App\Enums\UserRole;
use App\Filament\Concerns\FollowsAdminMode;
use App\Support\Settings;
use BackedEnum;
use Filament\Actions\Action;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
use Filament\Schemas\Components\Actions;
use Filament\Schemas\Components\EmbeddedSchema;
use Filament\Schemas\Components\Form;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Text;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use UnitEnum;
/**
* Operating mode: test mode sends every e-mail to one test recipient only; switching live delivers to the
* real recipients (guests, landlord). Administrators only.
*/
class Operations extends Page
{
use FollowsAdminMode;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPower;
protected static string|UnitEnum|null $navigationGroup = 'System';
protected static ?string $navigationLabel = 'Betrieb';
protected static ?string $title = 'Betrieb';
protected static ?string $slug = 'betrieb';
protected static ?int $navigationSort = 1;
/** @var array<string, ?string> */
public array $data = [];
public static function canAccess(): bool
{
return (bool) auth()->user()?->hasRole(UserRole::Admin);
}
public function mount(): void
{
$this->form->fill([
'mode' => Settings::get(Settings::MODE, Settings::MODE_TEST),
'test_recipient' => Settings::get(Settings::TEST_RECIPIENT) ?? auth()->user()?->email,
]);
}
public function form(Schema $schema): Schema
{
return $schema
->statePath('data')
->components([
Section::make('E-Mail-Versand')
->description('Im Testbetrieb gehen alle E-Mails – Eingangsbestätigungen, Angebote, Bestätigungen, Erinnerungen, Benachrichtigungen – ausschließlich an die Testadresse, egal welche Adresse auf der Webseite eingetragen wurde.')
->schema([
Radio::make('mode')
->label('Betriebsart')
->options([
Settings::MODE_TEST => 'Testbetrieb – alle E-Mails an die Testadresse',
Settings::MODE_LIVE => 'Scharf geschaltet – E-Mails an Gäste und Vermieterin',
])
->required()
->live(),
TextInput::make('test_recipient')
->label('Testadresse')
->email()
->required(fn (Get $get): bool => $get('mode') === Settings::MODE_TEST)
->visible(fn (Get $get): bool => $get('mode') === Settings::MODE_TEST),
Text::make(fn (): string => filled(config('fewo.mail_redirect_to'))
? 'Hinweis: Auf diesem Server ist zusätzlich FEWO_MAIL_REDIRECT_TO='.config('fewo.mail_redirect_to').' gesetzt – diese Umleitung gilt immer, auch wenn hier scharf geschaltet ist.'
: ''),
]),
]);
}
public function content(Schema $schema): Schema
{
return $schema->components([
Form::make([EmbeddedSchema::make('form')])
->id('form')
->livewireSubmitHandler('save')
->footer([Actions::make([Action::make('save')->label('Speichern')->submit('save')])]),
]);
}
public function save(): void
{
$data = $this->form->getState();
if ($data['mode'] === Settings::MODE_LIVE && Settings::get(Settings::MODE) !== Settings::MODE_LIVE) {
Notification::make()->title('Scharf geschaltet')->body('Ab jetzt erhalten Gäste und Vermieterin die E-Mails direkt.')->warning()->send();
} else {
Notification::make()->title('Gespeichert')->success()->send();
}
Settings::save([
Settings::MODE => $data['mode'],
Settings::TEST_RECIPIENT => $data['test_recipient'] ?? Settings::get(Settings::TEST_RECIPIENT),
]);
}
}
@@ -23,6 +23,7 @@
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Notifications\Notification;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Components\Utilities\Get;
@@ -35,6 +36,8 @@
class SeasonsRelationManager extends RelationManager
{
public const WEEKDAYS = [1 => 'Montag', 2 => 'Dienstag', 3 => 'Mittwoch', 4 => 'Donnerstag', 5 => 'Freitag', 6 => 'Samstag', 7 => 'Sonntag'];
protected static string $relationship = 'seasons';
protected static ?string $title = 'Saisons & Preise';
@@ -111,6 +114,7 @@ public function table(Table $table): Table
->headerActions([
CreateAction::make(),
$this->copyToNextYearAction(),
$this->minimumStayRulesAction(),
$this->priceCalculatorAction(),
])
->recordActions([
@@ -179,22 +183,52 @@ private function seasonYears(): array
return $years->combine($years)->all();
}
/**
* The relaxations of the seasons' minimum stay, edited where the seasons are maintained.
*/
private function minimumStayRulesAction(): Action
{
return Action::make('minimumStayRules')
->label('Regeln Mindestaufenthalt')
->icon(Heroicon::OutlinedAdjustmentsHorizontal)
->color('gray')
->modalHeading('Mindestaufenthalt – Ausnahmen')
->modalDescription('Jede Saison hat ihre Mindestnächte. Diese Regeln erlauben kürzere Aufenthalte, wenn sie den Kalender nicht zerstückeln. Sonderangebote können den Mindestaufenthalt zusätzlich aufheben.')
->fillForm(fn (): array => $this->getOwnerRecord()->only(['changeover_weekday', 'min_stay_fill_gaps', 'min_stay_until_changeover', 'min_stay_absolute']))
->schema([
Select::make('changeover_weekday')->label('Typischer An- und Abreisetag')->options(self::WEEKDAYS)->placeholder('keiner'),
Toggle::make('min_stay_fill_gaps')->label('Kalenderlücken: kürzer erlaubt, wenn die Buchung eine Lücke zwischen zwei Belegungen vollständig füllt'),
Toggle::make('min_stay_until_changeover')->label('Kürzer erlaubt, wenn die Buchung am typischen Anreisetag endet (die Woche danach bleibt frei buchbar)'),
TextInput::make('min_stay_absolute')->label('Untergrenze für alle Ausnahmen')->integer()->minValue(1)->maxValue(14)->suffix('Nächte')->required(),
])
->action(function (array $data): void {
$this->getOwnerRecord()->update($data);
Notification::make()->title('Regeln gespeichert')->success()->send();
});
}
private function copyToNextYearAction(): Action
{
return Action::make('copyToNextYear')
->label('In Folgejahr kopieren')
->icon(Heroicon::OutlinedDocumentDuplicate)
->color('gray')
->modalDescription('Alle Saisons, die im gewählten Jahr beginnen, werden mit gleichen Kalenderdaten und Preisen ins Folgejahr übernommen. Bereits belegte Zeiträume werden übersprungen.')
->modalDescription('Alle Saisons, die im gewählten Jahr beginnen, werden mit Preisen und Mindestnächten ins Folgejahr übernommen. Bereits belegte Zeiträume werden übersprungen.')
->schema([
Select::make('year')
->label('Jahr kopieren')
->options(fn (): array => $this->seasonYears())
->default((string) now()->year)
->required(),
Select::make('weekday')
->label('Saisonbeginn legen auf')
->helperText('Jeder Saisonbeginn wird auf den nächstgelegenen Wochentag verschoben (höchstens 3 Tage); aneinandergrenzende Saisons bleiben lückenlos.')
->options(self::WEEKDAYS)
->placeholder('gleiche Kalenderdaten wie im Vorjahr')
->default(fn (): ?int => $this->getOwnerRecord()->changeover_weekday),
])
->action(function (array $data, CopySeasonsToNextYear $copySeasons): void {
$result = $copySeasons->handle($this->getOwnerRecord(), (int) $data['year']);
$result = $copySeasons->handle($this->getOwnerRecord(), (int) $data['year'], filled($data['weekday'] ?? null) ? (int) $data['weekday'] : null);
Notification::make()
->title("{$result['created']} Saisons nach ".((int) $data['year'] + 1).' kopiert')
@@ -121,6 +121,9 @@ public function form(Schema $schema): Schema
Toggle::make('is_combinable')
->label('Mit anderen kombinierbaren Angeboten kombinierbar')
->helperText('Sonst erhält der Gast automatisch das für ihn beste Einzelangebot.'),
Toggle::make('waives_min_stay')
->label('Mindestaufenthalt der Saison aufheben')
->helperText('Wenn das Angebot gilt, darf der Aufenthalt kürzer sein als die Mindestnächte der Saison (z. B. Special Weekend mit 2 Nächten, kurze Lücke).'),
]),
Section::make('Bewerbung auf der Webseite')
->description('Welche Angebote gerade erscheinen, ergibt sich automatisch: aktiv, ohne Aktionscode, im Buchungszeitraum, feste Termine nur solange frei, Lückenfüller je gefundener Lücke. Mehrere gleichzeitig werden im Baustein „Sonderangebote“ nebeneinander, als Liste oder rollierend gezeigt.')
@@ -144,10 +147,7 @@ public function form(Schema $schema): Schema
->visible(fn (Get $get): bool => $this->kind($get) === OfferKind::GapFiller)
->schema([
TextInput::make('max_gap_nights')->label('Lücken bis höchstens … Nächte')->integer()->minValue(1)->default(4)->required(),
Toggle::make('waives_min_stay')
->label('Mindestaufenthalt der Saison aufheben')
->helperText('Damit auch kurze Lücken (z. B. 2 Nächte bei 5 Nächten Mindestaufenthalt) buchbar werden.')
->default(true),
]),
Section::make('Bedingungen')
->description('Leere Felder bedeuten: keine Einschränkung.')
+55 -7
View File
@@ -5,6 +5,7 @@
use App\Actions\CreateReservation;
use App\Actions\RequestMarketingConsent;
use App\Availability\AvailabilityChecker;
use App\Enums\BookingStatus;
use App\Enums\ReferralSource;
use App\Exceptions\ReservationException;
use App\Models\Booking;
@@ -77,12 +78,17 @@ class BookingRequest extends Component
/** Honeypot, must stay empty. */
public string $website = '';
/** When the form was opened (time trap against bots); cannot be changed by the browser. */
#[Locked]
public int $openedAt = 0;
#[Locked]
public ?int $bookingId = null;
public function mount(?Property $property = null): void
{
$this->propertyId = ($property ?? Property::query()->where('is_active', true)->firstOrFail())->id;
$this->openedAt = now()->getTimestamp();
$this->month = CarbonImmutable::today()->format('Y-m');
$this->prefillFromSearch();
$this->utm = collect(request()->only(['utm_source', 'utm_medium', 'utm_campaign']))
@@ -215,17 +221,22 @@ public function submit(CreateReservation $createReservation): void
{
$this->validate();
if ($this->website !== '') {
// Bots: honeypot filled or submitted faster than a human can fill the form – silently ignored.
if ($this->website !== '' || now()->getTimestamp() - $this->openedAt < config('fewo.spam.min_seconds')) {
return;
}
$rateLimitKey = 'booking-request:'.request()->ip();
if (RateLimiter::tooManyAttempts($rateLimitKey, 5)) {
if ($this->tooManyRequests()) {
$this->addError('email', 'Zu viele Anfragen. Bitte versuchen Sie es später erneut oder rufen Sie uns an.');
return;
}
RateLimiter::hit($rateLimitKey, 3600);
if ($this->openRequestsOfEmail() >= config('fewo.spam.open_requests_per_email')) {
$this->addError('email', 'Zu dieser E-Mail-Adresse liegen bereits offene Anfragen vor. Wir melden uns in Kürze – bei Fragen rufen Sie uns gern an.');
return;
}
try {
$booking = $createReservation->handle(
@@ -260,6 +271,39 @@ public function submit(CreateReservation $createReservation): void
/**
* @return array<string, list<string>>
*/
/**
* Rate limits per IP address, per e-mail address and for all requests together (counted when they pass).
*/
private function tooManyRequests(): bool
{
$limits = [
'booking-request:'.request()->ip() => [config('fewo.spam.per_ip_per_hour'), 3600],
'booking-request-email:'.sha1(mb_strtolower($this->email)) => [config('fewo.spam.per_email_per_day'), 86400],
'booking-request-all' => [config('fewo.spam.total_per_hour'), 3600],
];
foreach ($limits as $key => [$max]) {
if (RateLimiter::tooManyAttempts($key, $max)) {
return true;
}
}
foreach ($limits as $key => [, $decay]) {
RateLimiter::hit($key, $decay);
}
return false;
}
private function openRequestsOfEmail(): int
{
return Booking::query()
->whereIn('status', BookingStatus::holding())
->where('hold_expires_at', '>', now())
->whereHas('guest', fn ($query) => $query->where('email', mb_strtolower($this->email)))
->count();
}
protected function rules(): array
{
return [
@@ -268,14 +312,18 @@ protected function rules(): array
'guests' => ['required', 'integer', 'min:1', 'max:'.$this->property->max_guests],
'extras.*' => ['nullable', 'integer', 'min:0', 'max:10'],
'promoCode' => ['nullable', 'string', 'max:50'],
'firstName' => ['required', 'string', 'max:255'],
'lastName' => ['required', 'string', 'max:255'],
'firstName' => ['required', 'string', 'max:255', 'not_regex:/https?:|www\.|<|>/i'],
'lastName' => ['required', 'string', 'max:255', 'not_regex:/https?:|www\.|<|>/i'],
'email' => ['required', 'email', 'max:255'],
'phone' => ['nullable', 'string', 'max:50'],
'street' => ['nullable', 'string', 'max:255'],
'postalCode' => ['nullable', 'string', 'max:20'],
'city' => ['nullable', 'string', 'max:255'],
'message' => ['nullable', 'string', 'max:5000'],
'message' => ['nullable', 'string', 'max:5000', function (string $attribute, mixed $value, \Closure $fail): void {
if (preg_match_all('~https?://|www\.~i', (string) $value) > config('fewo.spam.max_links')) {
$fail('Bitte schreiben Sie Ihre Nachricht ohne Links.');
}
}],
'referralSource' => ['nullable', Rule::enum(ReferralSource::class)],
'privacyAccepted' => ['accepted'],
];
+19
View File
@@ -27,6 +27,10 @@
'hold_hours',
'check_in_time',
'check_out_time',
'changeover_weekday',
'min_stay_fill_gaps',
'min_stay_until_changeover',
'min_stay_absolute',
'is_active',
])]
class Property extends Model
@@ -39,10 +43,25 @@ class Property extends Model
*
* @return array<string, string>
*/
/**
* Defaults of the minimum stay rules (as in the migration), also before the model is reloaded.
*
* @var array<string, mixed>
*/
protected $attributes = [
'min_stay_fill_gaps' => true,
'min_stay_until_changeover' => false,
'min_stay_absolute' => 2,
];
protected function casts(): array
{
return [
'is_active' => 'boolean',
'min_stay_fill_gaps' => 'boolean',
'min_stay_until_changeover' => 'boolean',
'changeover_weekday' => 'integer',
'min_stay_absolute' => 'integer',
];
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
/**
* One operational setting (key → value), read through App\Support\Settings.
*/
#[Fillable(['key', 'value'])]
class Setting extends Model {}
+25 -2
View File
@@ -40,8 +40,7 @@ public function calculate(Property $property, StayRequest $stay, ?CarbonImmutabl
$offers = $this->applicableOffers($property, $stay, $nightSeasons, $bookedAt);
$arrivalSeason = $nightSeasons[0];
$minimumStayWaived = $offers->contains(fn (SpecialOffer $offer): bool => $offer->waives_min_stay && $offer->kind === OfferKind::GapFiller);
if ($nights < $arrivalSeason->min_nights && ! $minimumStayWaived) {
if ($nights < $arrivalSeason->min_nights && ! $this->minimumStayRelaxed($property, $stay, $offers)) {
throw QuoteException::minimumStay($arrivalSeason->min_nights, $arrivalSeason->name);
}
@@ -125,6 +124,30 @@ private function accommodationLines(array $nightSeasons): array
), $runs);
}
/**
* Whether a stay shorter than the season's minimum is still allowed: an applicable offer waives it, or –
* never below the property's absolute minimum – the stay fills a calendar gap completely, or it ends on the
* typical changeover day (so the following week stays bookable).
*
* @param Collection<int, SpecialOffer> $offers
*/
private function minimumStayRelaxed(Property $property, StayRequest $stay, Collection $offers): bool
{
if ($offers->contains(fn (SpecialOffer $offer): bool => $offer->waives_min_stay)) {
return true;
}
if ($stay->nights() < max(1, (int) $property->min_stay_absolute)) {
return false;
}
if ($property->min_stay_until_changeover && $property->changeover_weekday !== null && $stay->departure->isoWeekday() === $property->changeover_weekday) {
return true;
}
return $property->min_stay_fill_gaps && $this->gaps->gapContaining($property, $stay->arrival, $stay->departure) === $stay->nights();
}
/**
* Active offers whose conditions the stay meets. The calendar gap is only looked up if a gap filler exists.
*
+3 -5
View File
@@ -2,9 +2,9 @@
namespace App\Providers;
use App\Support\Settings;
use App\Support\StripImageMetadata;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent;
@@ -24,10 +24,8 @@ public function register(): void
*/
public function boot(): void
{
// Test environments: deliver every e-mail to one address only, so no guest gets test mails.
if (filled(config('fewo.mail_redirect_to'))) {
Mail::alwaysTo(config('fewo.mail_redirect_to'));
}
// Test mode (System › Betrieb, default until switched live): every e-mail goes to the test recipient only.
Settings::applyMailRouting();
// Photos: remove metadata (GPS position, camera data) from uploaded originals, which stay downloadable.
Event::listen(MediaHasBeenAddedEvent::class, fn (MediaHasBeenAddedEvent $event) => StripImageMetadata::strip($event->media));
@@ -16,7 +16,9 @@
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Support\Icons\Heroicon;
use Filament\View\PanelsRenderHook;
use Filament\Widgets\AccountWidget;
use Illuminate\Contracts\View\View;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
@@ -58,6 +60,8 @@ public function panel(Panel $panel): Panel
}),
])
->brandName('FeWo Stommer · Verwaltung')
// As long as the site is not switched live, every page shows where the e-mails go.
->renderHook(PanelsRenderHook::BODY_START, fn (): View => view('filament.test-mode-banner'))
->navigationGroups(['Vermietung', 'Webseite', 'System'])
->colors([
'primary' => Color::Sky,
+92
View File
@@ -0,0 +1,92 @@
<?php
namespace App\Support;
use App\Models\Setting;
use Illuminate\Mail\MailManager;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Mail;
use Throwable;
/**
* Operational settings from the admin (System › Betrieb), cached. The most important one: the operating mode.
* In **test mode** (the default until the site is switched live) every e-mail goes to the test recipient only,
* whatever address was entered on the website.
*/
class Settings
{
public const MODE = 'operations.mode';
public const TEST_RECIPIENT = 'operations.test_recipient';
public const MODE_TEST = 'test';
public const MODE_LIVE = 'live';
private const CACHE_KEY = 'settings.all';
public static function get(string $key, ?string $default = null): ?string
{
try {
$values = Cache::rememberForever(self::CACHE_KEY, fn (): array => Setting::query()->pluck('value', 'key')->all());
} catch (Throwable) {
return $default; // e.g. before the migrations ran
}
return $values[$key] ?? $default;
}
/**
* @param array<string, ?string> $values
*/
public static function save(array $values): void
{
foreach ($values as $key => $value) {
Setting::query()->updateOrCreate(['key' => $key], ['value' => $value]);
}
Cache::forget(self::CACHE_KEY);
self::applyMailRouting();
}
public static function isLive(): bool
{
return self::get(self::MODE, self::MODE_TEST) === self::MODE_LIVE;
}
/**
* Where all e-mails go instead of their real recipients, or null when mails are delivered normally.
* FEWO_MAIL_REDIRECT_TO in .env always wins (hard override for test servers).
*/
public static function mailRedirect(): ?string
{
$override = config('fewo.mail_redirect_to');
if (filled($override)) {
return (string) $override;
}
if (self::isLive()) {
return null;
}
return self::get(self::TEST_RECIPIENT) ?: (config('fewo.notification_email') ?: null);
}
/**
* Applies the redirect to the mailer; called at boot and after saving.
*/
public static function applyMailRouting(): void
{
$manager = Mail::getFacadeRoot();
if (! $manager instanceof MailManager) {
return; // Mail::fake() in tests
}
$redirect = self::mailRedirect();
$manager->purge();
if (filled($redirect)) {
$manager->alwaysTo($redirect);
}
}
}
+17 -1
View File
@@ -50,9 +50,25 @@
| Further retention periods (docs/LOESCHKONZEPT.md). The defaults are PROPOSALS – please have them
| confirmed according to the general legal opinion (tax advisor / legal advice) and adjust here.
*/
// Test environments: every e-mail goes to this address only (instead of guests/landlord). Empty = normal delivery.
// Hard override: every e-mail goes to this address only, regardless of the operating mode in the admin
// (System › Betrieb). Empty = the admin setting decides (test mode → test recipient, live → real recipients).
'mail_redirect_to' => env('FEWO_MAIL_REDIRECT_TO'),
// Protection of the booking form against bots (no external captcha service – GDPR). Every request holds
// the dates for the hold time, so automated requests could block the calendar.
'spam' => [
// Faster than this after opening the page = bot; silently ignored.
'min_seconds' => (int) env('FEWO_SPAM_MIN_SECONDS', 4),
'per_ip_per_hour' => (int) env('FEWO_SPAM_PER_IP_PER_HOUR', 5),
'per_email_per_day' => (int) env('FEWO_SPAM_PER_EMAIL_PER_DAY', 3),
// Requests/offers of one e-mail address that hold dates at the same time.
'open_requests_per_email' => (int) env('FEWO_SPAM_OPEN_REQUESTS_PER_EMAIL', 2),
// All website requests together (flood protection).
'total_per_hour' => (int) env('FEWO_SPAM_TOTAL_PER_HOUR', 30),
// Links allowed in the message.
'max_links' => (int) env('FEWO_SPAM_MAX_LINKS', 1),
],
// Daily database backup (php artisan backup:database): number of dumps kept in storage/app/private/backups.
'backup' => [
'keep' => (int) env('FEWO_BACKUP_KEEP', 14),
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Relaxations of the seasons' minimum stay (see Property::minimumStayRules / PriceCalculator).
*/
public function up(): void
{
Schema::table('properties', function (Blueprint $table) {
$table->unsignedTinyInteger('changeover_weekday')->nullable()->after('check_out_time');
$table->boolean('min_stay_fill_gaps')->default(true)->after('changeover_weekday');
$table->boolean('min_stay_until_changeover')->default(false)->after('min_stay_fill_gaps');
$table->unsignedTinyInteger('min_stay_absolute')->default(2)->after('min_stay_until_changeover');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('properties', function (Blueprint $table) {
$table->dropColumn(['changeover_weekday', 'min_stay_fill_gaps', 'min_stay_until_changeover', 'min_stay_absolute']);
});
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Operational settings changed in the admin (System › Betrieb), e.g. test mode and test recipient.
*/
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->text('value')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
}
};
+16 -3
View File
@@ -72,15 +72,24 @@ ## 5. Konfiguration auf dem Server (`shared/.env`)
| `FEWO_BANK_*` | leer | für Verträge/Angebote noch einzutragen |
| `FEWO_HEALTH_TOKEN`, `FEWO_SCHEDULER_TOKEN`, `FEWO_AUTOMATION_SECRET` | gesetzt | für n8n (Überwachung, Scheduler-Ersatz, Webhooks) |
## 5a. E-Mail: Testbetrieb und scharf schalten
- **Betriebsart** in der Verwaltung: **System › Betrieb** (nur Administratoren). Jede Installation beginnt im **Testbetrieb**: alle E-Mails (an Gäste, Vermieterin, Benachrichtigungen) gehen ausschließlich an die dort eingetragene **Testadresse** (ohne Eintrag: `FEWO_NOTIFICATION_EMAIL`), egal was auf der Webseite eingetragen wurde. Ein gelber Hinweis oben in der Verwaltung zeigt das an. Erst „Scharf geschaltet“ liefert an die echten Empfänger.
- `FEWO_MAIL_REDIRECT_TO` in `shared/.env` ist eine **harte Überschreibung** für Testserver (gilt auch bei „scharf“); normalerweise leer lassen.
- **Versandweg:** Standard `MAIL_MAILER=log` – dann wird gar nichts zugestellt (auch nicht im Protokoll gespeichert). Für echten Versand in `shared/.env` `MAIL_MAILER=smtp` und `MAIL_PASSWORD=<Passwort von fewo@stommer.de>` (nur selbst eintragen), dann `bash scripts/deploy.sh staging artisan optimize`.
- **Versand prüfen:** `bash scripts/deploy.sh staging artisan mail:test` – zeigt Versandweg, Umleitung und Fehler (z. B. SMTP-Anmeldung) und schickt eine Testmail.
- Dass jede Mail-Vorlage fehlerfrei aufgebaut wird (17 Mail-Typen, in ihrem echten Zustand), prüft `tests/Feature/MailRenderingTest.php`.
## 6. Erledigt / offen im Testbetrieb
Erledigt (22.10.2026): Ordnerstruktur, `shared/.env`, Migrationen, Grunddaten (`ProductionSeeder`: Wohnung, Saisons 2026, Inhalte, Seiten, Erscheinungsbilder), HTTPS unter stommer.info, Gesundheitscheck mit automatischem Rollback.
Erledigt (22.10.2026): Ordnerstruktur, `shared/.env`, Migrationen, Grunddaten (`ProductionSeeder`: Wohnung, Saisons 2026, Inhalte, Seiten, Erscheinungsbilder), HTTPS unter stommer.info, Gesundheitscheck mit automatischem Rollback, Admin-Konto `lars@stommer.com` mit 2FA, 39 Fotos importiert und von Metadaten bereinigt, Ende-zu-Ende-Durchlauf Anfrage → Angebot → Annahme (Testbuchung 2026-0002, darf gelöscht werden).
Offen:
- **Admin-Benutzer anlegen** (§7) und 2FA einrichten.
- **Konto für Brigitte** anlegen: System › Benutzer, Rolle Administrator, Ansicht Einfach (§7).
- **E-Mail im Testbetrieb** einschalten (§5a): Versandweg SMTP + Passwort; Betriebsart steht auf Testbetrieb mit Testadresse lars@stommer.com.
- **Cronjob** (Kundenlogin › Cronjobs), jede Minute:
`/opt/RZphp84/bin/php-cli /mnt/web508/e3/26/51539426/htdocs/test.fewo-stommer.de/current/artisan schedule:run`
Falls Strato nicht minütlich erlaubt: n8n ruft jede Minute `https://stommer.info/automation/scheduler?token=<FEWO_SCHEDULER_TOKEN>` auf.
Falls Strato nicht minütlich erlaubt: n8n ruft jede Minute `https://stommer.info/automation/scheduler` mit Header `Authorization: Bearer <FEWO_SCHEDULER_TOKEN>` auf.
- Bankdaten, Vertrags- und AGB-Texte, Rechtstexte prüfen.
### Fotos aus dem alten WordPress übernehmen
@@ -129,6 +138,7 @@ ## 7a. Datensicherung, Löschfristen, Automationen
```
Regelmäßig z. B. per Aufgabenplanung des NAS/PC ausführen (braucht den SSH-Schlüssel aus §4).
- **Löschfristen** (Vorschläge, rechtlich zu bestätigen – `config/fewo.php` bzw. `.env`): Gästedaten 10 Jahre nach letztem Aufenthalt (`FEWO_GUEST_RETENTION_YEARS`), nie verbindlich gewordene Anfragen/Angebote 6 Monate (`FEWO_RETENTION_INQUIRY_MONTHS`), Textauszüge von Portal-Mails 90 Tage (`FEWO_RETENTION_PORTAL_EMAIL_EXCERPT_DAYS`), Herkunftsangaben/UTM 24 Monate (`FEWO_RETENTION_ATTRIBUTION_MONTHS`). Läuft täglich 03:00. Anonymisierung ersetzt Name, Kontaktdaten, Nachrichten, Notizen, Herkunft und Bewertungs-Anzeigenamen; Buchung, Preise und Zahlungen bleiben als Beleg.
- **Bot-Schutz der Buchungsanfrage** (ohne externen Captcha-Dienst, `config/fewo.php › spam`): verstecktes Köderfeld, Zeitsperre (Absenden schneller als 4 s nach dem Öffnen = Bot, wird still ignoriert), höchstens 5 Anfragen/Stunde je IP, 3/Tag je E-Mail-Adresse, 30/Stunde insgesamt, höchstens 2 gleichzeitig vorgemerkte Anfragen je E-Mail-Adresse (sonst könnten Bots den Kalender blockieren), keine Links in Namen und höchstens 1 Link in der Nachricht.
- **Automationen (n8n):** Token bitte als Header `Authorization: Bearer <token>` senden (landet nicht in Server-Logs); `?token=` funktioniert übergangsweise weiter.
- **Fotos:** Beim Hochladen werden Metadaten (GPS, Kamera) aus dem Original entfernt; bestehende Fotos einmalig: `php artisan photos:strip-metadata` (`--force` bearbeitet auch bereits markierte erneut). Hinweis: bewusst mit GD – Imagick (auf Strato installiert) behält EXIF beim Speichern.
@@ -144,6 +154,9 @@ ## 8. Bekannte Eigenheiten und Lösungen
| Ersteinrichtung mit Factories schlägt fehl | Produktion ohne Dev-Pakete | `ProductionSeeder` |
| Kein SSL für Subdomain | Paket erlaubt SSL nur für Hauptdomains | Testbetrieb auf `stommer.info` |
| `Disk quota exceeded` beim Hochladen / Hinweis „zu viele Dateien“ | Webspace-Kontingent voll (geteilt mit allen anderen Seiten/Backups im Paket); jede Version belegt ~136 MB | Es ist die **Anzahl der Dateien** (Inode-Limit), nicht der Platz. Der Server behält nur die aktive Version (Geschichte als Git-Tags in Gitea), `vendor` wird beim Build ausgedünnt (~15.000 statt ~19.500 Dateien je Version); Reste abgebrochener Läufe räumt das nächste Deployment selbst weg. **Ordner außerhalb des Deploy-Ordners entscheidet nur Lars** (teils produktiv). |
| Signierte Links (Angebot, Bewertung, Newsletter, Vorschau) mit 403 | Strato meldet nach der `.htaccess`-Weiterleitung den internen Pfad `/releases/<version>/public/…` in `REQUEST_URI` | `public/index.php` entfernt dieses Präfix vor dem Start von Laravel |
| Keine E-Mails im Testbetrieb, auch nicht im Protokoll | `MAIL_MAILER=log` schreibt auf Stufe *debug*, `LOG_LEVEL=info` verwirft das | Zum Testen SMTP einschalten; `FEWO_MAIL_REDIRECT_TO` leitet dann **alle** Mails an eine Adresse (gesetzt: lars@stommer.com) |
| Foto-Metadaten (GPS) blieben erhalten | Spatie Image nutzt Imagick, wenn installiert (Strato), und Imagick behält EXIF | `StripImageMetadata` erzwingt GD |
| Windows: Symlinks, `php` nicht im PATH | Git Bash | Deploy nur gegen Strato testen; `export PATH="<php-ordner>:$PATH"` |
## 9. Nützliche Befehle
+8 -6
View File
@@ -57,7 +57,8 @@ ## 5. Verwaltungssystem (Admin)
- **Dashboard:** nächste An-/Abreisen, offene Anfragen, fällige Zahlungen, Auslastung/Umsatz pro Jahr.
- **Kalender:** alle Buchungen + Portal-Blockierungen + manuelle Sperrzeiten (Eigennutzung, Renovierung).
- **Saisons & Preise:** pro Saison Zeitraum, Preis/Nacht, Mindestaufenthalt, optional An-/Abreisetage. Jahr kopieren („Preise 2027 = 2026“) mit einem Klick.
- **Saisons & Preise:** pro Saison Zeitraum, Preis/Nacht, Mindestaufenthalt, optional An-/Abreisetage. Jahr kopieren („Preise 2027 = 2026“) mit einem Klick – optional mit **Saisonbeginn auf einen Wochentag** (z. B. Samstag; aneinandergrenzende Saisons bleiben lückenlos).
- **Ausnahmen vom Mindestaufenthalt** (je Wohnung, „Preise & Angebote › Saisons › Regeln Mindestaufenthalt“): kürzer erlaubt, wenn die Buchung eine Kalenderlücke vollständig füllt oder am typischen Anreisetag endet; Sonderangebote jeder Art können ihn aufheben; absolute Untergrenze für alle Ausnahmen (Standard 2 Nächte).
- **Preisbestandteile (konfigurierbar):** Endreinigung/Service (108 €), Zusatzperson ab 3. Person (7,50 €/Nacht), Extras (Bettwäsche 14 €, Handtücher 11 €, Paket 23 €), Kurtaxe (Hinweis, vor Ort), Anzahlungsquote 35 %, Restzahlungsfrist 4 Wochen.
- Darstellung wahlweise wie heute („erste Nacht inkl. Endreinigung“) oder transparent getrennt – die Berechnung ist identisch.
- **Sonderangebote & Sonderkonditionen:** werden bei jeder Preisberechnung automatisch geprüft (siehe 5a).
@@ -126,6 +127,7 @@ ### 6b. Weitere Festlegungen (22.10.2026)
- **Lösch- und Aufbewahrungsfristen** nach allgemeiner Rechtsauffassung festlegen (fachkundig bestätigen lassen); technisch als Einstellungen umsetzen (Vorschläge: docs/LOESCHKONZEPT.md).
- **Auftragsverarbeitung mit Strato:** Strato stellt dafür nach unserem Kenntnisstand einen Standardvertrag im Kundenbereich bereit – dort prüfen/abschließen.
- **Portalgäste** = Gäste, die über ein Buchungsportal (FeWo-direkt u. a.) buchen; ihre Daten erreichen uns nur über die Portal-Benachrichtigungen. Wir betreiben selbst kein Portal.
- **Testbetrieb vs. scharf geschaltet** (System › Betrieb): bis zum Scharfschalten gehen alle E-Mails nur an eine einstellbare Testadresse. **Bot-Schutz** der Anfrage ohne externe Dienste (DSGVO).
- **Verwaltung:** mehrere Verwalter-Konten (mindestens Lars und Brigitte Stommer); **einfache Ansicht** (Anfragen/Buchungen/Verträge, Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen) und **Expertenansicht** (alle Einstellungen), umschaltbar je Benutzer – umgesetzt.
- Die Dokumente BUCHUNGSPROZESS, DATENMODELL-KONZEPT, GAP-DELTA, GO-LIVE-CHECKLISTE, LOESCHKONZEPT und DATENSCHUTZ-* wurden von einem Analyse-Agenten erstellt; die dort genannten „verbindlichen Entscheidungen E1–E7“ sind **dessen Annahmen**. Maßgeblich sind die Festlegungen in diesem Dokument.
@@ -177,11 +179,11 @@ ## 9. Hosting & Deployment (Strato)
## 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:** 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.
2. **Kalender & Anfrage:** Belegung, Anfrageformular, Vorreservierung mit Haltezeit, Sonderangebote (Rabattaktion, fester Termin, Lückenfüller), Mindestaufenthalt mit Ausnahmen, Sperrzeiten, Buchungsverwaltung. ✅
3. **Buchungsworkflow:** Buchungsweg 1 Anfrage → Angebot → Annahme durch den Gast (§6a), Mietvertrag-PDF, Zahlungsfristen & Erinnerungen, Anreiseinfos. ✅ (Mietbedingungen/Storno/Angebotstexte noch als Muster)
4. **Webseite:** Theme-System, Bausteine, Erscheinungsbilder (Bilder je Baustein, saisonale Bausteine), Seiten, SEO, Markengrafiken ✅ · neues Design-Theme in eigener Session (docs/ZUSAMMENARBEIT.md, docs/THEME-ERSTELLUNG.md).
5. **Connectoren:** iCal-Import/-Export, Sync-Log, Konfliktwarnung, Portal-E-Mails. ✅ (echte Portal-Mails zur Feinabstimmung des Parsers fehlen)
6. **Go-Live:** Strato-Deployment und Testbetrieb ✅ · offen: Cronjob, Produktion, Umleitungen, Rechtstexte, echte Testbuchungen (Stand: docs/STATUS.md).
## 11. Offene Punkte / benötigte Inhalte
+103
View File
@@ -0,0 +1,103 @@
# Projektstand
Stand: 22.10.2026, spätabends · ausgelieferter Stand: siehe neuester Git-Tag `deploy/staging/*` · 200 Tests grün
> Dieses Dokument ist der Einstieg für jede neue Arbeitssitzung. Bitte bei größeren Änderungen fortschreiben (Abschnitte „Fertig“, „Offen“, „Nächste Schritte“).
## 1. Fertig (umgesetzt, getestet, auf stommer.info)
**Vermietung**
- **Preise:** Saisons mit Preis/Nacht und Mindestnächten; Preisrechner; Extras (Bettwäsche, Handtücher); Endreinigung, Zusatzperson, Anzahlungsquote, Restzahlungsfrist je Wohnung. In Folgejahr kopieren, optional mit Saisonbeginn auf einem Wochentag. *(Code: `app/Pricing`, `CopySeasonsToNextYear`)*
- **Mindestaufenthalt mit Ausnahmen:** Kalenderlücke vollständig gefüllt; Abreise am typischen Anreisetag; Sonderangebot hebt auf; absolute Untergrenze. *(`PriceCalculator::minimumStayRelaxed`, Einstellungen „Regeln Mindestaufenthalt“)*
- **Sonderangebote:** Rabattaktion, fester Termin (auch Pauschalpreis) und Lückenfüller (erkennt Lücken selbst). Dazu Aktionscodes, Priorität und „Hervorheben“. Die Webseite bewirbt Angebote nach eigenen Regeln (`OfferShowcase`), nebeneinander, als Liste oder rollierend. *(KONZEPT §5a)*
- **Buchungsweg 1 – Anfrage → Angebot → Annahme** (KONZEPT §6a):
1. Der Gast fragt unverbindlich an; der Zeitraum ist für die Haltezeit vorgemerkt.
2. Die Vermieterin öffnet „Angebot senden“ und passt bei Bedarf Termin, Personen, Rabattcode, Preis, Gültigkeit, Nachricht und Gastdaten an.
3. Der Gast erhält eine E-Mail mit Vertragsentwurf (PDF) und einem signierten Link.
4. Auf der Angebotsseite nimmt er an (Annahmenachweis ohne IP) oder lehnt ab.
5. Nach der Annahme: Bestätigung und Mietvertrag, Zahlungsfristen laufen.
Die Angebotsfrist verfällt automatisch. „Direkt bestätigen“ gibt es für telefonisch vereinbarte Buchungen. *(`SendOffer`, `AcceptOffer`, `RejectOffer`, `OfferController`, `resources/views/offer.blade.php`)*
- **Zahlungen:** manuell erfassen, Erinnerungen an Anzahlung und Rest, Anreiseinformationen, Bewertungsanfrage nach Abreise.
- **Gästekartei:** Notizen, Tags, CSV-Export, Werbe-Einwilligung mit Bestätigung per E-Mail (Double-Opt-in). Eine neue Anfrage überschreibt keine Stammdaten.
- **Portale:** iCal-Import und -Export, Überwachung, Portal-E-Mails als schneller Weg, Aufgaben für manuelle Sperren. *(PORTALE.md)*
- **Bewertungen:** Einladung per E-Mail, Freigabe im Admin, Anzeige mit Pflichthinweis zur Echtheit.
**Verwaltung (Admin)**
- **Rollen:** Administrator, Vermietung, Inhalte.
- **Ansichten:** Die **einfache Ansicht** zeigt Anfragen & Buchungen, Sperrzeiten, **Preise & Angebote**, Gäste, Portal-Aufgaben, Bewertungen und Bilder. Die **Expertenansicht** zeigt alles. Umschalten im Benutzermenü.
- **Sicherheit:** 2FA ist für **alle** Konten Pflicht; Administratoren können die 2FA eines anderen Kontos zurücksetzen und Passwörter neu vergeben.
**Webseite**
- **Theme-System:** Basis-Theme „Ostsee-Licht“, 15 Bausteine, Seiten-Baukasten.
- **Erscheinungsbilder** für Standard, Sommer, Winter, Weihnachten und Silvester:
- Bilder je Baustein, Bausteine nur in bestimmten Erscheinungsbildern,
- Vorschau-Links, Bildauswahl mit Vorschaubild.
- **Markengrafiken** im Theme: Logo, Favicon, Symbole, Wellenband, Illustration. *(`public/brand`, `partials/brand`)*
- **Theme-Werkzeuge:** `themes:make`, `themes:check`, `themes:preview`; Anleitung in THEME-ERSTELLUNG.md.
- **Fotos:** 39 Fotos aus dem alten WordPress importiert, GPS- und Kameradaten entfernt.
**Betrieb und Datenschutz**
- **Deployment:** atomare Versionen auf Strato, Gesundheitscheck mit automatischem Zurückschalten; Versionsgeschichte als Git-Tags. Nur die aktive Version liegt auf dem Server (Strato-Dateilimit).
- **Datenbank-Backup:** täglich; `scripts/backup-pull.sh` holt es samt Dateien aufs NAS.
- **Datenschutz:**
- Anonymisierung und Löschfristen (Vorschläge) laufen täglich.
- Sicherheits-Header sind gesetzt; Automations-Tokens werden per Header übergeben.
- Keine externen Quellen (Schriften selbst gehostet).
- **Betriebsart** (System › Betrieb): Testbetrieb (Standard) schickt alle Mails nur an eine Testadresse, „scharf geschaltet“ an die echten Empfänger; Hinweisbanner in der Verwaltung. `mail:test` prüft den Versand; alle 17 Mail-Typen werden in Tests vollständig aufgebaut.
- **Bot-Schutz der Buchungsanfrage:** Köderfeld, Zeitsperre, Begrenzungen je IP/E-Mail/gesamt, höchstens 2 gleichzeitige Vormerkungen je E-Mail, keine Links (ohne externen Captcha-Dienst).
- **Testbetrieb:** `noindex`.
## 2. Stand auf stommer.info (Testbetrieb)
| | |
|---|---|
| Konten | `lars@stommer.com` (Administrator); Konto für Brigitte noch anzulegen (Administrator, **einfache Ansicht**) |
| Daten | Wohnung, Preise 2026, 39 Fotos, Seiten, 5 Erscheinungsbilder; **Testbuchung 2026-0002** („E2E Testgast“, angenommenes Angebot) – darf gelöscht werden |
| E-Mail | Betriebsart **Testbetrieb** (System › Betrieb), Testadresse `lars@stommer.com` – alle Mails gingen nur dorthin. Versandweg aber noch `log` (nichts wird zugestellt): `MAIL_MAILER=smtp` + `MAIL_PASSWORD` in `shared/.env` selbst eintragen, dann `artisan mail:test` (BETRIEB.md §5a) |
| Cronjob | **noch nicht eingerichtet** – ohne ihn laufen Fristabläufe, Erinnerungen, Kalenderabgleich, Backups nicht automatisch (BETRIEB.md §6) |
| Typischer Anreisetag | noch nicht eingetragen (Preise & Angebote › Saisons › Regeln Mindestaufenthalt) |
## 3. Offen
**Entscheidungen und Inhalte (Betreiber)**
- Impressum und Datenschutzerklärung werden separat erstellt; dann unter Webseite › Texte › Rechtliches eintragen.
- Mietbedingungen, Storno-Regeln, AGB; Texte zu Angebot und Annahme, einschließlich der Beschriftung des Annahme-Buttons, fachkundig freigeben lassen (Webseite › Texte).
- Löschfristen nach allgemeiner Rechtsauffassung bestätigen (BETRIEB.md §7a); Auftragsverarbeitung mit Strato im Kundenbereich prüfen.
- Bankverbindung (`FEWO_BANK_*`), Preise 2027, Meldeschein: Ob der Ferienservice Balu ihn übernimmt, ist noch zu klären; die Kurabgabe erledigt Balu vor Ort.
- Sprachen: nur Deutsch oder auch Englisch?
**Technik**
- Cronjob auf Strato einrichten (BETRIEB.md §6).
- Neues Design-Theme: läuft in einer eigenen Session auf dem privaten Rechner (ZUSAMMENARBEIT.md, THEME-ERSTELLUNG.md).
- Logo in E-Mails und im Vertrags-PDF (`public/brand/logo-600.png` liegt bereit).
- Content-Security-Policy: braucht wegen Livewire/Filament Nonces und einen sorgfältigen Test.
- Produktion `www.fewo-stommer.de` vorbereiten:
- eigener Deploy-Ordner, Datenbank und `.env`,
- Umleitungen von der alten WordPress-Seite,
- echte Testbuchungen (GO-LIVE-CHECKLISTE.md).
- Später:
- Buchungsweg 2 (verbindliche Direktbuchung), erst bei verlässlicher Synchronisation mit FeWo-direkt,
- Portalbuchungen als vollwertige Buchungen (DATENMODELL-KONZEPT.md),
- Stornoformular für Gäste, KI-Angebotsentwürfe, Marketing und Social Media.
- SSH-Schlüssel des Firmen-Laptops vom Server entfernen, sobald der private PC eingerichtet ist (BETRIEB.md §4).
## 4. Nächste Schritte (Vorschlag)
1. Cronjob einrichten; SMTP einschalten und mit `mail:test` prüfen (Mails landen wegen Testbetrieb nur bei Lars); Konto für Brigitte anlegen.
1a. Vor dem Go-Live: System › Betrieb auf „scharf geschaltet“ stellen – erst dann erhalten Gäste die Mails.
2. Brigitte probt Anfrage → Angebot → Annahme mit einem eigenen Test (Angebotslink über die Aktion „Angebotslink“).
3. Design-Theme auf dem privaten Rechner (eigene Session, siehe ZUSAMMENARBEIT.md).
4. Rechtstexte und Bedingungen einpflegen, Produktion einrichten, Umzug von WordPress.
## 5. Schnellreferenz Code
| Bereich | Ort |
|---|---|
| Geschäftsabläufe | `app/Actions/*` (CreateReservation, SendOffer, AcceptOffer, RejectOffer, ConfirmBooking, DeclineBooking, ExpireReservations, RecordPayment, SyncChannel, ProcessPortalMail, AnonymizeGuests …) |
| Preise/Angebote | `app/Pricing/*` (PriceCalculator, OfferShowcase, AdvertisedOffer), `app/Availability/*` (AvailabilityChecker, GapFinder) |
| Verwaltung | `app/Filament/**` (Ansichten: `App\Enums\AdminMode`, Trait `FollowsAdminMode`) |
| Webseite | `app/Themes/**`, `resources/themes/ostsee-licht/**`, `config/themes.php` |
| Befehle | `users:create`, `photos:import`, `photos:strip-metadata`, `backup:database`, `themes:make/check/preview`, `channels:sync`, `bookings:expire-holds` |
| Zeitpläne | `routes/console.php` (jede Minute Postfach, alle 5 Min. Fristen/Abgleich, täglich Erinnerungen, Bewertungen, Anonymisierung 03:00, Backup 02:30) |
| Einstellungen | `config/fewo.php` (Frist, Löschfristen, Backup, Mail-Umleitung), `config/content.php` (bearbeitbare Texte) |
+17 -2
View File
@@ -2,6 +2,8 @@ # Neues Theme erstellen – verbindliche Bauanleitung
Stand: 22.10.2026 · gilt für jede Design-Sitzung (z. B. auf dem privaten Rechner mit dem Skill/Plugin `frontend-design`) · Architektur und Datenverträge: [THEMES.md](THEMES.md)
> **Vor dem Start:** [ZUSAMMENARBEIT.md](ZUSAMMENARBEIT.md) lesen – die Design-Session arbeitet auf dem Branch `theme/<key>` und nur im eigenen Theme-Ordner; Wünsche an die Anwendung gehen in ZUSAMMENARBEIT.md §5, Änderungen am Vorlagen-Vertrag stehen in §6.
> **Kurz:** Ein neues Design entsteht als **zusätzliches Theme** in einem eigenen Ordner `resources/themes/<key>/`. Das vorhandene Theme **„Ostsee-Licht“ wird nicht verändert**. Das neue Theme erbt alles, was es nicht selbst mitbringt, wird mit `php artisan themes:check <key>` geprüft, per Vorschau-Link angesehen und erst dann im Admin für die Website ausgewählt. Zurück geht es jederzeit durch Auswahl des alten Themes.
---
@@ -19,7 +21,7 @@ ## 1. Grundregeln (nicht verhandelbar)
## 2. Schnellstart
```bash
git pull # aktuellen Stand holen
git checkout main && git pull && git checkout -b theme/<key> # eigener Branch (ZUSAMMENARBEIT.md §2)
composer install && npm ci # einmalig auf dem Rechner
cp .env.example .env && php artisan key:generate # einmalig, lokale SQLite-Datenbank …
touch database/database.sqlite # … als leere Datei anlegen (PowerShell: New-Item database/database.sqlite)
@@ -199,6 +201,18 @@ ## 7. Schriften, Bilder, Icons, Bewegung
- **Icons:** Inline-SVG; Heroicons sind über Blade verfügbar (`<x-heroicon-o-sparkles class="size-5" />`, kommt mit Filament).
- **Bewegung:** nur mit Zweck; `@media (prefers-reduced-motion: no-preference)` und `@supports (animation-timeline: view())` als Verbesserung. Ohne Animation und ohne JS muss alles vollständig funktionieren. Kein Autoplay-Video mit Ton; Video nur stumm, mit Standbild und nicht bei `prefers-reduced-data`.
## 7a. Markengrafiken
Logo, Favicon, Symbole und Wellenband liegen als saubere SVGs in `public/brand/` (Beschreibung und Farben: `styles/README.md`). In Vorlagen inline einbinden – dann färben sie sich über CSS-Variablen:
```blade
@include('theme::partials.brand', ['name' => 'mark', 'class' => 'h-11 w-auto']) {{-- Bildmarke --}}
@include('theme::partials.brand', ['name' => 'wave-divider', 'class' => 'w-full h-auto']) {{-- Trenner --}}
@include('theme::partials.brand', ['name' => 'icon-location', 'class' => 'size-10', 'label' => 'Lage'])
```
Verfügbar: `mark`, `logo`, `wave-divider`, `icon-apartment`, `icon-sea`, `icon-terrace`, `icon-location`. Farben: `--brand-navy` (Standard = Textfarbe `--ink`, damit dunkle Erscheinungsbilder funktionieren), `--brand-teal`, `--brand-wave`, `--brand-sun` – im eigenen `theme.css` oder lokal (`class="[--brand-navy:var(--band-ink)]"`) überschreibbar. Favicon/App-Symbol bindet das Layout ein (`asset('brand/favicon.svg')`). Grafiken nicht verändern (Marke); eigene dekorative Grafiken gehören in den Theme-Ordner.
## 8. Qualität
Es gelten [THEMES.md](THEMES.md) §8:
@@ -213,7 +227,7 @@ ## 9. Prüfen, ansehen, einbinden
1. **Prüfen:** `php artisan themes:check <key>`. Rote Punkte (✗) sind Fehler und müssen behoben werden, gelbe (!) sind Hinweise.
2. **Ansehen, ohne etwas umzuschalten:** `php artisan themes:preview <key>` gibt für jede Seite signierte Links aus: „heute“ und je Erscheinungsbild (Standard, Sommer, Winter, Weihnachten, Silvester). Im Admin geht das auch unter System › Websites › Theme: Theme wählen, dann **„Vorschau“** (öffnet einen neuen Tab), noch nicht speichern. Vorschauseiten sind `noindex`. Klickt man in der Vorschau auf einen Menülink, verlässt man sie; deshalb für jede Seite den eigenen Link verwenden.
3. **Bauen und testen:** `npm run build` und `php artisan test --compact`. Der Test `test_installed_themes_fulfil_the_theme_contract` lässt die Suite rot werden, wenn ein Theme die Prüfung nicht besteht.
4. **Einreichen:** Commit (nur `resources/themes/<key>/**`, ggf. `package*.json`) und Push nach Gitea.
4. **Einreichen:** Commit (nur `resources/themes/<key>/**`, ggf. `package*.json`) auf `theme/<key>`, Push nach Gitea, Merge-Request nach `main` (ZUSAMMENARBEIT.md §2). Ausgeliefert wird nur aus `main`.
5. **Ausliefern:** `bash scripts/deploy.sh staging deploy` (Testbetrieb https://stommer.info, siehe [BETRIEB.md](BETRIEB.md)). Die Vorschau-Links funktionieren dort genauso (`php artisan themes:preview <key>` über `bash scripts/deploy.sh staging artisan themes:preview <key>`).
6. **Auswählen:** Admin › System › Websites › Website bearbeiten › **Theme** wählen › Speichern. Die Farbfelder darunter zeigen jetzt die Tokens des neuen Themes.
7. **Zurück:** dort das vorherige Theme wählen. Alle Themes bleiben installiert; es wird nichts überschrieben.
@@ -223,6 +237,7 @@ ## 10. Checkliste vor Abschluss
- [ ] Theme mit `themes:make` angelegt; `resources/themes/ostsee-licht/**` unverändert (`git status`)
- [ ] `themes:check <key>` ohne Fehler; Warnungen bewertet
- [ ] Alle Seiten (`/`, `/wohnung`, `/kuehlungsborn`, `/buchen`, `/kontakt`, `/impressum`, `/datenschutz`) auf Handy (360 px), Tablet und Desktop geprüft
- [ ] Seiten außerhalb der Bausteine im neuen Layout geprüft: **Angebotsseite** des Gastes (Admin › Buchung › „Angebot senden“, dann „Angebotslink“) und **Bewertungsseite**
- [ ] Alle 5 Erscheinungsbilder über `themes:preview` geprüft (Silvester ist dunkel, Kontraste!)
- [ ] Buchungsablauf in der Vorschau durchgespielt: Termin wählen → Preis erscheint → Anfrage absenden
- [ ] Sonderangebote in allen drei Darstellungen (Baustein-Einstellung) angesehen
+71
View File
@@ -0,0 +1,71 @@
# Zusammenarbeit – parallele Sessions ohne Konflikte
Stand: 22.10.2026 · gilt für alle Arbeitssitzungen (Mensch oder KI), die gleichzeitig am Projekt arbeiten
## 1. Wer arbeitet woran
| Session | Rechner | Aufgabe | Branch | Darf ändern |
|---|---|---|---|---|
| **A – Anwendung** | Firmen-Laptop (oder jeder andere) | Funktionen, Verwaltung, Abläufe, Betrieb, Deployment | `main` (größere Vorhaben: `feature/<thema>`) | alles **außer** `resources/themes/<neues-theme>/**` |
| **B – Design** | privater PC, Plugin `frontend-design` | ein **neues, zusätzliches Theme** | `theme/<key>` (z. B. `theme/ostsee-nacht`) | nur `resources/themes/<key>/**`, `package.json`/`package-lock.json` (nur `@fontsource`-Schriften), `docs/STATUS.md` (eigener Abschnitt) |
Session B ändert **nicht**: `app/**`, `config/**`, `database/**`, `routes/**`, `resources/views/**` (auch nicht die Livewire-Formulare), `resources/themes/ostsee-licht/**`, `public/brand/**`, andere Dokumente. Braucht das Theme etwas aus diesen Bereichen (neue Daten in einem Baustein, ein neuer Baustein, eine Schrift-Lizenzfrage …), trägt Session B den Wunsch in §5 ein. Session A setzt ihn um.
## 2. Ablauf Session B (Design)
```bash
git clone https://gitea.stommer.de/Lars/fewo-stommer.git && cd fewo-stommer # einmalig
git checkout main && git pull
git checkout -b theme/<key> # einmalig
php artisan themes:make <key> --name="…" --description="…"
# … arbeiten (docs/THEME-ERSTELLUNG.md) …
git add resources/themes/<key> package.json package-lock.json && git commit -m "Theme <key>: …"
git push -u origin theme/<key>
```
**Täglich vor der Arbeit** den Stand der Anwendung übernehmen, damit Vorlagen-Vertrag und Tests aktuell sind:
```bash
git fetch origin && git merge origin/main # Konflikte kann es nur in package-lock.json geben, siehe §4
php artisan migrate && npm ci && php artisan test --compact
```
**Zusammenführen:** Sobald `php artisan themes:check <key>` ohne Fehler und `php artisan test --compact` grün ist, Merge-Request in Gitea von `theme/<key>` nach `main` – oder lokal `git checkout main && git pull && git merge --no-ff theme/<key> && git push`. Ein unfertiges Theme darf zusammengeführt werden. Es ist installiert, aber nicht aktiv, solange es niemand unter Admin › Websites auswählt. Zusammenführen hilft sogar, weil dann die Vorschau auf stommer.info möglich ist.
## 3. Ausliefern (Deployment)
- **Nur aus `main`, nur nach `git pull`, nur mit grünen Tests.** Das Skript baut den letzten Commit des **lokalen** Stands. Wer aus einem Feature- oder Theme-Branch ausliefert, nimmt alle Änderungen der anderen Session vom Server.
- Theme-Vorschau auf stommer.info: erst nach dem Zusammenführen in `main`, dann `bash scripts/deploy.sh staging deploy` und `bash scripts/deploy.sh staging artisan themes:preview <key>` (gibt die Vorschau-Links aus).
- Das neue Theme aktivieren (Admin › System › Websites › Theme) entscheidet Lars, nach Sichtung der Vorschau.
- `shared/.env` auf dem Server ändert nur Lars (Passwörter); Sessions ändern dort höchstens nicht geheime Werte und dokumentieren das in BETRIEB.md.
- Jede Session braucht ihren **eigenen SSH-Schlüssel** für Strato (BETRIEB.md §4); keine Schlüssel kopieren.
## 4. Konflikte vermeiden
| Datei/Bereich | Regel |
|---|---|
| `package.json`, `package-lock.json` | Während der Theme-Phase installiert nur Session B neue npm-Pakete (Schriften). Bei Konflikt: Version von `main` übernehmen, dann eigene Pakete neu installieren: `git checkout --theirs package-lock.json && npm install @fontsource/<schrift>` |
| Vorlagen-Vertrag (`app/Themes/**`, Bausteine, Basis-Theme `ostsee-licht`, THEMES.md §4/§5, THEME-ERSTELLUNG.md §6) | Ändert nur Session A – und trägt jede Änderung in §6 ein, damit Session B sie nachzieht |
| `docs/STATUS.md` | Beide dürfen schreiben – Session B nur in einem eigenen Abschnitt „Design-Theme“ |
| `public/build` | Wird nicht committet (Build-Ergebnis); nie von Hand ändern |
| Datenbank-Migrationen | Nur Session A |
## 5. Wünsche der Design-Session an die Anwendung
*(Session B trägt hier ein, was sie braucht; Session A erledigt es und vermerkt „erledigt in <commit>“.)*
| Datum | Wunsch | Status |
|---|---|---|
| | | |
## 6. Änderungsprotokoll Vorlagen-Vertrag
*(Session A trägt hier jede Änderung ein, die Theme-Vorlagen betrifft.)*
| Datum | Änderung | Betrifft |
|---|---|---|
| 22.10.2026 | `theme-base.css` (Schriften, Token-Mapping, Basis-Klassen) von `theme.css` getrennt – Child-Themes importieren `theme-base.css` | theme.css |
| 22.10.2026 | Markengrafiken: `@include('theme::partials.brand', ['name' => 'mark', 'class' => '…'])` (mark, logo, wave-divider, icon-apartment/-sea/-terrace/-location); Farben über `--brand-navy/-teal/-wave/-sun` (navy = Textfarbe) | header, footer, facts, location, image |
| 22.10.2026 | `hero`: `$featuredOffer` (wichtigstes hervorgehobenes Angebot oder null) | sections/hero |
| 22.10.2026 | `offers`: `$display` (grid/list/rotating), `$offers` = `AdvertisedOffer` (Termin, Preis, `bookingUrl()`); rollierend über `data-rotator*` | sections/offers |
| 22.10.2026 | Seiten außerhalb der Bausteine, die das Theme-Layout nutzen: Angebotsseite `resources/views/offer.blade.php`, Bewertung `resources/views/review.blade.php` – beim Theme-Test mitprüfen | layouts/app |
@@ -0,0 +1,9 @@
@php($redirect = \App\Support\Settings::mailRedirect())
@if ($redirect)
<div class="fi-test-mode-banner" role="status" style="background:#fde68a;color:#422006;padding:.5rem 1rem;text-align:center;font-size:.875rem">
<strong>Testbetrieb:</strong> Alle E-Mails gehen nur an {{ $redirect }}.
@if (auth()->user()?->hasRole(\App\Enums\UserRole::Admin))
<a href="{{ \App\Filament\Pages\Operations::getUrl() }}" style="text-decoration:underline">Betrieb einstellen</a>
@endif
</div>
@endif
+3
View File
@@ -22,6 +22,9 @@ protected function setUp(): void
{
parent::setUp();
// These tests submit the form instantly; the bot time trap is tested in SpamProtectionTest.
config(['fewo.spam.min_seconds' => 0]);
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed([PropertySeeder::class, SiteSeeder::class]);
Mail::fake();
+3
View File
@@ -47,6 +47,9 @@ protected function setUp(): void
{
parent::setUp();
// These tests submit the form instantly; the bot time trap is tested in SpamProtectionTest.
config(['fewo.spam.min_seconds' => 0]);
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed(PropertySeeder::class);
$this->property = Property::sole();
+3
View File
@@ -40,6 +40,9 @@ protected function setUp(): void
{
parent::setUp();
// These tests submit the form instantly; the bot time trap is tested in SpamProtectionTest.
config(['fewo.spam.min_seconds' => 0]);
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed(PropertySeeder::class);
$this->property = Property::sole();
+128
View File
@@ -0,0 +1,128 @@
<?php
namespace Tests\Feature;
use App\Actions\AcceptOffer;
use App\Actions\CreateReservation;
use App\Actions\SendOffer;
use App\Enums\PortalEmailStatus;
use App\Enums\PortalEmailType;
use App\Mail\ArrivalInformation;
use App\Mail\BookingConfirmed;
use App\Mail\BookingDeclined;
use App\Mail\ChannelConflict;
use App\Mail\ChannelSyncAlert;
use App\Mail\ChannelTasksNotification;
use App\Mail\MailboxAlert;
use App\Mail\MarketingConsentRequest;
use App\Mail\NewReservation;
use App\Mail\NewReview;
use App\Mail\OfferAnswered;
use App\Mail\OfferMade;
use App\Mail\PaymentReminder;
use App\Mail\PortalMailNotification;
use App\Mail\ReservationExpired;
use App\Mail\ReservationReceived;
use App\Mail\ReviewRequest;
use App\Models\Booking;
use App\Models\Channel;
use App\Models\ChannelTask;
use App\Models\PortalEmail;
use App\Models\Property;
use App\Models\Review;
use App\Pricing\StayRequest;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Mail\Mailable;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
/**
* Every e-mail of the system is built completely (subject, body, attachments) in the state in which it is
* really sent – so a broken template is found here and not by a guest. Delivery itself is a server matter.
*/
class MailRenderingTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed(PropertySeeder::class);
Mail::fake();
Storage::fake('local');
}
public function test_every_mail_along_the_booking_path_renders_in_its_state(): void
{
$booking = app(CreateReservation::class)->handle(
Property::sole(),
new StayRequest(CarbonImmutable::parse('2026-12-01'), CarbonImmutable::parse('2026-12-05'), 2),
['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'erika@example.com', 'street' => 'Seeweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn'],
'Wir kommen mit Hund – ist das in Ordnung?',
sendMails: false,
);
$this->assertRenders(new ReservationReceived($booking), 'vorgemerkt');
$this->assertRenders(new NewReservation($booking), 'Erika Muster');
$send = app(SendOffer::class);
$booking = $send->handle($booking, ['price_adjustment' => -1500, 'offer_message' => 'Hund ist willkommen.'], sendMail: false);
$this->assertRenders(new OfferMade($booking, $send->offerUrl($booking)), 'Angebot ansehen und annehmen', attachments: 1);
$this->assertRenders(new ReservationExpired($booking), 'Angebot abgelaufen');
$this->assertRenders(new BookingDeclined($booking), 'Erika');
app(AcceptOffer::class)->handle($booking, $booking->offer_version);
$booking->refresh();
$this->assertRenders(new OfferAnswered($booking, accepted: true), 'Angebot angenommen');
$this->assertRenders(new OfferAnswered($booking, accepted: false), 'abgelehnt');
$this->assertRenders(new BookingConfirmed($booking), 'Sie haben unser Angebot', attachments: 1);
foreach ([PaymentReminder::DEPOSIT_OVERDUE, PaymentReminder::BALANCE_REQUEST, PaymentReminder::BALANCE_OVERDUE] as $kind) {
$this->assertRenders(new PaymentReminder($booking, $kind), 'Erika Muster');
}
$this->assertRenders(new ArrivalInformation($booking), 'Erika');
$this->assertRenders(new ReviewRequest($booking), 'Erika');
}
public function test_directly_confirmed_booking_and_other_notifications_render(): void
{
$booking = Booking::factory()->for(Property::sole())->create(['confirmed_at' => now(), 'deposit_due_on' => now()->addWeek()->toDateString()]);
$this->assertRenders(new BookingConfirmed($booking), 'verbindlich zu bestätigen');
$channel = Channel::factory()->for(Property::sole())->create(['name' => 'FeWo-direkt']);
$this->assertRenders(new ChannelSyncAlert($channel), 'FeWo-direkt');
$this->assertRenders(new ChannelConflict($channel, ['14.11.–17.11.2026 überschneidet Buchung 2026-0001']), 'überschneidet');
$this->assertRenders(new ChannelTasksNotification([ChannelTask::factory()->for($channel)->create()]), 'FeWo-direkt');
$this->assertRenders(new MailboxAlert('Login fehlgeschlagen'), 'Login fehlgeschlagen');
$this->assertRenders(new MarketingConsentRequest($booking->guest), $booking->guest->first_name);
$this->assertRenders(new NewReview(Review::factory()->create(['booking_id' => $booking->id, 'title' => 'Wunderbar'])), 'Wunderbar');
$this->assertRenders(new PortalMailNotification(PortalEmail::query()->create([
'channel_id' => $channel->id, 'message_id' => 'm1@portal', 'from' => 'noreply@portal.example', 'subject' => 'Neue Buchung',
'received_at' => now(), 'type' => PortalEmailType::Booking, 'status' => PortalEmailStatus::Blocked, 'starts_on' => '2026-11-14', 'ends_on' => '2026-11-17',
])), 'Neue Buchung');
}
public function test_test_mail_command_sends_and_respects_the_redirect(): void
{
config(['fewo.mail_redirect_to' => 'test@example.com']);
$this->artisan('mail:test', ['to' => 'gast@example.com'])
->expectsOutputToContain('Umleitung aktiv')
->assertSuccessful();
}
private function assertRenders(Mailable $mail, string $expected, int $attachments = 0): void
{
$html = $mail->render();
$this->assertNotEmpty($mail->envelope()->subject, $mail::class.' needs a subject');
$this->assertStringContainsString(e($expected), $html, $mail::class);
if (method_exists($mail, 'attachments')) {
$this->assertCount($attachments, $mail->attachments(), $mail::class.' attachments');
}
}
}
+127
View File
@@ -0,0 +1,127 @@
<?php
namespace Tests\Feature;
use App\Actions\CopySeasonsToNextYear;
use App\Filament\Resources\Properties\Pages\EditProperty;
use App\Filament\Resources\Properties\RelationManagers\SeasonsRelationManager;
use App\Models\BlockedPeriod;
use App\Models\Property;
use App\Models\Season;
use App\Models\SpecialOffer;
use App\Models\User;
use App\Pricing\PriceCalculator;
use App\Pricing\PriceQuote;
use App\Pricing\QuoteException;
use App\Pricing\StayRequest;
use Carbon\CarbonImmutable;
use Filament\Actions\Testing\TestAction;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;
class MinimumStayRulesTest extends TestCase
{
use RefreshDatabase;
private Property $property;
protected function setUp(): void
{
parent::setUp();
$this->property = Property::factory()->create(['min_stay_absolute' => 2]);
Season::factory()->for($this->property)->create(['name' => 'Hauptsaison', 'starts_on' => '2026-06-06', 'ends_on' => '2026-09-05', 'nightly_rate' => 9000, 'min_nights' => 7]);
}
public function test_season_minimum_applies_without_a_rule(): void
{
$this->expectException(QuoteException::class);
$this->quote('2026-07-08', '2026-07-11');
}
public function test_stay_filling_a_calendar_gap_completely_may_be_shorter(): void
{
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-07-01', 'ends_on' => '2026-07-08']);
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-07-11', 'ends_on' => '2026-07-18']);
$this->assertSame(3, $this->quote('2026-07-08', '2026-07-11')->nights());
$this->expectException(QuoteException::class);
$this->quote('2026-07-08', '2026-07-10');
}
public function test_gap_rule_can_be_switched_off(): void
{
$this->property->update(['min_stay_fill_gaps' => false]);
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-07-01', 'ends_on' => '2026-07-08']);
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-07-11', 'ends_on' => '2026-07-18']);
$this->expectException(QuoteException::class);
$this->quote('2026-07-08', '2026-07-11');
}
public function test_stay_ending_on_the_changeover_day_may_be_shorter_but_not_below_the_absolute_minimum(): void
{
$this->property->update(['changeover_weekday' => 6, 'min_stay_until_changeover' => true]);
$this->assertSame(3, $this->quote('2026-07-08', '2026-07-11')->nights(), 'Wednesday to Saturday');
try {
$this->quote('2026-07-10', '2026-07-11');
$this->fail('one night is below the absolute minimum');
} catch (QuoteException) {
$this->addToAssertionCount(1);
}
$this->expectException(QuoteException::class);
$this->quote('2026-07-08', '2026-07-10');
}
public function test_any_special_offer_can_waive_the_minimum_stay(): void
{
SpecialOffer::factory()->for($this->property)->create(['name' => 'Special Weekend', 'arrival_weekdays' => [5], 'max_nights' => 2, 'waives_min_stay' => true, 'discount_value' => 10]);
$quote = $this->quote('2026-07-10', '2026-07-12');
$this->assertSame(2, $quote->nights());
$this->assertGreaterThan(0, $quote->discount());
}
public function test_copying_seasons_moves_their_start_to_the_weekday_and_keeps_them_adjacent(): void
{
Season::factory()->for($this->property)->create(['name' => 'Vorsaison', 'starts_on' => '2026-04-04', 'ends_on' => '2026-06-06', 'nightly_rate' => 7000, 'min_nights' => 3]);
$result = app(CopySeasonsToNextYear::class)->handle($this->property, 2026, 6);
$copies = $this->property->seasons()->whereYear('starts_on', 2027)->orderBy('starts_on')->get();
$this->assertSame(2, $result['created']);
$this->assertSame(['2027-04-03', '2027-06-05', '2027-06-05', '2027-09-04'], [
$copies[0]->starts_on->toDateString(), $copies[0]->ends_on->toDateString(),
$copies[1]->starts_on->toDateString(), $copies[1]->ends_on->toDateString(),
]);
$this->assertTrue($copies->every(fn (Season $season): bool => $season->starts_on->isSaturday()));
}
public function test_rules_are_edited_next_to_the_seasons(): void
{
$this->actingAs(User::factory()->create());
Livewire::test(SeasonsRelationManager::class, ['ownerRecord' => $this->property, 'pageClass' => EditProperty::class])
->callAction(TestAction::make('minimumStayRules')->table(), [
'changeover_weekday' => 6,
'min_stay_fill_gaps' => true,
'min_stay_until_changeover' => true,
'min_stay_absolute' => 3,
])
->assertHasNoFormErrors();
$this->assertSame([6, true, 3], [$this->property->fresh()->changeover_weekday, $this->property->fresh()->min_stay_until_changeover, $this->property->fresh()->min_stay_absolute]);
}
private function quote(string $arrival, string $departure): PriceQuote
{
return app(PriceCalculator::class)->calculate($this->property->fresh(), new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2), CarbonImmutable::parse('2026-03-01'));
}
}
+1
View File
@@ -94,6 +94,7 @@ public function test_gap_filler_advertises_each_gap_found_in_the_calendar(): voi
public function test_gap_below_minimum_stay_is_not_advertised_unless_the_offer_waives_it(): void
{
$this->property->update(['min_stay_fill_gaps' => false]);
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-02-05', 'ends_on' => '2026-02-10']);
BlockedPeriod::factory()->for($this->property)->create(['starts_on' => '2026-02-12', 'ends_on' => '2026-02-20']);
$this->offer(['name' => 'Lückenfüller', 'kind' => OfferKind::GapFiller, 'max_gap_nights' => 4, 'discount_value' => 20]);
+78
View File
@@ -0,0 +1,78 @@
<?php
namespace Tests\Feature;
use App\Enums\UserRole;
use App\Filament\Pages\Operations;
use App\Models\User;
use App\Support\Settings;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Mail\MailManager;
use Illuminate\Support\Facades\Mail;
use Livewire\Livewire;
use Tests\TestCase;
class OperationsModeTest extends TestCase
{
use RefreshDatabase;
public function test_new_installations_start_in_test_mode_with_the_notification_address(): void
{
config(['fewo.mail_redirect_to' => null, 'fewo.notification_email' => 'fewo@example.com']);
$this->assertFalse(Settings::isLive());
$this->assertSame('fewo@example.com', Settings::mailRedirect());
}
public function test_in_test_mode_every_mail_goes_to_the_test_recipient_only(): void
{
config(['fewo.mail_redirect_to' => null, 'mail.default' => 'array']);
Settings::save([Settings::MODE => Settings::MODE_TEST, Settings::TEST_RECIPIENT => 'test@example.com']);
Mail::raw('Hallo', fn ($message) => $message->to('gast@example.com')->cc('vermieterin@example.com')->subject('Angebot'));
$sent = app(MailManager::class)->mailer('array')->getSymfonyTransport()->messages()->last();
$this->assertSame(['test@example.com'], array_map(fn ($address) => $address->getAddress(), $sent->getEnvelope()->getRecipients()));
}
public function test_switched_live_mails_reach_their_real_recipients(): void
{
config(['fewo.mail_redirect_to' => null, 'mail.default' => 'array']);
Settings::save([Settings::MODE => Settings::MODE_LIVE]);
Mail::raw('Hallo', fn ($message) => $message->to('gast@example.com')->subject('Angebot'));
$sent = app(MailManager::class)->mailer('array')->getSymfonyTransport()->messages()->last();
$this->assertSame(['gast@example.com'], array_map(fn ($address) => $address->getAddress(), $sent->getEnvelope()->getRecipients()));
$this->assertNull(Settings::mailRedirect());
}
public function test_server_override_always_wins(): void
{
config(['fewo.mail_redirect_to' => 'server@example.com']);
Settings::save([Settings::MODE => Settings::MODE_LIVE]);
$this->assertSame('server@example.com', Settings::mailRedirect());
}
public function test_administrator_switches_the_mode_in_the_admin_and_sees_the_banner(): void
{
config(['fewo.mail_redirect_to' => null]);
$this->actingAs(User::factory()->create());
$this->get(Operations::getUrl())->assertOk()->assertSee('Testbetrieb:');
Livewire::test(Operations::class)
->set('data.mode', Settings::MODE_TEST)
->set('data.test_recipient', 'lars@example.com')
->call('save')
->assertHasNoErrors();
$this->assertSame('lars@example.com', Settings::mailRedirect());
Livewire::test(Operations::class)->set('data.mode', Settings::MODE_LIVE)->call('save')->assertNotified('Scharf geschaltet');
$this->assertTrue(Settings::isLive());
$this->actingAs(User::factory()->role(UserRole::Rentals)->create());
$this->get(Operations::getUrl())->assertForbidden();
}
}
+83
View File
@@ -0,0 +1,83 @@
<?php
namespace Tests\Feature;
use App\Livewire\BookingRequest;
use App\Models\Booking;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Mail;
use Livewire\Features\SupportTesting\Testable;
use Livewire\Livewire;
use Tests\TestCase;
class SpamProtectionTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed(PropertySeeder::class);
Mail::fake();
}
public function test_form_sent_faster_than_a_human_is_ignored_silently(): void
{
$this->filled('anna@example.com')->call('submit')->assertHasNoErrors();
$this->assertSame(0, Booking::count());
}
public function test_honeypot_request_is_ignored(): void
{
$form = $this->filled('anna@example.com')->set('website', 'https://spam.example');
$this->travel(10)->seconds();
$form->call('submit');
$this->assertSame(0, Booking::count());
}
public function test_human_request_after_a_few_seconds_is_accepted(): void
{
$form = $this->filled('anna@example.com');
$this->travel(10)->seconds();
$form->call('submit')->assertHasNoErrors()->assertSee('Vielen Dank, Anna!');
$this->assertSame(1, Booking::count());
}
public function test_one_email_address_cannot_hold_many_dates_at_once(): void
{
foreach ([['2026-11-07', '2026-11-10'], ['2026-11-14', '2026-11-17'], ['2026-11-21', '2026-11-24']] as [$arrival, $departure]) {
$form = $this->filled('anna@example.com', $arrival, $departure);
$this->travel(10)->seconds();
$form->call('submit');
}
$this->assertSame(2, Booking::count());
}
public function test_links_in_names_or_many_links_in_the_message_are_rejected(): void
{
$form = $this->filled('anna@example.com')->set('firstName', 'Cheap https://pills.example')->set('message', 'see www.a.example and https://b.example');
$this->travel(10)->seconds();
$form->call('submit')->assertHasErrors(['firstName', 'message']);
$this->assertSame(0, Booking::count());
}
private function filled(string $email, string $arrival = '2026-11-07', string $departure = '2026-11-10'): Testable
{
return Livewire::test(BookingRequest::class)
->set('arrival', $arrival)
->set('departure', $departure)
->set('firstName', 'Anna')
->set('lastName', 'Muster')
->set('email', $email)
->set('privacyAccepted', true);
}
}