Hide a round trip's return leg from the Bookings list
Showing both legs as separate rows read as two unrelated bookings rather than one round trip. The list now only queries outbound/primary legs; the return leg is still reachable via the outbound leg's existing "Linked Leg" link on the detail page.
This commit is contained in:
@@ -344,6 +344,22 @@ test('a soft-deleted booking is hidden from the default list but visible via the
|
||||
->assertCanSeeTableRecords([$active, $deleted]);
|
||||
});
|
||||
|
||||
test('a round trip\'s return leg has no row of its own in the list, only its outbound leg', function () {
|
||||
$outbound = Booking::factory()->create(['is_return_leg' => false]);
|
||||
$return = Booking::factory()->create([
|
||||
'is_return_leg' => true,
|
||||
'linked_booking_id' => $outbound->id,
|
||||
]);
|
||||
$outbound->update(['linked_booking_id' => $return->id]);
|
||||
|
||||
// Showing both legs as separate rows read as two unrelated bookings
|
||||
// rather than one round trip — the return leg is still reachable via
|
||||
// the outbound leg's "Linked Leg" link on the detail page.
|
||||
Livewire::test(ListBookings::class)
|
||||
->assertCanSeeTableRecords([$outbound])
|
||||
->assertCanNotSeeTableRecords([$return]);
|
||||
});
|
||||
|
||||
test('the restore action is only visible for a trashed booking', function () {
|
||||
$active = Booking::factory()->create();
|
||||
$deleted = Booking::factory()->create();
|
||||
|
||||
Reference in New Issue
Block a user