<?php $id = (int) $item['id']; $name = 'items.' . $id; ?>
<div class="field-row" data-item-id="<?= $id ?>">
    <div class="field-row-head">
        <span class="num"><?= esc($item['numero'] ?? '') ?></span>
        <span class="q"><?= esc($item['pregunta']) ?><?= !empty($item['obligatorio']) ? ' <em>*</em>' : '' ?></span>
        <?php if (! empty($item['equipo'])): ?><span class="equipment"><?= esc($item['equipo']) ?></span><?php endif; ?>
        <span class="freq"><?= esc($item['frecuencia'] ?? '') ?></span>
    </div>
    <div class="snn-radios">
        <?php foreach ([1 => 'S', 0 => 'N', 2 => 'N/A'] as $val => $lab): ?>
            <label class="snn-opt">
                <input type="radio" name="<?= esc($name) ?>.value_bool" value="<?= $val ?>"
                       data-bind="items.<?= $id ?>.value_bool"
                       <?= isset($saved['value_bool']) && (int) $saved['value_bool'] === (int) $val ? 'checked' : '' ?>>
                <span><?= esc($lab) ?></span>
            </label>
        <?php endforeach; ?>
    </div>
    <div class="grid grid-2">
        <input type="text" placeholder="Lecturas" data-bind="items.<?= $id ?>.lecturas" value="<?= esc($saved['lecturas'] ?? '') ?>">
        <input type="text" placeholder="Comentarios" data-bind="items.<?= $id ?>.comentarios" value="<?= esc($saved['comentarios'] ?? '') ?>">
    </div>
</div>
