f
This commit is contained in:
parent
28c4781878
commit
6698df714c
|
|
@ -1,110 +1,104 @@
|
||||||
<?php
|
<?php
|
||||||
$codeTypeAvenant = $_SESSION['codeTypeAvenant_C'];
|
$codeTypeAvenant = $_SESSION['codeTypeAvenant_C'];
|
||||||
$numeroPolice = $this->nettoyer($_SESSION['numeroPolice_C']);
|
$numeroPolice = $this->nettoyer($_SESSION['numeroPolice_C']);
|
||||||
|
|
||||||
|
// On extrait la liste unique des collèges pour le filtre
|
||||||
|
$colleges = array_unique(array_column($adherents, 'libelleCollege'));
|
||||||
|
sort($colleges);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Pagination style */
|
||||||
|
.dataTables_paginate { margin-top: 15px; }
|
||||||
|
.paginate_button { padding: 5px 10px; margin: 0 2px; border: 1px solid #dee2e6; border-radius: 4px; cursor: pointer; }
|
||||||
|
.paginate_button.current { background: #0d6efd !important; color: white !important; border-color: #0d6efd; }
|
||||||
|
|
||||||
|
/* Vos styles existants */
|
||||||
|
.cursor-pointer { cursor: pointer; transition: all 0.2s; }
|
||||||
|
.cursor-pointer:hover { background-color: #f8f9fa !important; }
|
||||||
|
.status-actif { border-left: 4px solid #0dcaf0 !important; }
|
||||||
|
.status-archive { border-left: 4px solid #ffc107 !important; background-color: #fffdf5; }
|
||||||
|
.x-small { font-size: 0.72rem; }
|
||||||
|
.btn-white { background: #fff; }
|
||||||
|
</style>
|
||||||
|
|
||||||
<div id="div_liste_adherent" class="container-fluid py-0 animate__animated animate__fadeIn">
|
<div id="div_liste_adherent" class="container-fluid py-0 animate__animated animate__fadeIn">
|
||||||
|
|
||||||
<h1 class="text-primary"><i class="fas fa-users me-2"></i></i> <?= _('Gestion des Adhérents') ?></h1>
|
<h1 class="text-primary mb-4"><i class="fas fa-users me-2"></i> <?= _('Gestion des Adhérents') ?></h1>
|
||||||
|
|
||||||
<div class="card-header d-flex justify-content-between align-items-center py-3">
|
<div class="row mb-3 g-3">
|
||||||
<h4 class="fw-bold text-secondary mb-0">
|
<div class="col-md-4">
|
||||||
<?= _("POLICE") ?> : <span class="badge bg-white text-primary ms-2"><?= $this->nettoyer($_SESSION['numeroPolice_C']) ?></span>
|
<div class="input-group shadow-sm">
|
||||||
</h4>
|
<span class="input-group-text bg-white border-end-0 text-muted"><i class="fas fa-search"></i></span>
|
||||||
</div>
|
<input type="text" id="customSearch" class="form-control border-start-0 ps-0" placeholder="<?= _('Recherche globale...') ?>">
|
||||||
|
</div>
|
||||||
<div class="card shadow-sm border-0 mb-4 bg-office-primary-lighter text-white">
|
</div>
|
||||||
<div class="card-body d-flex align-items-center justify-content-between p-3">
|
<div class="col-md-3">
|
||||||
<button type="button" class="btn btn-light btn-sm fw-bold shadow-sm w-100" onclick="javascript:afficher_adherents_police();">
|
<select class="form-select shadow-sm" id="collegeFilter">
|
||||||
<i class="fas fa-sync-alt me-2 text-primary"></i> <?= _("Actualiser la liste") ?>
|
<option value=""><?= _("Tous les collèges") ?></option>
|
||||||
|
<?php foreach($colleges as $coll): ?>
|
||||||
|
<option value="<?= $this->nettoyer($coll) ?>"><?= $this->nettoyer($coll) ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<select class="form-select shadow-sm" id="statusFilter">
|
||||||
|
<option value=""><?= _("Tous les statuts") ?></option>
|
||||||
|
<option value="status-actif">🟢 <?= _("Actifs") ?></option>
|
||||||
|
<option value="status-archive">🟠 <?= _("Archivés") ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 text-end">
|
||||||
|
<button class="btn btn-outline-primary shadow-sm w-100" onclick="javascript:afficher_adherents_police();">
|
||||||
|
<i class="fas fa-sync-alt"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3 g-3">
|
<div class="table-responsive shadow-sm rounded-3 border bg-white p-3">
|
||||||
<div class="col-md-7">
|
<table class="table table-hover align-middle mb-0" id="tableAdherents" style="width:100%; font-size: 0.9rem;">
|
||||||
<div class="input-group shadow-sm">
|
|
||||||
<span class="input-group-text bg-white border-end-0 text-muted">
|
|
||||||
<i class="fas fa-search"></i>
|
|
||||||
</span>
|
|
||||||
<input type="text" id="filterInput" class="form-control border-start-0 ps-0"
|
|
||||||
placeholder="<?= _('Rechercher par nom, prénom ou n° adhérent...') ?>"
|
|
||||||
onkeyup="filtrerTableauAdherents()">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select class="form-select shadow-sm" id="statusFilter" onchange="filtrerTableauAdherents()">
|
|
||||||
<option value="all">🔍 <?= _("Tous les statuts") ?></option>
|
|
||||||
<option value="actif">🟢 <?= _("Actifs (Modifiables)") ?></option>
|
|
||||||
<option value="archive">🟠 <?= _("Archivés") ?></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<div class="dropdown w-100">
|
|
||||||
<button class="btn btn-primary w-100 dropdown-toggle shadow-sm" type="button" data-bs-toggle="dropdown">
|
|
||||||
<i class="fas fa-download me-2"></i><?= _("Exporter") ?>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu dropdown-menu-end shadow">
|
|
||||||
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#pop_liste_assures"><i class="fas fa-file-pdf me-2 text-danger"></i><?= _("Format PDF") ?></a></li>
|
|
||||||
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#pop_exporter_liste_assures"><i class="fas fa-file-excel me-2 text-success"></i><?= _("Format Excel") ?></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="div_liste_adherent" class="table-responsive shadow-sm rounded-3 border bg-white">
|
|
||||||
<table class="table table-hover align-middle mb-0" id="tableAdherents" style="font-size: 0.9rem;">
|
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="ps-3 py-3 text-center" width="10%"><?= _("N° Adhérent") ?></th>
|
<th class="text-center"><?= _("N° Adhérent") ?></th>
|
||||||
<th><?= _("Identité de l'assuré") ?></th>
|
<th><?= _("Identité") ?></th>
|
||||||
<th class="text-center"><?= _("Collège") ?></th>
|
<th class="text-center"><?= _("Collège") ?></th>
|
||||||
<th class="text-center"><?= _("Période Couverture") ?></th>
|
<th class="text-center"><?= _("Période") ?></th>
|
||||||
<th class="text-center" width="8%"><?= _("Actions") ?></th>
|
<th class="text-center no-export"><?= _("Actions") ?></th>
|
||||||
</tr>
|
<th class="d-none">StatusClass</th> </tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($adherents as $adherent):
|
<?php foreach ($adherents as $adherent):
|
||||||
$idAdh = $adherent['id'];
|
$idAdh = $adherent['id'];
|
||||||
$noAdh = $this->nettoyer($adherent['numeroAdherent']);
|
$noAdh = $this->nettoyer($adherent['numeroAdherent']);
|
||||||
|
$libelleColl = $this->nettoyer($adherent['libelleCollege']);
|
||||||
$estsupprimable = ($this->nettoyer($adherent['primeArchive']) == "0");
|
$estsupprimable = ($this->nettoyer($adherent['primeArchive']) == "0");
|
||||||
$statusClass = $estsupprimable ? 'status-actif' : 'status-archive';
|
$statusClass = $estsupprimable ? 'status-actif' : 'status-archive';
|
||||||
?>
|
?>
|
||||||
<tr class="<?= $statusClass ?> cursor-pointer"
|
<tr class="<?= $statusClass ?> cursor-pointer" onclick="selectionner_adherent(<?= $idAdh ?>,'<?= $noAdh ?>');">
|
||||||
onclick="selectionner_adherent(<?= $idAdh ?>,'<?= $noAdh ?>');"
|
|
||||||
ondblclick="afficher_adherent_id();">
|
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<span class="badge bg-light text-dark border fw-bold px-2 py-2">
|
<span class="badge bg-light text-dark border fw-bold"><?= $noAdh ?></span>
|
||||||
<?= $noAdh ?>
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="fw-bold text-dark text-uppercase"><?= $this->nettoyer($adherent['nom']) ?></div>
|
<div class="fw-bold text-dark text-uppercase"><?= $this->nettoyer($adherent['nom']) ?></div>
|
||||||
<div class="small text-muted"><?= $this->nettoyer($adherent['prenoms']) ?></div>
|
<div class="small text-muted"><?= $this->nettoyer($adherent['prenoms']) ?></div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<span class="badge bg-primary-subtle text-primary mb-1"><?= $this->nettoyer($adherent['codeProduit']) ?></span>
|
<span class="badge bg-primary-subtle text-primary mb-1"><?= $this->nettoyer($adherent['codeProduit']) ?></span>
|
||||||
<div class="x-small text-muted text-truncate" title="<?= $this->nettoyer($adherent['libelleCollege']) ?>" style="max-width: 140px;">
|
<div class="x-small text-muted"><?= $libelleColl ?></div>
|
||||||
<?= $this->nettoyer($adherent['libelleCollege']) ?>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="d-flex justify-content-center align-items-center small">
|
<div class="small">
|
||||||
<span class="text-success fw-bold"><?= dateLang($this->nettoyer($adherent['dateEntree'])) ?></span>
|
<span class="text-success fw-bold"><?= dateLang($this->nettoyer($adherent['dateEntree'])) ?></span>
|
||||||
<i class="fas fa-arrow-right mx-2 text-muted" style="font-size: 0.7rem;"></i>
|
<i class="fas fa-arrow-right mx-1 text-muted"></i>
|
||||||
<span class="text-danger fw-bold"><?= $adherent['dateSortie'] ? dateLang($this->nettoyer($adherent['dateSortie'])) : '--' ?></span>
|
<span class="text-danger fw-bold"><?= $adherent['dateSortie'] ? dateLang($this->nettoyer($adherent['dateSortie'])) : '--' ?></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
<td class="text-center pe-3">
|
<button class="btn btn-sm btn-white border shadow-sm" onclick="afficher_adherent_id();">
|
||||||
<button class="btn btn-white border-0" title="<?= _("Voir la fiche") ?>" onclick="selectionner_adherent(<?= $idAdh ?>,'<?= $noAdh ?>'); afficher_adherent_id();">
|
|
||||||
<i class="fas fa-user-edit text-primary"></i>
|
<i class="fas fa-user-edit text-primary"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="d-none"><?= $statusClass ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
@ -112,32 +106,34 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
|
||||||
.cursor-pointer { cursor: pointer; transition: all 0.2s; }
|
|
||||||
.cursor-pointer:hover { background-color: #f8f9fa !important; }
|
|
||||||
.status-actif { border-left: 4px solid #0dcaf0 !important; }
|
|
||||||
.status-archive { border-left: 4px solid #ffc107 !important; background-color: #fffdf5; }
|
|
||||||
.x-small { font-size: 0.72rem; }
|
|
||||||
.btn-white { background: #fff; }
|
|
||||||
.btn-white:hover { background: #f0f0f0; }
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function filtrerTableauAdherents() {
|
$(document).ready(function() {
|
||||||
const input = document.getElementById("filterInput").value.toUpperCase();
|
// Initialisation de DataTable
|
||||||
const status = document.getElementById("statusFilter").value;
|
var table = $('#tableAdherents').DataTable({
|
||||||
const tr = document.querySelectorAll("#tableAdherents tbody tr");
|
"pageLength": 10,
|
||||||
|
"language": {
|
||||||
|
"url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json"
|
||||||
|
},
|
||||||
|
"dom": 'rtp', // 'rtp' cache la barre de recherche par défaut pour utiliser la nôtre
|
||||||
|
"columnDefs": [
|
||||||
|
{ "orderable": false, "targets": [4] } // Désactive le tri sur la colonne Actions
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
tr.forEach(row => {
|
// Recherche personnalisée
|
||||||
const text = row.textContent.toUpperCase();
|
$('#customSearch').on('keyup', function() {
|
||||||
const estArchive = row.classList.contains('status-archive');
|
table.search(this.value).draw();
|
||||||
|
});
|
||||||
const matchText = text.includes(input);
|
|
||||||
const matchStatus = (status === 'all') ||
|
|
||||||
(status === 'actif' && !estArchive) ||
|
|
||||||
(status === 'archive' && estArchive);
|
|
||||||
|
|
||||||
row.style.display = (matchText && matchStatus) ? "" : "none";
|
// Filtre par Collège (Colonne 2 - index base 0)
|
||||||
|
$('#collegeFilter').on('change', function() {
|
||||||
|
table.column(2).search(this.value).draw();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Filtre par Statut (Colonne 5 - cachée)
|
||||||
|
$('#statusFilter').on('change', function() {
|
||||||
|
table.column(5).search(this.value).draw();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
</script>
|
||||||
</script>
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user