This commit is contained in:
KONE SOREL 2026-04-09 15:26:23 +00:00
parent b75875753c
commit 89b0ca3817
2 changed files with 89 additions and 74 deletions

View File

@ -92914,7 +92914,7 @@ async function detail_baremeacte_lettre_cle(idInitial, lettre) {
* * @param {number|string} idInitial - ID du barème initial (idActesbaremeinitiallettrecle)
* @param {string} lettre - La lettre clé concernée (ex: 'K', 'B', 'V')
*/
async function chargerContenuDetailActe(idInitial, lettre) {
async function chargerContenuDetailActe(idInitial, lettre, mode = 'complet') {
const racineWeb = document.getElementById("racineWeb").value;
const codeLangue = document.getElementById("codeLangue")?.value || 'fr_FR';
const modalContainer = document.getElementById("div_detail_bareme_actes");
@ -92926,14 +92926,26 @@ async function chargerContenuDetailActe(idInitial, lettre) {
try {
const response = await fetch(url, { method: "POST", body: formData });
if (!response.ok) throw new Error(`Erreur réseau : ${response.status}`);
const html = await response.text();
// Injection du HTML
modalContainer.innerHTML = html;
// Réinitialisation de DataTable
if (mode === 'complet') {
// OUVERTURE INITIALE : On injecte tout le HTML (Structure + Tableau)
modalContainer.innerHTML = html;
} else {
// ACTUALISATION APRÈS SUPPRESSION :
// On extrait seulement la zone du tableau du HTML reçu
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const nouveauContenuTableau = doc.getElementById('div_table_detail_lettrecle');
if (nouveauContenuTableau) {
// On ne remplace que l'intérieur de la zone cible
const zoneCible = document.getElementById('div_table_detail_lettrecle');
zoneCible.innerHTML = nouveauContenuTableau.innerHTML;
}
}
// Réinitialisation de DataTable (Indispensable après injection)
setTimeout(() => {
if ($.fn.DataTable.isDataTable('#table_detail_actes')) {
$('#table_detail_actes').DataTable().destroy();
@ -92946,14 +92958,13 @@ async function chargerContenuDetailActe(idInitial, lettre) {
: "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json"
},
"pageLength": 10,
"responsive": true,
"dom": "<'row mb-3'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>rtip"
"dom": "<'row mb-3'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>rtip",
"responsive": true
});
}, 50); // Délai réduit pour plus de réactivité
}, 100);
} catch (error) {
console.error("Erreur chargement :", error);
alert_ebene("Erreur de chargement", "Loading error");
console.error("Erreur de rafraîchissement :", error);
}
}
@ -92982,7 +92993,7 @@ function supprimer_baremeacte_lettre_cle_detail(adminProd, idActe) {
const lettre = $("#lettreCle").val();
// ON ACTUALISE JUSTE LE TABLEAU
chargerContenuDetailActe(idInitial, lettre);
chargerContenuDetailActe(idInitial, lettre, 'refresh');
}
});
}

View File

