document.addEventListener('DOMContentLoaded', function() { // Toggle user details document.querySelectorAll('h2').forEach(header => { header.addEventListener('click', function() { const details = this.parentElement.nextElementSibling; details.classList.toggle('active'); // Rotate icon if exists const icon = this.querySelector('i'); if (icon) { if (details.classList.contains('active')) { icon.style.transform = 'rotate(180deg)'; } else { icon.style.transform = 'rotate(0deg)'; } } }); }); // Action buttons functionality document.querySelectorAll('.action-ban').forEach(btn => { btn.addEventListener('click', function(e) { e.stopPropagation(); const username = this.closest('.flex').previousElementSibling.textContent; if (confirm(`Êtes-vous sûr de vouloir bannir ${username} ?`)) { alert(`${username} a été banni.`); } }); }); document.querySelectorAll('.action-suspend').forEach(btn => { btn.addEventListener('click', function(e) { e.stopPropagation(); const username = this.closest('.flex').previousElementSibling.textContent; if (confirm(`Êtes-vous sûr de vouloir suspendre ${username} ?`)) { alert(`${username} a été suspendu.`); } }); }); document.querySelectorAll('.action-view').forEach(btn => { btn.addEventListener('click', function(e) { e.stopPropagation(); const username = this.closest('.flex').previousElementSibling.textContent; alert(`Ouverture des messages privés de ${username}`); }); }); });