From 7d301a619a1c47f978bc4ee4950a6be5d48b562b Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Fri, 6 Mar 2026 10:23:11 +0000 Subject: [PATCH] df --- Js/fonctions.js | 107 +++++++++++------- .../affichergarantieproduitcons.php | 99 +++++++++++----- 2 files changed, 136 insertions(+), 70 deletions(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index d1bac52d..f97c722c 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -34356,53 +34356,76 @@ 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(); - $("#codeGcAssureur").focus(); - - $('#div_garantieproduit').html(""); - - return; - } + // 2. Validation du Garant + if (!codeGcAssureur || codeGcAssureur.trim() === "") { + Swal.fire({ + icon: 'warning', + title: '', + text: '', + confirmButtonColor: '#212e53' + }); + $("#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() === "") { + Swal.fire({ + icon: 'warning', + title: '', + text: '', + confirmButtonColor: '#212e53' + }); + div_attente.html(""); + return; + } - donnees = 'codeGcAssureur='+codeGcAssureur+'&codeProduit='+codeProduit; + // 4. Préparation des données et affichage du loader + const donnees = { + codeGcAssureur: codeGcAssureur, + codeProduit: codeProduit + }; - var div_attente = $('#div_garantieproduit'); - - div_attente.html('
' + '
'); + div_attente.html(` +
+
+

${''}

+
+ `); - $.ajax({ - url: $("#racineWeb").val()+"Ajaxparamseuilalerte/affichergarantieproduitcons/", - type : 'post', - data: donnees, - error: function(errorData) { - }, - success: function(data) { - div_attente.html(data); - }, - complete: function() { - } - }); + // 5. Appel AJAX + $.ajax({ + url: racineWeb + "Ajaxparamseuilalerte/affichergarantieproduitcons/", + type: 'post', + data: donnees, + success: function(data) { + // Injection du contenu + div_attente.html(data); + + // INITIALISATION DATATABLE (L'ID du tableau dans votre retour Ajax doit être #tableSeuils) + setTimeout(function() { + // On récupère le nom du garant pour le titre de l'export + const nomGarant = $("#codeGcAssureur option:selected").text(); + initSmartTable('#tableSeuils', 'Seuils d\'alerte - ' + nomGarant); + }, 150); + }, + error: function() { + div_attente.html(` +
+ + ${''} +
+ `); + } + }); } function afficher_garantie_produit() diff --git a/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php b/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php index 39b3d3dd..332811e0 100755 --- a/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php +++ b/Vue/Ajaxparamseuilalerte/affichergarantieproduitcons.php @@ -1,31 +1,74 @@ - - - - - - - - - - - - - +
+
+
+
+ + + + + + + + + + - - - - + + + + - - - - - - -
+ + + +
nettoyer($garanties_avec_seuil['garantie']) ?>
+ nettoyer($garanties_avec_seuil['garantie']) ?> +
+ + + % + + + + +
+ FCFA +
+ + + + + + + + + + + +