Actualizar calendario.html
This commit is contained in:
@@ -7,7 +7,14 @@
|
|||||||
<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: #f8fafc; -webkit-tap-highlight-color: transparent; }
|
/* VARIABLES DINÁMICAS: Se actualizarán por JS desde la base de datos */
|
||||||
|
:root {
|
||||||
|
--primary: #1e3a8a;
|
||||||
|
--secondary: #2563eb;
|
||||||
|
--app-bg: #f8fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
body { background-color: var(--app-bg); -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,11 +22,24 @@
|
|||||||
|
|
||||||
.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: #1e3a8a; color: white; border-color: #1e3a8a; transform: scale(1.05); box-shadow: 0 10px 15px -3px rgba(30,58,138,0.3); }
|
|
||||||
|
/* Uso de variables para los estados activos */
|
||||||
|
.day-active {
|
||||||
|
background-color: var(--primary) !important;
|
||||||
|
color: white !important;
|
||||||
|
border-color: var(--primary) !important;
|
||||||
|
transform: scale(1.05);
|
||||||
|
box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
.day-inactive { background-color: white; color: #64748b; border-color: #e2e8f0; }
|
.day-inactive { background-color: white; color: #64748b; border-color: #e2e8f0; }
|
||||||
|
|
||||||
|
/* Ajustes de color dinámicos para botones y cabeceras */
|
||||||
|
.bg-primary-dynamic { background-color: var(--primary) !important; }
|
||||||
|
.text-primary-dynamic { color: var(--primary) !important; }
|
||||||
|
.border-primary-dynamic { border-color: var(--primary) !important; }
|
||||||
|
|
||||||
/* Scroll del Modal */
|
/* Scroll del Modal */
|
||||||
#serviceModal { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; background: #f1f5f9; }
|
#serviceModal { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; background: var(--app-bg); }
|
||||||
.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 */
|
/* Caja de descripción sobria */
|
||||||
@@ -34,7 +54,7 @@
|
|||||||
<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-800 uppercase tracking-widest mb-0.5 truncate" id="monthYearDisplay">Cargando...</p>
|
<p class="text-[10px] font-black text-primary-dynamic uppercase tracking-widest mb-0.5 truncate" id="monthYearDisplay">Cargando...</p>
|
||||||
<h1 class="text-xl font-black tracking-tight text-slate-900 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">
|
||||||
@@ -47,7 +67,7 @@
|
|||||||
|
|
||||||
<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-900 mb-2"></i>
|
<i data-lucide="loader-2" class="w-8 h-8 animate-spin mx-auto text-primary-dynamic mb-2"></i>
|
||||||
<p class="text-xs font-bold uppercase tracking-widest text-slate-400">Consultando Base de 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>
|
||||||
@@ -56,11 +76,11 @@
|
|||||||
|
|
||||||
<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)]">
|
<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-900 w-20">
|
<a href="menu.html" class="flex flex-col items-center p-2 text-slate-400 hover:text-primary-dynamic 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-900 w-20">
|
<a href="calendario.html" class="flex flex-col items-center p-2 text-primary-dynamic 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>
|
||||||
@@ -85,31 +105,31 @@
|
|||||||
<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-blue-900 text-white p-4 rounded-3xl flex items-center justify-center gap-3 shadow-lg border-b-4 border-blue-700">
|
<div id="urgentBanner" class="hidden bg-primary-dynamic text-white p-4 rounded-3xl flex items-center justify-center gap-3 shadow-lg border-b-4 border-slate-700/30">
|
||||||
<i data-lucide="alert-circle" class="w-6 h-6 text-blue-400"></i>
|
<i data-lucide="alert-circle" class="w-6 h-6 text-white/80"></i>
|
||||||
<span class="font-black text-sm uppercase tracking-widest">Prioridad Máxima</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-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">
|
<button onclick="quickUpdate('camino')" class="bg-white border border-slate-200 text-primary-dynamic 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 text-blue-800"></i>
|
<i data-lucide="car" class="w-8 h-8"></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-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">
|
<button onclick="quickUpdate('trabajando')" class="bg-white border border-slate-200 text-primary-dynamic 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 text-blue-800"></i>
|
<i data-lucide="wrench" class="w-8 h-8"></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-800 uppercase tracking-widest" id="detCompany">Compañía</p>
|
<p class="text-[9px] font-black text-primary-dynamic 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-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">
|
<button onclick="callClient()" class="w-full bg-primary-dynamic 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 text-blue-400"></i> Llamar al Cliente
|
<i data-lucide="phone" class="w-5 h-5 fill-current"></i> Llamar al Cliente
|
||||||
</button>
|
</button>
|
||||||
<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">
|
<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 text-emerald-500"></i> WhatsApp
|
<i data-lucide="message-circle" class="w-4 h-4 text-emerald-500"></i> WhatsApp
|
||||||
@@ -127,19 +147,19 @@
|
|||||||
<div class="w-px h-6 bg-slate-200"></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-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>
|
<button onclick="openMaps()" class="bg-primary-dynamic 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="desc-box">
|
<div class="desc-box">
|
||||||
<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>
|
<p class="text-[10px] font-black text-primary-dynamic 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-600 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-white border border-slate-200 rounded-3xl overflow-hidden shadow-sm">
|
<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 bg-slate-50">
|
<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 técnica completa</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 text-slate-400"></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">
|
||||||
</div>
|
</div>
|
||||||
@@ -170,6 +190,32 @@
|
|||||||
let currentWeekStart = new Date();
|
let currentWeekStart = new Date();
|
||||||
let selectedDateStr = "";
|
let selectedDateStr = "";
|
||||||
|
|
||||||
|
// --- SISTEMA DE TEMA DINÁMICO ---
|
||||||
|
async function applyTheme() {
|
||||||
|
try {
|
||||||
|
// 1. Intentar cargar desde caché para velocidad
|
||||||
|
let theme = JSON.parse(localStorage.getItem('app_theme'));
|
||||||
|
|
||||||
|
// 2. Consultar al servidor para asegurar actualización
|
||||||
|
const res = await fetch(`${API_URL}/config/company`, {
|
||||||
|
headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` }
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
if(data.ok && data.config && data.config.app_settings) {
|
||||||
|
theme = data.config.app_settings;
|
||||||
|
localStorage.setItem('app_theme', JSON.stringify(theme));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(theme) {
|
||||||
|
document.documentElement.style.setProperty('--primary', theme.primary);
|
||||||
|
document.documentElement.style.setProperty('--secondary', theme.secondary);
|
||||||
|
document.documentElement.style.setProperty('--app-bg', theme.bg);
|
||||||
|
console.log("🎨 Tema corporativo aplicado desde BD");
|
||||||
|
}
|
||||||
|
} catch (e) { console.warn("Error cargando tema dinámico, usando default"); }
|
||||||
|
}
|
||||||
|
|
||||||
function safeLoadIcons() {
|
function safeLoadIcons() {
|
||||||
try { if (typeof lucide !== 'undefined') lucide.createIcons(); }
|
try { if (typeof lucide !== 'undefined') lucide.createIcons(); }
|
||||||
catch(e) { }
|
catch(e) { }
|
||||||
@@ -196,6 +242,10 @@
|
|||||||
if (!localStorage.getItem("token") || localStorage.getItem("role") !== 'operario') {
|
if (!localStorage.getItem("token") || localStorage.getItem("role") !== 'operario') {
|
||||||
window.location.href = "index.html"; return;
|
window.location.href = "index.html"; return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aplicar colores antes de renderizar nada
|
||||||
|
await applyTheme();
|
||||||
|
|
||||||
safeLoadIcons();
|
safeLoadIcons();
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
currentWeekStart = getMonday(today);
|
currentWeekStart = getMonday(today);
|
||||||
@@ -311,7 +361,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-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>`;
|
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-primary-dynamic"></i><span class="font-black text-primary-dynamic text-sm mt-1">${time}</span></div><div class="min-w-0 flex-1"><h3 class="font-black text-primary-dynamic 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";
|
||||||
@@ -321,14 +371,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-blue-900 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-primary-dynamic 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-900 mb-1"></i>
|
<i data-lucide="clock" class="w-6 h-6 text-primary-dynamic 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-900 px-2 py-0.5 rounded uppercase border border-blue-100">${compShort}</span>
|
<span class="text-[8px] font-black bg-blue-50 text-primary-dynamic 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>
|
||||||
|
|||||||
Reference in New Issue
Block a user