@php $logs = $record->statusLogs ?? collect(); $refs = $logs ->map(fn ($log) => trim((string) ($log->orderDetail?->product_reference ?? ''))) ->filter() ->unique() ->values() ->all(); $imagesByRef = $refs !== [] ? \App\Models\Universal\ProductImage::query() ->whereIn('reference_product', $refs) ->orderBy('id_product_images') ->get(['reference_product', 'link_image', 'id_product_images']) ->unique('reference_product') ->pluck('link_image', 'reference_product') ->all() : []; @endphp
Referencia: {{ $record->order_reference }}
@include('filament.orders.partials.order-progress', ['record' => $record]) @include('filament.orders.partials.order-steps', ['record' => $record])
@forelse ($logs as $log) @empty @endforelse
Fecha Usuario Estado Detalle
{{ optional($log->happened_at)->format('d/m/Y H:i') ?? '-' }} {{ $log->user_name ?? $log->user?->name ?? 'Sistema' }} @php $rawStatus = (string) $log->status; $normalizedStatus = \App\Models\Order::normalizeStatusCodeString($rawStatus); $statusEnum = \App\Enums\OrderStatus::tryFrom($normalizedStatus); $statusLabel = $statusEnum?->label() ?? ($normalizedStatus !== '' ? $normalizedStatus : $rawStatus); $statusColor = $statusEnum?->filamentColor() ?? 'gray'; @endphp {{ $statusLabel }}
{{ $log->note ?? '-' }}
@php $sku = trim((string) ($log->orderDetail?->product_reference ?? '')); $productName = trim((string) ($log->orderDetail?->product_name ?? '')); $imageUrl = $sku !== '' ? ($imagesByRef[$sku] ?? null) : null; @endphp @if ($sku !== '' || $productName !== '' || filled($imageUrl))
@if (filled($imageUrl)) {{ $productName !== '' ? $productName : 'Producto' }} @endif @if ($sku !== '')
SKU: {{ $sku }}
@endif @if ($productName !== '')
Producto: {{ $productName }}
@endif
@endif
Sin historial.