diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index b19badf..cbc7e03 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -109,5 +109,24 @@ }); } }); + /* ─── EIBS: allow only one open panel ─── */ + const allCollapses = document.querySelectorAll('.collapse'); + + allCollapses.forEach(function (panel) { + /* When any panel STARTS to open… */ + panel.addEventListener('show.bs.collapse', function () { + + /* …loop through every other panel… */ + allCollapses.forEach(function (openPanel) { + if (openPanel !== panel && openPanel.classList.contains('show')) { + /* …and close it. */ + /* If Bootstrap already has an instance → use it, otherwise create one on the fly */ + (bootstrap.Collapse.getInstance(openPanel) || + new bootstrap.Collapse(openPanel)) + .hide(); + } + }); + }); + }); }); - \ No newline at end of file +