Vorgangskern und geführte Vorgangsbearbeitung (Pakete 1 und 2, Prozessarchitektur v0.10)

- 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>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-01 16:25:46 +01:00
1 parent 9005c12164
commit 3a728c3255
78 files changed
+4296 -1180

No files matched your search

@@ -2,8 +2,8 @@
namespace App\Filament\Resources\Bookings\Schemas;
use App\Actions\RecordPortalBooking;
use App\Filament\Forms\Components\EuroInput;
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
use App\Models\Channel;
use App\Models\Property;
use App\Support\CurrentProperty;
@@ -14,21 +14,49 @@
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Text;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
use Illuminate\Support\HtmlString;
/**
* Manual entry of a booking received by phone or e-mail, or made binding by a portal (e.g. FeWo-direkt, usually
* without the guest's contact data). The price is calculated automatically; a portal price can be entered.
* "Neu": one entry for everything that arrives outside the website. The first question is what it is – a request,
* a booking already binding on a portal, or own use / a block – and only the fields that matter for that answer follow.
* Nothing has to be invented: unknown guest data, number of guests or portal price stay empty.
*/
class BookingForm
{
public const INQUIRY = 'inquiry';
public const EXTERNAL = 'external';
public const OWN_USE = 'own_use';
public static function configure(Schema $schema): Schema
{
$is = fn (string $kind): \Closure => fn (Get $get): bool => $get('kind') === $kind;
$isCase = fn (Get $get): bool => in_array($get('kind'), [self::INQUIRY, self::EXTERNAL], true);
return $schema
->components([
Section::make('Aufenthalt')
Section::make('Was möchten Sie eintragen?')
->schema([
Radio::make('kind')
->hiddenLabel()
->options([
self::INQUIRY => 'Eine Anfrage – per Telefon, E-Mail oder Nachricht über ein Portal',
self::EXTERNAL => 'Eine Buchung, die bei einem Portal schon fest gebucht ist',
self::OWN_USE => 'Eigene Nutzung oder eine Sperre (z. B. Wartung)',
])
->default(self::INQUIRY)
->required()
->live(),
Text::make(new HtmlString('Eigene Nutzung und Sperren tragen Sie bis auf Weiteres unter <a class="underline" href="'.e(BlockedPeriodResource::getUrl()).'">Sperrzeiten</a> ein.'))
->visible($is(self::OWN_USE)),
]),
Section::make('Zeitraum')
->columns(2)
->visible($isCase)
->schema([
Select::make('property_id')
->label('Wohnung')
@@ -40,58 +68,55 @@ public static function configure(Schema $schema): Schema
->label('Personen')
->integer()
->minValue(1)
->default(2)
->required(),
DatePicker::make('arrival')
->label('Anreise')
->required(),
DatePicker::make('departure')
->label('Abreise')
->after('arrival')
->required(),
TextInput::make('promo_code')
->label('Aktionscode'),
->helperText(fn (Get $get): ?string => $get('kind') === self::EXTERNAL ? 'Leer lassen, wenn nicht bekannt.' : null)
->required($is(self::INQUIRY)),
DatePicker::make('arrival')->label('Anreise')->required(),
DatePicker::make('departure')->label('Abreise')->after('arrival')->required(),
]),
Section::make('Buchungsweg')
->description('Telefon oder E-Mail: nichts auswählen. Hat ein Portal die Buchung bereits verbindlich gemacht (z. B. FeWo-direkt), das Portal wählen – dann genügen Name und Zeitraum, die Kontaktdaten können später nachgetragen werden.')
Section::make('Portal')
->columns(2)
->visible($isCase)
->schema([
Select::make('channel_id')
->label('Über Portal')
->placeholder('Direkt / telefonisch / per E-Mail')
->label(fn (Get $get): string => $get('kind') === self::EXTERNAL ? 'Gebucht über' : 'Über ein Portal (optional)')
->placeholder('Direkt – kein Portal')
->options(fn (Get $get): array => Channel::query()->where('property_id', $get('property_id'))->orderBy('name')->pluck('name', 'id')->all())
->live(),
TextInput::make('portal_reference')->label('Referenz im Portal (Buchungsnummer)')->maxLength(100)->visible(fn (Get $get): bool => filled($get('channel_id'))),
EuroInput::make('portal_total')->label('Preis laut Portal (Gesamtpreis, optional)')->helperText('Weicht er von unserer Berechnung ab, wird die Differenz als Zeile „Abweichung Portalpreis“ geführt.')->visible(fn (Get $get): bool => filled($get('channel_id'))),
->required($is(self::EXTERNAL)),
TextInput::make('portal_reference')->label('Buchungsnummer im Portal')->maxLength(100)->visible($is(self::EXTERNAL)),
EuroInput::make('portal_total')
->label('Gesamtpreis laut Portal')
->helperText('Der Betrag, den der Gast beim Portal gebucht hat. Leer lassen, wenn noch nicht bekannt – er wird nicht geschätzt.')
->visible($is(self::EXTERNAL)),
]),
Section::make('Gast')
->description(fn (Get $get): ?string => filled($get('channel_id')) ? 'Bei Portalbuchungen ohne Kontaktdaten genügt der Name – E-Mail und Adresse können später ergänzt werden.' : null)
->description('Nur eintragen, was bekannt ist. Fehlendes wird später ergänzt; das System erinnert daran.')
->columns(2)
->visible($isCase)
->schema([
TextInput::make('first_name')->label('Vorname')->required()->maxLength(255),
TextInput::make('last_name')->label('Nachname')->required()->maxLength(255),
TextInput::make('email')->label('E-Mail')->email()->required(fn (Get $get): bool => blank($get('channel_id')))->maxLength(255),
TextInput::make('first_name')->label('Vorname')->required($is(self::INQUIRY))->maxLength(255),
TextInput::make('last_name')->label('Nachname')->required($is(self::INQUIRY))->maxLength(255),
TextInput::make('email')->label('E-Mail')->email()->maxLength(255),
TextInput::make('phone')->label('Telefon')->tel()->maxLength(50),
TextInput::make('street')->label('Straße')->maxLength(255),
TextInput::make('postal_code')->label('PLZ')->maxLength(20),
TextInput::make('city')->label('Ort')->maxLength(255),
Toggle::make('guest_confirmed')->label('Der Gast hat die Buchung bereits per E-Mail bestätigt')->visible($is(self::EXTERNAL)),
]),
Section::make('Abschluss')
Section::make('Wie geht es weiter?')
->visible($is(self::INQUIRY))
->schema([
Textarea::make('internal_notes')->label('Interne Notiz'),
Toggle::make('confirm_immediately')->label('Sofort verbindlich bestätigen')->default(true)->visible(fn (Get $get): bool => blank($get('channel_id'))),
Toggle::make('send_mails')->label('E-Mails an den Gast senden')->default(false)->visible(fn (Get $get): bool => blank($get('channel_id'))),
Radio::make('portal_process')
->label('Wie geht der Vertragsprozess weiter?')
->options([
RecordPortalBooking::CONFIRM => 'Buchung bestätigen (Zeitraum belegen), Vertrag später – sobald die Kontaktdaten da sind',
RecordPortalBooking::CONTRACT => 'Buchung bestätigen und Vertrag jetzt per E-Mail senden (E-Mail-Adresse nötig)',
RecordPortalBooking::RECORD => 'Nur als Anfrage erfassen – alles Weitere von Hand',
])
->default(RecordPortalBooking::CONFIRM)
->required(fn (Get $get): bool => filled($get('channel_id')))
->visible(fn (Get $get): bool => filled($get('channel_id'))),
Toggle::make('guest_confirmed')->label('Der Gast hat die Buchung bereits per E-Mail bestätigt')->visible(fn (Get $get): bool => filled($get('channel_id'))),
Toggle::make('confirm_immediately')
->label('Die Buchung ist mit dem Gast schon fest vereinbart – gleich verbindlich eintragen')
->helperText('Aus: Das System bereitet das Angebot vor; je nach Einstellung geht es automatisch hinaus oder wartet auf Ihre Freigabe.')
->default(false),
Toggle::make('send_mails')->label('Dem Gast E-Mails senden (Eingangsbestätigung bzw. Buchungsbestätigung)')->default(true),
TextInput::make('promo_code')->label('Aktionscode')->maxLength(50),
]),
Section::make('Notiz')
->visible($isCase)
->collapsed()
->schema([
Textarea::make('internal_notes')->hiddenLabel()->placeholder('Interne Notiz (nur für Sie sichtbar)'),
]),
]);
}