464 lines
33 KiB
HTML
464 lines
33 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>SiboPay POS - Terminal de Mostrador y Despacho</title>
|
|
<link rel="icon" type="image/png" href="/img/sibopay-emblem.png">
|
|
<link rel="stylesheet" href="/css/styles.css">
|
|
<style>
|
|
/* Estilos específicos de terminal de alta velocidad */
|
|
.student-badge-scanned {
|
|
background: #0f172a;
|
|
border: 2px solid #38bdf8;
|
|
border-radius: 14px;
|
|
padding: 12px;
|
|
margin-bottom: 14px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
}
|
|
.status-pill {
|
|
font-size: 0.72rem;
|
|
font-weight: 800;
|
|
padding: 3px 8px;
|
|
border-radius: 6px;
|
|
text-transform: uppercase;
|
|
}
|
|
.status-pendiente { background: #fef3c7; color: #92400e; }
|
|
.status-en_preparacion { background: #e0e7ff; color: #3730a3; }
|
|
.status-listo { background: #dcfce7; color: #166534; }
|
|
.status-entregado { background: #f1f5f9; color: #64748b; }
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { transform: scale(1); opacity: 1; }
|
|
50% { transform: scale(1.08); opacity: 0.85; }
|
|
}
|
|
@keyframes spin {
|
|
from { transform: rotate(0deg); }
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
</style>
|
|
<body class="pos-mobile-view-catalog" style="background: #f8fafc; color: #0f172a;">
|
|
|
|
<!-- BANNER DE ADVERTENCIA HTTPS PARA TERMINALES REMOTAS -->
|
|
<div id="posBannerHttpsWarning" style="display: none; background: #b45309; color: white; padding: 10px 14px; font-size: 0.8rem; font-weight: 700; text-align: center;">
|
|
🔒 Terminal en HTTP. Para activar la cámara en vivo del dispositivo, se requiere conexión HTTPS:
|
|
<a id="posLinkHttpsRedirect" href="#" onclick="window.location.protocol = 'https:'; return false;" style="margin-left: 8px; color: white; text-decoration: underline; font-weight: 900;">
|
|
🚀 Abrir en HTTPS Seguro ↗
|
|
</a>
|
|
</div>
|
|
|
|
<!-- BARRA DE PESTAÑAS MÓVIL (PANTALLAS <= 900px) -->
|
|
<div class="pos-mobile-nav" id="posMobileNav">
|
|
<button class="pos-mobile-nav-btn active" id="btnMobileNavCatalog" onclick="switchPosMobileView('catalog')">
|
|
<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="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg> Catálogo
|
|
</button>
|
|
<button class="pos-mobile-nav-btn" id="btnMobileNavCheckout" onclick="switchPosMobileView('checkout')">
|
|
<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>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="pos-layout">
|
|
<!-- PANEL IZQUIERDO: CATÁLOGO TÁCTIL Y COLA DE PRE-ÓRDENES -->
|
|
<div class="pos-catalog-pane">
|
|
<div class="pos-header-card">
|
|
<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));">
|
|
<div>
|
|
<h1 style="font-size: 1.2rem; font-weight: 800; color: #0f172a; margin: 0;">SiboPay <span style="color: #0284c7;">Terminal Soda</span></h1>
|
|
<span style="font-size: 0.76rem; color: #64748b;">Soda Escolar • Ventana de Atención Rápida</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="display: flex; align-items: center; gap: 8px; 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 class="saas-dot" style="background: #0284c7;"></span>
|
|
Pistola QR Conectada
|
|
</span>
|
|
<span class="saas-status-badge saas-status-active" title="Conexión en tiempo real activa">
|
|
<span class="saas-dot"></span>
|
|
En Línea (SSE)
|
|
</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">
|
|
<span>🔔</span> <span id="lblPosNotificationStatus">Notificaciones</span>
|
|
</button>
|
|
<a href="/index.html" class="btn-saas btn-saas-outline" style="height: 30px; font-size: 0.76rem;">
|
|
<svg width="13" height="13" 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:3px;"><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> Admin
|
|
</a>
|
|
<a href="/index.html" target="_blank" class="btn-saas btn-saas-outline" style="height: 30px; font-size: 0.76rem; color: #0284c7; border-color: #bae6fd;">
|
|
<svg width="13" height="13" 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:3px;"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg> PWA Estudiante ↗
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- TABS DE MODO DE TERMINAL (RESPONSIVE SIN RECORTES) -->
|
|
<div class="pos-tabs">
|
|
<button class="pos-tab-btn active" id="tabBtnMostrador" onclick="switchPosTab('mostrador')">
|
|
<span class="tab-icon"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/></svg></span>
|
|
<span class="tab-label-full">Venta de Mostrador</span>
|
|
<span class="tab-label-short">Mostrador</span>
|
|
</button>
|
|
<button class="pos-tab-btn" id="tabBtnPreordenes" onclick="switchPosTab('preordenes')">
|
|
<span class="tab-icon"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7.5 4.27 9 5.15"/><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg></span>
|
|
<span class="tab-label-full">Fila Rápida Pre-Órdenes</span>
|
|
<span class="tab-label-short">Pre-Órdenes</span>
|
|
<span id="badgePreordenesCount" style="background: #ef4444; color: white; padding: 2px 7px; border-radius: 10px; font-size: 0.72rem; font-weight: 800;">0</span>
|
|
</button>
|
|
<button class="pos-tab-btn" id="tabBtnSinpe" onclick="switchPosTab('sinpe')">
|
|
<span class="tab-icon"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg></span>
|
|
<span class="tab-label-full">Recargas SINPE</span>
|
|
<span class="tab-label-short">Recargas SINPE</span>
|
|
<span id="badgeSinpeCount" style="background: #10b981; color: white; padding: 2px 7px; border-radius: 10px; font-size: 0.72rem; font-weight: 800; display: none;">0</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- VISTA 1: CATÁLOGO TÁCTIL DE PRODUCTOS (MOSTRADOR) -->
|
|
<div id="viewPosMostrador">
|
|
<!-- BUSCADOR INTELIGENTE DE PRODUCTOS EN MOSTRADOR -->
|
|
<div class="pos-search-bar-wrap">
|
|
<div class="pos-search-input-box">
|
|
<svg class="pos-search-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2">
|
|
<circle cx="11" cy="11" r="8"/>
|
|
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
|
|
</svg>
|
|
<input
|
|
type="text"
|
|
id="posProductSearch"
|
|
class="pos-search-input"
|
|
placeholder="Buscar por nombre, categoría o precio (ej: empanada, jugo, 1200, mep)..."
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
oninput="handlePosSearchInput(this.value)"
|
|
onkeydown="handlePosSearchKeyDown(event)"
|
|
/>
|
|
<button type="button" id="posSearchClearBtn" class="pos-search-clear-btn" onclick="clearPosSearch()" title="Borrar búsqueda" style="display: none;">
|
|
✕
|
|
</button>
|
|
<div class="pos-search-shortcut-pill" title="Atajo rápido de teclado: presiona '/'">/</div >
|
|
</div>
|
|
<div id="posSearchStats" class="pos-search-stats" style="display: none;">
|
|
<span id="posSearchStatsText">Mostrando 0 productos</span>
|
|
<button type="button" class="pos-search-reset-link" onclick="clearPosSearch()">Mostrar catálogo completo</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pos-category-toolbar">
|
|
<div class="pos-category-scroll-container" id="posCategoriesBar">
|
|
<!-- Filtros de categorías -->
|
|
</div>
|
|
<button type="button" onclick="openQuickProductModal()" class="btn-saas btn-saas-primary pos-btn-quick-prod" title="Crear y vender un producto no inventariado al instante">
|
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 5v14M5 12h14"/></svg>
|
|
<span>+ Nuevo Rápido</span>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="pos-products-grid" id="posProductsGrid">
|
|
<!-- Tarjetas táctiles de productos -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- VISTA 2: FILA RÁPIDA DE PRE-ÓRDENES (RETIRO EN RECREO) -->
|
|
<div id="viewPosPreordenes" style="display: none;">
|
|
<div style="background: #ffffff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);">
|
|
<div>
|
|
<div style="display: flex; align-items: center; gap: 6px;">
|
|
<span style="font-size: 1.1rem;">⚡</span>
|
|
<strong style="color: #0f172a; font-size: 0.95rem;">Despacho Exclusivo de Recreo</strong>
|
|
</div>
|
|
<p style="font-size: 0.78rem; color: #64748b; margin: 3px 0 0 0;">Los estudiantes con pre-orden retiran en segundos escaneando su carné aquí.</p>
|
|
</div>
|
|
<div style="display: flex; gap: 8px; align-items: center; flex-wrap: wrap;">
|
|
<button onclick="openPreOrderScanModal()" class="btn-saas btn-saas-primary" style="height: 36px; padding: 0 14px;">
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
|
|
<span>Escanear QR para Entregar</span>
|
|
</button>
|
|
<button onclick="loadPreOrders()" class="btn-saas btn-saas-outline" style="height: 36px; padding: 0 12px;">
|
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M3 21v-5h5"/></svg>
|
|
<span>Refrescar</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="preOrdersList" style="display: flex; flex-direction: column; gap: 12px;">
|
|
<!-- Lista de pre-órdenes -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- VISTA 3: RECARGAS SINPE PENDIENTES DE VERIFICACIÓN -->
|
|
<div id="viewPosSinpe" style="display: none;">
|
|
<div style="background: #ffffff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);">
|
|
<div>
|
|
<div style="display: flex; align-items: center; gap: 6px;">
|
|
<span style="font-size: 1.1rem;">📱</span>
|
|
<strong style="color: #0f172a; font-size: 0.95rem;">Recargas SINPE por Verificar</strong>
|
|
</div>
|
|
<p style="font-size: 0.78rem; color: #64748b; margin: 3px 0 0 0;">Verifica que el dinero ingresó a la cuenta bancaria de la soda antes de aprobar la recarga.</p>
|
|
</div>
|
|
<div>
|
|
<button onclick="loadSinpeRequests()" class="btn-saas btn-saas-outline" style="height: 36px; padding: 0 12px;">
|
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M3 21v-5h5"/></svg>
|
|
<span>Refrescar</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="sinpeRequestsList" style="display: flex; flex-direction: column; gap: 12px;">
|
|
<!-- Lista de solicitudes SINPE pendientes -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- BARRA FLOTANTE DE ACCESO RÁPIDO A CAJA EN MÓVIL -->
|
|
<div id="posFloatingCheckoutBar" class="pos-floating-checkout-bar" onclick="switchPosMobileView('checkout')" style="display: none;">
|
|
<div style="display: flex; align-items: center; gap: 10px;">
|
|
<div style="width: 36px; height: 36px; border-radius: 50%; background: rgba(56, 189, 248, 0.2); display: flex; align-items: center; justify-content: center; color: #38bdf8;">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/></svg>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 800; font-size: 0.88rem; color: #ffffff;" id="posFloatingCartText">0 ítems</div>
|
|
<div style="font-size: 0.72rem; color: #cbd5e1;">Toca para cobrar o escanear QR</div>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
<span style="font-size: 1.15rem; font-weight: 900; color: #38bdf8;" id="posFloatingCartTotal">₡0</span>
|
|
<span style="background: #0284c7; color: white; padding: 6px 12px; border-radius: 8px; font-weight: 800; font-size: 0.8rem;">Cobrar ➔</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- PANEL DERECHO: SCANNER QR, IDENTIFICACIÓN Y COBRO -->
|
|
<div class="pos-checkout-pane">
|
|
<div>
|
|
<!-- BOTÓN VOLVER EN MÓVIL DENTRO DE CHECKOUT -->
|
|
<div class="pos-mobile-back-bar">
|
|
<button onclick="switchPosMobileView('catalog')" class="pos-mobile-back-btn">
|
|
<span>⬅</span> Volver al Catálogo de Alimentos
|
|
</button>
|
|
</div>
|
|
|
|
<!-- SECCIÓN DE IDENTIFICACIÓN / ALUMNO EN MOSTRADOR -->
|
|
<div id="posStudentSection" style="margin-bottom: 12px;">
|
|
<!-- ESTADO INICIAL: SIN ALUMNO IDENTIFICADO -->
|
|
<div id="posNoStudentPlaceholder" style="background: #f8fafc; border: 1.5px dashed #cbd5e1; border-radius: 14px; padding: 16px; text-align: center;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
|
|
<span style="font-size: 0.85rem; font-weight: 800; color: #0f172a;">👤 Alumno en Mostrador</span>
|
|
<span class="saas-status-badge saas-status-active"><span class="saas-dot"></span>Caja Lista</span>
|
|
</div>
|
|
<p style="font-size: 0.78rem; color: #64748b; margin: 0 0 12px 0;">
|
|
Selecciona productos y presiona <strong>Cobrar</strong>, o identifica primero al estudiante:
|
|
</p>
|
|
<button type="button" onclick="openStudentIdModal()" class="btn-saas btn-saas-outline" style="height: 34px; padding: 0 14px; border-color: #cbd5e1;">
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
|
|
<span>Identificar Alumno / Ver Saldo</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- TARJETA DEL ESTUDIANTE IDENTIFICADO POR QR -->
|
|
<div id="studentScannedCard" style="display: none; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 14px; padding: 12px; margin-bottom: 14px; align-items: center; gap: 12px;">
|
|
<div id="scannedAvatar" class="scanned-avatar-badge">ES</div>
|
|
<div style="flex: 1; min-width: 0; word-break: break-word;">
|
|
<h4 id="scannedName" style="font-size: 0.92rem; font-weight: 800; color: #0f172a; margin: 0; line-height: 1.2;">Nombre del Alumno</h4>
|
|
<div id="scannedGrade" style="font-size: 0.74rem; color: #64748b; margin-top: 2px;">2° Grado • Sección 2-A</div>
|
|
<div style="display: flex; gap: 10px; margin-top: 4px; font-size: 0.74rem; flex-wrap: wrap;">
|
|
<span style="color: #475569;">Saldo: <strong id="scannedBalance" style="color: #16a34a; font-weight: 800;">₡0</strong></span>
|
|
<span style="color: #475569;">Disp. hoy: <strong id="scannedAvailable" style="color: #0284c7; font-weight: 800;">₡0</strong></span>
|
|
</div>
|
|
</div>
|
|
<button onclick="clearScannedStudent()" style="background: none; border: none; color: #dc2626; font-size: 1.2rem; cursor: pointer; padding: 4px 8px; flex-shrink: 0;" title="Desconectar alumno">✕</button>
|
|
</div>
|
|
|
|
<!-- ALERTA DE ALERGIAS AL CAJERO -->
|
|
<div id="scannedAllergyAlert" style="display: none; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 8px 12px; margin-top: 10px; font-size: 0.78rem; color: #991b1b;">
|
|
⚠️ <strong>ALERTA MÉDICA:</strong> <span id="scannedAllergyText"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- LISTA DE PRODUCTOS SELECCIONADOS EN CAJA -->
|
|
<div style="margin-top: 14px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; font-weight: 700; color: #64748b; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px;">
|
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
<span>Ítems en Mostrador</span>
|
|
<button type="button" onclick="openQuickProductModal()" class="btn-saas btn-saas-outline" style="height: 24px; font-size: 0.7rem; padding: 0 8px;">
|
|
<span>+ Rápido</span>
|
|
</button>
|
|
</div>
|
|
<button onclick="clearPosCart()" style="background: none; border: none; color: #dc2626; font-size: 0.75rem; font-weight: 700; cursor: pointer; padding: 2px 6px;">Limpiar</button>
|
|
</div>
|
|
<div class="pos-cart-list" id="posCartList">
|
|
<div style="text-align: center; padding: 26px 16px; background: #f8fafc; border-radius: 12px; border: 1.5px dashed #cbd5e1;">
|
|
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#94a3b8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-bottom: 6px;"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/></svg>
|
|
<p style="margin: 0; font-weight: 800; color: #475569; font-size: 0.85rem;">Mostrador vacío</p>
|
|
<span style="font-size: 0.74rem; color: #94a3b8;">Toca productos del menú para cobrar</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- BOTÓN DE COBRO Y TOTAL -->
|
|
<div style="border-top: 1px solid #e2e8f0; padding-top: 14px; margin-top: auto;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px;">
|
|
<span style="font-size: 0.88rem; font-weight: 800; color: #64748b; letter-spacing: 0.5px;">TOTAL A DEBITAR:</span>
|
|
<span id="posCartTotal" style="font-size: 1.65rem; font-weight: 900; color: #0284c7;">₡0</span>
|
|
</div>
|
|
|
|
<button id="btnCobrarPos" onclick="executePosDebit()" style="width: 100%; padding: 13px; background: #0f172a; border: none; border-radius: 12px; color: white; font-size: 0.95rem; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15); box-sizing: border-box; transition: all 0.15s ease;">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
|
|
<span>COBRAR CON PISTOLA QR</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODAL DE COBRO RÁPIDO CON PISTOLA QR -->
|
|
<div class="modal-qr-backdrop" id="modalPistolaCobro" style="display: none;" onclick="closePistolaModal(event)">
|
|
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 20px; box-shadow: 0 20px 50px rgba(0,0,0,0.15); padding: 22px; color: #0f172a; text-align: center;">
|
|
<!-- CABECERA -->
|
|
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 12px; margin-bottom: 16px;">
|
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
<span style="font-size: 1.5rem;" id="pistolaModalIcon">📷</span>
|
|
<strong style="font-size: 1.1rem; color: #0f172a; letter-spacing: 0.5px;" id="pistolaModalTitle">Escanear Carné QR</strong>
|
|
</div>
|
|
<button type="button" onclick="closePistolaModal()" style="background: none; border: none; font-size: 1.3rem; color: #64748b; cursor: pointer;">✕</button>
|
|
</div>
|
|
|
|
<!-- ESTADO 1: ESPERANDO ESCANEO (DEFAULT) -->
|
|
<div id="pistolaStateWaiting">
|
|
<!-- TOTAL A COBRAR GIGANTE (SOLO EN MODO COBRO) -->
|
|
<div id="pistolaTotalContainer" style="background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 14px; padding: 12px; margin-bottom: 14px;">
|
|
<div style="font-size: 0.78rem; font-weight: 800; color: #64748b; text-transform: uppercase;">Monto Total a Cobrar</div>
|
|
<div id="pistolaModalTotal" style="font-size: 2.3rem; font-weight: 900; color: #0284c7; margin: 4px 0;">₡0</div>
|
|
<div id="pistolaModalItemCount" style="font-size: 0.75rem; color: #64748b;">0 productos en mostrador</div>
|
|
</div>
|
|
|
|
<!-- CÁMARA BAJO DEMANDA INTEGRADA EN EL MODAL -->
|
|
<div id="modalCameraContainer" style="position: relative; border-radius: 14px; overflow: hidden; background: #000; min-height: 200px; max-height: 230px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid #0284c7;">
|
|
<video id="modalScannerVideo" style="width: 100%; height: 210px; object-fit: cover;" autoplay playsinline webkit-playsinline muted></video>
|
|
<div class="laser-scan-line"></div>
|
|
<div id="modalCameraStatusBadge" style="position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: rgba(15, 23, 42, 0.9); color: #ffffff; padding: 4px 12px; border-radius: 20px; font-size: 0.74rem; font-weight: 800; border: 1px solid #0284c7; white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.3);">
|
|
📷 Apunta el carné a la cámara o dispara pistola
|
|
</div>
|
|
<div id="modalCameraOverlay" style="display: none; position: absolute; inset: 0; background: rgba(15, 23, 42, 0.95); padding: 14px; text-align: center; flex-direction: column; justify-content: center; align-items: center; gap: 8px; z-index: 10;">
|
|
<span style="font-size: 2rem;">📷</span>
|
|
<div id="modalCameraHelpText" style="font-size: 0.8rem; color: #f8fafc; line-height: 1.35;">Toca el botón para permitir el uso de la cámara</div>
|
|
<button type="button" onclick="startModalCamera(true)" class="btn-saas btn-saas-primary" style="height: 36px; padding: 0 16px;">
|
|
Permitir Cámara
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- CAMPO DE ENTRADA ENFOCADO PARA PISTOLA USB -->
|
|
<div style="margin-bottom: 12px;">
|
|
<input type="text" id="inputPistolaDirectScan" placeholder="Esperando lectura de carné o pistola..." autocomplete="off" style="width: 100%; padding: 10px; border-radius: 10px; border: 1.5px solid #cbd5e1; background: #f8fafc; color: #0f172a; font-size: 0.88rem; font-weight: 800; text-align: center; box-sizing: border-box; outline: none;">
|
|
</div>
|
|
|
|
<!-- ACCESOS RÁPIDOS DE PRUEBA -->
|
|
<div style="border-top: 1px dashed #e2e8f0; padding-top: 10px; margin-top: 10px;">
|
|
<span style="font-size: 0.72rem; color: #64748b; display: block; margin-bottom: 6px;">Simulación rápida sin pistola física ni cámara:</span>
|
|
<div style="display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;">
|
|
<button type="button" onclick="handlePistolBarcodeScan('QR-MATEO-2026-A891')" class="btn-saas btn-saas-outline" style="height: 28px; font-size: 0.75rem;">🧒 Mateo (8a)</button>
|
|
<button type="button" onclick="handlePistolBarcodeScan('QR-SOFIA-2026-B442')" class="btn-saas btn-saas-outline" style="height: 28px; font-size: 0.75rem;">👧 Sofía (9a)</button>
|
|
<button type="button" onclick="handlePistolBarcodeScan('QR-NACHO-2026-D902')" class="btn-saas btn-saas-outline" style="height: 28px; font-size: 0.75rem;">🧑 Ignacio (14a)</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ESTADO 2: PROCESANDO COBRO -->
|
|
<div id="pistolaStateProcessing" style="display: none; padding: 20px 0;">
|
|
<div style="font-size: 2.8rem; animation: spin 1s infinite linear;">⚡</div>
|
|
<h3 style="font-size: 1.15rem; color: #0284c7; margin: 10px 0 4px 0;">Procesando Débito...</h3>
|
|
<p style="font-size: 0.8rem; color: #64748b;" id="pistolaProcessingName">Verificando carné y saldo del alumno...</p>
|
|
</div>
|
|
|
|
<!-- ESTADO 3: ÉXITO -->
|
|
<div id="pistolaStateSuccess" style="display: none; padding: 10px 0;">
|
|
<div style="font-size: 3rem;">✅</div>
|
|
<h3 style="font-size: 1.3rem; color: #16a34a; margin: 6px 0;">¡COBRO EXITOSO!</h3>
|
|
<div style="background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 14px; margin: 12px 0; text-align: left; font-size: 0.84rem;">
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
|
<span style="color: #64748b;">Estudiante:</span>
|
|
<strong id="pistolaSuccessStudent" style="color: #0f172a;">-</strong>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
|
<span style="color: #64748b;">Ticket:</span>
|
|
<strong id="pistolaSuccessTicket" style="color: #0284c7;">-</strong>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
|
<span style="color: #64748b;">Monto Cobrado:</span>
|
|
<strong id="pistolaSuccessAmount" style="color: #0f172a;">-</strong>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; border-top: 1px dashed #bbf7d0; padding-top: 6px; margin-top: 6px;">
|
|
<span style="color: #64748b;">Nuevo Saldo Disponible:</span>
|
|
<strong id="pistolaSuccessBalance" style="color: #16a34a; font-size: 0.95rem;">-</strong>
|
|
</div>
|
|
</div>
|
|
<button type="button" onclick="closePistolaModal()" class="btn-saas btn-saas-primary" style="width: 100%; height: 42px; background: #16a34a; border-color: #16a34a; font-size: 0.92rem; font-weight: 800;">
|
|
Listo / Siguiente Alumno (Enter) ➔
|
|
</button>
|
|
</div>
|
|
|
|
<!-- ESTADO 4: ERROR / ALERTA -->
|
|
<div id="pistolaStateError" style="display: none; padding: 10px 0;">
|
|
<div style="font-size: 3rem;">⛔</div>
|
|
<h3 style="font-size: 1.2rem; color: #dc2626; margin: 6px 0;" id="pistolaErrorTitle">No se pudo cobrar</h3>
|
|
<p style="font-size: 0.85rem; color: #991b1b; line-height: 1.4; margin-bottom: 16px;" id="pistolaErrorDesc">Detalle del error</p>
|
|
<button type="button" onclick="resetPistolaModalWaiting()" class="btn-saas btn-saas-outline" style="height: 38px; padding: 0 18px; font-weight: 700;">
|
|
🔄 Intentar con otro carné
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODAL: NUEVO PRODUCTO RÁPIDO EN CALIENTE -->
|
|
<div id="modalProductoRapido" style="display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); z-index: 9999; justify-content: center; align-items: center; padding: 16px; backdrop-filter: blur(4px);">
|
|
<div style="background: #ffffff; border: 1px solid #e2e8f0; border-radius: 18px; max-width: 420px; width: 100%; padding: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.15); position: relative; color: #0f172a;">
|
|
<button type="button" onclick="closeQuickProductModal()" style="position: absolute; top: 14px; right: 14px; background: none; border: none; color: #64748b; font-size: 1.4rem; cursor: pointer; padding: 4px 8px; line-height: 1;" title="Cerrar (Esc)">✕</button>
|
|
|
|
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 16px;">
|
|
<span style="font-size: 1.6rem; background: #f0fdf4; padding: 8px; border-radius: 12px; border: 1px solid #bbf7d0; display: inline-flex;">⚡</span>
|
|
<div>
|
|
<h3 style="font-size: 1.15rem; font-weight: 800; color: #0f172a; margin: 0;">Nuevo Producto Rápido</h3>
|
|
<span style="font-size: 0.76rem; color: #64748b;">Registro instantáneo para cobrar al vuelo</span>
|
|
</div>
|
|
</div>
|
|
|
|
<form id="formProductoRapido" onsubmit="saveQuickProduct(event)">
|
|
<div style="margin-bottom: 14px;">
|
|
<label style="display: block; font-size: 0.78rem; font-weight: 700; color: #475569; margin-bottom: 6px;">
|
|
Nombre del Producto:
|
|
</label>
|
|
<input type="text" id="inputQuickProdNombre" placeholder="Ej: Empanada de Pollo, Jugo Naranja..." required autocomplete="off" style="width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid #cbd5e1; background: #f8fafc; color: #0f172a; font-size: 0.92rem; font-weight: 700; box-sizing: border-box; outline: none;">
|
|
</div>
|
|
|
|
<div style="margin-bottom: 18px;">
|
|
<label style="display: block; font-size: 0.78rem; font-weight: 700; color: #475569; margin-bottom: 6px;">
|
|
Precio de Venta (₡ Colones):
|
|
</label>
|
|
<div style="position: relative;">
|
|
<span style="position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #0284c7; font-weight: 900; font-size: 1.1rem;">₡</span>
|
|
<input type="number" id="inputQuickProdPrecio" placeholder="1500" required min="1" step="50" style="width: 100%; padding: 10px 12px 10px 32px; border-radius: 10px; border: 1.5px solid #cbd5e1; background: #f8fafc; color: #0f172a; font-size: 1.1rem; font-weight: 900; box-sizing: border-box; outline: none;">
|
|
</div>
|
|
<span style="font-size: 0.72rem; color: #16a34a; margin-top: 6px; display: block; font-weight: 600;">
|
|
🌿 Sello MEP Saludable asignado automáticamente (sin bloqueo parental)
|
|
</span>
|
|
</div>
|
|
|
|
<div style="display: flex; gap: 10px;">
|
|
<button type="button" onclick="closeQuickProductModal()" class="btn-saas btn-saas-outline" style="flex: 1; height: 38px; font-size: 0.85rem;">
|
|
Cancelar (Esc)
|
|
</button>
|
|
<button type="submit" id="btnSubmitQuickProd" class="btn-saas btn-saas-primary" style="flex: 2; height: 38px; background: #0f172a; border-color: #0f172a; font-size: 0.88rem; font-weight: 800;">
|
|
<span>Guardar y Cobrar ➔</span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/js/sounds.js?v=8.6"></script>
|
|
<script src="/js/jsQR.js"></script>
|
|
<script src="/js/food-icons.js?v=1.1"></script>
|
|
<script src="/js/pos.js?v=9.9"></script>
|
|
</body>
|
|
</html>
|