File size: 1,865 Bytes
1435fb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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}`);
        });
    });
});