Intégration fonctionnalites V1

This commit is contained in:
bastien
2026-07-04 22:30:18 +02:00
parent 55a558b536
commit 10ee859602
54 changed files with 4802 additions and 1018 deletions
@@ -19,6 +19,8 @@ class BookingPageController extends Controller
->with(['user:id,first_name,last_name,email', 'machine:id,uuid,name,establishment_id', 'machine.establishment:id,name']);
$this->scopeMachineRelationQuery($query);
$this->applyEstablishmentFilter($request, $query, 'machine');
$this->applyUserSearchFilter($request, $query);
if ($request->filled('status')) {
$query->where('status', $request->string('status'));
@@ -29,8 +31,14 @@ class BookingPageController extends Controller
}
$bookings = $query
->orderByDesc('slot_start')
->paginate(20)
->tap(fn ($builder) => $this->applySort($request, $builder, [
'slot_start' => 'bookings.slot_start',
'user' => fn ($builder, string $direction) => $this->sortByRelatedUser($builder, 'bookings', 'user_id', $direction),
'machine' => fn ($builder, string $direction) => $this->sortByRelatedMachine($builder, 'bookings', $direction),
'status' => 'bookings.status',
'booking_fee' => 'bookings.booking_fee',
], 'slot_start', 'desc'))
->paginate($this->supervisorListPerPage($request))
->withQueryString()
->through(fn (Booking $booking) => [
'uuid' => $booking->uuid,
@@ -54,9 +62,15 @@ class BookingPageController extends Controller
return Inertia::render('Supervisor/Bookings/Index', [
'bookings' => $bookings,
'establishments' => $this->establishmentOptions(),
'filters' => [
'establishment_id' => $request->filled('establishment_id') ? (int) $request->input('establishment_id') : null,
'user' => $request->string('user')->toString() ?: null,
'status' => $request->string('status')->toString() ?: null,
'date' => $request->string('date')->toString() ?: null,
'sort' => $request->string('sort')->toString() ?: 'slot_start',
'direction' => $request->string('direction')->toString() === 'asc' ? 'asc' : 'desc',
'per_page' => $this->supervisorListPerPage($request),
],
'statusOptions' => $this->statusOptions(),
]);