- Buchung ist der einheitliche Vorgang: Eingangsart, Vorgangsart A1–A6, eingefrorenes Abwicklungsprofil, gespeicherter Verlauf (booking_events); Gast, Personen und Beträge dürfen unbekannt sein, Platzhalter-Gäste werden migriert und nicht mehr angelegt - Einstellungen in Ebenen: Vermieterstandard (So arbeite ich), Abweichung der Wohnung (Experte), Abweichung je Portal und Eingangsart; ersetzt booking_model als Steuergröße - Ein Weg für extern verbindliche Buchungen (TakeOverExternalBooking) statt RecordPortalBooking und "Akte anlegen"; Portalpreis als belegte Gesamtposition - Startseite "Zu erledigen", neue Vorgangsseite mit nächstem Schritt, Automatik-Schalter, "Beenden" mit Storno statt Statusumschaltung; Status von Hand nur im Expertenmodus - Migration übernimmt bisheriges Verhalten unverändert (abweichende Wohnungswerte bleiben als Abweichung), Bericht: php artisan process:settings-report Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
2.3 KiB
PHP
53 lines
2.3 KiB
PHP
<?php
|
||
|
||
namespace App\Filament\Widgets;
|
||
|
||
use App\Enums\BookingStatus;
|
||
use App\Enums\UserRole;
|
||
use App\Filament\Resources\Bookings\BookingResource;
|
||
use App\Models\Booking;
|
||
use App\Support\Money;
|
||
use Filament\Tables\Columns\TextColumn;
|
||
use Filament\Tables\Table;
|
||
use Filament\Widgets\TableWidget;
|
||
|
||
class UpcomingStays extends TableWidget
|
||
{
|
||
protected static ?int $sort = 2;
|
||
|
||
protected int|string|array $columnSpan = 'full';
|
||
|
||
protected static ?string $heading = 'Nächste Aufenthalte (30 Tage)';
|
||
|
||
public static function canView(): bool
|
||
{
|
||
return (bool) auth()->user()?->hasRole(UserRole::Admin, UserRole::Rentals);
|
||
}
|
||
|
||
public function table(Table $table): Table
|
||
{
|
||
return $table
|
||
->query(fn () => Booking::query()
|
||
->with(['guest', 'payments'])
|
||
->whereIn('status', BookingStatus::occupying())
|
||
->whereDate('departure', '>=', today())
|
||
->whereDate('arrival', '<=', today()->addDays(30)))
|
||
->defaultSort('arrival')
|
||
->paginated(false)
|
||
->emptyStateHeading('Keine Aufenthalte in den nächsten 30 Tagen')
|
||
->recordUrl(fn (Booking $record): string => BookingResource::getUrl('view', ['record' => $record]))
|
||
->columns([
|
||
TextColumn::make('arrival')->label('Anreise')->date('D, d.m.')
|
||
->description(fn (Booking $record): ?string => $record->arrival->isToday() ? 'heute' : ($record->arrival->isPast() ? 'läuft' : null)),
|
||
TextColumn::make('departure')->label('Abreise')->date('D, d.m.'),
|
||
TextColumn::make('guest.last_name')->label('Gast')->formatStateUsing(fn (Booking $record): string => $record->guestName()),
|
||
TextColumn::make('guests')->label('Pers.'),
|
||
TextColumn::make('status')->label('Status')->badge(),
|
||
TextColumn::make('open')->label('Offen')
|
||
->state(fn (Booking $record): string => $record->openAmount() > 0 ? Money::format($record->openAmount()) : '–')
|
||
->color(fn (Booking $record): ?string => $record->openAmount() > 0 ? 'danger' : null),
|
||
TextColumn::make('arrival_info_sent_at')->label('Anreiseinfo')->since()->placeholder('noch nicht'),
|
||
]);
|
||
}
|
||
}
|