Flights

Manage flight schedules and availability

@if(in_array(auth()->user()->role, ['admin', 'recruitment_agent'])) @endif

Total Flights

{{ $flights->total() }}

Scheduled

{{ $flights->where('status', 'scheduled')->count() }}

Avg Availability

{{ $flights->avg(function($flight) { return $flight->available_seats; }) ? round($flights->avg(function($flight) { return $flight->available_seats; })) : 0 }}

Avg Occupancy

{{ $flights->avg(function($flight) { return $flight->total_seats > 0 ? (($flight->total_seats - $flight->available_seats) / $flight->total_seats) * 100 : 0; }) ? round($flights->avg(function($flight) { return $flight->total_seats > 0 ? (($flight->total_seats - $flight->available_seats) / $flight->total_seats) * 100 : 0; })) : 0 }}%

@forelse($flights as $flight) @php $occupancyPercentage = $flight->total_seats > 0 ? (($flight->total_seats - $flight->available_seats) / $flight->total_seats) * 100 : 0; $occupancyColor = $occupancyPercentage >= 80 ? 'red' : ($occupancyPercentage >= 50 ? 'yellow' : 'green'); @endphp @empty @endforelse
Flight # Route Date Departure Seats Occupancy Status Actions
{{ $flight->flight_number }}
{{ $flight->airline }}
{{ $flight->departure_airport }} {{ $flight->arrival_airport }}
{{ $flight->route }}
{{ $flight->flight_date->format('M d, Y') }}
@if($flight->departure_time)
{{ \Carbon\Carbon::parse($flight->departure_time)->format('h:i A') }}
@else N/A @endif
{{ $flight->available_seats }}/{{ $flight->total_seats }}
{{ $flight->available_seats }} available
{{ round($occupancyPercentage) }}%
{{ ucfirst($flight->status) }}
@if(auth()->user()->role === 'admin')
@csrf @method('DELETE')
@endif

No flights found

Add your first flight to get started

{{ $flights->links() }}