@php use App\Livewire\Planning\DyestuffCatalog as DC; $tipoColors = [ 'Aux' => ['bg'=>'#dbeafe','color'=>'#1d4ed8'], 'Color' => ['bg'=>'#ede9fe','color'=>'#6d28d9'], 'Pigmento' => ['bg'=>'#ffedd5','color'=>'#c2410c'], 'Lavanderia' => ['bg'=>'#ccfbf1','color'=>'#0f766e'], 'Goma' => ['bg'=>'#fef3c7','color'=>'#92400e'], 'Acabado' => ['bg'=>'#dcfce7','color'=>'#15803d'], 'Hilo' => ['bg'=>'#e0e7ff','color'=>'#3730a3'], 'Lab' => ['bg'=>'#fce7f3','color'=>'#9d174d'], ]; // Compliance dot SVG helper $dot = fn(string $status) => match($status) { 'ok' => '', 'warning' => '', 'expired' => '', 'missing' => '', default => '', }; @endphp {{-- ── Stats panel ────────────────────────────────────────────── --}}
{{ $stats['total'] }}
Total
{{ $stats['activo'] }}
Activos
{{ $stats['obsoleto'] }}
Obsoletos
{{ $stats['msds_bad'] }}
MSDS vencidos / sin fecha
{{ $stats['mrsl_expiring'] }}
MRSL por vencer (90d)
{{-- ── Filter bar ─────────────────────────────────────────────── --}}
@if($search || $filterEstado || $filterTipoQ || $filterProveedor || $filterCompliance) @endif
{{-- ── Table ───────────────────────────────────────────────────── --}}
@forelse($chemicals as $c) @php $msdsS = DC::msdsStatus($c->msds_date?->format('Y-m-d')); $mrslS = DC::mrslStatus($c->mrsl_exp_date?->format('Y-m-d'), $c->mrsl_cert); $tc = $tipoColors[$c->tipo_q] ?? ['bg'=>'#f3f4f6','color'=>'#374151']; @endphp @empty @endforelse
Código Nombre Proveedor Tipo MSDS ZDHC MRSL Estado
{{ $c->code ?? '—' }}
{{ $c->name }}
@if($c->description)
{{ $c->description }}
@endif
{{ $c->supplier ?? $c->formulador ?? '—' }} @if($c->tipo_q) {{ $c->tipo_q }} @endif
{!! $dot($msdsS) !!} {{ $c->msds_date ? $c->msds_date->format('d/m/y') : 'Sin fecha' }}
{{ $c->zdhc_code ?? '' }} @if($c->mrsl_cert)
{!! $dot($mrslS) !!} {{ $c->mrsl_cert }}
@endif
{{ $c->status }}
Sin resultados para los filtros seleccionados.
{{ $chemicals->total() }} registros
{{ $chemicals->links() }}
{{-- ═══════════════════════════════════════════════════════════════ MODAL — Detail + Edit ══════════════════════════════════════════════════════════════════ --}} @if($showModal && $selected) @endif {{-- Modal for NEW chemical (no selectedId) --}} @if($showModal && !$selected && $editMode) @endif
{{-- end .page --}}