Actualizar asignados.html

This commit is contained in:
2026-03-17 22:59:25 +00:00
parent 9e76c5f57c
commit c07c0918e1

View File

@@ -247,6 +247,7 @@
let pickerSelectedTime = ""; let pickerSelectedTime = "";
// --- SISTEMA DE TEMA DINÁMICO (VERSIÓN TODOTERRENO DEFINITIVA) --- // --- SISTEMA DE TEMA DINÁMICO (VERSIÓN TODOTERRENO DEFINITIVA) ---
// --- SISTEMA DE TEMA DINÁMICO (EL BUENO) ---
async function applyTheme() { async function applyTheme() {
try { try {
let theme = JSON.parse(localStorage.getItem('app_theme')); let theme = JSON.parse(localStorage.getItem('app_theme'));
@@ -256,25 +257,19 @@
const data = await res.json(); const data = await res.json();
if (data.ok && data.config) { if (data.ok && data.config) {
// 1. Procesamos los horarios // Aquí le enseñamos a la app a mirar en app_settings
const ps = typeof data.config.portal_settings === 'string' ? JSON.parse(data.config.portal_settings) : (data.config.portal_settings || {}); if (data.config.app_settings) {
if(ps.m_start) bizHours = { m_start: ps.m_start, m_end: ps.m_end, a_start: ps.a_start, a_end: ps.a_end }; theme = typeof data.config.app_settings === 'string' ? JSON.parse(data.config.app_settings) : data.config.app_settings;
// 2. Cazamos los colores (vengan como vengan)
let newTheme = data.config.app_settings || ps.app_settings;
if(newTheme) {
theme = typeof newTheme === 'string' ? JSON.parse(newTheme) : newTheme;
localStorage.setItem('app_theme', JSON.stringify(theme)); localStorage.setItem('app_theme', JSON.stringify(theme));
} }
} }
// 3. Pintamos la app corporativa
if(theme && theme.primary) { if(theme && theme.primary) {
document.documentElement.style.setProperty('--primary', theme.primary); document.documentElement.style.setProperty('--primary', theme.primary);
document.documentElement.style.setProperty('--secondary', theme.secondary); document.documentElement.style.setProperty('--secondary', theme.secondary);
document.documentElement.style.setProperty('--app-bg', theme.bg || '#f4f7f9'); document.documentElement.style.setProperty('--app-bg', theme.bg || '#f4f7f9');
} }
} catch (e) { console.warn("Usando tema por defecto", e); } } catch (e) { console.warn("Usando tema por defecto"); }
} }
document.addEventListener("DOMContentLoaded", async () => { document.addEventListener("DOMContentLoaded", async () => {