@extends('layouts.app') {{-- Adjust layout as needed --}} @section('title', __('orders.show.title', ['order_id' => $order->id])) @section('content')
{{-- Header with Actions --}}

{{ __('orders.show.header', ['order_id' => $order->id]) }}

{{ __('orders.show.created_at') }} {{ $order->created_at->format('M j, Y \a\t g:i A') }}

{{-- Left Column --}}
{{-- Order Status & PO Numbers --}}

{{ __('orders.show.order_status') }}

{{ __('orders.show.status') }}
{{ __('orders.show.status_' . $order->status) }}
@if ($order->our_po_number)
{{ __('orders.show.our_po_number') }}
{{ $order->our_po_number }}
@endif @if ($order->amazon_po_number)
{{ __('orders.show.amazon_po_number') }}
{{ $order->amazon_po_number }}
@endif @if ($order->payment_transaction_id)
{{ __('orders.show.payment_transaction_id') }}
{{ $order->payment_transaction_id }}
@endif @if ($order->payment_gateway)
{{ __('orders.show.payment_gateway') }}
{{ ucfirst($order->payment_gateway) }}
@endif
@if ($order->error_message)

{{ __('orders.show.error_message') }}

{{ $order->error_message }}

@endif
{{-- Donor Information --}}

{{ __('orders.show.donor_information') }}

@php // For backward compatibility with older records, fallback to JSON billing_info $billingInfo = $order->billing_info ?? []; if (!is_array($billingInfo)) { $billingInfo = []; } @endphp
{{ __('orders.show.contact_email') }}
{{ $order->contact_email }}
@if ( $order->billing_first_name || $order->billing_last_name || !empty($billingInfo['first_name']) || !empty($billingInfo['last_name']))
{{ __('orders.show.full_name') }}
{{ trim(($order->billing_first_name ?? ($billingInfo['first_name'] ?? '')) . ' ' . ($order->billing_last_name ?? ($billingInfo['last_name'] ?? ''))) }}
@endif @if ($order->billing_company || !empty($billingInfo['company']))
{{ __('orders.show.company') }}
{{ $order->billing_company ?? $billingInfo['company'] }}
@endif @if ($order->user)
{{ __('orders.show.registered_user') }}
{{ __('orders.show.yes') }} ({{ $order->user->first_name }} {{ $order->user->last_name }})
@else
{{ __('orders.show.registered_user') }}
{{ __('orders.show.guest_checkout') }}
@endif
{{ __('orders.show.marketing_opt_in') }}
@if ($order->marketing_opt_in) ✓ {{ __('orders.show.yes') }} @else ✗ {{ __('orders.show.no') }} @endif
{{-- Billing Address --}} @if ($order->billing_first_name || $order->billing_address_line_1 || !empty($billingInfo))

Billing Address

@if ( $order->billing_first_name || $order->billing_last_name || !empty($billingInfo['first_name']) || !empty($billingInfo['last_name']))
{{ trim(($order->billing_first_name ?? ($billingInfo['first_name'] ?? '')) . ' ' . ($order->billing_last_name ?? ($billingInfo['last_name'] ?? ''))) }}
@endif @if ($order->billing_company || !empty($billingInfo['company']))
{{ $order->billing_company ?? $billingInfo['company'] }}
@endif @if ($order->billing_address_line_1 || !empty($billingInfo['address_line_1']))
{{ $order->billing_address_line_1 ?? $billingInfo['address_line_1'] }}
@endif @if ($order->billing_address_line_2 || !empty($billingInfo['address_line_2']))
{{ $order->billing_address_line_2 ?? $billingInfo['address_line_2'] }}
@endif @if ( $order->billing_city || $order->billing_state || $order->billing_zip_code || !empty($billingInfo['city']) || !empty($billingInfo['state']) || !empty($billingInfo['zip_code']))
{{ $order->billing_city ?? ($billingInfo['city'] ?? '') }}{{ ($order->billing_city ?? $billingInfo['city']) && ($order->billing_state ?? $billingInfo['state']) ? ', ' : '' }}{{ $order->billing_state ?? ($billingInfo['state'] ?? '') }} {{ $order->billing_zip_code ?? ($billingInfo['zip_code'] ?? '') }}
@endif @if ($order->billing_country || !empty($billingInfo['country']))
{{ $order->billing_country ?? $billingInfo['country'] }}
@endif
@endif {{-- Campaign Information --}} @if ($order->campaign)

Campaign

Campaign Name
{{ $order->campaign->title }}
@if ($order->campaign->po_number)
Campaign PO Prefix
{{ $order->campaign->po_number }}
@endif
@endif
{{-- Right Column --}}
{{-- Shipping Address --}} @if ($order->shippingAddress)

Shipping Address

@if ($order->shippingAddress->nickname)
{{ $order->shippingAddress->nickname }}
@endif @if ($order->shippingAddress->contact_name)
{{ $order->shippingAddress->contact_name }}
@endif @if ($order->shippingAddress->company)
{{ $order->shippingAddress->company }}
@endif
{{ $order->shippingAddress->address_line_1 }}
@if ($order->shippingAddress->address_line_2)
{{ $order->shippingAddress->address_line_2 }}
@endif
{{ $order->shippingAddress->city }}, {{ $order->shippingAddress->state }} {{ $order->shippingAddress->zip_code }}
{{ $order->shippingAddress->country }}
@if ($order->shippingAddress->phone)
📞 {{ $order->shippingAddress->phone }}
@endif
@endif {{-- Order Totals --}}

{{ __('orders.show.order_totals') }}

{{ __('orders.show.product_subtotal') }}
${{ number_format($order->total_product_value, 2) }}
@if ($order->donation_amount > 0)
{{ __('orders.show.donation_amount') }}
${{ number_format($order->donation_amount, 2) }}
@endif @if ($order->surcharge_amount > 0)
{{ $order->surcharge_label ?? __('orders.show.convenience_fee') }} @if ($order->surcharge_percentage > 0) ({{ number_format($order->surcharge_percentage, 2) }}%) @endif
${{ number_format($order->surcharge_amount, 2) }}
@endif
{{ __('orders.show.grand_total') }}
${{ number_format($order->grand_total, 2) }}
{{-- Order Items --}} @if (!empty($order->cart_items) && is_array($order->cart_items))

Order Items ({{ count($order->cart_items) }} {{ Str::plural('item', count($order->cart_items)) }})

@foreach ($order->cart_items as $item)

{{ $item['name'] ?? 'Unknown Product' }}

@if (!empty($item['attributes']))
@if (!empty($item['attributes']['asin'])) ASIN: {{ $item['attributes']['asin'] }} @endif @if (!empty($item['attributes']['currency'])) • {{ $item['attributes']['currency'] }} @endif
@endif
Qty: {{ $item['quantity'] ?? 1 }} × ${{ number_format($item['price'] ?? 0, 2) }}
${{ number_format(($item['price'] ?? 0) * ($item['quantity'] ?? 1), 2) }}
@endforeach
@endif
@endsection