From f4a435c71a61837c909162cb7cab9489fc51b098 Mon Sep 17 00:00:00 2001 From: Lars Date: Tue, 3 Nov 2026 17:31:51 +0100 Subject: [PATCH] =?UTF-8?q?Vorgang:=20fehlende=20Angaben=20selbst=20eintra?= =?UTF-8?q?gen=20als=20n=C3=A4chster=20Schritt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Wartet der Vorgang auf die Antwort des Gastes, ist „Fehlende Angaben selbst eintragen“ der große Schalter (vorher leer, Dialog nur unter „Weitere Möglichkeiten“). Die Eingabe läuft über den Fakteneingang (Herkunft „von Ihnen eingetragen“); die Rückfrage endet, sobald alles da ist, im Automatikmodus geht das Angebot hinaus. - Dialog verständlicher benannt: „Gast eintragen“ / „Fehlende Angaben selbst eintragen“ / „Gastdaten bearbeiten“. Co-Authored-By: Claude Opus 5.5 --- .../Resources/Bookings/Pages/ViewBooking.php | 12 ++++++++--- tests/Feature/DataRequestTest.php | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/Filament/Resources/Bookings/Pages/ViewBooking.php b/app/Filament/Resources/Bookings/Pages/ViewBooking.php index 7e7f229..8cc8232 100644 --- a/app/Filament/Resources/Bookings/Pages/ViewBooking.php +++ b/app/Filament/Resources/Bookings/Pages/ViewBooking.php @@ -153,7 +153,9 @@ protected function getHeaderActions(): array $this->setStatusAction(), ])->keyBy(fn (Action $action): string => $action->getName()); - $next = CaseActivities::next($this->record)?->action; + // While the case waits for the guest's missing details, entering them oneself (call, other mail) is the step at hand. + $next = CaseActivities::next($this->record)?->action + ?? collect(CaseActivities::for($this->record))->first(fn ($activity): bool => $activity->key === 'contact' && $activity->action !== null)?->action; $primary = $next !== null && $actions->has($next) ? $actions->pull($next)->color('primary')->size('lg')->icon(Heroicon::OutlinedArrowRightCircle) : null; $expert = $actions->only(self::EXPERT)->values()->all(); $more = $actions->except(self::EXPERT)->values()->all(); @@ -293,11 +295,15 @@ private function templateFields(): array private function provideContactAction(): Action { return Action::make('provideContact') - ->label(fn (): string => $this->record->guest === null ? 'Gast eintragen' : 'Kontaktdaten eintragen') + ->label(fn (): string => match (true) { + $this->record->guest === null => 'Gast eintragen', + RequestCaseData::needs($this->record) !== null => 'Fehlende Angaben selbst eintragen', + default => 'Gastdaten bearbeiten', + }) ->icon(Heroicon::OutlinedUserPlus) ->visible(fn (): bool => $this->record->internal_kind !== InternalKind::Block && ! in_array($this->record->status, [BookingStatus::Cancelled, BookingStatus::Declined, BookingStatus::Expired], true)) ->modalHeading('Kontaktdaten des Gastes') - ->modalDescription(fn (): string => 'Aus Portalnachricht, E-Mail oder Telefonat. Nur eintragen, was bekannt ist.'.$this->openFactConflicts()) + ->modalDescription(fn (): string => 'Aus Telefonat, E-Mail, Portalnachricht oder Gespräch. Nur eintragen, was bekannt ist; Ihre Eingabe gilt und wird mit Herkunft „von Ihnen eingetragen“ festgehalten. Eine laufende Rückfrage endet, sobald alles da ist.'.$this->openFactConflicts()) ->modalWidth('3xl') ->fillForm(fn (): array => [ 'guest' => $this->record->guest?->only(['first_name', 'last_name', 'email', 'phone', 'street', 'postal_code', 'city', 'country']) ?? [], diff --git a/tests/Feature/DataRequestTest.php b/tests/Feature/DataRequestTest.php index 64c74e5..1ab6f7b 100644 --- a/tests/Feature/DataRequestTest.php +++ b/tests/Feature/DataRequestTest.php @@ -4,11 +4,13 @@ use App\Actions\ContributeCaseFacts; use App\Actions\CreateReservation; +use App\Actions\ProvideGuestContact; use App\Actions\RequestCaseData; use App\Actions\TakeOverExternalBooking; use App\Enums\BookingStatus; use App\Enums\BookingTaskKind; use App\Enums\FactSource; +use App\Filament\Resources\Bookings\Pages\ViewBooking; use App\Mail\DataRequested; use App\Mail\ReservationReceived; use App\Models\Booking; @@ -17,6 +19,7 @@ use App\Models\Channel; use App\Models\DataRequest; use App\Models\Property; +use App\Models\User; use App\Pricing\StayRequest; use App\Process\CaseActivities; use App\Support\Content; @@ -24,11 +27,13 @@ use Carbon\CarbonImmutable; use Database\Seeders\PropertySeeder; use Database\Seeders\SiteSeeder; +use Filament\Actions\Testing\TestAction; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\URL; +use Livewire\Livewire; use Tests\TestCase; /** @@ -101,6 +106,22 @@ public function test_the_offer_waits_for_the_answer_even_when_the_steps_are_rele $this->assertSame(BookingStatus::Reserved, $booking->fresh()->status, 'manual processing: nothing sent by itself'); } + public function test_the_landlord_enters_the_missing_details_himself_while_the_guest_is_asked(): void + { + $this->actingAs(User::factory()->create()); + Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic', 'data_request_mode' => 'automatic']]); + $booking = $this->request(); + + $page = Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()]); + $primary = $page->instance()->getCachedHeaderActions()[0]; + $this->assertSame(['provideContact', 'Fehlende Angaben selbst eintragen'], [$primary->getName(), $primary->getLabel()]); + + $page->callAction(TestAction::make('provideContact')->arguments([]), ['guest' => ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Strandweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], 'process' => ProvideGuestContact::AUTOMATIC, 'guest_confirmed' => false]); + + $this->assertSame(DataRequest::COMPLETED, $booking->dataRequests()->first()->status); + $this->assertSame(BookingStatus::OfferSent, $booking->fresh()->status); + } + public function test_manual_mode_leaves_the_question_to_the_landlord(): void { Settings::tenant()->update(['process_defaults' => ['data_request_mode' => 'manual']]);