This commit is contained in:
2026-03-13 13:50:09 +00:00
parent c6a03abdf3
commit e3a8c97f77
3 changed files with 101 additions and 61 deletions

View File

@@ -92203,4 +92203,44 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
}
return table;
}
function loadMessageSection(section) {
let url = "";
let target = "#content-" + section;
let donnees = "";
// Détermination de l'ID du tableau et du titre pour l'export
let tableId = (section === 'Motifs') ? '#tableMotifs' : '#tableTextes';
let pageTitle = (section === 'Motifs') ? 'Liste des Motifs de Dépassement' : 'Liste des Textes de Facturation';
if (section === 'Motifs') url = $("#racineWeb").val() + "Ajaxmotifdepassement/";
if (section === 'Facturation') url = $("#racineWeb").val() + "Ajaxtextefacturationgarant/";
// Si déjà chargé, on ajuste simplement les colonnes pour le rendu visuel
if ($(target).find('table').length > 0) {
if ($.fn.DataTable.isDataTable(tableId)) {
$(tableId).DataTable().columns.adjust();
}
return;
}
$.ajax({
url: url,
type: 'post',
data: donnees,
success: function(data) {
// 1. Injection du contenu HTML
$(target).html(data);
// 2. Initialisation forcée avec un léger délai pour laisser le DOM respirer
setTimeout(function() {
initSmartTable(tableId, pageTitle, false);
}, 150);
},
error: function() {
$(target).html('<div class="alert alert-danger m-3">Erreur de chargement</div>');
}
});
}