drty
This commit is contained in:
parent
c1670cc079
commit
a83322741b
|
|
@ -52325,7 +52325,7 @@ function afficher_bareme_accessoire_garant() {
|
|||
if (!codeGcAssureur) return;
|
||||
|
||||
afficheBoutons(0);
|
||||
|
||||
|
||||
// 1. Feedback visuel (SaaS UX)
|
||||
const loadingMsg = (codeLangue === "en_US") ? "Loading schedule..." : "Chargement du barème...";
|
||||
$divLister.html(`
|
||||
|
|
@ -92312,10 +92312,10 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
|
|||
"search": "",
|
||||
"searchPlaceholder": "Rechercher...",
|
||||
"paginate": {
|
||||
"first": '<i class="fas fa-angle-double-left"></i>',
|
||||
"last": '<i class="fas fa-angle-double-right"></i>',
|
||||
"next": '<i class="fas fa-angle-right"></i>',
|
||||
"previous": '<i class="fas fa-angle-left"></i>'
|
||||
"first": '|◄',
|
||||
"last": '►|',
|
||||
"next": '►',
|
||||
"previous": '◄'
|
||||
}
|
||||
},
|
||||
"pageLength": 10,
|
||||
|
|
@ -92448,75 +92448,83 @@ function changerAnneeFiltre(valeur) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise une DataTable standard pour les tables de référence
|
||||
* Initialise une DataTable standard pour les tables de référence (Version ESI)
|
||||
* @param {string} selector - L'ID ou la classe de la table (ex: '#tableLister')
|
||||
* @param {string} exportTitle - Le nom du fichier lors de l'export
|
||||
* @param {boolean|array} defaultOrder - Exemple: [1, 'desc'] ou false pour garder l'ordre serveur
|
||||
*/
|
||||
function initDataTableReference(selector, exportTitle = 'Export_Donnees', defaultOrder = false) {
|
||||
const codeLangue = $("#codeLangue").val();
|
||||
const isEn = (codeLangue === "en_US");
|
||||
|
||||
// Objet de traduction interne
|
||||
const langConfig = (codeLangue === "en_US") ? {
|
||||
search: "Search:",
|
||||
lengthMenu: "Show _MENU_ entries",
|
||||
info: "Showing _START_ to _END_ of _TOTAL_ entries",
|
||||
infoEmpty: "Showing 0 to 0 of 0 entries",
|
||||
infoFiltered: "(filtered from _MAX_ total entries)",
|
||||
zeroRecords: "No matching records found",
|
||||
paginate: { next: "Next", previous: "Previous" }
|
||||
} : {
|
||||
search: "Recherche :",
|
||||
lengthMenu: "Afficher _MENU_ lignes",
|
||||
info: "Affichage de _START_ à _END_ sur _TOTAL_ lignes",
|
||||
infoEmpty: "Affichage de 0 à 0 sur 0 ligne",
|
||||
infoFiltered: "(filtré de _MAX_ lignes au total)",
|
||||
zeroRecords: "Aucune donnée trouvée",
|
||||
paginate: { next: "Suivant", previous: "Précédent" }
|
||||
// 1. Configuration de la langue avec icônes de pagination
|
||||
const langConfig = {
|
||||
search: "",
|
||||
searchPlaceholder: isEn ? "Search..." : "Rechercher...",
|
||||
lengthMenu: isEn ? "Show _MENU_" : "Afficher _MENU_",
|
||||
info: isEn ? "_START_ to _END_ of _TOTAL_" : "_START_ à _END_ sur _TOTAL_",
|
||||
infoEmpty: "0/0",
|
||||
infoFiltered: isEn ? "(filtered from _MAX_)" : "(filtré de _MAX_)",
|
||||
zeroRecords: isEn ? "No data found" : "Aucune donnée trouvée",
|
||||
paginate: {
|
||||
first: "|◄",
|
||||
last: "►|",
|
||||
next: "►",
|
||||
previous: "◄"
|
||||
}
|
||||
};
|
||||
|
||||
// 2. Nettoyage si instance existante
|
||||
if ($.fn.DataTable.isDataTable(selector)) {
|
||||
$(selector).DataTable().destroy();
|
||||
}
|
||||
|
||||
// Gestion du tri par défaut (false = pas de tri forcé)
|
||||
const orderConfig = (defaultOrder === false) ? [] : defaultOrder;
|
||||
|
||||
// 3. Initialisation
|
||||
const table = $(selector).DataTable({
|
||||
dom: 'frtip',
|
||||
// DOM : B=Buttons, f=Filter (recherche), t=Table, i=Info, p=Pagination
|
||||
dom: '<"d-flex align-items-center justify-content-between p-2 border-bottom"B<"ms-auto"f>>rt<"d-flex justify-content-between align-items-center p-2 bg-light"ip>',
|
||||
responsive: true,
|
||||
pageLength: 10,
|
||||
order: orderConfig, // <-- Application de la configuration de tri
|
||||
pagingType: "full_numbers", // Indispensable pour First/Last
|
||||
order: (defaultOrder === false) ? [] : defaultOrder,
|
||||
language: langConfig,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: '<i class="fas fa-file-excel me-1"></i> Excel',
|
||||
className: 'btn btn-sm btn-success-light border-success fw-bold text-success rounded-pill shadow-xs',
|
||||
className: 'btn btn-sm btn-outline-success fw-bold rounded-pill shadow-sm px-3',
|
||||
title: exportTitle,
|
||||
exportOptions: { columns: ':not(:last-child)' }
|
||||
exportOptions: { columns: ':not(.no-export)' }
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
text: '<i class="fas fa-file-pdf me-1"></i> PDF',
|
||||
className: 'btn btn-sm btn-danger-light border-danger fw-bold text-danger rounded-pill shadow-xs',
|
||||
className: 'btn btn-sm btn-outline-danger fw-bold rounded-pill shadow-sm px-3 ms-2',
|
||||
title: exportTitle,
|
||||
exportOptions: { columns: ':not(:last-child)' },
|
||||
orientation: 'landscape',
|
||||
exportOptions: { columns: ':not(.no-export)' },
|
||||
customize: function (doc) {
|
||||
doc.styles.tableHeader.fillColor = '#212e53';
|
||||
doc.styles.tableHeader.color = 'white';
|
||||
doc.content[1].table.widths = Array(doc.content[1].table.body[0].length + 1).join('*').split('');
|
||||
doc.styles.tableHeader.alignment = 'center';
|
||||
doc.defaultStyle.alignment = 'center';
|
||||
// Force la largeur à 100%
|
||||
doc.content[1].table.widths = Array(doc.content[1].table.body[0].length).fill('*');
|
||||
}
|
||||
}
|
||||
],
|
||||
drawCallback: function() {
|
||||
const info = this.api().page.info();
|
||||
const label = (codeLangue === "en_US") ? " Lines" : " Lignes";
|
||||
$("#badge-total").text(info.recordsTotal + label);
|
||||
// Mise à jour automatique des badges de totalisation si présents
|
||||
const recordsTotal = this.api().page.info().recordsTotal;
|
||||
const label = isEn ? " Lines" : " Lignes";
|
||||
$(".badge-total-count").text(recordsTotal + label);
|
||||
|
||||
// Style des boutons de recherche et pagination
|
||||
$('.dataTables_filter input').addClass('form-control form-control-sm rounded-pill border-primary-subtle px-3').css('width', '200px');
|
||||
$('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1');
|
||||
}
|
||||
});
|
||||
|
||||
table.buttons().container().appendTo('#table-buttons');
|
||||
return table;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user