From 2e60c7fc518f4520f3765fb0cc94b93d9a38dbcd Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Mon, 19 Jan 2026 18:11:21 +0000 Subject: [PATCH] freer --- Js/fonctions.js | 59 ++++++++++++++++++++++++++++--------------------- Vue/gabarit.php | 2 +- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index dbb24ce..d316e21 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -385,7 +385,8 @@ function dataTableSpeciale() { // Détruire l'instance existante si elle existe if ($.fn.DataTable.isDataTable($table)) { $table.DataTable().clear().destroy(); - $table.empty(); // Optionnel : vider le contenu si nécessaire + // ⚠️ Ne pas vider le contenu, sinon tu perds / + // $table.empty(); } // Définition des traductions @@ -421,11 +422,10 @@ function dataTableSpeciale() { }; // Définition des lengthMenu selon la langue - const lengthMenuOptions = (codeLangue === "en_US") ? [20, 50, 100] : [20, 50, 100]; + const lengthMenuOptions = [20, 50, 100]; try { - $table.DataTable({ - destroy: true, + const dt = $table.DataTable({ responsive: true, lengthMenu: lengthMenuOptions, scrollX: true, @@ -440,7 +440,7 @@ function dataTableSpeciale() { }); // Ajuster les colonnes après init - $table.DataTable().columns.adjust().draw(); + dt.columns.adjust().draw(); } catch (err) { console.error("Erreur DataTable:", err); @@ -1521,18 +1521,18 @@ function enregistrer_avenant() function pop_afficher_selection_retrait() { - var div_selection_assure = $('#div_selection_assure'); - + const div_selection_assure = $('#div_selection_assure'); + // 1. Affichage du Loader div_selection_assure.html(` -
-
- Loading... +
+
+ Loading... +
+ + Chargement de la liste... / Loading list... +
- - Chargement de la liste... / Loading list... - -
`); // 2. Appel Ajax @@ -1542,7 +1542,9 @@ function pop_afficher_selection_retrait() { error: function(xhr, status, error) { div_selection_assure.html(`
- Erreur lors du chargement : ${error} + + Erreur lors du chargement : ${error} +
${xhr.responseText || ''}
`); }, @@ -1550,21 +1552,28 @@ function pop_afficher_selection_retrait() { // Injection des données div_selection_assure.html(data); - // 3. INITIALISATION DU DATATABLE GÉNÉRIQUE - dataTableSpeciale(); + // 3. Initialisation du DataTable si la table existe + const $table = div_selection_assure.find('.tabspeciale'); + if ($table.length > 0 && $table.find('thead th').length > 0) { + try { + dataTableSpeciale(); + } catch (err) { + console.error("Erreur DataTable:", err); + } + } else { + console.warn("Table .tabspeciale non trouvée ou mal formée"); + } }, complete: function() { // 4. Gestion propre du Modal const modalEl = document.getElementById("popdetailassure"); - - // S'assurer que le modal est au bon endroit dans le DOM - if (modalEl && modalEl.parentNode !== document.body) { - document.body.appendChild(modalEl); + if (modalEl) { + if (modalEl.parentNode !== document.body) { + document.body.appendChild(modalEl); + } + const myModal = bootstrap.Modal.getOrCreateInstance(modalEl); + myModal.show(); } - - // Ouverture du modal via l'instance Bootstrap - var myModal = bootstrap.Modal.getOrCreateInstance(modalEl); - myModal.show(); } }); } diff --git a/Vue/gabarit.php b/Vue/gabarit.php index d8617c9..b1ca870 100755 --- a/Vue/gabarit.php +++ b/Vue/gabarit.php @@ -654,7 +654,7 @@ $photoAssureCrypte = $_SESSION['photoAssureCrypte']; - +