@extends('layouts.account')
@php
$orderReference = \Modules\Core\Order\Support\OrderReferenceDisplay::resolve($order);
@endphp
@section('title', __('storefront.orders.order_title', ['number' => $orderReference]))
@php
$productLines = $order->lines->where('type', '!=', 'shipping');
$shippingLine = $order->lines->firstWhere('type', 'shipping');
@endphp
@section('account')
{{-- Summary --}}
{{ __('storefront.orders.date') }}
{{ $order->placed_at->inDisplayTimezone()->format('d/m/Y') }}
{{ __('storefront.orders.status') }}
@if ($paymentMethodName)
{{ __('storefront.orders.payment') }}
{{ $paymentMethodName }}
@endif
@if ($shippingLine)
{{ __('storefront.orders.shipping_method') }}
{{ $shippingLine->description }}
@endif
{{-- Shipment tracking: the history we sync from the courier. Only
couriers without an integration link out to their own site. --}}
@if ($shipments->isNotEmpty())
@foreach ($shipments as $shipment)
@php
$history = $shipment->shipmentInfo->sortByDesc('occurred_at');
$latest = $history->first();
@endphp
{{ __('storefront.orders.shipment') }}
{{ $shipment->carrierLabel() }}
{{ __('storefront.orders.voucher_number') }}
{{ $shipment->tracking_reference }}
{{ __('storefront.orders.shipment_status') }}
{{ __('storefront.tracking_status.'.($latest?->status->value ?? 'pending')) }}
@if ($trackingUrl = $shipment->trackingUrl())
{{ __('storefront.orders.track_on_carrier') }}
@endif
{{ __('storefront.orders.tracking_history') }}
@if ($history->isEmpty())
{{ __('storefront.orders.tracking_empty') }}
@else
@foreach ($history as $checkpoint)
{{ $checkpoint->occurred_at->inDisplayTimezone()->format('d/m/Y H:i') }}
{{ __('storefront.tracking_status.'.$checkpoint->status->value) }}
@if ($details = collect([$checkpoint->location, ($checkpoint->status->value === 'unknown' || $checkpoint->carrier_status === 'manual') ? $checkpoint->message : null])->filter()->implode(' ยท '))
{{ $details }}
@endif
@endforeach
@endif
@endforeach
@endif
{{-- Items + totals --}}
{{ __('storefront.orders.subtotal') }}
{{ $order->sub_total?->formatted() }}
@if ($order->discount_total?->value > 0)
{{ __('storefront.orders.discount') }}
−{{ $order->discount_total->formatted() }}
@endif
{{ __('storefront.orders.shipping') }}
{{ $order->shipping_total?->formatted() }}
@if ($order->tax_total?->value > 0)
{{ __('storefront.orders.tax') }}
{{ $order->tax_total->formatted() }}
@endif
{{-- Addresses --}}
@foreach ([
'shipping_to' => $order->shippingAddress,
'billing' => $order->billingAddress,
] as $heading => $address)
@if ($address)
{{ trim($address->first_name.' '.$address->last_name) }}
@if ($address->company_name){{ $address->company_name }} @endif
@if ($address->tax_identifier){{ __('storefront.account.tax_identifier') }}: {{ $address->tax_identifier }} @endif
{{ $address->line_one }}
@if ($address->line_two){{ $address->line_two }} @endif
{{ trim($address->postcode.' '.$address->city) }}
@if ($address->state)
{{ Lang::has("core::states.{$address->state}") ? __("core::states.{$address->state}") : $address->state }}
@endif
@if ($address->contact_phone){{ $address->contact_phone }} @endif
@endif
@endforeach
@endsection