<?php include __DIR__ . '/../includes/header.php'; ensure_can_manage_master_data(); ?>
<div class="table-wrap" style="max-width:760px">
  <h4 class="mb-3">Vacante</h4>
  <form method="post" action="<?= e(base_url('recruitment/vacancy_create.php')) ?>">
    <?php if (!empty($item['id'])): ?><input type="hidden" name="id" value="<?= (int)$item['id'] ?>"><?php endif; ?>
    <div class="mb-3"><label class="form-label">Título</label><input type="text" name="title" class="form-control" value="<?= e($item['title'] ?? '') ?>"></div><div class="mb-3"><label class="form-label">Departamento</label><input type="text" name="department" class="form-control" value="<?= e($item['department'] ?? '') ?>"></div><div class="mb-3"><label class="form-label">Ubicación</label><input type="text" name="location" class="form-control" value="<?= e($item['location'] ?? '') ?>"></div><div class="mb-3"><label class="form-label">Estado</label><select name="status" class="form-select"><option value="Abierta" <?= (($item['status'] ?? '') === 'Abierta') ? 'selected' : '' ?>>Abierta</option><option value="Cerrada" <?= (($item['status'] ?? '') === 'Cerrada') ? 'selected' : '' ?>>Cerrada</option></select></div><div class="mb-3"><label class="form-label">Descripción</label><textarea name="description" class="form-control" rows="3"><?= e($item['description'] ?? '') ?></textarea></div>
    <div class="d-flex gap-2"><button class="btn btn-primary">Guardar</button><a class="btn btn-outline-secondary" href="<?= e(base_url('recruitment/index.php')) ?>">Volver</a></div>
  </form>
</div>
<?php include __DIR__ . '/../includes/footer.php'; ?>