ldc-cocotte/resources/views/fo/customer/orders/show.blade.php
Jérémy Munsch 192e72f554
refactor(dto): enhance OrderLineDto with flattened product properties
- Added new properties for product details in OrderLineDto.
- Updated fromModel method to map product properties correctly.
- Adjusted toArray method to include new properties.
- Improved unit tests for OrderLineDto to validate new behavior.
2026-11-02 14:53:17 +01:00

142 lines
5.8 KiB
PHP

@extends('fo.layouts.layout', ['brParam' => $order])
@section('title', __('Order detail of :date', ['date' => $order->created_at->isoFormat('ddd DD/MM/YY')]))
@section('description', __('Order detail of :date', ['date' => $order->created_at->isoFormat('ddd DD/MM/YY')]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<main class="container my-5">
<div class="mb-4">
<a class="btn btn-outline-secondary rounded-4" data-bs-toggle="tooltip" href="{{ route('fo.account.orders.index') }}"
title="{{ __('Back to :page', ['page' => __('My Orders')]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
</div>
<h1 class="text-center">
{{ __('Order detail of :date', ['date' => $order->created_at->isoFormat('ddd DD/MM/YY')]) }}
</h1>
<p class="text-muted mb-4 text-center">{{ __('ref: :reference', ['reference' => $order->reference]) }}</p>
<div class="rounded p-4 shadow-sm">
{{-- DESKTOP --}}
<div class="table-responsive d-none d-md-block mb-4">
<table class="table-striped table-hover mb-0 table">
<thead>
<tr>
<th class="text-center align-middle" scope="col">{{ __('Order status') }}</th>
<th class="text-start align-middle" scope="col">{{ __('Order summary') }}</th>
<th class="text-center align-middle" scope="col">{{ __('Price per kg (incl. tax)') }}</th>
<th class="text-center align-middle" scope="col">{{ __('Unit price (incl. tax)') }}</th>
</tr>
</thead>
<tbody>
@foreach ($order->lines as $index => $line)
<tr>
@if ($index === 0)
<td class="fw-medium border-end bg-light text-center align-middle" rowspan="{{ $order->lines->count() }}">
{{ $order->status->label() }}
</td>
@endif
<td class="text-start align-middle">
{{ $line->quantity }} x {{ $line->product_name }}
</td>
<td class="text-center align-middle">
@if ($line->is_variable_weight && $line->price_kg_ttc)
@money($line->price_kg_ttc)
@endif
</td>
<td class="text-center align-middle">
@money($line->unit_price_ttc)
</td>
</tr>
@endforeach
<tr class="table-group-divider">
<td class="fw-medium text-end align-middle" colspan="3">
{{ __('Estimated total incl. tax') }}
</td>
<td class="fs-5 fw-bold text-center align-middle">
@money($order->total)
</td>
</tr>
</tbody>
</table>
</div>
{{-- MOBILE --}}
<div class="d-block d-md-none mb-4">
<div class="card bg-light rounded-4 mb-3 border-0">
<div class="card-body d-flex justify-content-between align-items-center py-2">
<span class="fw-medium text-muted">{{ __('Order status') }}</span>
<span class="fw-bold">{{ $order->status->label() }}</span>
</div>
</div>
<h5 class="fw-bold mb-3 px-2">{{ __('Order summary') }}</h5>
@foreach ($order->lines as $line)
<div class="card rounded-4 mb-3 shadow-sm">
<div class="card-body">
<div class="fw-bold border-bottom mb-2 pb-2">
<span>{{ $line->quantity }} x {{ $line->product_name }}</span>
</div>
@if ($line->is_variable_weight && $line->price_kg_ttc)
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="fw-medium text-muted">{{ __('Price per kg (incl. tax)') }}</span>
<span>@money($line->price_kg_ttc)</span>
</div>
@endif
<div class="d-flex justify-content-between align-items-center">
<span class="fw-medium text-muted">{{ __('Unit price (incl. tax)') }}</span>
<span class="fw-bold">@money($line->unit_price_ttc)</span>
</div>
</div>
</div>
@endforeach
<div class="card border-dark rounded-4 mt-3">
<div class="card-body d-flex justify-content-between align-items-center py-3">
<span class="fw-bold">{{ __('Estimated total incl. tax') }}</span>
<span class="fs-5 fw-bold">
@money($order->total)
</span>
</div>
</div>
</div>
<hr class="text-muted my-4">
{{-- DELIVERY --}}
<div class="card bg-light rounded-4 p-lg-5 mb-5 border-0 p-4 mt-4">
<div class="d-flex align-items-center mb-4">
<i class="bi bi-shop fs-4 text-primary me-3"></i>
<h3 class="mb-0">{{ __('Collection details') }}</h3>
</div>
<div class="row g-4">
<div class="col-12 col-md-6">
<p class="text-muted mb-1">{{ __('To be collected on') }}</p>
<p class="fw-bold fs-5 text-capitalize mb-0">
{{ $order->pickup_day ? $order->pickup_day->translatedFormat('l j F Y') : '-' }}
</p>
</div>
<div class="col-12 col-md-6">
<p class="text-muted mb-1">{{ __('at the following address') }}</p>
<address class="mb-0">
<strong><a href="{{ $mapUrl }}" target="_blank" rel="noreferrer" class="text-dark" title="{{ __('View on map') }}" data-bs-toggle="tooltip">{{ $order->delivery_address->name }}</a></strong><br>
{{ $order->delivery_address->address }}<br>
{{ $order->delivery_address->postcode }} {{ $order->delivery_address->city }}
</address>
</div>
</div>
</div>
</div>
</main>
@endsection