Compare commits
1
Commits
v0.7.2-beta
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9131ba777d |
Binary file not shown.
@@ -1,8 +1,7 @@
|
||||
package com.oemspot.onevercontrol;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
|
||||
public class MainActivity extends BridgeActivity {
|
||||
@@ -10,15 +9,8 @@ public class MainActivity extends BridgeActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Prevenir que la barra de estado superior y la barra de navegación inferior del sistema tapen la app
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> {
|
||||
int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top;
|
||||
int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom;
|
||||
int left = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left;
|
||||
int right = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right;
|
||||
|
||||
view.setPadding(left, top, right, bottom);
|
||||
return insets;
|
||||
});
|
||||
// Asegurar que la ventana respete limpiamente las barras del sistema (Status Bar y Navigation Bar)
|
||||
// evitando solapamientos y eliminando espacios vacíos redundantes
|
||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:fitsSystemWindows">true</item>
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -7,7 +7,16 @@ export function getBaseUrl(): string {
|
||||
// 1. URL personalizada en localStorage (útil para configurar IP de backend en tablet)
|
||||
const savedUrl = localStorage.getItem('on_ever_api_url');
|
||||
if (savedUrl && savedUrl.trim()) {
|
||||
const trimmed = savedUrl.trim();
|
||||
let trimmed = savedUrl.trim();
|
||||
// Si en una tablet Android (Capacitor) guardan solo "/api/v1" o una ruta relativa,
|
||||
// en la app nativa debe resolverse hacia la IP LAN del backend
|
||||
if (Capacitor.isNativePlatform() && trimmed.startsWith('/')) {
|
||||
return `http://192.168.0.100:8000${trimmed.endsWith('/') ? trimmed.slice(0, -1) : trimmed}`;
|
||||
}
|
||||
// Si ingresaron la IP sin protocolo (ej: "192.168.0.100:8000" o "192.168.0.100:8000/api/v1")
|
||||
if (!trimmed.startsWith('http://') && !trimmed.startsWith('https://') && !trimmed.startsWith('/')) {
|
||||
trimmed = `http://${trimmed}`;
|
||||
}
|
||||
return trimmed.endsWith('/') ? trimmed.slice(0, -1) : trimmed;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,8 @@ html, body {
|
||||
touch-action: manipulation;
|
||||
overscroll-behavior-y: contain;
|
||||
user-select: none;
|
||||
|
||||
/* Safe Area Insets para prevenir solapamiento con la barra de estado y de navegación de Android */
|
||||
padding-top: env(safe-area-inset-top, 0px);
|
||||
padding-bottom: env(safe-area-inset-bottom, 0px);
|
||||
padding-left: env(safe-area-inset-left, 0px);
|
||||
padding-right: env(safe-area-inset-right, 0px);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#root {
|
||||
|
||||
@@ -297,32 +297,56 @@ export const ControlPostView: React.FC = () => {
|
||||
// Lista de carriles/pestañas del puesto actual (Paridad escritorio FormularioPuestoControlHost)
|
||||
const laneTabs = useMemo<LaneTab[]>(() => {
|
||||
const tabs: LaneTab[] = [];
|
||||
if (config?.entry_modules) {
|
||||
if (config?.entry_modules && config.entry_modules.length > 0) {
|
||||
config.entry_modules.forEach((m) => {
|
||||
tabs.push({
|
||||
key: `entry-${m.id}`,
|
||||
moduleId: m.id,
|
||||
key: `entry-${m.id || (m as any).modulo_id}`,
|
||||
moduleId: m.id || (m as any).modulo_id,
|
||||
direction: 'ENTRY',
|
||||
name: m.name,
|
||||
name: m.name || (m as any).nombre || 'ENTRADA VISITAS',
|
||||
address: m.address,
|
||||
tipo_acceso_nombre: m.tipo_acceso_nombre,
|
||||
es_acceso_peatonal: m.es_acceso_peatonal,
|
||||
});
|
||||
});
|
||||
}
|
||||
if (config?.exit_modules) {
|
||||
if (config?.exit_modules && config.exit_modules.length > 0) {
|
||||
config.exit_modules.forEach((m) => {
|
||||
tabs.push({
|
||||
key: `exit-${m.id}`,
|
||||
moduleId: m.id,
|
||||
key: `exit-${m.id || (m as any).modulo_id}`,
|
||||
moduleId: m.id || (m as any).modulo_id,
|
||||
direction: 'EXIT',
|
||||
name: m.name,
|
||||
name: m.name || (m as any).nombre || 'SALIDA VISITAS',
|
||||
address: m.address,
|
||||
tipo_acceso_nombre: m.tipo_acceso_nombre,
|
||||
es_acceso_peatonal: m.es_acceso_peatonal,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Fallback garantizado: si la estación actual no tiene módulos asignados en DB o está cargando,
|
||||
// mostrar siempre los carriles virtuales de Entrada y Salida para que el operador pueda trabajar
|
||||
if (tabs.length === 0) {
|
||||
tabs.push({
|
||||
key: 'entry-default',
|
||||
moduleId: 100009,
|
||||
direction: 'ENTRY',
|
||||
name: 'ENTRADA VISITAS',
|
||||
address: 90,
|
||||
tipo_acceso_nombre: 'Barrera Pulso',
|
||||
es_acceso_peatonal: false,
|
||||
});
|
||||
tabs.push({
|
||||
key: 'exit-default',
|
||||
moduleId: 100010,
|
||||
direction: 'EXIT',
|
||||
name: 'SALIDA VISITAS',
|
||||
address: 91,
|
||||
tipo_acceso_nombre: 'Barrera Pulso',
|
||||
es_acceso_peatonal: false,
|
||||
});
|
||||
}
|
||||
|
||||
return tabs;
|
||||
}, [config]);
|
||||
|
||||
@@ -1155,26 +1179,13 @@ export const ControlPostView: React.FC = () => {
|
||||
<main className="desktop-main-area">
|
||||
{/* Cabecera Superior: Tabs Entrada/Salida + Reloj + Menú Hamburguesa (☰) */}
|
||||
<header className="desktop-top-header">
|
||||
{/* Pestañas de Carriles: ENTRADA VISITAS / SALIDA DE VISITAS */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '0.75rem' }}>
|
||||
{/* Pestañas de Carriles: Módulos Virtuales Asociados */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '0.6rem', overflowX: 'auto', scrollbarWidth: 'none' }}>
|
||||
{laneTabs.map((tab) => {
|
||||
const isActive = tab.key === activeLaneTabKey;
|
||||
const isEntry = tab.direction === 'ENTRY';
|
||||
const dotColor = isEntry ? '#10B981' : '#EF4444';
|
||||
let tabLabel = isEntry ? 'ENTRADA VISITAS' : 'SALIDA DE VISITAS';
|
||||
if (tab.name) {
|
||||
const norm = tab.name.trim().toUpperCase();
|
||||
if (
|
||||
norm !== 'ENTRADA' &&
|
||||
norm !== 'SALIDA' &&
|
||||
norm !== 'ENTRADA VISITAS' &&
|
||||
norm !== 'SALIDA DE VISITAS' &&
|
||||
!norm.includes('ENTRADA') &&
|
||||
!norm.includes('SALIDA')
|
||||
) {
|
||||
tabLabel += ` (${tab.name})`;
|
||||
}
|
||||
}
|
||||
const tabLabel = tab.name ? tab.name.toUpperCase() : (isEntry ? 'ENTRADA VISITAS' : 'SALIDA DE VISITAS');
|
||||
|
||||
return (
|
||||
<button
|
||||
@@ -1191,9 +1202,10 @@ export const ControlPostView: React.FC = () => {
|
||||
backgroundColor: dotColor,
|
||||
boxShadow: isActive ? `0 0 8px ${dotColor}` : 'none',
|
||||
display: 'inline-block',
|
||||
flexShrink: 0,
|
||||
}}
|
||||
/>
|
||||
<span>{tabLabel}</span>
|
||||
<span style={{ whiteSpace: 'nowrap' }}>{tabLabel}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user