Phase 2: Kalender, Anfrage, Vorreservierung & Sonderangebote
- Gäste, Buchungen (Status-Workflow), Sperrzeiten, Sonderangebote - Vorreservierung mit Haltezeit je Wohnung; abgelaufene Holds geben den Kalender sofort frei, Cron setzt Status und benachrichtigt - Sonderangebote/Sonderkonditionen: %, € pro Aufenthalt, Sonderpreis/Nacht, Gratis-Nächte; Bedingungen u. a. Saison, Vorlauf, Wochentag, Nächte, Aktionscode; bestes Einzel- vs. kombinierte Angebote - Öffentliche Seite /buchen: Belegungskalender, Live-Preis, Anfrageformular (Honeypot, Rate-Limit) - E-Mails: Angebot an Gast, Benachrichtigung Vermieter, Bestätigung, Absage, Ablauf - Filament: Anfragen & Buchungen (bestätigen, ablehnen, verlängern, stornieren, Telefonbuchung), Gäste, Sperrzeiten, Sonderangebote - Deutsche Validierungstexte Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2e9a391b37
commit
08b6582fa1
79 files changed
+6213
-76
No files matched your search
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Guests;
|
||||
|
||||
use App\Filament\Resources\Guests\Pages\CreateGuest;
|
||||
use App\Filament\Resources\Guests\Pages\EditGuest;
|
||||
use App\Filament\Resources\Guests\Pages\ListGuests;
|
||||
use App\Filament\Resources\Guests\Schemas\GuestForm;
|
||||
use App\Filament\Resources\Guests\Tables\GuestsTable;
|
||||
use App\Models\Guest;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class GuestResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Guest::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
|
||||
|
||||
protected static ?string $modelLabel = 'Gast';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Gäste';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'last_name';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return GuestForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return GuestsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListGuests::route('/'),
|
||||
'create' => CreateGuest::route('/create'),
|
||||
'edit' => EditGuest::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Guests\Pages;
|
||||
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateGuest extends CreateRecord
|
||||
{
|
||||
protected static string $resource = GuestResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Guests\Pages;
|
||||
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditGuest extends EditRecord
|
||||
{
|
||||
protected static string $resource = GuestResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Guests\Pages;
|
||||
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListGuests extends ListRecords
|
||||
{
|
||||
protected static string $resource = GuestResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Guests\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class GuestForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(2)
|
||||
->components([
|
||||
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()->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),
|
||||
Select::make('country')
|
||||
->label('Land')
|
||||
->options(['DE' => 'Deutschland', 'AT' => 'Österreich', 'CH' => 'Schweiz', 'NL' => 'Niederlande', 'DK' => 'Dänemark', 'PL' => 'Polen'])
|
||||
->default('DE')
|
||||
->required(),
|
||||
Textarea::make('notes')->label('Notizen')->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Guests\Tables;
|
||||
|
||||
use App\Models\Guest;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class GuestsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('last_name')
|
||||
->columns([
|
||||
TextColumn::make('last_name')
|
||||
->label('Name')
|
||||
->formatStateUsing(fn (Guest $record): string => "{$record->last_name}, {$record->first_name}")
|
||||
->searchable(['first_name', 'last_name'])
|
||||
->sortable(),
|
||||
TextColumn::make('email')->label('E-Mail')->searchable(),
|
||||
TextColumn::make('phone')->label('Telefon')->placeholder('–'),
|
||||
TextColumn::make('city')->label('Ort')->placeholder('–'),
|
||||
TextColumn::make('bookings_count')->label('Buchungen')->counts('bookings')->sortable(),
|
||||
TextColumn::make('created_at')->label('Seit')->date('m/Y')->sortable(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user