record->reference} · {$this->record->guest->full_name}"; } protected function getHeaderActions(): array { return [ Action::make('confirm') ->label('Bestätigen') ->icon(Heroicon::OutlinedCheckCircle) ->color('success') ->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::Expired], true)) ->requiresConfirmation() ->modalHeading('Buchung bestätigen') ->modalDescription('Die Buchung wird verbindlich und der Zeitraum dauerhaft belegt.') ->schema([ Toggle::make('notify')->label('Buchungsbestätigung an den Gast senden')->default(true), ]) ->action(fn (array $data, ConfirmBooking $confirm) => $this->runWorkflow( fn () => $confirm->handle($this->record, $data['notify']), 'Buchung bestätigt', )), Action::make('decline') ->label('Ablehnen') ->icon(Heroicon::OutlinedXCircle) ->color('danger') ->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::Expired], true)) ->requiresConfirmation() ->modalHeading('Anfrage ablehnen') ->schema([ Toggle::make('notify')->label('Absage an den Gast senden')->default(true), ]) ->action(fn (array $data, DeclineBooking $decline) => $this->runWorkflow( fn () => $decline->handle($this->record, $data['notify']), 'Anfrage abgelehnt', )), Action::make('extendHold') ->label('Vormerkung verlängern') ->icon(Heroicon::OutlinedClock) ->color('gray') ->visible(fn (): bool => $this->record->status === BookingStatus::Reserved) ->schema([ TextInput::make('hours')->label('Um')->integer()->minValue(1)->default(24)->suffix('Stunden')->required(), ]) ->action(function (array $data): void { $from = $this->record->hold_expires_at?->isFuture() ? $this->record->hold_expires_at : now()->toImmutable(); $this->record->update(['hold_expires_at' => $from->addHours((int) $data['hours'])]); Notification::make()->title('Vorgemerkt bis '.$this->record->hold_expires_at->format('d.m.Y, H:i'))->success()->send(); }), ActionGroup::make([ Action::make('notes') ->label('Interne Notiz bearbeiten') ->icon(Heroicon::OutlinedPencilSquare) ->fillForm(fn (): array => ['internal_notes' => $this->record->internal_notes]) ->schema([ Textarea::make('internal_notes')->label('Interne Notizen')->rows(6), ]) ->action(fn (array $data) => $this->record->update($data)), Action::make('cancel') ->label('Stornieren') ->icon(Heroicon::OutlinedNoSymbol) ->color('danger') ->visible(fn (): bool => in_array($this->record->status, BookingStatus::occupying(), true)) ->requiresConfirmation() ->modalDescription('Der Zeitraum wird wieder freigegeben. Der Gast wird nicht automatisch benachrichtigt.') ->action(function (): void { $this->record->update(['status' => BookingStatus::Cancelled, 'cancelled_at' => now()]); Notification::make()->title('Buchung storniert')->success()->send(); }), ]), ]; } private function runWorkflow(callable $workflow, string $successTitle): void { try { $workflow(); } catch (ReservationException $exception) { Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send(); return; } Notification::make()->title($successTitle)->success()->send(); } }