from django.shortcuts import render, HttpResponse

import requests
from django.http import HttpResponse
import json
from django.http import JsonResponse
from random import uniform
import datetime
from collections import defaultdict


def get_users_data():
    try:
        response = requests.get(
            'http://210.56.21.197/trucking/index.php/Api/adminLogin')
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data


def get_monthly_graph_data(month):
    try:
        # Convert month name to month id (if needed)
        print(month)

        # Make a POST request with the month parameter
        response = requests.post(
            'http://210.56.21.197/trucking/index.php/Api/shipmentGraph',
            data={'month': month}
        )
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data


def get_drivers_data():
    try:
        response = requests.get(
            'http://210.56.21.197/trucking/index.php/Api/getDriverDetails')
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data


def get_shiper_data():
    try:
        response = requests.get(
            'http://210.56.21.197/trucking/index.php/Api/getShipperDetails')
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data


def get_pending_order_data():
    try:
        response = requests.get(
            'http://210.56.21.197/trucking/index.php/Api/getAllOrdersInWaiting')
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data


def get_inprogress_order_data():
    try:
        response = requests.get(
            'http://210.56.21.197/trucking/index.php/Api/getAllOrdersInProgress')
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data


def completed_order_data():
    try:
        response = requests.get(
            'http://210.56.21.197/trucking/index.php/Api/getAllOrdersCompleted')
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data


def cancelled_order_data():
    try:
        response = requests.get(
            'http://210.56.21.197/trucking/index.php/Api/getAllOrdersCancelled')
        response.raise_for_status()  # Raises HTTPError for bad responses
        data_send = response.json()
        data = data_send.get('response', [])

    except requests.exceptions.RequestException as e:
        print(f"Error fetching data: {e}")
        data = []  # Empty list in case of an exception

    return data

# Create your views here.


def dashboard(request):
    # Get the current date
    current_date = datetime.date.today()

    # Extract the month from the current date
    current_month = current_date.strftime("%B")

    print("Current Month:", current_month)

    userData = get_users_data()
    if userData:  # Check if userData is not None or empty

        shipper_count = userData.get('shipper_count', 0)
        driver_count = userData.get('driver_count', 0)
        pending_order_count = userData.get('pending_order_count', 0)
        shipment_process_count = userData.get('shipment_process_count', 0)
        completed_Count = userData.get('completed_Count', 0)
        cancelled_Count = userData.get('cancelled_Count', 0)
        graph_data = userData.get('graph_data', [])
        # graph_data = [{'2024-03-01': {'1': 10, '2': 3, '3': 4, '4': 7}, '2024-03-02': {'1': 60, '2': 1, '3': 2, '4': 1}, '2024-03-03': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-04': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-05': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-06': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-07': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-08': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-09': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-10': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-11': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-12': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-13': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-14': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-15': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-16': {
        #     '1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-17': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-18': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-19': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-20': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-21': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-22': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-23': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-24': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-25': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-26': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-27': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-28': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-29': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-30': {'1': 0, '2': 0, '3': 0, '4': 0}, '2024-03-31': {'1': 0, '2': 0, '3': 0, '4': 0}}]

        # Iterate through each date in graph_data

        waiting = []
        shipping = []
        completed = []
        cancelled = []
        total_orders = []
        dates = []

        for day_data in graph_data:
            for date, states in day_data.items():
                waiting_count = states.get('1', 0)
                shipping_count = states.get('2', 0)
                completed_count = states.get('3', 0)
                cancelled_count = states.get('4', 0)

                waiting.append((waiting_count))
                shipping.append((shipping_count))
                completed.append((completed_count))
                cancelled.append((cancelled_count))

                total_order_count = waiting_count + \
                    shipping_count + completed_count + cancelled_count
                total_orders.append((total_order_count))
                dates.append(date)

        print(total_orders)
        print(dates)

    else:
        # Handle the case when userData is null or empty
        # For example, you can assign default values to the counts
        shipper_count = 0
        driver_count = 0
        pending_order_count = 0
        shipment_process_count = 0
        completed_Count = 0
        cancelled_Count = 0
        waiting = []
        shipping = []
        completed = []
        cancelled = []
        total_orders = []
        dates = []

     # Initialize series_data

    series_data = {
        "Total": total_orders,
        "Waiting": waiting,
        "In progress": shipping,
        "Delivered": completed,
        "Cancelled": cancelled,
    }

    labels = [
        "Incorrect address",
        "Weather conditions",
        "Federal Holidays",
        "Damage during transit",
    ]
    series = [40, 25, 15, 20]
    avg_exceptions = "11%"

    return render(request, 'dashboard.html', {
        'userData': userData,
        'shipper_count': shipper_count,
        'driver_count': driver_count,
        'pending_order_count': pending_order_count,
        'shipment_process_count': shipment_process_count,
        'completed_Count': completed_Count,
        'cancelled_Count': cancelled_Count,
        'series_data': series_data,
        'categories': dates,
        'current_month': current_month,
        'labels': labels,
        'series': series,
        'avg_exceptions': avg_exceptions,
    })


