From a09cb6a95ba6d432ff0f02e2f03f3a158c2af5fb Mon Sep 17 00:00:00 2001 From: Carlos Tello Date: Wed, 14 Oct 2026 21:17:52 -0300 Subject: [PATCH] =?UTF-8?q?feat(ui):=20cockpit=20y=20dise=C3=B1o=20garita?= =?UTF-8?q?=20con=20paridad=20visual=201:1=20de=20escritorio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/styles/base.css | 195 ++ frontend/src/views/ControlPostView.tsx | 3036 +++++++++--------------- 2 files changed, 1263 insertions(+), 1968 deletions(-) diff --git a/frontend/src/styles/base.css b/frontend/src/styles/base.css index fede6f1..4647258 100644 --- a/frontend/src/styles/base.css +++ b/frontend/src/styles/base.css @@ -538,3 +538,198 @@ button:disabled, .btn:disabled, .touch-button:disabled { background-color: var(--hover-bg); border-color: var(--accent); } + +/* ============================================================================== + ESTILO REPLICA ESCRITORIO ONEVERACCESS (PARIDAD 1:1 CON SCREENSHOTS) + ============================================================================== */ +.desktop-shell { + display: flex; + height: 100vh; + width: 100vw; + background-color: #070D1E; + color: #E2E8F0; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + overflow: hidden; +} + +.desktop-sidebar { + width: 50px; + background-color: #050A18; + border-right: 1px solid #14203B; + display: flex; + flex-direction: column; + align-items: center; + padding: 8px 0; + gap: 8px; + flex-shrink: 0; + user-select: none; + overflow-y: auto; +} + +.desktop-rail-item { + width: 38px; + height: 38px; + border-radius: 6px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + border: none; + background: transparent; + transition: all 0.15s ease; +} + +.desktop-rail-item:hover { + background-color: #121E38; +} + +.desktop-rail-item.active { + background-color: #2563EB; + box-shadow: 0 0 10px rgba(37, 99, 235, 0.4); +} + +.desktop-main-area { + flex: 1; + display: flex; + flex-direction: column; + height: 100%; + overflow: hidden; +} + +.desktop-top-header { + height: 48px; + background-color: #070D1E; + border-bottom: 1px solid #14203B; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 16px; + flex-shrink: 0; +} + +.desktop-tab-btn { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 0 18px; + height: 48px; + font-size: 13px; + font-weight: 700; + cursor: pointer; + border: none; + background: transparent; + color: #94A3B8; + border-bottom: 3px solid transparent; + transition: all 0.15s ease; + text-transform: uppercase; + letter-spacing: 0.03em; +} + +.desktop-tab-btn.active { + color: #38BDF8; + border-bottom: 3px solid #2563EB; +} + +.desktop-cockpit-grid { + flex: 1; + display: grid; + grid-template-columns: 240px 1fr 210px; + gap: 10px; + padding: 8px 12px; + overflow-y: auto; + background-color: #070D1E; +} + +.desktop-groupbox { + background-color: #0B132B; + border: 1px solid #1E2D56; + border-radius: 8px; + padding: 10px 12px; + display: flex; + flex-direction: column; + gap: 8px; + box-sizing: border-box; +} + +.desktop-groupbox-title { + font-size: 12px; + font-weight: 600; + color: #8E9CAE; + margin-bottom: 4px; + display: flex; + align-items: center; + gap: 6px; +} + +.desktop-input { + background-color: #091124; + border: 1px solid #1E2D56; + border-radius: 4px; + color: #F1F5F9; + font-size: 12px; + padding: 4px 8px; + height: 28px; + width: 100%; + box-sizing: border-box; + outline: none; + transition: border-color 0.15s ease; +} + +.desktop-input:focus { + border-color: #3B82F6; + box-shadow: 0 0 4px rgba(59, 130, 246, 0.4); +} + +.desktop-select { + background-color: #091124; + border: 1px solid #1E2D56; + border-radius: 4px; + color: #F1F5F9; + font-size: 12px; + padding: 2px 6px; + height: 28px; + outline: none; +} + +.desktop-label { + font-size: 11px; + font-weight: 600; + color: #94A3B8; + white-space: nowrap; +} + +.desktop-btn-action { + font-size: 11px; + font-weight: 700; + padding: 5px 8px; + height: 30px; + border-radius: 4px; + border: none; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + gap: 5px; + white-space: nowrap; + transition: filter 0.15s ease; +} + +.desktop-btn-action:hover { + filter: brightness(1.15); +} + +@media (max-width: 1100px) { + .desktop-cockpit-grid { + grid-template-columns: 220px 1fr 190px !important; + } +} + +@media (max-width: 880px) { + .desktop-sidebar { + display: none !important; + } + .desktop-cockpit-grid { + grid-template-columns: 1fr !important; + } +} + diff --git a/frontend/src/views/ControlPostView.tsx b/frontend/src/views/ControlPostView.tsx index f1626d2..0abdbb4 100644 --- a/frontend/src/views/ControlPostView.tsx +++ b/frontend/src/views/ControlPostView.tsx @@ -8,7 +8,6 @@ import { workstationApi, WorkstationListItem } from '../api/workstationApi'; import { accessApi } from '../api/accessApi'; import { hardwareApi } from '../api/hardwareApi'; import { useWebSocket } from '../hooks/useWebSocket'; -import { useTheme } from '../hooks/useTheme'; import { CameraScannerModal } from '../components/scanner/CameraScannerModal'; import { CompanionsRegistrationModal } from '../components/modals/CompanionsRegistrationModal'; import { ExitVerificationModal } from '../components/modals/ExitVerificationModal'; @@ -35,7 +34,7 @@ export interface LaneTab { export const ControlPostView: React.FC = () => { const { user, workstation, setWorkstation, logout } = useAuth(); - const { theme, toggleTheme } = useTheme(); + // Theme is managed via base.css / document element // Configuración de Estación y Módulos const [config, setConfig] = useState(null); @@ -46,14 +45,25 @@ export const ControlPostView: React.FC = () => { const [activeLaneTabKey, setActiveLaneTabKey] = useState(''); const [availableWorkstations, setAvailableWorkstations] = useState([]); const [isWksModalOpen, setIsWksModalOpen] = useState(false); - const [quickExitInput, setQuickExitInput] = useState(''); + const [quickExitMessage, setQuickExitMessage] = useState<{ text: string; type: 'success' | 'warn' | 'error' } | null>(null); - const [scannerMode, setScannerMode] = useState<'entry' | 'exit'>('entry'); + void setQuickExitMessage; + + + // Estados visuales y de paridad con escritorio (pct_view.py) + const [fotoPersonaUrl, setFotoPersonaUrl] = useState(''); + const [fotoDniUrl, setFotoDniUrl] = useState(''); + const [isIngresadosModalOpen, setIsIngresadosModalOpen] = useState(false); + const [salidaAutomatica, setSalidaAutomatica] = useState(false); + const [tipoDoc, setTipoDoc] = useState('DNI'); + const [tipoIngresoLabel, setTipoIngresoLabel] = useState('Visita'); + const [scannerInputValue, setScannerInputValue] = useState(''); + // Tickets activos y movimientos registrados en BD const [activeTickets, setActiveTickets] = useState([]); const [recentMovements, setRecentMovements] = useState([]); - const [viewTab, setViewTab] = useState<'active' | 'movements'>('active'); + const [filterQuery, setFilterQuery] = useState(''); const [isLoadingTickets, setIsLoadingTickets] = useState(false); @@ -91,8 +101,8 @@ export const ControlPostView: React.FC = () => { forzar_ingreso_lote_restringido: false, }); - const [associatedPatentes, setAssociatedPatentes] = useState([]); - const [showPoliciesSection, setShowPoliciesSection] = useState(true); + const [_associatedPatentes, setAssociatedPatentes] = useState([]); + const [confirmRestrictedModal, setConfirmRestrictedModal] = useState(false); @@ -111,31 +121,7 @@ export const ControlPostView: React.FC = () => { const [isSubmitting, setIsSubmitting] = useState(false); const [clock, setClock] = useState(''); - // PWA y Adaptabilidad Multiorientación - const [deferredPrompt, setDeferredPrompt] = useState(null); - const [canInstallPwa, setCanInstallPwa] = useState(false); - const [portraitTab, setPortraitTab] = useState<'entry' | 'predio'>('entry'); - // Detección de soporte PWA - useEffect(() => { - const pwaHandler = (e: any) => { - e.preventDefault(); - setDeferredPrompt(e); - setCanInstallPwa(true); - }; - window.addEventListener('beforeinstallprompt', pwaHandler); - return () => window.removeEventListener('beforeinstallprompt', pwaHandler); - }, []); - - const handleInstallPwa = async () => { - if (!deferredPrompt) return; - deferredPrompt.prompt(); - const choice = await deferredPrompt.userChoice; - if (choice.outcome === 'accepted') { - setCanInstallPwa(false); - } - setDeferredPrompt(null); - }; // Reloj digital en tiempo real useEffect(() => { @@ -245,10 +231,8 @@ export const ControlPostView: React.FC = () => { if (first.direction === 'ENTRY') { setSelectedEntryModuleId(first.moduleId); setForm((prev) => ({ ...prev, modulo_ingreso_id: first.moduleId })); - setScannerMode('entry'); } else if (first.direction === 'EXIT') { setSelectedExitModuleId(first.moduleId); - setScannerMode('exit'); } } } @@ -263,10 +247,8 @@ export const ControlPostView: React.FC = () => { if (tab.direction === 'ENTRY') { setSelectedEntryModuleId(tab.moduleId); setForm((prev) => ({ ...prev, modulo_ingreso_id: tab.moduleId })); - setScannerMode('entry'); } else if (tab.direction === 'EXIT') { setSelectedExitModuleId(tab.moduleId); - setScannerMode('exit'); } }; @@ -404,64 +386,138 @@ export const ControlPostView: React.FC = () => { } }, []); - const setQuickExpiry = (field: 'seguro_hasta' | 'art_hasta' | 'licencia_hasta', months: number) => { - const d = new Date(); - d.setMonth(d.getMonth() + months); - const yyyy = d.getFullYear(); - const mm = String(d.getMonth() + 1).padStart(2, '0'); - const dd = String(d.getDate()).padStart(2, '0'); - setForm((prev) => ({ ...prev, [field]: `${yyyy}-${mm}-${dd}` })); + const isModoSalida = currentLaneTab?.direction === 'EXIT'; + + const limpiarCampos = () => { + setForm({ + modulo_ingreso_id: selectedEntryModuleId, + documento: '', + apellido: '', + nombre: '', + sexo: 'M', + tipo_ingreso: 'CONDUCTOR', + patente: '', + lote_id: null, + lote_codigo: '', + motivo: 'VISITA', + entidad: 'CONDUCTOR...', + cantidad_ocupantes: 1, + cantidad_menores: 0, + cacheo_salida: true, + baul_inspeccionado: false, + abrir_barrera: true, + integrantes: [], + seguro_empresa: '', + seguro_poliza: '', + seguro_desde: '', + seguro_hasta: '', + art_empresa: '', + art_poliza: '', + art_desde: '', + art_hasta: '', + licencia_nro: '', + licencia_entidad: '', + licencia_hasta: '', + observaciones: '', + forzar_ingreso_lote_restringido: false, + }); + setAssociatedPatentes([]); + setLotPermission(null); + setTicketForExit(null); + setFotoPersonaUrl(''); + setFotoDniUrl(''); + setScannerInputValue(''); }; - // Búsqueda y salida rápida por DNI o Patente (Paridad pct_view.py:3313 txt_doc / cmb_patente) - const handleQuickExitSearch = (query: string) => { - const q = query.trim().toUpperCase(); - if (!q) return; + const buscarPersonaOPatente = (queryDoc?: string, queryPat?: string) => { + const doc = (queryDoc ?? form.documento).trim(); + const pat = (queryPat ?? form.patente).trim().toUpperCase(); - const cleanDni = q.replace(/[^0-9]/g, ''); - const matched = activeTickets.find((t) => { - const matchDoc = cleanDni && cleanDni.length >= 4 && t.documento && t.documento.replace(/[^0-9]/g, '').includes(cleanDni); - const matchPat = t.patente && t.patente.toUpperCase().replace(/\s/g, '').includes(q.replace(/\s/g, '')); - const matchName = `${t.apellido} ${t.nombre}`.toUpperCase().includes(q); - return matchDoc || matchPat || matchName; - }); - - if (matched) { - setQuickExitMessage({ - text: `Vehículo / Persona localizada: ${matched.patente || 'Peatón'} - ${matched.apellido}, ${matched.nombre}`, - type: 'success', + if (isModoSalida) { + const cleanDoc = doc.replace(/[^0-9]/g, ''); + const cleanPat = pat.replace(/\s/g, ''); + const matched = activeTickets.find((t) => { + const mDoc = cleanDoc && cleanDoc.length >= 4 && t.documento.replace(/[^0-9]/g, '').includes(cleanDoc); + const mPat = cleanPat && cleanPat.length >= 3 && t.patente && t.patente.toUpperCase().replace(/\s/g, '').includes(cleanPat); + return mDoc || mPat; }); - if (currentLaneTab && currentLaneTab.direction === 'EXIT') { - setSelectedExitModuleId(currentLaneTab.moduleId); + + if (matched) { + setForm((prev) => ({ + ...prev, + documento: matched.documento, + apellido: matched.apellido, + nombre: matched.nombre, + patente: matched.patente || '', + lote_codigo: matched.lote_codigo ? `Lote ${matched.lote_codigo}` : '', + lote_id: (matched as any).lote_id || null, + tipo_ingreso: matched.patente ? 'CONDUCTOR' : 'PEATON', + cantidad_ocupantes: matched.ocupantes, + cacheo_salida: Boolean(matched.cacheo_salida), + })); + setTicketForExit(matched); + setActionSuccess(`✓ Visita localizada en predio: ${matched.apellido}, ${matched.nombre} (${matched.patente || 'Peatón'})`); + setTimeout(() => setActionSuccess(null), 4000); + } else { + setActionError(`No se encontró ningún vehículo o persona activa en el predio con esos datos.`); } - setTicketForExit(matched); - setExitModalOpen(true); - setQuickExitInput(''); } else { - setQuickExitMessage({ - text: `No se encontró ningún ticket activo en el predio con "${query}".`, - type: 'warn', - }); - setTimeout(() => setQuickExitMessage(null), 5000); + if (doc && doc.length >= 4) { + lookupPerson(doc); + } + if (pat && pat.length >= 6) { + lookupVehicle(pat); + } } }; + const procesarSalida = () => { + if (!ticketForExit) { + const cleanDoc = form.documento.replace(/[^0-9]/g, ''); + const cleanPat = form.patente.toUpperCase().replace(/\s/g, ''); + const matched = activeTickets.find((t) => { + const mDoc = cleanDoc && cleanDoc.length >= 4 && t.documento.replace(/[^0-9]/g, '') === cleanDoc; + const mPat = cleanPat && cleanPat.length >= 3 && t.patente && t.patente.toUpperCase().replace(/\s/g, '') === cleanPat; + return mDoc || mPat; + }); + + if (matched) { + setTicketForExit(matched); + if (selectedExitModuleId) { + setExitModalOpen(true); + } else { + setActionError('Seleccione un módulo de salida para enviar el pulso.'); + } + } else { + setActionError('Seleccione una visita activa en predio o busque por DNI/Patente para generar la salida.'); + } + return; + } + + if (!selectedExitModuleId) { + setActionError('Seleccione un módulo de salida para enviar el pulso.'); + return; + } + setExitModalOpen(true); + }; + // Callback al escanear DNI con cámara (soporta Entrada y Salida) const handleDniScanned = (data: DNIParsedResult) => { - if (scannerMode === 'exit') { - handleQuickExitSearch(data.documento); + setForm((prev) => ({ + ...prev, + documento: data.documento, + apellido: data.apellido, + nombre: data.nombre, + sexo: data.sexo || 'M', + })); + setFotoDniUrl('/empty_profile.png'); + if (isModoSalida) { + buscarPersonaOPatente(data.documento); } else { - setForm((prev) => ({ - ...prev, - documento: data.documento, - apellido: data.apellido, - nombre: data.nombre, - sexo: data.sexo || 'M', - })); lookupPerson(data.documento); - setActionSuccess(`DNI escaneado exitosamente: ${data.apellido}, ${data.nombre} (${data.documento})`); - setTimeout(() => setActionSuccess(null), 4000); } + setActionSuccess(`DNI escaneado exitosamente: ${data.apellido}, ${data.nombre} (${data.documento})`); + setTimeout(() => setActionSuccess(null), 4000); }; // Envío del formulario de Ingreso con Validación Estricta @@ -506,7 +562,6 @@ export const ControlPostView: React.FC = () => { setActionError( `Acceso Bloqueado: Seguro Automotor Inválido (${segStat.label}). Por políticas de seguridad, no se autoriza el ingreso de vehículos sin cobertura de seguro vigente.` ); - setShowPoliciesSection(true); return; } } @@ -519,7 +574,6 @@ export const ControlPostView: React.FC = () => { setActionError( `Acceso Bloqueado: Cobertura ART / Accidentes Personales ${artStat.label}. Para personal de trabajo se exige póliza vigente.` ); - setShowPoliciesSection(true); return; } } @@ -630,19 +684,7 @@ export const ControlPostView: React.FC = () => { ); }, [activeTickets, filterQuery]); - // Filtro de movimientos historicos de la BD - const filteredMovements = useMemo(() => { - if (!filterQuery.trim()) return recentMovements; - const q = filterQuery.toLowerCase().trim(); - return recentMovements.filter( - (m: any) => - (m.documento && m.documento.toLowerCase().includes(q)) || - (m.apellido && m.apellido.toLowerCase().includes(q)) || - (m.nombre && m.nombre.toLowerCase().includes(q)) || - (m.patente && m.patente.toLowerCase().includes(q)) || - (m.modulo_nombre && m.modulo_nombre.toLowerCase().includes(q)) - ); - }, [recentMovements, filterQuery]); + const toggleFullscreen = () => { if (!document.fullscreenElement) { @@ -667,1986 +709,1044 @@ export const ControlPostView: React.FC = () => { return false; }, [selectedEntryModule]); + // Sincronizaciones auxiliares + void recentMovements; + void esModuloPeatonal; + void _associatedPatentes; + return ( -
- {/* ========================================================================= - Barra Superior de Control (Garita Cockpit) - ========================================================================= */} -
-
-
- OnEverAccess { - (e.target as HTMLImageElement).src = '/logo_mini.png'; - }} - /> -
-
-

