Actualizar asignados.html

This commit is contained in:
2026-03-17 22:34:34 +00:00
parent e844a2c0f4
commit bbd4295455

View File

@@ -246,7 +246,7 @@
let pickerSelectedDate = "";
let pickerSelectedTime = "";
// --- SISTEMA DE TEMA DINÁMICO CORREGIDO ---
// --- SISTEMA DE TEMA DINÁMICO (VERSIÓN TODOTERRENO) ---
async function applyTheme() {
try {
let theme = JSON.parse(localStorage.getItem('app_theme'));
@@ -255,26 +255,26 @@
});
const data = await res.json();
if(data.ok && data.config) {
// 1. Extraemos los horarios (Están dentro de portal_settings)
if (data.config.portal_settings) {
const ps = 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 };
}
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. Extraemos los colores (Están FUERA, en su propia columna app_settings)
if (data.config.app_settings) {
theme = 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));
}
}
if(theme) {
// 3. Pintamos la app
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);
document.documentElement.style.setProperty('--app-bg', theme.bg || '#f4f7f9');
}
} catch (e) { console.warn("Usando tema por defecto"); }
} catch (e) { console.warn("Usando tema por defecto", e); }
}
document.addEventListener("DOMContentLoaded", async () => {