Portal-Direktbuchung erfassen, Kontaktdaten-Prozess, manueller Statuswechsel, Archiv, Filter, Menue Verwaltung/Einrichtung
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m38s

- Buchung erfassen: Buchungsweg Portal (Referenz, Portalpreis, ohne Kontaktdaten), Prozess bestaetigen/Vertrag sofort/nur erfassen
- Buchungsakte: Kontaktdaten eintragen (automatisch oder manuell weiter), Gast um Kontaktdaten bitten, Status von Hand aendern, Archivieren
- Liste: Filter Kanal, Anreisezeitraum, Kontaktdaten fehlen; Spalten ausblendbar; Archiv
- Klaerung: verstaendlichere Texte, eigenstaendige Belegung mit Kanal gilt als geklaert (Gitea #4)
- Akte per Button aus Liste und Belegungsplan erreichbar
- Menue: Gruppen Verwaltung (Tagesgeschaeft) und Einrichtung (Konfiguration), einfache Ansicht auf 8 Punkte

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-10-30 18:04:03 +01:00
1 parent 0c4187edaf
commit 5ba9ae08ab
37 files changed
+786 -82

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ class OccupancyCalendar extends Page
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCalendarDays;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $title = 'Belegungsplan';
+2 -2
View File
@@ -31,7 +31,7 @@ class PricesAndOffers extends Page
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCurrencyEuro;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Einrichtung';
protected static ?string $navigationLabel = 'Preise & Angebote';
@@ -39,7 +39,7 @@ class PricesAndOffers extends Page
protected static ?string $slug = 'preise-und-angebote';
protected static ?int $navigationSort = 5;
protected static ?int $navigationSort = 0;
#[Url(as: 'wohnung')]
public ?int $propertyId = null;
@@ -45,13 +45,13 @@ class BlockedPeriodResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedNoSymbol;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Sperrzeit';
protected static ?string $pluralModelLabel = 'Sperrzeiten';
protected static ?int $navigationSort = 3;
protected static ?int $navigationSort = 10;
public static function form(Schema $schema): Schema
{
@@ -128,12 +128,12 @@ public static function portalActions(): array
TextEntry::make('recognized_representation')->label('Fachliche Einordnung')->state(fn (BlockedPeriod $record): string => ICalRuleEngine::REPRESENTATIONS[$record->ical_interpretation['representation'] ?? 'unspecified']),
TextEntry::make('original')->label('Originalereignis (entfaltet)')->state(fn (BlockedPeriod $record): string => $record->ical_raw)->wrap()->extraAttributes(['style' => 'white-space:pre-wrap;overflow-wrap:anywhere']),
]),
Action::make('resolve')->label('Belegung zuordnen / klären')
Action::make('resolve')->label('Klären: eigenständig oder Doppelung?')
->visible(fn (BlockedPeriod $record): bool => ! $record->trashed() && in_array($record->source, ['channel', 'email'], true))
->authorize(fn (BlockedPeriod $record): bool => auth()->user()?->can('update', $record) ?? false)
->modalDescription('Nur nach persönlicher Prüfung zuordnen. Eine Darstellung steuert keine eigene Belegung mehr; die führende Buchung oder Sperre übernimmt Änderungen und Stornierungen. Kalenderereignisse und UIDs bleiben nachvollziehbar erhalten.')
->modalDescription('Nur nach persönlicher Prüfung klären. Eigenständig mit Buchungskanal (oder privat) gilt danach als geklärt und verschwindet aus „Ungeklärt“. Eine Doppelung steuert keine eigene Belegung mehr; die führende Buchung oder Sperre übernimmt Änderungen und Stornierungen. Kalenderereignisse und UIDs bleiben nachvollziehbar erhalten.')
->schema([
Select::make('resolution')->label('Fachliche Klärung')->options(['independent' => 'Eigenständige Belegung bestätigen', 'block' => 'Weitere Darstellung einer Kalenderbelegung (Portalreservierung oder Sperrzeit)', 'booking' => 'Weitere Darstellung einer eigenen Buchung'])->default('independent')->required()->live(),
Select::make('resolution')->label('Fachliche Klärung')->options(['independent' => 'Eigenständige Belegung – keine Doppelung (Buchungskanal unten angeben)', 'block' => 'Doppelung: dieselbe Belegung steht schon als Portalreservierung oder Sperrzeit im Kalender', 'booking' => 'Doppelung: dieselbe Belegung ist eine unserer eigenen Buchungen'])->default('independent')->required()->live(),
Select::make('target_id')->label('Führende Belegung mit demselben Zeitraum')
->visible(fn (Get $get): bool => $get('resolution') !== 'independent')
->required(fn (Get $get): bool => $get('resolution') !== 'independent')
@@ -20,13 +20,13 @@ class BookingTaskResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBanknotes;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Buchungsaufgabe';
protected static ?string $pluralModelLabel = 'Zahlungen & Wünsche';
protected static ?int $navigationSort = 3;
protected static ?int $navigationSort = 2;
public static function table(Table $table): Table
{
@@ -30,7 +30,7 @@ class BookingResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCalendarDays;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Buchung';
@@ -4,8 +4,10 @@
use App\Actions\ConfirmBooking;
use App\Actions\CreateReservation;
use App\Actions\RecordPortalBooking;
use App\Exceptions\ReservationException;
use App\Filament\Resources\Bookings\BookingResource;
use App\Models\Channel;
use App\Models\Property;
use App\Pricing\QuoteException;
use App\Pricing\StayRequest;
@@ -27,18 +29,32 @@ class CreateBooking extends CreateRecord
protected function handleRecordCreation(array $data): Model
{
try {
$booking = app(CreateReservation::class)->handle(
Property::findOrFail($data['property_id']),
new StayRequest(
CarbonImmutable::parse($data['arrival']),
CarbonImmutable::parse($data['departure']),
(int) $data['guests'],
promoCode: $data['promo_code'] ?: null,
),
Arr::only($data, ['first_name', 'last_name', 'email', 'phone', 'street', 'postal_code', 'city']),
source: 'manual',
sendMails: $data['send_mails'],
$property = Property::findOrFail($data['property_id']);
$stay = new StayRequest(
CarbonImmutable::parse($data['arrival']),
CarbonImmutable::parse($data['departure']),
(int) $data['guests'],
promoCode: $data['promo_code'] ?: null,
);
$guest = Arr::only($data, ['first_name', 'last_name', 'email', 'phone', 'street', 'postal_code', 'city']);
if (filled($data['channel_id'] ?? null)) {
$booking = app(RecordPortalBooking::class)->handle(
$property,
Channel::query()->findOrFail($data['channel_id']),
$stay,
$guest,
$data['portal_process'] ?? RecordPortalBooking::CONFIRM,
$data['portal_reference'] ?? null,
filled($data['portal_total'] ?? null) ? (int) $data['portal_total'] : null,
$data['internal_notes'] ?: null,
(bool) ($data['guest_confirmed'] ?? false),
);
return $booking;
}
$booking = app(CreateReservation::class)->handle($property, $stay, $guest, source: 'manual', sendMails: $data['send_mails']);
if ($data['confirm_immediately']) {
app(ConfirmBooking::class)->handle($booking, notifyGuest: $data['send_mails']);
@@ -5,7 +5,9 @@
use App\Actions\CancelBooking;
use App\Actions\ConfirmBooking;
use App\Actions\DeclineBooking;
use App\Actions\ProvideGuestContact;
use App\Actions\SendOffer;
use App\Actions\SetBookingStatus;
use App\Documents\OfferTerms;
use App\Documents\RentalContract;
use App\Enums\BookingStatus;
@@ -19,12 +21,14 @@
use App\Pricing\PriceCalculator;
use App\Pricing\QuoteException;
use App\Pricing\StayRequest;
use App\Support\BookingProgress;
use App\Support\Money;
use Carbon\CarbonImmutable;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
@@ -127,6 +131,61 @@ protected function getHeaderActions(): array
fn () => $send->handle($this->record, $this->offerChanges($data)),
'Angebot gesendet',
)),
Action::make('provideContact')
->label('Kontaktdaten eintragen')
->icon(Heroicon::OutlinedUserPlus)
->color(fn (): string => blank($this->record->guest?->email) ? 'warning' : 'gray')
->visible(fn (): bool => ! in_array($this->record->status, [BookingStatus::Cancelled, BookingStatus::Declined, BookingStatus::Expired], true))
->modalHeading('Kontaktdaten des Gastes')
->modalDescription('Kontaktdaten aus Portalnachricht, E-Mail oder Telefonat. Danach kann der Vertragsprozess automatisch weiterlaufen oder von Hand fortgeführt werden.')
->modalWidth('3xl')
->fillForm(fn (): array => ['guest' => $this->record->guest->only(['first_name', 'last_name', 'email', 'phone', 'street', 'postal_code', 'city']), 'process' => ProvideGuestContact::MANUAL, 'guest_confirmed' => $this->record->guest_confirmed_at !== null])
->schema([
Section::make('Gast')->columns(2)->schema([
TextInput::make('guest.first_name')->label('Vorname')->required()->maxLength(100),
TextInput::make('guest.last_name')->label('Nachname')->required()->maxLength(100),
TextInput::make('guest.email')->label('E-Mail')->email()->maxLength(255),
TextInput::make('guest.phone')->label('Telefon')->tel()->maxLength(50),
TextInput::make('guest.street')->label('Straße und Hausnummer')->maxLength(150),
TextInput::make('guest.postal_code')->label('PLZ')->maxLength(20),
TextInput::make('guest.city')->label('Ort')->maxLength(100),
]),
Section::make('Wie geht es weiter?')->schema([
Radio::make('process')->hiddenLabel()->options([
ProvideGuestContact::MANUAL => 'Nur speichern – den Vertragsprozess führe ich von Hand weiter',
ProvideGuestContact::AUTOMATIC => 'Automatisch weiter: Portal-Buchung → Bestätigung und Vertrag per E-Mail, Anfrage → Angebot per E-Mail',
])->required(),
Toggle::make('guest_confirmed')->label('Der Gast hat die Buchung per E-Mail bestätigt'),
]),
])
->action(function (array $data, ProvideGuestContact $provide): void {
try {
$message = $provide->handle($this->record, $data['guest'], $data['process'], (bool) $data['guest_confirmed']);
} catch (ReservationException|QuoteException $exception) {
Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send();
return;
}
$this->record->refresh();
Notification::make()->title($message)->success()->send();
}),
Action::make('requestContact')
->label('Gast um Kontaktdaten bitten')
->icon(Heroicon::OutlinedChatBubbleLeftEllipsis)
->color('gray')
->visible(fn (): bool => blank($this->record->guest?->email) && ! in_array($this->record->status, [BookingStatus::Cancelled, BookingStatus::Declined, BookingStatus::Expired], true))
->modalHeading('Gast um Kontaktdaten bitten')
->modalDescription('Der Text lässt sich im Nachrichtenfenster des Portals einfügen (Sie senden ihn selbst). Mit „Als angefragt vermerken“ merkt sich die Buchungsakte, dass die Kontaktdaten erfragt wurden.')
->modalSubmitActionLabel('Als angefragt vermerken')
->fillForm(fn (): array => ['text' => $this->contactRequestText()])
->schema([
Textarea::make('text')->label('Nachricht an den Gast')->rows(10)->extraInputAttributes(['readonly' => true, 'onclick' => 'this.select()']),
])
->action(function (): void {
$this->record->forceFill(['contact_requested_at' => now()])->saveQuietly();
Notification::make()->title('Als angefragt vermerkt')->success()->send();
}),
Action::make('offerLink')
->label('Angebotslink')
->icon(Heroicon::OutlinedLink)
@@ -250,6 +309,38 @@ protected function getHeaderActions(): array
Textarea::make('internal_notes')->label('Interne Notizen')->rows(6),
])
->action(fn (array $data) => $this->record->update($data)),
Action::make('setStatus')
->label('Status von Hand ändern')
->icon(Heroicon::OutlinedAdjustmentsHorizontal)
->visible(fn (): bool => BookingProgress::kind($this->record) !== BookingProgress::OWN && $this->record->status !== BookingStatus::Declined)
->modalHeading('Status von Hand ändern')
->modalDescription('Für Buchungen, die das System nicht selbst weiterführt. Es werden keine E-Mails versendet. Wird die Buchung wieder verbindlich, prüft das System den Kalender. Stornieren und Ablehnen haben eigene Aktionen.')
->schema([
Select::make('status')->label('Neuer Status')->options(collect(SetBookingStatus::TARGETS)->mapWithKeys(fn (BookingStatus $status): array => [$status->value => $status->getLabel()])->all())->required(),
Textarea::make('reason')->label('Grund / Anlass')->helperText('Wird in den internen Notizen festgehalten.')->required()->rows(2),
])
->action(function (array $data, SetBookingStatus $setStatus): void {
try {
$setStatus->handle($this->record, BookingStatus::from($data['status']), $data['reason'], auth()->user()->name);
} catch (ReservationException $exception) {
Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send();
return;
}
$this->record->refresh();
Notification::make()->title('Status geändert')->success()->send();
}),
Action::make('archive')
->label(fn (): string => $this->record->archived_at ? 'Aus dem Archiv holen' : 'Archivieren')
->icon(Heroicon::OutlinedArchiveBox)
->visible(fn (): bool => $this->record->archived_at !== null || $this->record->canBeArchived())
->modalDescription(fn (): string => $this->record->archived_at ? 'Die Buchung erscheint wieder in der Liste.' : 'Die Buchung verschwindet aus der Standardliste. Verlauf, E-Mails, Zahlungen und Dokumente bleiben vollständig erhalten.')
->requiresConfirmation()
->action(function (): void {
$this->record->update(['archived_at' => $this->record->archived_at ? null : now()]);
Notification::make()->title($this->record->archived_at ? 'Archiviert' : 'Wieder aktiv')->success()->send();
}),
Action::make('cancel')
->label('Stornieren')
->icon(Heroicon::OutlinedNoSymbol)
@@ -277,6 +368,21 @@ protected function getHeaderActions(): array
];
}
/**
* Suggested message asking a portal guest for the contact data the contract needs.
*/
private function contactRequestText(): string
{
$booking = $this->record;
$landlord = config('fewo.owner.name') ?: config('app.name');
return "Guten Tag {$booking->guest->first_name} {$booking->guest->last_name},\n\n"
."vielen Dank für Ihre Buchung der {$booking->property->name} vom {$booking->arrival->format('d.m.Y')} bis {$booking->departure->format('d.m.Y')}. "
."Für den Mietvertrag benötigen wir noch Ihre Kontaktdaten: vollständige Anschrift (Straße, PLZ, Ort), eine E-Mail-Adresse und eine Telefonnummer.\n\n"
."Sobald wir die Angaben haben, senden wir Ihnen den Vertrag mit allen Informationen zu.\n\n"
."Freundliche Grüße\n{$landlord}";
}
/**
* Form data of the offer modal as SendOffer changes (euro input → cents).
*
@@ -2,18 +2,24 @@
namespace App\Filament\Resources\Bookings\Schemas;
use App\Actions\RecordPortalBooking;
use App\Filament\Forms\Components\EuroInput;
use App\Models\Channel;
use App\Models\Property;
use App\Support\CurrentProperty;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
/**
* Manual entry of a booking received by phone or e-mail. The price is calculated automatically.
* Manual entry of a booking received by phone or e-mail, or made binding by a portal (e.g. FeWo-direkt, usually
* without the guest's contact data). The price is calculated automatically; a portal price can be entered.
*/
class BookingForm
{
@@ -28,7 +34,8 @@ public static function configure(Schema $schema): Schema
->label('Wohnung')
->options(fn (): array => Property::query()->orderBy('name')->pluck('name', 'id')->all())
->default(fn (): ?int => app(CurrentProperty::class)->id())
->required(),
->required()
->live(),
TextInput::make('guests')
->label('Personen')
->integer()
@@ -45,12 +52,25 @@ public static function configure(Schema $schema): Schema
TextInput::make('promo_code')
->label('Aktionscode'),
]),
Section::make('Buchungsweg')
->description('Telefon oder E-Mail: nichts auswählen. Hat ein Portal die Buchung bereits verbindlich gemacht (z. B. FeWo-direkt), das Portal wählen – dann genügen Name und Zeitraum, die Kontaktdaten können später nachgetragen werden.')
->columns(2)
->schema([
Select::make('channel_id')
->label('Über Portal')
->placeholder('Direkt / telefonisch / per E-Mail')
->options(fn (Get $get): array => Channel::query()->where('property_id', $get('property_id'))->orderBy('name')->pluck('name', 'id')->all())
->live(),
TextInput::make('portal_reference')->label('Referenz im Portal (Buchungsnummer)')->maxLength(100)->visible(fn (Get $get): bool => filled($get('channel_id'))),
EuroInput::make('portal_total')->label('Preis laut Portal (Gesamtpreis, optional)')->helperText('Weicht er von unserer Berechnung ab, wird die Differenz als Zeile „Abweichung Portalpreis“ geführt.')->visible(fn (Get $get): bool => filled($get('channel_id'))),
]),
Section::make('Gast')
->description(fn (Get $get): ?string => filled($get('channel_id')) ? 'Bei Portalbuchungen ohne Kontaktdaten genügt der Name – E-Mail und Adresse können später ergänzt werden.' : null)
->columns(2)
->schema([
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('email')->label('E-Mail')->email()->required(fn (Get $get): bool => blank($get('channel_id')))->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),
@@ -59,8 +79,19 @@ public static function configure(Schema $schema): Schema
Section::make('Abschluss')
->schema([
Textarea::make('internal_notes')->label('Interne Notiz'),
Toggle::make('confirm_immediately')->label('Sofort verbindlich bestätigen')->default(true),
Toggle::make('send_mails')->label('E-Mails an den Gast senden')->default(false),
Toggle::make('confirm_immediately')->label('Sofort verbindlich bestätigen')->default(true)->visible(fn (Get $get): bool => blank($get('channel_id'))),
Toggle::make('send_mails')->label('E-Mails an den Gast senden')->default(false)->visible(fn (Get $get): bool => blank($get('channel_id'))),
Radio::make('portal_process')
->label('Wie geht der Vertragsprozess weiter?')
->options([
RecordPortalBooking::CONFIRM => 'Buchung bestätigen (Zeitraum belegen), Vertrag später – sobald die Kontaktdaten da sind',
RecordPortalBooking::CONTRACT => 'Buchung bestätigen und Vertrag jetzt per E-Mail senden (E-Mail-Adresse nötig)',
RecordPortalBooking::RECORD => 'Nur als Anfrage erfassen – alles Weitere von Hand',
])
->default(RecordPortalBooking::CONFIRM)
->required(fn (Get $get): bool => filled($get('channel_id')))
->visible(fn (Get $get): bool => filled($get('channel_id'))),
Toggle::make('guest_confirmed')->label('Der Gast hat die Buchung bereits per E-Mail bestätigt')->visible(fn (Get $get): bool => filled($get('channel_id'))),
]),
]);
}
@@ -4,9 +4,12 @@
use App\Availability\OccupancyOverview;
use App\Enums\BookingStatus;
use App\Models\Channel;
use App\Models\Property;
use App\Support\CurrentProperty;
use Filament\Actions\Action;
use Filament\Forms\Components\DatePicker;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\SelectFilter;
@@ -18,7 +21,7 @@ class BookingsTable
public static function configure(Table $table, ?int $guestId = null): Table
{
return $table
->description('Eigene Anfragen und Buchungen sowie erkannte Portalreservierungen in einer Liste. Fehlende Gastzuordnungen lassen sich in den Details ergänzen; unbekannte Belegungen haben einen eigenen Klärungsbereich.')
->description('Eigene Anfragen und Buchungen sowie erkannte Portalreservierungen in einer Liste. „Akte öffnen“ zeigt alles zu einem Vorgang: nächster Schritt, Vertrag, Zahlungen, Aufgaben und E-Mails. Fehlende Gastzuordnungen lassen sich in den Details ergänzen; unbekannte Belegungen haben einen eigenen Klärungsbereich.')
->records(function (?string $search, ?string $sortColumn, ?string $sortDirection, array $filters, int $page, int|string $recordsPerPage) use ($guestId, $table): LengthAwarePaginator {
$propertyId = filled($filters['property']['value'] ?? null) ? (int) $filters['property']['value'] : null;
$records = app(OccupancyOverview::class)->records($propertyId, $guestId);
@@ -32,6 +35,18 @@ public static function configure(Table $table, ?int $guestId = null): Table
if ($filters['without_guest']['isActive'] ?? false) {
$records = $records->where('guest_assigned', false);
}
if (filled($filters['channel']['value'] ?? null)) {
$records = $records->where('channel_id', (int) $filters['channel']['value']);
}
if ($filters['contact_missing']['isActive'] ?? false) {
$records = $records->filter(fn (array $record): bool => $record['record_type'] === 'booking' && blank($record['guest_email']));
}
if (filled($filters['period']['arrival_from'] ?? null)) {
$records = $records->filter(fn (array $record): bool => $record['arrival'] >= $filters['period']['arrival_from']);
}
if (filled($filters['period']['arrival_until'] ?? null)) {
$records = $records->filter(fn (array $record): bool => $record['arrival'] <= $filters['period']['arrival_until']);
}
if (filled($filters['kind']['value'] ?? null)) {
$records = $records->where('record_type', $filters['kind']['value']);
}
@@ -41,6 +56,10 @@ public static function configure(Table $table, ?int $guestId = null): Table
// Cancelled, declined and expired requests leave the main list (they stay available as archive).
$records = $records->reject(fn (array $record): bool => in_array($record['status_key'], ['cancelled', 'declined', 'expired'], true));
}
if (! ($filters['show_closed']['isActive'] ?? false)) {
// Bookings the landlord moved to the archive; they keep their whole history and show again with the archive filter.
$records = $records->reject(fn (array $record): bool => $record['archived_booking']);
}
$column = in_array($sortColumn, ['arrival', 'departure', 'reference', 'guest', 'source', 'total'], true) ? $sortColumn : 'arrival';
$records = $records->sortBy($column, SORT_REGULAR, $sortDirection === 'desc');
$perPage = $recordsPerPage === 'all' ? max(1, $records->count()) : $recordsPerPage;
@@ -50,15 +69,16 @@ public static function configure(Table $table, ?int $guestId = null): Table
->defaultSort('arrival')->searchable()->recordAction(null)
->columns([
TextColumn::make('reference')->label('Nr. / Referenz')->sortable(),
TextColumn::make('kind_label')->label('Art')->badge(),
TextColumn::make('kind_label')->label('Art')->badge()->toggleable(),
TextColumn::make('status')->label('Status')->badge()->color(fn (array $record): string => $record['color']),
TextColumn::make('guest')->label('Gast / Namensinformation')->sortable()
->description(fn (array $record): string => $record['guest_assigned'] ? ($record['guest_email'] ?? 'E-Mail unbekannt') : 'Gastzuordnung offen'),
TextColumn::make('source')->label('Buchungskanal / Quelle')->sortable(),
TextColumn::make('source')->label('Buchungskanal / Quelle')->sortable()->toggleable(),
TextColumn::make('arrival')->label('Anreise')->date('d.m.Y')->sortable(),
TextColumn::make('departure')->label('Abreise')->date('d.m.Y')->sortable()
->description(fn (array $record): string => $record['nights'].' Nächte'),
TextColumn::make('persons')->label('Personen')->placeholder('Unbekannt')->toggleable(isToggledHiddenByDefault: true),
IconColumn::make('archived_booking')->label('Archiviert')->boolean()->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('total')->label('Bekannter Gesamtpreis')->money('EUR', divideBy: 100, locale: 'de')->placeholder('Unbekannt')->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('property')->label('Wohnung')->toggleable(isToggledHiddenByDefault: true),
])
@@ -71,11 +91,17 @@ public static function configure(Table $table, ?int $guestId = null): Table
...collect(BookingStatus::cases())->mapWithKeys(fn (BookingStatus $status): array => [$status->value => $status->getLabel()])->all(),
'imported' => 'Im Portalkalender geführt', 'archived' => 'Nicht mehr im Kalenderfeed',
]),
SelectFilter::make('channel')->label('Buchungskanal')->options(fn (): array => Channel::query()->orderBy('name')->pluck('name', 'id')->all()),
Filter::make('period')->label('Anreise im Zeitraum')->schema([
DatePicker::make('arrival_from')->label('Anreise ab'),
DatePicker::make('arrival_until')->label('Anreise bis'),
])->columns(2),
Filter::make('upcoming')->label('Nur kommende Aufenthalte'),
Filter::make('show_closed')->label('Archiv anzeigen (storniert, abgelehnt, abgelaufen)'),
Filter::make('contact_missing')->label('Kontaktdaten des Gastes fehlen'),
Filter::make('show_closed')->label('Archiv anzeigen (archiviert, storniert, abgelehnt, abgelaufen)'),
Filter::make('without_guest')->label('Gastzuordnung offen'),
])
->recordUrl(fn (array $record): string => $record['url'])
->recordActions([Action::make('view')->label('Details')->url(fn (array $record): string => $record['url'])]);
->recordActions([Action::make('view')->label(fn (array $record): string => $record['record_type'] === 'booking' ? 'Akte öffnen' : 'Details')->icon('heroicon-o-folder-open')->button()->color('primary')->url(fn (array $record): string => $record['url'])]);
}
}
@@ -35,13 +35,13 @@ class CancellationPolicyResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedReceiptPercent;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Einrichtung';
protected static ?string $modelLabel = 'Stornoregel';
protected static ?string $pluralModelLabel = 'Stornoregeln';
protected static ?int $navigationSort = 7;
protected static ?int $navigationSort = 3;
public static function form(Schema $schema): Schema
{
@@ -30,13 +30,13 @@ class CancellationResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedArchiveBoxXMark;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Stornierung';
protected static ?string $pluralModelLabel = 'Stornierungen';
protected static ?int $navigationSort = 5;
protected static ?int $navigationSort = 6;
public static function table(Table $table): Table
{
@@ -20,13 +20,13 @@ class ChannelTaskResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedClipboardDocumentCheck;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Portal-Aufgabe';
protected static ?string $pluralModelLabel = 'Portal-Aufgaben';
protected static ?int $navigationSort = 4;
protected static ?int $navigationSort = 3;
public static function table(Table $table): Table
{
@@ -27,7 +27,7 @@ class ChannelResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedArrowsRightLeft;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Einrichtung';
protected static ?string $navigationLabel = 'Kalenderabgleich (iCal)';
@@ -40,13 +40,13 @@ class ContractAnnexResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPaperClip;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Einrichtung';
protected static ?string $modelLabel = 'Vertragsanlage';
protected static ?string $pluralModelLabel = 'Vertragsanlagen';
protected static ?int $navigationSort = 8;
protected static ?int $navigationSort = 2;
public static function form(Schema $schema): Schema
{
@@ -25,13 +25,13 @@ class ContractTemplateResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentDuplicate;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Einrichtung';
protected static ?string $modelLabel = 'Vertragsvorlage';
protected static ?string $pluralModelLabel = 'Vertragsvorlagen';
protected static ?int $navigationSort = 6;
protected static ?int $navigationSort = 1;
public static function form(Schema $schema): Schema
{
@@ -25,7 +25,7 @@ class GuestResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Gast';
@@ -33,7 +33,7 @@ class GuestResource extends Resource
protected static ?string $recordTitleAttribute = 'last_name';
protected static ?int $navigationSort = 4;
protected static ?int $navigationSort = 5;
public static function form(Schema $schema): Schema
{
@@ -23,7 +23,7 @@ class InboxMessageResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedInbox;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $navigationLabel = 'Postfach';
@@ -31,7 +31,7 @@ class InboxMessageResource extends Resource
protected static ?string $pluralModelLabel = 'Postfach';
protected static ?int $navigationSort = 0;
protected static ?int $navigationSort = 4;
public static function table(Table $table): Table
{
@@ -21,13 +21,13 @@ class PortalEmailResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedEnvelopeOpen;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Portal-E-Mail';
protected static ?string $pluralModelLabel = 'Portal-E-Mails';
protected static ?int $navigationSort = 5;
protected static ?int $navigationSort = 8;
public static function table(Table $table): Table
{
@@ -17,7 +17,7 @@ class ManagePortalOccupations extends ManageRecords
public function getTabs(): array
{
return [
'unclear' => Tab::make('Ungeklärt')->modifyQueryUsing(fn (Builder $query) => $query->whereNull('deleted_at')->unclear()),
'unclear' => Tab::make('Ungeklärt (zu tun)')->modifyQueryUsing(fn (Builder $query) => $query->whereNull('deleted_at')->unclear()),
'all' => Tab::make('Alle Importereignisse')->modifyQueryUsing(fn (Builder $query) => $query->whereNull('deleted_at')),
'archive' => Tab::make('Nicht mehr im Feed')->modifyQueryUsing(fn (Builder $query) => $query->onlyTrashed()),
];
@@ -39,7 +39,7 @@ class PortalOccupationResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedQuestionMarkCircle;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $navigationLabel = 'Ungeklärte Belegungen';
@@ -47,7 +47,7 @@ class PortalOccupationResource extends Resource
protected static ?string $pluralModelLabel = 'Portalbelegungen & Klärung';
protected static ?int $navigationSort = 2;
protected static ?int $navigationSort = 7;
public static function getEloquentQuery(): Builder
{
@@ -68,7 +68,7 @@ public static function getNavigationBadgeColor(): string
public static function table(Table $table): Table
{
return $table->description('Unbekannte Belegungen und mögliche Mehrfachdarstellungen persönlich klären. Auch ungeklärte führende Einträge halten ihre Nächte belegt.')
return $table->description('So geht es: 1. „Einordnen“ – ist es eine Portalreservierung, eine Sperrzeit oder unbekannt? 2. „Klären“ – ist es eigenständig oder dieselbe Belegung wie ein anderer Eintrag (Doppelung)? 3. Der Gast lässt sich unter „Gast zuordnen“ ergänzen. Auch ungeklärte führende Einträge halten ihre Nächte belegt.')
->defaultSort('starts_on')->columns([
TextColumn::make('starts_on')->label('Anreise / Beginn')->date('d.m.Y')->sortable(),
TextColumn::make('ends_on')->label('Abreise / Ende')->date('d.m.Y'),
@@ -92,7 +92,7 @@ public static function occupationActions(): array
public static function classificationAction(): Action
{
return Action::make('classify')->label('Belegungsart / Zweck bearbeiten')
return Action::make('classify')->label('Einordnen: Reservierung, Sperrzeit oder unbekannt')
->visible(fn (BlockedPeriod $record): bool => in_array($record->source, ['channel', 'email'], true) && ! $record->is_representation && ! $record->trashed())
->authorize(fn (BlockedPeriod $record): bool => auth()->user()?->can('update', $record) ?? false)
->modalDescription('Nur bekannte Sachverhalte bestätigen. Die Einordnung ändert keine Termine, hebt keine Sperre auf und führt keine Ereignisse automatisch zusammen. Überschneidungen bleiben gesonderte Prüffälle.')
@@ -29,7 +29,7 @@ class PropertyResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedHomeModern;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Einrichtung';
protected static ?string $modelLabel = 'Wohnung';
@@ -26,13 +26,13 @@ class ReviewResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedStar;
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
protected static ?string $modelLabel = 'Bewertung';
protected static ?string $pluralModelLabel = 'Bewertungen';
protected static ?int $navigationSort = 3;
protected static ?int $navigationSort = 9;
public static function getNavigationBadge(): ?string
{