radiantrh/Vue/Ajaxfactureconspop/geds.php
2026-01-17 10:14:20 +00:00

75 lines
4.4 KiB
PHP

<div id="div_facture_detail" class="mt-3">
<div id="div_ged">
<div class="card border-0 shadow-sm">
<div class="card-header bg-dark text-white py-2 d-flex justify-content-between align-items-center">
<span class="fw-bold small text-uppercase">
<i class="fa-solid fa-folder-tree me-2"></i><?= _("Documents joints au dossier") ?>
</span>
<span class="badge bg-secondary"><?= count($geds) ?> <?= _("Fichier(s)") ?></span>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th width="20%" class="text-center small text-muted text-uppercase"><?= _("Date d'ajout") ?></th>
<th class="small text-muted text-uppercase"><?= _("Nom du document") ?></th>
<th width="15%" class="text-center small text-muted text-uppercase"><?= _("Action") ?></th>
</tr>
</thead>
<tbody>
<?php if (empty($geds)): ?>
<tr>
<td colspan="3" class="text-center py-4 text-muted small italic">
<i class="fa-solid fa-circle-info me-2"></i><?= _("Aucun document numérisé pour cette facture.") ?>
</td>
</tr>
<?php else: ?>
<?php foreach ($geds as $ged):
$idGed = $this->nettoyer($ged['idGed']);
$cheminFichier = $this->nettoyer($ged['cheminFichier']);
$nomFichier = $this->nettoyer($ged['nomOrigine']);
// Détection de l'icône selon l'extension
$extension = strtolower(pathinfo($nomFichier, PATHINFO_EXTENSION));
$icon = "fa-file-lines";
if(in_array($extension, ['jpg', 'jpeg', 'png'])) $icon = "fa-file-image text-info";
if($extension == 'pdf') $icon = "fa-file-pdf text-danger";
?>
<tr>
<td class="text-center">
<div class="small fw-bold text-dark"><?= dateLang($this->nettoyer($ged['dateSysteme']), $_SESSION['lang']) ?></div>
<div class="extra-small text-muted"><?= date('H:i', strtotime($ged['dateSysteme'])) ?></div>
</td>
<td>
<div class="d-flex align-items-center">
<i class="fa-solid <?= $icon ?> fs-4 me-3"></i>
<div class="text-truncate" style="max-width: 400px;">
<span class="fw-bold d-block small mb-0"><?= $nomFichier ?></span>
<span class="extra-small text-muted">ID: #<?= $idGed ?></span>
</div>
</div>
</td>
<td class="text-center">
<a href="<?= $cheminFichier ?>"
target="_blank"
class="btn btn-sm btn-outline-primary rounded-pill px-3 shadow-sm"
title="<?= _("Visualiser le document") ?>">
<i class="fa-solid fa-download me-1"></i> <?= _("Ouvrir") ?>
</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<style>
.extra-small { font-size: 0.7rem; }
.italic { font-style: italic; }
.table-hover tbody tr:hover { background-color: rgba(0,0,0,0.02); }
</style>