This commit is contained in:
KONE SOREL 2026-01-12 14:35:36 +00:00
parent 9ca80dc507
commit f600f8f6f6

View File

@ -128,36 +128,30 @@
</div>
</div>
<!-- ======================================================= -->
<!-- CHARGEMENT DES LIBRAIRIES GRAPHIQUES ET PDF ICI -->
<!-- Pour éviter de les recharger à chaque appel Ajax -->
<!-- ======================================================= -->
<script>
document.addEventListener('DOMContentLoaded', function() {
const collapses = document.querySelectorAll('.accordion-collapse');
collapses.forEach(collapse => {
// Quand une section s'ouvre
collapse.addEventListener('show.bs.collapse', function () {
const fnName = this.dataset.openFn;
if (fnName && typeof window[fnName] === 'function') {
window[fnName]();
}
// Changer licône en chevron-up
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"] .accordion-icon');
if (headerBtn) headerBtn.classList.replace('bi-chevron-down', 'bi-chevron-up');
// Trouver le bouton lié à ce collapse
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"]');
const icon = headerBtn?.querySelector('.accordion-icon');
if (icon) icon.classList.replace('bi-chevron-down', 'bi-chevron-up');
});
// Quand une section se ferme
collapse.addEventListener('hide.bs.collapse', function () {
const fnName = this.dataset.closeFn;
if (fnName && typeof window[fnName] === 'function') {
window[fnName]();
}
// Remettre licône en chevron-down
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"] .accordion-icon');
if (headerBtn) headerBtn.classList.replace('bi-chevron-up', 'bi-chevron-down');
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"]');
const icon = headerBtn?.querySelector('.accordion-icon');
if (icon) icon.classList.replace('bi-chevron-up', 'bi-chevron-down');
});
});
});