@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
| 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
|
{{ $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))
@endif
SKU: {{ $sku }}
@endif
@if ($productName !== '')
Producto: {{ $productName }}
@endif
|
| Sin historial. | |||