From e84fca59af82dcad040701dd57a75113bcf29c72 Mon Sep 17 00:00:00 2001 From: marsalva Date: Wed, 25 Feb 2026 20:17:10 +0000 Subject: [PATCH] Actualizar index.html --- index.html | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/index.html b/index.html index ffa9efb..932fc48 100644 --- a/index.html +++ b/index.html @@ -35,14 +35,6 @@

Conectando...

- -
@@ -90,32 +82,16 @@ const urlParams = new URLSearchParams(window.location.search); urlToken = urlParams.get('token'); - // SOLUCIÓN AL BLOQUEO SIN TOKEN - if (!urlToken) { - showError(); - return; - } + if (!urlToken) return; try { const res = await fetch(`${API_URL}/public/portal/${urlToken}`); const data = await res.json(); if (!data.ok) throw new Error("Token inválido"); renderPortal(data.client, data.company, data.services); - } catch (e) { - console.error(e); - showError(); - } + } catch (e) { console.error(e); } }); - function showError() { - document.getElementById('loader').classList.add('opacity-0', 'pointer-events-none'); - setTimeout(() => { - document.getElementById('loader').classList.add('hidden'); - document.getElementById('errorScreen').classList.remove('hidden'); - document.getElementById('errorScreen').classList.add('flex'); - }, 300); - } - function summarizeDescription(rawText) { if (!rawText) return "Avería reportada."; let text = rawText.replace(/\n/g, ' '); @@ -269,11 +245,10 @@ // LÓGICA DE MAPA EN TIEMPO REAL // ========================================== function initLiveMap(serviceId) { - // CORRECCIÓN APLICADA: liveMap- - if(!document.getElementById(`liveMap-${serviceId}`)) return; + if(!document.getElementById(`map-${serviceId}`)) return; // 1. Configuramos el mapa de Leaflet - liveMaps[serviceId] = L.map(`liveMap-${serviceId}`, { zoomControl: false, attributionControl: false }).setView([40.416775, -3.703790], 6); + liveMaps[serviceId] = L.map(`map-${serviceId}`, { zoomControl: false, attributionControl: false }).setView([40.416775, -3.703790], 6); L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png').addTo(liveMaps[serviceId]); // 2. Creamos un icono HTML personalizado (un puntito azul que brilla) @@ -298,7 +273,7 @@ if (data.ok && data.location) { const loader = document.getElementById(`map-loader-${serviceId}`); - if(loader) loader.classList.add('hidden'); // Ocultar pantalla de carga + if(loader) loader.classList.add('hidden'); // Ocultar pantalla de "Buscando satélites" const lat = parseFloat(data.location.lat); const lng = parseFloat(data.location.lng); @@ -312,9 +287,6 @@ liveMarkers[serviceId].setLatLng([lat, lng]); liveMaps[serviceId].flyTo([lat, lng], 16, { animate: true, duration: 1.5 }); } - } else { - const p = document.querySelector(`#map-loader-${serviceId} p`); - if(p) p.innerText = "ESPERANDO SEÑAL GPS DEL TÉCNICO..."; } } catch(e) {} }