ajouts stats

This commit is contained in:
theShlavuk 2026-01-20 21:57:58 +01:00
parent 683b160804
commit b95ed600e9
2 changed files with 18 additions and 6 deletions

View File

@ -85,6 +85,12 @@ function collectFilters() {
filters.annee = parseInt(anneeInput.value, 10); filters.annee = parseInt(anneeInput.value, 10);
} }
// Statut
const statutSelect = document.getElementById('stats_statut');
if (statutSelect && statutSelect.value) {
filters.statut = statutSelect.value;
}
// Filtre permanence // Filtre permanence
const permanenceCheckbox = document.getElementById('stats_filtre_permanence'); const permanenceCheckbox = document.getElementById('stats_filtre_permanence');
if (permanenceCheckbox && permanenceCheckbox.checked) { if (permanenceCheckbox && permanenceCheckbox.checked) {
@ -160,7 +166,8 @@ async function loadEvents() {
// Afficher les résultats // Afficher les résultats
displayEvents(result.events || []); displayEvents(result.events || []);
updateCounters(result.total || 0, result.filtered || 0); // Afficher le nombre d'événements filtrés comme total, et le nombre d'événements sur la page courante comme affichés
updateCounters(result.filtered || 0, (result.events || []).length);
displayPagination(result.page || 1, result.total_pages || 0); displayPagination(result.page || 1, result.total_pages || 0);
// IMPORTANT: Masquer le loader EN PREMIER, puis afficher le tableau // IMPORTANT: Masquer le loader EN PREMIER, puis afficher le tableau

View File

@ -81,11 +81,16 @@
<label for="stats_annee" style="display: block; margin-bottom: 5px; font-weight: 500;"><?php esc_html_e('Année', 'esi_crvi_agenda'); ?></label> <label for="stats_annee" style="display: block; margin-bottom: 5px; font-weight: 500;"><?php esc_html_e('Année', 'esi_crvi_agenda'); ?></label>
<input type="number" id="stats_annee" name="annee" min="2000" max="2100" placeholder="<?php echo date('Y'); ?>" class="form-control" style="width: 100%;"> <input type="number" id="stats_annee" name="annee" min="2000" max="2100" placeholder="<?php echo date('Y'); ?>" class="form-control" style="width: 100%;">
</div> </div>
<div class="filter" style="display: flex; flex-direction: column; gap: 10px;"> <div class="filter">
<label for="stats_filtre_permanence" style="display: flex; align-items: center; gap: 8px; cursor: pointer; margin-top: 25px;"> <label for="stats_statut" style="display: block; margin-bottom: 5px; font-weight: 500;"><?php esc_html_e('Statut', 'esi_crvi_agenda'); ?></label>
<input type="checkbox" id="stats_filtre_permanence" name="filtre_permanence" value="permanence"> <select id="stats_statut" name="statut" class="select2 form-control" style="width: 100%;">
<span><?php esc_html_e('Afficher uniquement les permanences', 'esi_crvi_agenda'); ?></span> <option value=""><?php esc_html_e('Tous', 'esi_crvi_agenda'); ?></option>
</label> <option value="prevu"><?php esc_html_e('Prévu', 'esi_crvi_agenda'); ?></option>
<option value="cloture"><?php esc_html_e('Clôturé', 'esi_crvi_agenda'); ?></option>
<option value="absence"><?php esc_html_e('Absence', 'esi_crvi_agenda'); ?></option>
<option value="annule"><?php esc_html_e('Annulé', 'esi_crvi_agenda'); ?></option>
<option value="non_tenu"><?php esc_html_e('Non tenu', 'esi_crvi_agenda'); ?></option>
</select>
</div> </div>
<div class="filter" style="display: flex; gap: 10px; justify-content: flex-end; align-items: end;"> <div class="filter" style="display: flex; gap: 10px; justify-content: flex-end; align-items: end;">
<button type="button" id="stats_filterBtn" class="btn btn-primary" style="min-width: 100px;"> <button type="button" id="stats_filterBtn" class="btn btn-primary" style="min-width: 100px;">