@if(!empty($alerts))
âš  {{ count($alerts) }} Alerta(s) de Compliance
@foreach($alerts as $alert)
{{ $alert['type']==='error'?'❌':'⚠️' }} {{ $alert['dyestuff'] }}: {{ $alert['msg'] }}
@endforeach
@else
✅ Todos los colorantes tienen documentación compliance válida.
@endif
{{ $dyestuffs->filter(fn($d)=>$d->documents->where('document_type','MSDS')->where('is_active',true)->first()?->isExpired()===false)->count() }}
MSDS OK
{{ $dyestuffs->filter(fn($d)=>!$d->documents->where('document_type','MSDS')->where('is_active',true)->first())->count() }}
Sin MSDS
{{ $dyestuffs->count() }}
Colorantes
@foreach($dyestuffs as $d) @php $msds = $d->documents->where('document_type','MSDS')->where('is_active',true)->sortByDesc('created_at')->first(); $tds = $d->documents->where('document_type','TDS')->where('is_active',true)->sortByDesc('created_at')->first(); $msdsOk = $msds && !$msds->isExpired(); $tdsOk = $tds && !$tds->isExpired(); @endphp
{{ $d->name }} @if($d->supplier){{ $d->supplier }}@endif
MSDS
@if($msds)
{{ $msdsOk?'✓ Válido':'Vencido' }} v{{ $msds->version ?? '—' }} {{ $msds->expiry_date?->format('d/m/Y') ?? 'Sin venc.' }}
@else
❌ Sin MSDS activo
@endif
TDS (Ficha técnica)
@if($tds)
{{ $tdsOk?'✓ Válido':'Vencido' }} v{{ $tds->version ?? '—' }} {{ $tds->expiry_date?->format('d/m/Y') ?? 'Sin venc.' }}
@else
âš  Sin TDS activo
@endif
Lotes (COA)
@php $approvedLots = $d->lots->where('qc_status','approved'); @endphp @if($approvedLots->isEmpty())
Sin lotes aprobados
@else @foreach($approvedLots->take(3) as $lot) @php $hasCoa = $lot->certificates->where('is_valid',true)->isNotEmpty(); @endphp
{{ $lot->lot_barcode }} {{ $hasCoa?'COA âś“':'Sin COA' }} {{ number_format($lot->quantity_remaining,1) }}kg
@endforeach @if($approvedLots->count() > 3)
+{{ $approvedLots->count()-3 }} más
@endif @endif
@endforeach @if($showDocModal) @endif