radiantassure/Vue/Remboursement/index.php
2025-12-07 09:35:13 +00:00

375 lines
13 KiB
PHP
Executable File

<?php
$this->titre = "Intersanté - Remboursement Direct";
$idDemandeRemboursement = $_SESSION['idDemandeRemboursement'] ?? "0";
if($idDemandeRemboursement > "0"){
$numeroDemandeRemboursement = $this->nettoyer($demande['numeroDemandeRemboursement']);
$codeEtatDemandeRemboursement = $this->nettoyer($demande['codeEtatDemandeRemboursement']);
$lien = $this->nettoyer($demande['lien']);
$numeroBeneficiaire = $this->nettoyer($demande['numeroBeneficiaire']);
$observation = $this->nettoyer($demande['observation']);
if (est_anglophone()){
$lien = $this->nettoyer($demande['lienEng']);
}
}else{
$numeroDemandeRemboursement = "0";
$codeEtatDemandeRemboursement = "0";
$lien = "";
$numeroBeneficiaire = "";
$observation = "";
}
?>
<div class="card shadow-lg border-0 mb-4" style="border-radius: 15px;">
<div class="card-header bg-primary text-white py-3" style="border-radius: 15px 15px 0 0;">
<div class="row align-items-center">
<div class="col-8">
<h4 id="h4_titre" class="mb-2 text-center">
<i class="fas fa-file-invoice-dollar me-2"></i>
<?php if($idDemandeRemboursement == "0" && $codeEtatDemandeRemboursement == "0"): ?>
<?= _("Demander un remboursement") ?>
<?php else: ?>
<?= _("Consulter un remboursement") ?>
<?php endif; ?>
</h4>
</div>
</div>
</div>
<div class="col-12">
<!-- Message d'information -->
<?php if($idDemandeRemboursement == "0" && $codeEtatDemandeRemboursement == "0"): ?>
<div class="alert alert-warning mt-3" style="margin-bottom:15px;">
<small>
<i class="fas fa-exclamation-circle me-2"></i>
<?= _("Les astérisques (*) sont obligatoires.")?>
</small>
</div>
<?php endif; ?>
<!-- Carte principale du formulaire -->
<div class="card shadow-sm mb-4">
<div class="card-header bg-light py-3">
<h2 class="mb-0 text-primary">
<i class="fas fa-user-md me-2"></i>
<?= _("Informations de la demande") ?>
</h2>
</div>
<div class="card-body">
<?php if($idDemandeRemboursement > "0"): ?>
<div class="row mb-4">
<div class="col-12">
<div id="div_numero" class="alert alert-primary text-center py-2">
<strong><?= _("Demande No").": ".$numeroDemandeRemboursement ?></strong>
</div>
</div>
</div>
<?php endif; ?>
<div class="row g-3">
<!-- Patient -->
<div class="col-12 col-md-6">
<label class="form-label fw-bold">
<?= _("Patient") ?>
<?php if($idDemandeRemboursement == "0"): ?><span class="text-danger">*</span><?php endif; ?>
</label>
<select class="form-select" id="numeroBeneficiaire" name="numeroBeneficiaire"
<?= ($idDemandeRemboursement > "0") ? 'disabled' : 'required autofocus' ?>
onChange="javascript:lienparente();">
<?php liste_options($benficiaires, $numeroBeneficiaire); ?>
</select>
</div>
<!-- Lien Parenté -->
<div class="col-12 col-md-6">
<label class="form-label fw-bold"><?= _("Lien Parenté") ?></label>
<div id="div_lien">
<input class="form-control" type="text" id="lienDemandeur" name="lienDemandeur"
value="<?= $lien ?>" readonly style="background-color: #e5e7e6; font-weight:bold;">
</div>
</div>
<!-- Commentaire -->
<div class="col-12">
<label class="form-label fw-bold">
<?= _("Commentaire") ?>
<?php if($idDemandeRemboursement == "0"): ?><span class="text-danger">*</span><?php endif; ?>
</label>
<textarea id="commentaires" name="commentaires" class="form-control" rows="4"
<?= ($idDemandeRemboursement > "0") ? 'disabled' : 'required' ?>><?= $observation ?></textarea>
</div>
<?php if($codeEtatDemandeRemboursement > "0"):?>
<div class="card-body">
<div class="row g-3">
<!-- État Réponse -->
<div class="col-12 col-md-6 col-lg-6">
<label class="form-label fw-bold"><?= _("Etat Réponse") ?></label>
<?php if($codeEtatDemandeRemboursement == "1"):?>
<div class="alert alert-success py-2 text-center mb-0 etatRdv"><?= _("Accordée")?></div>
<?php else: ?>
<div class="alert alert-danger py-2 text-center mb-0 etatRdv"><?= _("Refusée")?></div>
<?php endif; ?>
</div>
<!-- Date Réponse -->
<div class="col-12 col-md-6 col-lg-6">
<label class="form-label fw-bold"><?= _("Date Réponse") ?></label>
<input class="form-control" type="text"
value="<?= dateLang($this->nettoyer($demande['dateReponseDemandeRemboursement']), $_SESSION['lang']) ?>" readonly>
</div>
<!-- Motif Réponse -->
<div class="col-12">
<label class="form-label fw-bold"><?= _("Motif Réponse") ?></label>
<textarea class="form-control w-100" rows="5" style="height: 120px;" disabled><?= $this->nettoyer($demande['motifReponseDemandeRemboursement']); ?></textarea>
</div>
<!-- Date et Heure RDV Accordée -->
<?php if($codeEtatDemandeRemboursement == "1"):?>
<div class="col-12 col-md-6">
<label class="form-label fw-bold"><?= _("ID Dossier Remboursement") ?></label>
<input class="form-control" type="text"
value="<?= $this->nettoyer($demande['idDossier']); ?>" readonly>
</div>
<div class="col-12 col-md-6">
<label class="form-label fw-bold"><?= _("Ouvert le") ?></label>
<input class="form-control" type="text"
value="<?= dateLang($this->nettoyer($demande['dateCreationDossier']), $_SESSION['lang']); ?>" readonly>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<!-- Bouton Enregistrer -->
<?php if($idDemandeRemboursement == "0" && $codeEtatDemandeRemboursement == "0"): ?>
<div class="col-12">
<button class="btn btn-primary w-100 py-2 btn_autre"
onClick="javascript:enregistrer_demande_remboursement();">
<i class="fas fa-save me-2"></i><?= _("Enregistrer la demande") ?>
</button>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Section des documents joints -->
<?php if($idDemandeRemboursement > "0"): ?>
<div class="card shadow-sm">
<div class="card-header bg-light py-3">
<h2 class="mb-0 text-primary">
<i class="fas fa-paperclip me-2"></i>
<?= _("Factures des prestations") ?>
</h2>
</div>
<div class="card-body">
<?php if($codeEtatDemandeRemboursement == "0"): ?>
<form enctype="multipart/form-data" action="Remboursement" method="post">
<div class="alert alert-info mb-4">
<small>
<i class="fas fa-info-circle me-2"></i>
<?= _("Vous pouvez joindre vos factures ci-dessous mais assurez-vous qu'elles soient lisibles. Formats acceptés: bmp, gif, jpeg, jpg, pdf, png.") ?>
</small>
</div>
<div class="row g-3 align-items-end">
<!-- Upload de fichier -->
<div class="col-12 col-md-6">
<label class="form-label fw-bold">
<?= _("Ajouter facture(s)") ?> <span class="text-danger">*</span>
</label>
<input class="form-control" name="fichier_upload" type="file"
id="fichier_upload" required />
</div>
<!-- Boutons -->
<div class="col-12 col-md-6">
<div class="d-grid gap-2 d-md-flex">
<button type="submit" name="submit" class="btn btn-primary flex-fill btn_autre">
<i class="fas fa-upload me-2"></i><?= _("Envoyer") ?>
</button>
<button type="button" class="btn btn-outline-secondary flex-fill btn_autre"
onclick="javascript:actualiser_remboursement();">
<i class="fas fa-sync-alt me-2"></i><?= _("Actualiser") ?>
</button>
</div>
</div>
</div>
</form>
<?php endif; ?>
<?php if((isset($msgErreurGed)) && ($msgErreurGed>" ")) : ?>
<div class="alert alert-danger mt-3" role="alert">
<i class="fas fa-exclamation-triangle me-2"></i>
<?= $msgErreurGed ?>
</div>
<?php endif; ?>
<!-- Liste des documents -->
<?php if(count($geds) > 0): ?>
<div class="mt-4">
<div class="card-header bg-light py-2 d-flex justify-content-between align-items-center">
<h5 class="mb-0 text-dark">
<i class="fas fa-list me-2"></i>
<span class="hide-on-mobile"><?= _("Liste des factures")?></span>
<span class="badge bg-primary view-end"><?= format_N(count($geds)).' '._("facture(s)") ?> </span>
</h5>
</div>
<div class="d-none d-md-block">
<div class="table-responsive">
<table class="table table-striped table-hover" style="font-size:9pt; white-space: nowrap;">
<thead class="table-dark">
<tr>
<th width="20%" class="text-center">Date</th>
<th class="text-center"><?= _("Facture") ?></th>
<th width="15%" class="text-center"><?= _("Action") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($geds as $ged):
$idGed = $this->nettoyer($ged['idGed']);
$cheminFichier = $this->nettoyer($ged['cheminFichier']);
?>
<tr>
<td class="text-center"><?= dateheureLang($this->nettoyer($ged['dateSysteme']), $_SESSION['lang']) ?></td>
<td class="text-truncate" style="max-width: 200px;"
data-bs-toggle="tooltip" title="<?= $this->nettoyer($ged['nomOrigine']) ?>">
<?= $this->nettoyer($ged['nomOrigine']) ?>
</td>
<td class="text-center">
<a href="<?= $cheminFichier ?>" target="_blank"
class="btn btn-sm btn-outline-danger">
<i class="fas fa-download me-1 d-none d-sm-inline"></i>
<?= _("Télécharger") ?>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<!-- Affichage mobile (cartes) -->
<div class="d-md-none">
<?php foreach ($geds as $ged):
$idGed = $this->nettoyer($ged['idGed']);
$cheminFichier = $this->nettoyer($ged['cheminFichier']);
?>
<div class="card-body py-2">
<div class="row mb-2">
<div class="col-12 mb-2">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small me-3">Date</span>
<span class="fw-bold me-2"><?= dateheureLang($this->nettoyer($ged['dateSysteme']), $_SESSION['lang']) ?></span>
</div>
</div>
<div class="col-10 mb-2">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small me-3"><?= _("Facture") ?></span>
<span class="text-truncate" style="max-width: 200px;"><?= $this->nettoyer($ged['nomOrigine']) ?></span>
</div>
</div>
<div class="col-2 mb-2">
<div class="d-flex justify-content-between align-items-center">
<a href="<?= $cheminFichier ?>"
class="btn btn-sm btn-danger w-100">
<i class="fas fa-download me-1 d-sm-inline" style="font-size:1.8rem !important"></i>
</a>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php else: ?>
<div class="text-center text-muted py-4">
<div class="alert alert-info mt-3" style="margin-bottom:15px;">
<small>
<i class="fas fa-info-circle me-2"></i>
<?= _("Aucune facture trouvée pour les critères sélectionnés") ?>
</small>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php else: ?>
<div id="div_ged_0"></div>
<?php endif; ?>
</div>
</div>
<style>
.legend-title {
color: #2c3e50;
font-weight: 600;
padding-bottom: 10px;
border-bottom: 2px solid #3498db;
}
.card {
border: none;
border-radius: 10px;
}
.form-label {
font-size: 0.9rem;
}
.table th {
font-size: 0.85rem;
font-weight: 600;
}
/* Styles pour mobile */
@media (max-width: 768px) {
.card-body {
padding: 1rem;
}
.btn {
padding: 0.5rem;
}
.table-responsive {
font-size: 0.8rem;
}
}
/* Version ultra-mobile */
@media (max-width: 576px) {
.table th, .table td {
padding: 0.5rem;
}
.d-md-flex .btn {
margin-bottom: 0.5rem;
}
.d-md-flex .btn:last-child {
margin-bottom: 0;
}
}
</style>
<script>
// Initialiser les tooltips Bootstrap
document.addEventListener('DOMContentLoaded', function() {
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
});
</script>