@extends('layouts.app') @section('title', 'Track Order') @section('content') @php $currencySymbol = App\Models\AppSetting::getValue('currency_symbol', '₹'); $serviceType = $order->service_type ?? 'food'; $isParcelOrder = $serviceType === 'parcel'; $isTakeaway = ($order->order_type ?? 'delivery') === 'takeaway'; $steps = $isParcelOrder ? [ 'pending' => ['label' => 'Booking placed', 'icon' => 'fa-receipt'], 'confirmed' => ['label' => 'Booking confirmed', 'icon' => 'fa-circle-check'], 'preparing' => ['label' => 'Preparing pickup', 'icon' => 'fa-box'], 'ready_for_pickup' => ['label' => 'Ready for pickup', 'icon' => 'fa-box-open'], 'picked_up' => ['label' => 'Picked up by driver', 'icon' => 'fa-motorcycle'], 'on_the_way' => ['label' => 'Parcel in transit', 'icon' => 'fa-route'], 'delivered' => ['label' => 'Delivered', 'icon' => 'fa-circle-check'], ] : ($isTakeaway ? [ 'pending' => ['label' => 'Order placed', 'icon' => 'fa-receipt'], 'confirmed' => ['label' => 'Store accepted', 'icon' => 'fa-store'], 'preparing' => ['label' => 'Preparing food', 'icon' => 'fa-utensils'], 'ready_for_pickup' => ['label' => 'Ready to collect', 'icon' => 'fa-bag-shopping'], 'delivered' => ['label' => 'Picked up', 'icon' => 'fa-circle-check'], ] : [ 'pending' => ['label' => 'Order placed', 'icon' => 'fa-receipt'], 'confirmed' => ['label' => 'Store accepted', 'icon' => 'fa-store'], 'preparing' => ['label' => 'Preparing food', 'icon' => 'fa-utensils'], 'ready_for_pickup' => ['label' => 'Ready for pickup', 'icon' => 'fa-bag-shopping'], 'picked_up' => ['label' => 'Picked up by driver', 'icon' => 'fa-motorcycle'], 'on_the_way' => ['label' => 'Out for delivery', 'icon' => 'fa-route'], 'delivered' => ['label' => 'Delivered', 'icon' => 'fa-circle-check'], ]); $statusOrder = array_keys($steps); $currentStatus = $isTakeaway && $order->status === 'picked_up' ? 'delivered' : $order->status; $currentIndex = array_search($currentStatus, $statusOrder, true); $currentIndex = $currentIndex === false ? 0 : $currentIndex; @endphp