{{-- ── BATCH SELECTION ─────────────────────────────── --}} @if(!$selectedBatchId) @if($pendingBatches->isEmpty())
Sin batches pendientes con fórmula de producción asignada.
@else
@foreach($pendingBatches as $b)
Batch #{{ $b->batch_number }}
Estado: {{ $b->status }}
@if($b->kg)
{{ number_format($b->kg,1) }} kg
@endif
→ Abrir sala de pesaje
@endforeach
@endif {{-- ── ACTIVE BATCH — GROUP LIST ──────────────────── --}} @elseif(!$activeGroupId)
@if($groups->isEmpty())
Este batch no tiene fórmula de producción con pasos de dosificación definidos. Asegúrese de que la fórmula aprobada tenga una curva de tintura asignada con pasos de dosificación.
@endif @foreach($groups as $group)
{{ $group->container_label }} @if($group->curveStep)Paso {{ $group->curveStep->orden }} · {{ $group->curveStep->tipo }}@endif
@if($group->status === 'completed') ✓ Completado @elseif($group->status === 'in_progress') En proceso @else @endif
@foreach($group->items as $item) @php $vs = $item->variance_status ?? 'pending'; @endphp
{{ $item->formulaItem?->dyestuff?->name ?? '—' }}
Planificado: {{ number_format($item->planned_weight*1000,1) }} g
@if($item->actual_weight !== null)
{{ number_format($item->actual_weight*1000,1) }} g
{{ $item->variance_pct > 0 ? '+' : '' }}{{ number_format($item->variance_pct,1) }}%
{{ $vs === 'ok' ? '✅' : ($vs === 'warning' ? '⚠️' : '❌') }}
@else Pendiente @endif
@endforeach
@endforeach {{-- ── ACTIVE ITEM WEIGHING ─────────────────────── --}} @else @php $totalItems = $activeGroup ? $activeGroup->items->count() : 0; $currentItem = $activeGroup ? $activeGroup->items[$activeItemIndex ?? 0] : null; $doneCount = $activeGroup ? $activeGroup->items->filter(fn($i)=>$i->actual_weight!==null)->count() : 0; @endphp {{-- Progress dots --}}
@for($i = 0; $i < $totalItems; $i++)
@endfor {{ $doneCount }} / {{ $totalItems }} completados
@if($currentItem) @php $plannedG = $currentItem->planned_weight * 1000; $tolerance = \App\Models\PreparationGroupItem::DEFAULT_TOLERANCE_PCT; $minG = $plannedG * (1 - $tolerance/100); $maxG = $plannedG * (1 + $tolerance/100); @endphp
{{ $currentItem->formulaItem?->dyestuff?->name ?? '—' }} @if($currentItem->formulaItem?->dyestuff?->supplier) {{ $currentItem->formulaItem->dyestuff->supplier }} @endif
Peso Objetivo
{{ number_format($plannedG,1) }} g
Tolerancia ±{{ $tolerance }}% → {{ number_format($minG,1) }}–{{ number_format($maxG,1) }} g
@if($weighError)
🚫 {{ $weighError }}
@elseif($lotInfo)
✅ {{ $lotInfo['name'] }} · Stock: {{ number_format($lotInfo['qty'],3) }} kg @if($lotInfo['expiry']) · Vence: {{ $lotInfo['expiry'] }}@endif
@endif
@php $actualG = (float)$actualWeight; $varPct = $plannedG > 0 && $actualG > 0 ? (($actualG - $plannedG) / $plannedG * 100) : null; $varAbs = abs($varPct ?? 0); $varClass = $varAbs <= $tolerance ? 'var-ok' : ($varAbs <= $tolerance*1.5 ? 'var-warning' : 'var-error'); $varFillColor = $varAbs <= $tolerance ? '#16a34a' : ($varAbs <= $tolerance*1.5 ? '#d97706' : '#dc2626'); $varFillWidth = min(100, ($varAbs / ($tolerance*2)) * 100); @endphp @if($actualG > 0)
Varianza: {{ $varPct !== null ? (($varPct>0?'+':'').number_format($varPct,1).'%') : '—' }} {{ $varAbs <= $tolerance ? '✅' : ($varAbs <= $tolerance*1.5 ? '⚠️' : '❌') }}
@endif
@error('actualWeight')
{{ $message }}
@enderror @error('scannedBarcode')
{{ $message }}
@enderror @if(isset($varPct) && abs($varPct) > $tolerance)

⚠ Fuera de tolerancia. Se puede confirmar pero quedará registrado para revisión.

@endif
@endif @endif {{-- end active item --}}