Zahlungsaufgaben, Freigabe-/Storno-Link, Vertragsvorlagen, Anreise-Mail
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m36s

- Zahlungen werden nicht mehr automatisch angemahnt: faellige Anzahlung/Restzahlung werden Aufgaben
  (Zahlungen & Wuensche, Tages-/Wochenuebersicht); Mail nur per Klick; je Portal und Buchungstyp abschaltbar
- Freigabe-Link in der Eingangsbestaetigung, Storno-Link in der Buchungsbestaetigung; je Wohnung
  Wunsch / sofort / sofort bis Frist; Stornowuensche und Kosten bleiben Aufgabe des Gastgebers
- Vertragsvorlagen mit Versionen (je Angebot, Portal oder Wohnung waehlbar), benutzte Versionen gesperrt;
  Angebot und finaler Vertrag als unveraenderliche PDF mit SHA-256, Vertrag wird nie neu geschrieben
- Anreise-Mail je Wohnung einstellbar (Standard 3 Tage), neue Textfelder Schluessel/Parken/Ankunftstag

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-10-30 12:46:29 +01:00
1 parent eafab8a2cb
commit a73b164ea1
51 files changed
+1807 -52

No files matched your search

+17 -2
View File
@@ -12,6 +12,7 @@
use App\Filament\Resources\Bookings\BookingResource;
use App\Mail\OfferMade;
use App\Models\Booking;
use App\Models\ContractTemplate;
use App\Pricing\PriceCalculator;
use App\Pricing\PriceQuote;
use App\Pricing\QuoteException;
@@ -42,7 +43,7 @@ public function __construct(
) {}
/**
* @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
* @param array{arrival?: string, departure?: string, guests?: int, promo_code?: ?string, price_adjustment?: ?int, price_adjustment_label?: ?string, valid_until?: ?string, offer_message?: ?string, contract_template_id?: int|string|null, guest?: array<string, ?string>} $changes
*
* @throws QuoteException
* @throws ReservationException
@@ -97,7 +98,7 @@ public function handle(Booking $booking, array $changes = [], bool $sendMail = t
'offer_version' => $booking->offer_version + 1,
'offer_sent_at' => now(),
'offer_message' => $changes['offer_message'] ?? null,
'offer_terms' => OfferTerms::capture(),
'offer_terms' => OfferTerms::capture($this->templateFor($booking, $changes)),
]);
$booking->refresh();
$booking->update(['offer_hash' => OfferTerms::hash($booking)]);
@@ -113,6 +114,20 @@ public function handle(Booking $booking, array $changes = [], bool $sendMail = t
return $booking;
}
/**
* The contract template of this offer: chosen explicitly, else the portal's default, else the property's.
*
* @param array<string, mixed> $changes
*/
private function templateFor(Booking $booking, array $changes): ?ContractTemplate
{
$id = filled($changes['contract_template_id'] ?? null)
? (int) $changes['contract_template_id']
: ($booking->importChannel ?? $booking->originChannel)?->contract_template_id ?? $booking->property->contract_template_id;
return $id ? ContractTemplate::query()->find($id) : null;
}
/**
* Sends the offer mail. The offer is already saved (and its validity runs), so a failing mail server is
* recorded in the admin inbox and reported to the caller instead of being lost.