feat(sinpe): modal de validación en tiempo real con animación, sondeo de 18s y cero alertas nativas
This commit is contained in:
+203
-19
@@ -12,7 +12,7 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="apple-mobile-web-app-title" content="SiboPay">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<link rel="stylesheet" href="/css/styles.css?v=10.0">
|
||||
<link rel="stylesheet" href="/css/styles.css?v=10.1">
|
||||
<style>
|
||||
/* Transiciones suaves */
|
||||
.fade-enter { animation: fadeIn 0.2s ease-in-out; }
|
||||
@@ -1034,29 +1034,67 @@
|
||||
<span style="font-size: 0.7rem; color: #166534; background: #dcfce7; font-weight: 800; padding: 3px 8px; border-radius: 6px;">Inmediato</span>
|
||||
</div>
|
||||
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;">
|
||||
<div>
|
||||
<label for="inputParentSinpeMonto" style="display: block; font-size: 0.78rem; font-weight: 800; color: #166534; margin-bottom: 4px;">
|
||||
Monto a recargar (₡):
|
||||
</label>
|
||||
<div style="position: relative;">
|
||||
<span style="position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-weight: 900; color: #166534; font-size: 1.05rem;">₡</span>
|
||||
<input type="tel" inputmode="numeric" pattern="[0-9]*" id="inputParentSinpeMonto" placeholder="Ej: 3000" style="width: 100%; padding: 10px 10px 10px 28px; border-radius: 10px; border: 1.5px solid #86efac; font-size: 1.05rem; font-weight: 800; color: #166534; background: white; box-sizing: border-box;">
|
||||
</div>
|
||||
<!-- 1. Monto a Recargar -->
|
||||
<div style="margin-bottom: 12px;">
|
||||
<label for="inputParentSinpeMonto" style="display: block; font-size: 0.80rem; font-weight: 800; color: #166534; margin-bottom: 4px;">
|
||||
1. Monto a recargar (₡):
|
||||
</label>
|
||||
<div style="position: relative;">
|
||||
<span style="position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-weight: 900; color: #166534; font-size: 1.1rem;">₡</span>
|
||||
<input type="tel" inputmode="numeric" pattern="[0-9]*" id="inputParentSinpeMonto" placeholder="Ej: 3000" style="width: 100%; padding: 10px 12px 10px 30px; border-radius: 10px; border: 1.8px solid #86efac; font-size: 1.1rem; font-weight: 800; color: #166534; background: white; box-sizing: border-box; outline: none;">
|
||||
</div>
|
||||
<div>
|
||||
<label for="inputParentSinpeComprobante" style="display: block; font-size: 0.78rem; font-weight: 800; color: #166534; margin-bottom: 4px;">
|
||||
N° Comprobante SINPE:
|
||||
</label>
|
||||
<input type="text" id="inputParentSinpeComprobante" placeholder="Ej: 894321" style="width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid #86efac; font-size: 1.05rem; font-weight: 800; color: #166534; background: white; box-sizing: border-box;">
|
||||
<!-- Montos sugeridos rápidos -->
|
||||
<div style="display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap;">
|
||||
<button type="button" onclick="setParentSinpeMonto(1000)" style="background: white; border: 1px solid #86efac; color: #166534; font-size: 0.74rem; font-weight: 700; padding: 4px 9px; border-radius: 8px; cursor: pointer;">₡1.000</button>
|
||||
<button type="button" onclick="setParentSinpeMonto(2000)" style="background: white; border: 1px solid #86efac; color: #166534; font-size: 0.74rem; font-weight: 700; padding: 4px 9px; border-radius: 8px; cursor: pointer;">₡2.000</button>
|
||||
<button type="button" onclick="setParentSinpeMonto(3000)" style="background: white; border: 1px solid #86efac; color: #166534; font-size: 0.74rem; font-weight: 700; padding: 4px 9px; border-radius: 8px; cursor: pointer;">₡3.000</button>
|
||||
<button type="button" onclick="setParentSinpeMonto(5000)" style="background: white; border: 1px solid #86efac; color: #166534; font-size: 0.74rem; font-weight: 700; padding: 4px 9px; border-radius: 8px; cursor: pointer;">₡5.000</button>
|
||||
<button type="button" onclick="setParentSinpeMonto(10000)" style="background: white; border: 1px solid #86efac; color: #166534; font-size: 0.74rem; font-weight: 700; padding: 4px 9px; border-radius: 8px; cursor: pointer;">₡10.000</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" id="btnParentValidarSinpe" onclick="executeParentSinpeRecharge()" style="width: 100%; padding: 13px; background: linear-gradient(135deg, #16a34a, #15803d); color: white; border: none; border-radius: 12px; font-weight: 900; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
|
||||
<span>Validar SINPE</span>
|
||||
<!-- 2. Caja de Código de Detalle Obligatorio -->
|
||||
<div style="background: #ffffff; border: 2px dashed #16a34a; border-radius: 12px; padding: 12px; margin-bottom: 12px; text-align: center; box-shadow: 0 2px 6px rgba(22, 163, 74, 0.06);">
|
||||
<div style="font-size: 0.74rem; font-weight: 800; color: #15803d; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px;">
|
||||
2. Código Obligatorio en el Detalle
|
||||
</div>
|
||||
<p style="font-size: 0.72rem; color: #475569; margin: 0 0 8px 0; line-height: 1.3;">
|
||||
En la app de tu banco, coloca este código en el campo <strong>"Detalle"</strong> o <strong>"Motivo"</strong>:
|
||||
</p>
|
||||
|
||||
<div style="display: flex; align-items: center; justify-content: center; gap: 8px; background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 10px; padding: 8px 12px; margin-bottom: 6px;">
|
||||
<span id="parentSinpeCodigoDisplay" style="font-family: 'Courier New', Courier, monospace; font-size: 1.45rem; font-weight: 900; color: #166534; letter-spacing: 1.5px; user-select: all;">SIBO-CARGANDO</span>
|
||||
<button type="button" id="btnCopiarCodigoSinpe" onclick="copiarCodigoSinpe()" style="background: #16a34a; color: white; border: none; padding: 7px 12px; border-radius: 8px; font-weight: 800; font-size: 0.80rem; cursor: pointer; display: flex; align-items: center; gap: 4px; box-shadow: 0 2px 5px rgba(22, 163, 74, 0.25);">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
|
||||
<span id="lblCopiarCodigoSinpe">Copiar código</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; font-size: 0.68rem; color: #64748b; padding: 0 2px;">
|
||||
<span>Válido pegado, con guión o minúsculas.</span>
|
||||
<button type="button" onclick="obtenerNuevoCodigoSinpe()" style="background: none; border: none; color: #0284c7; font-weight: 700; cursor: pointer; text-decoration: underline; font-size: 0.68rem; padding: 0;">
|
||||
🔄 Cambiar código
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 3. Comprobante Opcional -->
|
||||
<div style="margin-bottom: 12px;">
|
||||
<label for="inputParentSinpeComprobante" style="display: block; font-size: 0.76rem; font-weight: 800; color: #166534; margin-bottom: 3px;">
|
||||
3. N° de Comprobante bancario <span style="font-size: 0.68rem; font-weight: 600; color: #64748b;">(Opcional)</span>:
|
||||
</label>
|
||||
<input type="text" id="inputParentSinpeComprobante" placeholder="Ej: 894321 (Opcional si pusiste el código en el detalle)" style="width: 100%; padding: 9px 11px; border-radius: 10px; border: 1.5px solid #86efac; font-size: 0.95rem; font-weight: 700; color: #166534; background: white; box-sizing: border-box;">
|
||||
</div>
|
||||
|
||||
<!-- Botón de Validar SINPE -->
|
||||
<button type="button" id="btnParentValidarSinpe" onclick="executeParentSinpeRecharge()" style="width: 100%; padding: 13px; background: linear-gradient(135deg, #16a34a, #15803d); color: white; border: none; border-radius: 12px; font-weight: 900; font-size: 0.98rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);">
|
||||
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
|
||||
<span id="btnParentValidarSinpeText">Validar SINPE</span>
|
||||
</button>
|
||||
|
||||
<!-- Banner de estado dinámico -->
|
||||
<div id="parentSinpeStatusMsg" style="display: none; margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 0.80rem; line-height: 1.4;"></div>
|
||||
|
||||
<!-- LISTA DE SOLICITUDES SINPE PENDIENTES DEL HIJO -->
|
||||
<div id="parentSinpePendingBox" style="margin-top: 14px; border-top: 1px dashed #86efac; padding-top: 10px; display: none;">
|
||||
<div style="font-size: 0.76rem; font-weight: 800; color: #166534; margin-bottom: 6px;">Estado de Recargas Recientes:</div>
|
||||
@@ -2356,6 +2394,152 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ======================================================== -->
|
||||
<!-- MODAL DE VALIDACIÓN Y ESTADO SINPE EN TIEMPO REAL -->
|
||||
<!-- ======================================================== -->
|
||||
<div class="modal-qr-backdrop modal-sinpe-backdrop" id="modalSinpeValidacion" style="display: none;" onclick="handleSinpeBackdropClick(event)">
|
||||
<div class="modal-qr-card modal-sinpe-card" onclick="event.stopPropagation()">
|
||||
<button type="button" class="modal-sinpe-close-btn" id="modalSinpeBtnCloseX" onclick="closeSinpeModal()" style="display: none;" title="Cerrar">✕</button>
|
||||
|
||||
<!-- 1. ESTADO: CARGANDO / VALIDANDO SINPE (10-20s con barra y animación) -->
|
||||
<div id="modalSinpeStateLoading" style="display: none;">
|
||||
<div class="sinpe-spinner-container">
|
||||
<div class="sinpe-pulse-ring"></div>
|
||||
<div class="sinpe-icon-badge loading">
|
||||
<svg class="sinpe-spin-svg" width="38" height="38" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="10" stroke="#dcfce7" stroke-width="3"/>
|
||||
<path d="M12 2a10 10 0 0 1 10 10" stroke="#16a34a" stroke-width="3" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 style="margin: 14px 0 4px 0; font-size: 1.25rem; font-weight: 900; color: var(--text-main);">Validando SINPE</h3>
|
||||
<p id="modalSinpeLoadingSubtext" style="font-size: 0.85rem; color: #64748b; margin: 0 0 14px 0; line-height: 1.35;">
|
||||
Consultando confirmación bancaria en tiempo real...
|
||||
</p>
|
||||
|
||||
<!-- Barra de Progreso y Cuenta Regresiva de 18s -->
|
||||
<div class="sinpe-progress-track">
|
||||
<div class="sinpe-progress-bar" id="modalSinpeProgressBar"></div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 0.72rem; color: #64748b; font-weight: 700;">
|
||||
<span id="modalSinpeStepText">Buscando comprobante bancario...</span>
|
||||
<span id="modalSinpeTimerText" style="color: #16a34a; font-weight: 900; font-family: monospace; font-size: 0.82rem;">18s</span>
|
||||
</div>
|
||||
|
||||
<!-- Resumen de la Operación -->
|
||||
<div class="sinpe-info-summary">
|
||||
<div class="sinpe-info-row">
|
||||
<span>Estudiante:</span>
|
||||
<strong id="modalSinpeSummaryChild">-</strong>
|
||||
</div>
|
||||
<div class="sinpe-info-row">
|
||||
<span>Monto a validar:</span>
|
||||
<strong id="modalSinpeSummaryMonto" style="color: #16a34a; font-size: 0.96rem;">₡0</strong>
|
||||
</div>
|
||||
<div class="sinpe-info-row">
|
||||
<span>Código de detalle:</span>
|
||||
<strong id="modalSinpeSummaryCodigo" style="font-family: monospace; letter-spacing: 0.5px; color: #15803d;">-</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="font-size: 0.73rem; color: #64748b; margin-top: 14px; line-height: 1.4; background: #f8fafc; padding: 9px 12px; border-radius: 10px; border: 1px solid #e2e8f0; text-align: left;">
|
||||
<span style="font-weight: 800; color: #334155;">⏳ Espere un momento, por favor:</span> Los bancos emiten el comprobante digital entre 10 y 20 segundos después de realizar el envío.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. ESTADO: ÉXITO / VALIDADO -->
|
||||
<div id="modalSinpeStateSuccess" style="display: none;">
|
||||
<div class="sinpe-icon-badge success">
|
||||
<svg width="42" height="42" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
|
||||
<polyline points="22 4 12 14.01 9 11.01"/>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<h3 style="margin: 14px 0 4px 0; font-size: 1.25rem; font-weight: 900; color: #15803d;">¡Pago Verificado con Éxito!</h3>
|
||||
<p style="font-size: 0.84rem; color: #64748b; margin: 0 0 12px 0;">
|
||||
El dinero fue acreditado automáticamente al monedero.
|
||||
</p>
|
||||
|
||||
<div class="sinpe-card-receipt">
|
||||
<div style="font-size: 0.72rem; text-transform: uppercase; color: #166534; font-weight: 800; letter-spacing: 0.5px; margin-bottom: 2px;">Monto Acreditado</div>
|
||||
<div id="modalSinpeSuccessMonto" style="font-size: 1.8rem; font-weight: 900; color: #15803d; margin-bottom: 10px;">₡0</div>
|
||||
|
||||
<div class="sinpe-info-row">
|
||||
<span>Estudiante:</span>
|
||||
<strong id="modalSinpeSuccessChild">-</strong>
|
||||
</div>
|
||||
<div class="sinpe-info-row">
|
||||
<span>Banco emisor:</span>
|
||||
<strong id="modalSinpeSuccessBanco">Banco</strong>
|
||||
</div>
|
||||
<div class="sinpe-info-row">
|
||||
<span>Comprobante:</span>
|
||||
<strong id="modalSinpeSuccessComp" style="font-family: monospace;">-</strong>
|
||||
</div>
|
||||
<div class="sinpe-info-row" style="border-top: 1px dashed #86efac; padding-top: 8px; margin-top: 6px;">
|
||||
<span style="font-weight: 800; color: #166534;">Nuevo Saldo Disponible:</span>
|
||||
<strong id="modalSinpeSuccessNuevoSaldo" style="color: #15803d; font-size: 1.05rem;">₡0</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn-sinpe-action btn-sinpe-success" onclick="closeSinpeModal()">
|
||||
<span>Aceptar y Continuar</span>
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 3. ESTADO: PENDIENTE DE REVISIÓN COMERCIO (Timeout / sin notificación bancaria) -->
|
||||
<div id="modalSinpeStatePending" style="display: none;">
|
||||
<div class="sinpe-icon-badge pending">
|
||||
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="10"/>
|
||||
<polyline points="12 6 12 12 16 14"/>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<h3 style="margin: 14px 0 4px 0; font-size: 1.25rem; font-weight: 900; color: #b45309;">Solicitud en Revisión</h3>
|
||||
<p style="font-size: 0.85rem; color: #475569; margin: 0 0 14px 0; line-height: 1.45;">
|
||||
Aún no ingresó la confirmación de tu banco. Tu solicitud de recarga por <strong>₡<span id="modalSinpePendingMonto">0</span></strong> quedó registrada para que el comercio la valide.
|
||||
</p>
|
||||
|
||||
<div style="background: #fffbeb; border: 1.5px solid #fde68a; border-radius: 12px; padding: 12px; margin-bottom: 16px; text-align: left; font-size: 0.78rem; color: #92400e; line-height: 1.45;">
|
||||
<div style="font-weight: 800; display: flex; align-items: center; gap: 5px; margin-bottom: 4px;">
|
||||
<span>⚡ Acreditación Automática:</span>
|
||||
</div>
|
||||
Si la notificación del banco entra en los próximos minutos, el sistema la acreditará de forma automática sin que tengas que hacer nada más.
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn-sinpe-action btn-sinpe-pending" onclick="closeSinpeModal()">
|
||||
<span>Entendido</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 4. ESTADO: ERROR / INVÁLIDO / REPETIDO -->
|
||||
<div id="modalSinpeStateError" style="display: none;">
|
||||
<div class="sinpe-icon-badge error">
|
||||
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="10"/>
|
||||
<line x1="12" y1="8" x2="12" y2="12"/>
|
||||
<line x1="12" y1="16" x2="12.01" y2="16"/>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<h3 id="modalSinpeErrorTitle" style="margin: 14px 0 4px 0; font-size: 1.22rem; font-weight: 900; color: #b91c1c;">No se pudo validar</h3>
|
||||
<p id="modalSinpeErrorMessage" style="font-size: 0.86rem; color: #475569; margin: 0 0 16px 0; line-height: 1.45;">
|
||||
Ocurrió un inconveniente al validar la recarga.
|
||||
</p>
|
||||
|
||||
<button type="button" class="btn-sinpe-action btn-sinpe-error" onclick="closeSinpeModal()">
|
||||
<span>Entendido</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- BARRA DE NAVEGACIÓN INFERIOR PWA (MÓVILES) -->
|
||||
<nav class="pwa-bottom-nav" id="pwaBottomNav" style="display: none;">
|
||||
<button class="pwa-nav-item active" id="pwaNavMenu" onclick="pwaNavigateTo('menu')">
|
||||
@@ -2383,6 +2567,6 @@
|
||||
<script src="/js/sounds.js?v=9.6"></script>
|
||||
<script src="/js/jsQR.js"></script>
|
||||
<script src="/js/food-icons.js?v=1.1"></script>
|
||||
<script src="/js/app.js?v=10.2"></script>
|
||||
<script src="/js/app.js?v=10.3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user