From 3512c096efa1cb058e68b8bd871dc305d0baa2ab Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Fri, 13 Mar 2026 14:13:36 +0000 Subject: [PATCH] val --- Js/fonctions.js | 110 +++++++++++------- .../affichergarantieproduitcons.php | 98 +++++++++++----- 2 files changed, 135 insertions(+), 73 deletions(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index f95dfedd..b94d19b4 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -34359,58 +34359,78 @@ function maj_duree_vie_bon(idTypebon, dureeVie) }); } -function afficher_garantie_produit_cons() -{ - - - 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_cons() { + // 1. Récupération des valeurs + const codeGcAssureur = $("#codeGcAssureur").val(); + const codeProduit = $("#codeProduit").val(); + const div_attente = $('#div_garantieproduit'); + const racineWeb = $("#racineWeb").val(); + const codeLangue = $("#codeLangue").val(); - $("#codeGcAssureur").focus(); - - $('#div_garantieproduit').html(""); - - return; - } + // 2. Validation du Garant + if (!codeGcAssureur || codeGcAssureur.trim() === "") { + let v_msg = "Veuillez sélectionner un garant !"; + let v_msg_eng = "Please select a guarantor!"; + + alert_ebene(v_msg, v_msg_eng); + + $("#codeGcAssureur").focus(); + div_attente.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; - } + // 3. Validation du Produit + if (!codeProduit || codeProduit.trim() === "") { + let v_msg = "Veuillez sélectionner un produit !"; + let v_msg_eng = "Please select a product!"; + + alert_ebene(v_msg, v_msg_eng); + + div_attente.html(""); + return; + } - donnees = 'codeGcAssureur='+codeGcAssureur+'&codeProduit='+codeProduit; + // 4. Préparation des données et affichage du loader (Texte bilingue manuel) + const donnees = { + codeGcAssureur: codeGcAssureur, + codeProduit: codeProduit + }; - var div_attente = $('#div_garantieproduit'); - - div_attente.html('
' + '
'); + let loadingTxt = (codeLangue === "en_US") ? "Loading guarantees..." : "Chargement des garanties..."; - $.ajax({ - url: $("#racineWeb").val()+"Ajaxparamseuilalerte/affichergarantieproduitcons/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - div_attente.html(data); - }, - complete: function() { - } - }); + div_attente.html(` +
+
+

${loadingTxt}

+
+ `); + + // 5. Appel AJAX + $.ajax({ + url: racineWeb + "Ajaxparamseuilalerte/affichergarantieproduitcons/", + type: 'post', + data: donnees, + success: function(data) { + div_attente.html(data); + + // INITIALISATION DATATABLE + setTimeout(function() { + const nomGarant = $("#codeGcAssureur option:selected").text(); + initSmartTable('#tableSeuils', 'Seuils d\'alerte - ' + nomGarant); + }, 150); + }, + error: function() { + let errorTxt = (codeLangue === "en_US") ? "Error retrieving data." : "Erreur lors de la récupération des données."; + div_attente.html(` +
+ ${errorTxt} +
+ `); + } + }); } + function afficher_garantie_produit() { codeGcAssureur =$("#codeGcAssureur").val(); diff --git a/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php b/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php index 39b3d3dd..7f874ab3 100755 --- a/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php +++ b/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php @@ -1,31 +1,73 @@ - - - - - - - - - - - - - +
+
+
+
+ + + + + + + + + + - - - - + + + + - - - - - - -
+ + + +
nettoyer($garanties_avec_seuil['garantie']) ?>
+ nettoyer($garanties_avec_seuil['garantie']) ?> +
+ + + % + + + + +
+ FCFA +
+ + + + + + + + + + + \ No newline at end of file