- ${compShort}
+ ${compShort}
${guildObj ? guildObj.name : 'Reparación'}
${name}
@@ -369,11 +371,8 @@
for(let key in raw) {
if(skipKeys.includes(key)) continue;
- let val = raw[key];
- // ARREGLO TYPEERROR: Verificamos si val es string antes del trim
- let valStr = String(val || "");
+ let valStr = String(raw[key] || "");
if(valStr.trim() === "") continue;
-
detailsHtml += `
${key}${valStr}
`;
}
extraContainer.innerHTML = detailsHtml || '
Sin datos adicionales.
';
@@ -388,8 +387,6 @@
const modal = document.getElementById('serviceModal');
modal.classList.add('translate-y-full');
setTimeout(() => modal.style.display = 'none', 300);
- document.getElementById('gpsLoading').classList.remove('hidden');
- document.getElementById('gpsResult').classList.add('hidden');
}
function callClient() { const p = document.getElementById('detPhoneRaw').value; if (p) window.location.href = `tel:+34${p}`; else alert("Sin teléfono"); }
@@ -397,7 +394,7 @@
function openMaps() { const a = document.getElementById('detAddress').innerText; if (a) window.open(`maps://?q=${encodeURIComponent(a)}`, '_blank'); }
async function calculateDistance(dest) {
- if(!navigator.geolocation) { showGpsError("No GPS"); return; }
+ if(!navigator.geolocation) return;
navigator.geolocation.getCurrentPosition(async (pos) => {
const lat = pos.coords.latitude; const lon = pos.coords.longitude;
try {
@@ -412,13 +409,11 @@
document.getElementById('gpsResult').classList.remove('hidden');
document.getElementById('gpsKm').innerText = km.toFixed(1);
document.getElementById('gpsMins').innerText = Math.round((km/35)*60)+5;
- } else { showGpsError("Sin ubicación"); }
- } catch(e) { showGpsError("Error GPS"); }
- }, () => showGpsError("GPS off"), { enableHighAccuracy: true });
+ }
+ } catch(e) { }
+ });
}
- function showGpsError(m) { document.getElementById('gpsLoading').innerHTML = `
${m}`; }
-
async function quickUpdate(action) {
if(!currentServiceId) return;
let word = ""; let msg = "";
@@ -436,7 +431,7 @@
method: 'PUT', headers: { "Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}` },
body: JSON.stringify({ status_operativo: st.id })
});
- if(res.ok) { showToast("¡Hecho!"); closeModal(); refreshData(); }
+ if(res.ok) { showToast("¡Actualizado!"); closeModal(); refreshData(); }
} catch (e) { alert("Error"); }
}