Vollstaendige Gastdaten direkt im Zuordnungsdialog erfassen
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m48s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m48s
This commit is contained in:
1 parent
13f1b5856c
commit
78aafd7c28
6 files changed
+105
-28
No files matched your search
@@ -20,6 +20,7 @@
|
||||
use App\Filament\Pages\OccupancyCalendar;
|
||||
use App\Filament\Resources\BlockedPeriods\Pages\ManageBlockedPeriods;
|
||||
use App\Filament\Resources\Bookings\Pages\ListBookings;
|
||||
use App\Filament\Resources\Bookings\Pages\ViewBooking;
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use App\Filament\Resources\Guests\Pages\CreateGuest;
|
||||
use App\Filament\Resources\Guests\Pages\EditGuest;
|
||||
@@ -163,6 +164,62 @@ public function test_guest_can_be_entered_directly_without_fabricating_unknown_c
|
||||
$this->assertSame(['Tanja', '', null], [Guest::sole()->first_name, Guest::sole()->last_name, Guest::sole()->email]);
|
||||
}
|
||||
|
||||
#[DataProvider('guestAssignmentSources')]
|
||||
public function test_complete_guest_profile_can_be_entered_and_assigned_in_one_dialog(string $source): void
|
||||
{
|
||||
$property = $this->property();
|
||||
$record = $source === 'portal' ? $this->import($property, ['ical_event_type' => 'portal_reservation']) : Booking::factory()->for($property)->reserved()->create();
|
||||
$page = $source === 'portal' ? ViewPortalOccupation::class : ViewBooking::class;
|
||||
$before = $record->only(['id', 'arrival', 'departure', 'starts_on', 'ends_on', 'external_uid']);
|
||||
Mail::fake();
|
||||
|
||||
Livewire::test($page, ['record' => $record->id])->callAction('assignGuest', [
|
||||
'mode' => 'new', 'first_name' => 'Samira', 'last_name' => 'Gast', 'email' => 'SAMIRA@example.test',
|
||||
'phone' => '+43 123456', 'street' => 'Seestraße 12', 'postal_code' => '1010', 'city' => 'Wien', 'country' => 'AT',
|
||||
'notes' => 'Anreise am Abend', 'tags' => ['Familie'],
|
||||
])->assertHasNoActionErrors()->assertNotified('Gast zugeordnet');
|
||||
|
||||
$guest = Guest::query()->where('email', 'samira@example.test')->sole();
|
||||
$this->assertSame(['Seestraße 12', '1010', 'Wien', 'AT', '+43 123456', 'Anreise am Abend', ['Familie']], [$guest->street, $guest->postal_code, $guest->city, $guest->country, $guest->phone, $guest->notes, $guest->tags]);
|
||||
$this->assertSame($guest->id, $record->fresh()->guest_id);
|
||||
$this->assertEquals($before, $record->fresh()->only(array_keys($before)));
|
||||
Mail::assertNothingSent();
|
||||
}
|
||||
|
||||
public static function guestAssignmentSources(): array
|
||||
{
|
||||
return ['portal reservation' => ['portal'], 'own booking' => ['booking']];
|
||||
}
|
||||
|
||||
public function test_selecting_an_existing_guest_does_not_overwrite_their_contact_details(): void
|
||||
{
|
||||
$property = $this->property();
|
||||
$record = $this->import($property, ['ical_event_type' => 'portal_reservation']);
|
||||
$guest = Guest::factory()->create(['tenant_id' => $property->tenant_id, 'street' => 'Bestehende Straße 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE', 'notes' => 'Bestehende Notiz']);
|
||||
$before = $guest->only(['first_name', 'last_name', 'street', 'postal_code', 'city', 'country', 'notes']);
|
||||
|
||||
Livewire::test(ViewPortalOccupation::class, ['record' => $record->id])->callAction('assignGuest', [
|
||||
'mode' => 'existing', 'guest_id' => $guest->id, 'first_name' => 'Ersetzen', 'street' => 'Andere Straße', 'city' => 'Wien', 'country' => 'AT', 'notes' => 'Nicht übernehmen',
|
||||
])->assertHasNoActionErrors();
|
||||
|
||||
$this->assertEquals($before, $guest->fresh()->only(array_keys($before)));
|
||||
$this->assertSame($guest->id, $record->fresh()->guest_id);
|
||||
$this->assertSame(1, Guest::count());
|
||||
}
|
||||
|
||||
public function test_invalid_new_guest_address_does_not_leave_a_partial_guest_or_assignment(): void
|
||||
{
|
||||
$property = $this->property();
|
||||
$record = $this->import($property, ['ical_event_type' => 'portal_reservation']);
|
||||
|
||||
Livewire::test(ViewPortalOccupation::class, ['record' => $record->id])->callAction('assignGuest', [
|
||||
'mode' => 'new', 'first_name' => 'Samira', 'postal_code' => str_repeat('1', 21), 'country' => 'DE',
|
||||
])->assertHasActionErrors(['postal_code' => 'max']);
|
||||
|
||||
$this->assertSame(0, Guest::count());
|
||||
$this->assertNull($record->fresh()->guest_id);
|
||||
}
|
||||
|
||||
public function test_guest_assignment_survives_import_changes_archiving_and_return_with_same_uid(): void
|
||||
{
|
||||
$property = $this->property();
|
||||
|
||||
Reference in new issue
Block a user