@extends('layouts.app') @section('title', 'Order #' . $order->order_number) @section('content')

Order #{{ $order->order_number }}

@if($order->store) Store: {{ $order->store->name }} (WooCommerce) @elseif($order->webhookSource) Source: {{ $order->webhookSource->name }} ({{ ucfirst($order->webhookSource->type) }} Webhook) @else Source: Unknown @endif

Order Information

Status
@php $statusColors = [ 'processing' => 'yellow', 'completed' => 'green', 'pending' => 'gray', 'on-hold' => 'orange', 'cancelled' => 'red', 'refunded' => 'purple', 'failed' => 'red' ]; $color = $statusColors[$order->status] ?? 'gray'; @endphp {{ ucfirst($order->status) }}
Payment Method
{{ $order->payment_method_title }}
Order Date
{{ $order->date_created ? $order->date_created->format('M d, Y H:i') : 'N/A' }}
Modified Date
{{ $order->date_modified ? $order->date_modified->format('M d, Y H:i') : 'N/A' }}

Order Items

@if(is_array($order->line_items)) @foreach($order->getExpandedLineItems() as $expandedItem) @php $item = $expandedItem['item']; $isBundle = $expandedItem['is_bundle']; $bundleDetails = $expandedItem['bundle_details']; @endphp @endforeach @endif @if($order->shipping_total > 0) @endif @if($order->calculated_fee > 0) @endif @if($order->discount_total > 0) @endif
Item Price Qty Total
{{ $item['name'] ?? 'N/A' }} @if($isBundle) BUNDLE @endif
@if(isset($item['sku']))
SKU: {{ $item['sku'] }}
@endif @if($isBundle && $bundleDetails)
@foreach($bundleDetails['items'] as $bundleItem)
- {{ $bundleItem['name'] ?? $bundleItem['sku'] }} x{{ $bundleItem['quantity'] }} @if(isset($bundleItem['sku']) && $bundleItem['sku']) ({{ $bundleItem['sku'] }}) @endif
@endforeach
@endif
{{ $order->formatCurrency($item['price'] ?? 0) }} {{ $item['quantity'] ?? 0 }} {{ $order->formatCurrency($item['total'] ?? 0) }}
Subtotal: {{ $order->formatCurrency($order->calculated_subtotal) }}
Shipping{{ $order->shipping_method_title ? ' (' . $order->shipping_method_title . ')' : '' }}: {{ $order->formatCurrency($order->shipping_total) }}
Processing Fee: {{ $order->formatCurrency($order->calculated_fee) }}
Discount: -{{ $order->formatCurrency($order->discount_total) }}
Total: {{ $order->formatCurrency() }}
@if($order->notes)

Customer Notes

{{ $order->notes }}

@endif

Billing Details

Name
@php // Support both WooCommerce format (first_name/last_name) and sales page format (name) $billingName = $order->billing['name'] ?? trim(($order->billing['first_name'] ?? '') . ' ' . ($order->billing['last_name'] ?? '')); @endphp
{{ $billingName }}
Email
{{ $order->billing['email'] ?? 'N/A' }}
Phone
{{ App\Helpers\PhoneHelper::display($order->billing['phone'] ?? null) ?? 'N/A' }} @if(!empty($order->billing['phone'])) WhatsApp @endif
Address
@php // Support both WooCommerce format (address_1) and sales page format (address) $billingAddress1 = $order->billing['address_1'] ?? $order->billing['address'] ?? ''; $billingAddress2 = $order->billing['address_2'] ?? ''; @endphp
{{ $billingAddress1 }}
@if($billingAddress2) {{ $billingAddress2 }}
@endif {{ $order->billing['city'] ?? '' }}, {{ $order->billing['state'] ?? '' }}
{{ $order->billing['postcode'] ?? '' }}
{{ $order->billing['country'] ?? '' }}

Shipping Details

Name
@php // Support both WooCommerce format (first_name/last_name) and sales page format (name) $shippingName = $order->shipping['name'] ?? $order->billing['name'] ?? trim(($order->shipping['first_name'] ?? $order->billing['first_name'] ?? '') . ' ' . ($order->shipping['last_name'] ?? $order->billing['last_name'] ?? '')); @endphp
{{ $shippingName }}
Address
@php // Support both WooCommerce format (address_1) and sales page format (address) $shippingAddress1 = $order->shipping['address_1'] ?? $order->shipping['address'] ?? $order->billing['address_1'] ?? $order->billing['address'] ?? ''; $shippingAddress2 = $order->shipping['address_2'] ?? $order->billing['address_2'] ?? ''; @endphp
{{ $shippingAddress1 }}
@if($shippingAddress2) {{ $shippingAddress2 }}
@endif {{ $order->shipping['city'] ?? $order->billing['city'] ?? '' }}, {{ $order->shipping['state'] ?? $order->billing['state'] ?? '' }}
{{ $order->shipping['postcode'] ?? $order->billing['postcode'] ?? '' }}
{{ $order->shipping['country'] ?? $order->billing['country'] ?? '' }}

Courier & Tracking

@if($order->tracking_number)
Courier
{{ $order->courier ?? 'Pos Laju' }}
Tracking Number
{{ $order->tracking_number }}
Generated At
{{ $order->awb_generated_at ? $order->awb_generated_at->format('M d, Y H:i') : 'N/A' }}
@if($order->status !== 'completed')
@csrf
@endif
@else

No tracking number generated yet

@endif
@push('scripts') @endpush @endsection