@extends('layouts.app') @section('title', 'Order #' . $order->order_number . ' โ€” Tracking') @section('content')
{{-- Order Header --}}

Order #{{ $order->order_number }}

Placed on {{ $order->created_at->format('d M Y, h:i A') }}

@auth @if($order->user_id === auth()->id()) ๐Ÿงพ Order Slip / Invoice @endif @endauth @php $statusColors = [ 'pending' => 'bg-yellow-100 text-yellow-800', 'confirmed' => 'bg-blue-100 text-blue-800', 'processing' => 'bg-indigo-100 text-indigo-800', 'shipped' => 'bg-purple-100 text-purple-800', 'delivered' => 'bg-green-100 text-green-800', 'completed' => 'bg-green-100 text-green-800', 'cancelled' => 'bg-red-100 text-red-800', ]; $color = $statusColors[$order->status] ?? 'bg-gray-100 text-gray-800'; @endphp {{ ucfirst($order->status) }}
{{-- Progress timeline --}} @php $steps = ['pending', 'confirmed', 'processing', 'shipped', 'delivered']; $current = array_search($order->status, $steps); $current = ($current === false) ? 0 : $current; @endphp
@foreach($steps as $i => $step)
@if($i < $current)โœ“@else{{ $i + 1 }}@endif
@unless($loop->last)
@endunless
@endforeach
{{-- Shipments --}} @forelse($trackingData as $tracking) @php $shipment = $tracking['shipment']; @endphp

Shipment Tracking

@if($shipment->awb) {{ $shipment->awb }} @endif
@if($shipment->tracking_url) ๐Ÿ”— Track on {{ ucfirst($shipment->provider) }} @endif @if($shipment->estimated_delivery)
๐Ÿšš Estimated delivery: {{ \Carbon\Carbon::parse($shipment->estimated_delivery)->format('l, d M Y') }}
@endif {{-- Tracking events --}} @if(!empty($tracking['events']))
@foreach($tracking['events'] as $event)
@unless($loop->last)
@endunless

{{ $event['status'] }}

@if(!empty($event['location']))

๐Ÿ“ {{ $event['location'] }}

@endif @if(!empty($event['timestamp']))

{{ $event['timestamp'] }}

@endif
@endforeach
@else

No tracking events yet. Check back soon.

@endif
@empty

Your order has not been shipped yet. We'll update you when it's on the way.

@endforelse
{{-- Order Summary --}}

Order Summary

@foreach($order->items as $item)
{{ $item->product_name }} ร— {{ $item->quantity }} NPR {{ number_format($item->total_price, 2) }}
@endforeach
Total NPR {{ number_format($order->total_amount, 2) }}
@if($order->shipping_address)

Shipping To

{{ $order->shipping_address['name'] ?? '' }}
{{ $order->shipping_address['line1'] ?? '' }}
{{ $order->shipping_address['city'] ?? '' }}, {{ $order->shipping_address['country'] ?? '' }}

@endif
{{-- Auto-refresh every 2 minutes --}} @endsection