diff --git a/app/Http/Controllers/Account/OrderController.php b/app/Http/Controllers/Account/OrderController.php index a8802ae..396cc8f 100644 --- a/app/Http/Controllers/Account/OrderController.php +++ b/app/Http/Controllers/Account/OrderController.php @@ -44,7 +44,11 @@ public function show(string $locale, Request $request, int $orderId): View return view('account.orders.show', [ 'order' => $order, 'paymentMethodName' => $paymentMethodName, - 'shipments' => $order->shipments->whereNull('cancelled_at')->whereNotNull('tracking_reference'), + // Active shipments with a number; return vouchers are the shop's + // business, not the customer's. + 'shipments' => $order->shipments + ->reject(fn ($shipment) => $shipment->isCancelled() || $shipment->isReturn() || blank($shipment->tracking_reference)) + ->values(), ]); } } diff --git a/public/static/logos/core/elta-courier-logo.png b/public/static/logos/core/elta-courier-logo.png new file mode 100644 index 0000000..aee4f2b Binary files /dev/null and b/public/static/logos/core/elta-courier-logo.png differ diff --git a/resources/views/account/orders/index.blade.php b/resources/views/account/orders/index.blade.php index e7f1afd..fb1bebe 100644 --- a/resources/views/account/orders/index.blade.php +++ b/resources/views/account/orders/index.blade.php @@ -35,7 +35,7 @@
  • {{ __('storefront.orders.date') }}: - {{ $order->placed_at->format('d/m/Y') }} + {{ $order->placed_at->inDisplayTimezone()->format('d/m/Y') }} {{ __('storefront.orders.number') }}: diff --git a/resources/views/account/orders/show.blade.php b/resources/views/account/orders/show.blade.php index 4a49c88..853c97c 100644 --- a/resources/views/account/orders/show.blade.php +++ b/resources/views/account/orders/show.blade.php @@ -30,7 +30,7 @@
    {{ __('storefront.orders.date') }}
    -
    {{ $order->placed_at->format('d/m/Y') }}
    +
    {{ $order->placed_at->inDisplayTimezone()->format('d/m/Y') }}
    @@ -51,15 +51,70 @@
    {{ $shippingLine->description }}
    @endif - - @foreach ($shipments as $shipment) -
    -
    {{ __('storefront.orders.tracking') }}
    -
    {{ $shipment->tracking_reference }}
    -
    - @endforeach
    + {{-- Shipment tracking: the history we sync from the courier. Only + couriers without an integration link out to their own site. --}} + @if ($shipments->isNotEmpty()) +
    +

    {{ __('storefront.orders.tracking') }}

    + + @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) +
    1. + +
      + {{ __('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 +
      +
    2. + @endforeach +
    + @endif +
    +
    + @endforeach +
    + @endif + {{-- Items + totals --}}

    {{ __('storefront.orders.items') }}

    diff --git a/resources/views/vendor/core/order/notifications/dispatched.blade.php b/resources/views/vendor/core/order/notifications/dispatched.blade.php index faebbd6..c0938fc 100644 --- a/resources/views/vendor/core/order/notifications/dispatched.blade.php +++ b/resources/views/vendor/core/order/notifications/dispatched.blade.php @@ -1,4 +1,4 @@ -{{-- Core passes only the order reference here (and the amount for payment emails). Greek on purpose: sent from the queue in the app default locale. --}} +{{-- Core passes the order, its reference and its active shipments. Greek on purpose: sent from the queue in the app default locale. --}} @extends('emails.layout') @section('title', "Η παραγγελία σου στάλθηκε") @@ -10,12 +10,23 @@ Η παραγγελία σου στάλθηκε -

    Η παραγγελία σου #{{ $reference }} είναι καθ’ οδόν. Θα τη λάβεις σύντομα.

    +

    Η παραγγελία σου #{{ $reference }} είναι καθ’ οδόν. Θα τη λάβεις σύντομα.

    - @include('emails.partials.button', [ - 'url' => route('account.orders', ['locale' => 'el']), - 'label' => 'Οι παραγγελίες μου', - ]) + @foreach ($shipments ?? [] as $shipment) +

    + {{ $shipment->carrierLabel() }} · Αριθμός αποστολής: {{ $shipment->tracking_reference }} + @if ($carrierUrl = $shipment->trackingUrl()) + · Παρακολούθηση στη σελίδα του courier + @endif +

    + @endforeach + +
    + + {{-- Orders with an account: their order page shows the tracking history we sync from the courier. --}} + @include('emails.partials.button', $order->customer_id + ? ['url' => route('account.orders.show', ['locale' => 'el', 'orderId' => $order->id]), 'label' => 'Παρακολούθηση παραγγελίας'] + : ['url' => route('account.orders', ['locale' => 'el']), 'label' => 'Οι παραγγελίες μου']) @endsection @section('footer') diff --git a/resources/views/vendor/core/order/notifications/placed.blade.php b/resources/views/vendor/core/order/notifications/placed.blade.php index f4c673b..c4e1383 100644 --- a/resources/views/vendor/core/order/notifications/placed.blade.php +++ b/resources/views/vendor/core/order/notifications/placed.blade.php @@ -46,7 +46,7 @@

    Λάβαμε την παραγγελία σου #{{ $reference }} - στις {{ $order->placed_at?->format('d/m/Y') }}. + στις {{ $order->placed_at?->inDisplayTimezone()->format('d/m/Y') }}. Θα σε ενημερώσουμε με email μόλις σταλεί.