Actualizar asignados.html
This commit is contained in:
@@ -246,7 +246,7 @@
|
|||||||
let pickerSelectedDate = "";
|
let pickerSelectedDate = "";
|
||||||
let pickerSelectedTime = "";
|
let pickerSelectedTime = "";
|
||||||
|
|
||||||
// --- SISTEMA DE TEMA DINÁMICO CORREGIDO ---
|
// --- SISTEMA DE TEMA DINÁMICO (VERSIÓN TODOTERRENO) ---
|
||||||
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 +256,25 @@
|
|||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (data.ok && data.config) {
|
if (data.ok && data.config) {
|
||||||
// 1. Extraemos los horarios (Están dentro de portal_settings)
|
// 1. Procesamos los horarios
|
||||||
if (data.config.portal_settings) {
|
const ps = typeof data.config.portal_settings === 'string' ? JSON.parse(data.config.portal_settings) : (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(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)
|
// 2. Cazamos los colores (vengan como vengan)
|
||||||
if (data.config.app_settings) {
|
let newTheme = data.config.app_settings || ps.app_settings;
|
||||||
theme = data.config.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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(theme) {
|
// 3. Pintamos la app
|
||||||
|
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);
|
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 () => {
|
document.addEventListener("DOMContentLoaded", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user