@extends('layouts.site') @section('title', 'Track Your Order — pcfy.in') @section('screen_label', 'Track Order') @section('page_css') @endsection @section('content')

Track Your Order

Enter your order number and the email or phone used while ordering to see live status.

{{-- Lookup form --}}
@if(session('error'))
{{ session('error') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif
@csrf
@if($searched && $order) @php $statuses = \App\Models\Order::statuses(); // 'cancelled' is a terminal state shown separately, not part of the progress timeline $timeline = ['pending', 'confirmed', 'processing', 'shipped', 'delivered']; $currentIndex = array_search($order->status, $timeline); $isCancelled = $order->status === 'cancelled'; $latestShipment = $order->shipments->first(); @endphp
{{-- Order header --}}
Order Number
{{ $order->order_number }}
Placed on
{{ $order->created_at->format('d M Y') }}
@if($isCancelled)
✕ This order has been cancelled.
@else {{-- Interactive status timeline --}}
Order Status
@foreach($timeline as $i => $step) @php $done = $i < $currentIndex; $active = $i === $currentIndex; $icon = match($step) { 'pending' => '🕐', 'confirmed' => '✓', 'processing' => '⚙', 'shipped' => '🚚', 'delivered' => '📦', default => '•', }; @endphp
@if($i > 0)
@endif
{{ $done ? '✓' : $icon }}
{{ \App\Models\Order::statusLabel($step) }}
@if($active)
Current
@endif
@endforeach
@if($order->estimated_delivery_date && $order->status !== 'delivered')
Estimated delivery: {{ $order->estimated_delivery_date->format('d M Y') }}
@endif
{{-- Shipment tracking --}} @if($latestShipment)
Shipment Details
@if($latestShipment->courier_name)
Courier
{{ $latestShipment->courier_name }}
@endif @if($latestShipment->tracking_number)
Tracking No.
{{ $latestShipment->tracking_number }}
@endif
Status
{{ \App\Models\OrderShipment::statusLabel($latestShipment->status) }}
@if($latestShipment->estimated_delivery)
Est. Delivery
{{ $latestShipment->estimated_delivery->format('d M Y') }}
@endif
@if($latestShipment->tracking_url) Track on courier site → @endif @if($latestShipment->notes)
{{ $latestShipment->notes }}
@endif
@endif @endif {{-- Order items --}}
Order Items
@foreach($order->items as $item) @endforeach
Product Qty Unit Price Total
{{ $item->product_name }}
@if($item->product_sku)
SKU: {{ $item->product_sku }}
@endif
{{ $item->quantity }} ₹{{ number_format($item->unit_price/100, 0, '.', ',') }} {{ $item->line_total_inr }}
@if($order->gst_amount > 0)
GST ({{ $order->gst_percent }}%): {{ $order->gst_amount_inr }}
@endif @if($order->discount_amount > 0)
{{ $order->discount_label ?: 'Discount' }}: − {{ $order->discount_amount_inr }}
@endif @if($order->shipping_amount > 0)
{{ $order->shipping_label ?: 'Shipping' }}: {{ $order->shipping_amount_inr }}
@endif
Grand Total: {{ $order->grand_total_inr }}
{{-- Payment status --}}
Payment Status
{{ \App\Models\Order::paymentLabel($order->payment_status) }}
@endif
@endsection