Fix SITES tab: check for modal before getElementById on missing pane

This commit is contained in:
2026-05-29 19:34:52 +00:00
parent 0f82fb9e85
commit 0f7106a80d
+3 -2
View File
@@ -1507,14 +1507,15 @@ async function loadNews() {
// ── TABS ────────────────────────────────────────────────────────────── // ── TABS ──────────────────────────────────────────────────────────────
function switchTab(name) { function switchTab(name) {
if (name === 'sites') { openSitesModal(); return; }
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active')); document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
document.querySelectorAll('.tab-pane').forEach(p => p.classList.remove('active')); document.querySelectorAll('.tab-pane').forEach(p => p.classList.remove('active'));
event.target.classList.add('active'); event.target.classList.add('active');
document.getElementById('tab-'+name).classList.add('active'); const pane = document.getElementById('tab-'+name);
if (pane) pane.classList.add('active');
if (name === 'news') loadNews(); if (name === 'news') loadNews();
if (name === 'agents') loadAgents(); if (name === 'agents') loadAgents();
if (name === 'alerts') loadAlerts(); if (name === 'alerts') loadAlerts();
if (name === 'sites') { openSitesModal(); return; }
} }
// ── CHAT ────────────────────────────────────────────────────────────── // ── CHAT ──────────────────────────────────────────────────────────────