fix: propagar genero al seleccionar paciente recién creado o editado
Al crear un paciente nuevo desde el modal, el objeto no incluía genero por lo que el bloque embarazada no se ocultaba para masculinos. Al editar también se actualiza genero y se re-evalúa la visibilidad del bloque. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
5bc6ddfadd
commit
69793dd9c4
@@ -2879,11 +2879,15 @@ async function mpacGuardar() {
|
||||
pacienteActivo.numero_documento = docVal;
|
||||
pacienteActivo.tipo_documento = tipoDoc;
|
||||
pacienteActivo.telefono = tel;
|
||||
pacienteActivo.genero = document.getElementById('mpac-genero').value;
|
||||
document.getElementById('lbl-pac-nombre').textContent =
|
||||
(pacienteActivo.full_name || nombre).trim();
|
||||
document.getElementById('lbl-pac-doc').textContent =
|
||||
tipoDoc + ' ' + (docVal || '');
|
||||
document.getElementById('lbl-pac-cel').textContent = tel || '';
|
||||
const esMasc = (pacienteActivo.genero || '').toUpperCase() === 'M';
|
||||
document.getElementById('bloque-embarazada').style.display = esMasc ? 'none' : '';
|
||||
if (esMasc) document.getElementById('chk-embarazada').checked = false;
|
||||
}
|
||||
} else {
|
||||
// Creación: vincular al turno automáticamente
|
||||
@@ -2894,6 +2898,7 @@ async function mpacGuardar() {
|
||||
tipo_documento: tipoDoc,
|
||||
numero_documento: docVal,
|
||||
telefono: tel,
|
||||
genero: document.getElementById('mpac-genero').value,
|
||||
};
|
||||
seleccionarPaciente(nuevoPac);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user