<?php $employees = db()->query("SELECT id, full_name FROM employees WHERE status='active' ORDER BY full_name")->fetchAll(); ?>
<div class="row">
  <div class="col-md-6 mb-3"><label class="form-label">Empleado</label>
    <select name="employee_id" class="form-select" required>
      <option value="">Seleccione</option>
      <?php foreach ($employees as $emp): ?>
      <option value="<?= e($emp['id']) ?>" <?= (($item['employee_id'] ?? '') == $emp['id']) ? 'selected' : '' ?>><?= e($emp['full_name']) ?></option>
      <?php endforeach; ?>
    </select>
  </div>
  <div class="col-md-3 mb-3"><label class="form-label">Fecha</label><input type="date" name="attendance_date" class="form-control" required value="<?= e($item['attendance_date'] ?? date('Y-m-d')) ?>"></div>
  <div class="col-md-3 mb-3"><label class="form-label">Entrada</label><input type="time" name="check_in" class="form-control" value="<?= e($item['check_in'] ?? '') ?>"></div>
  <div class="col-md-3 mb-3"><label class="form-label">Salida</label><input type="time" name="check_out" class="form-control" value="<?= e($item['check_out'] ?? '') ?>"></div>
  <div class="col-md-9 mb-3"><label class="form-label">Observación</label><input name="notes" class="form-control" value="<?= e($item['notes'] ?? '') ?>"></div>
</div>
