Flatlogic Bot 463712fc0c SMS
2026-03-07 09:22:35 +00:00

32 lines
1.1 KiB
JavaScript

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';
});
});
}
});