This commit is contained in:
KONE SOREL 2026-04-09 10:58:57 +00:00
parent d3fb51a941
commit 2e1ae05f9e
6 changed files with 183 additions and 8 deletions

View File

@ -92882,4 +92882,73 @@ function actualiser_bareme_acte_lettre_cle() {
`);
}
});
}
/**
* Récupère et affiche le détail des actes liés à une lettre clé dans une modale
* @param {number} idActesbaremeinitiallettrecle
* @param {string} lettreCle
*/
async function detail_baremeacte_lettre_cle(idActesbaremeinitiallettrecle, lettreCle) {
const racineWeb = document.getElementById("racineWeb").value;
const codeLangue = document.getElementById("codeLangue")?.value || 'fr_FR';
const modalContainer = document.getElementById("div_detail_bareme_actes");
const url = `${racineWeb}Ajaxbaremelettrecle/detailactes/`;
// 1. Préparation des données
const formData = new FormData();
formData.append("idActesbaremeinitiallettrecle", idActesbaremeinitiallettrecle);
formData.append("lettreCle", lettreCle);
// 2. Feedback visuel avant l'appel (Loader dans la modale)
modalContainer.innerHTML = `
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body text-center p-5">
<div class="spinner-border text-info" role="status" style="width: 3rem; height: 3rem;"></div>
<p class="mt-3 text-uppercase fw-bold small text-muted">
${codeLangue === "en_US" ? "Loading details..." : "Chargement du détail..."}
</p>
</div>
</div>
</div>
`;
// On affiche la modale immédiatement pour montrer le loader
$(modalContainer).modal("show");
try {
// 3. Exécution de la requête Fetch
const response = await fetch(url, {
method: "POST",
body: formData
});
if (!response.ok) {
throw new Error(`Erreur HTTP : ${response.status}`);
}
const html = await response.text();
// 4. Injection du contenu reçu (La vue PHP du détail)
modalContainer.innerHTML = html;
} catch (error) {
console.error("Erreur lors du chargement du détail :", error);
// Affichage de l'erreur dans la modale
modalContainer.innerHTML = `
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body alert alert-danger m-3 shadow-sm">
<i class="fas fa-exclamation-triangle me-2"></i>
${codeLangue === "en_US" ? "Unable to load data." : "Impossible de charger les données."}
</div>
<div class="modal-footer border-0">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Fermer</button>
</div>
</div>
</div>
`;
}
}

View File

@ -0,0 +1,106 @@
<?php
$adminProd = $_SESSION['adminProd'];
$lettreCle = $_SESSION['lettreCle'];
?>
<input type="hidden" id="idActesbaremeinitiallettrecle" name="idActesbaremeinitiallettrecle" value="<?= $_SESSION['idActesbaremeinitiallettrecle'] ?>">
<input type="hidden" id="lettreCle" name="lettreCle" value="<?= $lettreCle ?>">
<div class="modal-dialog modal-xl modal-dialog-centered" role="document">
<div class="modal-content shadow-lg border-0">
<div class="modal-header bg-light border-bottom-0 py-3">
<h5 class="modal-title d-flex align-items-center fw-bold">
<span class="badge bg-primary me-2 px-3 py-2"><?= $lettreCle ?></span>
<span class="text-dark small text-uppercase"><?= _("Détail des actes impactés") ?></span>
</h5>
<button type="button" class="btn-close shadow-none" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body p-4">
<input class="sr-only" type="text" id="datejour" name="datejour" value="<?= datefr(date('Y/m/d')); ?>">
<div class="mb-3 border-start border-4 border-primary ps-3 py-1">
<p class="text-muted small mb-0 fw-bold">
<?= _("Liste chronologique des actes associés à cette lettre clé pour ce barème.") ?>
</p>
</div>
<?php if(count($detailactes) > 0): ?>
<div class="table-responsive rounded border shadow-sm">
<table class="table table-sm table-hover align-middle mb-0" style="font-size: 0.85rem;">
<thead class="table-dark">
<tr class="text-center small">
<th class="py-2 ps-3 text-start"><?= _("Libellé de l'Acte") ?></th>
<th><?= _("Coefficient") ?></th>
<th><?= _("Plafond Acte") ?></th>
<th><?= _("Ticket Mod.") ?></th>
<th><?= _("Statut") ?></th>
<th class="pe-3"><?= _("Actions") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($detailactes as $v):
$idActe = $this->nettoyer($v['id']);
$supprime = $v['supprime'];
$libelle = est_anglophone() ? $this->nettoyer($v['libelleEng']) : $this->nettoyer($v['libelle']);
$isActif = ($this->nettoyer($v['actif']) == "1");
?>
<tr class="text-center <?= ($supprime == '1') ? 'table-danger opacity-50' : ''; ?>">
<td class="text-start ps-3 fw-bold text-dark border-end"><?= $libelle ?></td>
<td class="fw-bold"><?= $this->nettoyer($v['coefficient']); ?></td>
<td class="text-primary fw-bold"><?= format_N($this->nettoyer($v['forfaitPlafond']));?></td>
<td class="text-danger"><?= $this->nettoyer($v['ticketModerateur']);?>%</td>
<td>
<?php if($isActif): ?>
<span class="badge bg-success-subtle text-success rounded-pill px-2" style="font-size: 0.7rem;">
<?= _("Oui") ?>
</span>
<?php else: ?>
<span class="badge bg-secondary-subtle text-secondary rounded-pill px-2" style="font-size: 0.7rem;">
<?= _("Non") ?>
</span>
<?php endif; ?>
</td>
<td class="pe-3">
<?php if($supprime == '0'): ?>
<button type="button" class="btn btn-sm btn-outline-danger border-0"
onClick="javascript:supprimer_baremeacte_lettre_cle_detail('<?= $adminProd?>', <?= $idActe ?>);"
title="<?= _("Supprimer") ?>">
<i class="fas fa-trash-alt"></i>
</button>
<?php else: ?>
<span class="text-muted small italic" style="font-size: 0.7rem;"><?= _("Supprimé") ?></span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-warning border-dashed text-center p-5">
<i class="fas fa-search fa-3x mb-3 opacity-25"></i>
<p class="mb-0 fw-bold"><?= _("Aucun acte trouvé pour ce détail.") ?></p>
</div>
<?php endif; ?>
</div>
<div class="modal-footer bg-light border-top-0">
<button type="button" class="btn btn-secondary px-4 fw-bold shadow-sm" data-bs-dismiss="modal">
<i class="fas fa-times me-2"></i><?= _("Fermer") ?>
</button>
</div>
</div>
</div>
<style>
.border-dashed { border: 2px dashed #dee2e6 !important; background: none; }
.opacity-50 { text-decoration: line-through rgba(220, 53, 69, 0.3); }
.modal-xl { max-width: 90% !important; }
.btn-outline-danger:hover { background-color: #dc3545; color: white; }
</style>

View File

@ -3,8 +3,8 @@
?>
<?php if(count($actes) > 0): ?>
<div class="table-responsive shadow-sm rounded border overflow-hidden">
<table class="table table-sm table-hover align-middle mb-0" style="font-size: 0.85rem;">
<div class="table-responsive shadow-sm rounded">
<table class="table table-sm table-hover table-bordered align-middle mb-0 text-nowrap">
<thead class="table-light border-bottom">
<tr class="text-center text-uppercase small fw-bold text-muted">
<th class="py-3 border-end" style="width: 80px;"><?= _("Détail") ?></th>
@ -39,7 +39,7 @@
<td class="fw-bold border-end"><?= $lettreCle ?></td>
<td class="text-start ps-3 border-end text-truncate" style="max-width: 250px;"><?= $libelle ?></td>
<td class="text-nowrap border-end"><?= datefr($this->nettoyer($v['dateEffet'])); ?></td>
<td class="text-nowrap border-end"><?= dateLang($this->nettoyer($v['dateEffet']), $_SESSION['lang']); ?></td>
<td class="fw-bold text-primary border-end"><?= format_N($this->nettoyer($v['forfaitPlafond']));?></td>
<td class="text-danger border-end fw-bold"><?= $this->nettoyer($v['ticketModerateur']);?>%</td>
<td class="border-end"><?= format_N($this->nettoyer($v['nbActes']));?></td>
@ -68,7 +68,7 @@
</div>
<?php else: ?>
<div class="alert alert-warning border-dashed text-center p-4 text-uppercase">
<div class="alert alert-warning border-dashed text-center p-2 text-uppercase">
<i class="fas fa-info-circle fa-2x mb-2 d-block opacity-50"></i>
<?= _("Aucune lettre clé paramétrée pour ce barème.") ?>
</div>

View File

@ -55,7 +55,7 @@
<tr class="<?= ($supprime == '1') ? 'table-danger opacity-50' : ''; ?>">
<td class="ps-3 fw-bold text-dark small border-end"><?= $libelle ?></td>
<td class="text-center text-nowrap"><?= Lang($this->nettoydateer($v['dateEffet']), $_SESSION['lang']); ?></td>
<td class="text-center text-nowrap"><?= dateLang($this->nettoyer($v['dateEffet']), $_SESSION['lang']); ?></td>
<td class="text-center fw-bold text-primary border-start"><?= $plafondFamille; ?></td>
<td class="text-center text-muted small"><?= $periodicitePlafondFamille;?></td>

View File

@ -45,7 +45,7 @@
?>
<tr class="text-center <?= ($supprime == '1') ? 'table-danger opacity-50' : ''; ?>">
<td class="fw-bold text-nowrap border-end"><?= datefr($this->nettoyer($v['dateEffet'])); ?></td>
<td class="fw-bold text-nowrap border-end"><?= dateLang($this->nettoyer($v['dateEffet']), $_SESSION['lang']); ?></td>
<td class="border-end">
<span class="badge bg-info bg-opacity-10 text-info border border-info-subtle px-2">
<?= $lienparente;?>

View File

@ -30,7 +30,7 @@
<div id="div_maxdateeffetactebareme" class="sr-only"></div>
<div id="div_acte_masquer">
<div class="row g-3">
<div class="row g-1">
<div class="col-md-12">
<div class="card border-0 shadow-sm">
<div class="card-body p-2 bg-light rounded">
@ -97,6 +97,6 @@
</div>
</div>
<div id="div_detail_bareme" class="mt-4 shadow-sm rounded overflow-hidden">
<div id="div_detail_bareme" class="mt-2 shadow-sm rounded overflow-hidden">
<?php require "Vue/Ajaxbaremelettrecle/index.php"; ?>
</div>