dfg
This commit is contained in:
parent
89bd62a45c
commit
1fef0ddb6d
186
Js/fonctions.js
186
Js/fonctions.js
|
|
@ -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()
|
||||
{
|
||||
codeProduit=$("#codeProduit").val();
|
||||
// 2. Définition des messages d'avertissement (Action destructive)
|
||||
let v_msg = "Attention ! Confirmez-vous le retrait de TOUTES les garanties avec seuil ?";
|
||||
let v_msgEng = "Warning ! Do you confirm the removal of ALL guarantees with thresholds?";
|
||||
|
||||
if (codeProduit<=" ")
|
||||
{
|
||||
v_msg="Veuillez sélectionner un produit!";
|
||||
v_msgEng="Please select a category!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
// 3. Appel de votre fonction de confirmation bilingue
|
||||
confirm_ebene(v_msg, v_msgEng).then((isConfirmed) => {
|
||||
if (isConfirmed) {
|
||||
|
||||
// Transformation de la modale en loader pendant le traitement
|
||||
Swal.showLoading();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
donnees = 'codeProduit='+codeProduit;
|
||||
|
||||
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/retirertousgarantieproduit/",
|
||||
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/retirertousgarantieproduit/",
|
||||
type: 'POST',
|
||||
data: { codeProduit: codeProduit },
|
||||
success: function(data) {
|
||||
let v_suc = (codeLangue === "en_US") ? "All thresholds removed" : "Tous les seuils ont été retirés";
|
||||
toastr.success(v_suc);
|
||||
},
|
||||
error: function() {
|
||||
let v_err_ajax = (codeLangue === "en_US") ? "An error occurred" : "Une erreur est survenue";
|
||||
toastr.error(v_err_ajax);
|
||||
},
|
||||
complete: function() {
|
||||
// 4. Rafraîchissement automatique de la vue (Refresh Dual List)
|
||||
afficher_garantie_produit();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function retirer_un_garantie_produit(id_garantie_produit)
|
||||
{
|
||||
codeProduit=$("#codeProduit").val();
|
||||
function retirer_un_garantie_produit(id_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);
|
||||
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;
|
||||
}
|
||||
const donnees = {
|
||||
codeProduit: codeProduit,
|
||||
idGarantieProduit: id_garantie_produit
|
||||
};
|
||||
|
||||
donnees = 'codeProduit='+codeProduit+'&idGarantieProduit='+id_garantie_produit;
|
||||
|
||||
$.ajax({
|
||||
url: $("#racineWeb").val()+"Ajaxparamseuilalerte/retirerungarantieproduit/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
},
|
||||
error: function(data) {
|
||||
},
|
||||
complete: function() {
|
||||
afficher_garantie_produit();
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: racineWeb + "Ajaxparamseuilalerte/retirerungarantieproduit/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
let v_suc = (codeLangue === "en_US") ? "Guarantee removed" : "Garantie retirée";
|
||||
toastr.info(v_suc); // Utilisation de .info (bleu) pour le retrait
|
||||
},
|
||||
error: function() {
|
||||
let v_err_ajax = (codeLangue === "en_US") ? "Error" : "Erreur lors du retrait";
|
||||
toastr.error(v_err_ajax);
|
||||
},
|
||||
complete: function() {
|
||||
afficher_garantie_produit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ajouter_un_garantie_produit(codeGarantie)
|
||||
{
|
||||
|
||||
|
||||
codeProduit=$("#codeProduit").val();
|
||||
function ajouter_un_garantie_produit(codeGarantie) {
|
||||
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);
|
||||
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;
|
||||
}
|
||||
const donnees = {
|
||||
codeProduit: codeProduit,
|
||||
codeGarantie: codeGarantie
|
||||
};
|
||||
|
||||
donnees = 'codeProduit='+codeProduit+'&codeGarantie='+codeGarantie;
|
||||
|
||||
$.ajax({
|
||||
url: $("#racineWeb").val()+"Ajaxparamseuilalerte/ajouterungarantieproduit/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
// $('#div_test_gabarit').html(data);
|
||||
},
|
||||
error: function(data) {
|
||||
},
|
||||
complete: function() {
|
||||
afficher_garantie_produit();
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: racineWeb + "Ajaxparamseuilalerte/ajouterungarantieproduit/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
let v_suc = (codeLangue === "en_US") ? "Guarantee added" : "Garantie ajoutée";
|
||||
toastr.success(v_suc);
|
||||
},
|
||||
error: function() {
|
||||
let v_err_ajax = (codeLangue === "en_US") ? "Error" : "Erreur lors de l'ajout";
|
||||
toastr.error(v_err_ajax);
|
||||
},
|
||||
complete: function() {
|
||||
afficher_garantie_produit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function maj_taux_seuil_alerte_garantie(id_garantie_produit, tauxSeuilAlerte)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user