@extends('layouts.agent') @section('page-title', 'Buses Schedules') @section('main-container')

@php $count_buses_availables = 1; @endphp @if(isset($route)) @if(count($route) > 0) @foreach($route as $route_details) @foreach($route_details->depature as $depature_details) @if($depature_details->depature_date == $departure_date_in && $depature_details->is_deleted == 0 && $depature_details->status == 0)
@csrf

{{$route_details->start_from}}({{$route_details->end_to}}) - {{$sub_routes->name}}


BUS TYPE

{{$depature_details->bus_type}}

{{Str::upper($depature_details->registration_number)}}

Departure

{{date_format(date_create($departure_date_in), 'd M Y')}}

{{date_format(date_create($depature_details->depature_time), 'H:i A')}}

VIA
{{$depature_details->via}}

Fare

{{number_format($sub_routes->fare, 2)}} TZS

@php $seat_active = count($depature_details->booking)-count($depature_details->booking->where('sit_number', 0)); @endphp
Total @php echo $depature_details->number_of_sit-$seat_active; @endphp Seat left

Available

VIP

Selected

Booked
@php $xs = $fvip = $founded = 0; $vipseats = explode(',', $depature_details->vip_seat); $totalvipseat = count($vipseats); @endphp @if($totalvipseat > 0) @for($ic = 1; $ic <= $depature_details->number_of_sit; $ic++) @foreach($depature_details->booking as $booking) @if($booking->sit_number == $ic)
{{$ic}}
@php $xs = $ic; break; @endphp @endif @endforeach @if($xs != $ic) @php $foundeds = 0; @endphp @for($vi = 0; $vi < $totalvipseat; $vi++) @if($ic == $vipseats[$vi])
{{$ic}}
@php $foundeds = 1; @endphp @endif @endfor @if($foundeds != 1)
{{$ic}}
@endif @endif @if($depature_details->number_of_sit == 47) @if($ic == 1 || $ic == 4)
@elseif($ic == 8 || $ic == 12 || $ic == 16 || $ic == 20 || $ic == 24 || $ic == 28 || $ic == 32 || $ic == 36 || $ic == 40)
@endif @elseif($depature_details->number_of_sit == 53) @if($ic == 2 || $ic == 6 || $ic == 10 || $ic == 14 || $ic == 18 || $ic == 22 || $ic == 26 || $ic == 30 || $ic == 34 || $ic == 38 || $ic == 42 || $ic == 46)
@endif @else @if($ic == 2 || $ic == 6 || $ic == 10 || $ic == 14 || $ic == 18 || $ic == 22 || $ic == 26 || $ic == 30 || $ic == 34 || $ic == 38 || $ic == 42 || $ic == 46 || $ic == 50)
@endif @endif @endfor @else @for($ic = 1; $ic <= $depature_details->number_of_sit; $ic++) @foreach($depature_details->booking as $booking) @if($booking->sit_number == $ic)
{{$ic}}
@php $xs = $ic; break; @endphp @endif @endforeach @if($xs == $ic) @else
{{$ic}}
@endif @if($depature_details->number_of_sit == 53) @if($ic == 2 || $ic == 6 || $ic == 10 || $ic == 14 || $ic == 18 || $ic == 22 || $ic == 26 || $ic == 30 || $ic == 34 || $ic == 38 || $ic == 42 || $ic == 46)
@endif @else @if($ic == 2 || $ic == 6 || $ic == 10 || $ic == 14 || $ic == 18 || $ic == 22 || $ic == 26 || $ic == 30 || $ic == 34 || $ic == 38 || $ic == 42 || $ic == 46 || $ic == 50)
@endif @endif @endfor @endif

Boarding Points

@foreach($boarding as $boarding_points) @if($route_details->id == $boarding_points->route_id)
{{$boarding_points->name}}
@endif @endforeach

Selected Seats Details

Schedule Summary

Start From: {{$route_details->start_from}}({{$route_details->end_to}})
Destination: {{$sub_routes->name}}
Vehicle Number: {{Str::upper($depature_details->registration_number)}}
Reporting Time: {{date_format(date_create($departure_date_in), 'd M Y')}} {{date_format(date_create($depature_details->report_time), 'H:i A')}}
Departure Time: {{date_format(date_create($departure_date_in), 'd M Y')}} {{date_format(date_create($depature_details->depature_time), 'H:i A')}}
Expected Arrival: {{date_format(date_create($depature_details->expected_arrival_time), 'd M Y H:i A')}}
Fare: {{number_format($sub_routes->fare, 2)}} TZS
@php $count_buses_availables = 0; @endphp @else @endif @endforeach @endforeach @else @endif @else @endif @if($count_buses_availables > 0)
@endif
@endsection @push('scripts') @endpush