diff --git a/Controleur/ControleurAjaxlisterpolicesclient.php b/Controleur/ControleurAjaxlisterpolicesclient.php new file mode 100644 index 0000000..f39af48 --- /dev/null +++ b/Controleur/ControleurAjaxlisterpolicesclient.php @@ -0,0 +1,20 @@ +police = new Police(); + } + + public function index() + { + $vue = $this->requete->getParametreFormulaire("vue"); + $polices = $this->police->getPoliceRh(); + + $this->genererVueAjax(array('vue' => $vue, 'polices' => $polices)); + } +} \ No newline at end of file diff --git a/Js/fonctions.js b/Js/fonctions.js index fa4af42..31b1231 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -4129,4 +4129,89 @@ function consulterfactureged_pop() complete: function() { } }); +} + +function lister_polices_client(id) { + const vues = { + 1: "Rechercherassure", + 2: "Syntheseconsopolice", + 3: "Sppolice" + }; + + vue = vues[id] || null; // null si id ne correspond à rien + + const modalEl = document.getElementById('pop_police'); + + // On déplace le modal directement sous
s'il n'y est pas déjà. + // Cela permet de passer outre les z-index des conteneurs parents (Sidebar, Header). + if (modalEl.parentElement !== document.body) { + document.body.appendChild(modalEl); + } + + const racine = $("#racineWeb").val() || "/"; + const divPolice = document.getElementById('div_police'); + + /* =================================================== + * Préparation visuelle (Spinner) + * =================================================== */ + showLoader("#div_police", { size: 3 }); + + + /* =================================================== + * Initialisation de l'instance Bootstrap + * =================================================== */ + const modal = bootstrap.Modal.getOrCreateInstance(modalEl, { + backdrop: 'static', + keyboard: false + }); + + /* =================================================== + * Gestion de l'événement d'affichage et AJAX + * =================================================== */ + // On utilise 'shown.bs.modal' pour lancer l'AJAX une fois le modal visible + $(modalEl).one('shown.bs.modal', function () { + $.ajax({ + url: racine + "Ajaxlisterpolicesclient/", + type: 'POST', + data: { vue: vue }, + success: function (data) { + divPolice.innerHTML = data; + }, + error: function (xhr, status, error) { + divPolice.innerHTML = ` +