This commit is contained in:
KONE SOREL 2026-03-18 12:53:02 +00:00
parent a68c1a6dd8
commit 486be1c162
3 changed files with 145 additions and 119 deletions

View File

@ -15735,45 +15735,53 @@ function afficher_lite_prestataire()
}
function afficher_lite_prestataire_lot()
{
donnees = "";
donnees_retour = "";
function afficher_lite_prestataire_lot() {
// 1. Collecte des données
const donnees = {
codeTypePrestataire: $("#codeTypePrestataire").val(),
categoriePresataire: $("#categoriePresataire").val(),
libelle: $("#libelle").val(),
codePays: $("#codePays").val(),
codeVille: $("#codeVille").val(),
codeLocalite: $("#codeLocalite").val()
};
codeTypePrestataire = $("#codeTypePrestataire").val();
categoriePresataire = $("#categoriePresataire").val();
libelle = $("#libelle").val();
codePays = $("#codePays").val();
codeVille = $("#codeVille").val();
codeLocalite = $("#codeLocalite").val();
donnees += 'codeTypePrestataire=' + codeTypePrestataire;
donnees += '&categoriePresataire=' + categoriePresataire;
donnees += '&libelle=' + libelle;
donnees += '&codePays=' + codePays;
donnees += '&codeVille=' + codeVille;
donnees += '&codeLocalite=' + codeLocalite;
$("#div_liste_prestataire").html('<div style="padding-top:80px; text-align:center; font-size:14px; color: #0088cf; "><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
$.ajax({
url: $("#racineWeb").val()+"Ajaxlisteprestataireparlot/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
donnees_retour = data;
},
complete: function() {
$("#div_liste_prestataire").html(donnees_retour);
$("#nbligne").val("Lignes Filtrées : "+$("#nbligne_info").val());
dataTableSpeciale();
}
});
// 2. Affichage du Loader Neutral Pro
const loader = `
<div class="d-flex justify-content-center align-items-center p-5">
<div class="text-center">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>
<div class="mt-2 text-primary fw-bold text-uppercase small animate__animated animate__pulse animate__infinite">
${($("#codeLangue").val() === 'en_US') ? 'Searching...' : 'Recherche en cours...'}
</div>
</div>
</div>`;
$("#div_liste_prestataire").html(loader);
$.ajax({
url: $("#racineWeb").val() + "Ajaxlisteprestataireparlot/",
type: 'post',
data: donnees,
success: function(data) {
// Injection des données
$("#div_liste_prestataire").html(data);
// Mise à jour du compteur dans la vue parente
const nbreFiltre = $("#nbligne_info").val() || 0;
if(typeof updateLotCounter === 'function'){
updateLotCounter(nbreFiltre);
} else {
$("#nbligne").val("Lignes Filtrées : " + nbreFiltre);
}
// Initialisation d'une DataTable si nécessaire
if (typeof dataTableSpeciale === 'function') dataTableSpeciale();
},
error: function() {
$("#div_liste_prestataire").html('<div class="alert alert-danger mx-3"><?= _("Erreur lors du chargement des données") ?></div>');
}
});
}

View File

@ -1,82 +1,100 @@
<?php
$nbligne = 0;
if (est_anglophone()){
if($existeselection){
$libbouton = "Uncheck all";
}else{
$libbouton = "Check all";
}
}else{
if($existeselection){
$libbouton = "Décocher tous";
}else{
$libbouton = "Cocher tous";
}
}
$nbligne = 0;
$isAnglais = est_anglophone();
// Libellé du bouton de sélection globale
if ($isAnglais) {
$libbouton = $existeselection ? "Uncheck all" : "Check all";
} else {
$libbouton = $existeselection ? "Décocher tous" : "Cocher tous";
}
?>
<div id="div_liste_prestataire">
<input class="sr-only" type="text" id="fichier_lister" name="fichier_lister" value="Ajaxlisteprestataireparlot" >
<div id="div_nblignes_cochee" style="width:20%; margin:auto;">
<table class="table-responsive table-condensed" style='font-size:10pt;'>
<tbody>
<tr>
<td>
<input class="form-control" style="text-align: center; font-size:10pt;" type="text" id="nbcoche"
name="nbcoche" value="Lignes Cochées : <?= format_N($this->nettoyer($nbreprestataire['nbcoche'])) ?>" readonly>
</td>
</tr>
</tbody>
</table>
</div>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive tabspeciale compact" style="font-size:10pt;">
<thead>
<tr>
<th > <?= _("Nom") ?> </th>
<th style="text-align:center" width="5%" >Code</th>
<th style="text-align:center"> <?= _("Catégorie") ?> </th>
<th style="text-align:center" > Type </th>
<th style="text-align:center" > <?= _("Ville") ?> </th>
<th style="text-align:center"> <?= _("Pays") ?> </th>
<th class="text-center">
<button
type="button" id="btn-coche" class="form-control btn btn-primary"
onclick="javascript:selection_prestataire_lot();" > <?= $libbouton; ?>
</button>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($prestataires as $prestataire):
$id = $this->nettoyer($prestataire['id']);
$codePrestataire = $this->nettoyer($prestataire['codePrestataire']);
$nbligne++;
?>
<tr ondblclick="javascript:afficher_prestataire_id(<?= $id ?>);" valign="top">
<td><?= $this->nettoyer($prestataire['libelle']) ?></td>
<td align="center"><?= $this->nettoyer($prestataire['codePrestataire']) ?></td>
<td align="center"><?= $this->nettoyer($prestataire['libelleCategorie']) ?></td>
<td align="center"><?= $this->nettoyer($prestataire['typeprestataire']) ?></td>
<td align="center"><?= $this->nettoyer($prestataire['localite']) ?></td>
<td align="center"><?= $this->nettoyer($prestataire['codePays']) ?></td>
<td class="text-center" width="10%">
<?php
if($this->nettoyer($prestataire['choix'] == '0')){
$check ='';
}
else{
$check = 'checked';
}
?>
<INPUT TYPE="checkbox" class="custom-control-input" style="width: 2rem;height: 2rem;" id="choix"
NAME="choix" value="<?=(($this->nettoyer($prestataire['choix'])==0)? 0 : 1);?>"
onclick="if (this.checked) this.value=1; else this.value=0;cocherDecocherUn($('#fichier_lister').val(),<?= $id; ?>);" <?= $check;?>>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input class="sr-only" type="text" id="nbligne_info" name="nbligne_info" value="<?= $nbligne ?>" >
<div class="animate__animated animate__fadeIn">
<input type="hidden" id="fichier_lister" name="fichier_lister" value="Ajaxlisteprestataireparlot">
<div class="d-flex justify-content-center mb-3">
<div class="badge bg-warning text-dark border shadow-sm px-4 py-2 rounded-pill fs-6">
<i class="fas fa-check-square me-2"></i>
<?= _("Lignes Cochées :") ?> <span class="fw-bold" id="nbcoche_display"><?= format_N($this->nettoyer($nbreprestataire['nbcoche'])) ?></span>
<input type="hidden" id="nbcoche" name="nbcoche" value="<?= $this->nettoyer($nbreprestataire['nbcoche']) ?>">
</div>
</div>
<div class="card border-0 shadow-sm">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0 tabspeciale" style="font-size: 9.5pt;">
<thead class="bg-light">
<tr>
<th class="ps-3 py-3"><?= _("Nom du Prestataire") ?></th>
<th class="text-center">Code</th>
<th class="text-center"><?= _("Catégorie") ?></th>
<th class="text-center">Type</th>
<th class="text-center"><?= _("Ville / Pays") ?></th>
<th class="text-center py-3" width="150px">
<button type="button" id="btn-coche"
class="btn btn-sm <?= $existeselection ? 'btn-danger' : 'btn-primary' ?> rounded-pill px-3 fw-bold shadow-sm"
onclick="selection_prestataire_lot();">
<i class="fas <?= $existeselection ? 'fa-times-circle' : 'fa-check-circle' ?> me-1"></i>
<?= $libbouton; ?>
</button>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($prestataires as $v):
$id = $this->nettoyer($v['id']);
$check = ($v['choix'] == '1') ? 'checked' : '';
$nbligne++;
?>
<tr ondblclick="afficher_prestataire_id(<?= $id ?>);">
<td class="ps-3 fw-bold text-dark text-uppercase"><?= $this->nettoyer($v['libelle']) ?></td>
<td class="text-center"><span class="badge bg-light text-muted border"><?= $this->nettoyer($v['codePrestataire']) ?></span></td>
<td class="text-center small"><?= $this->nettoyer($v['libelleCategorie']) ?></td>
<td class="text-center">
<span class="badge bg-primary-ghost text-primary fw-normal"><?= $this->nettoyer($v['typeprestataire']) ?></span>
</td>
<td class="text-center">
<div class="fw-bold"><?= $this->nettoyer($v['localite']) ?></div>
<div class="text-muted smaller text-uppercase"><?= $this->nettoyer($v['codePays']) ?></div>
</td>
<td class="text-center">
<div class="form-check form-switch d-flex justify-content-center">
<input class="form-check-input custom-switch-lg cursor-pointer"
type="checkbox"
role="switch"
id="choix_<?= $id ?>"
value="<?= ($v['choix'] == 0 ? 0 : 1) ?>"
onclick="this.value = this.checked ? 1 : 0; cocherDecocherUn('Ajaxlisteprestataireparlot', <?= $id; ?>);"
<?= $check ?>>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<input type="hidden" id="nbligne_info" name="nbligne_info" value="<?= $nbligne ?>">
</div>
<style>
/* Switch de grande taille pour une meilleure ergonomie */
.custom-switch-lg {
width: 3.5rem !important;
height: 1.75rem !important;
cursor: pointer;
}
.custom-switch-lg:checked {
background-color: var(--bs-primary);
border-color: var(--bs-primary);
}
.tabspeciale tbody tr:hover {
background-color: rgba(33, 46, 83, 0.03);
}
.smaller { font-size: 0.8rem; }
.bg-primary-ghost { background-color: rgba(33, 46, 83, 0.08) !important; }
</style>

View File

@ -36,7 +36,7 @@
<div class="card border-0 shadow-sm mb-1">
<div class="card-header bg-white py-3 border-bottom border-2">
<h6 class="mb-0 fw-bold text-muted text-uppercase small"><i class="fas fa-filter me-2"></i><?= _("Critères de sélection") ?></h6>
<h6 class="mb-0 fw-bold text-primary text-uppercase"><i class="fas fa-filter me-2"></i><?= _("Critères de sélection") ?></h6>
</div>
<div class="card-body bg-light-subtle">
<form id="form_filtre_lot">
@ -71,7 +71,7 @@
</div>
<div class="col-md-4">
<label class="form-label small fw-bold text-muted"><?= (isset($_SESSION['affichagedynamique']['District / Région'])) ? _($_SESSION['affichagedynamique']['District / Région']) : _("District / Région") ?></label>
<label class="form-label small fw-bold text-muted"><?= (isset($_SESSION['affichagedynamique']['District / Région / Province'])) ? _($_SESSION['affichagedynamique']['District / Région / Province']) : _("District / Région / Province") ?></label>
<div id="listeville">
<select class="selectpicker form-control border-2" id="codeVille" name="codeVille" data-live-search="true" onchange="ajaxListerLocaliteConsultation();">
<?php liste_options_consultation($ville, ""); ?>
@ -80,7 +80,7 @@
</div>
<div class="col-md-3">
<label class="form-label small fw-bold text-muted"><?= (isset($_SESSION['affichagedynamique']['Commune'])) ? _($_SESSION['affichagedynamique']['Commune']) : _("Commune") ?></label>
<label class="form-label small fw-bold text-muted"><?= (isset($_SESSION['affichagedynamique']['Ville / Localité'])) ? _($_SESSION['affichagedynamique']['Ville / Localité']) : _("Ville / Localité") ?></label>
<div id="listelocalite">
<select class="selectpicker form-control border-2" id="codeLocalite" name="codeLocalite" data-live-search="true">
<?php liste_options_consultation($listelocalite, "" ); ?>