radiantrh/Vue/Ajaxfraisfuneraires/index.php
2026-04-30 11:41:57 +00:00

107 lines
5.9 KiB
PHP

<div class="card shadow-sm border-0 animate__animated animate__fadeIn" style="border-radius: 12px;">
<?php if (empty($demandes)): ?>
<div class="alert alert-info text-center m-3 border-0 shadow-sm" style="border-radius: 10px;">
<i class="fas fa-info-circle me-2"></i>
<?= _("Aucune demande trouvée pour ce filtre") ?>
</div>
<?php else: ?>
<div class="card-header bg-white py-3 d-flex justify-content-between align-items-center border-bottom">
<h5 class="mb-0 fw-bold text-primary">
<i class="fas fa-list-ul me-2"></i>
<span class="hide-on-mobile"><?= _("Liste des demandes")?></span>
</h5>
<span class="badge bg-primary rounded-pill px-3 py-2 shadow-sm">
<i class="fas fa-file-invoice me-1"></i> <?= format_N(count($demandes)).' '._("demande(s)") ?>
</span>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table id="table_frais_funeraires" class="table table-striped table-hover mb-0 tabliste compact w-100" style="font-size:9pt; white-space:nowrap;">
<thead class="table-dark text-uppercase small">
<tr>
<th class="text-center"><?= _("N° Demande") ?></th>
<th class="text-center"><?= _("Date Saisie") ?></th>
<th><?= _("Bénéficiaire") ?></th>
<th class="text-center"><?= _("Lien Parenté") ?></th>
<th class="text-center"><?= _("État") ?></th>
<th><?= _("Observations") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($demandes as $v):
$idDemande = $this->nettoyer($v['id']);
$numeroFraisFuneraire = $this->nettoyer($v['numeroFraisFuneraire']);
$dateSysteme = $this->nettoyer($v['dateSysteme']);
$codeEtatDemandeFrais = $v['codeEtatDemandeFrais'];
?>
<tr>
<td class="text-center">
<button class="btn btn-xs btn-outline-primary fw-bold px-3 shadow-xs"
onClick="afficher_demande_fraisfun('<?= $idDemande ?>');">
<?= $numeroFraisFuneraire ?>
</button>
</td>
<td class="text-center text-muted">
<?= dateheureLang($dateSysteme, $_SESSION['lang']) ?>
</td>
<td>
<div class="fw-bold text-uppercase text-dark"><?= $this->nettoyer($v['beneficiaire']) ?></div>
<div class="x-small text-muted italic"><?= $this->nettoyer($v['numeroBeneficiaire']) ?></div>
</td>
<td class="text-center">
<span class="badge bg-light text-secondary border"><?= $v['lienbeneficiaire'] ?></span>
</td>
<td class="text-center">
<?php if($codeEtatDemandeFrais == "1"):?>
<span class="badge bg-success-subtle text-success border border-success-subtle px-3 fw-bold">
<i class="fas fa-check-circle me-1"></i><?= _("Accordée")?>
</span>
<?php elseif($codeEtatDemandeFrais == "0"): ?>
<span class="badge bg-warning-subtle text-warning border border-warning-subtle px-3 fw-bold">
<i class="fas fa-clock me-1"></i><?= _("En attente")?>
</span>
<?php else: ?>
<span class="badge bg-danger-subtle text-danger border border-danger-subtle px-3 fw-bold">
<i class="fas fa-times-circle me-1"></i><?= _("Refusée")?>
</span>
<?php endif; ?>
</td>
<td class="small text-muted italic">
<?= $v['observations'] ? $this->nettoyer($v['observations']) : '<span class="opacity-25">-</span>' ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
</div>
<script>
$(document).ready(function() {
const titreRapport = "<?= mb_strtoupper(_('DEMANDES DE FRAIS FUNÉRAIRES'), 'UTF-8'); ?>";
const infosEntete = "\n<?= _('Police') ?> : <?= $_SESSION['numeroPolice_C'] ?>\n" +
"<?= _('Période du') ?> : <?= $_SESSION['dateDebutRequete'] ?> <?= _('au') ?> <?= $_SESSION['dateFinRequete'] ?>\n";
// Application de la fonction commune avec les boutons d'export
appliquerDataTable('#table_frais_funeraires', {
pageLength: 25,
order: [[1, "desc"]], // Tri par date de saisie décroissante
buttons: [
{ extend: 'excel', title: titreRapport, messageTop: infosEntete, className: 'btn btn-sm btn-success' },
{ extend: 'pdf', title: titreRapport, messageTop: infosEntete, orientation: 'landscape', className: 'btn btn-sm btn-danger' },
{ extend: 'print', title: titreRapport, messageTop: infosEntete, className: 'btn btn-sm btn-dark' }
]
}, titreRapport, infosEntete);
});
</script>
<style>
.btn-xs { padding: 0.2rem 0.4rem; font-size: 0.75rem; border-radius: 4px; }
.shadow-xs { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.bg-success-subtle { background-color: #d1e7dd !important; }
.bg-warning-subtle { background-color: #fff3cd !important; }
.bg-danger-subtle { background-color: #f8d7da !important; }
</style>