From a0979e31e79453e20fe3a62508051d9a0261115b Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 3 Jul 2026 08:19:27 -0500 Subject: [PATCH] =?UTF-8?q?recepcion:=20quitar=20bot=C3=B3n=20duplicar=20d?= =?UTF-8?q?el=20historial=20(va=20en=20secci=C3=B3n=20formatos)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/views/recepcion.php | 48 ----------------------------- 1 file changed, 48 deletions(-) diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index 83b146f..17e5396 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -447,13 +447,6 @@ document.addEventListener('DOMContentLoaded', function() {
@@ -1185,7 +1178,6 @@ function seleccionarPaciente(pac) { // Resetear estado colapsado document.getElementById('hist-pac-body').classList.add('d-none'); document.getElementById('btn-hist-toggle').classList.remove('open'); - document.getElementById('btn-duplicar-wrap').classList.remove('d-none'); // Precargar en background (usuario decide si abre) _historialPacienteCargado = false; _historialPacienteId = pac.id; @@ -1222,7 +1214,6 @@ function desvincularPaciente() { document.getElementById('sec-historial-pac').classList.add('d-none'); document.getElementById('hist-pac-body').classList.add('d-none'); document.getElementById('btn-hist-toggle').classList.remove('open'); - document.getElementById('btn-duplicar-wrap').classList.add('d-none'); document.getElementById('lista-pacientes-res').innerHTML = ''; document.getElementById('inp-buscar-pac').value = ''; document.getElementById('chk-embarazada').checked = false; @@ -1761,45 +1752,6 @@ function resetMedico() { quitarMedico(); } -async function duplicarUltimaVisita() { - if (!_historialPacienteId) { mostrarError('No hay paciente seleccionado.'); return; } - mostrarToast('Buscando última visita…', 'info', 1500); - try { - // 1. Obtener el turno más reciente del paciente - const rH = await fetch(`${API}get_historial.php?paciente_id=${_historialPacienteId}&per_page=1&page=1`); - const jH = await rH.json(); - if (!jH.ok || !jH.turnos?.length) { mostrarError('Sin visitas anteriores para duplicar.'); return; } - const ultimoTurnoId = jH.turnos[0].id; - - // 2. Obtener solicitud + exámenes de esa visita - const rS = await fetch(`${API}get_consentimientos.php?turno_id=${ultimoTurnoId}&incluir_solicitud=1`); - const jS = await rS.json(); - if (!jS.ok || !jS.examenes?.length) { mostrarError('La última visita no tiene exámenes registrados.'); return; } - - // 3. Pre-marcar checkboxes con los exam_tipo_ids - const ids = new Set(jS.examenes.map(e => String(e.id))); - let marcados = 0; - document.querySelectorAll('.exam-chk').forEach(c => { - const match = ids.has(c.value); - c.checked = match; - if (match) marcados++; - }); - - // 4. Pre-llenar pago si viene - if (jS.solicitud?.metodo_pago) { - document.getElementById('sel-pago').value = jS.solicitud.metodo_pago; - togglePagoCombinado(); - } - if (jS.solicitud?.total_cobrado) { - document.getElementById('inp-total').value = jS.solicitud.total_cobrado; - } - - mostrarToast(`Duplicado: ${marcados} exámen${marcados !== 1 ? 'es' : ''} copiado${marcados !== 1 ? 's' : ''}.`, 'success', 3000); - } catch (e) { - mostrarError('Error al duplicar: ' + e.message); - } -} - function escJs(s) { return String(s||'').replace(/\\/g,'\\\\').replace(/'/g,"\\'"); } function toggleSoloMuestras() {