{{-- resources/views/admin/internal_orders/show.blade.php --}} @extends('admin.layouts.app') @section('title', 'Encomenda interna #' . $order->id) @php $labels = [ 'placed' => 'Nova', 'confirmed' => 'Confirmada', 'preparing' => 'Em preparação', 'shipped' => 'Enviada', 'delivered' => 'Entregue', 'cancelled' => 'Cancelada', ]; $statusPills = [ 'placed' => 'azp-badge-pill', 'confirmed' => 'azp-badge-pill', 'preparing' => 'azp-badge-pill', 'shipped' => 'azp-badge-pill', 'delivered' => 'azp-badge-pill', 'cancelled' => 'azp-badge-pill', ]; $currentStatus = $order->status ?? 'placed'; @endphp @section('content')
{{-- Header --}}

Encomenda interna #{{ $order->id }}

Clube: {{ optional($order->club)->name ?? '—' }} / Estado: {{ $labels[$currentStatus] ?? $currentStatus }}
{{-- Flash --}} @if (session('status'))
{{ session('status') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @if ($errors->any())
Há erros no formulário.
@endif {{-- Top grid --}}
Resumo
Criada em
{{ $order->created_at ? \Carbon\Carbon::parse($order->created_at)->format('d/m/Y H:i') : '—' }}
@if($order->placed_at) Pedido em: {{ \Carbon\Carbon::parse($order->placed_at)->format('d/m/Y H:i') }} @endif @if($order->confirmed_at)
Confirmada em: {{ \Carbon\Carbon::parse($order->confirmed_at)->format('d/m/Y H:i') }} @endif @if($order->shipped_at)
Enviada em: {{ \Carbon\Carbon::parse($order->shipped_at)->format('d/m/Y H:i') }} @endif @if($order->delivered_at)
Entregue em: {{ \Carbon\Carbon::parse($order->delivered_at)->format('d/m/Y H:i') }} @endif
Totais
Subtotal € {{ number_format((float)$order->subtotal, 2, ',', '.') }}
Portes € {{ number_format((float)$order->shipping_total, 2, ',', '.') }}
Total € {{ number_format((float)$order->grand_total, 2, ',', '.') }}
Nota: os portes foram copiados do valor global existente no momento de criação da encomenda.
Estado
@csrf
@error('status')
{{ $message }}
@enderror
Alterar o estado ajuda a organizar a lista por tabs.
@if(!empty($order->notes))
Notas
{{ $order->notes }}
@endif
{{-- Lines --}}
Itens
@forelse($order->lines ?? [] as $ln) @php $p = $ln->product ?? null; $mainImagePath = $p ? ($p->image_url ?? optional($p->images->first())->path) : null; $mainImageUrl = $mainImagePath ? asset('storage/' . ltrim($mainImagePath, '/')) : null; $size = ($p && !empty($p->size)) ? $p->size : null; @endphp @empty @endforelse
Produto Preço Qtd Total
@if($mainImageUrl) {{ $ln->product_name }} @else
Sem imagem
@endif
{{ $ln->product_name }}
ID produto: {{ $ln->product_id }} @if($size) Tam: {{ $size }} @endif
€ {{ number_format((float)$ln->unit_price, 2, ',', '.') }} {{ (int)$ln->quantity }} € {{ number_format((float)$ln->line_total, 2, ',', '.') }}
Sem itens nesta encomenda.
@endsection