def updateGraph(request):
    if request.method == 'POST' and request.headers.get('x-requested-with') == 'XMLHttpRequest':
        try:
            # Process the POST data
            data = json.loads(request.body)
            month = data['month']
            print(month)

            # Make a request to the external API
            api_url = 'http://210.56.21.197/trucking/index.php/Api/shipmentGraph'
            payload = {
                'month': month
            }
            response = requests.post(api_url, json=payload)

            # Check the response from the external API
            if response.ok:
                # API request successful
                print("API request successful")
                data = response.json()
                waiting = []
                shipping = []
                completed = []
                cancelled = []
                total_orders = []
                dates = []

                if data:

                    graph_data = data['response']

                    if graph_data:
                        # print(graph_data)
                        for day_data in graph_data:
                            for date, states in day_data.items():
                                waiting_count = states.get('1', 0)
                                shipping_count = states.get('2', 0)
                                completed_count = states.get('3', 0)
                                cancelled_count = states.get('4', 0)

                                waiting.append((waiting_count))
                                shipping.append((shipping_count))
                                completed.append((completed_count))
                                cancelled.append((cancelled_count))

                                total_order_count = waiting_count + \
                                    shipping_count + completed_count + cancelled_count
                                total_orders.append((total_order_count))
                                dates.append(date)

                        print(total_orders)
                        print(dates)

                series_data = {
                    "Total": total_orders,
                    "Waiting": waiting,
                    "In progress": shipping,
                    "Delivered": completed,
                    "Cancelled": cancelled,
                }

                return JsonResponse({'status': 'success', 'series_data': series_data,
                                     'categories': dates})
            else:
                # API request failed
                return JsonResponse({'status': 'failure', 'message': 'Failed to connect to external API'})
        except Exception as e:
            # Handle any exceptions
            return JsonResponse({'status': 'failure', 'message': str(e)})
    else:
        # Return a JsonResponse with an error message if the request is not valid
        return JsonResponse({'error': 'Invalid request'})


def shiperDetails(request):
    shipperData = get_shiper_data()
    print(shipperData)
    if shipperData:
        return render(request, 'shiper_list.html', {'shipper_data_list': shipperData})
    else:
        # Passing an empty list if data is not found
        return render(request, 'shiper_list.html', {'shipper_data_list': []})


def driverDetails(request):
    driverData = get_drivers_data()
    print(driverData)
    if driverData:
        return render(request, 'driver_list.html', {'driver_data_list': driverData})
    else:
        # Passing an empty list if data is not found
        return render(request, 'driver_list.html', {'driver_data_list': []})


def pendingOrders(request):
    pendingOrdersData = get_pending_order_data()
    # Check if pendingOrdersData is not empty before passing it to the template
    if pendingOrdersData:
        return render(request, 'pendingOrderDetails.html', {'pending_orders_data': pendingOrdersData})
    else:
        # Passing an empty list if data is not found
        return render(request, 'pendingOrderDetails.html', {'pending_orders_data': []})


def inprogressOrders(request):
    inprogressOrdersData = get_inprogress_order_data()

    # Check if pendingOrdersData is not empty before passing it to the template
    if inprogressOrdersData:
        return render(request, 'inprogressOrderDetails.html', {'inprogress_orders_data': inprogressOrdersData})
    else:
        # Passing an empty list if data is not found
        return render(request, 'inprogressOrderDetails.html', {'inprogress_orders_data': []})


