Correction des erreurs dans console

This commit is contained in:
KONE SOREL 2025-12-26 12:37:54 +00:00
parent bb125ffb6c
commit c6f3128faf
3 changed files with 27 additions and 12 deletions

View File

@ -52,7 +52,12 @@ function connexion_cookie() {
$(function() { $(function() {
// 1. Initialisation des composants au chargement de la page // 1. Initialisation des composants au chargement de la page
appliquerDataTable(); appliquerDataTable('#claimsTable', {
order: [[1, "asc"]], // tri sur la 2e colonne
buttons: ['excel', 'pdf'], // seulement export Excel et PDF
pageLength: 25 // 25 lignes par page
});
// 2. Lancement du cycle de rafraîchissement automatique // 2. Lancement du cycle de rafraîchissement automatique
const vueActuelle = $("#vue").val(); const vueActuelle = $("#vue").val();
@ -83,7 +88,7 @@ function raffraichier_gabarit() {
success: function(data) { success: function(data) {
// Injection du nouveau contenu // Injection du nouveau contenu
debugger; debugger;
$("#div_ajaxgabarit").html(data); $("#div_ajaxgabarit").html(data);
const codeSociete = $("#codeSociete").val(); const codeSociete = $("#codeSociete").val();
@ -325,10 +330,14 @@ function changer_langue_connexion() {
/** /**
* CONFIGURATION DATATABLES * CONFIGURATION DATATABLES
* Initialise les tableaux avec exports, filtres et traductions. * Initialise un tableau DataTable avec options génériques.
*
* @param {string|jQuery} selector - Sélecteur du tableau (ex: '.tabliste' ou '#myTable')
* @param {object} options - Options personnalisées (langue, boutons, ordre, etc.)
*/ */
function appliquerDataTable() { function appliquerDataTable(selector = '.tabliste', options = {}) {
const codeLangue = $("#codeLangue").val() || 'fr_FR'; const codeLangue = $("#codeLangue").val() || 'fr_FR';
const translations = { const translations = {
fr_FR: { fr_FR: {
lengthMenu: "Affiche _MENU_ par page", lengthMenu: "Affiche _MENU_ par page",
@ -346,15 +355,16 @@ function appliquerDataTable() {
} }
}; };
$('.tabliste').each(function() { $(selector).each(function() {
const $table = $(this); const $table = $(this);
// On récupère les colonnes marquées comme 'data-hidden'
// 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);
}); });
const instance = $table.DataTable({ const instance = $table.DataTable($.extend(true, {
destroy: true, destroy: true,
responsive: true, responsive: true,
order: [[0, "desc"]], order: [[0, "desc"]],
@ -362,10 +372,15 @@ function appliquerDataTable() {
columnDefs: [{ targets: hiddenTargets, visible: false }], columnDefs: [{ targets: hiddenTargets, visible: false }],
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print'] buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
}); }, options));
// Ajustement forcé après rendu pour éviter les problèmes de colonnes mal alignées // Ajustement après rendu
setTimeout(() => instance.columns.adjust().responsive.recalc(), 100); $table.on('init.dt', function () {
if (instance && instance.responsive) {
instance.columns.adjust();
instance.responsive.recalc();
}
});
}); });
} }

View File

@ -616,7 +616,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.06"></script> <script src="/Js/fonctions.js?ver=2025.12.25.07"></script>
<?php if (est_anglophone()): ?> <?php if (est_anglophone()): ?>
<script src="/Js/datepicker-eng.js"></script> <script src="/Js/datepicker-eng.js"></script>

View File

@ -14,7 +14,7 @@
"icons": [ "icons": [
{ {
"src": "/Bootstrap_new/images/new/favicon.png", "src": "/Bootstrap_new/images/new/favicon.png",
"sizes": "72x72 96x96 128x128 144x144 152x152 192x192 384x384 512x512", "sizes": "48x48 72x72 96x96 128x128 144x144 152x152 192x192 384x384 512x512",
"type": "image/png", "type": "image/png",
"purpose": "any maskable" "purpose": "any maskable"
}, },