- Eigene Webseite als Kanal eigener Art (channels.kind = website), nur zur Konfiguration: Webseiten-Anfragen bleiben direkt (A1) ohne Kanalbezug; der Eintrag nimmt an Sync, Export, Überwachung und Sperraufgaben nicht teil (active()/Property::channels() nur Portale, Feed nur für Portale). - Neue Einstellungen im bestehenden ProcessSetting: Klärungsreservierung automatisch/Freigabe (15/180 min, 0 = keine), Rückfragemodus, Erinnerungen, Folgefragen, Erinnerungsabstand, Linkgültigkeit, Anschrift im Webformular verlangen (Standard: nein). - „Kanäle“ in der einfachen Ansicht: Webseite und Portale an einer Stelle, Verweis auf „Ihre Standards“; „Wirksame Einstellungen“ mit Spalte „Eigene Webseite“ und Herkunft „Webseite“. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
145 lines
8.1 KiB
PHP
145 lines
8.1 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';
|
||
case ClarificationHoldAutoMinutes = 'clarification_hold_auto_minutes';
|
||
case ClarificationHoldManualMinutes = 'clarification_hold_manual_minutes';
|
||
case DataRequest = 'data_request_mode';
|
||
case DataRequestRemindersMax = 'data_request_reminders_max';
|
||
case DataRequestFollowupsMax = 'data_request_followups_max';
|
||
case DataRequestReminderHours = 'data_request_reminder_hours';
|
||
case GuestLinkValidDays = 'guest_link_valid_days';
|
||
case FormRequiresAddress = 'form_requires_address';
|
||
|
||
/**
|
||
* 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,
|
||
self::ClarificationHoldAutoMinutes => 15,
|
||
self::ClarificationHoldManualMinutes => 180,
|
||
self::DataRequest => DataRequestMode::Approval->value,
|
||
self::DataRequestRemindersMax => 2,
|
||
self::DataRequestFollowupsMax => 2,
|
||
self::DataRequestReminderHours => 24,
|
||
self::GuestLinkValidDays => 14,
|
||
self::FormRequiresAddress => false,
|
||
};
|
||
}
|
||
|
||
/**
|
||
* 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 bzw. eine unverbindliche Auskunft (mit Reservierung: so lange 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?',
|
||
self::ClarificationHoldAutoMinutes => 'Wie lange wird der Zeitraum einer unvollständigen Anfrage vorläufig reserviert, wenn automatisch nachgefragt wird (0 = gar nicht)?',
|
||
self::ClarificationHoldManualMinutes => 'Wie lange wird der Zeitraum einer unvollständigen Anfrage vorläufig reserviert, wenn Sie die Rückfrage freigeben oder selbst nachfragen (0 = gar nicht)?',
|
||
self::DataRequest => 'Wie wird nach fehlenden Angaben gefragt?',
|
||
self::DataRequestRemindersMax => 'Wie oft wird höchstens erinnert, wenn der Gast nicht antwortet?',
|
||
self::DataRequestFollowupsMax => 'Wie viele gezielte Folgefragen gehen höchstens hinaus, wenn eine Antwort unvollständig ist?',
|
||
self::DataRequestReminderHours => 'Nach wie vielen Stunden ohne Antwort wird erinnert?',
|
||
self::GuestLinkValidDays => 'Wie lange gilt der Link, über den der Gast Angaben ergänzt?',
|
||
self::FormRequiresAddress => 'Muss die vollständige Anschrift schon im Anfrageformular der Webseite angegeben werden?',
|
||
};
|
||
}
|
||
|
||
/**
|
||
* 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, self::GuestLinkValidDays => [],
|
||
self::ClarificationHoldAutoMinutes, self::ClarificationHoldManualMinutes, self::FormRequiresAddress => [IntakeKind::Inquiry],
|
||
self::DataRequest, self::DataRequestRemindersMax, self::DataRequestFollowupsMax, self::DataRequestReminderHours => [IntakeKind::Inquiry, IntakeKind::Booking],
|
||
};
|
||
}
|
||
|
||
/**
|
||
* 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, self::FormRequiresAddress => is_bool($value) ? $value : filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||
self::HoldHours, self::ArrivalInfoDaysBefore, self::ContractTemplate => is_numeric($value) ? (int) $value : null,
|
||
self::DataRequest => ($value instanceof DataRequestMode ? $value : DataRequestMode::tryFrom((string) $value))?->value,
|
||
// 0 is a value of its own: no clarification hold, no reminder, no follow-up question.
|
||
self::ClarificationHoldAutoMinutes, self::ClarificationHoldManualMinutes, self::DataRequestRemindersMax, self::DataRequestFollowupsMax => is_numeric($value) ? max(0, (int) $value) : null,
|
||
self::DataRequestReminderHours, self::GuestLinkValidDays => is_numeric($value) ? max(1, (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,
|
||
self::ClarificationHoldAutoMinutes, self::ClarificationHoldManualMinutes => (int) $value === 0 ? 'keine vorläufige Reservierung' : $value.' Minuten',
|
||
self::DataRequest => DataRequestMode::tryFrom((string) $value)?->getLabel() ?? '–',
|
||
self::DataRequestRemindersMax => (int) $value === 0 ? 'keine Erinnerung' : 'höchstens '.$value.' Erinnerung'.((int) $value === 1 ? '' : 'en'),
|
||
self::DataRequestFollowupsMax => (int) $value === 0 ? 'keine Folgefrage' : 'höchstens '.$value.' Folgefrage'.((int) $value === 1 ? '' : 'n'),
|
||
self::DataRequestReminderHours => 'nach '.$value.' Stunden',
|
||
self::GuestLinkValidDays => $value.' Tage',
|
||
self::FormRequiresAddress => $value ? 'ja, Pflichtangabe' : 'nein, kann nachgefragt werden',
|
||
};
|
||
}
|
||
}
|