Maj DataTable
This commit is contained in:
parent
730b94ebe4
commit
a6ae4e7efe
|
|
@ -376,67 +376,62 @@ function connexion_cookie()
|
||||||
|
|
||||||
// Applique la librairie DataBase sur les tableaux
|
// Applique la librairie DataBase sur les tableaux
|
||||||
function appliquerDataTable() {
|
function appliquerDataTable() {
|
||||||
const $table = $('.tabliste');
|
|
||||||
const codeLangue = $("#codeLangue").val();
|
const codeLangue = $("#codeLangue").val();
|
||||||
|
|
||||||
// Dictionnaire des traductions
|
|
||||||
const translations = {
|
const translations = {
|
||||||
en_US: {
|
|
||||||
lengthMenu: "Display _MENU_ records per page",
|
|
||||||
zeroRecords: "Nothing found - sorry",
|
|
||||||
info: "Showing page _PAGE_ of _PAGES_",
|
|
||||||
infoEmpty: "No records available",
|
|
||||||
search: "Search:",
|
|
||||||
paginate: {
|
|
||||||
next: "►",
|
|
||||||
previous: "◄",
|
|
||||||
first: "|◄",
|
|
||||||
last: "►|"
|
|
||||||
},
|
|
||||||
infoFiltered: "(filtered from _MAX_ total records)"
|
|
||||||
},
|
|
||||||
fr_FR: {
|
fr_FR: {
|
||||||
lengthMenu: "Affiche _MENU_ par page",
|
lengthMenu: "Affiche _MENU_ par page",
|
||||||
zeroRecords: "Désolé - Aucune donnée trouvée",
|
zeroRecords: "Désolé - Aucune donnée trouvée",
|
||||||
info: "_PAGE_ sur _PAGES_ pages",
|
info: "_PAGE_ sur _PAGES_ pages",
|
||||||
infoEmpty: "Pas d'enregistrement",
|
infoEmpty: "Pas d'enregistrement",
|
||||||
search: "Recherche:",
|
search: "Recherche:",
|
||||||
paginate: {
|
paginate: { next: "►", previous: "◄", first: "|◄", last: "►|" },
|
||||||
next: "►",
|
|
||||||
previous: "◄",
|
|
||||||
first: "|◄",
|
|
||||||
last: "►|"
|
|
||||||
},
|
|
||||||
infoFiltered: "(filtré de _MAX_ total enregistrements)"
|
infoFiltered: "(filtré de _MAX_ total enregistrements)"
|
||||||
|
},
|
||||||
|
en_US: {
|
||||||
|
lengthMenu: "Display _MENU_ records per page",
|
||||||
|
zeroRecords: "Nothing found - sorry",
|
||||||
|
info: "Showing page _PAGE_ of _PAGES_",
|
||||||
|
infoEmpty: "No records available",
|
||||||
|
search: "Search:",
|
||||||
|
paginate: { next: "►", previous: "◄", first: "|◄", last: "►|" },
|
||||||
|
infoFiltered: "(filtered from _MAX_ total records)"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Options DataTable
|
$('.tabliste').each(function() {
|
||||||
const options = {
|
const $table = $(this);
|
||||||
destroy: true,
|
|
||||||
responsive: true,
|
// Détecter les colonnes avec data-hidden="true"
|
||||||
order: [[0, "desc"]],
|
const hiddenTargets = [];
|
||||||
lengthMenu: [50, 100, 150],
|
$table.find('thead th').each(function(index) {
|
||||||
pagingType: "full_numbers",
|
if ($(this).data('hidden')) {
|
||||||
autoWidth: false,
|
hiddenTargets.push(index);
|
||||||
language: translations[codeLangue] || translations.fr_FR
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
destroy: true,
|
||||||
|
responsive: true,
|
||||||
|
order: [[0, "desc"]],
|
||||||
|
lengthMenu: [50, 100, 150],
|
||||||
|
pagingType: "full_numbers",
|
||||||
|
autoWidth: false,
|
||||||
|
language: translations[codeLangue] || translations.fr_FR,
|
||||||
|
columnDefs: [
|
||||||
|
{ targets: hiddenTargets, visible: false, searchable: true }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
// Initialisation
|
|
||||||
const instance = $table.DataTable(options);
|
const instance = $table.DataTable(options);
|
||||||
|
|
||||||
// Correction d'alignement après le rendu
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
instance.columns.adjust().responsive.recalc();
|
instance.columns.adjust().responsive.recalc();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error("Erreur lors de l'application du DataTable :", err);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function raffraichier_gabarit()
|
function raffraichier_gabarit()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,48 +78,61 @@
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-bordered table-hover table-condensed tabliste compact w-100" style="font-size:10pt; white-space:nowrap;">
|
<table class="table table-striped table-bordered table-hover table-condensed tabliste compact w-100" style="font-size:10pt; white-space:nowrap;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align:center"> <?= _("No Police") ?> </th>
|
<th style="text-align:center"> <?= _("No Police") ?> </th>
|
||||||
<th style="text-align:center"> <?= _("ID Police") ?> </th>
|
<th style="text-align:center"> <?= _("ID Police") ?> </th>
|
||||||
<th style="text-align:center">Type</th>
|
<th style="text-align:center">Type</th>
|
||||||
<th style="text-align:center"> <?= _("Effet") ?> </th>
|
<th style="text-align:center"> <?= _("Effet") ?> </th>
|
||||||
<th style="text-align:center"> <?= _("Échéance") ?> </th>
|
<th style="text-align:center"> <?= _("Échéance") ?> </th>
|
||||||
<th style="text-align:center"> <?= _("Type Avenant") ?> </th>
|
<th style="text-align:center"> <?= _("Type Avenant") ?> </th>
|
||||||
<th style="text-align:center"> <?= _("État") ?> </th>
|
<th style="text-align:center"> <?= _("État") ?> </th>
|
||||||
<th style="text-align:center"> <?= _("Prime") ?> </th>
|
<th style="text-align:center"> <?= _("Prime") ?> </th>
|
||||||
<th style="text-align:center"> <?= _("Sinistres") ?> </th>
|
<th style="text-align:center"> <?= _("Sinistres") ?> </th>
|
||||||
<th style="text-align:center"> <?= _("R S/P") ?> </th>
|
<th style="text-align:center"> <?= _("R S/P") ?> </th>
|
||||||
</tr>
|
|
||||||
|
<!-- Colonnes cachées pour recherche -->
|
||||||
|
<th data-hidden="true">NoPoliceHidden</th>
|
||||||
|
<th data-hidden="true">IdPoliceHidden</th>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($polices as $police):
|
<?php foreach ($polices as $police):
|
||||||
$id = $this->nettoyer($police['idPolice']);
|
$id = $this->nettoyer($police['idPolice']);
|
||||||
$nopol = $this->nettoyer($police['numeroPolice']);
|
$nopol = $this->nettoyer($police['numeroPolice']);
|
||||||
?>
|
?>
|
||||||
<tr onclick="javascript:selectionner_police(<?= $id ?>,'<?= $nopol ?>');" ondblclick="javascript:selectionner_police(<?= $id ?>,'<?= $nopol ?>');afficher_police_id();" valign="top">
|
<tr>
|
||||||
<td align="center"> <input type="button" class = "form-control btn btn-primary" value="<?= $nopol ?>" onClick="javascript:selectionner_police(<?= $id ?>,'<?= $nopol ?>');afficher_police_id();"> </td>
|
<!-- Boutons visibles -->
|
||||||
<td align="center"> <input type="button" class = "form-control btn btn-info" value="<?= $id ?>" onClick="javascript:selectionner_police(<?= $id ?>,'<?= $nopol ?>');afficher_police_id();"> </td>
|
<td align="center">
|
||||||
|
<input type="button" class="form-control btn btn-primary" value="<?= $nopol ?>"
|
||||||
<td align='center'><?= $this->nettoyer($police['typeContrat']) ?></td>
|
onClick="selectionner_police(<?= $id ?>,'<?= $nopol ?>');afficher_police_id();">
|
||||||
<td align='center'><?= dateLang($this->nettoyer($police['dateEffet']), $_SESSION['lang'])?></td>
|
</td>
|
||||||
<td align='center'><?= dateLang($this->nettoyer($police['dateEcheance']), $_SESSION['lang']) ?></td>
|
<td align="center">
|
||||||
|
<input type="button" class="form-control btn btn-info" value="<?= $id ?>"
|
||||||
<td align='center'><?= $this->nettoyer($police['typeAvenant']) ?></td>
|
onClick="selectionner_police(<?= $id ?>,'<?= $nopol ?>');afficher_police_id();">
|
||||||
<td align='center'><?= $this->nettoyer($police['etatPolice']) ?></td>
|
</td>
|
||||||
<td align='center'><?= format_N($this->nettoyer($police['primeNetteStat'])) ?></td>
|
|
||||||
<td align='center'><?= format_N($this->nettoyer($police['montantApayer'])) ?></td>
|
|
||||||
|
|
||||||
<?php if($police["rapportSp"] > 65 && $police["rapportSp"] <= 80):?>
|
<!-- Autres colonnes -->
|
||||||
<td align='center' class="text-warning"><?= $police["rapportSp"].'%' ?></td>
|
<td align='center'><?= $this->nettoyer($police['typeContrat']) ?></td>
|
||||||
<?php elseif($police["rapportSp"] > 80):?>
|
<td align='center'><?= dateLang($this->nettoyer($police['dateEffet']), $_SESSION['lang'])?></td>
|
||||||
<td align='center' class="text-danger"><?= $police["rapportSp"].'%' ?></td>
|
<td align='center'><?= dateLang($this->nettoyer($police['dateEcheance']), $_SESSION['lang']) ?></td>
|
||||||
<?php else:?>
|
<td align='center'><?= $this->nettoyer($police['typeAvenant']) ?></td>
|
||||||
<td align='center' class="text-primary"><?= $police["rapportSp"].'%' ?></td>
|
<td align='center'><?= $this->nettoyer($police['etatPolice']) ?></td>
|
||||||
<?php endif;?>
|
<td align='center'><?= format_N($this->nettoyer($police['primeNetteStat'])) ?></td>
|
||||||
</tr>
|
<td align='center'><?= format_N($this->nettoyer($police['montantApayer'])) ?></td>
|
||||||
<?php endforeach; ?>
|
|
||||||
|
<?php if($police["rapportSp"] > 65 && $police["rapportSp"] <= 80):?>
|
||||||
|
<td align='center' class="text-warning"><?= $police["rapportSp"].'%' ?></td>
|
||||||
|
<?php elseif($police["rapportSp"] > 80):?>
|
||||||
|
<td align='center' class="text-danger"><?= $police["rapportSp"].'%' ?></td>
|
||||||
|
<?php else:?>
|
||||||
|
<td align='center' class="text-primary"><?= $police["rapportSp"].'%' ?></td>
|
||||||
|
<?php endif;?>
|
||||||
|
|
||||||
|
<!-- Colonnes cachées -->
|
||||||
|
<td><?= $nopol ?></td>
|
||||||
|
<td><?= $id ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -594,7 +594,7 @@ console.groupEnd();
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<!-- Application Scripts -->
|
<!-- Application Scripts -->
|
||||||
<script src="/Js/fonctions.js?ver=2025.12.25.01"></script>
|
<script src="/Js/fonctions.js?ver=2025.12.25.03"></script>
|
||||||
|
|
||||||
<?php if (est_anglophone()): ?>
|
<?php if (est_anglophone()): ?>
|
||||||
<script src="/Js/datepicker-eng.js"></script>
|
<script src="/Js/datepicker-eng.js"></script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user