fg
This commit is contained in:
parent
2794f0f446
commit
1b29761095
|
|
@ -115,5 +115,16 @@ class ControleurAjaxparamseuilalerte extends Controleurrequete
|
|||
|
||||
// $this->genererVueAjax();
|
||||
}
|
||||
|
||||
public function actualisegarantieproduit()
|
||||
{
|
||||
$codeProduit = $this->requete->getParametreFormulaire("codeProduit");
|
||||
|
||||
$garanties_sans_seuils = $this->produit->getgarantiessansseuil($codeProduit);
|
||||
|
||||
$garanties_avec_seuils = $this->produit->getgarantiesavecseuil($codeProduit);
|
||||
|
||||
$this->genererVueAjax(array('garanties_sans_seuils' => $garanties_sans_seuils, 'garanties_avec_seuils' => $garanties_avec_seuils));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34462,7 +34462,6 @@ function afficher_garantie_produit() {
|
|||
|
||||
function ajouter_tous_garantie_produit()
|
||||
{
|
||||
idProduit = $("#idProduit").val();
|
||||
codeProduit = $("#codeProduit").val();
|
||||
|
||||
if (codeProduit<=" ")
|
||||
|
|
@ -34494,7 +34493,6 @@ function ajouter_tous_garantie_produit()
|
|||
},
|
||||
complete: function() {
|
||||
//afficher_garantie_produit();
|
||||
garanties_produit($idProduit);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
@ -34605,7 +34603,7 @@ function ajouter_un_garantie_produit(codeGarantie)
|
|||
},
|
||||
complete: function() {
|
||||
//afficher_garantie_produit();
|
||||
garanties_produit($idProduit);
|
||||
//garanties_produit($idProduit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -92268,3 +92266,66 @@ function nouveau_produit()
|
|||
window.location.assign($("#racineWeb" ).val()+"Nouveauproduit/");
|
||||
}
|
||||
|
||||
function actualiser_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();
|
||||
const codeLangue = $("#codeLangue").val();
|
||||
|
||||
// 2. Validation du Garant via alert_ebene
|
||||
if (!codeGcAssureur || codeGcAssureur.trim() === "") {
|
||||
let v_msg = "Garant manquant ! Veuillez sélectionner un garant pour continuer.";
|
||||
let v_msg_eng = "Guarantor missing ! Please select a guarantor to continue.";
|
||||
|
||||
alert_ebene(v_msg, v_msg_eng);
|
||||
|
||||
$("#codeGcAssureur").focus();
|
||||
div_cible.html("");
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Validation du Produit via alert_ebene
|
||||
if (!codeProduit || codeProduit.trim() === "") {
|
||||
let v_msg = "Produit manquant ! Veuillez sélectionner un produit.";
|
||||
let v_msg_eng = "Product missing ! Please select a product.";
|
||||
|
||||
alert_ebene(v_msg, v_msg_eng);
|
||||
|
||||
div_cible.html("");
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. Préparation et affichage du loader bilingue
|
||||
const donnees = { codeProduit: codeProduit };
|
||||
let loadingTxt = (codeLangue === "en_US") ? "Loading the entry form..." : "Chargement du formulaire de saisie...";
|
||||
|
||||
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">${loadingTxt}</h5>
|
||||
</div>
|
||||
`);
|
||||
|
||||
// 5. Exécution de la requête AJAX
|
||||
$.ajax({
|
||||
url: racineWeb + "Ajaxparamseuilalerte/actualisegarantieproduit/",
|
||||
type: 'post',
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
div_cible.html(data);
|
||||
},
|
||||
error: function() {
|
||||
let errorTxt = (codeLangue === "en_US") ? "Technical error while retrieving the form." : "Erreur technique lors de la récupération du formulaire.";
|
||||
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>${errorTxt}</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
});
|
||||
}
|
||||
105
Vue/Ajaxparamseuilalerte/actualisegarantieproduit.php
Executable file
105
Vue/Ajaxparamseuilalerte/actualisegarantieproduit.php
Executable file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
$isEditable = ($produit['produitArchive'] == "0");
|
||||
?>
|
||||
|
||||
<div class="row g-2">
|
||||
<div class="col-lg-5">
|
||||
<div class="card border-0 shadow-sm h-100">
|
||||
<div class="card-header bg-light py-3 d-flex justify-content-between align-items-center">
|
||||
<h6 class="mb-0 fw-bold text-primary text-uppercase"><i class="fas fa-list me-2"></i><?= _("Garanties Disponibles") ?></h6>
|
||||
<?php if ($isEditable): ?>
|
||||
<button class="btn btn-xs btn-outline-primary rounded-pill fw-bold" onclick="ajouter_tous_garantie_produit();">
|
||||
<?= _("Tout ajouter") ?> <i class="fas fa-angle-double-right ms-1"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive" style="max-height: 600px; overflow-y: auto;">
|
||||
<table class="table table-hover align-middle mb-0" style="font-size: 9.5pt;">
|
||||
<thead class="bg-white sticky-top">
|
||||
<tr>
|
||||
<th class="ps-3 py-2 border-bottom"><?= _("Libellé Garantie") ?></th>
|
||||
<?php if ($isEditable): ?><th class="text-center border-bottom" width="15%"><?= _("Action") ?></th><?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($garanties_sans_seuils as $v): $code = $v['codeGarantie']; ?>
|
||||
<tr>
|
||||
<td class="ps-3"><?= $this->nettoyer($v['garantie']) ?></td>
|
||||
<?php if ($isEditable): ?>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-sm btn-primary-ghost rounded-circle action-btn" onclick="ajouter_un_garantie_produit('<?=$code?>');" title="<?= _("Ajouter") ?>">
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
</button>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7">
|
||||
<div class="card border-0 shadow-sm h-100 border-start border-primary border-4">
|
||||
<div class="card-header bg-white py-3 d-flex justify-content-between align-items-center border-bottom border-2">
|
||||
<?php if ($isEditable): ?>
|
||||
<h6 class="mb-0 fw-bold text-danger text-uppercase"><i class="fas fa-check-circle me-2"></i><?= _("Garanties affectées au Produit Santé") ?></h6>
|
||||
<button class="btn btn-xs btn-outline-danger rounded-pill fw-bold" onclick="retirer_tous_garantie_produit();">
|
||||
<i class="fas fa-angle-double-left me-1"></i> <?= _("Tout retirer") ?>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<h6 class="mb-0 fw-bold text-success text-uppercase"><i class="fas fa-check-circle me-2"></i><?= _("Garanties affectées au Produit Santé") ?></h6>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive" style="max-height: 600px; overflow-y: auto;">
|
||||
<table class="table table-hover align-middle mb-0" style="font-size: 9pt;">
|
||||
<thead class="bg-primary-ghost text-primary sticky-top">
|
||||
<tr>
|
||||
<?php if ($isEditable): ?><th class="ps-3 py-2 border-bottom" width="10%"><?= _("Retirer") ?></th><?php endif; ?>
|
||||
<th class="py-2 border-bottom"><?= _("Libellé") ?></th>
|
||||
<th class="text-center border-bottom" width="20%"><?= _("Seuil Taux (%)") ?></th>
|
||||
<th class="text-center border-bottom" width="25%"><?= _("Seuil Valeur") ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($garanties_avec_seuils as $v): $id = $v['id']; ?>
|
||||
<tr>
|
||||
<?php if ($isEditable): ?>
|
||||
<td class="ps-3 text-center">
|
||||
<button class="btn btn-sm btn-danger-light rounded-circle action-btn" onclick="retirer_un_garantie_produit('<?=$id?>');" title="<?= _("Retirer") ?>">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
</button>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="fw-bold"><?= $this->nettoyer($v['garantie']) ?></td>
|
||||
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control text-center border-2 fw-bold <?= $isEditable ? 'input-editable' : 'bg-light' ?>"
|
||||
type="number" value="<?= $v['tauxSeuilAlerte'] ?>"
|
||||
<?= $isEditable ? '' : 'disabled' ?>
|
||||
onchange="this.value=supprimer_espace_nombre(this.value); if(controle_numerique(this)){maj_taux_seuil_alerte_garantie('<?=$id?>', this.value);}">
|
||||
<span class="input-group-text bg-white border-2 border-start-0">%</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="pe-3">
|
||||
<input class="form-control form-control-sm text-center border-2 fw-bold text-primary <?= $isEditable ? 'input-editable' : 'bg-light' ?>"
|
||||
type="text" value="<?= format_N($v['seuilAlerte']) ?>"
|
||||
<?= $isEditable ? '' : 'disabled' ?>
|
||||
onfocus="formatNumerique(this);" onkeyup="controle_numerique(this);"
|
||||
onblur="formatMonetaire(this); maj_seuil_alerte_garantie('<?=$id?>', supprimer_espace_string(this.value));">
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
$isEditable = ($produit['produitArchive'] == "0");
|
||||
?>
|
||||
|
||||
<div class="page-content animate__animated animate__fadeIn">
|
||||
|
||||
<div class="header-section mb-1">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user