Files
LarsandClaude Opus 5.5 234e642e4d Pakete 7 und 9 abgeschlossen: Wirksamkeit, Browserbefunde, Gesamtabnahme
- Wirksame Einstellungen: Antwort auf Anfragen, Aufenthalt je Wohnung,
  Dokument und beide Abschlüsse je Vorgang
- Schritte vor dem Aufenthalt entfallen nach der Abreise; direkt bestaetigte
  Vorgaenge zeigen keine Auskunft; "Als Naechstes" ohne fremden Detailtext
- Automatische Wunschbestaetigung nur mit freigegebenen Vertragstexten
- Taeglicher Lauf bewertet auch bereits abgeschlossene Vorgaenge kaufmaennisch
- Dokumente: UMSETZUNGSERGEBNIS_P7_P9, END_TO_END_ABNAHME (T01-T25),
  KONFIGURATION_UND_WIRKSAMKEIT, GESAMTABNAHME_v0.10, STATUS; Screenshots

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 08:51:24 +01:00

192 lines
11 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Filament\Resources\Properties\Schemas;
use App\Enums\AdminMode;
use App\Enums\CancellationMode;
use App\Enums\ProcessSetting;
use App\Filament\Forms\Components\EuroInput;
use App\Filament\Forms\ProcessSettingFields;
use App\Filament\Pages\HandlingSettings;
use App\ImageWorlds\ImageWorldRegistry;
use App\Models\ContractTemplate;
use App\Models\Site;
use App\Models\User;
use App\Support\Settings;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\TimePicker;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Illuminate\Support\Str;
class PropertyForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Section::make('Wohnung')
->columns(2)
->schema([
TextInput::make('name')
->label('Name')
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(fn (Set $set, ?string $state, string $operation) => $operation === 'create' ? $set('slug', Str::slug((string) $state)) : null),
TextInput::make('slug')
->label('URL-Kürzel')
->required()
->maxLength(255)
->alphaDash()
->unique(ignoreRecord: true),
TextInput::make('address')
->label('Adresse')
->maxLength(255),
TextInput::make('size_sqm')
->label('Größe')
->numeric()
->minValue(1)
->suffix('m²'),
TimePicker::make('check_in_time')
->label('Anreise ab')
->seconds(false),
TimePicker::make('check_out_time')
->label('Abreise bis')
->seconds(false),
Select::make('site_id')
->label('Website')
->options(fn (): array => Site::query()->pluck('name', 'id')->all())
->placeholder('keine'),
Select::make('image_world')
->label('Bildwelt')
->options(fn (): array => app(ImageWorldRegistry::class)->options())
->placeholder('wie die Website')
->helperText('Nur setzen, wenn diese Wohnung anders aussehen soll als die Website – etwa eine Bergwohnung auf einer Küsten-Website.'),
Toggle::make('is_active')
->label('Aktiv (auf der Webseite buchbar)')
->default(true),
]),
Section::make('Belegung & Preise')
->description('Übernachtungspreise werden je Saison gepflegt (Reiter „Saisons“ unten).')
->columns(2)
->schema([
TextInput::make('max_guests')
->label('Maximale Personen')
->required()
->integer()
->minValue(1),
TextInput::make('included_guests')
->label('Im Preis enthaltene Personen')
->required()
->integer()
->minValue(1)
->lte('max_guests'),
EuroInput::make('extra_guest_fee_per_night')
->label('Aufpreis je weitere Person und Nacht')
->required()
->default(0),
EuroInput::make('cleaning_fee')
->label('Endreinigung & Service (einmalig)')
->required()
->default(0),
EuroInput::make('tourist_tax_rate')
->label('Kurabgabe je Person und Nacht')
->helperText('Ihr Satz laut Gemeinde. Wird bei eigener Nutzung und privaten Aufenthalten als eigene Position berechnet; Befreiungen tragen Sie im Vorgang ein. Leer lassen: keine Berechnung.'),
]),
Section::make('Zahlungsbedingungen')
->columns(2)
->schema([
TextInput::make('deposit_percent')
->label('Anzahlung')
->helperText('Anteil am Mietpreis (Übernachtungen ohne Endreinigung und Extras)')
->required()
->integer()
->minValue(0)
->maxValue(100)
->suffix('%')
->default(35),
TextInput::make('balance_due_days_before_arrival')
->label('Restzahlung fällig')
->required()
->integer()
->minValue(0)
->suffix('Tage vor Anreise')
->default(28),
Select::make('cancellation_mode')
->label('Stornierungslink in der Buchungsbestätigung')
->options(CancellationMode::class)
->default(CancellationMode::Request)
->required()
->live()
->helperText('Bei Sofort-Stornierung wird der Zeitraum frei; Kosten und Rückzahlung bleiben immer Ihre Aufgabe.'),
TextInput::make('free_cancellation_days')
->label('Kostenfrei stornierbar bis')
->integer()
->minValue(0)
->suffix('Tage vor Anreise')
->default(14)
->visible(fn (Get $get): bool => $get('cancellation_mode') === CancellationMode::InstantWhenFree->value || $get('cancellation_mode') === CancellationMode::InstantWhenFree),
KeyValue::make('contract_data')
->label('Vertragsdaten der Wohnung')
->helperText('Für Platzhalter in Vertragsvorlagen, z. B. Name „wlan_passwort“ → {{ wohnung.wlan_passwort }}. Nur Kleinbuchstaben, Ziffern und Unterstrich im Namen.')
->keyLabel('Name')
->valueLabel('Wert')
->columnSpanFull(),
Select::make('contract_template_id')
->label('Standard-Vertragsvorlage')
->options(fn (): array => ContractTemplate::query()->orderBy('name')->orderBy('version')->get()->mapWithKeys(fn (ContractTemplate $template): array => [$template->id => $template->label()])->all())
->placeholder('Texte der Webseite')
->helperText('Wird bei neuen Angeboten verwendet, sofern das Portal keine eigene Vorlage hat.'),
]),
Section::make('Aufenthalt vorbereiten und abschließen')
->description('Was bei jedem Aufenthalt in dieser Wohnung zu tun ist. Jede Zeile wird rechtzeitig zur Aufgabe am Vorgang – keine Personalplanung. Gebuchte Leistungen (z. B. Wäschepaket) kommen automatisch dazu.')
->collapsed()
->columnSpanFull()
->schema([
Toggle::make('asks_arrival_time')
->label('Anreisezeit erfragen')
->helperText('Fehlt sie wenige Tage vor der Anreise, erscheint die Aufgabe „Anreisedaten beim Gast erfragen“. Kontaktdaten werden immer geprüft.'),
Repeater::make('stay_tasks')
->label('Aufgaben je Aufenthalt')
->addActionLabel('Aufgabe hinzufügen')
->defaultItems(0)
->columns(4)
->schema([
TextInput::make('title')->label('Was?')->placeholder('z. B. Endreinigung')->required()->maxLength(120),
Select::make('when')->label('Wann?')->required()->default('before_arrival')->live()->options([
'before_arrival' => 'vor der Anreise',
'on_arrival' => 'am Anreisetag',
'after_departure' => 'am Abreisetag',
]),
TextInput::make('days')->label('Tage vorher')->integer()->minValue(0)->maxValue(14)->default(1)->visible(fn (Get $get): bool => $get('when') === 'before_arrival'),
TextInput::make('responsible')->label('Wer? (optional)')->placeholder('z. B. Reinigung Müller')->maxLength(120),
CheckboxList::make('applies_to')->label('Bei')->required()->default(['rental'])->columns(4)->columnSpanFull()->options([
'rental' => 'Gästebuchungen',
'private' => 'Familie/Freunde',
'own' => 'eigener Nutzung',
'block' => 'Sperren',
]),
]),
]),
Section::make('Abweichende Abwicklung dieser Wohnung')
->description('Nur nötig, wenn diese Wohnung anders bearbeitet wird als in „So arbeite ich“ eingestellt. Leere Felder folgen Ihren Standardeinstellungen.')
->visible(fn (): bool => auth()->user() instanceof User && auth()->user()->adminMode() === AdminMode::Expert)
->collapsed()
->columns(2)
->schema(ProcessSettingFields::make('process_overrides.', HandlingSettings::settings(), function (ProcessSetting $setting): string {
$defaults = (array) (Settings::tenant()?->process_defaults ?? []);
return $setting->describe($setting->normalize($defaults[$setting->value] ?? null) ?? $setting->default());
})),
]);
}
}