fix(ui): make all form and writing modals persistent and protect unsaved input

This commit is contained in:
unknown
2026-10-08 18:45:30 -06:00
parent 7c62608519
commit 2c7856f642
4 changed files with 189 additions and 34 deletions
+11 -4
View File
@@ -168,7 +168,6 @@
modal.className = 'modal-qr-backdrop';
modal.id = 'modalRechazarSinpe';
modal.style.cssText = 'display: none; z-index: 99999;';
modal.setAttribute('onclick', 'cerrarModalRechazoSinpe(event)');
modal.innerHTML = `
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; text-align: left; padding: 22px; border-radius: 18px;">
<!-- Encabezado -->
@@ -295,9 +294,17 @@
modal.style.display = 'flex';
};
window.cerrarModalRechazoSinpe = function(event) {
if (event && event.target && event.target !== document.getElementById('modalRechazarSinpe')) {
return;
window.cerrarModalRechazoSinpe = function(force = false) {
if (force && force.target && force.target.classList && force.target.classList.contains('modal-qr-backdrop')) {
return; // Ignorar clic/arrastre sobre el fondo
}
const note = document.getElementById('sinpeRejectNotaAdmin');
const customTxt = document.getElementById('sinpeRejectMotivoCustom');
const isDirty = (note && note.value.trim().length > 0) || (customTxt && customTxt.value.trim().length > 0);
if (force !== true && isDirty) {
if (!confirm('¿Deseas cancelar el rechazo de la recarga? Se perderá la nota escrita.')) {
return;
}
}
const modal = document.getElementById('modalRechazarSinpe');
if (modal) modal.style.display = 'none';