fix(pos,admin): posicionar boton Salir arriba a la derecha con logout directo en POS y asegurar filtro de rechazados con estilos forzados y rutas correctas

This commit is contained in:
unknown
2026-10-07 01:49:12 -06:00
parent 33a32413f0
commit 51d534d330
6 changed files with 106 additions and 36 deletions
+33
View File
@@ -4840,3 +4840,36 @@ body.dark-mode .sinpe-card-receipt {
border-color: #059669; border-color: #059669;
} }
/* Filtros de Historial de Movimientos */
.mov-filter-btn {
padding: 6px 14px;
border: none;
border-radius: 8px;
font-weight: 700;
font-size: 0.8rem;
cursor: pointer;
background: transparent;
color: #64748b;
white-space: nowrap;
transition: all 0.15s ease;
user-select: none;
}
.mov-filter-btn.active {
background: #ffffff !important;
color: #0284c7 !important;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
font-weight: 800 !important;
}
body.dark-mode .mov-filter-btn {
color: #94a3b8;
}
body.dark-mode .mov-filter-btn.active {
background: #1e293b !important;
color: #38bdf8 !important;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}
+2 -2
View File
@@ -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=10.5"> <link rel="stylesheet" href="/css/styles.css?v=10.6">
<style> <style>
/* Transiciones suaves */ /* Transiciones suaves */
.fade-enter { animation: fadeIn 0.2s ease-in-out; } .fade-enter { animation: fadeIn 0.2s ease-in-out; }
@@ -2639,6 +2639,6 @@
<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=10.5"></script> <script src="/js/app.js?v=10.6"></script>
</body> </body>
</html> </html>
+21 -9
View File
@@ -74,6 +74,16 @@ document.addEventListener('DOMContentLoaded', async () => {
}).catch(err => console.log('SW error:', err)); }).catch(err => console.log('SW error:', err));
} }
// Verificar si se solicitó cerrar sesión
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('logout') === 'true') {
localStorage.removeItem('sibopay_token');
localStorage.removeItem('sibopay_user');
localStorage.removeItem('recreopay_token');
localStorage.removeItem('recreopay_user');
sessionStorage.clear();
}
// Verificar si hay sesión activa guardada // Verificar si hay sesión activa guardada
const storedUser = localStorage.getItem('sibopay_user') || localStorage.getItem('recreopay_user'); const storedUser = localStorage.getItem('sibopay_user') || localStorage.getItem('recreopay_user');
if (storedUser) { if (storedUser) {
@@ -5140,7 +5150,7 @@ async function loadAdminMovimientos() {
</div> </div>
`; `;
const res = await fetch('/api/admin/movimientos?limit=100'); const res = await fetch('/api/admin/movimientos?limit=100&_t=' + Date.now());
if (!res.ok) throw new Error('Error al cargar movimientos desde el servidor'); if (!res.ok) throw new Error('Error al cargar movimientos desde el servidor');
adminMovimientosData = await res.json(); adminMovimientosData = await res.json();
renderAdminMovimientos(); renderAdminMovimientos();
@@ -5149,6 +5159,7 @@ async function loadAdminMovimientos() {
container.innerHTML = `<div style="text-align: center; color: #ef4444; padding: 25px; font-weight: 700;">Error al cargar el historial: ${err.message}</div>`; container.innerHTML = `<div style="text-align: center; color: #ef4444; padding: 25px; font-weight: 700;">Error al cargar el historial: ${err.message}</div>`;
} }
} }
window.loadAdminMovimientos = loadAdminMovimientos;
function setMovFilter(filter) { function setMovFilter(filter) {
currentMovFilter = filter; currentMovFilter = filter;
@@ -5160,20 +5171,20 @@ function setMovFilter(filter) {
[btnAll, btnRecargas, btnCobros, btnRechazados].forEach(b => { [btnAll, btnRecargas, btnCobros, btnRechazados].forEach(b => {
if (!b) return; if (!b) return;
b.classList.remove('active'); b.classList.remove('active');
b.style.background = 'transparent'; b.style.setProperty('background', 'transparent', 'important');
b.style.color = '#64748b'; b.style.setProperty('color', '#64748b', 'important');
b.style.boxShadow = 'none'; b.style.setProperty('box-shadow', 'none', 'important');
b.style.fontWeight = '700'; b.style.setProperty('font-weight', '700', 'important');
}); });
const isRechazadosTab = filter === 'rechazados' || filter === 'rechazado'; const isRechazadosTab = filter === 'rechazados' || filter === 'rechazado';
const activeBtn = filter === 'recargas' ? btnRecargas : (filter === 'cobros' ? btnCobros : (isRechazadosTab ? btnRechazados : btnAll)); const activeBtn = filter === 'recargas' ? btnRecargas : (filter === 'cobros' ? btnCobros : (isRechazadosTab ? btnRechazados : btnAll));
if (activeBtn) { if (activeBtn) {
activeBtn.classList.add('active'); activeBtn.classList.add('active');
activeBtn.style.background = '#ffffff'; activeBtn.style.setProperty('background', '#ffffff', 'important');
activeBtn.style.color = '#0284c7'; activeBtn.style.setProperty('color', '#0284c7', 'important');
activeBtn.style.boxShadow = '0 1px 3px rgba(0,0,0,0.08)'; activeBtn.style.setProperty('box-shadow', '0 1px 4px rgba(0,0,0,0.08)', 'important');
activeBtn.style.fontWeight = '800'; activeBtn.style.setProperty('font-weight', '800', 'important');
} }
if (!adminMovimientosData || adminMovimientosData.length === 0) { if (!adminMovimientosData || adminMovimientosData.length === 0) {
@@ -5183,6 +5194,7 @@ function setMovFilter(filter) {
} }
if (window.sounds) window.sounds.playTap(); if (window.sounds) window.sounds.playTap();
} }
window.setMovFilter = setMovFilter;
function filterMovimientosUI() { function filterMovimientosUI() {
renderAdminMovimientos(); renderAdminMovimientos();
+1 -1
View File
@@ -1872,7 +1872,6 @@ async function procesarSinpePos(solicitudId, accion) {
} }
function posLogout() { function posLogout() {
if (!confirm('¿Deseas cerrar sesión en la terminal POS?')) return;
try { try {
localStorage.removeItem('sibopay_token'); localStorage.removeItem('sibopay_token');
localStorage.removeItem('sibopay_user'); localStorage.removeItem('sibopay_user');
@@ -1882,4 +1881,5 @@ function posLogout() {
} catch (e) {} } catch (e) {}
window.location.href = '/index.html?logout=true'; window.location.href = '/index.html?logout=true';
} }
window.posLogout = posLogout;
+32 -7
View File
@@ -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=10.5"> <link rel="stylesheet" href="/css/styles.css?v=10.6">
<style> <style>
/* Estilos específicos de terminal de alta velocidad */ /* Estilos específicos de terminal de alta velocidad */
.student-badge-scanned { .student-badge-scanned {
@@ -39,6 +39,20 @@
to { transform: rotate(360deg); } to { transform: rotate(360deg); }
} }
</style> </style>
<script>
function posLogout() {
try {
localStorage.removeItem('sibopay_token');
localStorage.removeItem('sibopay_user');
localStorage.removeItem('recreopay_token');
localStorage.removeItem('recreopay_user');
sessionStorage.clear();
} catch (e) {}
window.location.href = '/index.html?logout=true';
}
window.posLogout = posLogout;
</script>
</head>
<body class="pos-mobile-view-catalog" style="background: #f8fafc; color: #0f172a;"> <body class="pos-mobile-view-catalog" style="background: #f8fafc; color: #0f172a;">
<!-- BANNER DE ADVERTENCIA HTTPS PARA TERMINALES REMOTAS --> <!-- BANNER DE ADVERTENCIA HTTPS PARA TERMINALES REMOTAS -->
@@ -58,12 +72,18 @@
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/></svg> Caja / Cobro QR <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/></svg> Caja / Cobro QR
<span class="pos-mobile-nav-badge" id="mobileCartBadge" style="display: none;">0</span> <span class="pos-mobile-nav-badge" id="mobileCartBadge" style="display: none;">0</span>
</button> </button>
<button type="button" onclick="posLogout()" class="pos-mobile-nav-btn" style="flex: 0 0 auto; padding: 10px 14px; background: #fef2f2; border: 1.5px solid #fecaca; color: #dc2626; font-weight: 800; border-radius: 10px; cursor: pointer;" title="Cerrar sesión de la terminal">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
<span>Salir</span>
</button>
</div> </div>
<div class="pos-layout"> <div class="pos-layout">
<!-- PANEL IZQUIERDO: CATÁLOGO TÁCTIL Y COLA DE PRE-ÓRDENES --> <!-- PANEL IZQUIERDO: CATÁLOGO TÁCTIL Y COLA DE PRE-ÓRDENES -->
<div class="pos-catalog-pane"> <div class="pos-catalog-pane">
<div class="pos-header-card"> <div class="pos-header-card">
<!-- MARCA Y BADGES DE CONEXIÓN -->
<div style="display: flex; align-items: center; gap: 12px; flex-wrap: wrap;">
<div style="display: flex; align-items: center; gap: 10px;"> <div style="display: flex; align-items: center; gap: 10px;">
<img src="/img/sibopay-emblem.png" alt="SiboPay" style="width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(2, 132, 199, 0.3));"> <img src="/img/sibopay-emblem.png" alt="SiboPay" style="width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(2, 132, 199, 0.3));">
<div> <div>
@@ -72,7 +92,7 @@
</div> </div>
</div> </div>
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;"> <div style="display: flex; align-items: center; gap: 6px; flex-wrap: wrap;">
<span id="pistolaStatusBadge" class="saas-status-badge" style="background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; font-weight: 700;" title="Pistola lectora USB/Bluetooth lista para escanear en cualquier momento"> <span id="pistolaStatusBadge" class="saas-status-badge" style="background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; font-weight: 700;" title="Pistola lectora USB/Bluetooth lista para escanear en cualquier momento">
<span class="saas-dot" style="background: #0284c7;"></span> <span class="saas-dot" style="background: #0284c7;"></span>
Pistola QR Conectada Pistola QR Conectada
@@ -81,15 +101,20 @@
<span class="saas-dot"></span> <span class="saas-dot"></span>
En Línea (SSE) En Línea (SSE)
</span> </span>
<button id="btnPosNotificationToggle" onclick="enablePushNotificationsPrompt()" class="btn-saas btn-saas-outline" style="height: 30px; font-size: 0.76rem; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: #0284c7; border-color: #bae6fd;" title="Activar notificaciones de recargas en tiempo real"> <button id="btnPosNotificationToggle" onclick="enablePushNotificationsPrompt()" class="btn-saas btn-saas-outline" style="height: 32px; font-size: 0.76rem; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: #0284c7; border-color: #bae6fd;" title="Activar notificaciones de recargas en tiempo real">
<span>🔔</span> <span id="lblPosNotificationStatus">Notificaciones</span> <span>🔔</span> <span id="lblPosNotificationStatus">Notificaciones</span>
</button> </button>
<a href="/index.html?tab=admin" class="btn-saas btn-saas-outline" style="height: 30px; font-size: 0.76rem; display: inline-flex; align-items: center; gap: 5px; font-weight: 700;" title="Ir al Panel de Administración"> </div>
</div>
<!-- ARRIBA A LA DERECHA: ADMIN Y SALIR -->
<div style="display: flex; align-items: center; gap: 8px; margin-left: auto;">
<a href="/index.html?tab=admin" class="btn-saas btn-saas-outline" style="height: 32px; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 5px; font-weight: 700;" title="Ir al Panel de Administración">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg> <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>
<span>Admin</span> <span>Admin</span>
</a> </a>
<button type="button" onclick="posLogout()" class="btn-saas btn-saas-danger-subtle" style="height: 30px; font-size: 0.76rem; display: inline-flex; align-items: center; gap: 5px; font-weight: 700; cursor: pointer; color: #dc2626; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 0 10px;" title="Cerrar sesión de la terminal"> <button type="button" onclick="posLogout()" class="btn-saas" style="height: 32px; font-size: 0.82rem; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; cursor: pointer; color: #dc2626; background: #fef2f2; border: 1.5px solid #fecaca; border-radius: 9px; padding: 0 14px; box-shadow: 0 1px 3px rgba(220, 38, 38, 0.1);" title="Cerrar sesión de la terminal">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
<span>Salir</span> <span>Salir</span>
</button> </button>
</div> </div>
@@ -460,6 +485,6 @@
<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=10.1"></script> <script src="/js/pos.js?v=10.2"></script>
</body> </body>
</html> </html>
+2 -2
View File
@@ -1,5 +1,5 @@
// RecreoPay PWA Service Worker v8.7 - Soporte Web Push VAPID en Segundo Plano // RecreoPay PWA Service Worker v8.8 - Soporte Web Push VAPID en Segundo Plano
const CACHE_NAME = 'recreopay-v8.7'; const CACHE_NAME = 'recreopay-v8.8';
const STATIC_ASSETS = [ const STATIC_ASSETS = [
'/', '/',
'/index.html', '/index.html',