document.addEventListener('DOMContentLoaded', () => { const toastEl = document.getElementById('liveToast'); if (toastEl) { const toast = new bootstrap.Toast(toastEl); if (toastEl.dataset.autoshow === '1') { toast.show(); } } const roleSelect = document.getElementById('roleSelect'); if (roleSelect) { roleSelect.addEventListener('change', () => { const role = roleSelect.value; const url = new URL(window.location.href); url.searchParams.set('role', role); window.location.href = url.toString(); }); } const searchInput = document.getElementById('studentSearch'); const tableRows = document.querySelectorAll('[data-student-row]'); if (searchInput) { searchInput.addEventListener('input', () => { const query = searchInput.value.toLowerCase(); tableRows.forEach((row) => { const hay = row.dataset.studentRow || ''; row.style.display = hay.includes(query) ? '' : 'none'; }); }); } });