- Datenmodell Property/Season/Extra (Beträge in Cent), Seeder mit Preisliste 2026 - PriceCalculator: Saison-Splitting, Mindestaufenthalt, Zusatzperson, Endreinigung, Extras, Anzahlung/Restzahlung - Filament-Verwaltung: Wohnungen, Saisons (Überschneidungsprüfung, Lückenwarnung, Kopie ins Folgejahr, Preisrechner), Zusatzleistungen - Tests für Preisberechnung und Saisonverwaltung Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
100 lines
4.3 KiB
PHP
100 lines
4.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Properties\Schemas;
|
|
|
|
use App\Filament\Forms\Components\EuroInput;
|
|
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\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),
|
|
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),
|
|
]),
|
|
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),
|
|
]),
|
|
]);
|
|
}
|
|
}
|