{{-- ── SPLIT: Batch list (left) + Detail (right) ── --}}
{{-- Batch list ──────────────────────────────────── --}}
@forelse($batches as $batch) @php $color = $batch->dyeColor ?? $batch->productionFormula?->labFormula?->customerColor; $hex = $color?->fallback_hex ?? '#6B7280'; $lastMeas= $batch->colorMeasurements->last(); $lastDisp= $batch->latestDisposition; $de = $lastMeas?->delta_E; $deClass = $de === null ? 'de-none' : ($de <= 1.0 ? 'de-pass' : ($de <= 1.5 ? 'de-marginal' : 'de-fail')); @endphp
Batch #{{ $batch->batch_number }}
{{ $color?->code }} — {{ $color?->name }}
@if($de !== null)
ΔE {{ number_format($de,2) }}
@endif @if($lastDisp) {{ $lastDisp->type_label }} @else Sin disposición @endif
@empty
Sin batches con fórmula de producción.
@endforelse
{{ $batches->links() }}
{{-- Batch detail ─────────────────────────────────── --}} @if($selectedBatch) @php $color = $selectedBatch->dyeColor ?? $selectedBatch->productionFormula?->labFormula?->customerColor; $hex = $color?->fallback_hex ?? '#6B7280'; $ref = $color?->reference_data ?? []; $hasRef = $color?->hasLabReference(); @endphp
Batch #{{ $selectedBatch->batch_number }}
{{ $color?->code }} — {{ $color?->name }}
@if($hasRef)
@foreach(['L*'=>$color->target_l,'a*'=>$color->target_a??0,'b*'=>$color->target_b??0] as $lbl=>$val)
{{ number_format($val,1) }}
{{ $lbl }}
@endforeach
@endif
Mediciones Espectrofotométricas{{ $selectedBatch->colorMeasurements->count() }}
@if($selectedBatch->colorMeasurements->isEmpty())
Sin mediciones. Registre la primera lectura del espectrofotómetro.
@else @foreach($selectedBatch->colorMeasurements->sortByDesc('id') as $m) @php $de2 = $m->delta_E; $dc2 = $de2 === null ? 'de-none' : ($de2 <= 1.0 ? 'de-pass' : ($de2 <= 1.5 ? 'de-marginal' : 'de-fail')); @endphp
{{ $m->stage }}
L*{{ number_format($m->read_L,2) }} a*{{ number_format($m->read_a,2) }} b*{{ number_format($m->read_b,2) }}
@if($de2 !== null)
ΔE {{ number_format($de2,2) }}
@endif {{ $m->status }}
@if(in_array($m->status,['Rejected','Marginal'])) @endif
@endforeach @endif
@if($selectedBatch->dispositions->isNotEmpty())
Historial de Disposiciones
@foreach($selectedBatch->dispositions->sortByDesc('id') as $disp)
{{ $disp->type_label }} {{ $disp->notes }} {{ $disp->decided_by_name }} · {{ $disp->created_at->format('d/m/Y H:i') }}
@endforeach
@endif
@endif
{{-- ── Measurement Modal ── --}} @if($showMeasureModal) @endif {{-- ── Disposition Modal ── --}} @if($showDispositionModal) @endif