diff --git a/assets/js/main.js b/assets/js/main.js index 7641da0..e5a0915 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -3424,7 +3424,7 @@ document.addEventListener('DOMContentLoaded', () => { const resp = await fetch('api_v1_events.php', { method: 'POST', body: formData }); const result = await resp.json(); if (result.success) { - deleteBtn.closest('.col-12').remove(); + location.reload(); } else { alert(result.error || 'Erreur lors de la suppression'); } diff --git a/index.php b/index.php index 84d4afe..1470727 100644 --- a/index.php +++ b/index.php @@ -198,7 +198,7 @@ if ($is_dm_view) { $active_server_id = $_GET['server_id'] ?? ($servers[0]['id'] ?? 1); // Fetch channels - $stmt = db()->prepare("SELECT * FROM channels WHERE server_id = ? ORDER BY position ASC, id ASC"); + $stmt = db()->prepare("SELECT c.*, (SELECT COUNT(*) FROM channel_events e WHERE e.channel_id = c.id AND (e.is_permanent = 1 OR CONCAT(e.end_date, ' ', e.end_time) >= NOW())) as event_count FROM channels c WHERE c.server_id = ? ORDER BY c.position ASC, c.id ASC"); $stmt->execute([$active_server_id]); $all_channels = $stmt->fetchAll(); @@ -349,7 +349,14 @@ if ($is_dm_view) { } $current_channel_name = 'general'; - foreach($channels as $c) if($c['id'] == $active_channel_id) $current_channel_name = $c['name']; + foreach($channels as $c) { + if($c['id'] == $active_channel_id) { + $current_channel_name = $c['name']; + if ($c['type'] === 'event' && !empty($c['event_count'])) { + $current_channel_name .= " (" . $c['event_count'] . ")"; + } + } + } // Fetch voice sessions for the sidebar $stmt_vs = db()->prepare(" @@ -602,7 +609,12 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; - + + + + () + +