Portal-Direktbuchung erfassen, Kontaktdaten-Prozess, manueller Statuswechsel, Archiv, Filter, Menue Verwaltung/Einrichtung
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m38s

- Buchung erfassen: Buchungsweg Portal (Referenz, Portalpreis, ohne Kontaktdaten), Prozess bestaetigen/Vertrag sofort/nur erfassen
- Buchungsakte: Kontaktdaten eintragen (automatisch oder manuell weiter), Gast um Kontaktdaten bitten, Status von Hand aendern, Archivieren
- Liste: Filter Kanal, Anreisezeitraum, Kontaktdaten fehlen; Spalten ausblendbar; Archiv
- Klaerung: verstaendlichere Texte, eigenstaendige Belegung mit Kanal gilt als geklaert (Gitea #4)
- Akte per Button aus Liste und Belegungsplan erreichbar
- Menue: Gruppen Verwaltung (Tagesgeschaeft) und Einrichtung (Konfiguration), einfache Ansicht auf 8 Punkte

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-10-30 18:04:03 +01:00
1 parent 0c4187edaf
commit 5ba9ae08ab
37 files changed
+786 -82

No files matched your search

+107
View File
@@ -0,0 +1,107 @@
<?php
namespace App\Actions;
use App\Enums\QuoteLineType;
use App\Exceptions\ReservationException;
use App\Models\Booking;
use App\Models\Channel;
use App\Models\Property;
use App\Pricing\PriceCalculator;
use App\Pricing\QuoteException;
use App\Pricing\QuoteLine;
use App\Pricing\StayRequest;
use Illuminate\Support\Facades\DB;
/**
* Records a booking that a portal already made binding (e.g. a direct booking on FeWo-direkt) – usually without
* the guest's contact data. The booking keeps the portal as its origin channel and may carry the portal's price and
* reference. The landlord decides how the contract process continues:
*
* - {@see self::CONFIRM}: the booking becomes binding right away (the dates are occupied), the contract follows
* once the contact data is known ({@see ProvideGuestContact}) – no contract is generated before that;
* - {@see self::CONTRACT}: binding and contract mail at once (needs the guest's e-mail address);
* - {@see self::RECORD}: only recorded as a request, everything else is done by hand.
*/
class RecordPortalBooking
{
public const CONFIRM = 'confirm';
public const CONTRACT = 'contract';
public const RECORD = 'record';
public function __construct(
private CreateReservation $create,
private ConfirmBooking $confirm,
private PriceCalculator $calculator,
) {}
/**
* @param array<string, ?string> $guestData first_name and last_name are required, everything else optional
*
* @throws QuoteException
* @throws ReservationException
*/
public function handle(Property $property, Channel $channel, StayRequest $stay, array $guestData, string $process = self::CONFIRM, ?string $portalReference = null, ?int $portalTotal = null, ?string $notes = null, bool $guestConfirmed = false): Booking
{
if ($channel->property_id !== $property->id) {
throw new ReservationException('Der Kanal gehört nicht zu dieser Wohnung.');
}
if ($process === self::CONTRACT && blank($guestData['email'] ?? null)) {
throw new ReservationException('Für den sofortigen Vertragsversand wird die E-Mail-Adresse des Gastes benötigt.');
}
$booking = $this->create->handle($property, $stay, $guestData, source: 'portal', sendMails: false);
$changes = ['origin_channel_id' => $channel->id, 'portal_reference' => filled($portalReference) ? trim($portalReference) : null, 'internal_notes' => filled($notes) ? trim($notes) : $booking->internal_notes];
if ($guestConfirmed) {
$changes['guest_confirmed_at'] = now();
}
if ($portalTotal !== null) {
$changes += $this->priceOf($property, $stay, $portalTotal);
}
$booking->update($changes);
if ($process === self::RECORD) {
return $booking->refresh();
}
if ($process === self::CONTRACT) {
$this->confirm->handle($booking, notifyGuest: true);
} else {
DB::transaction(fn () => $this->confirm->bind($booking));
}
return $booking->refresh();
}
/**
* Price columns for a booking whose portal price differs from our own calculation: the difference becomes an
* adjustment line, so the quote still adds up to what the portal charged.
*
* @return array<string, mixed>
*
* @throws QuoteException
*/
private function priceOf(Property $property, StayRequest $stay, int $portalTotal): array
{
$quote = $this->calculator->calculate($property, $stay);
$difference = $portalTotal - $quote->total();
if ($difference === 0) {
return [];
}
$difference = max($difference, -$quote->rent());
$quote = $quote->withLine(new QuoteLine(QuoteLineType::Adjustment, 'Abweichung Portalpreis', 1, $difference, $difference));
return [
'price_adjustment' => $difference,
'price_adjustment_label' => 'Abweichung Portalpreis',
'quote' => $quote->toArray(),
'total' => $quote->total(),
'deposit' => $quote->deposit(),
];
}
}