fix: tab state persists in url hash. Settings save nolonger reload the page. Scheduler management now cascades to individual events.

This commit is contained in:
serversdwn
2026-02-04 18:12:18 +00:00
parent f296806fd1
commit e515bff1a9
3 changed files with 59 additions and 7 deletions

View File

@@ -311,6 +311,7 @@
</div>
</div>
<div id="settings-success" class="hidden text-sm text-green-600 dark:text-green-400"></div>
<div id="settings-error" class="hidden text-sm text-red-600"></div>
<div class="flex justify-end gap-3 pt-2">
@@ -606,6 +607,9 @@ function switchTab(tabName) {
button.classList.remove('border-transparent', 'text-gray-600', 'dark:text-gray-400');
button.classList.add('border-seismo-orange', 'text-seismo-orange');
}
// Persist active tab in URL hash so refresh stays on this tab
history.replaceState(null, '', `#${tabName}`);
}
// Load project details
@@ -677,12 +681,20 @@ document.getElementById('project-settings-form').addEventListener('submit', asyn
throw new Error('Failed to update project');
}
// Reload page to show updated data
window.location.reload();
// Refresh header and dashboard without full page reload
refreshProjectDashboard();
// Show success feedback
const successEl = document.getElementById('settings-success');
successEl.textContent = 'Settings saved.';
successEl.classList.remove('hidden');
document.getElementById('settings-error').classList.add('hidden');
setTimeout(() => successEl.classList.add('hidden'), 3000);
} catch (err) {
const errorEl = document.getElementById('settings-error');
errorEl.textContent = err.message || 'Failed to update project.';
errorEl.classList.remove('hidden');
document.getElementById('settings-success').classList.add('hidden');
}
});
@@ -1251,9 +1263,16 @@ document.getElementById('schedule-modal')?.addEventListener('click', function(e)
}
});
// Load project details on page load
// Load project details on page load and restore active tab from URL hash
document.addEventListener('DOMContentLoaded', function() {
loadProjectDetails();
// Restore tab from URL hash (e.g. #schedules, #settings)
const hash = window.location.hash.replace('#', '');
const validTabs = ['overview', 'locations', 'units', 'schedules', 'sessions', 'data', 'settings'];
if (hash && validTabs.includes(hash)) {
switchTab(hash);
}
});
</script>
{% endblock %}