Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +49 -17
templates/index.html
CHANGED
|
@@ -3,7 +3,11 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>ActiData
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
<style>
|
| 8 |
:root { --p: #0f172a; --a: #2563eb; --s: #10b981; --d: #ef4444; --w: #f59e0b; --bg: #f8fafc; --sidebar: #1e293b; --vis: #8b5cf6; --neg: #d97706; --mkt: #ec4899; }
|
| 9 |
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); margin:0; padding:0; color: #334155; display:flex; height:100vh; overflow:hidden; }
|
|
@@ -49,9 +53,9 @@
|
|
| 49 |
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
|
| 50 |
th, td { padding: 8px; border-bottom: 1px solid #eee; text-align: left; }
|
| 51 |
th { background: #f8fafc; color: #64748b; font-size: 0.75rem; text-transform: uppercase; }
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
#map-box { height: 400px
|
| 55 |
|
| 56 |
#status { text-align: center; margin-top: 15px; font-weight: bold; color: #64748b; }
|
| 57 |
#err-box { background: #fee2e2; color: #b91c1c; padding: 15px; border-radius: 8px; margin-top: 20px; display: none; text-align: center; }
|
|
@@ -59,7 +63,9 @@
|
|
| 59 |
.debug-btn { position: absolute; top:0; right:0; background: #64748b; padding:5px 10px; font-size:0.7rem; border-radius:4px; color:white; border:none; cursor:pointer; }
|
| 60 |
#debug-modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:2000; align-items:center; justify-content:center; }
|
| 61 |
#debug-content { background:white; width:80%; height:80%; padding:20px; overflow:auto; border-radius:10px; font-family:monospace; }
|
| 62 |
-
|
|
|
|
|
|
|
| 63 |
.chat-h { background: var(--p); color: white; padding: 15px; cursor: pointer; font-weight:bold; }
|
| 64 |
.chat-b { height: 300px; overflow-y: auto; padding: 15px; background: #f8fafc; }
|
| 65 |
.chat-f { padding: 10px; border-top: 1px solid #e2e8f0; background: white; display: flex; }
|
|
@@ -86,7 +92,7 @@
|
|
| 86 |
<div class="main-content">
|
| 87 |
<div class="container">
|
| 88 |
<div class="header">
|
| 89 |
-
<h1>🛡️ ActiData <span>AI
|
| 90 |
<p style="color:#64748b">Análisis Comercial & Jurídico Integral</p>
|
| 91 |
<button class="debug-btn" onclick="showDebug()">🐞 Ver Logs</button>
|
| 92 |
</div>
|
|
@@ -157,9 +163,10 @@
|
|
| 157 |
</div>
|
| 158 |
|
| 159 |
<div class="card">
|
| 160 |
-
<h3>📍 Ubicación
|
| 161 |
<div id="loc-name" style="font-size:0.8em; color:#999; margin-bottom:5px"></div>
|
| 162 |
-
<div id="map-box"></div> <div id="google-maps-link"></div>
|
|
|
|
| 163 |
|
| 164 |
<div class="card c-env">
|
| 165 |
<h3>🌳 Eco-Radar & SAE</h3>
|
|
@@ -201,13 +208,19 @@
|
|
| 201 |
|
| 202 |
<script>
|
| 203 |
let gData = null;
|
|
|
|
| 204 |
fetchHistory();
|
| 205 |
|
| 206 |
function safeSet(id, val) {
|
| 207 |
const el = document.getElementById(id);
|
| 208 |
if(el) el.innerText = (val !== undefined && val !== null && val !== "") ? val : '---';
|
| 209 |
}
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
function showDebug() {
|
| 212 |
document.getElementById('debug-text').innerText = JSON.stringify(gData ? gData.debug_info : "No data", null, 2);
|
| 213 |
document.getElementById('debug-modal').style.display = 'flex';
|
|
@@ -249,7 +262,7 @@
|
|
| 249 |
let f = document.getElementById('files').files;
|
| 250 |
if(!f.length) return alert("Selecciona archivos.");
|
| 251 |
|
| 252 |
-
safeSet('status', "⏳ Analizando con IA
|
| 253 |
document.getElementById('btnGo').disabled = true;
|
| 254 |
document.getElementById('err-box').style.display = 'none';
|
| 255 |
|
|
@@ -334,18 +347,23 @@
|
|
| 334 |
safeSet('vis-mat', vis.calidad_materiales);
|
| 335 |
safeSet('vis-obs', vis.observaciones);
|
| 336 |
|
| 337 |
-
// 7. MAPA
|
| 338 |
-
if(d.
|
| 339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
} else {
|
| 341 |
-
document.getElementById('map-box').innerHTML = "<div style='display:flex;align-items:center;justify-content:center;height:100%'>
|
| 342 |
}
|
|
|
|
| 343 |
// Link de Street View
|
| 344 |
if(d.g_maps_link) {
|
| 345 |
document.getElementById('google-maps-link').innerHTML = `<a href="${d.g_maps_link}" target="_blank" class="sv-btn">🌍 Ver Street View en Google Maps</a>`;
|
| 346 |
-
} else if(d.coords && d.coords.lat) {
|
| 347 |
-
let gUrl = `https://www.google.com/maps?q=${d.coords.lat},${d.coords.lon}`;
|
| 348 |
-
document.getElementById('google-maps-link').innerHTML = `<a href="${gUrl}" target="_blank" class="sv-btn">🌍 Ver Mapa en Google Maps</a>`;
|
| 349 |
}
|
| 350 |
|
| 351 |
// 8. AMBIENTAL
|
|
@@ -427,5 +445,19 @@
|
|
| 427 |
}
|
| 428 |
</script>
|
| 429 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
</body>
|
| 431 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ActiData V175</title>
|
| 7 |
+
|
| 8 |
+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
|
| 9 |
+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
|
| 10 |
+
|
| 11 |
<style>
|
| 12 |
:root { --p: #0f172a; --a: #2563eb; --s: #10b981; --d: #ef4444; --w: #f59e0b; --bg: #f8fafc; --sidebar: #1e293b; --vis: #8b5cf6; --neg: #d97706; --mkt: #ec4899; }
|
| 13 |
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); margin:0; padding:0; color: #334155; display:flex; height:100vh; overflow:hidden; }
|
|
|
|
| 53 |
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
|
| 54 |
th, td { padding: 8px; border-bottom: 1px solid #eee; text-align: left; }
|
| 55 |
th { background: #f8fafc; color: #64748b; font-size: 0.75rem; text-transform: uppercase; }
|
| 56 |
+
|
| 57 |
+
/* MAPA SEGURO LEAFLET */
|
| 58 |
+
#map-box { height: 400px; width: 100%; border-radius: 8px; z-index: 1; }
|
| 59 |
|
| 60 |
#status { text-align: center; margin-top: 15px; font-weight: bold; color: #64748b; }
|
| 61 |
#err-box { background: #fee2e2; color: #b91c1c; padding: 15px; border-radius: 8px; margin-top: 20px; display: none; text-align: center; }
|
|
|
|
| 63 |
.debug-btn { position: absolute; top:0; right:0; background: #64748b; padding:5px 10px; font-size:0.7rem; border-radius:4px; color:white; border:none; cursor:pointer; }
|
| 64 |
#debug-modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:2000; align-items:center; justify-content:center; }
|
| 65 |
#debug-content { background:white; width:80%; height:80%; padding:20px; overflow:auto; border-radius:10px; font-family:monospace; }
|
| 66 |
+
|
| 67 |
+
/* CHAT FIX */
|
| 68 |
+
.chat-w { position: fixed; bottom: 20px; right: 20px; width: 340px; background: white; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); display: none; border: 1px solid #e2e8f0; z-index: 9999; flex-direction: column; overflow: hidden; }
|
| 69 |
.chat-h { background: var(--p); color: white; padding: 15px; cursor: pointer; font-weight:bold; }
|
| 70 |
.chat-b { height: 300px; overflow-y: auto; padding: 15px; background: #f8fafc; }
|
| 71 |
.chat-f { padding: 10px; border-top: 1px solid #e2e8f0; background: white; display: flex; }
|
|
|
|
| 92 |
<div class="main-content">
|
| 93 |
<div class="container">
|
| 94 |
<div class="header">
|
| 95 |
+
<h1>🛡️ ActiData <span>AI V175</span></h1>
|
| 96 |
<p style="color:#64748b">Análisis Comercial & Jurídico Integral</p>
|
| 97 |
<button class="debug-btn" onclick="showDebug()">🐞 Ver Logs</button>
|
| 98 |
</div>
|
|
|
|
| 163 |
</div>
|
| 164 |
|
| 165 |
<div class="card">
|
| 166 |
+
<h3>📍 Ubicación</h3>
|
| 167 |
<div id="loc-name" style="font-size:0.8em; color:#999; margin-bottom:5px"></div>
|
| 168 |
+
<div id="map-box"></div> <div id="google-maps-link"></div>
|
| 169 |
+
</div>
|
| 170 |
|
| 171 |
<div class="card c-env">
|
| 172 |
<h3>🌳 Eco-Radar & SAE</h3>
|
|
|
|
| 208 |
|
| 209 |
<script>
|
| 210 |
let gData = null;
|
| 211 |
+
let map = null; // Global map instance
|
| 212 |
fetchHistory();
|
| 213 |
|
| 214 |
function safeSet(id, val) {
|
| 215 |
const el = document.getElementById(id);
|
| 216 |
if(el) el.innerText = (val !== undefined && val !== null && val !== "") ? val : '---';
|
| 217 |
}
|
| 218 |
+
|
| 219 |
+
function toggleChat() {
|
| 220 |
+
let w = document.getElementById('chat-window');
|
| 221 |
+
w.style.display = (w.style.display === 'flex') ? 'none' : 'flex';
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
function showDebug() {
|
| 225 |
document.getElementById('debug-text').innerText = JSON.stringify(gData ? gData.debug_info : "No data", null, 2);
|
| 226 |
document.getElementById('debug-modal').style.display = 'flex';
|
|
|
|
| 262 |
let f = document.getElementById('files').files;
|
| 263 |
if(!f.length) return alert("Selecciona archivos.");
|
| 264 |
|
| 265 |
+
safeSet('status', "⏳ Analizando con IA V175...");
|
| 266 |
document.getElementById('btnGo').disabled = true;
|
| 267 |
document.getElementById('err-box').style.display = 'none';
|
| 268 |
|
|
|
|
| 347 |
safeSet('vis-mat', vis.calidad_materiales);
|
| 348 |
safeSet('vis-obs', vis.observaciones);
|
| 349 |
|
| 350 |
+
// 7. MAPA CON LEAFLET JS
|
| 351 |
+
if(d.coords && d.coords.lat) {
|
| 352 |
+
if(map) { map.remove(); } // Limpiar mapa anterior
|
| 353 |
+
map = L.map('map-box').setView([d.coords.lat, d.coords.lon], 16);
|
| 354 |
+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
| 355 |
+
attribution: '© OpenStreetMap'
|
| 356 |
+
}).addTo(map);
|
| 357 |
+
L.marker([d.coords.lat, d.coords.lon]).addTo(map)
|
| 358 |
+
.bindPopup(d.meta.dir_legal || "Ubicación")
|
| 359 |
+
.openPopup();
|
| 360 |
} else {
|
| 361 |
+
document.getElementById('map-box').innerHTML = "<div style='display:flex;align-items:center;justify-content:center;height:100%;color:#999'>Ubicación no detectada</div>";
|
| 362 |
}
|
| 363 |
+
|
| 364 |
// Link de Street View
|
| 365 |
if(d.g_maps_link) {
|
| 366 |
document.getElementById('google-maps-link').innerHTML = `<a href="${d.g_maps_link}" target="_blank" class="sv-btn">🌍 Ver Street View en Google Maps</a>`;
|
|
|
|
|
|
|
|
|
|
| 367 |
}
|
| 368 |
|
| 369 |
// 8. AMBIENTAL
|
|
|
|
| 445 |
}
|
| 446 |
</script>
|
| 447 |
|
| 448 |
+
<div id="debug-modal" onclick="this.style.display='none'">
|
| 449 |
+
<div id="debug-content" onclick="event.stopPropagation()">
|
| 450 |
+
<h3>🐛 Logs Técnicos</h3>
|
| 451 |
+
<pre id="debug-text" style="white-space: pre-wrap; word-break: break-all;">Sin datos...</pre>
|
| 452 |
+
<button onclick="document.getElementById('debug-modal').style.display='none'">Cerrar</button>
|
| 453 |
+
</div>
|
| 454 |
+
</div>
|
| 455 |
+
|
| 456 |
+
<div class="chat-w" id="chat-window">
|
| 457 |
+
<div class="chat-h" onclick="toggleChat()">Asistente ActiData <span>✖</span></div>
|
| 458 |
+
<div class="chat-b" id="msgs"></div>
|
| 459 |
+
<div class="chat-f"><input id="q" placeholder="Pregunta..." onkeypress="if(event.key=='Enter')ask()"></div>
|
| 460 |
+
</div>
|
| 461 |
+
|
| 462 |
</body>
|
| 463 |
</html>
|