df
This commit is contained in:
191
Js/fonctions.js
191
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('<div style="padding-top:80px; text-align:center; font-size:14px; color: #0088cf; "><span><i class="fa fa-spinner fa-spin fa-5x" >' + '</span></div>');
|
||||
// 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(`
|
||||
<div class="d-flex flex-column align-items-center justify-content-center p-5">
|
||||
<div class="spinner-grow text-warning" role="status" style="width: 3rem; height: 3rem;">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<h5 class="mt-4 text-warning fw-bold text-uppercase italic">${'<?= _("Chargement du formulaire de saisie...") ?>'}</h5>
|
||||
</div>
|
||||
`);
|
||||
|
||||
// 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(`
|
||||
<div class="alert alert-danger d-flex align-items-center m-3" role="alert">
|
||||
<i class="fas fa-exclamation-triangle me-2"></i>
|
||||
<div>${'<?= _("Erreur technique lors de la récupération du formulaire.") ?>'}</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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 > ""){
|
||||
|
||||
Reference in New Issue
Block a user