{{-- One section's row of answer inputs, laid out by its EntGrading layout. Shared by the answer-key page (admin/ent_variants/keys) and the answer-sheet form (admin/ent_sheets/form) — they post the same shape, {name}[question_no], and EntSheetGrader::normaliseSection() reads both. Expects: $section (EntSheetGrader::sections() row with a layout), $name (input name prefix), $values (question no => current value). Typing moves to the next cell once a cell is full (one letter for single choice, two for matching) so a sheet can be typed straight off the paper. Multiple-choice cells don't auto-advance: their length isn't fixed. --}} @php $typeLabels = [ \App\Support\EntGrading::SINGLE => [__('Один ответ'), 1], \App\Support\EntGrading::MATCHING => [__('Соответствие (2 буквы)'), 2], \App\Support\EntGrading::MULTIPLE => [__('Один или несколько'), 6], ]; $groups = []; foreach ($section['layout'] as $no => $type) { $last = array_key_last($groups); if ($last === null || $groups[$last]['type'] !== $type) { $groups[] = ['type' => $type, 'nos' => []]; $last = array_key_last($groups); } $groups[$last]['nos'][] = $no; } @endphp @foreach ($groups as $group)