Files
Autoparts-DB/pos/templates/whatsapp.html
consultoria-as 042acd6207 OPCIÓN C + A1: Consolidación técnica + orjson
C1: Materialized view part_vehicle_preview (creación en progreso)
- Migración v3.3_materialized_view.sql
- catalog_service.py y dashboard/server.py ahora usan la MV
- Script refresh_part_vehicle_preview.py + warm_vehicle_cache.py actualizado

C2: Fix cache warming script (autónomo)
- Auto-re-ejecuta con sudo -u postgres si peer auth falla
- Args CLI: --dsn, --batch-size, --ttl, --dry-run

C3: CSS dinámico residual extraído
- sidebar.js → sidebar.css (nuevo)
- pos-utils.js → common.css (nuevo)
- Links agregados a 14 templates POS

C4: Script de load testing básico
- scripts/load_test.py: métricas p50/p95/p99, throughput, errores

C5: Documentación actualizada
- FASES_IMPLEMENTADAS.md: test count real, FASE 7 completa
- performance_audit_2026.md: anexo post-FASE 7, métricas actualizadas

A1: Serialización orjson
- pos/json_provider.py: DefaultJSONProvider con orjson.dumps/loads
- Aplicado a POS app y Dashboard server
- Fix indentation error en pos_bp.py

Tests: 73/73 pasando
2026-04-27 09:36:03 +00:00

135 lines
6.4 KiB
HTML

<!DOCTYPE html>
<html lang="es" data-theme="industrial">
<head>
<script>/*pos_theme_early*/(function(){var t=localStorage.getItem("pos_theme")||"industrial";document.documentElement.setAttribute("data-theme",t);})()</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WhatsApp — Nexus Autoparts POS</title>
<link rel="stylesheet" href="/pos/static/css/tokens.css" />
<link rel="stylesheet" href="/pos/static/css/common.css" />
<link rel="stylesheet" href="/pos/static/css/sidebar.css" />
<link rel="stylesheet" href="/pos/static/css/pos-glass.css" />
<link rel="manifest" href="/pos/static/pwa/manifest.json" />
<meta name="theme-color" content="#F5A623" />
<link rel="stylesheet" href="/pos/static/css/whatsapp.css">
</head>
<body>
<div class="page-shell">
<!-- Sidebar injected by sidebar.js -->
<aside class="sidebar"></aside>
<div class="main-content pos-main-offset">
<!-- Top bar -->
<div class="top-bar">
<div class="top-bar__title">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>
</svg>
WhatsApp Business
</div>
<div class="top-bar__actions">
<div class="top-bar__status">
<span class="status-dot" id="statusDot"></span>
<span id="statusText">Verificando...</span>
</div>
<button class="btn btn--sm btn--whatsapp" id="connectBtn" style="display:none">Conectar WhatsApp</button>
<button class="btn btn--sm" id="disconnectBtn" style="display:none">Desconectar</button>
</div>
</div>
<!-- Connection / QR section (shown when not connected) -->
<div class="connect-section" id="connectSection" style="display:none">
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="#25D366" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>
</svg>
<div class="connect-section__title">Conectar WhatsApp</div>
<div class="connect-section__desc">
Escanea el codigo QR con tu telefono para vincular WhatsApp.<br>
Abre WhatsApp &gt; Dispositivos vinculados &gt; Vincular un dispositivo.
</div>
<div class="connect-section__qr">
<img id="qrImg" style="display:none" alt="QR Code" />
<span class="connect-section__qr-placeholder" id="qrPlaceholder">
Haz click en "Conectar WhatsApp" para generar el QR
</span>
</div>
<div class="connect-section__actions">
<button class="btn btn--sm" id="refreshQrBtn" style="display:none">Actualizar QR</button>
</div>
</div>
<!-- Messenger (shown when connected) -->
<div class="messenger" id="messengerArea" style="display:none">
<!-- Left: Conversation list -->
<div class="conv-panel">
<div class="conv-panel__header">
<span class="conv-panel__title">Conversaciones</span>
<button class="btn btn--sm btn--whatsapp" id="newChatBtn" title="Nueva conversacion">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>
</svg>
Nuevo
</button>
</div>
<div class="conv-panel__list" id="convList">
<div class="conv-empty">Cargando...</div>
</div>
</div>
<!-- Right: Chat view (hidden until a conversation is selected) -->
<div class="empty-state" id="emptyState">
<svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>
</svg>
<div class="empty-state__text">Selecciona una conversacion<br>o inicia una nueva</div>
<div class="empty-state__hint">Los mensajes de WhatsApp aparecen aqui en tiempo real</div>
</div>
<div class="chat-panel" id="chatPanel" style="display:none">
<div class="chat-panel__header">
<span class="chat-panel__phone" id="chatHeaderPhone"></span>
<div class="chat-panel__actions">
<button class="btn btn--sm" id="sendQuoteBtn" title="Enviar cotizacion por WhatsApp">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/>
</svg>
Enviar Cotizacion
</button>
</div>
</div>
<div class="chat-panel__messages" id="chatMessages"></div>
<div class="chat-input-bar">
<textarea id="chatInput" placeholder="Escribe un mensaje..." rows="1"></textarea>
<button class="btn btn--primary" id="sendBtn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/>
</svg>
Enviar
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Theme engine -->
<script>
function posSetTheme(t){document.documentElement.setAttribute('data-theme',t);localStorage.setItem('pos_theme',t);}
function posLogout(){localStorage.removeItem('pos_token');window.location.href='/pos/login';}
</script>
<!-- Sidebar -->
<script src="/pos/static/js/i18n.js" defer></script>
<script src="/pos/static/js/whatsapp.js" defer></script>
<script src="/pos/static/js/pos-utils.js" defer></script>
<script src="/pos/static/js/sidebar.js" defer></script>
</body>
</html>