Files
fewo-stommer/app/Filament/Resources/Properties/RelationManagers/ExtrasRelationManager.php
T
Lars StommerandClaude Opus 5.5 2e9a391b37 Phase 1: Wohnungen, Saisons & Preisberechnung
- 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>
2026-10-22 09:19:49 +02:00

83 lines
2.6 KiB
PHP

<?php
namespace App\Filament\Resources\Properties\RelationManagers;
use App\Enums\ExtraPricing;
use App\Filament\Forms\Components\EuroInput;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class ExtrasRelationManager extends RelationManager
{
protected static string $relationship = 'extras';
protected static ?string $title = 'Zusatzleistungen';
protected static ?string $modelLabel = 'Zusatzleistung';
protected static ?string $pluralModelLabel = 'Zusatzleistungen';
public function form(Schema $schema): Schema
{
return $schema
->columns(2)
->components([
TextInput::make('name')
->label('Bezeichnung')
->required()
->maxLength(255),
TextInput::make('description')
->label('Beschreibung')
->maxLength(255),
EuroInput::make('price')
->label('Preis')
->required(),
Select::make('pricing')
->label('Abrechnung')
->options(ExtraPricing::class)
->default(ExtraPricing::PerItem)
->required(),
Toggle::make('is_active')
->label('Buchbar')
->default(true),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->reorderable('sort_order')
->defaultSort('sort_order')
->columns([
TextColumn::make('name')
->label('Bezeichnung')
->description(fn ($record): ?string => $record->description),
TextColumn::make('price')
->label('Preis')
->money('EUR', divideBy: 100, locale: 'de'),
TextColumn::make('pricing')
->label('Abrechnung'),
IconColumn::make('is_active')
->label('Buchbar')
->boolean(),
])
->headerActions([
CreateAction::make(),
])
->recordActions([
EditAction::make(),
DeleteAction::make(),
]);
}
}