@ -6,74 +6,78 @@
<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-info me-2 px-3 py-2"><?= $lettreCle ?></span>
<span class="text-light small text-uppercase"><?= _("Détail des actes impactés") ?></span>
<span class="badge bg-info me-2 px-3 py-2 text-white"><?= $lettreCle ?></span>
<span class="text-dark small text-uppercase"><?= _("Détail des actes impactés") ?></span>
</h5>
<button type="button" class="btn p-2 border-0 shadow-none d-flex align-items-center justify-content-center"
data-bs-dismiss="modal" aria-label="Close"
style="background: transparent; transition: transform 0.2s ease;">
<i class="fas fa-times text-white fs-4"></i>
<i class="fas fa-times text-muted fs-4"></i>
</button>
</div>
<div class="modal-body p-4">
<div class="mb-4 border-start ps-3 py-1 rounded-end">
<p class="text-primary small mb-0 fw-bold">
<input type="hidden" id="idInitial_hidden" value="<?= $_SESSION['idActesbaremeinitiallettrecle'] ?>">
<input type="hidden" id="lettre_hidden" value="<?= $lettreCle ?>">
<div class="mb-4 border-start border-4 border-info ps-3 py-1 rounded-end bg-info bg-opacity-10">
<p class="text-info small mb-0 fw-bold">
<i class="fas fa-info-circle me-1"></i> <?= _("Utilisez la barre de recherche pour filtrer un acte spécifique.") ?>
</p>
</div>
<?php if(count($detailactes) > 0): ?>
<div class="table-responsive p-1">
<table id="table_detail_actes" class="table table-sm table-hover align-middle border shadow-sm" style="width:100%;">
<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 text-decoration-line-through' : ''; ?>">
<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 fw-bold"><?= intval($this->nettoyer($v['ticketModerateur']));?>%</td>
<td>
<span class="badge <?= $isActif ? 'bg-success' : 'bg-secondary' ?> rounded-pill">
<?= $isActif ? _("Oui") : _("Non") ?>
</span>
</td>
<td class="pe-3">
<?php if($supprime == '0'): ?>
<button type="button" class="btn btn-sm text-danger border-0 p-0"
onClick="javascript:supprimer_baremeacte_lettre_cle_detail('<?= $adminProd?>', <?= $idActe ?>);"
title="<?= _("Supprimer") ?>">
<i class="fas fa-trash-alt"></i>
</button>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-warning text-center p-5 border-dashed">
<i class="fas fa-search fa-3x mb-3 opacity-25"></i>
<p class="mb-0 fw-bold"><?= _("Aucun acte trouvé.") ?></p>
</div>
<?php endif; ?>
</div>
<div id="div_table_detail_lettrecle">
<?php if(count($detailactes) > 0): ?>
<div class="table-responsive p-1">
<table id="table_detail_actes" class="table table-sm table-hover align-middle border shadow-sm" style="width:100%;">
<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 text-decoration-line-through' : ''; ?>">
<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 fw-bold"><?= intval($this->nettoyer($v['ticketModerateur']));?>%</td>
<td>
<span class="badge <?= $isActif ? 'bg-success' : 'bg-secondary' ?> rounded-pill px-2" style="font-size: 0.7rem;">
<?= $isActif ? _("Oui") : _("Non") ?>
</span>
</td>
<td class="pe-3">
<?php if($supprime == '0'): ?>
<button type="button" class="btn btn-sm text-danger border-0 p-0"
onClick="javascript:supprimer_baremeacte_lettre_cle_detail('<?= $adminProd?>', <?= $idActe ?>);"
title="<?= _("Supprimer") ?>">
<i class="fas fa-trash-alt"></i>
</button>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-warning text-center p-5 border-dashed bg-transparent">
<i class="fas fa-search fa-3x mb-3 opacity-25"></i>
<p class="mb-0 fw-bold"><?= _("Aucun acte trouvé.") ?></p>
</div>
<?php endif; ?>
</div> </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">
@ -89,9 +93,9 @@
/* Correction de la largeur DataTables en modale */
#table_detail_actes { width: 100% !important; border-collapse: collapse !important; }
/* Design du champ de recherche */
/* Design du champ de recherche DataTables */
.dataTables_filter input {
border: 1px solid #0d6efd;
border: 1px solid #0dcaf0;
border-radius: 5px;
padding: 4px 10px;
font-size: 0.85rem;
@ -100,12 +104,12 @@
/* Pagination personnalisée */
.dataTables_paginate .paginate_button.current {
background: #0d6efd !important;
background: #0dcaf0 !important;
color: white !important;
border: none;
border: none !important;
border-radius: 4px;
}
.border-dashed { border: 2px dashed #dee2e6 !important; background: none; }
.border-dashed { border: 2px dashed #dee2e6 !important; }
.modal-xl { max-width: 90% !important; }
</style>