This commit is contained in:
KONE SOREL 2026-03-06 11:13:34 +00:00
parent 89bd62a45c
commit 1fef0ddb6d

View File

@ -34544,110 +34544,116 @@ function ajouter_tous_garantie_produit() {
}); });
} }
function retirer_tous_garantie_produit() {
const codeProduit = $("#codeProduit").val();
const racineWeb = $("#racineWeb").val();
const codeLangue = $("#codeLangue").val();
// 1. Validation de sécurité
if (!codeProduit || codeProduit.trim() === "") {
let v_err = (codeLangue === "en_US") ? "Please select a product first!" : "Veuillez d'abord sélectionner un produit !";
toastr.info(v_err);
return;
}
function retirer_tous_garantie_produit() // 2. Définition des messages d'avertissement (Action destructive)
{ let v_msg = "Attention ! Confirmez-vous le retrait de TOUTES les garanties avec seuil ?";
codeProduit=$("#codeProduit").val(); let v_msgEng = "Warning ! Do you confirm the removal of ALL guarantees with thresholds?";
if (codeProduit<=" ") // 3. Appel de votre fonction de confirmation bilingue
{ confirm_ebene(v_msg, v_msgEng).then((isConfirmed) => {
v_msg="Veuillez sélectionner un produit!"; if (isConfirmed) {
v_msgEng="Please select a category!";
alert_ebene(v_msg, v_msgEng); // Transformation de la modale en loader pendant le traitement
Swal.showLoading();
return; $.ajax({
} url: racineWeb + "Ajaxparamseuilalerte/retirertousgarantieproduit/",
type: 'POST',
donnees = 'codeProduit='+codeProduit; data: { codeProduit: codeProduit },
success: function(data) {
v_msg="Confirmez-vous cette opération?"; let v_suc = (codeLangue === "en_US") ? "All thresholds removed" : "Tous les seuils ont été retirés";
v_msgEng="Do you confirm this operation?"; toastr.success(v_suc);
},
error: function() {
confirm_ebene(v_msg, v_msgEng) let v_err_ajax = (codeLangue === "en_US") ? "An error occurred" : "Une erreur est survenue";
.then((isConfirmed) => { toastr.error(v_err_ajax);
if (isConfirmed) { },
// L'utilisateur a confirmé complete: function() {
$.ajax({ // 4. Rafraîchissement automatique de la vue (Refresh Dual List)
url: $("#racineWeb").val()+"Ajaxparamseuilalerte/retirertousgarantieproduit/", afficher_garantie_produit();
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");
}
});
} }
function retirer_un_garantie_produit(id_garantie_produit) function retirer_un_garantie_produit(id_garantie_produit) {
{ const codeProduit = $("#codeProduit").val();
codeProduit=$("#codeProduit").val(); const racineWeb = $("#racineWeb").val();
const codeLangue = $("#codeLangue").val();
if (codeProduit<=" ") if (!codeProduit || codeProduit.trim() === "") {
{ let v_err = (codeLangue === "en_US") ? "Please select a product!" : "Veuillez sélectionner un produit !";
v_msg="Veuillez sélectionner un produit!"; toastr.warning(v_err);
v_msgEng="Please select a category!"; return;
alert_ebene(v_msg, v_msgEng); }
return; const donnees = {
} codeProduit: codeProduit,
idGarantieProduit: id_garantie_produit
};
donnees = 'codeProduit='+codeProduit+'&idGarantieProduit='+id_garantie_produit; $.ajax({
url: racineWeb + "Ajaxparamseuilalerte/retirerungarantieproduit/",
$.ajax({ type: 'POST',
url: $("#racineWeb").val()+"Ajaxparamseuilalerte/retirerungarantieproduit/", data: donnees,
type: 'POST', success: function(data) {
data: donnees, let v_suc = (codeLangue === "en_US") ? "Guarantee removed" : "Garantie retirée";
success: function(data) { toastr.info(v_suc); // Utilisation de .info (bleu) pour le retrait
}, },
error: function(data) { error: function() {
}, let v_err_ajax = (codeLangue === "en_US") ? "Error" : "Erreur lors du retrait";
complete: function() { toastr.error(v_err_ajax);
afficher_garantie_produit(); },
} complete: function() {
}); afficher_garantie_produit();
}
});
} }
function ajouter_un_garantie_produit(codeGarantie) function ajouter_un_garantie_produit(codeGarantie) {
{ const codeProduit = $("#codeProduit").val();
const racineWeb = $("#racineWeb").val();
const codeLangue = $("#codeLangue").val();
codeProduit=$("#codeProduit").val();
if (codeProduit<=" ") if (!codeProduit || codeProduit.trim() === "") {
{ let v_err = (codeLangue === "en_US") ? "Please select a product!" : "Veuillez sélectionner un produit !";
v_msg="Veuillez sélectionner un produit!"; toastr.warning(v_err);
v_msgEng="Please select a category!"; return;
alert_ebene(v_msg, v_msgEng); }
return; const donnees = {
} codeProduit: codeProduit,
codeGarantie: codeGarantie
};
donnees = 'codeProduit='+codeProduit+'&codeGarantie='+codeGarantie; $.ajax({
url: racineWeb + "Ajaxparamseuilalerte/ajouterungarantieproduit/",
$.ajax({ type: 'POST',
url: $("#racineWeb").val()+"Ajaxparamseuilalerte/ajouterungarantieproduit/", data: donnees,
type: 'POST', success: function(data) {
data: donnees, let v_suc = (codeLangue === "en_US") ? "Guarantee added" : "Garantie ajoutée";
success: function(data) { toastr.success(v_suc);
// $('#div_test_gabarit').html(data); },
}, error: function() {
error: function(data) { let v_err_ajax = (codeLangue === "en_US") ? "Error" : "Erreur lors de l'ajout";
}, toastr.error(v_err_ajax);
complete: function() { },
afficher_garantie_produit(); complete: function() {
} afficher_garantie_produit();
}); }
});
} }
function maj_taux_seuil_alerte_garantie(id_garantie_produit, tauxSeuilAlerte) function maj_taux_seuil_alerte_garantie(id_garantie_produit, tauxSeuilAlerte)