@extends('dispatch.layout') @push('dispatch-css') @endpush @section('dispatch-content')
Order ID : {{ $item->request_number }}
{{--
--}}
Trip Details :

Vehicle Type : {{ $item->vehicle_type_name }}

Payment Details:

Payment Type : {{ $item->payment_opt == 1 ? 'Cash' : 'Card' }}

Amount : @if ($item->requestBill) {{ $item->currency . ' ' . $item->requestBill->total_amount }} @else - @endif

@if ($item->driverDetail)
Driver Details:

Name : {{ $item->driverDetail->name }}

Email : {{ $item->driverDetail->email }}

Phone : {{ $item->driverDetail->mobile }}

Stars : {{ $item->driverDetail->driverDetail->rating }}

@endif @if ($item->zoneType->vehicleType)
Vehicle Details:

Plate No : {{ $item->driverDetail ? $item->driverDetail->vehicle_number : '-' }}

Color : {{ $item->driverDetail ? $item->driverDetail->car_color : '-' }}

Type : {{ $item->vehicle_type_name }}

Make : {{ $item->driverDetail ? $item->driverDetail->carMake->name : '-' }}

Model : {{ $item->driverDetail ? $item->driverDetail->carModel->name : '-' }}

@endif
Customer Details :

Customer Detail :

Name : {{ $item->adHocuserDetail->name ?? $item->userDetail->name}}

Number : {{ $item->adHocuserDetail->mobile?? $item->userDetail->mobile }}

Activity Timeline :
    @if ($item->converted_created_at)
  • Request Made at :
    {{ $item->converted_created_at }}

  • @endif @if ($item->converted_accepted_at)
  • Accepted at :
    {{ $item->converted_accepted_at }}

  • @endif @if ($item->converted_arrived_at)
  • Arrived at :
    {{ $item->converted_arrived_at }}

  • @endif @if ($item->converted_trip_start_time)
  • Trip Started at :
    {{ $item->converted_trip_start_time }}

  • @endif @if ($item->converted_completed_at)
  • Reached to Drop location at :
    {{ $item->converted_completed_at }}

  • @endif
Pickup Details :

{{-- Coimbatore --}}

Location :
{{ $item->requestPlace->pick_address }}

Time :
{{ $item->converted_trip_start_time }}

Drop Details :

{{-- Coimbatore --}}

Location :
{{ $item->requestPlace->drop_address }}

Time :
{{ $item->converted_completed_at }}

@endsection }; // Initialize Firebase firebase.initializeApp(firebaseConfig); firebase.analytics(); var map = new google.maps.Map(document.getElementById('map'), { center: new google.maps.LatLng(default_lat, default_lng), zoom: 10, mapTypeId: 'roadmap', mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, position: google.maps.ControlPosition.TOP_CENTER, }, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.RIGHT_BOTTOM, }, scaleControl: true, streetViewControl: false, fullscreenControl: true, }); directionsRenderer.setMap(map); var iconBase = "{{ asset('map/icon/') }}"; var icons = { available: { name: 'Available', icon: iconBase + '/taxi1.svg' }, ontrip: { name: 'OnTrip', icon: iconBase + '/taxi.svg' }, pickup: { name: 'PickUp', icon: iconBase + '/driver_available.png' }, drop: { name: 'Drop', icon: iconBase + '/driver_on_trip.png' } }; var requestRef = firebase.database().ref('requests/'+requestId); requestRef.on('value', async function(snapshot) { var tripData = snapshot.val(); if (typeof tripData.request_id != 'undefined') { await loadDriverIcons(tripData); await getTripDetails(tripData.request_id); } }); function loadDriverIcons(val){ deleteAllMarkers(); var iconImg = icons['ontrip'].icon; var carIcon = new google.maps.Marker({ position: new google.maps.LatLng(val.lat, val.lng), icon: { url: iconImg, scaledSize: new google.maps.Size(40, 40) }, map: map }); marker.push(carIcon); carIcon.setMap(map); setTimeout(() => { rotateMarker(iconImg, val.bearing); }, 3000); } function getTripDetails(requestId){ var basePath = "{{ asset('storage/uploads/request/delivery-proof') }}/" if(requestId){ let url = "{{ url('dispatch/request') }}/"+requestId; fetch(url) .then(response => response.json()) .then(result => { if(result){ var pickLat = result.pick_lat var pickLng = result.pick_lng var dropLat = result.drop_lat var dropLng = result.drop_lng var pickUpLocation = new google.maps.LatLng(pickLat, pickLng); var dropLocation = new google.maps.LatLng(dropLat, dropLng); calcRoute(pickUpLocation, dropLocation) var activity = `
Activity Timeline :
`; $('.tripTimeline').html(activity); } }); } } // To rotate truck based on driver bearing function rotateMarker(carimage, bearing) { if(document.querySelectorAll(`img[src='${carimage}']`).length > 0) var bearing = Math.floor((Math.random() * 180) + 0); document.querySelectorAll(`img[src='${carimage}']`)[0].style.transform = 'rotate(' + bearing + 'deg)'; } // Delete truck icons once map reloads function deleteAllMarkers() { for (var i = 0; i < marker.length; i++) { marker[i].setMap(null); } } // Draw path from pickup to drop - map api function calcRoute(pickup, drop) { var request = { origin: pickup, destination: drop, travelMode: google.maps.TravelMode['DRIVING'] }; directionsService.route(request, function(response, status) { if (status == 'OK') { directionsRenderer.setDirections(response); var leg = response.routes[0].legs[0]; makeMarker(leg.start_location, icons['pickup'].icon, icons['pickup'].name, map); makeMarker(leg.end_location, icons['drop'].icon, icons['drop'].name, map); } }); } function makeMarker(position, icon, title, map) { new google.maps.Marker({ position: position, map: map, icon: icon, title: title }); } @endsection