df
This commit is contained in:
parent
f755b8d377
commit
3c10f27d48
302
Js/fonctions.js
302
Js/fonctions.js
|
|
@ -32041,127 +32041,71 @@ function ajouter_sms_attente_singleton(p_destinataires, p_message)
|
|||
}
|
||||
|
||||
// 2ème fonction à mettre à jour
|
||||
function tester_disponibiliter_sms()
|
||||
{
|
||||
p_destinataires = $("#destinataires").val();
|
||||
if (p_destinataires<=" ")
|
||||
{
|
||||
v_msg="Veuillez saisir un destinataire!";
|
||||
v_msgEng="Please enter a recipient!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
function tester_disponibiliter_sms() {
|
||||
// 1. Récupération des éléments de base
|
||||
const p_destinataires = $("#destinataires").val();
|
||||
const fournisseurSms = $("#fournisseurSms").val();
|
||||
const racineWeb = $("#racineWeb").val();
|
||||
const div_cible = $('#div_test_gabarit');
|
||||
|
||||
$("#destinataires").focus();
|
||||
return;
|
||||
}
|
||||
// 2. Validation du destinataire
|
||||
if (!p_destinataires || p_destinataires.trim() === "") {
|
||||
alert_ebene("Veuillez saisir un destinataire!", "Please enter a recipient!");
|
||||
$("#destinataires").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
p_message = "";
|
||||
|
||||
fournisseurSms = $("#fournisseurSms").val();
|
||||
|
||||
if (fournisseurSms<=" ")
|
||||
{
|
||||
v_msg="Fournisseur de SMS non défini!";
|
||||
v_msgEng="SMS provider not defined!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
return;
|
||||
}
|
||||
// 3. Validation du fournisseur
|
||||
if (!fournisseurSms || fournisseurSms.trim() === "") {
|
||||
alert_ebene("Fournisseur de SMS non défini!", "SMS provider not defined!");
|
||||
return;
|
||||
}
|
||||
|
||||
if(fournisseurSms=="esicia")
|
||||
{
|
||||
p_message = "Fournisseur : esicia ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="blive")
|
||||
{
|
||||
p_message = "Fournisseur : blive ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="hooza")
|
||||
{
|
||||
p_message = "Fournisseur : hooza ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="skysms")
|
||||
{
|
||||
p_message = "Fournisseur : skysms ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="satelcom")
|
||||
{
|
||||
p_message = "Fournisseur : satelcom ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="noah")
|
||||
{
|
||||
p_message = "Fournisseur : noah ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="nerhysms")
|
||||
{
|
||||
p_message = "Fournisseur : nerhysms ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="emisms")
|
||||
{
|
||||
p_message = "Fournisseur : emisms ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="erling")
|
||||
{
|
||||
p_message = "Fournisseur : erling ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="ovh")
|
||||
{
|
||||
p_message = "Fournisseur : ovh ";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="afriksms")
|
||||
{
|
||||
p_message = "Fournisseur : afriksms";
|
||||
}
|
||||
else
|
||||
if(fournisseurSms=="ekotech")
|
||||
{
|
||||
p_message = "Fournisseur : ekotech";
|
||||
}
|
||||
else
|
||||
{
|
||||
v_msg=fournisseurSms+" => Fournisseur de SMS inconnu!";
|
||||
v_msgEng=fournisseurSms+" => Unknown SMS Provider!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
return;
|
||||
}
|
||||
|
||||
donnees = "destinataires="+p_destinataires+"&message="+p_message+"&fournisseurSms="+fournisseurSms;
|
||||
// 4. Mapping des fournisseurs (Remplace les multiples if/else)
|
||||
const fournisseursValides = [
|
||||
"esicia", "blive", "hooza", "skysms", "satelcom", "noah",
|
||||
"nerhysms", "emisms", "erling", "ovh", "afriksms", "ekotech"
|
||||
];
|
||||
|
||||
alert(donnees);
|
||||
if (!fournisseursValides.includes(fournisseurSms)) {
|
||||
alert_ebene(
|
||||
fournisseurSms + " => Fournisseur de SMS inconnu!",
|
||||
fournisseurSms + " => Unknown SMS Provider!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$("#div_test_gabarit").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>');
|
||||
|
||||
$.ajax({
|
||||
url: $("#racineWeb").val()+"Ajaxtesterdisponiblitesms/envoyerlesms/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data)
|
||||
{
|
||||
alert("success "+data);
|
||||
$('#div_test_gabarit').html(data);
|
||||
},
|
||||
error: function(errdata)
|
||||
{
|
||||
alert("Error : "+errdata);
|
||||
$('#div_test_gabarit').html(errdata);
|
||||
},
|
||||
complete: function()
|
||||
{
|
||||
/*
|
||||
v_msg="Opération terminée avec succès!";
|
||||
v_msgEng="Operation completed successfully!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
*/
|
||||
}
|
||||
});
|
||||
// 5. Préparation du message et des données
|
||||
const p_message = "Fournisseur : " + fournisseurSms;
|
||||
const donnees = {
|
||||
destinataires: p_destinataires,
|
||||
message: p_message,
|
||||
fournisseurSms: fournisseurSms
|
||||
};
|
||||
|
||||
// 6. Affichage du loader Neutral Pro
|
||||
div_cible.html(`
|
||||
<div class="text-center p-5">
|
||||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>
|
||||
<p class="mt-3 text-primary fw-bold">Envoi du SMS de test en cours...</p>
|
||||
</div>
|
||||
`);
|
||||
|
||||
// 7. Appel AJAX
|
||||
$.ajax({
|
||||
url: racineWeb + "Ajaxtesterdisponiblitesms/envoyerlesms/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
// Notification discrète de succès (Toast)
|
||||
toastr.success("Demande transmise au serveur");
|
||||
div_cible.html(data);
|
||||
},
|
||||
error: function(err) {
|
||||
toastr.error("Erreur lors de l'envoi");
|
||||
div_cible.html(`<div class="alert alert-danger">Erreur : ${err.statusText}</div>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ajouter_destinataire_sms_adherent(p_destinataires)
|
||||
|
|
@ -88789,78 +88733,74 @@ function enregistrer_modif_param_filtreip()
|
|||
|
||||
}
|
||||
|
||||
function tester_disponibiliter_whatsapp()
|
||||
{
|
||||
p_destinataires = $("#destinataires").val();
|
||||
if (p_destinataires<=" ")
|
||||
{
|
||||
v_msg="Veuillez saisir un destinataire!";
|
||||
v_msgEng="Please enter a recipient!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
function tester_disponibiliter_whatsapp() {
|
||||
// 1. Initialisation des variables
|
||||
const p_destinataires = $("#destinataires").val();
|
||||
const racineWeb = $("#racineWeb").val();
|
||||
const div_cible = $('#div_test_gabarit');
|
||||
const codeLangue = $("#codeLangue").val();
|
||||
|
||||
// On force waapi par défaut selon votre logique actuelle,
|
||||
// mais prêt pour une sélection dynamique si besoin.
|
||||
const fournisseurWhatsApp = 'waapi';
|
||||
|
||||
$("#destinataires").focus();
|
||||
return;
|
||||
}
|
||||
// 2. Validation du destinataire
|
||||
if (!p_destinataires || p_destinataires.trim() === "") {
|
||||
alert_ebene("Veuillez saisir un destinataire!", "Please enter a recipient!");
|
||||
$("#destinataires").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
p_message = "";
|
||||
|
||||
p_message = "TESTS WHATSAPP INTER-SANTE";
|
||||
|
||||
// ajout KANE du 18/02/2025
|
||||
// 3. Validation et mapping du message fournisseur
|
||||
let p_message = "";
|
||||
const providers = {
|
||||
'waapi': 'Fournisseur WhatsApp : waapi',
|
||||
'ultramsg': 'Fournisseur WhatsApp : ultramsg'
|
||||
};
|
||||
|
||||
// fournisseurWhatsApp = $("#fournisseurWhatsApp").val();
|
||||
fournisseurWhatsApp = 'waapi';
|
||||
|
||||
if (fournisseurWhatsApp<=" ")
|
||||
{
|
||||
v_msg="Fournisseur de WhatsApp non défini!";
|
||||
v_msgEng="WhatsApp provider not defined!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
return;
|
||||
}
|
||||
if (providers[fournisseurWhatsApp]) {
|
||||
p_message = providers[fournisseurWhatsApp];
|
||||
} else {
|
||||
alert_ebene(
|
||||
fournisseurWhatsApp + " => Fournisseur de WhatsApp inconnu!",
|
||||
fournisseurWhatsApp + " => Unknown WhatsApp Provider!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if(fournisseurWhatsApp=="waapi")
|
||||
{
|
||||
p_message = "Fournisseur WhatsApp : waapi ";
|
||||
}
|
||||
else
|
||||
if(fournisseurWhatsApp=="ultramsg")
|
||||
{
|
||||
p_message = "Fournisseur WhatsApp : ultramsg ";
|
||||
}
|
||||
else
|
||||
{
|
||||
v_msg=fournisseurWhatsApp+" => Fournisseur de WhatsApp inconnu!";
|
||||
v_msgEng=fournisseurWhatsApp+" => Unknown WhatsApp Provider!";
|
||||
alert_ebene(v_msg, v_msgEng);
|
||||
return;
|
||||
}
|
||||
|
||||
donnees = "destinataires="+p_destinataires+"&message="+p_message+"&fournisseurWhatsApp="+fournisseurWhatsApp;
|
||||
// 4. Préparation des données (Format Objet)
|
||||
const donnees = {
|
||||
destinataires: p_destinataires,
|
||||
message: p_message,
|
||||
fournisseurWhatsApp: fournisseurWhatsApp
|
||||
};
|
||||
|
||||
$("#div_test_gabarit").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>');
|
||||
|
||||
$.ajax({
|
||||
url: $("#racineWeb").val()+"Ajaxtesterdisponiblitesms/envoyerlewhatsapp/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data)
|
||||
{
|
||||
// alert("success "+data);
|
||||
$('#div_test_gabarit').html(data);
|
||||
},
|
||||
error: function(errdata)
|
||||
{
|
||||
// alert("Error : "+errdata);
|
||||
$('#div_test_gabarit').html(errdata);
|
||||
},
|
||||
complete: function()
|
||||
{
|
||||
}
|
||||
});
|
||||
// 5. Affichage du loader stylisé
|
||||
div_cible.html(`
|
||||
<div class="text-center p-5">
|
||||
<div class="spinner-border text-success" role="status" style="width: 3rem; height: 3rem;"></div>
|
||||
<p class="mt-3 text-success fw-bold italic">
|
||||
${(codeLangue === "en_US") ? "Sending WhatsApp message..." : "Envoi du message WhatsApp..."}
|
||||
</p>
|
||||
</div>
|
||||
`);
|
||||
|
||||
// 6. Requête AJAX
|
||||
$.ajax({
|
||||
url: racineWeb + "Ajaxtesterdisponiblitesms/envoyerlewhatsapp/",
|
||||
type: 'POST',
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
toastr.success((codeLangue === "en_US") ? "WhatsApp API called" : "API WhatsApp appelée");
|
||||
div_cible.html(data);
|
||||
},
|
||||
error: function(xhr) {
|
||||
toastr.error((codeLangue === "en_US") ? "Connection error" : "Erreur de connexion");
|
||||
div_cible.html(`<div class="alert alert-danger">Error: ${xhr.statusText}</div>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function parametre_produit()
|
||||
{
|
||||
var codeProduit = $('#codeProduit').val();
|
||||
|
|
|
|||
|
|
@ -1,49 +1,114 @@
|
|||
<?php $this->titre = "INTER SANTE - Autres Paramètres Généraux"; ?>
|
||||
<div class="page-content">
|
||||
<div class="header-section mb-4">
|
||||
<div class="d-flex align-items-center bg-white p-3 shadow-sm border-start border-success border-4" style="border-radius: var(--radius-md);">
|
||||
<div class="icon-shape bg-success-ghost text-success rounded-circle me-3" style="width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;">
|
||||
<i class="fas fa-vial fs-4"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h4 id="titre-page" class="mb-0 fw-bold text-uppercase"><?= _("Test des APIs de Notification") ?></h4>
|
||||
<p class="text-muted small mb-0"><?= _("Vérifiez la disponibilité des services SMS et WhatsApp") ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="sr-only d-none" type="text" id="idSocieteuser" name="idSocieteuser" value="<?= $this->nettoyer($societeuser['idSocieteuser']) ?>" >
|
||||
|
||||
<script type="text/javascript">
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-12">
|
||||
<div class="card border-0 shadow-sm mb-4" style="border-radius: var(--radius-md);">
|
||||
<div class="card-header bg-white border-0 py-3">
|
||||
<h6 class="mb-0 fw-bold text-muted small uppercase"><i class="fas fa-building me-2"></i><?= _("Informations de l'émetteur") ?></h6>
|
||||
</div>
|
||||
<div class="card-body bg-light-subtle">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small fw-bold text-muted"><?= _("Code") ?></label>
|
||||
<input class="form-control bg-white border-0 shadow-none fw-bold" type="text" value="<?= $this->nettoyer($societeuser['codeSociete']) ?>" readonly>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label small fw-bold text-muted"><?= _("Nom de la Société") ?></label>
|
||||
<input class="form-control bg-white border-0 shadow-none fw-bold" type="text" value="<?= $this->nettoyer($societeuser['nomSociete']) ?>" readonly>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small fw-bold text-muted"><?= _("Adresse Géo") ?></label>
|
||||
<input class="form-control bg-white border-0 shadow-none small" type="text" value="<?= $this->nettoyer($societeuser['adresseGeoSociete']) ?>" readonly>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small fw-bold text-muted"><?= _("Adresse Postale") ?></label>
|
||||
<input class="form-control bg-white border-0 shadow-none small" type="text" value="<?= $this->nettoyer($societeuser['adressePostSociete']) ?>" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<input class="sr-only" type="text" id="idSocieteuser" name="idSocieteuser" value="<?= $this->nettoyer($societeuser['idSocieteuser']) ?>" >
|
||||
|
||||
<legend><?= _("Tester l'API D'ENVOI des SMS et WhatsApp")?></legend>
|
||||
|
||||
<table class="table table-responsive table-condensed" style='font-size:9pt;'>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
<td width="10%" >Code</td>
|
||||
<td><INPUT style='font-size:9pt;' class="form-control" TYPE="text" id="codeSociete" NAME="codeSociete" value="<?=$this->nettoyer($societeuser['codeSociete'])?>" readonly></td>
|
||||
|
||||
<td width="10%" align="center"> <?= _("Nom") ?> </td>
|
||||
<td><INPUT style='font-size:9pt;' class="form-control" TYPE="text" id="nomSociete" NAME="nomSociete" value="<?=$this->nettoyer($societeuser['nomSociete'])?>" readonly></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?= _("Adresse Géo") ?></td>
|
||||
<td><INPUT style='font-size:9pt;' class="form-control" TYPE="text" id="adresseGeoSociete" NAME="adresseGeoSociete" value="<?=$this->nettoyer($societeuser['adresseGeoSociete'])?>" readonly></td>
|
||||
|
||||
<td align="center"> <?= _("Adresse Post") ?> </td>
|
||||
<td><INPUT style='font-size:9pt;' class="form-control" TYPE="text" id="adressePostSociete" NAME="adressePostSociete" value="<?=$this->nettoyer($societeuser['adressePostSociete'])?>" readonly></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> <?= _("No Tests SMS") ?> </td>
|
||||
<td><INPUT style='font-size:9pt;' class="form-control" TYPE="text" id="destinataires" NAME="destinataires" ></td>
|
||||
|
||||
<td align="center"> <?= _("Exemple de No") ?> </td>
|
||||
<td><INPUT style='font-size:9pt;' class="form-control" TYPE="text" value="22506802339,250788439348,25761198584" readonly></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='2'> <button style='font-size:10pt;' type="button" class="form-control btn btn-success" onclick="javascript:tester_disponibiliter_whatsapp();"> <?= _("ENVOYER MESSAGE WHATSAPP") ?> </button> </td>
|
||||
<td> </td>
|
||||
<td colspan='2'> <button style='font-size:10pt;' type="button" class="form-control btn btn-primary" onclick="javascript:tester_disponibiliter_sms();"> <?= _("ENVOYER SMS") ?> </button> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col-lg-12">
|
||||
<div class="card border-0 shadow-sm" style="border-radius: var(--radius-md);">
|
||||
<div class="card-header bg-white border-0 py-3">
|
||||
<h6 class="mb-0 fw-bold text-primary"><i class="fas fa-paper-plane me-2"></i><?= _("Configuration de l'envoi de test") ?></h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-4 align-items-end">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label small fw-bold required"><?= _("Numéros de téléphone (Destinataires)") ?></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text bg-light border-2 border-end-0"><i class="fas fa-phone-alt text-muted"></i></span>
|
||||
<input class="form-control border-2 border-start-0 ps-0" type="text" id="destinataires" name="destinataires" placeholder="Ex: 225000000000, 225111111111">
|
||||
</div>
|
||||
<div class="form-text small mt-2">
|
||||
<i class="fas fa-info-circle text-info me-1"></i>
|
||||
<?= _("Séparez les numéros par des virgules. Format international sans le signe +.") ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label small fw-bold text-muted italic"><?= _("Format d'exemple pour référence") ?></label>
|
||||
<input class="form-control border-dashed bg-light small" type="text" value="22506802339, 250788439348, 25761198584" readonly style="border-style: dashed;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer bg-white border-top-0 p-4">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<button type="button" class="btn btn-whatsapp w-100 py-3 fw-bold shadow-sm" onclick="javascript:tester_disponibiliter_whatsapp();">
|
||||
<i class="fab fa-whatsapp me-2 fs-5"></i> <?= _("TESTER L'API WHATSAPP") ?>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<button type="button" class="btn btn-primary w-100 py-3 fw-bold shadow-sm" onclick="javascript:tester_disponibiliter_sms();">
|
||||
<i class="fas fa-sms me-2 fs-5"></i> <?= _("TESTER L'API SMS") ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.bg-success-ghost { background: rgba(40, 167, 69, 0.1) !important; }
|
||||
.border-dashed { border: 1px dashed #dee2e6; }
|
||||
|
||||
/* Bouton spécifique WhatsApp */
|
||||
.btn-whatsapp {
|
||||
background-color: #25D366;
|
||||
color: white;
|
||||
border: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.btn-whatsapp:hover {
|
||||
background-color: #128C7E;
|
||||
color: white;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #212e53;
|
||||
border: none;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background-color: #1a2542;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user