This commit is contained in:
KONE SOREL 2026-03-11 18:25:41 +00:00
parent af8f5470db
commit 31ddbbf280
2 changed files with 132 additions and 77 deletions

View File

@ -46709,43 +46709,56 @@ function ctrlkeypress_liste_garants(ev)
} }
} }
function afficher_liste_garants() function afficher_liste_garants() {
{ // 1. Récupération des critères
donnees = ""; const typeGarant = $("#typeGarant").val() || 0;
donnees_retour = ""; const libelle = $("#libelle").val();
const codeGcAssureur = $("#codeGcAssureur").val();
const racineWeb = $("#racineWeb").val();
typeGarant = $("#typeGarant").val(); // 2. Préparation des données (Objet propre)
libelle = $("#libelle").val(); const donnees = {
codeGcAssureur = $("#codeGcAssureur").val(); typeGarant: typeGarant,
libelle: libelle,
if(typeGarant==''){ codeGcAssureur: codeGcAssureur
typeGarant=0; };
}
// 3. Feedback Visuel Neutral Pro
donnees += 'typeGarant=' + typeGarant; const loaderHtml = `
donnees += '&libelle=' + libelle; <div class="text-center p-5 my-5">
donnees += '&codeGcAssureur=' + codeGcAssureur; <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>
<p class="mt-3 text-muted fw-bold animate__animated animate__fadeIn animate__infinite">
//alert(donnees); ${(typeof _ !== 'undefined') ? _("Chargement des porteurs de risque...") : "Chargement des porteurs de risque..."}
//return; </p>
</div>`;
$("#div_gcs").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>');
$("#div_gcs").html(loaderHtml);
$.ajax({
url: $("#racineWeb").val()+"Ajaxlistegarantsparametrage/", // 4. Appel AJAX
type : 'post', $.ajax({
data: donnees, url: racineWeb + "Ajaxlistegarantsparametrage/",
error: function(errorData) { type: 'post',
}, data: donnees,
success: function(data) { success: function(data) {
donnees_retour = data; // Injection des résultats
}, $("#div_gcs").html(data);
complete: function() {
$("#div_gcs").html(donnees_retour); // Initialisation DataTables Standard Neutral Pro
dataTableSpeciale(); if (typeof initDataTableReference === 'function') {
$("#nbligne").val("Nbre Lignes : "+$("#nbligne_info").val()); initDataTableReference('#tableGarants', 'Liste_Garants');
} } else if (typeof dataTableSpeciale === 'function') {
}); dataTableSpeciale();
}
// Mise à jour du compteur (Badge dynamique au lieu de l'input)
const nbre = $("#nbligne_info").val() || 0;
$("#badge-total-garants").text(nbre + " " + (nbre > 1 ? "Lignes" : "Ligne"));
},
error: function(xhr) {
toastr.error("Erreur lors de la récupération des données");
$("#div_gcs").html('<div class="alert alert-danger mx-3 mt-3">Erreur de connexion au serveur.</div>');
}
});
} }
function desactive_gc_assureur(idGarant){ function desactive_gc_assureur(idGarant){

View File

@ -1,46 +1,88 @@
<?php <?php
$nbligne = count($garants); $nbligne = count($garants);
$superUser = $_SESSION['superUser']; $superUser = $_SESSION['superUser'] ?? "0";
?> ?>
<div class="card border-0 shadow-sm overflow-hidden animate__animated animate__fadeIn">
<div class="card-header bg-white py-3 d-flex justify-content-between align-items-center">
<h6 class="mb-0 fw-bold text-muted text-uppercase small">
<i class="fas fa-list me-2"></i><?= _("Liste des Porteurs de Risque") ?>
</h6>
<span class="badge bg-primary-ghost text-primary rounded-pill px-3 py-2 fw-bold" id="badge-total-garants">
<?= $nbligne ?> <?= ($nbligne > 1) ? _("Lignes") : _("Ligne") ?>
</span>
</div>
<div class="table-responsive">
<div id="div_gcs"> <table id="tableGarants" class="table table-hover align-middle mb-0" style="font-size: 9pt;">
<table class="table table-striped table-bordered table-hover table-condensed table-responsive tabspeciale compact" style="font-size:8pt;"> <thead class="bg-light">
<thead> <tr>
<tr> <th class="text-center py-3" width="12%"><?= _("Code") ?></th>
<th style="text-align:center" width="10%" > Code </th> <th class="py-3" width="40%"><?= _("Nom / Raison Sociale") ?></th>
<th width="50%" style="text-align:center" > <?= _("Nom") ?> </th> <th class="py-3" width="28%"><?= _("Type") ?></th>
<th width="30%" style="text-align:center" > <?= _("Type Garant") ?> </th> <th class="text-center py-3" width="10%"><?= _("Polices") ?></th>
<th width="10%" style="text-align:center" > <?= _("Nombre Police") ?> </th> <?php if($superUser == "1"): ?>
<!-- <th class="text-center py-3" width="10%"><?= _("Action") ?></th>
<?php if($superUser=="1"):?> <?php endif; ?>
<th width="10%" style="text-align:center" > <?= _("Action") ?> </th> </tr>
<?php endif;?> </thead>
--> <tbody>
</tr> <?php foreach ($garants as $gc):
</thead> $idGc = $this->nettoyer($gc['id']);
<tbody> $code = $this->nettoyer($gc['codeGcAssureur']);
<?php foreach ($garants as $gc): $libelle = $this->nettoyer($gc['libelle']);
$idGc = $this->nettoyer($gc['id']); $type = $this->nettoyer($gc['typegc']);
$codeGcAssureur = $this->nettoyer($gc['codeGcAssureur']); $nbPolice = (int)$gc['nbPoliceGarant'];
$nbPoliceGarant = $this->nettoyer($gc['nbPoliceGarant']); ?>
?> <tr ondblclick="afficher_gc_assureur('<?= $idGc ?>');" style="cursor: pointer;">
<tr ondblclick="javascript:afficher_gc_assureur('<?=$idGc?>');" valign="top"> <td class="text-center">
<td align="center"> <input type="button" style='font-size:10pt;' class = "form-control btn btn-primary" value="<?= $codeGcAssureur ?>" onClick="javascript:afficher_gc_assureur('<?=$idGc?>');" title="Fiche Garant"> </td> <span class="badge bg-primary px-3 py-2 rounded-pill shadow-xs"
<td align="center"> <?= $this->nettoyer($gc['libelle']) ?> </td> onclick="afficher_gc_assureur('<?= $idGc ?>');"
<td align="center"> <?= $this->nettoyer($gc['typegc']) ?> </td> title="<?= _("Voir la fiche") ?>" style="cursor: pointer;">
<td align="center"> <?= $nbPoliceGarant ?> </td> <?= $code ?>
<!-- </span>
<?php if($superUser=="1"):?> </td>
<td align="center"> <td class="fw-bold text-dark text-uppercase"><?= $libelle ?></td>
<button type="button" class="form-control btn btn-danger" onclick="javascript:desactive_gc_assureur('<?=$idGc?>');" style='font-size:10pt;' > <?= _("Désactiver") ?> </button> <td>
</td> <span class="text-muted"><i class="fas fa-tag me-1 opacity-50"></i> <?= $type ?></span>
<?php endif;?> </td>
--> <td class="text-center">
</tr> <span class="badge bg-light text-dark border fw-normal px-2">
<?php endforeach; ?> <?= $nbPolice ?>
</tbody> </span>
</table> </td>
<input class="sr-only" type="text" id="nbligne_info" name="nbligne_info" value="<?= $nbligne ?>" > <?php if($superUser == "1"): ?>
<td class="text-center">
<button type="button" class="btn btn-outline-danger btn-sm rounded-pill"
onclick="desactive_gc_assureur('<?= $idGc ?>');"
title="<?= _("Désactiver") ?>">
<i class="fas fa-ban"></i>
</button>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div> </div>
<input type="hidden" id="nbligne_info" value="<?= $nbligne ?>">
<style>
/* Table Styling Neutral Pro */
#tableGarants thead th {
border-bottom: 2px solid #f1f4f6;
color: #6c757d;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
}
#tableGarants tbody tr {
transition: background-color 0.2s ease;
}
#tableGarants tbody tr:hover {
background-color: rgba(33, 46, 83, 0.02) !important;
}
.bg-primary-ghost { background-color: rgba(33, 46, 83, 0.08) !important; }
</style>