Actualizar calendario.html

This commit is contained in:
2026-02-22 18:20:39 +00:00
parent bc5e48ee44
commit 49240b5167

View File

@@ -7,7 +7,7 @@
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide@latest"></script> <script src="https://unpkg.com/lucide@latest"></script>
<style> <style>
body { background-color: #f4f7f9; -webkit-tap-highlight-color: transparent; } body { background-color: #f8fafc; -webkit-tap-highlight-color: transparent; }
.fade-in { animation: fadeIn 0.3s ease-out forwards; } .fade-in { animation: fadeIn 0.3s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.no-scrollbar::-webkit-scrollbar { display: none; } .no-scrollbar::-webkit-scrollbar { display: none; }
@@ -15,24 +15,27 @@
.main-content { padding-bottom: 120px; } .main-content { padding-bottom: 120px; }
.day-card { transition: all 0.2s; } .day-card { transition: all 0.2s; }
.day-active { background-color: #2563eb; color: white; border-color: #2563eb; transform: scale(1.05); box-shadow: 0 10px 15px -3px rgba(37,99,235,0.4); } .day-active { background-color: #1e3a8a; color: white; border-color: #1e3a8a; transform: scale(1.05); box-shadow: 0 10px 15px -3px rgba(30,58,138,0.3); }
.day-inactive { background-color: white; color: #64748b; border-color: #e2e8f0; } .day-inactive { background-color: white; color: #64748b; border-color: #e2e8f0; }
/* Arreglo del Scroll del Modal */ /* Scroll del Modal */
#serviceModal { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; background: #f8fafc; } #serviceModal { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; background: #f1f5f9; }
.modal-scroll-area { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 100px; } .modal-scroll-area { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 100px; }
/* Caja de descripción sobria */
.desc-box { background: white; border: 1px solid #e2e8f0; border-radius: 1.5rem; padding: 1.25rem; }
</style> </style>
</head> </head>
<body class="text-slate-800 font-sans antialiased h-screen flex flex-col overflow-hidden relative"> <body class="text-slate-800 font-sans antialiased h-screen flex flex-col overflow-hidden relative">
<header class="bg-white px-5 pt-safe mt-6 pb-4 shadow-sm z-20 shrink-0 border-b border-slate-100"> <header class="bg-white px-5 pt-safe mt-6 pb-4 shadow-sm z-20 shrink-0 border-b border-slate-200">
<div class="flex items-center gap-3 mb-4"> <div class="flex items-center gap-3 mb-4">
<a href="menu.html" class="w-10 h-10 shrink-0 bg-slate-50 rounded-full flex items-center justify-center text-slate-600 border border-slate-200 active:scale-95 transition-transform"> <a href="menu.html" class="w-10 h-10 shrink-0 bg-slate-50 rounded-full flex items-center justify-center text-slate-600 border border-slate-200 active:scale-95 transition-transform">
<i data-lucide="arrow-left" class="w-5 h-5"></i> <i data-lucide="arrow-left" class="w-5 h-5"></i>
</a> </a>
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0">
<p class="text-[10px] font-black text-blue-500 uppercase tracking-widest mb-0.5 truncate" id="monthYearDisplay">Cargando...</p> <p class="text-[10px] font-black text-blue-800 uppercase tracking-widest mb-0.5 truncate" id="monthYearDisplay">Cargando...</p>
<h1 class="text-xl font-black tracking-tight text-slate-800 leading-none truncate">Mi Agenda</h1> <h1 class="text-xl font-black tracking-tight text-slate-900 leading-none truncate">Mi Agenda</h1>
</div> </div>
<div class="flex gap-1 shrink-0"> <div class="flex gap-1 shrink-0">
<button onclick="changeWeek(-1)" class="w-10 h-10 bg-white rounded-full flex items-center justify-center text-slate-600 border border-slate-200 active:bg-slate-50 shadow-sm"><i data-lucide="chevron-left" class="w-5 h-5"></i></button> <button onclick="changeWeek(-1)" class="w-10 h-10 bg-white rounded-full flex items-center justify-center text-slate-600 border border-slate-200 active:bg-slate-50 shadow-sm"><i data-lucide="chevron-left" class="w-5 h-5"></i></button>
@@ -44,20 +47,20 @@
<main class="flex-1 overflow-y-auto no-scrollbar p-5 main-content relative z-10" id="mainArea"> <main class="flex-1 overflow-y-auto no-scrollbar p-5 main-content relative z-10" id="mainArea">
<div id="loader" class="text-center py-10 opacity-50"> <div id="loader" class="text-center py-10 opacity-50">
<i data-lucide="loader-2" class="w-8 h-8 animate-spin mx-auto text-blue-500 mb-2"></i> <i data-lucide="loader-2" class="w-8 h-8 animate-spin mx-auto text-blue-900 mb-2"></i>
<p class="text-xs font-bold uppercase tracking-widest">Cargando datos...</p> <p class="text-xs font-bold uppercase tracking-widest text-slate-400">Consultando Base de Datos...</p>
</div> </div>
<div id="dayTitle" class="font-black text-slate-400 uppercase tracking-widest text-[10px] mb-4 hidden">Servicios</div> <div id="dayTitle" class="font-black text-slate-400 uppercase tracking-widest text-[10px] mb-4 hidden">Servicios</div>
<div id="servicesList" class="space-y-4 hidden fade-in"></div> <div id="servicesList" class="space-y-4 hidden fade-in"></div>
</main> </main>
<nav class="bg-white/90 backdrop-blur-md border-t border-slate-200 z-20 absolute bottom-0 left-0 w-full shadow-[0_-10px_30px_rgba(0,0,0,0.05)] rounded-t-[2rem]"> <nav class="bg-white/95 backdrop-blur-md border-t border-slate-200 z-20 absolute bottom-0 left-0 w-full rounded-t-[2rem] shadow-[0_-10px_30px_rgba(0,0,0,0.03)]">
<div class="flex justify-around items-center px-3 pt-3 pb-8"> <div class="flex justify-around items-center px-3 pt-3 pb-8">
<a href="menu.html" class="flex flex-col items-center p-2 text-slate-400 hover:text-blue-600 w-20"> <a href="menu.html" class="flex flex-col items-center p-2 text-slate-400 hover:text-blue-900 w-20">
<i data-lucide="layout-grid" class="w-6 h-6 mb-1"></i> <i data-lucide="layout-grid" class="w-6 h-6 mb-1"></i>
<span class="text-[9px] font-black uppercase tracking-widest">Inicio</span> <span class="text-[9px] font-black uppercase tracking-widest">Inicio</span>
</a> </a>
<a href="calendario.html" class="flex flex-col items-center p-2 text-blue-600 w-20"> <a href="calendario.html" class="flex flex-col items-center p-2 text-blue-900 w-20">
<i data-lucide="calendar-days" class="w-6 h-6 mb-1"></i> <i data-lucide="calendar-days" class="w-6 h-6 mb-1"></i>
<span class="text-[9px] font-black uppercase tracking-widest">Agenda</span> <span class="text-[9px] font-black uppercase tracking-widest">Agenda</span>
</a> </a>
@@ -69,11 +72,11 @@
</nav> </nav>
<div id="serviceModal" class="translate-y-full transition-transform duration-300"> <div id="serviceModal" class="translate-y-full transition-transform duration-300">
<div class="pt-safe bg-white border-b border-slate-100 flex justify-between items-center p-4 shrink-0 shadow-sm"> <div class="pt-safe bg-white border-b border-slate-200 flex justify-between items-center p-4 shrink-0 shadow-sm">
<button onclick="closeModal()" class="bg-slate-100 p-2.5 rounded-full text-slate-600 active:scale-90 transition-transform"><i data-lucide="chevron-down" class="w-6 h-6"></i></button> <button onclick="closeModal()" class="bg-slate-100 p-2.5 rounded-full text-slate-600 active:scale-90 transition-transform"><i data-lucide="chevron-down" class="w-6 h-6"></i></button>
<div class="flex items-center gap-2 bg-blue-50 px-4 py-1.5 rounded-full border border-blue-100"> <div class="flex items-center gap-2 bg-slate-900 px-4 py-1.5 rounded-full">
<i data-lucide="clock" class="w-4 h-4 text-blue-600"></i> <i data-lucide="clock" class="w-4 h-4 text-blue-300"></i>
<span class="font-black text-xs text-blue-700 uppercase" id="modTime">--:--</span> <span class="font-black text-xs text-white uppercase" id="modTime">--:--</span>
</div> </div>
<div class="w-10"></div> <div class="w-10"></div>
</div> </div>
@@ -82,61 +85,60 @@
<input type="hidden" id="detId"> <input type="hidden" id="detId">
<input type="hidden" id="detPhoneRaw"> <input type="hidden" id="detPhoneRaw">
<div id="urgentBanner" class="hidden bg-rose-600 text-white p-4 rounded-3xl flex items-center justify-center gap-3 shadow-xl shadow-rose-200 animate-pulse"> <div id="urgentBanner" class="hidden bg-blue-900 text-white p-4 rounded-3xl flex items-center justify-center gap-3 shadow-lg border-b-4 border-blue-700">
<i data-lucide="alert-octagon" class="w-6 h-6"></i> <i data-lucide="alert-circle" class="w-6 h-6 text-blue-400"></i>
<span class="font-black text-sm uppercase tracking-widest">¡SERVICIO URGENTE!</span> <span class="font-black text-sm uppercase tracking-widest">Prioridad Máxima</span>
</div> </div>
<div class="grid grid-cols-2 gap-3"> <div class="grid grid-cols-2 gap-3">
<button onclick="quickUpdate('camino')" class="bg-indigo-600 text-white font-black p-5 rounded-3xl flex flex-col items-center gap-2 shadow-lg shadow-indigo-200 active:scale-95 transition-transform"> <button onclick="quickUpdate('camino')" class="bg-white border border-slate-200 text-blue-900 font-black p-5 rounded-3xl flex flex-col items-center gap-2 shadow-sm active:bg-slate-50 transition-all">
<i data-lucide="car" class="w-8 h-8"></i> <i data-lucide="car" class="w-8 h-8 text-blue-800"></i>
<span class="text-[10px] uppercase tracking-widest">De Camino</span> <span class="text-[10px] uppercase tracking-widest">De Camino</span>
</button> </button>
<button onclick="quickUpdate('trabajando')" class="bg-amber-500 text-white font-black p-5 rounded-3xl flex flex-col items-center gap-2 shadow-lg shadow-amber-200 active:scale-95 transition-transform"> <button onclick="quickUpdate('trabajando')" class="bg-white border border-slate-200 text-blue-900 font-black p-5 rounded-3xl flex flex-col items-center gap-2 shadow-sm active:bg-slate-50 transition-all">
<i data-lucide="wrench" class="w-8 h-8"></i> <i data-lucide="wrench" class="w-8 h-8 text-blue-800"></i>
<span class="text-[10px] uppercase tracking-widest">He Llegado</span> <span class="text-[10px] uppercase tracking-widest">He Llegado</span>
</button> </button>
</div> </div>
<div class="bg-white p-6 rounded-[2.5rem] shadow-sm border border-slate-200"> <div class="bg-white p-6 rounded-[2.5rem] shadow-sm border border-slate-200">
<div class="flex justify-between items-start mb-1"> <div class="flex justify-between items-start mb-1">
<p class="text-[9px] font-black text-blue-600 uppercase tracking-widest" id="detCompany">Compañía</p> <p class="text-[9px] font-black text-blue-800 uppercase tracking-widest" id="detCompany">Compañía</p>
<span id="detRef" class="text-[9px] font-black text-slate-400 uppercase"></span> <span id="detRef" class="text-[9px] font-black text-slate-400 uppercase"></span>
</div> </div>
<h2 id="detName" class="text-2xl font-black text-slate-900 uppercase leading-none mb-6">Nombre Cliente</h2> <h2 id="detName" class="text-2xl font-black text-slate-900 uppercase leading-none mb-6">Nombre Cliente</h2>
<button onclick="callClient()" class="w-full bg-blue-600 text-white font-black py-4 rounded-2xl shadow-xl shadow-blue-200 flex items-center justify-center gap-3 uppercase text-sm tracking-widest active:scale-95 transition-all"> <button onclick="callClient()" class="w-full bg-blue-900 text-white font-black py-4 rounded-2xl shadow-xl flex items-center justify-center gap-3 uppercase text-sm tracking-widest active:scale-95 transition-all">
<i data-lucide="phone" class="w-5 h-5 fill-current"></i> Llamar al Cliente <i data-lucide="phone" class="w-5 h-5 fill-current text-blue-400"></i> Llamar al Cliente
</button> </button>
<button onclick="openWhatsApp()" class="w-full mt-3 bg-emerald-50 text-emerald-700 font-black py-3 rounded-2xl border border-emerald-100 flex items-center justify-center gap-2 text-xs uppercase tracking-widest active:scale-95 transition-all"> <button onclick="openWhatsApp()" class="w-full mt-3 bg-slate-50 text-slate-700 font-black py-3 rounded-2xl border border-slate-200 flex items-center justify-center gap-2 text-xs uppercase tracking-widest active:scale-95">
<i data-lucide="message-circle" class="w-4 h-4"></i> Abrir WhatsApp <i data-lucide="message-circle" class="w-4 h-4 text-emerald-500"></i> WhatsApp
</button> </button>
</div> </div>
<div class="bg-slate-900 text-white p-6 rounded-[2.5rem] shadow-2xl relative overflow-hidden"> <div class="bg-white p-6 rounded-[2.5rem] shadow-sm border border-slate-200 relative overflow-hidden">
<i data-lucide="map" class="absolute -right-6 -bottom-6 w-40 h-40 text-white/5 pointer-events-none"></i>
<p class="text-[10px] font-black text-slate-400 uppercase tracking-widest mb-2">Ubicación</p> <p class="text-[10px] font-black text-slate-400 uppercase tracking-widest mb-2">Ubicación</p>
<p id="detAddress" class="text-base font-bold uppercase leading-tight mb-6">Dirección Completa...</p> <p id="detAddress" class="text-base font-bold text-slate-900 uppercase leading-tight mb-6"></p>
<div class="flex items-center justify-between bg-white/10 p-4 rounded-2xl backdrop-blur-md"> <div class="flex items-center justify-between bg-slate-50 p-4 rounded-2xl border border-slate-100">
<div id="gpsLoading" class="text-xs font-bold text-slate-300 flex items-center gap-2"><i data-lucide="loader-2" class="w-3 h-3 animate-spin"></i> Calculando...</div> <div id="gpsLoading" class="text-xs font-bold text-slate-400 flex items-center gap-2"><i data-lucide="loader-2" class="w-3 h-3 animate-spin"></i> GPS...</div>
<div id="gpsResult" class="hidden flex gap-4"> <div id="gpsResult" class="hidden flex gap-4 text-slate-900">
<div class="text-center"><p class="text-xl font-black leading-none" id="gpsMins">--</p><p class="text-[8px] font-bold text-slate-400 uppercase">min</p></div> <div class="text-center"><p class="text-xl font-black leading-none" id="gpsMins">--</p><p class="text-[8px] font-bold text-slate-400 uppercase">min</p></div>
<div class="w-px h-6 bg-white/20"></div> <div class="w-px h-6 bg-slate-200"></div>
<div class="text-center"><p class="text-xl font-black leading-none" id="gpsKm">--</p><p class="text-[8px] font-bold text-slate-400 uppercase">km</p></div> <div class="text-center"><p class="text-xl font-black leading-none" id="gpsKm">--</p><p class="text-[8px] font-bold text-slate-400 uppercase">km</p></div>
</div> </div>
<button onclick="openMaps()" class="bg-white text-slate-900 px-4 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest shadow-lg active:scale-90 transition-transform">Ver Mapa</button> <button onclick="openMaps()" class="bg-blue-900 text-white px-4 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest shadow-md active:scale-90 transition-transform">Ver Mapa</button>
</div> </div>
</div> </div>
<div class="bg-amber-50 border border-amber-200 p-6 rounded-[2.5rem]"> <div class="desc-box">
<p class="text-[10px] font-black text-amber-700 uppercase tracking-widest mb-3 flex items-center gap-2"><i data-lucide="file-text" class="w-4 h-4"></i> Notas del Servicio</p> <p class="text-[10px] font-black text-blue-900 uppercase tracking-widest mb-3 flex items-center gap-2"><i data-lucide="file-text" class="w-4 h-4"></i> Descripción Técnica</p>
<div id="detDesc" class="text-sm font-bold text-slate-700 leading-relaxed max-h-60 overflow-y-auto no-scrollbar">--</div> <div id="detDesc" class="text-sm font-bold text-slate-600 leading-relaxed max-h-60 overflow-y-auto no-scrollbar">--</div>
</div> </div>
<div class="bg-slate-50 border border-slate-200 rounded-3xl overflow-hidden"> <div class="bg-white border border-slate-200 rounded-3xl overflow-hidden shadow-sm">
<button onclick="document.getElementById('extraDataBox').classList.toggle('hidden')" class="w-full p-4 flex justify-between items-center text-[10px] font-black text-slate-500 uppercase tracking-widest"> <button onclick="document.getElementById('extraDataBox').classList.toggle('hidden')" class="w-full p-4 flex justify-between items-center text-[10px] font-black text-slate-500 uppercase tracking-widest bg-slate-50">
<span>Ficha Completa de la Compañía</span> <span>Ficha técnica completa</span>
<i data-lucide="chevron-right" class="w-4 h-4"></i> <i data-lucide="chevron-right" class="w-4 h-4"></i>
</button> </button>
<div id="extraDataBox" class="hidden p-5 space-y-3 bg-white border-t border-slate-100" id="detExtraInfo"> <div id="extraDataBox" class="hidden p-5 space-y-3 bg-white border-t border-slate-100" id="detExtraInfo">
@@ -144,10 +146,10 @@
</div> </div>
<div class="pt-4"> <div class="pt-4">
<button onclick="quickUpdate('finalizado')" class="w-full bg-emerald-500 text-white font-black py-5 rounded-[2rem] shadow-xl shadow-emerald-100 flex items-center justify-center gap-3 uppercase text-sm tracking-widest active:scale-95 transition-all"> <button onclick="quickUpdate('finalizado')" class="w-full bg-emerald-600 text-white font-black py-5 rounded-[2rem] shadow-xl flex items-center justify-center gap-3 uppercase text-sm tracking-widest active:scale-95 transition-all">
<i data-lucide="check-circle" class="w-6 h-6"></i> Finalizar y Cerrar <i data-lucide="check-circle" class="w-6 h-6"></i> Finalizar Trabajo
</button> </button>
<p class="text-center text-[9px] font-bold text-slate-400 mt-4 uppercase tracking-widest">IntegraRepara Mobile v2.0</p> <p class="text-center text-[9px] font-bold text-slate-400 mt-6 uppercase tracking-widest">IntegraRepara Mobile</p>
</div> </div>
</div> </div>
</div> </div>
@@ -229,7 +231,7 @@
<button onclick="selectDate('${isoDate}')" class="day-card ${isSelected ? 'day-active' : 'day-inactive'} border min-w-[4.2rem] rounded-2xl p-4 flex flex-col items-center justify-center shrink-0"> <button onclick="selectDate('${isoDate}')" class="day-card ${isSelected ? 'day-active' : 'day-inactive'} border min-w-[4.2rem] rounded-2xl p-4 flex flex-col items-center justify-center shrink-0">
<span class="text-[9px] font-black uppercase opacity-70">${dayName}</span> <span class="text-[9px] font-black uppercase opacity-70">${dayName}</span>
<span class="text-xl font-black mt-1">${dayNum}</span> <span class="text-xl font-black mt-1">${dayNum}</span>
<div class="mt-2 w-full flex justify-center h-1.5"><span id="badge-${isoDate}" class="bg-rose-500 w-1.5 h-1.5 rounded-full hidden"></span></div> <div class="mt-2 w-full flex justify-center h-1.5"><span id="badge-${isoDate}" class="bg-blue-400 w-1.5 h-1.5 rounded-full hidden"></span></div>
</button>`; </button>`;
} }
updateBadges(); updateBadges();
@@ -309,7 +311,7 @@
const raw = s.raw_data || {}; const raw = s.raw_data || {};
const time = raw.scheduled_time || "--:--"; const time = raw.scheduled_time || "--:--";
if (s.provider === 'SYSTEM_BLOCK') { if (s.provider === 'SYSTEM_BLOCK') {
return `<div class="bg-rose-50/80 p-5 rounded-3xl border border-rose-100 flex gap-4"><div class="flex flex-col items-center justify-center border-r border-rose-200 pr-4 shrink-0"><i data-lucide="lock" class="w-5 h-5 text-rose-500"></i><span class="font-black text-rose-800 text-sm mt-1">${time}</span></div><div class="min-w-0 flex-1"><h3 class="font-black text-rose-800 text-sm uppercase">BLOQUEADO</h3><p class="text-[10px] font-bold text-rose-400 mt-1 uppercase">${raw["Descripción"] || ""}</p></div></div>`; return `<div class="bg-blue-50/50 p-5 rounded-3xl border border-slate-200 flex gap-4"><div class="flex flex-col items-center justify-center border-r border-slate-200 pr-4 shrink-0"><i data-lucide="lock" class="w-5 h-5 text-blue-900"></i><span class="font-black text-blue-900 text-sm mt-1">${time}</span></div><div class="min-w-0 flex-1"><h3 class="font-black text-blue-900 text-sm uppercase">BLOQUEADO</h3><p class="text-[10px] font-bold text-slate-400 mt-1 uppercase">${raw["Descripción"] || ""}</p></div></div>`;
} }
const name = raw["Nombre Cliente"] || raw["CLIENTE"] || "Asegurado"; const name = raw["Nombre Cliente"] || raw["CLIENTE"] || "Asegurado";
@@ -319,14 +321,14 @@
return ` return `
<div onclick="openService(${s.id})" class="bg-white p-6 rounded-[2.5rem] border border-slate-200 shadow-sm active:scale-95 transition-transform flex gap-4 relative overflow-hidden"> <div onclick="openService(${s.id})" class="bg-white p-6 rounded-[2.5rem] border border-slate-200 shadow-sm active:scale-95 transition-transform flex gap-4 relative overflow-hidden">
${s.is_urgent ? '<div class="absolute top-0 right-0 bg-rose-600 text-white text-[8px] font-black px-3 py-1.5 rounded-bl-xl uppercase tracking-widest z-10">Urgente</div>' : ''} ${s.is_urgent ? '<div class="absolute top-0 right-0 bg-blue-900 text-white text-[8px] font-black px-3 py-1.5 rounded-bl-xl uppercase tracking-widest z-10">Urgente</div>' : ''}
<div class="flex flex-col items-center justify-center border-r border-slate-100 pr-4 shrink-0 min-w-[70px]"> <div class="flex flex-col items-center justify-center border-r border-slate-100 pr-4 shrink-0 min-w-[70px]">
<i data-lucide="clock" class="w-6 h-6 text-blue-500 mb-1"></i> <i data-lucide="clock" class="w-6 h-6 text-blue-900 mb-1"></i>
<span class="font-black text-slate-900 text-base">${time}</span> <span class="font-black text-slate-900 text-base">${time}</span>
</div> </div>
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<div class="flex flex-wrap gap-1.5 mb-2"> <div class="flex flex-wrap gap-1.5 mb-2">
<span class="text-[8px] font-black bg-blue-50 text-blue-600 px-2 py-0.5 rounded uppercase border border-blue-100">${compShort}</span> <span class="text-[8px] font-black bg-blue-50 text-blue-900 px-2 py-0.5 rounded uppercase border border-blue-100">${compShort}</span>
<span class="text-[8px] font-black bg-slate-100 text-slate-500 px-2 py-0.5 rounded uppercase border border-slate-200">${guildObj ? guildObj.name : 'Reparación'}</span> <span class="text-[8px] font-black bg-slate-100 text-slate-500 px-2 py-0.5 rounded uppercase border border-slate-200">${guildObj ? guildObj.name : 'Reparación'}</span>
</div> </div>
<h3 class="font-black text-slate-800 text-sm uppercase leading-tight truncate">${name}</h3> <h3 class="font-black text-slate-800 text-sm uppercase leading-tight truncate">${name}</h3>
@@ -369,11 +371,8 @@
for(let key in raw) { for(let key in raw) {
if(skipKeys.includes(key)) continue; if(skipKeys.includes(key)) continue;
let val = raw[key]; let valStr = String(raw[key] || "");
// ARREGLO TYPEERROR: Verificamos si val es string antes del trim
let valStr = String(val || "");
if(valStr.trim() === "") continue; if(valStr.trim() === "") continue;
detailsHtml += `<div class="border-b border-slate-100 pb-2 mb-2 last:border-0 flex flex-col gap-0.5"><span class="text-[8px] font-black text-slate-400 uppercase tracking-widest">${key}</span><span class="text-[11px] font-bold text-slate-700 break-words">${valStr}</span></div>`; detailsHtml += `<div class="border-b border-slate-100 pb-2 mb-2 last:border-0 flex flex-col gap-0.5"><span class="text-[8px] font-black text-slate-400 uppercase tracking-widest">${key}</span><span class="text-[11px] font-bold text-slate-700 break-words">${valStr}</span></div>`;
} }
extraContainer.innerHTML = detailsHtml || '<p class="text-xs text-slate-400">Sin datos adicionales.</p>'; extraContainer.innerHTML = detailsHtml || '<p class="text-xs text-slate-400">Sin datos adicionales.</p>';
@@ -388,8 +387,6 @@
const modal = document.getElementById('serviceModal'); const modal = document.getElementById('serviceModal');
modal.classList.add('translate-y-full'); modal.classList.add('translate-y-full');
setTimeout(() => modal.style.display = 'none', 300); 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"); } 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'); } function openMaps() { const a = document.getElementById('detAddress').innerText; if (a) window.open(`maps://?q=${encodeURIComponent(a)}`, '_blank'); }
async function calculateDistance(dest) { async function calculateDistance(dest) {
if(!navigator.geolocation) { showGpsError("No GPS"); return; } if(!navigator.geolocation) return;
navigator.geolocation.getCurrentPosition(async (pos) => { navigator.geolocation.getCurrentPosition(async (pos) => {
const lat = pos.coords.latitude; const lon = pos.coords.longitude; const lat = pos.coords.latitude; const lon = pos.coords.longitude;
try { try {
@@ -412,12 +409,10 @@
document.getElementById('gpsResult').classList.remove('hidden'); document.getElementById('gpsResult').classList.remove('hidden');
document.getElementById('gpsKm').innerText = km.toFixed(1); document.getElementById('gpsKm').innerText = km.toFixed(1);
document.getElementById('gpsMins').innerText = Math.round((km/35)*60)+5; 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 = `<span class="text-rose-400 font-bold">${m}</span>`; } });
}
async function quickUpdate(action) { async function quickUpdate(action) {
if(!currentServiceId) return; if(!currentServiceId) return;
@@ -436,7 +431,7 @@
method: 'PUT', headers: { "Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}` }, method: 'PUT', headers: { "Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}` },
body: JSON.stringify({ status_operativo: st.id }) 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"); } } catch (e) { alert("Error"); }
} }