diff --git a/asignados.html b/asignados.html
index 6e6b013..21f0043 100644
--- a/asignados.html
+++ b/asignados.html
@@ -247,6 +247,7 @@
let pickerSelectedTime = "";
// --- SISTEMA DE TEMA DINÁMICO (VERSIÓN TODOTERRENO DEFINITIVA) ---
+ // --- SISTEMA DE TEMA DINÁMICO (EL BUENO) ---
async function applyTheme() {
try {
let theme = JSON.parse(localStorage.getItem('app_theme'));
@@ -256,25 +257,19 @@
const data = await res.json();
if (data.ok && data.config) {
- // 1. Procesamos los horarios
- const ps = typeof data.config.portal_settings === 'string' ? JSON.parse(data.config.portal_settings) : (data.config.portal_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 };
-
- // 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;
+ // Aquí le enseñamos a la app a mirar en app_settings
+ if (data.config.app_settings) {
+ theme = typeof data.config.app_settings === 'string' ? JSON.parse(data.config.app_settings) : data.config.app_settings;
localStorage.setItem('app_theme', JSON.stringify(theme));
}
}
- // 3. Pintamos la app corporativa
if(theme && theme.primary) {
document.documentElement.style.setProperty('--primary', theme.primary);
document.documentElement.style.setProperty('--secondary', theme.secondary);
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 () => {