dfr
This commit is contained in:
parent
eebe13a698
commit
3efa88d108
|
|
@ -69,4 +69,14 @@ class ControleurAjaxprestatairesreseau extends Controleurrequete
|
|||
|
||||
$this->executerAction("index");
|
||||
}
|
||||
|
||||
public function rechercher() {
|
||||
$query = $this->requete->getParametreFormulaire("query");
|
||||
$codeReseau = $_SESSION['codeReseau'];
|
||||
|
||||
$resultats = $this->reseau->rechercherPrestatairesDispo($codeReseau, $query);
|
||||
|
||||
// On génère une vue partielle qui ne contient que les <tr>
|
||||
$this->genererVueAjax(array('resultats' => $resultats));
|
||||
}
|
||||
}
|
||||
|
|
@ -23,13 +23,11 @@ class ControleurPrestatairesreseau extends Controleur {
|
|||
|
||||
$prestatairesdispo = $this->reseau->getPrestatairesReseauNonAffectes($codeReseau);
|
||||
$prestatairesreseau = $this->reseau->getPrestatairesReseauAffectes($codeReseau);
|
||||
$chemin = $this->menuvue->getChemin('Prestatairesreseau');
|
||||
|
||||
$this->genererVue(array(
|
||||
'reseau' => $reseau,
|
||||
'prestatairesdispo' => $prestatairesdispo,
|
||||
'prestatairesreseau' => $prestatairesreseau,
|
||||
'chemin' => $chemin
|
||||
'prestatairesreseau' => $prestatairesreseau
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46866,7 +46866,7 @@ function afficher_prestataires_reseau()
|
|||
data: donnees,
|
||||
success: function(data) {
|
||||
$('#div_prestataires_reseau').html(data);
|
||||
appliquerDataTable();
|
||||
//appliquerDataTable();
|
||||
},
|
||||
error: function(data) {
|
||||
},
|
||||
|
|
@ -92357,4 +92357,5 @@ function actualiser_garantie_produit() {
|
|||
`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -373,4 +373,19 @@ class Reseausoins extends Modele
|
|||
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche les prestataires non affectés avec un filtre textuel (Serveur-side)
|
||||
*/
|
||||
public function rechercherPrestatairesDispo($codeReseau, $query) {
|
||||
|
||||
$query = contruireParamLike($query);
|
||||
$codeSociete = $_SESSION['codeSociete'];
|
||||
|
||||
$sql = "CALL sp_rechercher_prestataires_dispo(?, ?, ?)"; // Sécurité pour ne pas saturer le DOM
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($codeSociete, $codeReseau, $query));
|
||||
|
||||
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,14 @@
|
|||
<?php
|
||||
$this->titre = "INTER SANTE - Affectation Prestataires";
|
||||
$codeReseau = $this->nettoyer($reseau['codeReseau']);
|
||||
$idReseau = $this->nettoyer($reseau['id']);
|
||||
$nomReseau = $this->nettoyer($reseau['libelle']);
|
||||
|
||||
// Extraction unique des types pour les selects (Optionnel)
|
||||
$typesDispo = array_unique(array_column($prestatairesdispo, 'typeprestataire'));
|
||||
sort($typesDispo);
|
||||
$typesAffect = array_unique(array_column($prestatairesreseau, 'typeprestataire'));
|
||||
sort($typesAffect);
|
||||
?>
|
||||
|
||||
<div class="page-content animate__animated animate__fadeIn">
|
||||
|
|
@ -30,8 +37,8 @@
|
|||
<input type="hidden" id="codeReseau" name="codeReseau" value="<?= $codeReseau ?>">
|
||||
<input type="hidden" id="idReseau" name="idReseau" value="<?= $idReseau ?>">
|
||||
|
||||
<div class="row g-4">
|
||||
|
||||
<div id="div_prestataires_reseau" class="row g-4">
|
||||
|
||||
<div class="col-lg-5">
|
||||
<div class="card border-0 shadow-sm h-100">
|
||||
<div class="card-header bg-white py-3 border-bottom">
|
||||
|
|
@ -43,14 +50,29 @@
|
|||
<?= count($prestatairesdispo) ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<span class="input-group-text bg-white border-2 border-end-0 text-muted"><i class="fas fa-search"></i></span>
|
||||
<input type="text" id="search_dispo" class="form-control border-2 border-start-0 shadow-none" placeholder="<?= _("Filtrer par nom, ville...") ?>" onkeyup="filterTable('tab_dispo', this.value, 'count_dispo')">
|
||||
|
||||
<div class="bg-primary-ghost-light p-2 rounded mb-2 border border-primary-subtle">
|
||||
<div class="row g-1">
|
||||
<div class="col-12 mb-1">
|
||||
<input type="text" id="search_nom_dispo" class="form-control form-control-sm border-2 shadow-none" placeholder="<?= _("Nom du prestataire...") ?>" onkeyup="multiFilter('tab_dispo', 'count_dispo')">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" id="search_ville_dispo" class="form-control form-control-sm border-2 shadow-none" placeholder="<?= _("Ville...") ?>" onkeyup="multiFilter('tab_dispo', 'count_dispo')">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<select id="search_type_dispo" class="form-select form-select-sm border-2 shadow-none" onchange="multiFilter('tab_dispo', 'count_dispo')">
|
||||
<option value=""><?= _("Tous les types") ?></option>
|
||||
<?php foreach($typesDispo as $t): ?> <option value="<?= $t ?>"><?= $t ?></option> <?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary-ghost btn-sm w-100 mt-2 rounded-pill fw-bold" onclick="ajouter_tous_prestataires_reseau();">
|
||||
|
||||
<button class="btn btn-primary-ghost btn-sm w-100 rounded-pill fw-bold" onclick="ajouter_tous_prestataires_reseau();">
|
||||
<?= _("Tout ajouter") ?> <i class="fas fa-angle-double-right ms-1"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive" style="max-height: 500px; overflow-y: auto;">
|
||||
<table class="table table-hover align-middle mb-0" id="tab_dispo" style="font-size: 8.5pt;">
|
||||
|
|
@ -65,8 +87,9 @@
|
|||
<tr>
|
||||
<td class="ps-3">
|
||||
<div class="fw-bold text-dark search-target"><?= $this->nettoyer($v['libelle']) ?></div>
|
||||
<div class="text-muted smaller search-target">
|
||||
<?= $this->nettoyer($v['localite']) ?> | <?= $this->nettoyer($v['typeprestataire']) ?>
|
||||
<div class="text-muted smaller">
|
||||
<span class="search-target"><?= $this->nettoyer($v['localite']) ?></span> |
|
||||
<span class="text-primary search-target"><?= $this->nettoyer($v['typeprestataire']) ?></span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center pe-3">
|
||||
|
|
@ -94,14 +117,29 @@
|
|||
<?= count($prestatairesreseau) ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<span class="input-group-text bg-white border-2 border-end-0 text-muted"><i class="fas fa-search"></i></span>
|
||||
<input type="text" id="search_affect" class="form-control border-2 border-start-0 shadow-none" placeholder="<?= _("Rechercher dans la liste...") ?>" onkeyup="filterTable('tab_affect', this.value, 'count_affect')">
|
||||
|
||||
<div class="bg-success-ghost p-2 rounded mb-2 border border-success-subtle">
|
||||
<div class="row g-1">
|
||||
<div class="col-12 mb-1">
|
||||
<input type="text" id="search_nom_affect" class="form-control form-control-sm border-2 shadow-none" placeholder="<?= _("Rechercher dans la liste...") ?>" onkeyup="multiFilter('tab_affect', 'count_affect')">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" id="search_ville_affect" class="form-control form-control-sm border-2 shadow-none" placeholder="<?= _("Filtrer par ville...") ?>" onkeyup="multiFilter('tab_affect', 'count_affect')">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<select id="search_type_affect" class="form-select form-select-sm border-2 shadow-none" onchange="multiFilter('tab_affect', 'count_affect')">
|
||||
<option value=""><?= _("Tous les types") ?></option>
|
||||
<?php foreach($typesAffect as $t): ?> <option value="<?= $t ?>"><?= $t ?></option> <?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-danger-light btn-sm w-100 mt-2 rounded-pill fw-bold" onclick="retirer_tous_prestataires_du_site();">
|
||||
<i class="fas fa-angle-double-left me-1"></i> <?= _("Retirer tous") ?>
|
||||
|
||||
<button class="btn btn-danger-light btn-sm w-100 rounded-pill fw-bold" onclick="retirer_tous_prestataires_du_site();">
|
||||
<i class="fas fa-angle-double-left me-1"></i> <?= _("Retirer tous les prestataires") ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive" style="max-height: 500px; overflow-y: auto;">
|
||||
<table class="table table-hover align-middle mb-0" id="tab_affect" style="font-size: 8.5pt;">
|
||||
|
|
@ -109,7 +147,7 @@
|
|||
<tr>
|
||||
<th class="ps-3 py-2" width="50px"></th>
|
||||
<th class="py-2"><?= _("Nom du Prestataire") ?></th>
|
||||
<th class="py-2 pe-3"><?= _("Ville / Localité") ?></th>
|
||||
<th class="py-2 pe-3"><?= _("Ville & Type") ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -120,8 +158,11 @@
|
|||
<i class="fas fa-chevron-left"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td class="fw-bold search-target"><?= $this->nettoyer($v['libelle']) ?></td>
|
||||
<td class="pe-3 search-target"><?= $this->nettoyer($v['localite']) ?></td>
|
||||
<td class="fw-bold text-dark text-uppercase search-target"><?= $this->nettoyer($v['libelle']) ?></td>
|
||||
<td class="pe-3 search-target">
|
||||
<span class="text-muted"><i class="fas fa-map-marker-alt me-1"></i><?= $this->nettoyer($v['localite']) ?></span>
|
||||
<span class="badge bg-light text-muted fw-normal ms-2 search-target"><?= $this->nettoyer($v['typeprestataire']) ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
@ -135,19 +176,27 @@
|
|||
|
||||
<script>
|
||||
/**
|
||||
* Fonction de filtrage en temps réel
|
||||
* @param {string} tableId - ID de la table à filtrer
|
||||
* @param {string} query - Texte recherché
|
||||
* @param {string} counterId - ID du badge de décompte
|
||||
* Filtrage multicritères universel pour INTER-SANTE
|
||||
*/
|
||||
function filterTable(tableId, query, counterId) {
|
||||
const filter = query.toLowerCase();
|
||||
function multiFilter(tableId, counterId) {
|
||||
const suffix = tableId === 'tab_dispo' ? '_dispo' : '_affect';
|
||||
|
||||
const valNom = document.getElementById('search_nom' + suffix).value.toLowerCase();
|
||||
const valVille = document.getElementById('search_ville' + suffix).value.toLowerCase();
|
||||
const valType = document.getElementById('search_type' + suffix).value.toLowerCase();
|
||||
|
||||
const rows = document.querySelectorAll(`#${tableId} tbody tr`);
|
||||
let visibleCount = 0;
|
||||
|
||||
rows.forEach(row => {
|
||||
const text = row.innerText.toLowerCase();
|
||||
if (text.includes(filter)) {
|
||||
// On récupère le texte complet de la ligne pour le filtrage
|
||||
const rowText = row.innerText.toLowerCase();
|
||||
|
||||
const matchNom = rowText.includes(valNom);
|
||||
const matchVille = rowText.includes(valVille);
|
||||
const matchType = valType === "" || rowText.includes(valType);
|
||||
|
||||
if (matchNom && matchVille && matchType) {
|
||||
row.style.display = "";
|
||||
visibleCount++;
|
||||
} else {
|
||||
|
|
@ -155,16 +204,27 @@ function filterTable(tableId, query, counterId) {
|
|||
}
|
||||
});
|
||||
|
||||
// Mise à jour du compteur
|
||||
document.getElementById(counterId).innerText = visibleCount;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.bg-primary-ghost { background-color: rgba(33, 46, 83, 0.08) !important; }
|
||||
.bg-primary-ghost-light { background-color: rgba(33, 46, 83, 0.03) !important; }
|
||||
.btn-primary-ghost { color: var(--bs-primary); background-color: rgba(33, 46, 83, 0.1); border: none; }
|
||||
.btn-primary-ghost:hover { background-color: rgba(33, 46, 83, 0.2); }
|
||||
|
||||
.bg-success-light { background-color: rgba(25, 135, 84, 0.08) !important; }
|
||||
.bg-success-ghost { background-color: rgba(25, 135, 84, 0.03) !important; }
|
||||
.btn-danger-light { color: var(--bs-danger); background-color: rgba(220, 53, 69, 0.1); border: none; }
|
||||
.action-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
|
||||
.input-group-sm > .form-control:focus { border-color: #dee2e6; }
|
||||
.btn-danger-light:hover { background-color: rgba(220, 53, 69, 0.2); }
|
||||
|
||||
.action-icon { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; }
|
||||
.action-icon:hover { transform: scale(1.15); }
|
||||
|
||||
.smaller { font-size: 0.85em; }
|
||||
|
||||
/* Scrollbar */
|
||||
.table-responsive::-webkit-scrollbar { width: 6px; }
|
||||
.table-responsive::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 10px; }
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user