@extends('layouts.customer') @section('customer-content')

Order #{{ $order->order_number }}

Back to Orders

Order Items

{{ ucfirst($order->status) }}
@foreach($order->items as $item) @endforeach
ProductWarehouseStatusQtyPriceSubtotal
@if($item->product) {{ $item->product->name }} @else {{ $item->product_name ?? 'Deleted Product' }} @endif @if(($item->warehouse ?? 'ghana') === 'china') 🇨🇳 China @else 🇬🇭 Ghana @endif @if(($item->warehouse ?? 'ghana') === 'china') @php $fStatus = $item->fulfillment_status ?? 'pending'; $fLabel = match($fStatus) { 'pending' => 'Awaiting freight', 'in_transit' => 'In transit', 'arrived' => 'Arrived in Ghana', 'shipped' => 'Shipped', 'delivered' => 'Delivered', default => 'Pending' }; @endphp {{ $fLabel }} @if($item->expected_arrival)

ETA: {{ $item->expected_arrival->format('M d') }}

@endif @else Ready to ship @endif
{{ $item->quantity }} {{ price($item->price) }} {{ price($item->subtotal) }}
@if($order->hasMixedWarehouses())

⚠️ This order has items from both warehouses

Ghana items ship immediately. China items will ship separately after freight arrival.

@endif

Subtotal: {{ price($order->subtotal) }}

@if($order->shipping_cost > 0)

Shipping: ${{ number_format($order->shipping_cost, 2) }}

@endif @if($order->discount > 0)

Discount: -${{ number_format($order->discount, 2) }}

@endif

Total: {{ price($order->total) }}

@if($order->status === 'delivered')

Review This Order

@csrf @foreach($order->items as $item)

{{ $item->product_name ?? ($item->product?->name ?? 'Deleted Product') }}

@for($i = 1; $i <= 5; $i++) @endfor
@endforeach
@endif

Order Details

Order Number:{{ $order->order_number }}
Date:{{ $order->created_at->format('M d, Y H:i') }}
Payment:{{ $order->payment_status }}
Payment Method:{{ $order->payment_method }}

Shipping Address

@php $addr = is_array($order->shipping_address) ? $order->shipping_address : json_decode($order->shipping_address, true); @endphp @if($addr)

{{ $addr['first_name'] }} {{ $addr['last_name'] }}

{{ $addr['address_line1'] }}

@if(!empty($addr['address_line2']))

{{ $addr['address_line2'] }}

@endif

{{ $addr['city'] }}, {{ $addr['state'] }} {{ $addr['postal_code'] }}

{{ $addr['country'] }}

@if(!empty($addr['phone']))

Phone: {{ $addr['phone'] }}

@endif @else

No shipping address available

@endif
@endsection