diff --git a/Js/fonctions.js b/Js/fonctions.js
index f97c722c..b1dd14cb 100755
--- a/Js/fonctions.js
+++ b/Js/fonctions.js
@@ -47,7 +47,6 @@ function alert_ebene(p_msg, p_msg_eng) {
});
}
-
function confirm_ebene(p_msg, p_msg_eng) {
// Récupération de la langue sélectionnée
let codeLangue = $("#codeLangue").val();
@@ -34428,99 +34427,125 @@ 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();
- $("#codeGcAssureur").focus();
-
- $('#div_garantieproduit').html("");
-
- return;
- }
+ // 2. Validation du Garant (avec SweetAlert2)
+ if (!codeGcAssureur || codeGcAssureur.trim() === "") {
+ Swal.fire({
+ icon: 'warning',
+ title: '= _("Garant manquant") ?>',
+ text: '= _("Veuillez sélectionner un garant pour continuer.") ?>',
+ confirmButtonColor: '#212e53'
+ });
+ $("#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
+ if (!codeProduit || codeProduit.trim() === "") {
+ Swal.fire({
+ icon: 'warning',
+ title: '= _("Produit manquant") ?>',
+ text: '= _("Veuillez sélectionner un produit !") ?>',
+ confirmButtonColor: '#212e53'
+ });
+ div_cible.html("");
+ return;
+ }
- var div_attente = $('#div_garantieproduit');
-
- div_attente.html('
' + '
');
+ // 4. Préparation des paramètres et affichage du loader "Ghost"
+ const donnees = { codeProduit: codeProduit };
- $.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...
+
+
${'= _("Chargement du formulaire de saisie...") ?>'}
+
+ `);
+
+ // 5. Exécution de la requête AJAX
+ $.ajax({
+ url: racineWeb + "Ajaxparamseuilalerte/affichergarantieproduit/",
+ type: 'post',
+ data: donnees,
+ success: function(data) {
+ // Injection du contenu (Tableau avec inputs de modification)
+ div_cible.html(data);
+
+ // INITIALISATION DATATABLE
+ // On utilise l'ID #tableSeuilsModif qui doit être présent dans le retour AJAX
+ setTimeout(function() {
+ const nomProduit = $("#codeProduit option:selected").text();
+ initSmartTable('#tableSeuilsModif', 'Modif Seuils - ' + nomProduit);
+ }, 150);
+ },
+ error: function() {
+ div_cible.html(`
+
+
+
${'= _("Erreur technique lors de la récupération du formulaire.") ?>'}
+
+ `);
+ }
+ });
}
-function ajouter_tous_garantie_produit()
-{
- codeProduit=$("#codeProduit").val();
+function ajouter_tous_garantie_produit() {
+ const codeProduit = $("#codeProduit").val();
+ const racineWeb = $("#racineWeb").val();
+ const codeLangue = $("#codeLangue").val();
- if (codeProduit<=" ")
- {
- v_msg="Veuillez sélectionner un produit!";
- v_msgEng="Please select a category!";
- alert_ebene(v_msg, v_msgEng);
+ // 1. Validation de sécurité (Messages manuels selon la langue)
+ if (!codeProduit || codeProduit.trim() === "") {
+ let v_err = (codeLangue === "en_US") ? "Please select a product!" : "Veuillez sélectionner un produit !";
+ toastr.warning(v_err);
+ return;
+ }
- return;
- }
+ // 2. Définition des messages pour confirm_ebene
+ let v_msg = "Confirmez-vous l'ajout de toutes les garanties ?";
+ let v_msgEng = "Do you confirm the addition of all guarantees?";
- donnees = 'codeProduit='+codeProduit;
+ // 3. Appel de votre fonction de confirmation personnalisée
+ confirm_ebene(v_msg, v_msgEng).then((isConfirmed) => {
+ if (isConfirmed) {
+
+ // Affichage d'un indicateur de traitement (Loading)
+ Swal.showLoading();
- v_msg="Confirmez-vous cette opération?";
- v_msgEng="Do you confirm this operation?";
-
-
- confirm_ebene(v_msg, v_msgEng)
- .then((isConfirmed) => {
- if (isConfirmed) {
- // L'utilisateur a confirmé
- $.ajax({
- url: $("#racineWeb").val()+"Ajaxparamseuilalerte/ajoutertousgarantieproduit/",
- type: 'POST',
- data: donnees,
- success: function(data) {
- },
- error: function(data) {
- },
- complete: function() {
- afficher_garantie_produit();
- }
- });
- } else {
- // L'utilisateur a annulé
- console.log("Confirmation refusée");
- }
- });
-
+ $.ajax({
+ url: racineWeb + "Ajaxparamseuilalerte/ajoutertousgarantieproduit/",
+ type: 'POST',
+ data: { codeProduit: codeProduit },
+ success: function(data) {
+ // Notification discrète de succès
+ let v_suc = (codeLangue === "en_US") ? "Operation successful" : "Opération réussie";
+ toastr.success(v_suc);
+ },
+ error: function() {
+ let v_err_ajax = (codeLangue === "en_US") ? "Server error" : "Erreur serveur";
+ toastr.error(v_err_ajax);
+ },
+ complete: function() {
+ // 4. Rafraîchissement automatique de la vue
+ afficher_garantie_produit();
+ }
+ });
+ }
+ });
}
+
+
function retirer_tous_garantie_produit()
{
codeProduit=$("#codeProduit").val();
@@ -46244,7 +46269,7 @@ $(function(){
afficher_bareme_produit();
}
- }else if($('#nomForm').val()=="modifierseuilalerte"){
+ }/*else if($('#nomForm').val()=="modifierseuilalerte"){
codeGcAssureur = $("#codeGcAssureur").val();
codeProduit = $("#codeProduit").val();
@@ -46252,7 +46277,7 @@ $(function(){
afficher_garantie_produit();
}
- }else if($('#nomForm').val()=="Paramfacproduit"){
+ }*/else if($('#nomForm').val()=="Paramfacproduit"){
codeProduit = $("#codeProduit").val();
if(codeProduit > ""){
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 @@
-
-
-
-
-
-
- | = _("Garantie") ?> |
- => |
-
+
+
+
+
+
+
+
+
-
- | |
-
-
-
+
+
+
+
+ | = _("Libellé Garantie") ?> |
+ = _("Action") ?> |
+
+
+
+
+
+ | = $this->nettoyer($v['garantie']) ?> |
+
+
+ |
+
+
+
+
+
+
+
-
-
-
- | = $this->nettoyer($garanties_sans_seuil['garantie']) ?> |
- |
-
-
-
-
-
+
+
+
-
-
-
-
-
-
- | <= |
- = _("Garantie") ?> |
- = _("Seuil") ?> |
-
-
-
- | = _("Taux") ?> |
- = _("Forfait") ?> |
-
-
-
- | |
-
-
-
+
+
+
+
-
-
-
- | |
-
- = $this->nettoyer($garanties_avec_seuil['garantie']) ?> |
+
\ No newline at end of file
diff --git a/Vue/Modifparamseuilalerte/index.php b/Vue/Modifparamseuilalerte/index.php
index 8520a25d..71e2425a 100755
--- a/Vue/Modifparamseuilalerte/index.php
+++ b/Vue/Modifparamseuilalerte/index.php
@@ -1,45 +1,59 @@
-titre = "INTER SANTE - Seuil alerte consommation";
+
+
-
+
+
+
+
+
+
+
+
+
= _("Sélectionnez un couple Garant/Produit pour modifier les seuils") ?>
+
+
+
+
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file