From 35d0e56f9f4f9b77bf50df09d023efcfea267449 Mon Sep 17 00:00:00 2001 From: Carlos Tello Date: Wed, 4 Nov 2026 01:15:54 -0300 Subject: [PATCH] fix(ui): optimizar UX y relacion de aspecto para tablets Samsung Galaxy Tab (acordeon polizas, cockpit 0-scroll y contraste) --- backend/app/core/config.py | 3 + backend/app/main.py | 3 +- frontend/src/styles/base.css | 132 ++++-- frontend/src/views/ControlPostView.tsx | 565 +++++++++++++------------ iniciar_backend.bat | 1 + 5 files changed, 396 insertions(+), 308 deletions(-) diff --git a/backend/app/core/config.py b/backend/app/core/config.py index ef20811..ae0849e 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -33,6 +33,9 @@ class Settings(BaseSettings): "http://127.0.0.1:5173", "http://localhost:8000", "http://127.0.0.1:8000", + "https://localhost", + "http://localhost", + "capacitor://localhost", ] # Base de Datos SQL Server (videoman) diff --git a/backend/app/main.py b/backend/app/main.py index af605ef..c7349fc 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -25,10 +25,11 @@ app = FastAPI( # Middleware de Compresión GZip (optimiza transferencia a tablets por Wi-Fi) app.add_middleware(GZipMiddleware, minimum_size=1000) -# Middleware de CORS +# Middleware de CORS con soporte para Capacitor (Android/iOS), LAN y Web app.add_middleware( CORSMiddleware, allow_origins=settings.ALLOWED_ORIGINS, + allow_origin_regex=r"^(https?|capacitor)://(localhost|127\.0\.0\.1|192\.168\.\d+\.\d+|172\.\d+\.\d+\.\d+|10\.\d+\.\d+\.\d+)(:\d+)?$", allow_credentials=True, allow_methods=["*"], allow_headers=["*"], diff --git a/frontend/src/styles/base.css b/frontend/src/styles/base.css index cacb2ac..5f6ef49 100644 --- a/frontend/src/styles/base.css +++ b/frontend/src/styles/base.css @@ -598,13 +598,30 @@ button:disabled, .btn:disabled, .touch-button:disabled { .desktop-top-header { height: 48px; - background-color: #070D1E; - border-bottom: 1px solid #14203B; + background-color: var(--bg-surface, #070D1E); + border-bottom: 1px solid var(--border-subtle, #14203B); display: flex; align-items: center; justify-content: space-between; - padding: 0 16px; + padding: 0 12px; flex-shrink: 0; + overflow-x: auto; + scrollbar-width: none; +} + +.desktop-top-header::-webkit-scrollbar { + display: none; +} + +@media (max-width: 900px) { + .desktop-top-header { + padding: 0 8px; + gap: 4px; + } + .desktop-tab-btn { + padding: 0 10px; + font-size: 12px; + } } .desktop-tab-btn { @@ -797,63 +814,90 @@ button:disabled, .btn:disabled, .touch-button:disabled { } /* ============================================================================== - RESPONSIVIDAD Y ERGONOMÍA PARA TABLETS SAMSUNG GALAXY TAB A11 (1340x800) + RESPONSIVIDAD Y ERGONOMÍA PARA TABLETS SAMSUNG GALAXY TAB (16:10 - 1280x800 / 1340x800) ============================================================================== */ -@media (max-width: 1180px) and (min-width: 961px) { + +/* Modo Horizontal (Landscape) en Tablets y Escritorios (ancho >= 768px y orientacion landscape) */ +@media (orientation: landscape) and (min-width: 768px) { .desktop-cockpit-grid { - grid-template-columns: 210px 1fr 195px !important; + display: grid !important; + grid-template-columns: 225px 1fr 220px !important; gap: 8px !important; padding: 6px 8px !important; - } -} - -/* Modo Vertical (Portrait) en Tablets (Samsung Galaxy Tab 800x1340) -> 2 Columnas */ -@media (max-width: 960px) and (min-width: 680px) { - .desktop-cockpit-grid { - grid-template-columns: 270px 1fr !important; - gap: 8px !important; - padding: 8px 10px !important; - padding-bottom: 64px !important; + padding-bottom: 6px !important; + height: calc(100vh - 48px) !important; + overflow-y: auto !important; } .desktop-column-actions { - grid-column: span 2; + display: flex !important; + grid-column: auto !important; + } + .tablet-portrait-dock { + display: none !important; + } + .desktop-card-action-buttons, + .desktop-card-hardware-buttons { + display: flex !important; } } -/* Modo Smartphone o Pantalla Muy Estrecha (<680px) */ -@media (max-width: 679px) { +/* Modo Horizontal en pantallas medianas / compactas (1024px a 1180px) */ +@media (orientation: landscape) and (max-width: 1180px) and (min-width: 840px) { .desktop-cockpit-grid { - grid-template-columns: 1fr !important; - gap: 10px !important; - padding: 8px 10px !important; - padding-bottom: 64px !important; + grid-template-columns: 215px 1fr 205px !important; + gap: 6px !important; + padding: 4px 6px !important; + } +} + +/* Modo Vertical (Portrait) en Tablets Samsung Galaxy Tab (ancho CSS 500px a 960px) -> 2 Columnas */ +@media (orientation: portrait) and (min-width: 500px), (max-width: 960px) and (orientation: portrait) { + .desktop-cockpit-grid { + display: grid !important; + grid-template-columns: 245px 1fr !important; + gap: 8px !important; + padding: 6px 8px !important; + padding-bottom: 70px !important; + overflow-y: auto !important; + } + .desktop-column-actions { + display: none !important; /* Sus acciones están ancladas en tablet-portrait-dock */ + } + .tablet-portrait-dock { + display: flex !important; + } +} + +/* Modo Celular o Pantalla Ultra Angosta (<500px) */ +@media (max-width: 499px) { + .desktop-cockpit-grid { + display: flex !important; + flex-direction: column !important; + gap: 8px !important; + padding: 6px 8px !important; + padding-bottom: 70px !important; + overflow-y: auto !important; + } + .desktop-column-actions { + display: none !important; + } + .tablet-portrait-dock { + display: flex !important; } } /* Dock de Acciones Rápidas para Modo Vertical (Portrait) */ .tablet-portrait-dock { display: none; -} - -@media (max-width: 960px) { - .tablet-portrait-dock { - display: flex; - align-items: center; - gap: 8px; - padding: 8px 12px; - background-color: var(--bg-surface); - border-top: 1px solid var(--border-strong); - position: sticky; - bottom: 0; - z-index: 100; - box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.35); - } - - /* Evitar repetición de botones en la tarjeta de acciones cuando el dock fijo está activo */ - .desktop-card-action-buttons, - .desktop-card-hardware-buttons { - display: none !important; - } + align-items: center; + gap: 8px; + padding: 8px 12px; + background-color: var(--bg-surface); + border-top: 1px solid var(--border-strong); + position: sticky; + bottom: 0; + z-index: 100; + box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.35); } /* ============================================================================== diff --git a/frontend/src/views/ControlPostView.tsx b/frontend/src/views/ControlPostView.tsx index 7c70b29..603c903 100644 --- a/frontend/src/views/ControlPostView.tsx +++ b/frontend/src/views/ControlPostView.tsx @@ -133,6 +133,7 @@ export const ControlPostView: React.FC = () => { const [tipoDoc, setTipoDoc] = useState('DNI'); const [tipoIngresoLabel, setTipoIngresoLabel] = useState('Visita'); const [scannerInputValue, setScannerInputValue] = useState(''); + const [isDocExpanded, setIsDocExpanded] = useState(false); // Tickets activos y movimientos registrados en BD @@ -1154,7 +1155,7 @@ export const ControlPostView: React.FC = () => { {/* Cabecera Superior: Usuario + Logo Infinito + Tabs Entrada/Salida + Puesto + Reloj */}
-
+
👤 {user?.username || 'root'} - + {clock} - {APP_VERSION} + {APP_VERSION}
@@ -1565,6 +1570,108 @@ export const ControlPostView: React.FC = () => { + + {/* Groupbox: Historial de Escaneos (DNI) reubicado ergonómicamente en Columna 1 */} +
+
+ + Historial Escaneos ({scanHistory.length}) + + {scanHistory.length > 0 && ( + + )} +
+ +
+ {scanHistory.length === 0 ? ( +
+ Sin escaneos recientes en este puesto. +
+ ) : ( + + + {scanHistory.map((it) => { + const isSelected = selectedHistoryDoc === it.documento; + return ( + setSelectedHistoryDoc(it.documento)} + onDoubleClick={() => handleLoadFromHistory(it)} + style={{ + borderBottom: '1px solid var(--border-subtle)', + backgroundColor: isSelected ? 'var(--selection-bg)' : 'transparent', + cursor: 'pointer', + transition: 'background-color 0.1s', + }} + title="Tocar o doble clic para cargar en carril" + > + + + + + ); + })} + +
+ {it.documento} + + {it.sexo} + + + {it.apellido ? `${it.apellido}, ${it.nombre}` : 'Persona'} + {it.patente ? ({it.patente}) : null} + + {it.hora} +
+ )} +
+ + {scanHistory.length > 0 && selectedHistoryDoc && ( + + )} +
{/* ========================================================================= @@ -1575,20 +1682,22 @@ export const ControlPostView: React.FC = () => {
Datos Persona - {/* Fila 1: Ingreso / Doc / Nro Doc / Radios Conductor - Peatón (Fluido con flex-wrap para que Nro Doc nunca se aplaste) */} -
- Ingreso / Doc: - + {/* Fila 1: Ingreso / Doc / Nro Doc / Radios Conductor - Peatón (Grid fluido) */} +
+
+ Ingreso: + +
-
- Nro Doc: - { - const raw = e.target.value; - const norm = normalizarDniInput(raw); - const docClean = norm.documento || raw; - setForm((prev) => ({ - ...prev, - documento: docClean, - ...(norm.sexo ? { sexo: norm.sexo } : {}), - })); - if (docClean.length >= 4) { - lookupPerson(docClean); - } - }} - onKeyDown={(e) => { - if (e.key === 'Enter') { - e.preventDefault(); - buscarPersonaOPatente(); - } - }} - /> -
-
-