fix(sinpe): asegurar visibilidad y apertura dinamica del modal de rechazo de recargas
This commit is contained in:
+5
-3
@@ -12,7 +12,7 @@
|
|||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
<meta name="apple-mobile-web-app-title" content="SiboPay">
|
<meta name="apple-mobile-web-app-title" content="SiboPay">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<link rel="stylesheet" href="/css/styles.css?v=13.4">
|
<link rel="stylesheet" href="/css/styles.css?v=13.5">
|
||||||
<link rel="stylesheet" href="/css/desktop.css?v=2.2">
|
<link rel="stylesheet" href="/css/desktop.css?v=2.2">
|
||||||
<style>
|
<style>
|
||||||
/* Transiciones suaves */
|
/* Transiciones suaves */
|
||||||
@@ -3248,6 +3248,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- MODAL: RECHAZAR RECARGA SINPE CON MOTIVO Y TRAZABILIDAD -->
|
<!-- MODAL: RECHAZAR RECARGA SINPE CON MOTIVO Y TRAZABILIDAD -->
|
||||||
<div class="modal-qr-backdrop" id="modalRechazarSinpe" style="display: none; z-index: 99999;" onclick="cerrarModalRechazoSinpe(event)">
|
<div class="modal-qr-backdrop" id="modalRechazarSinpe" style="display: none; z-index: 99999;" onclick="cerrarModalRechazoSinpe(event)">
|
||||||
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; text-align: left; padding: 22px; border-radius: 18px;">
|
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; text-align: left; padding: 22px; border-radius: 18px;">
|
||||||
@@ -3363,10 +3365,10 @@
|
|||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<script src="/js/dialogs.js?v=13.4"></script>
|
<script src="/js/dialogs.js?v=13.5"></script>
|
||||||
<script src="/js/sounds.js?v=9.6"></script>
|
<script src="/js/sounds.js?v=9.6"></script>
|
||||||
<script src="/js/jsQR.js"></script>
|
<script src="/js/jsQR.js"></script>
|
||||||
<script src="/js/food-icons.js?v=1.1"></script>
|
<script src="/js/food-icons.js?v=1.1"></script>
|
||||||
<script src="/js/app.js?v=13.4"></script>
|
<script src="/js/app.js?v=13.5"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+39
-35
@@ -5903,43 +5903,47 @@ async function procesarSinpeAdmin(solicitudId, accion) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (accion === 'rechazar') {
|
} else if (accion === 'rechazar') {
|
||||||
const sol = (window.cachedAdminSinpeRequests || []).find(s => s.id === solicitudId) || {};
|
const sol = (window.cachedAdminSinpeRequests || []).find(s => s.id == solicitudId) || {};
|
||||||
abrirModalRechazoSinpe({
|
if (typeof window.abrirModalRechazoSinpe === 'function') {
|
||||||
id: solicitudId,
|
window.abrirModalRechazoSinpe({
|
||||||
estudiante_nombre: sol.estudiante_nombre,
|
id: solicitudId,
|
||||||
monto_colones: sol.monto_colones,
|
estudiante_nombre: sol.estudiante_nombre,
|
||||||
comprobante: sol.comprobante_sinpe || sol.codigo_detalle,
|
monto_colones: sol.monto_colones,
|
||||||
onConfirm: async (motivo) => {
|
comprobante: sol.comprobante_sinpe || sol.codigo_detalle,
|
||||||
try {
|
onConfirm: async (motivo) => {
|
||||||
const res = await fetch('/api/sinpe/procesar', {
|
try {
|
||||||
method: 'POST',
|
const res = await fetch('/api/sinpe/procesar', {
|
||||||
headers: { 'Content-Type': 'application/json' },
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
headers: { 'Content-Type': 'application/json' },
|
||||||
solicitud_id: solicitudId,
|
body: JSON.stringify({
|
||||||
accion: 'rechazar',
|
solicitud_id: solicitudId,
|
||||||
motivo: motivo || 'Rechazado por la soda',
|
accion: 'rechazar',
|
||||||
usuario_id: currentUser ? currentUser.id : null
|
motivo: motivo || 'Rechazado por la soda',
|
||||||
})
|
usuario_id: currentUser ? currentUser.id : null
|
||||||
});
|
})
|
||||||
const data = await res.json();
|
});
|
||||||
if (!res.ok) throw new Error(data.error);
|
const data = await res.json();
|
||||||
|
if (!res.ok) throw new Error(data.error);
|
||||||
|
|
||||||
await showAppAlert({
|
await showAppAlert({
|
||||||
title: 'Recarga Rechazada',
|
title: 'Recarga Rechazada',
|
||||||
message: 'La solicitud de recarga ha sido rechazada y su motivo ha quedado guardado para trazabilidad.',
|
message: 'La solicitud de recarga ha sido rechazada y su motivo ha quedado guardado para trazabilidad.',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
});
|
||||||
loadAdminSinpeRequests();
|
loadAdminSinpeRequests();
|
||||||
await loadAdminData();
|
await loadAdminData();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showAppAlert({
|
showAppAlert({
|
||||||
title: 'Error al Rechazar',
|
title: 'Error al Rechazar',
|
||||||
message: err.message,
|
message: err.message,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} else {
|
||||||
|
console.error('abrirModalRechazoSinpe no está disponible globalmente');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+103
-1
@@ -161,6 +161,108 @@
|
|||||||
// ========================================================
|
// ========================================================
|
||||||
let currentSinpeRejectData = null;
|
let currentSinpeRejectData = null;
|
||||||
|
|
||||||
|
function ensureSinpeRejectModalDom() {
|
||||||
|
let modal = document.getElementById('modalRechazarSinpe');
|
||||||
|
if (!modal) {
|
||||||
|
modal = document.createElement('div');
|
||||||
|
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 -->
|
||||||
|
<div style="display: flex; align-items: center; justify-content: space-between; border-bottom: 1.5px solid var(--border, #e2e8f0); padding-bottom: 10px; margin-bottom: 14px;">
|
||||||
|
<div style="display: flex; align-items: center; gap: 8px;">
|
||||||
|
<span style="font-size: 1.3rem;">🚫</span>
|
||||||
|
<div>
|
||||||
|
<h3 style="margin: 0; font-size: 1.05rem; font-weight: 900; color: #991b1b;">Rechazar Recarga SINPE</h3>
|
||||||
|
<span style="font-size: 0.72rem; color: var(--text-muted, #64748b);">Trazabilidad detallada para la soda y el padre</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" onclick="cerrarModalRechazoSinpe()" style="background: none; border: none; font-size: 1.3rem; color: var(--text-muted, #64748b); cursor: pointer; padding: 4px;">✕</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Resumen de Solicitud -->
|
||||||
|
<div style="background: rgba(148, 163, 184, 0.08); border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.80rem; line-height: 1.45;">
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<span style="color: var(--text-muted, #64748b);">Estudiante:</span>
|
||||||
|
<strong id="rechazoSinpeEstudiante" style="color: var(--text-main, #0f172a);">-</strong>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; margin-top: 3px;">
|
||||||
|
<span style="color: var(--text-muted, #64748b);">Monto Solicitado:</span>
|
||||||
|
<strong id="rechazoSinpeMonto" style="color: #0284c7; font-size: 0.92rem;">₡0</strong>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; margin-top: 3px;">
|
||||||
|
<span style="color: var(--text-muted, #64748b);">Comprobante / Cód:</span>
|
||||||
|
<strong id="rechazoSinpeComprobante" style="color: var(--text-main, #334155);">-</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Motivo de Rechazo (Opciones Rápidas) -->
|
||||||
|
<label style="display: block; font-size: 0.78rem; font-weight: 800; color: var(--text-main, #0f172a); margin-bottom: 6px;">
|
||||||
|
Selecciona el motivo del rechazo:
|
||||||
|
</label>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px;">
|
||||||
|
<label class="sinpe-reject-option" style="display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--border, #e2e8f0); border-radius: 9px; cursor: pointer; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155);">
|
||||||
|
<input type="radio" name="sinpeRejectReason" value="fondos_no_recibidos" checked onchange="toggleSinpeRejectInputs()">
|
||||||
|
<span>🚫 Fondos no recibidos en cuenta bancaria</span>
|
||||||
|
</label>
|
||||||
|
<label class="sinpe-reject-option" style="display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--border, #e2e8f0); border-radius: 9px; cursor: pointer; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155);">
|
||||||
|
<input type="radio" name="sinpeRejectReason" value="monto_no_coincide" onchange="toggleSinpeRejectInputs()">
|
||||||
|
<span>⚠️ Monto no coincide con comprobante</span>
|
||||||
|
</label>
|
||||||
|
<label class="sinpe-reject-option" style="display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--border, #e2e8f0); border-radius: 9px; cursor: pointer; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155);">
|
||||||
|
<input type="radio" name="sinpeRejectReason" value="comprobante_invalido" onchange="toggleSinpeRejectInputs()">
|
||||||
|
<span>📄 Comprobante falso, duplicado o ilegible</span>
|
||||||
|
</label>
|
||||||
|
<label class="sinpe-reject-option" style="display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--border, #e2e8f0); border-radius: 9px; cursor: pointer; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155);">
|
||||||
|
<input type="radio" name="sinpeRejectReason" value="telefono_no_coincide" onchange="toggleSinpeRejectInputs()">
|
||||||
|
<span>📱 Teléfono o destinatario no coincide</span>
|
||||||
|
</label>
|
||||||
|
<label class="sinpe-reject-option" style="display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--border, #e2e8f0); border-radius: 9px; cursor: pointer; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155);">
|
||||||
|
<input type="radio" name="sinpeRejectReason" value="otro" onchange="toggleSinpeRejectInputs()">
|
||||||
|
<span>✏️ Otro motivo personalizado</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Campo de Monto Real cuando el monto no coincide -->
|
||||||
|
<div id="sinpeRejectMontoContainer" style="display: none; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px; margin-bottom: 12px;">
|
||||||
|
<label style="display: block; font-size: 0.75rem; font-weight: 800; color: #92400e; margin-bottom: 4px;">
|
||||||
|
¿De cuánto era realmente el SINPE recibido? (₡):
|
||||||
|
</label>
|
||||||
|
<input type="number" id="sinpeRejectMontoReal" placeholder="Ej: 1000" style="width: 100%; height: 36px; padding: 0 10px; border: 1.5px solid #fcd34d; border-radius: 8px; font-size: 0.88rem; font-weight: 800; color: #92400e; box-sizing: border-box;" oninput="updateSinpeRejectPreview()">
|
||||||
|
<span id="sinpeRejectMontoPreview" style="display: block; font-size: 0.72rem; color: #b45309; margin-top: 4px; font-weight: 600;">
|
||||||
|
Se intentaron recargar ₡0 pero el SINPE fue de ₡0
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Notas o detalles adicionales -->
|
||||||
|
<div style="margin-bottom: 16px;">
|
||||||
|
<label style="display: block; font-size: 0.75rem; font-weight: 700; color: var(--text-muted, #64748b); margin-bottom: 4px;">
|
||||||
|
Detalle u observación adicional (opcional):
|
||||||
|
</label>
|
||||||
|
<input type="text" id="sinpeRejectNotasExtra" placeholder="Ej: Fondos no figuran en estado bancario al corte" style="width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border, #cbd5e1); border-radius: 8px; font-size: 0.80rem; box-sizing: border-box;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Botones de Acción -->
|
||||||
|
<div style="display: flex; gap: 8px; justify-content: flex-end;">
|
||||||
|
<button type="button" onclick="cerrarModalRechazoSinpe()" class="btn-saas btn-saas-outline" style="height: 36px; padding: 0 14px; font-weight: 700; cursor: pointer;">
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
<button type="button" id="btnConfirmarRechazoSinpe" onclick="confirmarRechazoSinpeModal()" class="btn-saas" style="height: 36px; padding: 0 16px; background: #dc2626; color: #ffffff; border: 1px solid #dc2626; font-weight: 800; cursor: pointer;">
|
||||||
|
Confirmar Rechazo
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
} else if (modal.parentElement !== document.body) {
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
}
|
||||||
|
return modal;
|
||||||
|
}
|
||||||
|
|
||||||
window.abrirModalRechazoSinpe = function({ id, estudiante_nombre, monto_colones, comprobante, onConfirm }) {
|
window.abrirModalRechazoSinpe = function({ id, estudiante_nombre, monto_colones, comprobante, onConfirm }) {
|
||||||
currentSinpeRejectData = {
|
currentSinpeRejectData = {
|
||||||
id,
|
id,
|
||||||
@@ -170,7 +272,7 @@
|
|||||||
onConfirm
|
onConfirm
|
||||||
};
|
};
|
||||||
|
|
||||||
const modal = document.getElementById('modalRechazarSinpe');
|
const modal = ensureSinpeRejectModalDom();
|
||||||
if (!modal) return;
|
if (!modal) return;
|
||||||
|
|
||||||
const estEl = document.getElementById('rechazoSinpeEstudiante');
|
const estEl = document.getElementById('rechazoSinpeEstudiante');
|
||||||
|
|||||||
+38
-34
@@ -2389,42 +2389,46 @@ async function procesarSinpePos(solicitudId, accion) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (accion === 'rechazar') {
|
} else if (accion === 'rechazar') {
|
||||||
const sol = (window.cachedSinpeRequests || []).find(s => s.id === solicitudId) || {};
|
const sol = (window.cachedSinpeRequests || []).find(s => s.id == solicitudId) || {};
|
||||||
abrirModalRechazoSinpe({
|
if (typeof window.abrirModalRechazoSinpe === 'function') {
|
||||||
id: solicitudId,
|
window.abrirModalRechazoSinpe({
|
||||||
estudiante_nombre: sol.estudiante_nombre,
|
id: solicitudId,
|
||||||
monto_colones: sol.monto_colones,
|
estudiante_nombre: sol.estudiante_nombre,
|
||||||
comprobante: sol.comprobante_sinpe || sol.codigo_detalle,
|
monto_colones: sol.monto_colones,
|
||||||
onConfirm: async (motivo) => {
|
comprobante: sol.comprobante_sinpe || sol.codigo_detalle,
|
||||||
try {
|
onConfirm: async (motivo) => {
|
||||||
const res = await fetch('/api/sinpe/procesar', {
|
try {
|
||||||
method: 'POST',
|
const res = await fetch('/api/sinpe/procesar', {
|
||||||
headers: { 'Content-Type': 'application/json' },
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
headers: { 'Content-Type': 'application/json' },
|
||||||
solicitud_id: solicitudId,
|
body: JSON.stringify({
|
||||||
accion: 'rechazar',
|
solicitud_id: solicitudId,
|
||||||
motivo: motivo || 'Rechazado por la soda',
|
accion: 'rechazar',
|
||||||
usuario_id: null
|
motivo: motivo || 'Rechazado por la soda',
|
||||||
})
|
usuario_id: null
|
||||||
});
|
})
|
||||||
const data = await res.json();
|
});
|
||||||
if (!res.ok) throw new Error(data.error);
|
const data = await res.json();
|
||||||
|
if (!res.ok) throw new Error(data.error);
|
||||||
|
|
||||||
await showAppAlert({
|
await showAppAlert({
|
||||||
title: 'Recarga Rechazada',
|
title: 'Recarga Rechazada',
|
||||||
message: 'La solicitud de recarga ha sido rechazada y su motivo ha quedado guardado para trazabilidad.',
|
message: 'La solicitud de recarga ha sido rechazada y su motivo ha quedado guardado para trazabilidad.',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
});
|
||||||
loadSinpeRequests();
|
loadSinpeRequests();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showAppAlert({
|
showAppAlert({
|
||||||
title: 'Error al Rechazar',
|
title: 'Error al Rechazar',
|
||||||
message: err.message,
|
message: err.message,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} else {
|
||||||
|
console.error('abrirModalRechazoSinpe no está disponible globalmente');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -5,7 +5,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>SiboPay POS - Terminal de Mostrador y Despacho</title>
|
<title>SiboPay POS - Terminal de Mostrador y Despacho</title>
|
||||||
<link rel="icon" type="image/png" href="/img/sibopay-emblem.png">
|
<link rel="icon" type="image/png" href="/img/sibopay-emblem.png">
|
||||||
<link rel="stylesheet" href="/css/styles.css?v=13.4">
|
<link rel="stylesheet" href="/css/styles.css?v=13.5">
|
||||||
<style>
|
<style>
|
||||||
/* Estilos específicos de terminal de alta velocidad */
|
/* Estilos específicos de terminal de alta velocidad */
|
||||||
.student-badge-scanned {
|
.student-badge-scanned {
|
||||||
@@ -673,10 +673,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/dialogs.js?v=13.4"></script>
|
<script src="/js/dialogs.js?v=13.5"></script>
|
||||||
<script src="/js/sounds.js?v=8.6"></script>
|
<script src="/js/sounds.js?v=8.6"></script>
|
||||||
<script src="/js/jsQR.js"></script>
|
<script src="/js/jsQR.js"></script>
|
||||||
<script src="/js/food-icons.js?v=1.1"></script>
|
<script src="/js/food-icons.js?v=1.1"></script>
|
||||||
<script src="/js/pos.js?v=13.4"></script>
|
<script src="/js/pos.js?v=13.5"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
// SiboPay PWA Service Worker v13.4 - Modales en app, Trazabilidad & Reportes Excel
|
// SiboPay PWA Service Worker v13.5 - Corrección apertura y trazabilidad modal rechazo SINPE
|
||||||
const CACHE_NAME = 'sibopay-v13.4';
|
const CACHE_NAME = 'sibopay-v13.5';
|
||||||
const STATIC_ASSETS = [
|
const STATIC_ASSETS = [
|
||||||
'/',
|
'/',
|
||||||
'/index.html',
|
'/index.html',
|
||||||
|
|||||||
Reference in New Issue
Block a user