generated from boboko/starter
Feat: Order Controller updates
This commit is contained in:
@@ -44,7 +44,11 @@ public function show(string $locale, Request $request, int $orderId): View
|
|||||||
return view('account.orders.show', [
|
return view('account.orders.show', [
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'paymentMethodName' => $paymentMethodName,
|
'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(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
@@ -35,7 +35,7 @@
|
|||||||
<li class="grid grid-cols-2 gap-x-6 gap-y-2 border-b border-black py-5 sm:grid-cols-[1fr_1fr_1.5fr_1fr_auto] sm:items-center">
|
<li class="grid grid-cols-2 gap-x-6 gap-y-2 border-b border-black py-5 sm:grid-cols-[1fr_1fr_1.5fr_1fr_auto] sm:items-center">
|
||||||
<span>
|
<span>
|
||||||
<span class="sr-only">{{ __('storefront.orders.date') }}:</span>
|
<span class="sr-only">{{ __('storefront.orders.date') }}:</span>
|
||||||
{{ $order->placed_at->format('d/m/Y') }}
|
{{ $order->placed_at->inDisplayTimezone()->format('d/m/Y') }}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-right font-bold sm:text-left">
|
<span class="text-right font-bold sm:text-left">
|
||||||
<span class="sr-only">{{ __('storefront.orders.number') }}:</span>
|
<span class="sr-only">{{ __('storefront.orders.number') }}:</span>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<dl class="grid grid-cols-1 gap-6 border-y border-black py-6 sm:grid-cols-2 lg:grid-cols-4">
|
<dl class="grid grid-cols-1 gap-6 border-y border-black py-6 sm:grid-cols-2 lg:grid-cols-4">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.date') }}</dt>
|
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.date') }}</dt>
|
||||||
<dd>{{ $order->placed_at->format('d/m/Y') }}</dd>
|
<dd>{{ $order->placed_at->inDisplayTimezone()->format('d/m/Y') }}</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
@@ -51,15 +51,70 @@
|
|||||||
<dd>{{ $shippingLine->description }}</dd>
|
<dd>{{ $shippingLine->description }}</dd>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@foreach ($shipments as $shipment)
|
|
||||||
<div class="flex flex-col gap-1">
|
|
||||||
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.tracking') }}</dt>
|
|
||||||
<dd class="break-all">{{ $shipment->tracking_reference }}</dd>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
{{-- Shipment tracking: the history we sync from the courier. Only
|
||||||
|
couriers without an integration link out to their own site. --}}
|
||||||
|
@if ($shipments->isNotEmpty())
|
||||||
|
<section class="flex flex-col gap-6" aria-labelledby="order-tracking-heading">
|
||||||
|
<h2 id="order-tracking-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.orders.tracking') }}</h2>
|
||||||
|
|
||||||
|
@foreach ($shipments as $shipment)
|
||||||
|
@php
|
||||||
|
$history = $shipment->shipmentInfo->sortByDesc('occurred_at');
|
||||||
|
$latest = $history->first();
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-5 border-b border-black pb-6">
|
||||||
|
<dl class="grid grid-cols-1 gap-6 sm:grid-cols-3">
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.shipment') }}</dt>
|
||||||
|
<dd>{{ $shipment->carrierLabel() }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.voucher_number') }}</dt>
|
||||||
|
<dd class="break-all">{{ $shipment->tracking_reference }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.shipment_status') }}</dt>
|
||||||
|
<dd class="font-bold">{{ __('storefront.tracking_status.'.($latest?->status->value ?? 'pending')) }}</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
@if ($trackingUrl = $shipment->trackingUrl())
|
||||||
|
<a href="{{ $trackingUrl }}" target="_blank" rel="noopener" class="inline-flex items-center gap-2 self-start text-sm underline hover:no-underline">
|
||||||
|
{{ __('storefront.orders.track_on_carrier') }}
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-3">
|
||||||
|
<h3 class="text-sm text-neutral-500">{{ __('storefront.orders.tracking_history') }}</h3>
|
||||||
|
|
||||||
|
@if ($history->isEmpty())
|
||||||
|
<p class="text-sm">{{ __('storefront.orders.tracking_empty') }}</p>
|
||||||
|
@else
|
||||||
|
<ol class="flex flex-col gap-3">
|
||||||
|
@foreach ($history as $checkpoint)
|
||||||
|
<li class="flex flex-col gap-0.5 sm:flex-row sm:gap-6">
|
||||||
|
<time datetime="{{ $checkpoint->occurred_at->toIso8601String() }}" class="shrink-0 text-sm text-neutral-500 sm:w-36">
|
||||||
|
{{ $checkpoint->occurred_at->inDisplayTimezone()->format('d/m/Y H:i') }}
|
||||||
|
</time>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<span>{{ __('storefront.tracking_status.'.$checkpoint->status->value) }}</span>
|
||||||
|
@if ($details = collect([$checkpoint->location, ($checkpoint->status->value === 'unknown' || $checkpoint->carrier_status === 'manual') ? $checkpoint->message : null])->filter()->implode(' · '))
|
||||||
|
<span class="text-sm text-neutral-500">{{ $details }}</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
</ol>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</section>
|
||||||
|
@endif
|
||||||
|
|
||||||
{{-- Items + totals --}}
|
{{-- Items + totals --}}
|
||||||
<section class="flex flex-col gap-6" aria-labelledby="order-items-heading">
|
<section class="flex flex-col gap-6" aria-labelledby="order-items-heading">
|
||||||
<h2 id="order-items-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.orders.items') }}</h2>
|
<h2 id="order-items-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.orders.items') }}</h2>
|
||||||
|
|||||||
@@ -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')
|
@extends('emails.layout')
|
||||||
|
|
||||||
@section('title', "Η παραγγελία σου στάλθηκε")
|
@section('title', "Η παραγγελία σου στάλθηκε")
|
||||||
@@ -10,12 +10,23 @@
|
|||||||
Η παραγγελία σου στάλθηκε
|
Η παραγγελία σου στάλθηκε
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<p style="margin:0 0 32px;">Η παραγγελία σου <strong>#{{ $reference }}</strong> είναι καθ’ οδόν. Θα τη λάβεις σύντομα.</p>
|
<p style="margin:0 0 24px;">Η παραγγελία σου <strong>#{{ $reference }}</strong> είναι καθ’ οδόν. Θα τη λάβεις σύντομα.</p>
|
||||||
|
|
||||||
@include('emails.partials.button', [
|
@foreach ($shipments ?? [] as $shipment)
|
||||||
'url' => route('account.orders', ['locale' => 'el']),
|
<p style="margin:0 0 8px;">
|
||||||
'label' => 'Οι παραγγελίες μου',
|
{{ $shipment->carrierLabel() }} · Αριθμός αποστολής: <strong>{{ $shipment->tracking_reference }}</strong>
|
||||||
])
|
@if ($carrierUrl = $shipment->trackingUrl())
|
||||||
|
· <a href="{{ $carrierUrl }}" style="color:#000000;text-decoration:underline;">Παρακολούθηση στη σελίδα του courier</a>
|
||||||
|
@endif
|
||||||
|
</p>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<div style="height:24px;"></div>
|
||||||
|
|
||||||
|
{{-- 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
|
@endsection
|
||||||
|
|
||||||
@section('footer')
|
@section('footer')
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
<p style="margin:0 0 24px;">
|
<p style="margin:0 0 24px;">
|
||||||
Λάβαμε την παραγγελία σου <strong>#{{ $reference }}</strong>
|
Λάβαμε την παραγγελία σου <strong>#{{ $reference }}</strong>
|
||||||
στις {{ $order->placed_at?->format('d/m/Y') }}.
|
στις {{ $order->placed_at?->inDisplayTimezone()->format('d/m/Y') }}.
|
||||||
Θα σε ενημερώσουμε με email μόλις σταλεί.
|
Θα σε ενημερώσουμε με email μόλις σταλεί.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user