diff --git a/modules/turnero/api/quitar_consentimiento.php b/modules/turnero/api/quitar_consentimiento.php
new file mode 100644
index 0000000..8ce16fe
--- /dev/null
+++ b/modules/turnero/api/quitar_consentimiento.php
@@ -0,0 +1,53 @@
+prepare(
+ "SELECT tc.id, tc.turno_id, tc.formulario_id, tc.estado,
+ lf.nombre AS formulario_nombre,
+ t.codigo AS turno_codigo
+ FROM turnero_consentimientos tc
+ JOIN lab_formularios lf ON lf.id = tc.formulario_id
+ JOIN turnero_turnos t ON t.id = tc.turno_id
+ WHERE tc.id = ? LIMIT 1"
+);
+$row->execute([$consentId]);
+$consent = $row->fetch(PDO::FETCH_ASSOC);
+
+if (!$consent) jsonError('Consentimiento no encontrado', 404);
+
+$pdo->prepare('DELETE FROM turnero_consentimientos WHERE id = ?')->execute([$consentId]);
+
+(new ActividadAdmin())->registrar(
+ adminId(),
+ 'turnero_config',
+ 'quitar_consentimiento',
+ $consentId,
+ [
+ 'turno_codigo' => $consent['turno_codigo'],
+ 'turno_id' => $consent['turno_id'],
+ 'formulario_id' => $consent['formulario_id'],
+ 'formulario_nombre' => $consent['formulario_nombre'],
+ 'estado_previo' => $consent['estado'],
+ 'motivo' => $motivo,
+ ]
+);
+
+jsonOk([], 'Consentimiento quitado');
diff --git a/modules/turnero/views/lugar.php b/modules/turnero/views/lugar.php
index 3a468de..d6ef3c9 100644
--- a/modules/turnero/views/lugar.php
+++ b/modules/turnero/views/lugar.php
@@ -843,6 +843,40 @@ require_once __DIR__ . '/../../../shared/components/sidebar.php';
+
+
+
+
+ Quitar consentimiento
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `;
+
return `
${escHtml(c.formulario_nombre || 'Consentimiento')}
${progresoBadge}
${countdownEl}
${label}
-
${btnAccion}${btnVer}
+
${btnAccion}${btnVer}${btnQuitar}
`;
}).join('');
}
+// ── Quitar consentimiento ─────────────────────────────────────
+let _mqcConsentId = null;
+function _abrirModalQuitarConsent(consentId, formNombre) {
+ _mqcConsentId = consentId;
+ document.getElementById('mqc-nombre').textContent = formNombre;
+ document.getElementById('mqc-motivo').value = '';
+ document.getElementById('mqc-error').style.display = 'none';
+ document.getElementById('modal-quitar-consent').style.display = 'flex';
+ setTimeout(() => document.getElementById('mqc-motivo').focus(), 50);
+}
+function _cerrarModalQuitarConsent() {
+ document.getElementById('modal-quitar-consent').style.display = 'none';
+ _mqcConsentId = null;
+}
+async function _confirmarQuitarConsent() {
+ const motivo = document.getElementById('mqc-motivo').value.trim();
+ const errEl = document.getElementById('mqc-error');
+ if (!motivo) { errEl.textContent = 'El motivo es obligatorio.'; errEl.style.display = ''; return; }
+ const btn = document.getElementById('mqc-btn-confirmar');
+ btn.disabled = true;
+ btn.innerHTML = '
Quitando…';
+ try {
+ const res = await fetch(`${API}quitar_consentimiento.php`, {
+ method: 'POST',
+ headers: {'Content-Type':'application/json'},
+ body: JSON.stringify({consent_id: _mqcConsentId, motivo})
+ });
+ const json = await res.json();
+ if (!json.ok) { errEl.textContent = json.error || 'Error al quitar.'; errEl.style.display = ''; }
+ else {
+ _cerrarModalQuitarConsent();
+ if (turnoActivo?.id) actualizarConsentimientos(turnoActivo.id);
+ }
+ } catch(e) { errEl.textContent = 'Error de red.'; errEl.style.display = ''; }
+ btn.disabled = false;
+ btn.innerHTML = '
Quitar';
+}
+
async function actualizarConsentimientos(turnoId) {
if (!turnoId) return;
try {