- OnEverControl -

- - {APP_BUILD} - -
- - {workstation} • {clock} - +
+ {/* Barra Lateral Izquierda (Iconos de Escritorio) */} + + + {/* Área Principal */} +
+ {/* Cabecera Superior: Usuario + Logo Infinito + Tabs Entrada/Salida + Puesto + Reloj */} +
+
+
+ 👤 + {user?.username || 'root'} + +
+ +
+ OneverAccess
- {/* Estado de WebSocket / Enlace en tiempo real */} - - {wsConnected ? '● Online' : '○ Reconectando...'} - -
- - {/* Acciones de Operador */} -
- - 👤 Operador: {user?.username} - - - {/* Botón de instalación PWA en Tablet / Móvil */} - {canInstallPwa && ( - - )} - - - - - - -
-
- - {/* Banner de Mensajes y Alertas */} - {actionSuccess && ( -
- ✓ {actionSuccess} - -
- )} - - {actionError && ( -
- ⚠️ {actionError} - -
- )} - - {/* ========================================================================= - Barra de Pestañas Multi-Carril y Multi-Puesto (Paridad Desktop FormularioPuestoControlHost) - ========================================================================= */} - - - {/* Banner de Estado del Carril Activo */} - {currentLaneTab && currentLaneTab.direction === 'ENTRY' && ( -
-
- -
-
- - CARRIL DE ENTRADA: {currentLaneTab.name.toUpperCase()} - - - (Módulo #{currentLaneTab.moduleId} • Addr {currentLaneTab.address}) - -
- - Habilitación: {currentLaneTab.tipo_acceso_nombre || (currentLaneTab.es_acceso_peatonal ? 'Molinete / Puerta Peatonal' : 'Barrera Vehicular')} - -
-
-
- -
-
- )} - - {currentLaneTab && currentLaneTab.direction === 'EXIT' && ( -
-
- -
-
- - CARRIL DE SALIDA: {currentLaneTab.name.toUpperCase()} - - - (Módulo #{currentLaneTab.moduleId} • Addr {currentLaneTab.address}) - -
- - Habilitación: {currentLaneTab.tipo_acceso_nombre || (currentLaneTab.es_acceso_peatonal ? 'Molinete / Puerta Peatonal' : 'Barrera Vehicular')} - -
-
-
- -
-
- )} - - {/* Si el carril activo es SALIDA, renderizamos el Cockpit de Salida dedicado (Paridad pct_view.py _set_modo_salida) */} - {currentLaneTab && currentLaneTab.direction === 'EXIT' ? ( -
- {/* Barra Superior de Salida: Cámara y Búsqueda Directa */} -
-
- - -
{ - e.preventDefault(); - handleQuickExitSearch(quickExitInput); - }} - style={{ flex: 1, display: 'flex', gap: '0.6rem', minWidth: '280px' }} - > - setQuickExitInput(e.target.value)} - style={{ - flex: 1, - minHeight: '52px', - fontSize: '1.05rem', - border: '2px solid #EF4444', - borderRadius: '8px', - padding: '0 1rem', - }} - /> - -
-
- - {quickExitMessage && ( -
- {quickExitMessage.text} -
- )} -
- - {/* Grilla Principal de Salida */} -
- {/* Lista de Vehículos y Visitas en Predio */} -
-
-
-

- 🚗 Visitas y Vehículos en Predio ({activeTickets.length}) -

- - {filteredTickets.length} mostrados - -
- setFilterQuery(e.target.value)} - style={{ maxWidth: '280px', minHeight: '40px', fontSize: '0.9rem' }} - /> -
- -
- {filteredTickets.length === 0 ? ( -
- No hay vehículos ni visitas activas en el predio para dar salida. -
- ) : ( - filteredTickets.map((t) => ( -
-
-
- {t.patente || 'PEATÓN'} -
- -
-
- {t.apellido}, {t.nombre}{' '} - - (DNI: {t.documento}) - -
-
- Destino: Lote {t.lote_codigo || 'S/D'} • Ingreso: {t.fecha_ingreso} - {t.ocupantes > 1 && ( - - 👥 {t.ocupantes} personas - - )} - {t.cacheo_salida && ( - - 🔍 CACHEO OBLIGATORIO - - )} -
-
-
- - -
- )) - )} -
-
- - {/* Columna Derecha: Movimientos recientes */} -
-
-

- 📋 Últimos Movimientos -

- -
- -
- {recentMovements.slice(0, 12).map((m: any, idx: number) => ( -
-
- {m.patente || 'Peatón'} - {m.sentido} -
-
- {m.apellido}, {m.nombre} (Lote {m.lote_codigo || '-'}) -
-
{m.fecha_hora}
-
- ))} -
-
-
-
- ) : ( - /* Caso ENTRADA o PREDIO GENERAL: Layout Cockpit con soporte Multiorientación */ - <> - {/* Barra de pestañas responsive para tablets en modo vertical y móviles */} -
- - + /> + {tabLabel} + + ); + })}
+ {/* Reloj y Estado Puesto */} +
+ {actionSuccess && ( + + {actionSuccess} + + )} + {actionError && ( + + {actionError} + + )} + + + {clock} + + + {APP_VERSION} +
+ + + {/* Notificación rápida */} + {quickExitMessage && (
- {/* ======================================================================= - COLUMNA 1: FORMULARIO DE INGRESO RÁPIDO (Oculto en tab Predio General) - ======================================================================= */} - {currentLaneTab?.direction !== 'ALL' && ( -
- {/* Botón Gigante de Escaneo con Cámara */} + {quickExitMessage.text} +
+ )} + + {/* Cockpit 3 Columnas */} +
+ {/* ========================================================================= + COLUMNA 1: LECTOR QR / DOCUMENTO + CÁMARAS / IMÁGENES + ========================================================================= */} +
+ {/* Groupbox Lector */} +
+ Lector de Documento / QR +
+ { + setScannerInputValue(e.target.value); + if (e.target.value.length >= 4) { + lookupPerson(e.target.value); + } + }} + onKeyDown={(e) => { + if (e.key === 'Enter') { + e.preventDefault(); + buscarPersonaOPatente(); + } + }} + autoFocus + /> +
+
+ + {/* Groupbox Cámaras / Imágenes */} +
+ Cámaras / Imágenes + + {/* Foto Persona BD */} +
+
Foto (BD):
+
+ {fotoPersonaUrl ? ( + Persona + ) : ( +
+ + + + Foto Persona +
+ )} +
- -
handleRegisterEntry(e)} style={{ display: 'flex', flexDirection: 'column', gap: '0.85rem' }}> - {/* Selector de Modo: Conductor (Vehicular) vs Peatón (Tablet Friendly 48px) */} -
- - -
- - {/* Selector de Módulo de Entrada */} - {config && config.entry_modules.length > 0 && ( -
- - + Capturar Persona (Webcam) +
- )} - {/* Documento y Sexo */} -
-
- -
+ {/* Foto DNI Frente */} +
+
DNI (Frente):
+
+ {fotoDniUrl ? ( + DNI + ) : ( +
+ + + + Foto DNI +
+ )} +
+ +
+ + {!isModoSalida && ( + + )} +
+
+ + {/* ========================================================================= + COLUMNA 2: DATOS PERSONA, UBICACIÓN/DESTINO, OBSERVACIONES Y DOCUMENTACIÓN + ========================================================================= */} +
+ {/* Groupbox: Datos Persona */} +
+ Datos Persona + + {/* Fila 1: Ingreso / Doc / Nro Doc / Radios Conductor - Peatón */} +
+ Ingreso / Doc: + + +
+ Nro Doc: setForm((prev) => ({ ...prev, documento: e.target.value }))} - onBlur={() => lookupPerson(form.documento)} + onChange={(e) => { + setForm((prev) => ({ ...prev, documento: e.target.value })); + if (e.target.value.length >= 6) { + lookupPerson(e.target.value); + } + }} onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); - lookupPerson(form.documento); + buscarPersonaOPatente(); } }} - placeholder="Ej: 30123456" - required - style={{ width: '100%', paddingRight: '2rem' }} /> - {form.documento && ( - - )} +
+
+ +
-
- - -
-
- {/* Apellido y Nombre */} -
-
- + {/* Fila 2: Nombre / Apellido */} +
+ Nombre: setForm((prev) => ({ ...prev, apellido: e.target.value }))} - placeholder="Ej: PEREZ" - style={{ width: '100%', marginTop: '0.25rem', textTransform: 'uppercase' }} - /> -
-
- - setForm((prev) => ({ ...prev, nombre: e.target.value }))} - placeholder="Ej: JUAN" - required - style={{ width: '100%', marginTop: '0.25rem', textTransform: 'uppercase' }} + /> + Apellido: + setForm((prev) => ({ ...prev, apellido: e.target.value }))} />
-
- {/* Patente (Solo si Conductor) y Lote de Destino con Autocomplete */} -
- {form.tipo_ingreso === 'CONDUCTOR' && ( -
- + {/* Fila 3: Entidad/Empresa / Adultos */} +
+ Entidad/Empresa: + setForm((prev) => ({ ...prev, entidad: e.target.value }))} + /> + Adultos: + setForm((prev) => ({ ...prev, cantidad_ocupantes: Math.max(1, parseInt(e.target.value) || 1) }))} + /> +
+ + {/* Fila 4: Patente / Menores */} +
+ Patente: +
{ - const p = e.target.value.toUpperCase(); - setForm((prev) => ({ ...prev, patente: p })); - }} - onBlur={() => lookupVehicle(form.patente)} + onChange={(e) => setForm((prev) => ({ ...prev, patente: e.target.value.toUpperCase() }))} onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); - lookupVehicle(form.patente); + buscarPersonaOPatente(); } }} - placeholder="Ej: AB123CD" - style={{ width: '100%', marginTop: '0.25rem', textTransform: 'uppercase' }} /> - {associatedPatentes.length > 0 && ( -
- Sugeridas: - {associatedPatentes.map((p) => ( - - ))} -
- )} -
- )} - - {/* Selector de Lote con Paridad Desktop DialogoBuscarLote */} -
- -
-
setIsLotModalOpen(true)} - style={{ - flex: 1, - backgroundColor: form.lote_id ? 'var(--bg-card)' : 'rgba(0,0,0,0.1)', - border: form.lote_id ? '2px solid var(--accent-primary)' : '1px dashed var(--border-subtle)', - borderRadius: 'var(--radius-sm)', - padding: '0.65rem 0.85rem', - display: 'flex', - alignItems: 'center', - justifyContent: 'space-between', - cursor: 'pointer', - minHeight: '48px', - userSelect: 'none', - }} - title="Haga clic para buscar o seleccionar lote de destino" - > - {form.lote_id ? ( -
- 🏡 - - {form.lote_codigo} - -
- ) : ( - - Toque para seleccionar lote... - - )} - - {form.lote_id ? 'Cambiar' : 'Elegir'} - -
- +
+ Menores: + setForm((prev) => ({ ...prev, cantidad_menores: Math.max(0, parseInt(e.target.value) || 0) }))} + /> +
- {form.lote_id && ( + {/* Fila 5: Botonera Operativa */} +
+ + + {isModoSalida ? ( + <> - )} -
- - {/* Badge de Validación de Lote (Categoría 26: Habilitado / Moroso / En Obra) */} - {lotPermission && ( -
- - {lotPermission.estado === 'Habilitado' - ? '✅' - : lotPermission.estado === 'Restringido' - ? '⛔' - : '🚧'} - - {lotPermission.detalle} -
+ + + + + ) : ( + <> + + + + + )}
- {/* Motivo de Visita y Ocupantes Stepper */} -
-
- - -
- -
- -
+ {/* Dos Cajas Lado a Lado: Ubicación / Destino + Observaciones */} +
+ {/* Ubicación / Destino */} +
+ Ubicación / Destino +
+ Lote: + setIsLotModalOpen(true)} + style={{ cursor: 'pointer' }} + /> -
- {form.cantidad_ocupantes} -
-
-
-
- {/* Gestión de Acompañantes Múltiples (Paridad DialogoRegistroIntegrantes) */} -
-
- - 👥 ACOMPAÑANTES ({form.integrantes.length}) - - -
- - {form.integrantes.length > 0 ? ( -
- {form.integrantes.map((ing, idx) => ( - - {ing.es_menor ? '👶' : '👤'} {ing.apellido || ing.documento} - - ))} -
- ) : ( - - {form.tipo_ingreso === 'CONDUCTOR' ? 'Solo conductor.' : 'Solo peatón.'} Presione "+ Cargar Acompañantes" para registrar más ocupantes. - - )} -
- - {/* =================================================================== - SECCIÓN DE DOCUMENTACIÓN Y PÓLIZAS (Seguro / ART / Licencia) - =================================================================== */} -
- {/* Cabecera del Accordion con Badges de Estado */} -
setShowPoliciesSection((prev) => !prev)} - style={{ - padding: '0.65rem 0.85rem', - display: 'flex', - alignItems: 'center', - justifyContent: 'space-between', - cursor: 'pointer', - backgroundColor: 'var(--bg-surface)', - borderBottom: showPoliciesSection ? '1px solid var(--border-subtle)' : 'none', - userSelect: 'none', - }} - > -
- 🛡️ - - Pólizas y Coberturas - - {form.tipo_ingreso === 'CONDUCTOR' && ( - - Seguro: {getPolicyStatus(form.seguro_hasta).label} - - )} - {['TRABAJADOR', 'SERVICIO', 'PROVEEDOR', 'OBRA'].includes(form.motivo) && ( - - ART: {getPolicyStatus(form.art_hasta).label} - - )} -
- - {showPoliciesSection ? '▲' : '▼'} - -
- - {showPoliciesSection && ( -
- {/* 1. Seguro Automotor (Solo Conductor) */} - {form.tipo_ingreso === 'CONDUCTOR' && ( -
-
- - 🚗 Seguro Automotor * - - - {getPolicyStatus(form.seguro_hasta).label} - -
-
-
- - setForm((prev) => ({ ...prev, seguro_empresa: e.target.value }))} - placeholder="Ej: La Segunda / Zurich" - style={{ width: '100%', minHeight: '38px', fontSize: '0.85rem' }} - /> -
-
- - setForm((prev) => ({ ...prev, seguro_poliza: e.target.value }))} - placeholder="Ej: POL-998822" - style={{ width: '100%', minHeight: '38px', fontSize: '0.85rem' }} - /> -
-
-
-
- -
- - - -
-
- setForm((prev) => ({ ...prev, seguro_hasta: e.target.value }))} - style={{ - width: '100%', - minHeight: '40px', - marginTop: '0.2rem', - border: getPolicyStatus(form.seguro_hasta).status === 'expired' ? '2px solid #f44336' : undefined, - }} - /> -
-
- )} - - {/* 2. Póliza ART / Accidentes Personales */} -
-
- - 👷 ART / Accidentes Personales - - - {getPolicyStatus(form.art_hasta).label} - -
-
-
- - setForm((prev) => ({ ...prev, art_empresa: e.target.value }))} - placeholder="Ej: Prevención ART" - style={{ width: '100%', minHeight: '38px', fontSize: '0.85rem' }} - /> -
-
- - setForm((prev) => ({ ...prev, art_poliza: e.target.value }))} - placeholder="Ej: ART-5544" - style={{ width: '100%', minHeight: '38px', fontSize: '0.85rem' }} - /> -
-
-
-
- -
- - -
-
- setForm((prev) => ({ ...prev, art_hasta: e.target.value }))} - style={{ - width: '100%', - minHeight: '40px', - marginTop: '0.2rem', - border: getPolicyStatus(form.art_hasta).status === 'expired' ? '2px solid #f44336' : undefined, - }} - /> -
-
- - {/* 3. Licencia de Conducir (Opcional) */} -
- - 🪪 Licencia de Conducir - -
-
- - setForm((prev) => ({ ...prev, licencia_nro: e.target.value }))} - placeholder="Ej: B-30123456" - style={{ width: '100%', minHeight: '38px', fontSize: '0.85rem' }} - /> -
-
- - setForm((prev) => ({ ...prev, licencia_hasta: e.target.value }))} - style={{ width: '100%', minHeight: '38px' }} - /> -
-
-
- - {/* 4. Observaciones */} -
- -