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>
This commit is contained in:
1 parent
bf4c1c0838
commit
2e9a391b37
35 files changed
+1766
-12
No files matched your search
@@ -0,0 +1,82 @@
|
||||
<?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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user