@php // Keyed by procedure id, never by a running counter. A counter passed into // an @include is copied, not shared, so each section would restart at zero // and every section's rows would collide on both form keys and DOM ids. $key = $procedure->id; $latest = $latestMap[$procedure->id] ?? null; $name = "assessments[{$key}]"; $isPassed = (bool) $latest?->isPassing(); $state = $isPassed ? 'passed' : ($latest ? 'retry' : 'pending'); $allowNA = $allowNA ?? false; @endphp