This commit is contained in:
KONE SOREL 2026-03-28 17:05:20 +00:00
parent 82c921d249
commit d94d1ad727
3 changed files with 43 additions and 20 deletions

View File

@ -23,6 +23,14 @@ class ControleurListeavenant extends Controleur {
$avenants = $this->avenant->getAvenant($idPolice); $avenants = $this->avenant->getAvenant($idPolice);
$this->genererVue(array('police' => $police, 'avenants' => $avenants)); $dj = date("Y-m-d");
$sppoliceentete = $this->sppolice->getRapportSpPoliceEntete($idPolice, $dj);
$this->genererVue(array(
'police' => $police,
'avenants' => $avenants,
'sppoliceentete' => $sppoliceentete
));
} }
} }

View File

@ -366,7 +366,7 @@ function changer_langue_connexion() {
* @param {string|jQuery} selector - Sélecteur du tableau (ex: '.tabliste' ou '#myTable') * @param {string|jQuery} selector - Sélecteur du tableau (ex: '.tabliste' ou '#myTable')
* @param {object} options - Options personnalisées (langue, boutons, ordre, etc.) * @param {object} options - Options personnalisées (langue, boutons, ordre, etc.)
*/ */
function appliquerDataTable(selector = '.tabliste', options = {}, titreDoc = "Rapport") { function appliquerDataTable(selector = '.tabliste', options = {}, titreDoc = "Rapport", message = "") {
const codeLangue = $("#codeLangue").val() || 'fr_FR'; const codeLangue = $("#codeLangue").val() || 'fr_FR';
const translations = { const translations = {
@ -389,19 +389,29 @@ function appliquerDataTable(selector = '.tabliste', options = {}, titreDoc = "Ra
$(selector).each(function() { $(selector).each(function() {
const $table = $(this); const $table = $(this);
// Colonnes marquées comme 'data-hidden'
const hiddenTargets = []; const hiddenTargets = [];
$table.find('thead th').each((idx, th) => { $table.find('thead th').each((idx, th) => {
if ($(th).data('hidden')) hiddenTargets.push(idx); if ($(th).data('hidden')) hiddenTargets.push(idx);
}); });
// Configuration des boutons avec le titre dynamique // Configuration des boutons avec Titre ET Message de haut de page
const exportButtons = [ const exportButtons = [
{ extend: 'copy', title: titreDoc }, {
{ extend: 'csv', title: titreDoc }, extend: 'excel',
{ extend: 'excel', title: titreDoc }, title: titreDoc,
{ extend: 'pdf', title: titreDoc }, messageTop: message // Ajoute les infos en haut de l'Excel
{ extend: 'print', title: titreDoc } },
{
extend: 'pdf',
title: titreDoc,
messageTop: message, // Ajoute les infos en haut du PDF
orientation: 'landscape'
},
{
extend: 'print',
title: titreDoc,
messageTop: message // Ajoute les infos sur l'impression
}
]; ];
const instance = $table.DataTable($.extend(true, { const instance = $table.DataTable($.extend(true, {
@ -411,10 +421,9 @@ function appliquerDataTable(selector = '.tabliste', options = {}, titreDoc = "Ra
language: translations[codeLangue] || translations.fr_FR, language: translations[codeLangue] || translations.fr_FR,
columnDefs: [{ targets: hiddenTargets, visible: false }], columnDefs: [{ targets: hiddenTargets, visible: false }],
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: exportButtons // Utilisation des boutons configurés buttons: exportButtons
}, options)); }, options));
// Ajustement après rendu
$table.on('init.dt', function () { $table.on('init.dt', function () {
if (instance && instance.responsive) { if (instance && instance.responsive) {
instance.columns.adjust(); instance.columns.adjust();

View File

@ -1,7 +1,5 @@
<?php <?php
$titre = est_anglophone() $titre = 'Historique des Avenants';
? 'History of Endorsements'
: 'Historique des Avenants';
?> ?>
<div id="div_avenant" class="card shadow-sm border-0 mb-4 animate__animated animate__fadeIn"> <div id="div_avenant" class="card shadow-sm border-0 mb-4 animate__animated animate__fadeIn">
@ -91,11 +89,19 @@
</div> </div>
</div> </div>
</div> </div>
<script>
// Exécution au chargement complet du DOM
document.addEventListener("DOMContentLoaded", function() {
// Initialisation des composants au chargement de la page
appliquerDataTable('.tabliste', {}, "<?= mb_strtoupper($titre, 'UTF-8'); ?>");
});
<script>
document.addEventListener("DOMContentLoaded", function() {
// Préparation du titre
const titre = "<?= mb_strtoupper($titre, 'UTF-8'); ?>";
// Préparation du bloc d'informations (Le \n sert pour le retour à la ligne dans Excel/PDF)
const infosComplementaires =
"<?= _('Souscripteur').' : '.$_SESSION['nomClient_C'] ?>\n" +
"<?= _('Numéro Police').' : '.$_SESSION['numeroPolice_C'] ?>\n" +
"<?= _('Période couverte').' : '.dateLang($sppoliceentete['dateEffet'], $_SESSION['lang']) ?> <?= _('au') ?> <?= dateLang($sppoliceentete['dateEcheance'], $_SESSION['lang']) ?>";
// Appel de la fonction
appliquerDataTable('.tabliste', {}, titre, infosComplementaires);
});
</script> </script>