def completedOrders(request):
    completedOrdersData = completed_order_data()

    # Check if pendingOrdersData is not empty before passing it to the template
    if completedOrdersData:
        return render(request, 'completedOrderDetails.html', {'completed_order_data': completedOrdersData})
    else:
        # Passing an empty list if data is not found
        return render(request, 'completedOrderDetails.html', {'completed_order_data': []})


def cancelledOrders(request):
    cancelledOrdersData = cancelled_order_data()
    print(cancelledOrdersData)
    # Check if pendingOrdersData is not empty before passing it to the template
    if cancelledOrdersData:
        return render(request, 'cancelledOrderDetails.html', {'cancelled_order_data':  cancelledOrdersData})
    else:
        # Passing an empty list if data is not found
        return render(request, 'cancelledOrderDetails.html', {'cancelled_order_data': []})


def ordersTracking(request):

    return render(request, 'orderTracking.html')


def pendingOrdersTracking(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    orderDelivery = request.GET.get('orderDelivery')
    print(orderDelivery)
    driverName = request.GET.get('driverName')
    print(driverName)
    driverEmail = request.GET.get('driverEmail')
    print(driverEmail)
    driverPhone = request.GET.get('driverPhone')
    print(driverPhone)

    # Your code to retrieve location coordinates
    origin_lat = 31.5204
    origin_lng = 74.3587
    destination_lat = 30.1575
    destination_lng = 71.5249

    return render(request, 'pendingOrderTracking.html', {'order_id': orderId, 'order_price': orderPrice, 'order_delivery_time': orderDelivery, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, 'origin_lat': origin_lat,
                                                         'origin_lng': origin_lng,
                                                         'destination_lat': destination_lat,
                                                         'destination_lng': destination_lng})


def inprogressOrdersTracking(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    orderDelivery = request.GET.get('orderDelivery')
    print(orderDelivery)
    driverName = request.GET.get('driverName')
    print(driverName)
    driverEmail = request.GET.get('driverEmail')
    print(driverEmail)
    driverPhone = request.GET.get('driverPhone')
    print(driverPhone)

    # Assuming you have retrieved these values from your database or other source
    origin_lat = 31.5497
    origin_lng = 74.3436
    destination_lat = 24.8607
    destination_lng = 67.0011
    driver_lat = 30.1956
    driver_lng = 71.4753

    return render(request, 'inprogressOrderTracking.html', {'order_id': orderId, 'order_price': orderPrice, 'order_delivery_time': orderDelivery, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, 'origin_lat': origin_lat,
                                                            'origin_lng': origin_lng,
                                                            'destination_lat': destination_lat,
                                                            'destination_lng': destination_lng,
                                                            'driver_lat': driver_lat,
                                                            'driver_lng': driver_lng, })


def completedOrdersTracking(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    orderDelivery = request.GET.get('orderDelivery')
    orderDelivered = request.GET.get('orderDelivered')
    print(orderDelivery)
    driverName = request.GET.get('driverName')
    print(driverName)
    driverEmail = request.GET.get('driverEmail')
    print(driverEmail)
    driverPhone = request.GET.get('driverPhone')
    print(driverPhone)

    # Your code to retrieve location coordinates
    origin_lat = 31.5204
    origin_lng = 74.3587
    destination_lat = 30.1575
    destination_lng = 71.5249

    return render(request, 'completedOrderTracking.html', {'order_id': orderId, 'order_price': orderPrice, 'order_delivery_time': orderDelivery, 'order_delivered': orderDelivered, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, 'origin_lat': origin_lat,
                                                           'origin_lng': origin_lng,
                                                           'destination_lat': destination_lat,
                                                           'destination_lng': destination_lng})


def cancelledOrdersTracking(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    orderDelivery = request.GET.get('orderDelivery')
    cancelledReason = request.GET.get('cancelledReason')
    print(orderDelivery)
    driverName = request.GET.get('driverName')
    print(driverName)
    driverEmail = request.GET.get('driverEmail')
    print(driverEmail)
    driverPhone = request.GET.get('driverPhone')
    print(driverPhone)

    # Your code to retrieve location coordinates
    origin_lat = 31.5204
    origin_lng = 74.3587
    destination_lat = 30.1575
    destination_lng = 71.5249

    return render(request, 'cancelledOrderTracking.html', {'order_id': orderId, 'order_price': orderPrice, 'order_delivery_time': orderDelivery, 'cancelled_reason': cancelledReason, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, 'origin_lat': origin_lat,
                                                           'origin_lng': origin_lng,
                                                           'destination_lat': destination_lat,
                                                           'destination_lng': destination_lng})


def update_shiper_state(request):
    if request.method == 'POST' and request.headers.get('x-requested-with') == 'XMLHttpRequest':
        try:
            # Process the POST data
            data = json.loads(request.body)
            user_id = data['user_id']
            account_state = data['account_state']

            # Make a request to the external API
            api_url = 'http://210.56.21.197/trucking/index.php/Api/updateUserState'
            payload = {
                'user_id': user_id,
                'account_state': account_state
            }
            response = requests.post(api_url, json=payload)

            # Check the response from the external API
            if response.ok:
                # API request successful\
                shipperData = get_shiper_data()

                return JsonResponse({'status': 'success', 'shipper_data_list': shipperData})
            else:
                # API request failed
                return JsonResponse({'status': 'failure', 'message': 'Failed to connect to external API'})
        except Exception as e:
            # Handle any exceptions
            return JsonResponse({'status': 'failure', 'message': str(e)})
    else:
        # Return a JsonResponse with an error message if the request is not valid
        return JsonResponse({'error': 'Invalid request'})


def update_driver_state(request):

    if request.method == 'POST' and request.headers.get('x-requested-with') == 'XMLHttpRequest':
        try:
            # Process the POST data
            data = json.loads(request.body)
            user_id = data['user_id']
            account_state = data['account_state']

            # Make a request to the external API
            api_url = 'http://210.56.21.197/trucking/index.php/Api/updateUserState'
            payload = {
                'user_id': user_id,
                'account_state': account_state
            }
            response = requests.post(api_url, json=payload)

            # Check the response from the external API
            if response.ok:
                # API request successful
                driverData = get_drivers_data()

                return JsonResponse({'status': 'success', 'driver_data_list': driverData})
            else:
                # API request failed
                return JsonResponse({'status': 'failure', 'message': 'Failed to connect to external API'})
        except Exception as e:
            # Handle any exceptions
            return JsonResponse({'status': 'failure', 'message': str(e)})
    else:
        # Return a JsonResponse with an error message if the request is not valid
        return JsonResponse({'error': 'Invalid request'})


def pending_details(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    orderTime = request.GET.get('ordertime')
    orderDelivery = request.GET.get('orderDelivery')
    pickupAddress = request.GET.get('pickupAddress')
    destinationAddress = request.GET.get('destinationAddress')
    isFullTruck = request.GET.get('isFullTruck')
    cargoType = request.GET.get('cargoType')
    cargoSize = request.GET.get('cargoSize')
    cargoWeight = request.GET.get('cargoWeight')
    driverName = request.GET.get('driverName')
    driverEmail = request.GET.get('driverEmail')
    driverPhone = request.GET.get('driverPhone')
    shipperName = request.GET.get('shipperName')
    shipperEmail = request.GET.get('shipperEmail')
    shipperPhone = request.GET.get('shipperPhone')

    return render(request, 'pendingOrderMoreDetails.html', {'order_id': orderId, 'order_price': orderPrice, 'order_time': orderTime, 'order_delivery_time': orderDelivery, 'pickup_address': pickupAddress, 'destination_address': destinationAddress, 'is_full_truck': isFullTruck, 'cargo_type': cargoType, 'cargo_size': cargoSize, 'cargo_weight': cargoWeight, 'shipper_name': shipperName, 'shipper_email': shipperEmail, 'shipper_phone': shipperPhone, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, })


def inprogress_details(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    orderTime = request.GET.get('ordertime')
    orderDelivery = request.GET.get('orderDelivery')
    orderPickup = request.GET.get('orderPickup')
    pickupAddress = request.GET.get('pickupAddress')
    destinationAddress = request.GET.get('destinationAddress')
    isFullTruck = request.GET.get('isFullTruck')
    cargoType = request.GET.get('cargoType')
    cargoSize = request.GET.get('cargoSize')
    cargoWeight = request.GET.get('cargoWeight')
    driverName = request.GET.get('driverName')
    driverEmail = request.GET.get('driverEmail')
    driverPhone = request.GET.get('driverPhone')
    shipperName = request.GET.get('shipperName')
    shipperEmail = request.GET.get('shipperEmail')
    shipperPhone = request.GET.get('shipperPhone')

    return render(request, 'inprogressOrderMoreDetails.html', {'order_id': orderId, 'order_price': orderPrice, 'order_time': orderTime, 'order_delivery_time': orderDelivery, 'order_pickup': orderPickup, 'pickup_address': pickupAddress, 'destination_address': destinationAddress, 'is_full_truck': isFullTruck, 'cargo_type': cargoType, 'cargo_size': cargoSize, 'cargo_weight': cargoWeight, 'shipper_name': shipperName, 'shipper_email': shipperEmail, 'shipper_phone': shipperPhone, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, })


def completed_details(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    orderTime = request.GET.get('ordertime')
    orderDelivery = request.GET.get('orderDelivery')
    orderPickup = request.GET.get('orderPickup')
    orderDeleverd = request.GET.get('orderDeleverd')
    pickupAddress = request.GET.get('pickupAddress')
    destinationAddress = request.GET.get('destinationAddress')
    isFullTruck = request.GET.get('isFullTruck')
    cargoType = request.GET.get('cargoType')
    cargoSize = request.GET.get('cargoSize')
    cargoWeight = request.GET.get('cargoWeight')
    driverName = request.GET.get('driverName')
    driverEmail = request.GET.get('driverEmail')
    driverPhone = request.GET.get('driverPhone')
    shipperName = request.GET.get('shipperName')
    shipperEmail = request.GET.get('shipperEmail')
    shipperPhone = request.GET.get('shipperPhone')

    return render(request, 'completedOrderMoreDetails.html', {'order_id': orderId, 'order_price': orderPrice, 'order_time': orderTime, 'order_delivery_time': orderDelivery, 'order_pickup': orderPickup, 'order_deleverd': orderDeleverd, 'pickup_address': pickupAddress, 'destination_address': destinationAddress, 'is_full_truck': isFullTruck, 'cargo_type': cargoType, 'cargo_size': cargoSize, 'cargo_weight': cargoWeight, 'shipper_name': shipperName, 'shipper_email': shipperEmail, 'shipper_phone': shipperPhone, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, })


def cancelled_details(request):
    orderId = request.GET.get('orderId')
    orderPrice = request.GET.get('orderPrice')
    exceptionReason = request.GET.get('exceptionReason')
    orderTime = request.GET.get('ordertime')
    orderDelivery = request.GET.get('orderDelivery')
    pickupAddress = request.GET.get('pickupAddress')
    destinationAddress = request.GET.get('destinationAddress')
    isFullTruck = request.GET.get('isFullTruck')
    cargoType = request.GET.get('cargoType')
    cargoSize = request.GET.get('cargoSize')
    cargoWeight = request.GET.get('cargoWeight')
    driverName = request.GET.get('driverName')
    driverEmail = request.GET.get('driverEmail')
    driverPhone = request.GET.get('driverPhone')
    shipperName = request.GET.get('shipperName')
    shipperEmail = request.GET.get('shipperEmail')
    shipperPhone = request.GET.get('shipperPhone')

    return render(request, 'cancelledOrderMoreDetails.html', {'order_id': orderId, 'order_price': orderPrice, 'exception_reason': exceptionReason, 'order_time': orderTime, 'order_delivery_time': orderDelivery, 'pickup_address': pickupAddress, 'destination_address': destinationAddress, 'is_full_truck': isFullTruck, 'cargo_type': cargoType, 'cargo_size': cargoSize, 'cargo_weight': cargoWeight, 'shipper_name': shipperName, 'shipper_email': shipperEmail, 'shipper_phone': shipperPhone, 'driver_name': driverName, 'driver_email': driverEmail, 'driver_phone': driverPhone, })
