@extends('layouts.app') @section('title', 'Manage Bookings') @section('content')

All Bookings

@php // Custom status order $statusOrder = ['Pending' => 1, 'Approved' => 2, 'Returned' => 3, 'Rejected' => 4]; // Sort by status first, then by booking date $bookings = $bookings->sortBy(function ($booking) use ($statusOrder) { return sprintf( '%d-%s', $statusOrder[$booking->status] ?? 99, $booking->date_of_booking ); }); @endphp @foreach ($bookings as $booking) @endforeach
User Equipment Quantity Booking Date Booking Time Return Date Return Time Location Status Action
{{ $booking->user->name }} {{ $booking->equipment->name }} {{ $booking->quantity }} {{ \Carbon\Carbon::parse($booking->date_of_booking)->format('F j, Y') }} {{ $booking->booking_time ?? '-' }} {{ \Carbon\Carbon::parse($booking->date_of_return)->format('F j, Y') }} {{ $booking->return_time ?? '-' }} {{ $booking->location ?? '-' }} {{ $booking->status ?? 'Pending' }} @if ($booking->status == 'Pending' || $booking->status == 'Rejected')
@csrf
@elseif ($booking->status == 'Approved')
@csrf
@endif
@csrf @method('DELETE')
@endsection