Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d018c97be4 | ||
|
|
fdcb68d578 | ||
|
|
70a8c5072b | ||
|
|
20235b9139 | ||
|
|
565eee4325 | ||
|
|
fd744edf8c | ||
|
|
7a6ee316cd | ||
|
|
6690beafe6 | ||
|
|
4f69b426a4 |
No files matched your search
@@ -43,6 +43,8 @@ MAIL_FROM_NAME="${APP_NAME}"
|
||||
FEWO_OWNER_NAME="Brigitte Stommer"
|
||||
FEWO_OWNER_EMAIL=fewo@stommer.de
|
||||
FEWO_NOTIFICATION_EMAIL=fewo@stommer.de
|
||||
# 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=
|
||||
FEWO_BANK_BIC=
|
||||
|
||||
@@ -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 admins via `RequireTwoFactorForAdmins`. 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`.
|
||||
- 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`.
|
||||
|
||||
@@ -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 admins via `RequireTwoFactorForAdmins`. 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`.
|
||||
- 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`.
|
||||
|
||||
@@ -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).
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Mail\OfferAnswered;
|
||||
use App\Models\Booking;
|
||||
use App\Support\Content;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* The guest accepts the offer on the signed offer page: the booking is concluded. A record of what was
|
||||
* accepted is kept (offer version, time, fingerprints of price and terms – no IP address), then the booking
|
||||
* is confirmed as usual (contract + confirmation mail as electronic acknowledgement).
|
||||
*/
|
||||
class AcceptOffer
|
||||
{
|
||||
public function __construct(private ConfirmBooking $confirm) {}
|
||||
|
||||
/**
|
||||
* @throws ReservationException
|
||||
*/
|
||||
public function handle(Booking $booking, int $offerVersion): void
|
||||
{
|
||||
$this->ensureAcceptable($booking, $offerVersion);
|
||||
|
||||
$booking->update([
|
||||
'accepted_at' => now(),
|
||||
'acceptance' => [
|
||||
'offer_version' => $booking->offer_version,
|
||||
'accepted_at' => now()->toIso8601String(),
|
||||
'total' => $booking->total,
|
||||
'quote_sha256' => hash('sha256', json_encode($booking->quote)),
|
||||
'terms_sha256' => hash('sha256', (string) Content::get('contract.terms').'|'.Content::get('stay.cancellation')),
|
||||
'via' => 'offer_link',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->confirm->handle($booking);
|
||||
|
||||
try {
|
||||
Mail::to(config('fewo.notification_email'))->send(new OfferAnswered($booking, accepted: true));
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ReservationException
|
||||
*/
|
||||
public function ensureAcceptable(Booking $booking, int $offerVersion): void
|
||||
{
|
||||
if ($offerVersion !== $booking->offer_version) {
|
||||
throw ReservationException::offerOutdated();
|
||||
}
|
||||
|
||||
if ($booking->status !== BookingStatus::OfferSent) {
|
||||
throw ReservationException::invalidTransition($booking->status->getLabel(), 'angenommen');
|
||||
}
|
||||
|
||||
if (! $booking->hold_expires_at?->isFuture()) {
|
||||
throw ReservationException::offerExpired();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,15 @@
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Guest;
|
||||
use App\Models\PortalEmail;
|
||||
|
||||
/**
|
||||
* Anonymises guests whose last stay ended longer ago than the retention period (GDPR storage limitation).
|
||||
* GDPR storage limitation: anonymises guests whose last stay ended longer ago than the retention period, and
|
||||
* guests who only ever sent requests/offers that never became binding (shorter period), and removes
|
||||
* operational extras that are no longer needed (portal e-mail excerpts, marketing attribution).
|
||||
* Booking records (dates, prices, payments) stay as accounting documents.
|
||||
*/
|
||||
class AnonymizeGuests
|
||||
{
|
||||
@@ -19,8 +24,32 @@ public function handle(): int
|
||||
->whereDoesntHave('bookings', fn ($query) => $query->whereDate('departure', '>=', $cutoff))
|
||||
->get();
|
||||
|
||||
$guests->each->anonymize();
|
||||
$inquiryCutoff = now()->subMonths(config('fewo.retention.inquiry_months'));
|
||||
$inquiriesOnly = Guest::query()
|
||||
->whereNull('anonymized_at')
|
||||
->whereDoesntHave('bookings', fn ($query) => $query->whereNotNull('confirmed_at'))
|
||||
->whereDoesntHave('bookings', fn ($query) => $query->where('updated_at', '>=', $inquiryCutoff))
|
||||
->where('updated_at', '<', $inquiryCutoff)
|
||||
->get();
|
||||
|
||||
return $guests->count();
|
||||
$all = $guests->merge($inquiriesOnly)->unique('id');
|
||||
$all->each->anonymize();
|
||||
|
||||
$this->purgeOperationalData();
|
||||
|
||||
return $all->count();
|
||||
}
|
||||
|
||||
private function purgeOperationalData(): void
|
||||
{
|
||||
PortalEmail::query()
|
||||
->whereNotNull('excerpt')
|
||||
->where('received_at', '<', now()->subDays(config('fewo.retention.portal_email_excerpt_days')))
|
||||
->update(['excerpt' => null]);
|
||||
|
||||
Booking::query()
|
||||
->where('created_at', '<', now()->subMonths(config('fewo.retention.attribution_months')))
|
||||
->where(fn ($query) => $query->whereNotNull('referral_source')->orWhereNotNull('utm_source')->orWhereNotNull('utm_medium')->orWhereNotNull('utm_campaign'))
|
||||
->update(['referral_source' => null, 'utm_source' => null, 'utm_medium' => null, 'utm_campaign' => null]);
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,9 @@
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
/**
|
||||
* The landlord accepts a reservation: the booking becomes binding, payment due dates are fixed,
|
||||
* the rental contract is generated and sent with the confirmation.
|
||||
* Expired reservations can still be confirmed while the dates are free.
|
||||
* Makes a booking binding: payment due dates are fixed, the rental contract is generated and sent with the
|
||||
* confirmation. Used when the guest accepts an offer (AcceptOffer) and when the landlord confirms directly
|
||||
* (e.g. a booking agreed on the phone). Expired requests/offers can still be confirmed while the dates are free.
|
||||
*/
|
||||
class ConfirmBooking
|
||||
{
|
||||
@@ -28,7 +28,7 @@ public function __construct(
|
||||
*/
|
||||
public function handle(Booking $booking, bool $notifyGuest = true): void
|
||||
{
|
||||
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::Expired], true)) {
|
||||
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
|
||||
throw ReservationException::invalidTransition($booking->status->getLabel(), 'bestätigt');
|
||||
}
|
||||
|
||||
|
||||
@@ -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,8 +47,7 @@ public function handle(Property $property, StayRequest $stay, array $guestData,
|
||||
|
||||
$quote = $this->calculator->calculate($property, $stay);
|
||||
|
||||
$guest = Guest::firstOrNew(['email' => mb_strtolower($guestData['email'])]);
|
||||
$guest->fill($guestData)->fill(['email' => mb_strtolower($guestData['email'])])->save();
|
||||
[$guest, $differences] = $this->guestFor($guestData);
|
||||
|
||||
return $property->bookings()->create([
|
||||
'guest_id' => $guest->id,
|
||||
@@ -66,6 +65,7 @@ public function handle(Property $property, StayRequest $stay, array $guestData,
|
||||
'balance_due_on' => $quote->balanceDueOn->toDateString(),
|
||||
'hold_expires_at' => now()->addHours($property->hold_hours),
|
||||
'message' => $message,
|
||||
'internal_notes' => $differences !== [] ? "Abweichende Angaben in dieser Anfrage (Gästekartei nicht geändert):\n".implode("\n", $differences) : null,
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -76,6 +76,42 @@ public function handle(Property $property, StayRequest $stay, array $guestData,
|
||||
return $booking;
|
||||
}
|
||||
|
||||
/**
|
||||
* The guest record for the request. A known e-mail address never overwrites existing master data
|
||||
* (anybody can type somebody else's address); empty fields are completed, differing values are
|
||||
* returned so the landlord sees them with the request and can take them over in the offer.
|
||||
*
|
||||
* @param array<string, ?string> $guestData
|
||||
* @return array{0: Guest, 1: list<string>}
|
||||
*/
|
||||
private function guestFor(array $guestData): array
|
||||
{
|
||||
$email = mb_strtolower($guestData['email']);
|
||||
$guest = Guest::query()->where('email', $email)->first();
|
||||
|
||||
if ($guest === null) {
|
||||
return [Guest::create([...$guestData, 'email' => $email]), []];
|
||||
}
|
||||
|
||||
$labels = ['first_name' => 'Vorname', 'last_name' => 'Nachname', 'phone' => 'Telefon', 'street' => 'Straße', 'postal_code' => 'PLZ', 'city' => 'Ort', 'country' => 'Land'];
|
||||
$differences = [];
|
||||
foreach ($labels as $field => $label) {
|
||||
$value = trim((string) ($guestData[$field] ?? ''));
|
||||
if ($value === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (blank($guest->{$field})) {
|
||||
$guest->{$field} = $value;
|
||||
} elseif (mb_strtolower((string) $guest->{$field}) !== mb_strtolower($value)) {
|
||||
$differences[] = "{$label}: {$value} (Kartei: {$guest->{$field}})";
|
||||
}
|
||||
}
|
||||
$guest->save();
|
||||
|
||||
return [$guest, $differences];
|
||||
}
|
||||
|
||||
/**
|
||||
* A failing mail server must not lose the reservation; failures are reported and visible in the log.
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ class DeclineBooking
|
||||
*/
|
||||
public function handle(Booking $booking, bool $notifyGuest = true): void
|
||||
{
|
||||
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::Expired], true)) {
|
||||
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
|
||||
throw ReservationException::invalidTransition($booking->status->getLabel(), 'abgelehnt');
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class ExpireReservations
|
||||
public function handle(): int
|
||||
{
|
||||
$expired = Booking::query()
|
||||
->where('status', BookingStatus::Reserved)
|
||||
->whereIn('status', BookingStatus::holding())
|
||||
->where('hold_expires_at', '<=', now())
|
||||
->with(['guest', 'property'])
|
||||
->get();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Mail\OfferAnswered;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* The guest declines the offer on the offer page: the dates are released and the landlord is informed.
|
||||
*/
|
||||
class RejectOffer
|
||||
{
|
||||
/**
|
||||
* @throws ReservationException
|
||||
*/
|
||||
public function handle(Booking $booking, int $offerVersion): void
|
||||
{
|
||||
if ($offerVersion !== $booking->offer_version) {
|
||||
throw ReservationException::offerOutdated();
|
||||
}
|
||||
|
||||
if ($booking->status !== BookingStatus::OfferSent) {
|
||||
throw ReservationException::invalidTransition($booking->status->getLabel(), 'abgelehnt');
|
||||
}
|
||||
|
||||
$booking->update([
|
||||
'status' => BookingStatus::Declined,
|
||||
'declined_by' => 'guest',
|
||||
'hold_expires_at' => null,
|
||||
]);
|
||||
|
||||
try {
|
||||
Mail::to(config('fewo.notification_email'))->send(new OfferAnswered($booking, accepted: false));
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Documents\RentalContract;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\QuoteLineType;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Mail\OfferMade;
|
||||
use App\Models\Booking;
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\PriceQuote;
|
||||
use App\Pricing\QuoteException;
|
||||
use App\Pricing\QuoteLine;
|
||||
use App\Pricing\StayRequest;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
/**
|
||||
* Booking path 1 (docs/KONZEPT.md §6a): the landlord turns a request into an offer. Dates, guests, promo
|
||||
* code, a manual price adjustment and the guest's contact data can be changed; the price is calculated again,
|
||||
* the contract draft is generated and the guest receives it with a signed link to accept or decline.
|
||||
* Sending again replaces the previous offer (links of older versions stop working).
|
||||
*/
|
||||
class SendOffer
|
||||
{
|
||||
public function __construct(
|
||||
private PriceCalculator $calculator,
|
||||
private AvailabilityChecker $availability,
|
||||
private RentalContract $contract,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array{arrival?: string, departure?: string, guests?: int, promo_code?: ?string, price_adjustment?: ?int, price_adjustment_label?: ?string, valid_until?: ?string, offer_message?: ?string, guest?: array<string, ?string>} $changes
|
||||
*
|
||||
* @throws QuoteException
|
||||
* @throws ReservationException
|
||||
*/
|
||||
public function handle(Booking $booking, array $changes = [], bool $sendMail = true): Booking
|
||||
{
|
||||
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
|
||||
throw ReservationException::invalidTransition($booking->status->getLabel(), 'als Angebot versendet');
|
||||
}
|
||||
|
||||
DB::transaction(function () use ($booking, $changes): void {
|
||||
$arrival = CarbonImmutable::parse($changes['arrival'] ?? $booking->arrival);
|
||||
$departure = CarbonImmutable::parse($changes['departure'] ?? $booking->departure);
|
||||
|
||||
if (! $this->availability->isAvailable($booking->property, $arrival, $departure, ignore: $booking)) {
|
||||
throw ReservationException::notAvailable();
|
||||
}
|
||||
|
||||
$promoCode = array_key_exists('promo_code', $changes) ? (filled($changes['promo_code']) ? trim((string) $changes['promo_code']) : null) : $booking->promo_code;
|
||||
$stay = new StayRequest($arrival, $departure, (int) ($changes['guests'] ?? $booking->guests), $booking->extras ?? [], $promoCode);
|
||||
$adjustment = (int) ($changes['price_adjustment'] ?? 0);
|
||||
$adjustmentLabel = trim((string) ($changes['price_adjustment_label'] ?? '')) ?: ($adjustment < 0 ? 'Nachlass' : 'Zuschlag');
|
||||
$quote = $this->quoteWithAdjustment($booking, $stay, $adjustment, $adjustmentLabel);
|
||||
|
||||
if (filled($changes['guest'] ?? null)) {
|
||||
$booking->guest->update(Arr::only(array_map(fn ($value) => filled($value) ? trim((string) $value) : null, $changes['guest']), ['first_name', 'last_name', 'phone', 'street', 'postal_code', 'city', 'country']));
|
||||
}
|
||||
|
||||
$booking->update([
|
||||
'status' => BookingStatus::OfferSent,
|
||||
'arrival' => $arrival->toDateString(),
|
||||
'departure' => $departure->toDateString(),
|
||||
'guests' => $stay->guests,
|
||||
'promo_code' => $quote->promoCodeApplied ? $promoCode : null,
|
||||
'price_adjustment' => $adjustment !== 0 ? $adjustment : null,
|
||||
'price_adjustment_label' => $adjustment !== 0 ? $adjustmentLabel : null,
|
||||
'quote' => $quote->toArray(),
|
||||
'total' => $quote->total(),
|
||||
'deposit' => $quote->deposit(),
|
||||
'balance_due_on' => $quote->balanceDueOn->toDateString(),
|
||||
'hold_expires_at' => filled($changes['valid_until'] ?? null) ? CarbonImmutable::parse($changes['valid_until']) : now()->addHours($booking->property->hold_hours),
|
||||
'offer_version' => $booking->offer_version + 1,
|
||||
'offer_sent_at' => now(),
|
||||
'offer_message' => $changes['offer_message'] ?? null,
|
||||
]);
|
||||
});
|
||||
|
||||
$booking->refresh();
|
||||
$this->contract->generate($booking, draft: true);
|
||||
|
||||
if ($sendMail) {
|
||||
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new OfferMade($booking, $this->offerUrl($booking)));
|
||||
}
|
||||
|
||||
return $booking;
|
||||
}
|
||||
|
||||
/**
|
||||
* The guest's link to the offer page; valid while the offer is valid and only for this offer version.
|
||||
*/
|
||||
public function offerUrl(Booking $booking): string
|
||||
{
|
||||
return URL::temporarySignedRoute('offers.show', $booking->hold_expires_at, ['booking' => $booking, 'v' => $booking->offer_version]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Price for the (possibly changed) stay plus the manual adjustment; a reduction never makes the stay negative.
|
||||
*
|
||||
* @throws QuoteException
|
||||
*/
|
||||
private function quoteWithAdjustment(Booking $booking, StayRequest $stay, int $adjustment, string $label): PriceQuote
|
||||
{
|
||||
$quote = $this->calculator->calculate($booking->property, $stay);
|
||||
if ($adjustment === 0) {
|
||||
return $quote;
|
||||
}
|
||||
|
||||
$adjustment = max($adjustment, -$quote->rent());
|
||||
|
||||
return $quote->withLine(new QuoteLine(QuoteLineType::Adjustment, $label, 1, $adjustment, $adjustment));
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,8 @@ public function handle(Channel $channel): ChannelSyncLog
|
||||
'property_id' => $channel->property_id,
|
||||
'starts_on' => $period->startsOn->toDateString(),
|
||||
'ends_on' => $period->endsOn->toDateString(),
|
||||
'reason' => "{$channel->name}".($period->summary ? ": {$period->summary}" : ''),
|
||||
// The portal's SUMMARY is not stored: it may contain guest names (data minimisation).
|
||||
'reason' => $channel->name,
|
||||
'source' => 'channel',
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Throwable;
|
||||
|
||||
#[Signature('backup:database {--keep= : Anzahl aufbewahrter Sicherungen}')]
|
||||
#[Description('Write a compressed SQL dump of the database to storage/app/private/backups and keep the newest ones')]
|
||||
class BackupDatabase extends Command
|
||||
{
|
||||
public const DIRECTORY = 'backups';
|
||||
|
||||
/** Tables without lasting value; their content is not dumped (structure only). */
|
||||
private const SKIP_DATA = ['sessions', 'cache', 'cache_locks', 'jobs', 'job_batches', 'failed_jobs'];
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$keep = (int) ($this->option('keep') ?? config('fewo.backup.keep', 14));
|
||||
$file = self::DIRECTORY.'/fewo-'.now()->format('Ymd-His').'.sql.gz';
|
||||
$temp = tempnam(sys_get_temp_dir(), 'fewo-backup');
|
||||
$out = gzopen($temp, 'wb6');
|
||||
|
||||
try {
|
||||
gzwrite($out, '-- FeWo Stommer database backup '.now()->toIso8601String().' ('.DB::getDriverName().")\n");
|
||||
gzwrite($out, $this->isMysql() ? "SET FOREIGN_KEY_CHECKS=0;\nSET NAMES utf8mb4;\n" : "PRAGMA foreign_keys=OFF;\n");
|
||||
|
||||
foreach ($this->tables() as $table) {
|
||||
gzwrite($out, "\nDROP TABLE IF EXISTS ".$this->quoteName($table).";\n".$this->createStatement($table).";\n");
|
||||
if (! in_array($table, self::SKIP_DATA, true)) {
|
||||
$this->dumpRows($out, $table);
|
||||
}
|
||||
}
|
||||
|
||||
gzwrite($out, $this->isMysql() ? "SET FOREIGN_KEY_CHECKS=1;\n" : "PRAGMA foreign_keys=ON;\n");
|
||||
gzclose($out);
|
||||
|
||||
Storage::disk('local')->put($file, (string) file_get_contents($temp));
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
$this->error('Sicherung fehlgeschlagen: '.$exception->getMessage());
|
||||
|
||||
return self::FAILURE;
|
||||
} finally {
|
||||
@unlink($temp);
|
||||
}
|
||||
|
||||
$this->prune($keep);
|
||||
$this->info("Sicherung erstellt: storage/app/private/{$file} (".round(Storage::disk('local')->size($file) / 1024).' KB)');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
private function isMysql(): bool
|
||||
{
|
||||
return in_array(DB::getDriverName(), ['mysql', 'mariadb'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private function tables(): array
|
||||
{
|
||||
return $this->isMysql()
|
||||
? array_map(fn (object $row): string => (string) array_values((array) $row)[0], DB::select('SHOW TABLES'))
|
||||
: array_map(fn (object $row): string => $row->name, DB::select("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' ORDER BY name"));
|
||||
}
|
||||
|
||||
private function createStatement(string $table): string
|
||||
{
|
||||
if ($this->isMysql()) {
|
||||
return (string) array_values((array) DB::selectOne('SHOW CREATE TABLE '.$this->quoteName($table)))[1];
|
||||
}
|
||||
|
||||
return (string) DB::selectOne("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?", [$table])->sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $out
|
||||
*/
|
||||
private function dumpRows($out, string $table): void
|
||||
{
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$offset = 0;
|
||||
|
||||
do {
|
||||
$rows = DB::table($table)->offset($offset)->limit(500)->get();
|
||||
foreach ($rows as $row) {
|
||||
$values = array_map(fn ($value): string => $value === null ? 'NULL' : (is_int($value) || is_float($value) ? (string) $value : $pdo->quote((string) $value)), (array) $row);
|
||||
gzwrite($out, 'INSERT INTO '.$this->quoteName($table).' ('.implode(', ', array_map($this->quoteName(...), array_keys((array) $row))).') VALUES ('.implode(', ', $values).");\n");
|
||||
}
|
||||
$offset += 500;
|
||||
} while ($rows->count() === 500);
|
||||
}
|
||||
|
||||
private function quoteName(string $name): string
|
||||
{
|
||||
return $this->isMysql() ? '`'.str_replace('`', '``', $name).'`' : '"'.str_replace('"', '""', $name).'"';
|
||||
}
|
||||
|
||||
private function prune(int $keep): void
|
||||
{
|
||||
collect(Storage::disk('local')->files(self::DIRECTORY))
|
||||
->filter(fn (string $path): bool => str_ends_with($path, '.sql.gz'))
|
||||
->sort()
|
||||
->reverse()
|
||||
->slice(max(1, $keep))
|
||||
->each(fn (string $path) => Storage::disk('local')->delete($path));
|
||||
}
|
||||
}
|
||||
@@ -55,9 +55,7 @@ public function handle(): int
|
||||
|
||||
$this->info("Benutzer {$email} ({$role->getLabel()}) angelegt.");
|
||||
|
||||
if ($role === UserRole::Admin) {
|
||||
$this->line('Bei der ersten Anmeldung wird die Zwei-Faktor-Anmeldung mit einer Authenticator-App eingerichtet.');
|
||||
}
|
||||
$this->line('Bei der ersten Anmeldung wird die Zwei-Faktor-Anmeldung mit einer Authenticator-App eingerichtet.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Photo;
|
||||
use App\Support\StripImageMetadata;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Signature('photos:strip-metadata {--force : Auch bereits bereinigte Fotos erneut bearbeiten}')]
|
||||
#[Description('Remove metadata (GPS position, camera data) from all stored original photos – new uploads are cleaned automatically')]
|
||||
class StripPhotoMetadata extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$cleaned = Media::query()->where('collection_name', Photo::COLLECTION)->get()
|
||||
->filter(fn (Media $media): bool => StripImageMetadata::strip($media, (bool) $this->option('force')))
|
||||
->count();
|
||||
|
||||
$this->info("{$cleaned} Original-Foto(s) bereinigt.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -7,28 +7,31 @@
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* The rental contract as PDF. It is generated once at confirmation and stored, so later changes
|
||||
* of texts or prices do not alter a contract the guest already received.
|
||||
* The rental contract as PDF. As a draft it is part of the offer (offer_path, one file per offer version);
|
||||
* the final contract is generated at confirmation (contract_path). Both are stored, so later changes of
|
||||
* texts or prices do not alter a document the guest already received.
|
||||
*/
|
||||
class RentalContract
|
||||
{
|
||||
private const DISK = 'local';
|
||||
|
||||
public function generate(Booking $booking): string
|
||||
public function generate(Booking $booking, bool $draft = false): string
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
$path = "contracts/Mietvertrag-{$booking->reference}.pdf";
|
||||
$path = $draft
|
||||
? "contracts/Angebot-{$booking->reference}-v{$booking->offer_version}.pdf"
|
||||
: "contracts/Mietvertrag-{$booking->reference}.pdf";
|
||||
|
||||
Storage::disk(self::DISK)->put($path, Pdf::loadView('pdf.contract', ['booking' => $booking])->setPaper('a4')->output());
|
||||
$booking->update(['contract_path' => $path]);
|
||||
Storage::disk(self::DISK)->put($path, Pdf::loadView('pdf.contract', ['booking' => $booking, 'draft' => $draft])->setPaper('a4')->output());
|
||||
$booking->update([$draft ? 'offer_path' : 'contract_path' => $path]);
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function absolutePath(Booking $booking): ?string
|
||||
public function absolutePath(Booking $booking, bool $draft = false): ?string
|
||||
{
|
||||
return $booking->contract_path && Storage::disk(self::DISK)->exists($booking->contract_path)
|
||||
? Storage::disk(self::DISK)->path($booking->contract_path)
|
||||
: null;
|
||||
$path = $draft ? $booking->offer_path : $booking->contract_path;
|
||||
|
||||
return $path && Storage::disk(self::DISK)->exists($path) ? Storage::disk(self::DISK)->path($path) : null;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Filament\Pages\PricesAndOffers;
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use App\Filament\Resources\Photos\PhotoResource;
|
||||
use App\Filament\Resources\Reviews\ReviewResource;
|
||||
use Filament\Support\Contracts\HasDescription;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
@@ -26,9 +28,11 @@ enum AdminMode: string implements HasDescription, HasLabel
|
||||
public const SIMPLE_NAVIGATION = [
|
||||
BookingResource::class,
|
||||
BlockedPeriodResource::class,
|
||||
PricesAndOffers::class,
|
||||
GuestResource::class,
|
||||
ChannelTaskResource::class,
|
||||
ReviewResource::class,
|
||||
PhotoResource::class,
|
||||
];
|
||||
|
||||
public function getLabel(): string
|
||||
@@ -42,7 +46,7 @@ public function getLabel(): string
|
||||
public function getDescription(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Simple => 'Nur das Tägliche: Anfragen, Buchungen und Verträge, Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen',
|
||||
self::Simple => 'Das Tägliche: Anfragen, Buchungen und Verträge, Sperrzeiten, Preise & Angebote, Gäste, Portal-Aufgaben, Bewertungen, Fotos',
|
||||
self::Expert => 'Alle Einstellungen: Preise, Angebote, Portale, Webseite, System',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,8 +7,13 @@
|
||||
|
||||
enum BookingStatus: string implements HasColor, HasLabel
|
||||
{
|
||||
/** Guest request; the dates are held until hold_expires_at. */
|
||||
/** Non-binding guest request; the dates are held until hold_expires_at. */
|
||||
case Reserved = 'reserved';
|
||||
|
||||
/** The landlord sent an offer; the dates are held until hold_expires_at (= end of the offer's validity). */
|
||||
case OfferSent = 'offer_sent';
|
||||
|
||||
/** Binding booking: the guest accepted the offer (or the landlord confirmed directly). */
|
||||
case Confirmed = 'confirmed';
|
||||
case DepositPaid = 'deposit_paid';
|
||||
case Paid = 'paid';
|
||||
@@ -20,7 +25,8 @@ enum BookingStatus: string implements HasColor, HasLabel
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Reserved => 'Vorreserviert',
|
||||
self::Reserved => 'Anfrage (vorgemerkt)',
|
||||
self::OfferSent => 'Angebot gesendet',
|
||||
self::Confirmed => 'Bestätigt',
|
||||
self::DepositPaid => 'Anzahlung erhalten',
|
||||
self::Paid => 'Bezahlt',
|
||||
@@ -35,12 +41,23 @@ public function getColor(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Reserved => 'warning',
|
||||
self::OfferSent => 'primary',
|
||||
self::Confirmed, self::DepositPaid => 'info',
|
||||
self::Paid, self::Completed => 'success',
|
||||
self::Declined, self::Expired, self::Cancelled => 'gray',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Statuses that occupy the calendar while their hold time (hold_expires_at) runs.
|
||||
*
|
||||
* @return list<self>
|
||||
*/
|
||||
public static function holding(): array
|
||||
{
|
||||
return [self::Reserved, self::OfferSent];
|
||||
}
|
||||
|
||||
/**
|
||||
* Statuses that occupy the calendar regardless of any hold time.
|
||||
*
|
||||
|
||||
@@ -10,11 +10,14 @@ enum QuoteLineType: string
|
||||
case Extra = 'extra';
|
||||
case Discount = 'discount';
|
||||
|
||||
/** Manual price change by the landlord in an offer (negative = reduction). */
|
||||
case Adjustment = 'adjustment';
|
||||
|
||||
/**
|
||||
* Whether the line counts towards the rent on which the deposit is calculated.
|
||||
*/
|
||||
public function isRent(): bool
|
||||
{
|
||||
return in_array($this, [self::Accommodation, self::ExtraGuest, self::Discount], true);
|
||||
return in_array($this, [self::Accommodation, self::ExtraGuest, self::Discount, self::Adjustment], true);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,16 @@ public static function notAvailable(): self
|
||||
return new self('Der gewünschte Zeitraum ist leider nicht mehr frei.');
|
||||
}
|
||||
|
||||
public static function offerExpired(): self
|
||||
{
|
||||
return new self('Dieses Angebot ist nicht mehr gültig. Bitte melden Sie sich bei uns – gern erstellen wir Ihnen ein neues Angebot.');
|
||||
}
|
||||
|
||||
public static function offerOutdated(): self
|
||||
{
|
||||
return new self('Zu dieser Anfrage gibt es inzwischen ein aktualisiertes Angebot. Bitte verwenden Sie den Link aus unserer neuesten E-Mail.');
|
||||
}
|
||||
|
||||
public static function invalidTransition(string $statusLabel, string $action): self
|
||||
{
|
||||
return new self("Eine Buchung im Status „{$statusLabel}“ kann nicht {$action} werden.");
|
||||
|
||||
@@ -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),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Properties\Pages\EditProperty;
|
||||
use App\Filament\Resources\Properties\RelationManagers\ExtrasRelationManager;
|
||||
use App\Filament\Resources\Properties\RelationManagers\SeasonsRelationManager;
|
||||
use App\Filament\Resources\Properties\RelationManagers\SpecialOffersRelationManager;
|
||||
use App\Models\Property;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Livewire;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Components\Text;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Livewire\Attributes\Url;
|
||||
use UnitEnum;
|
||||
|
||||
/**
|
||||
* The yearly price work in one place, without the other apartment settings: seasons & prices,
|
||||
* special offers & promo codes, extras. Reuses the relation managers of the apartment.
|
||||
*/
|
||||
class PricesAndOffers extends Page
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCurrencyEuro;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
|
||||
|
||||
protected static ?string $navigationLabel = 'Preise & Angebote';
|
||||
|
||||
protected static ?string $title = 'Preise & Angebote';
|
||||
|
||||
protected static ?string $slug = 'preise-und-angebote';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
#[Url(as: 'wohnung')]
|
||||
public ?int $propertyId = null;
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return (bool) auth()->user()?->hasRole(UserRole::Admin, UserRole::Rentals);
|
||||
}
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->propertyId ??= Property::query()->where('is_active', true)->value('id') ?? Property::query()->value('id');
|
||||
}
|
||||
|
||||
public function content(Schema $schema): Schema
|
||||
{
|
||||
$property = Property::find($this->propertyId);
|
||||
if ($property === null) {
|
||||
return $schema->components([Text::make('Es ist noch keine Wohnung angelegt (Expertenansicht › Wohnungen).')]);
|
||||
}
|
||||
|
||||
$context = ['ownerRecord' => $property, 'pageClass' => EditProperty::class];
|
||||
|
||||
return $schema->components([
|
||||
Select::make('propertyId')
|
||||
->label('Wohnung')
|
||||
->options(fn (): array => Property::query()->orderBy('name')->pluck('name', 'id')->all())
|
||||
->live()
|
||||
->afterStateUpdated(fn () => $this->redirect(static::getUrl(['wohnung' => $this->propertyId])))
|
||||
->visible(fn (): bool => Property::query()->count() > 1),
|
||||
Tabs::make('prices')
|
||||
->persistTabInQueryString()
|
||||
->tabs([
|
||||
Tab::make('Saisons & Preise')->icon(Heroicon::OutlinedCalendar)->schema([
|
||||
Livewire::make(SeasonsRelationManager::class, $context)->key("seasons-{$property->id}"),
|
||||
]),
|
||||
Tab::make('Sonderangebote & Rabattcodes')->icon(Heroicon::OutlinedSparkles)->schema([
|
||||
Livewire::make(SpecialOffersRelationManager::class, $context)->key("offers-{$property->id}"),
|
||||
]),
|
||||
Tab::make('Extras')->icon(Heroicon::OutlinedGift)->schema([
|
||||
Livewire::make(ExtrasRelationManager::class, $context)->key("extras-{$property->id}"),
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,31 @@
|
||||
|
||||
use App\Actions\ConfirmBooking;
|
||||
use App\Actions\DeclineBooking;
|
||||
use App\Actions\SendOffer;
|
||||
use App\Documents\RentalContract;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Models\Booking;
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\QuoteException;
|
||||
use App\Pricing\StayRequest;
|
||||
use App\Support\Money;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Text;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* @property Booking $record
|
||||
@@ -33,14 +45,92 @@ public function getTitle(): string
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('confirm')
|
||||
->label('Bestätigen')
|
||||
->icon(Heroicon::OutlinedCheckCircle)
|
||||
Action::make('sendOffer')
|
||||
->label(fn (): string => $this->record->status === BookingStatus::OfferSent ? 'Angebot ändern & neu senden' : 'Angebot senden')
|
||||
->icon(Heroicon::OutlinedPaperAirplane)
|
||||
->color('success')
|
||||
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::Expired], true))
|
||||
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true))
|
||||
->modalHeading('Angebot an den Gast senden')
|
||||
->modalDescription('Der Gast erhält das Angebot mit Vertragsentwurf per E-Mail und kann es über einen Link annehmen oder ablehnen. Erst mit seiner Annahme ist die Buchung verbindlich.')
|
||||
->modalSubmitActionLabel('Angebot senden')
|
||||
->modalWidth('3xl')
|
||||
->fillForm(fn (): array => [
|
||||
'arrival' => $this->record->arrival->toDateString(),
|
||||
'departure' => $this->record->departure->toDateString(),
|
||||
'guests' => $this->record->guests,
|
||||
'promo_code' => $this->record->promo_code,
|
||||
'price_adjustment' => $this->record->price_adjustment !== null ? number_format($this->record->price_adjustment / 100, 2, '.', '') : null,
|
||||
'price_adjustment_label' => $this->record->price_adjustment_label,
|
||||
'valid_until' => now()->addHours($this->record->property->hold_hours)->format('Y-m-d H:i'),
|
||||
'offer_message' => $this->record->offer_message,
|
||||
'guest' => $this->record->guest->only(['first_name', 'last_name', 'street', 'postal_code', 'city', 'phone']),
|
||||
])
|
||||
->schema([
|
||||
Section::make('Termin')->columns(3)->schema([
|
||||
DatePicker::make('arrival')->label('Anreise')->required()->live(onBlur: true),
|
||||
DatePicker::make('departure')->label('Abreise')->after('arrival')->required()->live(onBlur: true),
|
||||
TextInput::make('guests')->label('Personen')->integer()->minValue(1)->maxValue(fn (): int => $this->record->property->max_guests)->required()->live(onBlur: true),
|
||||
]),
|
||||
Section::make('Preis')->columns(3)->schema([
|
||||
TextInput::make('promo_code')->label('Rabattcode')->helperText('Sonderkondition aus den Angeboten')->maxLength(50)->live(onBlur: true),
|
||||
TextInput::make('price_adjustment')
|
||||
->label('Preisanpassung')
|
||||
->helperText('Minus = Nachlass, z. B. -50')
|
||||
->numeric()
|
||||
->step(0.01)
|
||||
->suffix('€')
|
||||
->live(onBlur: true),
|
||||
TextInput::make('price_adjustment_label')->label('Bezeichnung')->placeholder('Nachlass / Zuschlag')->maxLength(80),
|
||||
Text::make(fn (Get $get): string => $this->offerPricePreview($get))->columnSpanFull(),
|
||||
]),
|
||||
Section::make('Gültigkeit & Nachricht')->columns(2)->schema([
|
||||
DateTimePicker::make('valid_until')
|
||||
->label('Angebot gültig bis')
|
||||
->helperText(fn (): string => 'Standard: '.$this->record->property->hold_hours.' Stunden (Einstellung der Wohnung). Bis dahin bleibt der Zeitraum reserviert.')
|
||||
->seconds(false)
|
||||
->after('now')
|
||||
->required(),
|
||||
Textarea::make('offer_message')->label('Persönliche Nachricht an den Gast (optional)')->rows(3),
|
||||
]),
|
||||
Section::make('Gast – so erscheint er im Mietvertrag')->columns(2)->collapsed()->schema([
|
||||
TextInput::make('guest.first_name')->label('Vorname')->required()->maxLength(100),
|
||||
TextInput::make('guest.last_name')->label('Nachname')->required()->maxLength(100),
|
||||
TextInput::make('guest.street')->label('Straße und Hausnummer')->maxLength(150),
|
||||
TextInput::make('guest.postal_code')->label('PLZ')->maxLength(20),
|
||||
TextInput::make('guest.city')->label('Ort')->maxLength(100),
|
||||
TextInput::make('guest.phone')->label('Telefon')->maxLength(50),
|
||||
]),
|
||||
])
|
||||
->action(fn (array $data, SendOffer $send) => $this->runWorkflow(
|
||||
fn () => $send->handle($this->record, $this->offerChanges($data)),
|
||||
'Angebot gesendet',
|
||||
)),
|
||||
Action::make('offerLink')
|
||||
->label('Angebotslink')
|
||||
->icon(Heroicon::OutlinedLink)
|
||||
->color('gray')
|
||||
->visible(fn (): bool => $this->record->status === BookingStatus::OfferSent && $this->record->hold_expires_at?->isFuture())
|
||||
->modalHeading('Link zum Angebot')
|
||||
->modalDescription('Derselbe Link wie in der Angebots-E-Mail – z. B. zum Weitergeben per Messenger. Gültig bis zum Ende der Angebotsfrist.')
|
||||
->schema([
|
||||
TextInput::make('url')->label('Link')->default(fn (SendOffer $send): string => $send->offerUrl($this->record))->readOnly()->copyable(),
|
||||
])
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelActionLabel('Schließen'),
|
||||
Action::make('offerPdf')
|
||||
->label('Angebot (PDF)')
|
||||
->icon(Heroicon::OutlinedDocumentText)
|
||||
->color('gray')
|
||||
->visible(fn (): bool => $this->record->status === BookingStatus::OfferSent && $this->record->offer_path !== null)
|
||||
->action(fn (RentalContract $contract) => response()->download($contract->absolutePath($this->record, draft: true) ?? abort(404), "Angebot-{$this->record->reference}.pdf")),
|
||||
Action::make('confirm')
|
||||
->label('Direkt bestätigen')
|
||||
->icon(Heroicon::OutlinedCheckCircle)
|
||||
->color('gray')
|
||||
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true))
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Buchung bestätigen')
|
||||
->modalDescription('Die Buchung wird verbindlich und der Zeitraum dauerhaft belegt.')
|
||||
->modalHeading('Buchung direkt bestätigen')
|
||||
->modalDescription('Ohne Angebot und Annahme durch den Gast – nur wenn die Buchung bereits anders verbindlich vereinbart wurde (z. B. telefonisch). Die Buchung wird verbindlich und der Zeitraum dauerhaft belegt.')
|
||||
->schema([
|
||||
Toggle::make('notify')->label('Buchungsbestätigung an den Gast senden')->default(true),
|
||||
])
|
||||
@@ -52,7 +142,7 @@ protected function getHeaderActions(): array
|
||||
->label('Ablehnen')
|
||||
->icon(Heroicon::OutlinedXCircle)
|
||||
->color('danger')
|
||||
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::Expired], true))
|
||||
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true))
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Anfrage ablehnen')
|
||||
->schema([
|
||||
@@ -66,7 +156,7 @@ protected function getHeaderActions(): array
|
||||
->label('Vormerkung verlängern')
|
||||
->icon(Heroicon::OutlinedClock)
|
||||
->color('gray')
|
||||
->visible(fn (): bool => $this->record->status === BookingStatus::Reserved)
|
||||
->visible(fn (): bool => in_array($this->record->status, BookingStatus::holding(), true))
|
||||
->schema([
|
||||
TextInput::make('hours')->label('Um')->integer()->minValue(1)->default(24)->suffix('Stunden')->required(),
|
||||
])
|
||||
@@ -117,11 +207,45 @@ protected function getHeaderActions(): array
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Form data of the offer modal as SendOffer changes (euro input → cents).
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function offerChanges(array $data): array
|
||||
{
|
||||
return [
|
||||
...$data,
|
||||
'price_adjustment' => filled($data['price_adjustment'] ?? null) ? (int) round((float) $data['price_adjustment'] * 100) : null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Live price shown in the offer modal, calculated exactly like the offer itself.
|
||||
*/
|
||||
private function offerPricePreview(Get $get): string
|
||||
{
|
||||
try {
|
||||
$stay = new StayRequest(CarbonImmutable::parse($get('arrival')), CarbonImmutable::parse($get('departure')), (int) $get('guests'), $this->record->extras ?? [], filled($get('promo_code')) ? (string) $get('promo_code') : null);
|
||||
$quote = app(PriceCalculator::class)->calculate($this->record->property, $stay);
|
||||
} catch (QuoteException $exception) {
|
||||
return 'Preis: '.$exception->getMessage();
|
||||
} catch (Throwable) {
|
||||
return 'Preis: bitte Termin und Personen angeben.';
|
||||
}
|
||||
|
||||
$adjustment = filled($get('price_adjustment')) ? max((int) round((float) $get('price_adjustment') * 100), -$quote->rent()) : 0;
|
||||
$promo = filled($get('promo_code')) ? ($quote->promoCodeApplied ? ' · Rabattcode angewendet' : ' · Rabattcode gilt hier nicht') : '';
|
||||
|
||||
return 'Gesamtpreis im Angebot: '.Money::format($quote->total() + $adjustment).' (bisher '.Money::format($this->record->total).')'.$promo;
|
||||
}
|
||||
|
||||
private function runWorkflow(callable $workflow, string $successTitle): void
|
||||
{
|
||||
try {
|
||||
$workflow();
|
||||
} catch (ReservationException $exception) {
|
||||
} catch (ReservationException|QuoteException $exception) {
|
||||
Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send();
|
||||
|
||||
return;
|
||||
|
||||
@@ -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.')
|
||||
|
||||
@@ -36,8 +36,7 @@ public function feed(string $token, ICalFeed $feed): Response
|
||||
|
||||
public function health(Request $request): JsonResponse
|
||||
{
|
||||
$token = config('fewo.channels.health_token');
|
||||
abort_if(blank($token) || ! hash_equals($token, (string) $request->query('token')), 404);
|
||||
abort_unless($this->hasValidToken($request, config('fewo.channels.health_token')), 404);
|
||||
|
||||
$channels = Channel::query()->active()->get()->map(fn (Channel $channel): array => [
|
||||
'name' => $channel->name,
|
||||
@@ -69,8 +68,7 @@ public function health(Request $request): JsonResponse
|
||||
*/
|
||||
public function scheduler(Request $request): JsonResponse
|
||||
{
|
||||
$token = config('fewo.scheduler_token');
|
||||
abort_if(blank($token) || ! hash_equals($token, (string) $request->query('token')), 404);
|
||||
abort_unless($this->hasValidToken($request, config('fewo.scheduler_token')), 404);
|
||||
|
||||
Artisan::call('schedule:run');
|
||||
|
||||
@@ -129,4 +127,15 @@ private function verifySignature(Request $request): void
|
||||
|
||||
abort_if(blank($secret) || ! hash_equals(hash_hmac('sha256', $request->getContent(), $secret), $signature), 403);
|
||||
}
|
||||
|
||||
/**
|
||||
* The token is sent as header "Authorization: Bearer <token>" (preferred – does not end up in web server logs)
|
||||
* or, for older automations, as ?token=<token>.
|
||||
*/
|
||||
private function hasValidToken(Request $request, ?string $expected): bool
|
||||
{
|
||||
$given = (string) ($request->bearerToken() ?? $request->header('X-Fewo-Token') ?? $request->query('token', ''));
|
||||
|
||||
return filled($expected) && hash_equals((string) $expected, $given);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\AcceptOffer;
|
||||
use App\Actions\RejectOffer;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
/**
|
||||
* The guest's offer page (no account): reached by the signed link in the offer e-mail. Shows the complete
|
||||
* offer and lets the guest accept or decline it; the form actions are signed the same way.
|
||||
*/
|
||||
class OfferController extends Controller
|
||||
{
|
||||
public function show(Request $request, Booking $booking, AcceptOffer $accept): View
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
$version = (int) $request->query('v');
|
||||
|
||||
$problem = null;
|
||||
if ($booking->status === BookingStatus::OfferSent) {
|
||||
try {
|
||||
$accept->ensureAcceptable($booking, $version);
|
||||
} catch (ReservationException $exception) {
|
||||
$problem = $exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$expires = $booking->hold_expires_at?->isFuture() ? $booking->hold_expires_at : now()->addHour();
|
||||
|
||||
return view('offer', [
|
||||
'booking' => $booking,
|
||||
'problem' => $problem,
|
||||
'canAnswer' => $booking->status === BookingStatus::OfferSent && $problem === null,
|
||||
'acceptUrl' => URL::temporarySignedRoute('offers.accept', $expires, ['booking' => $booking, 'v' => $version]),
|
||||
'rejectUrl' => URL::temporarySignedRoute('offers.reject', $expires, ['booking' => $booking, 'v' => $version]),
|
||||
'title' => 'Ihr Angebot',
|
||||
]);
|
||||
}
|
||||
|
||||
public function accept(Request $request, Booking $booking, AcceptOffer $accept): RedirectResponse
|
||||
{
|
||||
$request->validate(['terms' => ['accepted']], ['terms.accepted' => 'Bitte bestätigen Sie, dass Sie die Bedingungen gelesen haben.']);
|
||||
|
||||
return $this->answer($request, $booking, fn (int $version) => $accept->handle($booking, $version), 'Vielen Dank! Ihre Buchung ist verbindlich. Die Bestätigung mit dem Mietvertrag haben wir Ihnen per E-Mail gesendet.');
|
||||
}
|
||||
|
||||
public function reject(Request $request, Booking $booking, RejectOffer $reject): RedirectResponse
|
||||
{
|
||||
return $this->answer($request, $booking, fn (int $version) => $reject->handle($booking, $version), 'Schade – wir haben Ihre Absage erhalten und den Zeitraum wieder freigegeben. Vielleicht ein anderes Mal!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the answer and returns to a freshly signed offer page with the result.
|
||||
*/
|
||||
private function answer(Request $request, Booking $booking, callable $action, string $success): RedirectResponse
|
||||
{
|
||||
$version = (int) $request->query('v');
|
||||
$back = URL::temporarySignedRoute('offers.show', now()->addDays(30), ['booking' => $booking, 'v' => $version]);
|
||||
|
||||
try {
|
||||
$action($version);
|
||||
} catch (ReservationException $exception) {
|
||||
return redirect()->to($back)->with('offer.error', $exception->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->to($back)->with('offer.success', $success);
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@ public function robots(): Response
|
||||
'Disallow: /automation',
|
||||
'Disallow: /bewertung',
|
||||
'Disallow: /angebote',
|
||||
'Disallow: /angebot/',
|
||||
'Sitemap: '.route('sitemap'),
|
||||
'',
|
||||
]), 200, ['Content-Type' => 'text/plain; charset=UTF-8']);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
use Filament\Auth\MultiFactor\Http\Middleware\EnsureMultiFactorAuthenticationIsEnabled;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Filament evaluates "two-factor required" once per panel; this narrows it to administrators.
|
||||
* Other roles may set it up voluntarily in their profile.
|
||||
*/
|
||||
class RequireTwoFactorForAdmins extends EnsureMultiFactorAuthenticationIsEnabled
|
||||
{
|
||||
public function handle(Request $request, Closure $next): mixed
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
if (! $user instanceof User || ! $user->hasRole(UserRole::Admin)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return parent::handle($request, $next);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Security headers for every response. A Content-Security-Policy is not set yet: Livewire/Filament rely on
|
||||
* inline scripts and styles, a policy needs nonces and a careful test first.
|
||||
*/
|
||||
class SecurityHeaders
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$response = $next($request);
|
||||
|
||||
$response->headers->set('X-Content-Type-Options', 'nosniff');
|
||||
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
|
||||
$response->headers->set('Referrer-Policy', 'strict-origin-when-cross-origin');
|
||||
$response->headers->set('Permissions-Policy', 'camera=(), microphone=(), geolocation=(), payment=(), usb=()');
|
||||
|
||||
if ($request->isSecure() && ! app()->environment('local', 'testing')) {
|
||||
$response->headers->set('Strict-Transport-Security', 'max-age=31536000');
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -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'],
|
||||
];
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Tells the landlord that the guest accepted or declined an offer.
|
||||
*/
|
||||
class OfferAnswered extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public function __construct(public Booking $booking, public bool $accepted) {}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: ($this->accepted ? 'Angebot angenommen: ' : 'Angebot abgelehnt: ').$this->booking->reference,
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(markdown: 'mail.offer-answered');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Documents\RentalContract;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* The offer to the guest: price, validity, contract draft as PDF and the link to accept or decline.
|
||||
*/
|
||||
class OfferMade extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public function __construct(public Booking $booking, public string $offerUrl) {}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Ihr Angebot '.$this->booking->reference.' – Ferienwohnung Stommer',
|
||||
replyTo: [new Address(config('fewo.owner.email'), config('fewo.owner.name'))],
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(markdown: 'mail.offer-made');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
$path = app(RentalContract::class)->absolutePath($this->booking, draft: true);
|
||||
|
||||
return $path ? [Attachment::fromPath($path)->as("Angebot-{$this->booking->reference}.pdf")->withMime('application/pdf')] : [];
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public function __construct(public Booking $booking) {}
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Ihre Anfrage '.$this->booking->reference.' – Termin vorgemerkt',
|
||||
subject: 'Ihre Anfrage '.$this->booking->reference.' – Termin vorgemerkt, Angebot folgt',
|
||||
replyTo: [new Address(config('fewo.owner.email'), config('fewo.owner.name'))],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
'guests',
|
||||
'extras',
|
||||
'promo_code',
|
||||
'price_adjustment',
|
||||
'price_adjustment_label',
|
||||
'quote',
|
||||
'total',
|
||||
'deposit',
|
||||
@@ -43,9 +45,16 @@
|
||||
'balance_due_on',
|
||||
'contract_path',
|
||||
'hold_expires_at',
|
||||
'offer_version',
|
||||
'offer_sent_at',
|
||||
'offer_message',
|
||||
'offer_path',
|
||||
'message',
|
||||
'internal_notes',
|
||||
'confirmed_at',
|
||||
'accepted_at',
|
||||
'acceptance',
|
||||
'declined_by',
|
||||
'cancelled_at',
|
||||
'review_requested_at',
|
||||
'deposit_reminded_at',
|
||||
@@ -83,6 +92,9 @@ protected function casts(): array
|
||||
'balance_due_on' => 'immutable_date',
|
||||
'hold_expires_at' => 'immutable_datetime',
|
||||
'confirmed_at' => 'immutable_datetime',
|
||||
'offer_sent_at' => 'immutable_datetime',
|
||||
'accepted_at' => 'immutable_datetime',
|
||||
'acceptance' => 'array',
|
||||
'cancelled_at' => 'immutable_datetime',
|
||||
'review_requested_at' => 'immutable_datetime',
|
||||
'deposit_reminded_at' => 'immutable_datetime',
|
||||
@@ -109,7 +121,7 @@ public function guest(): BelongsTo
|
||||
}
|
||||
|
||||
/**
|
||||
* Bookings that currently occupy their dates: confirmed ones and reservations whose hold has not expired.
|
||||
* Bookings that currently occupy their dates: confirmed ones and requests/offers whose hold has not expired.
|
||||
*
|
||||
* @param Builder<Booking> $query
|
||||
* @return Builder<Booking>
|
||||
@@ -120,7 +132,7 @@ protected function occupying(Builder $query): Builder
|
||||
return $query->where(fn (Builder $query) => $query
|
||||
->whereIn('status', BookingStatus::occupying())
|
||||
->orWhere(fn (Builder $query) => $query
|
||||
->where('status', BookingStatus::Reserved)
|
||||
->whereIn('status', BookingStatus::holding())
|
||||
->where('hold_expires_at', '>', now())));
|
||||
}
|
||||
|
||||
@@ -185,6 +197,6 @@ public function nights(): int
|
||||
|
||||
public function isHoldActive(): bool
|
||||
{
|
||||
return $this->status === BookingStatus::Reserved && $this->hold_expires_at?->isFuture();
|
||||
return in_array($this->status, BookingStatus::holding(), true) && $this->hold_expires_at?->isFuture();
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,19 @@ protected function withMarketingConsent(Builder $query): Builder
|
||||
public function anonymize(): void
|
||||
{
|
||||
DB::transaction(function (): void {
|
||||
$this->bookings()->update(['message' => null]);
|
||||
$this->bookings()->update([
|
||||
'message' => null,
|
||||
'internal_notes' => null,
|
||||
'offer_message' => null,
|
||||
'referral_source' => null,
|
||||
'utm_source' => null,
|
||||
'utm_medium' => null,
|
||||
'utm_campaign' => null,
|
||||
]);
|
||||
Review::query()->whereIn('booking_id', $this->bookings()->select('id'))->update([
|
||||
'display_name' => 'Gast',
|
||||
'private_feedback' => null,
|
||||
]);
|
||||
|
||||
$this->forceFill([
|
||||
'first_name' => 'Anonymisiert',
|
||||
|
||||
@@ -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',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {}
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,14 @@ public function __construct(
|
||||
public ?bool $promoCodeApplied = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* The same quote with one more line, e.g. a manual adjustment in an offer.
|
||||
*/
|
||||
public function withLine(QuoteLine $line): self
|
||||
{
|
||||
return new self($this->arrival, $this->departure, $this->guests, [...$this->lines, $line], $this->depositPercent, $this->balanceDueOn, $this->promoCodeApplied);
|
||||
}
|
||||
|
||||
/**
|
||||
* Total of all special offer discounts as a positive amount.
|
||||
*/
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Support\Settings;
|
||||
use App\Support\StripImageMetadata;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -20,6 +24,12 @@ public function register(): void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// 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));
|
||||
|
||||
// On Strato the domain points at the deployment folder and .htaccess forwards to current/public;
|
||||
// without a fixed root, some URLs (e.g. /sitemap.xml) would be generated with /current/public.
|
||||
if (! $this->app->environment('local', 'testing')) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Enums\AdminMode;
|
||||
use App\Http\Middleware\RequireTwoFactorForAdmins;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
@@ -17,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;
|
||||
@@ -42,12 +43,11 @@ public function panel(Panel $panel): Panel
|
||||
->path('admin')
|
||||
->login()
|
||||
->profile(isSimple: false)
|
||||
// Two-factor login with an authenticator app (TOTP) and recovery codes; mandatory for administrators.
|
||||
// Two-factor login with an authenticator app (TOTP) and recovery codes; mandatory for every account.
|
||||
->multiFactorAuthentication(
|
||||
[AppAuthentication::make()->brandName('FeWo Stommer')->recoverable()],
|
||||
isRequired: true,
|
||||
)
|
||||
->multiFactorAuthenticationRequiredMiddlewareName(RequireTwoFactorForAdmins::class)
|
||||
->userMenuItems([
|
||||
'admin-mode' => Action::make('switchAdminMode')
|
||||
->label(fn (): string => (self::currentUser()?->adminMode() ?? AdminMode::Expert)->other()->switchLabel())
|
||||
@@ -60,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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Spatie\Image\Enums\ImageDriver;
|
||||
use Spatie\Image\Image;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Re-encodes an uploaded original photo without its metadata (EXIF/XMP: GPS position, camera, owner).
|
||||
* The orientation is applied first, so the photo keeps its correct rotation. Failures never block an upload.
|
||||
*/
|
||||
class StripImageMetadata
|
||||
{
|
||||
private const TYPES = ['image/jpeg', 'image/png', 'image/webp'];
|
||||
|
||||
public static function strip(Media $media, bool $force = false): bool
|
||||
{
|
||||
if (! in_array($media->mime_type, self::TYPES, true) || ($media->getCustomProperty('metadata_stripped') && ! $force)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$path = $media->getPath();
|
||||
if (! is_file($path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// GD on purpose: Imagick (default when installed, e.g. on Strato) keeps the EXIF data when saving.
|
||||
Image::useImageDriver(ImageDriver::Gd)->loadFile($path)->quality(90)->save($path);
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
clearstatcache(true, $path);
|
||||
$media->size = (int) filesize($path);
|
||||
$media->setCustomProperty('metadata_stripped', true);
|
||||
$media->saveQuietly();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Middleware\ResolveTheme;
|
||||
use App\Http\Middleware\SecurityHeaders;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
@@ -14,6 +15,7 @@
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware): void {
|
||||
$middleware->web(append: [ResolveTheme::class]);
|
||||
$middleware->append(SecurityHeaders::class);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
$exceptions->shouldRenderJsonWhen(
|
||||
|
||||
@@ -36,12 +36,22 @@
|
||||
'contract' => [
|
||||
'label' => 'Mietvertrag',
|
||||
'fields' => [
|
||||
'contract.intro' => ['label' => 'Einleitung', 'type' => 'textarea', 'default' => 'Zwischen Vermieter und Mieter wird folgender Mietvertrag über die Ferienwohnung geschlossen. Der Vertrag kommt mit der Buchungsbestätigung des Vermieters zustande.'],
|
||||
'contract.intro' => ['label' => 'Einleitung', 'type' => 'textarea', 'default' => 'Zwischen Vermieter und Mieter wird folgender Mietvertrag über die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.'],
|
||||
'contract.terms' => ['label' => 'Mietbedingungen', 'type' => 'richtext', 'default' => '<p><strong>[MUSTER – bitte durch Ihre geprüften Mietbedingungen ersetzen]</strong></p><ol><li>Die Wohnung darf nur von den im Vertrag genannten Personen genutzt werden.</li><li>Der Mieter behandelt die Wohnung und das Inventar pfleglich und meldet Schäden unverzüglich.</li><li>Die Kurtaxe ist nicht im Mietpreis enthalten und wird vor Ort entrichtet.</li></ol>'],
|
||||
'contract.closing' => ['label' => 'Schlusstext', 'type' => 'textarea', 'default' => 'Wir freuen uns auf Ihren Besuch und wünschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.'],
|
||||
],
|
||||
],
|
||||
|
||||
'offer' => [
|
||||
'label' => 'Angebot & Annahme',
|
||||
'fields' => [
|
||||
'offer.intro' => ['label' => 'Einleitung in der Angebots-E-Mail', 'type' => 'textarea', 'default' => 'vielen Dank für Ihre Anfrage. Gern machen wir Ihnen folgendes Angebot – den Vertragsentwurf mit allen Bedingungen finden Sie im Anhang.'],
|
||||
'offer.contract_note' => ['label' => 'Hinweis im Vertragsentwurf', 'type' => 'textarea', 'default' => 'Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot über den Link in unserer E-Mail annehmen.'],
|
||||
'offer.accept_note' => ['label' => 'Hinweis über dem Annahme-Button', 'type' => 'textarea', 'default' => 'Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden fällig.'],
|
||||
'offer.accept_button' => ['label' => 'Beschriftung des Annahme-Buttons', 'type' => 'text', 'default' => 'Angebot zahlungspflichtig annehmen'],
|
||||
],
|
||||
],
|
||||
|
||||
'legal' => [
|
||||
'label' => 'Rechtliches',
|
||||
'fields' => [
|
||||
|
||||
@@ -46,6 +46,43 @@
|
||||
*/
|
||||
'guest_retention_years' => (int) env('FEWO_GUEST_RETENTION_YEARS', 10),
|
||||
|
||||
/*
|
||||
| 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.
|
||||
*/
|
||||
// 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),
|
||||
],
|
||||
|
||||
'retention' => [
|
||||
// Requests/offers that never became a binding booking: guest data anonymised after … months.
|
||||
'inquiry_months' => (int) env('FEWO_RETENTION_INQUIRY_MONTHS', 6),
|
||||
// Text excerpt of processed portal e-mails (may contain names) is removed after … days.
|
||||
'portal_email_excerpt_days' => (int) env('FEWO_RETENTION_PORTAL_EMAIL_EXCERPT_DAYS', 90),
|
||||
// Marketing attribution (UTM parameters, "how did you hear about us") is removed after … months.
|
||||
'attribution_months' => (int) env('FEWO_RETENTION_ATTRIBUTION_MONTHS', 24),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Portal synchronisation
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Booking path 1: request → offer by the landlord → acceptance by the guest (docs/KONZEPT.md §6a).
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->unsignedSmallInteger('offer_version')->default(0)->after('hold_expires_at');
|
||||
$table->timestamp('offer_sent_at')->nullable()->after('offer_version');
|
||||
$table->text('offer_message')->nullable()->after('offer_sent_at');
|
||||
$table->string('offer_path')->nullable()->after('offer_message');
|
||||
$table->integer('price_adjustment')->nullable()->after('promo_code');
|
||||
$table->string('price_adjustment_label')->nullable()->after('price_adjustment');
|
||||
$table->timestamp('accepted_at')->nullable()->after('confirmed_at');
|
||||
$table->json('acceptance')->nullable()->after('accepted_at');
|
||||
$table->string('declined_by', 10)->nullable()->after('acceptance');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->dropColumn(['offer_version', 'offer_sent_at', 'offer_message', 'offer_path', 'price_adjustment', 'price_adjustment_label', 'accepted_at', 'acceptance', 'declined_by']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
@@ -103,15 +112,14 @@ ## 7. Zugang zur Verwaltung (`/admin`)
|
||||
"cd test.fewo-stommer.de/current && /opt/RZphp84/bin/php-cli artisan users:create lars@stommer.com --name='Lars Stommer' --role=admin"
|
||||
```
|
||||
|
||||
Weitere Benutzer legt ein Administrator in der Verwaltung an (System › Benutzer): Name, E-Mail, **Rolle** (was die Person darf) und **Ansicht** (was das Menü zeigt), Passwort. Rollen: `admin` (alles inkl. Benutzer), `rentals` (Vermietung), `content` (Inhalte); ohne Rolle kein Zugang. Empfehlung: Lars `admin`, Brigitte `rentals` mit einfacher Ansicht.
|
||||
Weitere Benutzer legt ein Administrator in der Verwaltung an (System › Benutzer): Name, E-Mail, **Rolle** (was die Person darf) und **Ansicht** (was das Menü zeigt), Passwort. Rollen: `admin` (alles inkl. Benutzer), `rentals` (Vermietung), `content` (Inhalte); ohne Rolle kein Zugang. Festlegung 22.10.2026: Lars und Brigitte beide `admin` (dürfen alles); Brigitte mit **einfacher Ansicht** (beim Anlegen „Ansicht: Einfach“ wählen, sonst erhalten Administratoren die Expertenansicht).
|
||||
|
||||
**Ansichten:** *Einfache Ansicht* – nur Anfragen & Buchungen (inkl. Bestätigen, Mietvertrag, Zahlungen), Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen. *Expertenansicht* – alle Einstellungen, die die Rolle erlaubt (Preise, Angebote, Portale, Webseite, System). Ohne Auswahl: Administratoren Experten-, alle anderen einfache Ansicht. Umschalten jederzeit über das Benutzermenü oben rechts („Zur … Ansicht wechseln“). Die Ansicht blendet nur Menüpunkte aus; Rechte regelt allein die Rolle.
|
||||
**Ansichten:** *Einfache Ansicht* – Anfragen & Buchungen (Angebot senden, Mietvertrag, Zahlungen), Sperrzeiten, **Preise & Angebote** (Saisons, Sonderangebote/Rabattcodes, Extras), Gäste, Portal-Aufgaben, Bewertungen, Bilder. *Expertenansicht* – alle Einstellungen, die die Rolle erlaubt (Preise, Angebote, Portale, Webseite, System). Ohne Auswahl: Administratoren Experten-, alle anderen einfache Ansicht. Umschalten jederzeit über das Benutzermenü oben rechts („Zur … Ansicht wechseln“). Die Ansicht blendet nur Menüpunkte aus; Rechte regelt allein die Rolle.
|
||||
|
||||
**Passwort vergessen:** Ein Administrator vergibt unter System › Benutzer › Bearbeiten ein neues Passwort (eine Selbst-Zurücksetzung per E-Mail gibt es bewusst nicht). **Handy verloren:** dort Aktion „2FA zurücksetzen“ – die Person richtet die 2FA bei der nächsten Anmeldung neu ein.
|
||||
|
||||
**Zwei-Faktor-Anmeldung (2FA):** Filament-eigene Lösung mit Authenticator-App (TOTP, z. B. Bitwarden/Vaultwarden, Google oder Microsoft Authenticator) und Wiederherstellungscodes.
|
||||
- **Pflicht für Administratoren:** Nach der ersten Anmeldung wird man auf die Einrichtungsseite geleitet (QR-Code scannen, Code bestätigen, Wiederherstellungscodes sichern). Umgesetzt mit `App\Http\Middleware\RequireTwoFactorForAdmins`.
|
||||
- **Freiwillig für andere Rollen:** im Profil (Avatar oben rechts › Profil).
|
||||
- **Pflicht für alle Konten** (Entscheidung 22.10.2026): Nach der ersten Anmeldung wird man auf die Einrichtungsseite geleitet (QR-Code scannen, Code bestätigen, Wiederherstellungscodes sichern). Filament-Standard (`multiFactorAuthentication(isRequired: true)`).
|
||||
- Schlüssel und Codes liegen verschlüsselt (mit `APP_KEY`) in `users.app_authentication_secret` / `app_authentication_recovery_codes`.
|
||||
- **Handy verloren:** Anmeldung mit einem Wiederherstellungscode. Sind auch die weg, setzt ein Administrator mit Serverzugang die 2FA zurück:
|
||||
```bash
|
||||
@@ -121,6 +129,19 @@ ## 7. Zugang zur Verwaltung (`/admin`)
|
||||
|
||||
Lokal (nur Entwicklung, `php artisan migrate:fresh --seed`): `admin@example.com` / `password`, 2FA wird bei der ersten Anmeldung eingerichtet.
|
||||
|
||||
## 7a. Datensicherung, Löschfristen, Automationen
|
||||
|
||||
- **Datenbank-Backup:** täglich 02:30 per Scheduler (`php artisan backup:database`) als `shared/storage/app/private/backups/fewo-<datum>.sql.gz`; es bleiben die neuesten 14 (`FEWO_BACKUP_KEEP`). Wiederherstellen: Datei entpacken und mit `mysql` bzw. phpMyAdmin (Strato) einspielen.
|
||||
- **Sicherung aufs NAS / einen Rechner** (holt eine frische Datenbank-Sicherung plus Fotos und Verträge; auf dem Server wird nichts verändert):
|
||||
```bash
|
||||
bash scripts/backup-pull.sh staging /pfad/zum/nas/fewo-backup
|
||||
```
|
||||
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.
|
||||
|
||||
## 8. Bekannte Eigenheiten und Lösungen
|
||||
|
||||
| Problem | Ursache | Lösung (umgesetzt) |
|
||||
@@ -133,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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) |
|
||||
@@ -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
|
||||
|
||||
@@ -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 |
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 85 KiB |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="1 10 62 50">
|
||||
<style>.navy{fill:#0B2E55}@media (prefers-color-scheme:dark){.navy{fill:#F6F2EA}}</style>
|
||||
<circle cx="50" cy="34" r="9" fill="#F2C27A"/>
|
||||
<path class="navy" d="M4 34 L28 16 L37 23 L37 18 L42 18 L42 27 L54 36 L49 36 L28 21 L7 37 Z"/>
|
||||
<g class="navy"><rect x="24.5" y="25" width="3.5" height="3.5" rx=".5"/><rect x="29" y="25" width="3.5" height="3.5" rx=".5"/><rect x="24.5" y="29.5" width="3.5" height="3.5" rx=".5"/><rect x="29" y="29.5" width="3.5" height="3.5" rx=".5"/></g>
|
||||
<path fill="#0286A2" d="M2 48 C10 40 20 37 28 38 C38 39 46 45 62 44 C54 50 44 51 36 49 C26 46 16 43 2 48 Z"/>
|
||||
<path fill="#6DBFC2" d="M6 55 C14 50 22 48 30 49.5 C37 51 42 54 50 54.5 C44 57.5 36 57.5 30 56 C22 54 14 52.5 6 55 Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 790 B |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Ferienwohnung">
|
||||
<title>Ferienwohnung</title>
|
||||
<circle cx="88" cy="62" r="15" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<path fill="var(--brand-navy, #0B2E55)" d="M12 64 L52 34 L68 46 L68 36 L76 36 L76 52 C84 60 92 66 104 70 L94 70 C86 68 78 62 72 57 L52 42 L16 68 C13 70 10 66 12 64 Z"/>
|
||||
<g fill="var(--brand-navy, #0B2E55)"><rect x="45" y="50" width="6" height="6" rx="1"/><rect x="53" y="50" width="6" height="6" rx="1"/><rect x="45" y="58" width="6" height="6" rx="1"/><rect x="53" y="58" width="6" height="6" rx="1"/></g>
|
||||
<rect x="82" y="74" width="30" height="3.5" rx="1.75" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<path fill="var(--brand-teal, #0286A2)" d="M6 92 C18 80 32 74 46 75 C62 76 74 86 96 84 C86 92 74 94 62 92 C48 90 36 83 22 84 C16 85 10 88 6 92 Z"/>
|
||||
<path fill="var(--brand-wave, #6DBFC2)" d="M12 100 C22 94 32 92 42 93 C54 94 62 100 76 100 C68 104 58 104 50 103 C40 101 30 98 12 100 Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1000 B |
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Lage">
|
||||
<title>Lage</title>
|
||||
<defs><clipPath id="icon-location-inner"><circle cx="60" cy="46" r="28"/></clipPath></defs>
|
||||
<path fill="var(--brand-navy, #0B2E55)" fill-rule="evenodd" d="M60 6 C82 6 98 22 98 44 C98 66 74 88 60 112 C46 88 22 66 22 44 C22 22 38 6 60 6 Z M60 18 C45.6 18 34 29.6 34 44 C34 58.4 45.6 70 60 70 C74.4 70 86 58.4 86 44 C86 29.6 74.4 18 60 18 Z"/>
|
||||
<g clip-path="url(#icon-location-inner)">
|
||||
<circle cx="66" cy="46" r="13" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<path fill="var(--brand-teal, #0286A2)" d="M30 54 C40 46 52 44 62 47 C72 50 80 54 92 50 L92 58 C82 62 72 60 62 56 C52 52 42 52 30 60 Z"/>
|
||||
<path fill="var(--brand-wave, #6DBFC2)" d="M30 64 C40 58 50 57 60 60 C70 63 80 64 92 60 L92 68 C80 72 70 70 60 67 C50 64 40 64 30 70 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 871 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Ostsee">
|
||||
<title>Ostsee</title>
|
||||
<path fill="var(--brand-teal, #0286A2)" d="M8 76 C20 60 36 52 52 56 C66 60 76 72 90 68 C98 66 102 58 98 50 C94 44 86 44 84 50 C88 48 92 52 90 56 C86 62 76 58 74 48 C72 38 82 30 92 32 C106 34 114 48 110 62 C106 78 88 86 72 82 C58 78 48 66 34 66 C24 66 16 70 8 76 Z"/>
|
||||
<path fill="var(--brand-wave, #6DBFC2)" d="M10 90 C22 80 36 76 50 78 C64 80 76 90 104 82 C96 92 82 96 68 94 C54 92 42 86 30 86 C22 86 16 88 10 90 Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 547 B |
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Terrasse und Strand">
|
||||
<title>Terrasse und Strand</title>
|
||||
<defs><clipPath id="icon-terrace-sun"><rect x="70" y="20" width="40" height="34"/></clipPath></defs>
|
||||
<circle cx="90" cy="46" r="15" fill="var(--brand-sun, #F2C27A)" clip-path="url(#icon-terrace-sun)"/>
|
||||
<rect x="72" y="56" width="38" height="3" rx="1.5" fill="var(--brand-sun, #F2C27A)"/><rect x="80" y="63" width="22" height="3" rx="1.5" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<path fill="var(--brand-navy, #0B2E55)" d="M14 44 C18 30 30 22 44 22 C58 22 70 30 74 44 C68 40 62 40 56 42 C52 38 48 37 44 37 C40 37 36 38 32 42 C26 40 20 40 14 44 Z"/>
|
||||
<rect x="42.5" y="36" width="3.5" height="38" fill="var(--brand-navy, #0B2E55)"/>
|
||||
<path fill="var(--brand-navy, #0B2E55)" d="M24 52 L30 52 L44 70 L66 70 C68 70 69 72 68 74 L34 74 L28 84 L24 84 L30 73 Z M58 74 L62 74 L66 84 L62 84 Z"/>
|
||||
<path fill="var(--brand-teal, #0286A2)" d="M8 94 C24 86 42 84 60 86 C78 88 92 88 112 82 C100 92 82 96 64 95 C46 94 28 90 8 94 Z"/>
|
||||
<path fill="var(--brand-wave, #6DBFC2)" d="M14 102 C30 97 46 96 62 98 C76 100 88 100 104 97 C94 103 80 105 66 104 C50 103 32 100 14 102 Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 87 KiB |
@@ -0,0 +1,20 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1448 1000" role="img" aria-label="FeWo Stommer – Ferienwohnung in Kühlungsborn">
|
||||
<title>FeWo Stommer – Ferienwohnung in Kühlungsborn</title>
|
||||
<g transform="translate(200 -170) scale(0.86)">
|
||||
<defs><clipPath id="logo-sun"><rect x="860" y="500" width="380" height="262"/></clipPath></defs>
|
||||
<circle cx="1046" cy="708" r="140" fill="var(--brand-sun, #F2C27A)" clip-path="url(#logo-sun)"/>
|
||||
<rect x="930" y="776" width="296" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<rect x="1048" y="832" width="152" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<path fill="var(--brand-navy, #0B2E55)" d="M118 716 L553 412 L750 549 L750 485 L826 485 L826 602 C905 685 990 748 1102 760 C1060 772 1000 774 960 768 C880 754 820 706 760 652 L553 476 L132 724 C124 728 114 722 118 716 Z"/>
|
||||
<g fill="var(--brand-navy, #0B2E55)">
|
||||
<rect x="492" y="553" width="50" height="50" rx="4"/><rect x="559" y="553" width="50" height="50" rx="4"/>
|
||||
<rect x="492" y="617" width="50" height="50" rx="4"/><rect x="559" y="617" width="50" height="50" rx="4"/>
|
||||
</g>
|
||||
<path fill="var(--brand-teal, #0286A2)" d="M30 858 C140 750 280 672 400 670 C520 668 640 730 760 790 C870 845 980 845 1070 812 C990 872 880 888 780 868 C660 845 560 780 430 748 C300 718 160 760 30 858 Z"/>
|
||||
<path fill="var(--brand-wave, #6DBFC2)" d="M62 865 C160 790 270 760 360 762 C470 764 560 815 650 860 C710 890 760 905 792 902 C740 920 690 925 630 912 C560 895 470 840 380 812 C280 785 170 812 62 865 Z"/>
|
||||
</g>
|
||||
<text x="724" y="760" text-anchor="middle" font-family="'Cormorant Garamond', 'Libre Caslon Text', Georgia, 'Times New Roman', serif" font-size="215" font-weight="600" textLength="1300" lengthAdjust="spacingAndGlyphs" fill="var(--brand-navy, #0B2E55)">FeWo Stommer</text>
|
||||
<rect x="74" y="842" width="96" height="8" rx="4" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<rect x="1278" y="842" width="96" height="8" rx="4" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<text x="724" y="878" text-anchor="middle" font-family="'Figtree', 'Helvetica Neue', Arial, sans-serif" font-size="46" font-weight="500" textLength="1020" lengthAdjust="spacing" fill="var(--brand-navy, #0B2E55)">FERIENWOHNUNG IN KÜHLUNGSBORN</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="20 390 1220 540" role="img" aria-label="FeWo Stommer">
|
||||
<title>FeWo Stommer</title>
|
||||
<defs><clipPath id="sun-horizon"><rect x="860" y="500" width="380" height="262"/></clipPath></defs>
|
||||
<circle cx="1046" cy="708" r="140" fill="var(--brand-sun, #F2C27A)" clip-path="url(#sun-horizon)"/>
|
||||
<rect x="930" y="776" width="296" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<rect x="1048" y="832" width="152" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
|
||||
<path fill="var(--brand-navy, #0B2E55)" d="M118 716 L553 412 L750 549 L750 485 L826 485 L826 602 C905 685 990 748 1102 760 C1060 772 1000 774 960 768 C880 754 820 706 760 652 L553 476 L132 724 C124 728 114 722 118 716 Z"/>
|
||||
<g fill="var(--brand-navy, #0B2E55)">
|
||||
<rect x="492" y="553" width="50" height="50" rx="4"/><rect x="559" y="553" width="50" height="50" rx="4"/>
|
||||
<rect x="492" y="617" width="50" height="50" rx="4"/><rect x="559" y="617" width="50" height="50" rx="4"/>
|
||||
</g>
|
||||
<path fill="var(--brand-teal, #0286A2)" d="M30 858 C140 750 280 672 400 670 C520 668 640 730 760 790 C870 845 980 845 1070 812 C990 872 880 888 780 868 C660 845 560 780 430 748 C300 718 160 760 30 858 Z"/>
|
||||
<path fill="var(--brand-wave, #6DBFC2)" d="M62 865 C160 790 270 760 360 762 C470 764 560 815 650 860 C710 890 760 905 792 902 C740 920 690 925 630 912 C560 895 470 840 380 812 C280 785 170 812 62 865 Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 220" preserveAspectRatio="xMidYMid meet" role="presentation" aria-hidden="true">
|
||||
<defs><clipPath id="wave-divider-horizon"><rect x="1020" y="40" width="120" height="82"/></clipPath></defs>
|
||||
<circle cx="1080" cy="120" r="46" fill="var(--brand-sun, #F2C27A)" clip-path="url(#wave-divider-horizon)"/>
|
||||
<path fill="var(--brand-sun, #F2C27A)" d="M1030 126 H1130 A3 3 0 0 1 1130 132 H1030 A3 3 0 0 1 1030 126 Z M1052 142 H1108 A3 3 0 0 1 1108 148 H1052 A3 3 0 0 1 1052 142 Z"/>
|
||||
<path fill="var(--brand-navy, #0B2E55)" d="M948 52 C958 44 972 44 982 54 C990 44 1004 40 1018 44 C1004 46 994 54 986 66 C980 58 966 50 948 52 Z M900 74 C906 69 914 69 920 75 C925 69 933 67 941 69 C933 71 927 76 922 83 C918 78 910 73 900 74 Z"/>
|
||||
<path fill="var(--brand-teal, #0286A2)" d="M10 170 C120 120 220 104 330 120 C440 136 520 164 640 140 C760 116 820 80 900 82 C990 84 1040 130 1120 156 C1220 188 1380 170 1590 120 C1420 186 1250 214 1110 186 C1020 168 960 120 890 112 C810 104 760 150 650 168 C530 188 440 160 330 144 C220 130 120 136 10 170 Z"/>
|
||||
<path fill="var(--brand-wave, #6DBFC2)" d="M40 178 C140 150 240 146 330 160 C410 172 470 184 540 176 C470 192 400 192 330 182 C240 170 140 168 40 178 Z M580 172 C680 150 760 120 860 118 C960 116 1020 160 1120 188 C1040 178 980 150 900 140 C820 130 720 160 580 172 Z M1260 190 C1360 184 1460 166 1560 140 C1480 176 1380 196 1260 190 Z"/>
|
||||
<path fill="var(--brand-navy, #0B2E55)" d="M870 84 C930 80 980 104 1020 130 C1050 150 1070 160 1100 168 C1060 166 1030 150 1000 130 C960 104 920 90 870 84 Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -13,6 +13,16 @@
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// Strato: the domain points at the deployment folder and .htaccess forwards to releases/<version>/public,
|
||||
// and the web server then reports the rewritten path in REQUEST_URI/SCRIPT_NAME. Laravel would see
|
||||
// "/releases/…/public/angebot/2" instead of "/angebot/2" (signed links would fail). The site is always
|
||||
// served from the domain root, so the internal prefix is removed here.
|
||||
if (preg_match('~^/(?:releases/[^/?]+|current)/public(?=[/?]|$)~', $_SERVER['REQUEST_URI'] ?? '', $internalPrefix)) {
|
||||
$path = substr($_SERVER['REQUEST_URI'], strlen($internalPrefix[0]));
|
||||
$_SERVER['REQUEST_URI'] = str_starts_with($path, '/') ? $path : '/'.$path;
|
||||
$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = '/index.php';
|
||||
}
|
||||
|
||||
// Bootstrap Laravel and handle the request...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
@@ -30,6 +30,15 @@ @theme inline {
|
||||
--font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif;
|
||||
}
|
||||
|
||||
/* Brand graphics (public/brand, inlined via partials/brand): navy follows the text colour, so the logo stays
|
||||
visible in dark appearances; teal, light wave and sun keep the brand colours unless a theme overrides them. */
|
||||
:root {
|
||||
--brand-navy: var(--ink);
|
||||
--brand-teal: #0286a2;
|
||||
--brand-wave: #6dbfc2;
|
||||
--brand-sun: #f2c27a;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
<meta property="og:image" content="{{ $ogImage }}">
|
||||
@endisset
|
||||
<link rel="canonical" href="{{ url()->current() }}">
|
||||
<link rel="icon" href="{{ asset('brand/favicon.svg') }}" type="image/svg+xml">
|
||||
<link rel="apple-touch-icon" href="{{ asset('brand/apple-touch-icon.png') }}">
|
||||
@if ($theme->isPreview || ! app()->isProduction())
|
||||
<meta name="robots" content="noindex">
|
||||
@endif
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{{--
|
||||
Inline brand graphic from public/brand/<name>.svg (mark, logo, wave-divider, icon-apartment, icon-sea,
|
||||
icon-terrace, icon-location). Inline, so the colours follow the CSS variables --brand-navy/-teal/-wave/-sun
|
||||
(theme-base.css maps navy to the text colour, so it stays visible in dark appearances).
|
||||
Variables: $name, $class (optional), $label (optional; without it the graphic is decorative).
|
||||
--}}
|
||||
@php
|
||||
static $brandSvgs = [];
|
||||
$brandSvgs[$name] ??= is_file(public_path("brand/{$name}.svg")) ? file_get_contents(public_path("brand/{$name}.svg")) : '';
|
||||
$brandUid = 'b'.\Illuminate\Support\Str::lower(\Illuminate\Support\Str::random(6));
|
||||
$brandSvg = preg_replace(['/\s(role|aria-label)="[^"]*"/', '/<title>.*?<\/title>/s'], '', $brandSvgs[$name]);
|
||||
$brandSvg = preg_replace(['/id="([^"]+)"/', '/url\(#([^)]+)\)/'], ['id="$1-'.$brandUid.'"', 'url(#$1-'.$brandUid.')'], $brandSvg);
|
||||
$brandAttributes = 'class="'.e($class ?? '').'" '.(isset($label) ? 'role="img" aria-label="'.e($label).'"' : 'aria-hidden="true" focusable="false"');
|
||||
$brandSvg = preg_replace('/<svg\s/', '<svg '.$brandAttributes.' ', $brandSvg, 1);
|
||||
@endphp
|
||||
{!! $brandSvg !!}
|
||||
@@ -1,7 +1,10 @@
|
||||
<footer class="mt-8 border-t border-line">
|
||||
<div class="mt-16 px-4" aria-hidden="true">
|
||||
@include('theme::partials.brand', ['name' => 'wave-divider', 'class' => 'mx-auto block h-auto w-full max-w-4xl'])
|
||||
</div>
|
||||
<footer class="border-t border-line">
|
||||
<div class="mx-auto flex max-w-7xl flex-wrap justify-between gap-x-16 gap-y-6 px-4 py-14 text-sm text-muted sm:px-8">
|
||||
<div>
|
||||
<span class="font-display text-2xl text-ink">{{ $theme->site->name }}</span><br>
|
||||
<span class="flex items-center gap-2 font-display text-2xl text-ink">@include('theme::partials.brand', ['name' => 'mark', 'class' => 'h-7 w-auto']){{ $theme->site->name }}</span>
|
||||
{{ $theme->property()?->address }}
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<header class="relative z-20">
|
||||
<div class="mx-auto flex max-w-7xl items-center justify-between gap-6 px-4 py-5 sm:px-8">
|
||||
<a href="{{ route('home') }}" class="flex flex-col leading-tight">
|
||||
<span class="font-display text-[1.875rem] font-semibold tracking-wide">{{ str($theme->site->name)->afterLast(' ') }}</span>
|
||||
<span class="text-[11px] tracking-[0.24em] text-muted uppercase">Ferienwohnung · Kühlungsborn</span>
|
||||
<a href="{{ route('home') }}" class="flex items-center gap-3 leading-tight" aria-label="{{ $theme->site->name }} – Startseite">
|
||||
@include('theme::partials.brand', ['name' => 'mark', 'class' => 'h-11 w-auto shrink-0 sm:h-12'])
|
||||
<span class="flex flex-col">
|
||||
<span class="font-display text-[1.875rem] font-semibold tracking-wide">{{ str($theme->site->name)->afterLast(' ') }}</span>
|
||||
<span class="text-[11px] tracking-[0.24em] text-muted uppercase">Ferienwohnung · Kühlungsborn</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav aria-label="Hauptnavigation" class="hidden lg:block">
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
decoding="async"
|
||||
class="{{ $class ?? '' }}">
|
||||
@else
|
||||
<div class="{{ $class ?? '' }} flex items-center justify-center bg-line/60 text-sm text-muted" role="img" aria-label="Bild folgt">Bild folgt</div>
|
||||
<div class="{{ $class ?? '' }} flex items-center justify-center bg-surface" role="img" aria-label="Bild folgt">
|
||||
<img src="{{ asset('brand/coastal-illustration-1200.webp') }}" alt="" loading="lazy" decoding="async" class="h-full max-h-full w-full object-contain p-6 opacity-90">
|
||||
</div>
|
||||
@endif
|
||||
@@ -2,16 +2,16 @@
|
||||
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display mb-8">{{ $heading }}</h2>@endif
|
||||
<ul class="reveal grid grid-cols-2 gap-6 border-y border-line lg:grid-cols-4">
|
||||
@if ($property?->size_sqm)
|
||||
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">{{ $property->size_sqm }} m²</span><span class="text-sm text-muted">Wohnfläche</span></li>
|
||||
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-apartment', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">{{ $property->size_sqm }} m²</span><span class="text-sm text-muted">Wohnfläche</span></li>
|
||||
@endif
|
||||
@if ($property)
|
||||
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">1–{{ $property->max_guests }}</span><span class="text-sm text-muted">Gäste</span></li>
|
||||
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-terrace', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">1–{{ $property->max_guests }}</span><span class="text-sm text-muted">Gäste</span></li>
|
||||
@endif
|
||||
@if ($fromPrice)
|
||||
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">ab {{ \App\Support\Money::format((int) $fromPrice) }}</span><span class="text-sm text-muted">pro Nacht</span></li>
|
||||
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-sea', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">ab {{ \App\Support\Money::format((int) $fromPrice) }}</span><span class="text-sm text-muted">pro Nacht</span></li>
|
||||
@endif
|
||||
@if ($highlights->isNotEmpty())
|
||||
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">inklusive</span><span class="text-sm text-muted">{{ $highlights->take(3)->implode(', ') }}</span></li>
|
||||
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-location', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">inklusive</span><span class="text-sm text-muted">{{ $highlights->take(3)->implode(', ') }}</span></li>
|
||||
@endif
|
||||
</ul>
|
||||
</section>
|
||||
@@ -5,8 +5,10 @@
|
||||
<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>
|
||||
@if ($text)<div class="mt-6 text-band-muted [&_a]:underline [&_p]:mb-4">{{ $text }}</div>@endif
|
||||
@if ($address)
|
||||
<p class="mt-6 text-band-muted">{{ $address }}<br>
|
||||
<a href="{{ $mapUrl }}" class="font-semibold text-band-ink underline" rel="noopener" target="_blank">Auf der Karte ansehen</a>
|
||||
<p class="mt-6 flex items-start gap-3 text-band-muted [--brand-navy:var(--band-ink)]">
|
||||
@include('theme::partials.brand', ['name' => 'icon-location', 'class' => 'size-10 shrink-0'])
|
||||
<span>{{ $address }}<br>
|
||||
<a href="{{ $mapUrl }}" class="font-semibold text-band-ink underline" rel="noopener" target="_blank">Auf der Karte ansehen</a></span>
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
@@ -215,10 +215,10 @@ class="mt-1 w-full rounded-lg border-line">
|
||||
@disabled(! $pricing['quote'])
|
||||
wire:loading.attr="disabled"
|
||||
class="mt-5 w-full rounded-xl bg-accent px-4 py-3 font-semibold text-accent-ink transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50">
|
||||
<span wire:loading.remove wire:target="submit">Termin vormerken & Angebot erhalten</span>
|
||||
<span wire:loading.remove wire:target="submit">Unverbindlich anfragen</span>
|
||||
<span wire:loading wire:target="submit">Wird gesendet …</span>
|
||||
</button>
|
||||
<p class="mt-2 text-center text-xs text-muted">Kostenlos und unverbindlich. Verbindlich wird die Buchung erst mit unserer Bestätigung.</p>
|
||||
<p class="mt-2 text-center text-xs text-muted">Kostenlos und unverbindlich. Wir halten den Termin für Sie frei und senden Ihnen ein Angebot per E-Mail – verbindlich wird die Buchung erst, wenn Sie es annehmen.</p>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
Guten Tag {{ $booking->guest->full_name }},
|
||||
|
||||
@if ($booking->accepted_at)
|
||||
vielen Dank – Sie haben unser Angebot am {{ $booking->accepted_at->format('d.m.Y') }} um {{ $booking->accepted_at->format('H:i') }} Uhr angenommen. Damit ist Ihre Buchung der **{{ $booking->property->name }}** verbindlich.
|
||||
@else
|
||||
wir freuen uns, Ihre Buchung der **{{ $booking->property->name }}** verbindlich zu bestätigen.
|
||||
@endif
|
||||
|
||||
**Anreise:** {{ $booking->arrival->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_in_time) ab {{ substr($booking->property->check_in_time, 0, 5) }} Uhr @endif<br>
|
||||
**Abreise:** {{ $booking->departure->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_out_time) bis {{ substr($booking->property->check_out_time, 0, 5) }} Uhr @endif<br>
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
@endif
|
||||
|
||||
<x-mail::button :url="\App\Filament\Resources\Bookings\BookingResource::getUrl('view', ['record' => $booking])">
|
||||
Anfrage bestätigen oder ablehnen
|
||||
Angebot senden oder Anfrage ablehnen
|
||||
</x-mail::button>
|
||||
</x-mail::message>
|
||||
@@ -0,0 +1,15 @@
|
||||
<x-mail::message>
|
||||
@if ($accepted)
|
||||
# Angebot angenommen
|
||||
|
||||
{{ $booking->guest->full_name }} hat das Angebot **{{ $booking->reference }}** ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}, {{ \App\Support\Money::format($booking->total) }}) am {{ $booking->accepted_at?->format('d.m.Y') }} um {{ $booking->accepted_at?->format('H:i') }} Uhr angenommen. Die Buchung ist verbindlich; Bestätigung und Mietvertrag wurden an den Gast gesendet.
|
||||
@else
|
||||
# Angebot abgelehnt
|
||||
|
||||
{{ $booking->guest->full_name }} hat das Angebot **{{ $booking->reference }}** ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}) abgelehnt. Der Zeitraum ist im Kalender wieder frei.
|
||||
@endif
|
||||
|
||||
<x-mail::button :url="\App\Filament\Resources\Bookings\BookingResource::getUrl('view', ['record' => $booking])">
|
||||
Buchung öffnen
|
||||
</x-mail::button>
|
||||
</x-mail::message>
|
||||
@@ -0,0 +1,31 @@
|
||||
<x-mail::message>
|
||||
# Ihr Angebot für die {{ $booking->property->name }}
|
||||
|
||||
Guten Tag {{ $booking->guest->full_name }},
|
||||
|
||||
{{ \App\Support\Content::get('offer.intro') }}
|
||||
|
||||
**Anreise:** {{ $booking->arrival->translatedFormat('l, d.m.Y') }}<br>
|
||||
**Abreise:** {{ $booking->departure->translatedFormat('l, d.m.Y') }}<br>
|
||||
**Personen:** {{ $booking->guests }}<br>
|
||||
**Angebotsnummer:** {{ $booking->reference }}
|
||||
|
||||
@include('mail.partials.quote')
|
||||
|
||||
@if ($booking->offer_message)
|
||||
{{ $booking->offer_message }}
|
||||
@endif
|
||||
|
||||
Das Angebot gilt **bis {{ $booking->hold_expires_at->format('d.m.Y, H:i') }} Uhr**; bis dahin halten wir den Zeitraum für Sie frei.
|
||||
|
||||
<x-mail::button :url="$offerUrl">
|
||||
Angebot ansehen und annehmen
|
||||
</x-mail::button>
|
||||
|
||||
Auf der Angebotsseite können Sie das Angebot annehmen oder ablehnen. Erst mit Ihrer Annahme wird die Buchung verbindlich; Sie erhalten dann sofort die Buchungsbestätigung mit dem Mietvertrag.
|
||||
|
||||
Bei Fragen antworten Sie einfach auf diese E-Mail oder rufen Sie uns an: {{ config('fewo.owner.phone') }}
|
||||
|
||||
Herzliche Grüße<br>
|
||||
{{ config('fewo.owner.name') }}
|
||||
</x-mail::message>
|
||||
@@ -1,9 +1,9 @@
|
||||
<x-mail::message>
|
||||
# Vormerkung abgelaufen
|
||||
# {{ $booking->offer_version > 0 ? 'Angebot abgelaufen' : 'Vormerkung abgelaufen' }}
|
||||
|
||||
Die Anfrage **{{ $booking->reference }}** von {{ $booking->guest->full_name }} ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}) wurde nicht rechtzeitig bestätigt. Der Zeitraum ist im Kalender wieder frei.
|
||||
Die Anfrage **{{ $booking->reference }}** von {{ $booking->guest->full_name }} ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}) {{ $booking->offer_version > 0 ? 'wurde vom Gast nicht rechtzeitig angenommen' : 'wurde nicht rechtzeitig beantwortet' }}. Der Zeitraum ist im Kalender wieder frei.
|
||||
|
||||
Sie können die Anfrage weiterhin bestätigen, sofern der Zeitraum noch frei ist.
|
||||
Sie können weiterhin ein (neues) Angebot senden, sofern der Zeitraum noch frei ist.
|
||||
|
||||
<x-mail::button :url="\App\Filament\Resources\Bookings\BookingResource::getUrl('view', ['record' => $booking])">
|
||||
Anfrage öffnen
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
|
||||
Guten Tag {{ $booking->guest->full_name }},
|
||||
|
||||
wir haben Ihre Anfrage für die **{{ $booking->property->name }}** erhalten und den Zeitraum für Sie **bis {{ $booking->hold_expires_at->format('d.m.Y, H:i') }} Uhr vorgemerkt**.
|
||||
wir haben Ihre unverbindliche Anfrage für die **{{ $booking->property->name }}** erhalten und den Zeitraum für Sie **bis {{ $booking->hold_expires_at->format('d.m.Y, H:i') }} Uhr vorgemerkt**.
|
||||
|
||||
**Anreise:** {{ $booking->arrival->translatedFormat('l, d.m.Y') }}<br>
|
||||
**Abreise:** {{ $booking->departure->translatedFormat('l, d.m.Y') }}<br>
|
||||
**Personen:** {{ $booking->guests }}<br>
|
||||
**Anfragenummer:** {{ $booking->reference }}
|
||||
|
||||
**Voraussichtlicher Preis laut Preisliste:**
|
||||
|
||||
@include('mail.partials.quote')
|
||||
|
||||
Wir prüfen Ihre Anfrage und melden uns in Kürze mit der Buchungsbestätigung. Erst mit unserer Bestätigung ist die Buchung verbindlich.
|
||||
Wir prüfen Ihre Anfrage und senden Ihnen in Kürze **unser Angebot** per E-Mail. Verbindlich wird die Buchung erst, wenn Sie dieses Angebot annehmen.
|
||||
|
||||
@if ($booking->message)
|
||||
**Ihre Nachricht:**<br>
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
@php($money = fn (int $cents): string => \App\Support\Money::format($cents))
|
||||
@extends('theme::layouts.app', ['title' => 'Ihr Angebot'])
|
||||
|
||||
@push('head')
|
||||
<meta name="robots" content="noindex">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="mx-auto max-w-3xl px-4 py-14 sm:px-8">
|
||||
<p class="eyebrow">Angebot {{ $booking->reference }}</p>
|
||||
<h1 class="heading-display">{{ $booking->property->name }}</h1>
|
||||
<p class="mt-2 text-muted">für {{ $booking->guest->full_name }}</p>
|
||||
|
||||
@if (session('offer.success'))
|
||||
<div class="mt-8 rounded border border-accent bg-surface p-5" role="status">{{ session('offer.success') }}</div>
|
||||
@endif
|
||||
@if (session('offer.error') || $problem)
|
||||
<div class="mt-8 rounded border border-line bg-surface p-5" role="alert">{{ session('offer.error') ?? $problem }}</div>
|
||||
@endif
|
||||
@if (! session('offer.success') && ! $problem)
|
||||
@if ($booking->status === \App\Enums\BookingStatus::Declined)
|
||||
<div class="mt-8 rounded border border-line bg-surface p-5">Dieses Angebot wurde abgelehnt.</div>
|
||||
@elseif (in_array($booking->status, \App\Enums\BookingStatus::occupying(), true))
|
||||
<div class="mt-8 rounded border border-accent bg-surface p-5">Dieses Angebot wurde @if ($booking->accepted_at) am {{ $booking->accepted_at->format('d.m.Y') }} @endif angenommen – Ihre Buchung ist verbindlich.</div>
|
||||
@elseif ($booking->status === \App\Enums\BookingStatus::Expired)
|
||||
<div class="mt-8 rounded border border-line bg-surface p-5">{{ \App\Exceptions\ReservationException::offerExpired()->getMessage() }}</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
<section class="mt-10 rounded bg-surface p-7" aria-labelledby="offer-stay">
|
||||
<h2 id="offer-stay" class="font-display text-2xl">Ihr Aufenthalt</h2>
|
||||
<dl class="mt-4 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1">
|
||||
<dt class="text-muted">Anreise</dt><dd>{{ $booking->arrival->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_in_time) ab {{ substr($booking->property->check_in_time, 0, 5) }} Uhr @endif</dd>
|
||||
<dt class="text-muted">Abreise</dt><dd>{{ $booking->departure->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_out_time) bis {{ substr($booking->property->check_out_time, 0, 5) }} Uhr @endif</dd>
|
||||
<dt class="text-muted">Nächte</dt><dd>{{ $booking->nights() }}</dd>
|
||||
<dt class="text-muted">Personen</dt><dd>{{ $booking->guests }}</dd>
|
||||
@if ($booking->status === \App\Enums\BookingStatus::OfferSent)
|
||||
<dt class="text-muted">Gültig bis</dt><dd>{{ $booking->hold_expires_at?->format('d.m.Y, H:i') }} Uhr</dd>
|
||||
@endif
|
||||
</dl>
|
||||
|
||||
<h2 class="mt-8 font-display text-2xl">Preis</h2>
|
||||
<table class="mt-3 w-full">
|
||||
@foreach ($booking->quote['lines'] ?? [] as $line)
|
||||
<tr class="border-b border-line"><td class="py-2">{{ $line['label'] }}</td><td class="py-2 text-right whitespace-nowrap">{{ $money($line['amount']) }}</td></tr>
|
||||
@endforeach
|
||||
<tr class="font-semibold"><td class="pt-3">Gesamtpreis</td><td class="pt-3 text-right">{{ $money($booking->total) }}</td></tr>
|
||||
</table>
|
||||
<p class="mt-3 text-sm text-muted">
|
||||
@if ($booking->balance_due_on->lessThanOrEqualTo(today()->addDays(config('fewo.deposit_due_days'))))
|
||||
Da die Anreise kurz bevorsteht, ist der Gesamtbetrag innerhalb von {{ config('fewo.deposit_due_days') }} Tagen nach Buchung fällig.
|
||||
@else
|
||||
Anzahlung {{ $money($booking->deposit) }} innerhalb von {{ config('fewo.deposit_due_days') }} Tagen nach Buchung,
|
||||
Restbetrag {{ $money($booking->total - $booking->deposit) }} bis {{ $booking->balance_due_on->format('d.m.Y') }}.
|
||||
@endif
|
||||
Die Kurtaxe ist nicht enthalten und wird vor Ort entrichtet.
|
||||
</p>
|
||||
|
||||
@if ($booking->offer_message)
|
||||
<p class="mt-6 rounded border border-line p-4">{{ $booking->offer_message }}</p>
|
||||
@endif
|
||||
|
||||
<h2 class="mt-8 font-display text-2xl">Bedingungen</h2>
|
||||
<div class="prose-theme mt-3">{{ \App\Support\Content::html('contract.terms') }}</div>
|
||||
@if (\App\Support\Content::get('stay.cancellation'))
|
||||
<h3 class="mt-6 font-semibold">Rücktritt / Stornierung</h3>
|
||||
<div class="prose-theme mt-2">{{ \App\Support\Content::html('stay.cancellation') }}</div>
|
||||
@endif
|
||||
<p class="mt-4 text-sm text-muted">Den vollständigen Vertragsentwurf finden Sie als PDF im Anhang unserer E-Mail.</p>
|
||||
</section>
|
||||
|
||||
@if ($canAnswer)
|
||||
<section class="mt-8 rounded bg-surface p-7" aria-label="Angebot annehmen oder ablehnen">
|
||||
<form method="post" action="{{ $acceptUrl }}">
|
||||
@csrf
|
||||
<label class="flex items-start gap-3">
|
||||
<input type="checkbox" name="terms" value="1" required class="mt-1">
|
||||
<span>Ich habe die Angaben und Bedingungen dieses Angebots gelesen.</span>
|
||||
</label>
|
||||
@error('terms')<p class="mt-1 text-sm" role="alert">{{ $message }}</p>@enderror
|
||||
<p class="mt-4 text-sm text-muted">{{ \App\Support\Content::get('offer.accept_note') }}</p>
|
||||
<button type="submit" class="btn-accent mt-4 w-full sm:w-auto">{{ \App\Support\Content::get('offer.accept_button') }}</button>
|
||||
</form>
|
||||
<form method="post" action="{{ $rejectUrl }}" class="mt-6 border-t border-line pt-4">
|
||||
@csrf
|
||||
<button type="submit" class="text-sm text-muted underline hover:text-ink">Angebot ablehnen</button>
|
||||
</form>
|
||||
</section>
|
||||
@endif
|
||||
|
||||
<p class="mt-8 text-sm text-muted">Fragen? {{ config('fewo.owner.name') }} · {{ config('fewo.owner.phone') }} · <a class="underline" href="mailto:{{ config('fewo.owner.email') }}">{{ config('fewo.owner.email') }}</a></p>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -25,8 +25,14 @@
|
||||
<body>
|
||||
<div class="footer">{{ config('fewo.owner.name') }} · {{ config('fewo.owner.street') }} · {{ config('fewo.owner.city') }} · {{ config('fewo.owner.phone') }} · {{ config('fewo.owner.email') }}</div>
|
||||
|
||||
<h1>Mietvertrag Ferienwohnung</h1>
|
||||
<p class="muted">Buchungsnummer {{ $booking->reference }} · ausgestellt am {{ ($booking->confirmed_at ?? now())->format('d.m.Y') }}</p>
|
||||
@if ($draft ?? false)
|
||||
<h1>Angebot und Mietvertrag (Entwurf)</h1>
|
||||
<p class="muted">Angebot {{ $booking->reference }} · Version {{ $booking->offer_version }} · erstellt am {{ ($booking->offer_sent_at ?? now())->format('d.m.Y') }} · gültig bis {{ $booking->hold_expires_at?->format('d.m.Y, H:i') }} Uhr</p>
|
||||
<p><strong>{{ \App\Support\Content::get('offer.contract_note') }}</strong></p>
|
||||
@else
|
||||
<h1>Mietvertrag Ferienwohnung</h1>
|
||||
<p class="muted">Buchungsnummer {{ $booking->reference }} · ausgestellt am {{ ($booking->confirmed_at ?? now())->format('d.m.Y') }}@if ($booking->accepted_at) · Angebot angenommen am {{ $booking->accepted_at->format('d.m.Y, H:i') }} Uhr @endif</p>
|
||||
@endif
|
||||
|
||||
<p>{{ \App\Support\Content::get('contract.intro') }}</p>
|
||||
|
||||
|
||||
@@ -35,5 +35,10 @@
|
||||
|
||||
Schedule::call(fn (AnonymizeGuests $anonymizeGuests) => $anonymizeGuests->handle())
|
||||
->name('guests:anonymize')
|
||||
->monthlyOn(1, '03:00')
|
||||
->dailyAt('03:00')
|
||||
->withoutOverlapping();
|
||||
|
||||
Schedule::command('backup:database')
|
||||
->name('backup:database')
|
||||
->dailyAt('02:30')
|
||||
->withoutOverlapping();
|
||||
@@ -2,15 +2,20 @@
|
||||
|
||||
use App\Http\Controllers\ChannelController;
|
||||
use App\Http\Controllers\MarketingConsentController;
|
||||
use App\Http\Controllers\OfferController;
|
||||
use App\Http\Controllers\PageController;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::middleware('signed')->group(function () {
|
||||
Route::get('/bewertung/{booking}', fn (Booking $booking) => view('review', ['booking' => $booking]))->name('reviews.create');
|
||||
Route::get('/bewertung/{booking}', fn (Booking $booking) => view('review', ['booking' => $booking]))->name('reviews.create')->middleware('throttle:30,1');
|
||||
Route::get('/angebote/bestaetigen/{guest}', [MarketingConsentController::class, 'confirm'])->name('marketing.confirm');
|
||||
Route::get('/angebote/abmelden/{guest}', [MarketingConsentController::class, 'unsubscribe'])->name('marketing.unsubscribe');
|
||||
// Booking path 1: the guest's offer page (docs/KONZEPT.md §6a)
|
||||
Route::get('/angebot/{booking}', [OfferController::class, 'show'])->name('offers.show')->middleware('throttle:30,1');
|
||||
Route::post('/angebot/{booking}/annehmen', [OfferController::class, 'accept'])->name('offers.accept')->middleware('throttle:10,1');
|
||||
Route::post('/angebot/{booking}/ablehnen', [OfferController::class, 'reject'])->name('offers.reject')->middleware('throttle:10,1');
|
||||
});
|
||||
|
||||
Route::get('/kalender/{token}.ics', [ChannelController::class, 'feed'])->name('channels.feed')->middleware('throttle:60,1');
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Fetches a fresh backup from the server to a local folder (e.g. the NAS) – nothing is changed on the server
|
||||
# except creating the new database dump.
|
||||
#
|
||||
# scripts/backup-pull.sh <environment> <target folder>
|
||||
#
|
||||
# Copies: the newest database dump (backup:database) and the uploaded files (photos, contracts) from shared/storage/app.
|
||||
# Uses the same settings as scripts/deploy.sh (scripts/deploy.<environment>.env).
|
||||
set -euo pipefail
|
||||
|
||||
ENVIRONMENT="${1:?Umgebung angeben, z. B. production}"
|
||||
TARGET="${2:?Zielordner angeben, z. B. /volume1/backup/fewo}"
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "$ROOT/scripts/deploy.$ENVIRONMENT.env"
|
||||
DEPLOY_SSH_KEY="${DEPLOY_SSH_KEY/#\~/$HOME}"
|
||||
SSH=(ssh -p "${DEPLOY_PORT:-22}" -o BatchMode=yes ${DEPLOY_SSH_KEY:+-i "$DEPLOY_SSH_KEY"} "${DEPLOY_USER:+$DEPLOY_USER@}$DEPLOY_HOST")
|
||||
STAMP="$(date +%Y%m%d-%H%M%S)"
|
||||
mkdir -p "$TARGET/$STAMP"
|
||||
|
||||
echo "▶ Datenbank sichern"
|
||||
"${SSH[@]}" "cd '$DEPLOY_PATH/current' && '${DEPLOY_PHP:-/opt/RZphp84/bin/php-cli}' artisan backup:database --no-interaction"
|
||||
LATEST="$("${SSH[@]}" "ls -1 '$DEPLOY_PATH/shared/storage/app/private/backups/' | sort | tail -n 1")"
|
||||
"${SSH[@]}" "cat '$DEPLOY_PATH/shared/storage/app/private/backups/$LATEST'" > "$TARGET/$STAMP/$LATEST"
|
||||
|
||||
echo "▶ Dateien sichern (Fotos, Verträge)"
|
||||
"${SSH[@]}" "tar -czf - -C '$DEPLOY_PATH/shared/storage/app' --exclude='private/backups' ." > "$TARGET/$STAMP/files.tar.gz"
|
||||
|
||||
echo "✓ Gesichert nach $TARGET/$STAMP ($(du -sh "$TARGET/$STAMP" | cut -f1))"
|
||||
|
After Width: | Height: | Size: 662 KiB |
|
After Width: | Height: | Size: 629 KiB |
|
After Width: | Height: | Size: 592 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 769 KiB |
@@ -5,6 +5,7 @@
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Pages\PricesAndOffers;
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use App\Filament\Resources\BlockedPeriods\Pages\ManageBlockedPeriods;
|
||||
use App\Filament\Resources\Properties\PropertyResource;
|
||||
@@ -12,6 +13,7 @@
|
||||
use App\Filament\Resources\Users\UserResource;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Property;
|
||||
use App\Models\Season;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\Testing\TestAction;
|
||||
@@ -63,6 +65,23 @@ public function test_every_admin_resource_and_page_follows_the_admin_mode(): voi
|
||||
}
|
||||
}
|
||||
|
||||
public function test_prices_and_offers_page_bundles_seasons_offers_and_extras_in_the_simple_mode(): void
|
||||
{
|
||||
$property = Property::factory()->create();
|
||||
Season::factory()->for($property)->create(['name' => 'Hochsaison Test', 'starts_on' => now()->addMonth()->toDateString(), 'ends_on' => now()->addMonths(2)->toDateString()]);
|
||||
$this->actingAs(User::factory()->create(['admin_mode' => AdminMode::Simple]));
|
||||
|
||||
$this->get(PricesAndOffers::getUrl())
|
||||
->assertOk()
|
||||
->assertSee('Saisons & Preise', false)
|
||||
->assertSee('Sonderangebote & Rabattcodes', false)
|
||||
->assertSee('Hochsaison Test');
|
||||
$this->get(Dashboard::getUrl())->assertSee('Preise & Angebote', false)->assertSee('Bilder')->assertDontSee('Erscheinungsbilder');
|
||||
|
||||
$this->actingAs(User::factory()->role(UserRole::Content)->create());
|
||||
$this->get(PricesAndOffers::getUrl())->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_administrators_default_to_the_expert_mode(): void
|
||||
{
|
||||
$this->assertSame(AdminMode::Expert, User::factory()->create()->adminMode());
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||