fix missing school year pages
Tests / PHPUnit (push) Failing after 42s

This commit is contained in:
root
2026-07-12 19:09:38 -04:00
parent e06ccc9cc0
commit 55f8027550
14 changed files with 471 additions and 113 deletions
+19 -7
View File
@@ -305,6 +305,23 @@
const normalize = s => (s||'').toString().toLowerCase();
const debounce = (fn, wait=200) => { let t; return (...args)=>{ clearTimeout(t); t=setTimeout(()=>fn(...args), wait); }; };
const openFamilyResult = (type, id) => {
const params = {};
if (type === 'student') {
params.student_id = id;
} else if (type === 'guardian') {
params.guardian_id = id;
}
if (Object.keys(params).length && typeof window.openFamilyCard === 'function') {
window.openFamilyCard(params);
return;
}
if (type === 'student') {
window.location.href = '<?= site_url('family') ?>' + '?student_id=' + encodeURIComponent(id);
} else if (type === 'guardian') {
window.location.href = '<?= site_url('family') ?>' + '?guardian_id=' + encodeURIComponent(id);
}
};
// Preloaded datasets for suggestions (students + guardians)
const STATIC_ITEMS = [
@@ -368,12 +385,7 @@
btn.className = 'list-group-item list-group-item-action';
btn.innerHTML = `<div class="d-flex justify-content-between"><span>${(it.label||'').replace(/</g,'&lt;')}</span><span class="text-muted small">${(it.sub||'').replace(/</g,'&lt;')}</span></div>`;
btn.addEventListener('click', () => {
// Redirect to show only the selected family
if (it.type === 'student') {
window.location.href = '<?= site_url('family') ?>' + '?student_id=' + encodeURIComponent(it.id);
} else if (it.type === 'guardian') {
window.location.href = '<?= site_url('family') ?>' + '?guardian_id=' + encodeURIComponent(it.id);
}
openFamilyResult(it.type, it.id);
});
suggest.appendChild(btn);
});
@@ -455,7 +467,7 @@
}
if (best) {
e.preventDefault();
window.location.href = '<?= site_url('family') ?>' + '?student_id=' + encodeURIComponent(best.value);
openFamilyResult('student', best.value);
}
});
// Hide suggestions on outside click