- Buchung ist der einheitliche Vorgang: Eingangsart, Vorgangsart A1–A6, eingefrorenes Abwicklungsprofil, gespeicherter Verlauf (booking_events); Gast, Personen und Beträge dürfen unbekannt sein, Platzhalter-Gäste werden migriert und nicht mehr angelegt - Einstellungen in Ebenen: Vermieterstandard (So arbeite ich), Abweichung der Wohnung (Experte), Abweichung je Portal und Eingangsart; ersetzt booking_model als Steuergröße - Ein Weg für extern verbindliche Buchungen (TakeOverExternalBooking) statt RecordPortalBooking und "Akte anlegen"; Portalpreis als belegte Gesamtposition - Startseite "Zu erledigen", neue Vorgangsseite mit nächstem Schritt, Automatik-Schalter, "Beenden" mit Storno statt Statusumschaltung; Status von Hand nur im Expertenmodus - Migration übernimmt bisheriges Verhalten unverändert (abweichende Wohnungswerte bleiben als Abweichung), Bericht: php artisan process:settings-report Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
108 lines
4.4 KiB
PHP
108 lines
4.4 KiB
PHP
<?php
|
||
|
||
namespace App\Enums;
|
||
|
||
/**
|
||
* The settings that shape how a case is handled. Each one has a built-in default; the landlord sets his own default,
|
||
* a property (expert area) and a channel per intake kind may deviate. A value that is not set inherits – a deliberately
|
||
* set 0, "no" or "manual" is a value of its own.
|
||
*/
|
||
enum ProcessSetting: string
|
||
{
|
||
case Processing = 'processing';
|
||
case PreReservation = 'pre_reservation';
|
||
case HoldHours = 'hold_hours';
|
||
case Documents = 'documents';
|
||
case Payments = 'payments';
|
||
case GuestMessages = 'guest_messages';
|
||
case ArrivalInfoDaysBefore = 'arrival_info_days_before';
|
||
case ContractTemplate = 'contract_template_id';
|
||
|
||
/**
|
||
* Built-in default (the behaviour before any landlord setting existed).
|
||
*/
|
||
public function default(): string|int|bool|null
|
||
{
|
||
return match ($this) {
|
||
self::Processing => ProcessingMode::Manual->value,
|
||
self::PreReservation => true,
|
||
self::HoldHours => 48,
|
||
self::Documents, self::Payments, self::GuestMessages => Responsibility::Landlord->value,
|
||
self::ArrivalInfoDaysBefore => 3,
|
||
self::ContractTemplate => null,
|
||
};
|
||
}
|
||
|
||
/**
|
||
* The question shown to the landlord, in plain words.
|
||
*/
|
||
public function question(): string
|
||
{
|
||
return match ($this) {
|
||
self::Processing => 'Wie sollen neue Vorgänge bearbeitet werden?',
|
||
self::PreReservation => 'Soll eine Anfrage den Zeitraum im Kalender reservieren?',
|
||
self::HoldHours => 'Wie lange gilt ein Angebot (und bleibt der Zeitraum reserviert)?',
|
||
self::Documents => 'Wer schickt dem Gast Vertrag bzw. Buchungsunterlagen?',
|
||
self::Payments => 'Wer kümmert sich um die Zahlungen des Gastes?',
|
||
self::GuestMessages => 'Wer schickt dem Gast Anreise-Informationen und die Bitte um eine Bewertung?',
|
||
self::ArrivalInfoDaysBefore => 'Wann gehen die Anreise-Informationen an den Gast?',
|
||
self::ContractTemplate => 'Welche Vertragsvorlage wird verwendet?',
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Intake kinds for which a channel may deviate (empty: landlord and property level only).
|
||
*
|
||
* @return list<IntakeKind>
|
||
*/
|
||
public function channelIntakes(): array
|
||
{
|
||
return match ($this) {
|
||
self::Processing, self::Payments, self::GuestMessages, self::ContractTemplate => [IntakeKind::Inquiry, IntakeKind::Booking],
|
||
self::PreReservation, self::HoldHours => [IntakeKind::Inquiry],
|
||
self::Documents => [IntakeKind::Booking],
|
||
self::ArrivalInfoDaysBefore => [],
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Whether the landlord sets this on his general settings page (the template is chosen per property or channel).
|
||
*/
|
||
public function isLandlordSetting(): bool
|
||
{
|
||
return $this !== self::ContractTemplate;
|
||
}
|
||
|
||
/**
|
||
* Normalises a stored or submitted value; null means "not set".
|
||
*/
|
||
public function normalize(mixed $value): string|int|bool|null
|
||
{
|
||
if ($value === null || $value === '') {
|
||
return null;
|
||
}
|
||
|
||
return match ($this) {
|
||
self::Processing => ($value instanceof ProcessingMode ? $value : ProcessingMode::tryFrom((string) $value))?->value,
|
||
self::Documents, self::Payments, self::GuestMessages => ($value instanceof Responsibility ? $value : Responsibility::tryFrom((string) $value))?->value,
|
||
self::PreReservation => filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||
self::HoldHours, self::ArrivalInfoDaysBefore, self::ContractTemplate => is_numeric($value) ? (int) $value : null,
|
||
};
|
||
}
|
||
|
||
/**
|
||
* The value in plain words, for showing where a value comes from.
|
||
*/
|
||
public function describe(string|int|bool|null $value): string
|
||
{
|
||
return match ($this) {
|
||
self::Processing => ProcessingMode::tryFrom((string) $value)?->getLabel() ?? '–',
|
||
self::Documents, self::Payments, self::GuestMessages => Responsibility::tryFrom((string) $value)?->getLabel() ?? '–',
|
||
self::PreReservation => $value ? 'ja' : 'nein',
|
||
self::HoldHours => $value.' Stunden',
|
||
self::ArrivalInfoDaysBefore => $value.' Tage vor Anreise',
|
||
self::ContractTemplate => $value === null ? 'Texte der Webseite' : 'Vorlage Nr. '.$value,
|
||
};
|
||
}
|
||
}
|