This commit is contained in:
KONE SOREL 2026-04-24 11:24:42 +00:00
parent 5ece381e17
commit 8daf22be49
5 changed files with 191 additions and 6 deletions

View File

@ -0,0 +1,27 @@
<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Fraisfuneraire.php';
class ControleurAjaxmouvementassure extends Controleur {
private $frais;
public function __construct() {
$this->frais = new Fraisfuneraire();
}
public function index()
{
$idPolice = $this->requete->getParametreFormulaire("idPolice");
$_SESSION['idPolice_C'] = $idPolice;
$valide = $this->requete->getParametreFormulaire("valide");
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$demandes = $this->mouvementassure->getfraisfunerairePolice($idPolice, $debut, $fin, $valide);
$this->genererVueAjax(array('demandes' => $demandes));
}
}

View File

@ -7303,4 +7303,53 @@ function confirmer_correction(idMvt, idBeneficiaire)
}
});
}
}
function liste_frais_funeraires_assures_client()
{
idPolice=$("#idPolice").val();
if (idPolice<=" ")
{
v_msg="Veuillez sélectionner une police!";
v_msgEng="Please select a policy!";
alert_ebene(v_msg, v_msgEng).then(() => {
// Ce code ne sexécute quaprès clic sur OK
return;
});
return;
}
valide=$("#valide").val();
debut=$("#debut").val();
fin=$("#fin").val();
donnees = 'idPolice='+idPolice;
donnees += '&valide='+valide;
donnees += '&debut='+debut+'&fin='+fin;
$("#div_mvt").html(`
<div class="d-flex flex-column align-items-center justify-content-center" style="padding-top:80px;">
<div class="spinner-border text-primary" role="status" style="width:3rem; height:3rem;">
<span class="visually-hidden">Loading...</span>
</div>
<span class="mt-3 fs-5 fw-bold">
Veuillez patienter... / Please wait...
</span>
</div>
`);
$.ajax({
url: $("#racineWeb").val()+"Ajaxfraisfuneraires/",
type : 'post',
data: donnees,
error: function(errorData) {
},
success: function(data) {
$("#div_frais").html(data);
},
complete: function() {
}
});
}

View File

@ -87,11 +87,13 @@ class Fraisfuneraire extends Modele {
$this->executerRequete($sql, array($idFraisfuneraire, $user));
}
public function getfraisfunerairePolice($idPolice)
public function getfraisfunerairePolice($idPolice, $debut, $fin, $valide)
{
$sql = 'call sp_r_get_fraisfuneraire(?)';
$valide = contruireParamLike($valide);
$sql = 'call sp_c_get_fraisfuneraire_police(?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idPolice));
$resultat = $this->executerRequete($sql, array($idPolice, $debut, $fin, $valide));
return $resultat->fetch(PDO::FETCH_ASSOC);
}

View File

@ -0,0 +1,107 @@
<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="selectionner_remboursement('<?= $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>

View File

@ -45,7 +45,7 @@
</div>
<div class="col-md-12 mt-4">
<button type="button" class="btn btn-primary w-100 fw-bold shadow-sm py-2" onclick="liste_mouvemements_assures_client();">
<button type="button" class="btn btn-primary w-100 fw-bold shadow-sm py-2" onclick="liste_frais_funeraires_assures_client();">
<i class="fa-solid fa-magnifying-glass me-2"></i><?= _("Actualiser la liste des demandes") ?>
</button>
</div>
@ -54,7 +54,7 @@
</div>
</div>
<div id="div_mvt" class="min-vh-50 bg-white rounded shadow-sm border p-4">
<div id="div_frais" class="min-vh-50 bg-white rounded shadow-sm border p-4">
<div class="text-center py-5">
<div class="opacity-25 mb-3">
<i class="fa-solid fa-box-open fa-5x text-secondary"></i>