@extends('admin.layouts.home') @section('title', 'Order Details') @section('styles') @endsection @section('content')

Order Details

Back to Orders

Order #{{ $order->order_number }}

@php $statusClass = [ 'pending' => 'bg-warning text-dark', 'processing' => 'bg-info text-white', 'shipped' => 'bg-primary', 'delivered' => 'bg-success', 'completed' => 'bg-success', 'cancelled' => 'bg-danger', ][$order->status] ?? 'bg-secondary'; @endphp {{ ucfirst($order->status) }} {{ $order->created_at->format('M d, Y H:i') }}

Payment Method: {{ ucfirst($order->payment_method ?? 'N/A') }}

Payment Status: @if($order->payment_status == 'paid') Paid @elseif($order->payment_status == 'pending') Pending @elseif($order->payment_status == 'failed') Failed @else {{ ucfirst($order->payment_status ?? 'N/A') }} @endif

Total Amount: ${{ number_format($order->total_amount, 2) }}

@if($order->discount_amount > 0)

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

@endif
Customer Information
@if($order->user)
@if($order->user->avatar) {{ $order->user->name }} @else
@endif
{{ $order->user->name }}

{{ $order->user->email }}

@else
Guest Order
@endif
Shipping Address
@if($order->address)
{{ $order->address->full_name }}
{{ $order->address->address_line1 }}
@if($order->address->address_line2) {{ $order->address->address_line2 }}
@endif {{ $order->address->city }}, {{ $order->address->state }} {{ $order->address->postal_code }}
{{ $order->address->country }}
P: {{ $order->address->phone }}
@else

No shipping address provided

@endif
Billing Address
@if($order->billing_address)
{{ $order->billing_address->full_name }}
{{ $order->billing_address->address_line1 }}
@if($order->billing_address->address_line2) {{ $order->billing_address->address_line2 }}
@endif {{ $order->billing_address->city }}, {{ $order->billing_address->state }} {{ $order->billing_address->postal_code }}
{{ $order->billing_address->country }}
P: {{ $order->billing_address->phone }}
@elseif($order->address)

Same as shipping address

@else

No billing address provided

@endif
Order Timeline
@php $isPending = in_array($order->status, ['pending', 'processing', 'shipped', 'delivered', 'completed']); $markerClass = $isPending ? 'completed' : ''; @endphp
Order Placed

{{ $order->created_at->format('M d, Y H:i') }}

@php $isProcessing = in_array($order->status, ['processing', 'shipped', 'delivered', 'completed']); $markerClass = $isProcessing ? 'completed' : ($order->status == 'pending' ? 'active' : ''); @endphp
Processing

@if($isProcessing) {{ $order->updated_at->format('M d, Y H:i') }} @else Waiting @endif

@php $isShipped = in_array($order->status, ['shipped', 'delivered', 'completed']); $markerClass = $isShipped ? 'completed' : ($order->status == 'processing' ? 'active' : ''); @endphp
Shipped

@if($isShipped) {{ $order->updated_at->format('M d, Y H:i') }} @else Waiting @endif

@php $isDelivered = in_array($order->status, ['delivered', 'completed']); $markerClass = $isDelivered ? 'completed' : ($order->status == 'shipped' ? 'active' : ''); @endphp
Delivered

@if($isDelivered) {{ $order->updated_at->format('M d, Y H:i') }} @else Waiting @endif

@php $isCompleted = $order->status == 'completed'; $isCancelled = $order->status == 'cancelled'; $markerClass = $isCompleted ? 'completed' : ($isCancelled ? 'cancelled' : ($order->status == 'delivered' ? 'active' : '')); @endphp
{{ $isCancelled ? 'Cancelled' : 'Completed' }}

@if($isCompleted || $isCancelled) {{ $order->updated_at->format('M d, Y H:i') }} @else Waiting @endif

Order Summary
Subtotal: ${{ number_format($order->subtotal ?? $order->total_amount, 2) }}
@if($order->tax_amount)
Tax: ${{ number_format($order->tax_amount, 2) }}
@endif @if($order->shipping_amount)
Shipping: ${{ number_format($order->shipping_amount, 2) }}
@endif @if($order->discount_amount)
Discount: -${{ number_format($order->discount_amount, 2) }}
@endif
Total: ${{ number_format($order->total_amount, 2) }}
@if($order->coupon_code)
Coupon Applied: {{ $order->coupon_code }}
@endif @if($order->notes)
Order Notes:

{{ $order->notes }}

@endif
Order Items
@foreach($order->products as $product) @endforeach @if($order->tax_amount) @endif @if($order->shipping_amount) @endif @if($order->discount_amount) @endif
Product Store Quantity Price Total
@if($product->thumbnail) {{ $product->name }} @else
@endif
{{ $product->name }}
SKU: {{ $product->sku ?? 'N/A' }}
@if($product->store) {{ $product->store->name }} @else N/A @endif {{ $product->pivot->quantity ?? 1 }} ${{ number_format($product->pivot->price ?? $product->price, 2) }} ${{ number_format(($product->pivot->price ?? $product->price) * ($product->pivot->quantity ?? 1), 2) }}
Subtotal: ${{ number_format($order->subtotal ?? $order->total_amount, 2) }}
Tax: ${{ number_format($order->tax_amount, 2) }}
Shipping: ${{ number_format($order->shipping_amount, 2) }}
Discount: -${{ number_format($order->discount_amount, 2) }}
Total: ${{ number_format($order->total_amount, 2) }}
@endsection