diff --git a/Js/fonctions.js b/Js/fonctions.js index 8c6151d3..de2b1eb7 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -34431,53 +34431,74 @@ function afficher_garantie_produit_cons() { } -function afficher_garantie_produit() -{ - codeGcAssureur =$("#codeGcAssureur").val(); - - - if(codeGcAssureur<=" ") - { - v_msg="Veuillez s\u00e9lectionner un garant!"; - v_msgEng="Please select a guarantor!"; - alert_ebene(v_msg, v_msgEng); +function afficher_garantie_produit() { + // 1. Définition des constantes et cibles + const codeGcAssureur = $("#codeGcAssureur").val(); + const codeProduit = $("#codeProduit").val(); + const div_cible = $('#div_garantieproduit'); + const racineWeb = $("#racineWeb").val(); + const codeLangue = $("#codeLangue").val(); - $("#codeGcAssureur").focus(); - - $('#div_garantieproduit').html(""); - - return; - } + // 2. Validation du Garant via alert_ebene + if (!codeGcAssureur || codeGcAssureur.trim() === "") { + let v_msg = "Garant manquant ! Veuillez sélectionner un garant pour continuer."; + let v_msg_eng = "Guarantor missing ! Please select a guarantor to continue."; + + alert_ebene(v_msg, v_msg_eng); + + $("#codeGcAssureur").focus(); + div_cible.html(""); + return; + } - codeProduit=$("#codeProduit").val(); - - if (codeProduit<=" ") - { - v_msg="Veuillez s\u00e9lectionner un produit!"; - v_msgEng="Please select a product!"; - alert_ebene(v_msg, v_msgEng); - - $('#div_garantieproduit').html(""); - return; - } - donnees = 'codeProduit='+codeProduit; + // 3. Validation du Produit via alert_ebene + if (!codeProduit || codeProduit.trim() === "") { + let v_msg = "Produit manquant ! Veuillez sélectionner un produit."; + let v_msg_eng = "Product missing ! Please select a product."; + + alert_ebene(v_msg, v_msg_eng); + + div_cible.html(""); + return; + } - var div_attente = $('#div_garantieproduit'); - - div_attente.html('
' + '
'); + // 4. Préparation et affichage du loader bilingue + const donnees = { codeProduit: codeProduit }; + let loadingTxt = (codeLangue === "en_US") ? "Loading the entry form..." : "Chargement du formulaire de saisie..."; - $.ajax({ - url: $("#racineWeb").val()+"Ajaxparamseuilalerte/affichergarantieproduit/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - div_attente.html(data); - }, - complete: function() { - } - }); + div_cible.html(` +
+
+ Loading... +
+
${loadingTxt}
+
+ `); + + // 5. Exécution de la requête AJAX + $.ajax({ + url: racineWeb + "Ajaxparamseuilalerte/affichergarantieproduit/", + type: 'post', + data: donnees, + success: function(data) { + div_cible.html(data); + + // INITIALISATION DATATABLE + setTimeout(function() { + const nomProduit = $("#codeProduit option:selected").text(); + initSmartTable('#tableSeuilsModif', 'Modif Seuils - ' + nomProduit); + }, 150); + }, + error: function() { + let errorTxt = (codeLangue === "en_US") ? "Technical error while retrieving the form." : "Erreur technique lors de la récupération du formulaire."; + div_cible.html(` + + `); + } + }); } @@ -61146,39 +61167,49 @@ function filtrecollegepolice() }); } -function filtreproduitgarant(){ - // - - var codeGcAssureur = $('#codeGcAssureur').val(); - - var codeGcAssureur = $('#codeGcAssureur').val(); - - - donnees = 'codeGcAssureur='+codeGcAssureur; - - if(codeGcAssureur !=""){ - $.ajax({ - url: $("#racineWeb").val()+"Ajaxfiltreproduitgarant/", - type : 'post', - data: donnees, - error: function(errorData){ - //alert("Erreur : "+errorData); - }, - success: function(data) { - //alert("Success : "+data); - // - $('#div_produit').html(data); - $("#codeProduit").selectpicker(); - }, - complete: function() { - - } - }); - - - } +function filtreproduitgarant() { + const codeGcAssureur = $('#codeGcAssureur').val(); + const racineWeb = $("#racineWeb").val(); + const $container = $('#div_produit'); + + if (codeGcAssureur !== "") { + // 1. Feedback visuel Neutral Pro : On vide et on met un spinner + $container.html(` +
+
+ ${(typeof codeLangue !== 'undefined' && codeLangue === "en_US") ? "Loading products..." : "Chargement des produits..."} +
+ `); + + $.ajax({ + url: racineWeb + "Ajaxfiltreproduitgarant/", + type: 'POST', + data: { codeGcAssureur: codeGcAssureur }, // Utilisation d'un objet (plus propre) + success: function(data) { + // 2. Injection des données + $container.html(data); + + // 3. Réinitialisation du SelectPicker (si vous l'utilisez toujours) + if ($.fn.selectpicker) { + $("#codeProduit").selectpicker('refresh'); + } + }, + error: function(xhr, status, error) { + console.error("Erreur Filtre Produit:", error); + $container.html(` +
+ Erreur de chargement +
+ `); + } + }); + } else { + // Si aucun garant n'est sélectionné, on peut vider ou réinitialiser le champ produit + $container.html(''); + } } + function afficher_adherent_bascule() { codeGcAssureur = $('#codeGcAssureur').val(); diff --git a/Vue/Ajaxparamseuilalerte/affichergarantieproduit.php b/Vue/Ajaxparamseuilalerte/affichergarantieproduit.php index 8214501f..012d128a 100755 --- a/Vue/Ajaxparamseuilalerte/affichergarantieproduit.php +++ b/Vue/Ajaxparamseuilalerte/affichergarantieproduit.php @@ -1,79 +1,117 @@ -
-
- - - - - - - +
+
+
+
+
+ +
+ +
+ +
+ +
-
- - - - +
+
=>
+ + + + + + + + + + + + + + +
nettoyer($v['garantie']) ?> + +
+
+
+ - - - - nettoyer($garanties_sans_seuil['garantie']) ?> - - - - - - +
+
+
+
+ +
+ +
-
- - - - - - - - - - - - - - - - - - - - +
+
<=
+ + + + + + + + + + + + + + + + + + +
#
+ + nettoyer($v['garantie']) ?> +
+ + +
+
+
+ + CFA +
+
+
+
+
+ - - - - - - nettoyer($garanties_avec_seuil['garantie']) ?> + \ No newline at end of file diff --git a/Vue/Paramseuilalerte/index.php b/Vue/Paramseuilalerte/index.php index 4660babf..34e58f56 100755 --- a/Vue/Paramseuilalerte/index.php +++ b/Vue/Paramseuilalerte/index.php @@ -8,7 +8,7 @@

-

+