components([ Section::make('Aufenthalt') ->columns(2) ->schema([ Select::make('property_id') ->label('Wohnung') ->options(fn (): array => Property::query()->orderBy('name')->pluck('name', 'id')->all()) ->default(fn (): ?int => app(CurrentProperty::class)->id()) ->required() ->live(), TextInput::make('guests') ->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'), ]), 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.') ->columns(2) ->schema([ Select::make('channel_id') ->label('Über Portal') ->placeholder('Direkt / telefonisch / per E-Mail') ->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'))), ]), 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) ->columns(2) ->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('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), ]), Section::make('Abschluss') ->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'))), ]), ]); } }