rhsaas/Vue/Ajaxsppolice/categorie.php
2026-01-16 07:11:49 +00:00

65 lines
3.3 KiB
PHP

<div id="div_detail_sp" class="animate__animated animate__fadeIn">
<div class="d-flex align-items-center bg-primary text-light p-3 rounded-top shadow-sm">
<i class="fas fa-layer-group me-3"></i>
<h6 class="mb-0 fw-bold text-uppercase"><?= _("Analyse du Rapport S / P par Catégorie") ?></h6>
</div>
<div class="card border-0 shadow-sm rounded-0 rounded-bottom">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0 text-center" style="font-size: 0.9rem;">
<thead class="bg-light text-muted small fw-bold">
<tr>
<th class="py-3" width="10%"><?= _("Produit") ?></th>
<th width="18%"><?= _("Primes Totales") ?></th>
<th width="18%"><?= _("Primes Acquises") ?></th>
<th width="18%"><?= _("Consommations") ?></th>
<th width="18%"><?= _("S/P (Acquis)") ?></th>
<th width="18%"><?= _("S/P Global") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($sppolices as $sppolice):
// Logique de couleur pour le ratio
$ratio = (float)str_replace(',', '.', $sppolice['rapportsp']);
$statusClass = ($ratio >= 100) ? 'text-danger fw-bold' : (($ratio >= 75) ? 'text-warning fw-bold' : 'text-success fw-bold');
$progressColor = ($ratio >= 100) ? 'bg-danger' : (($ratio >= 75) ? 'bg-warning' : 'bg-success');
?>
<tr>
<td>
<span class="badge bg-secondary-subtle text-dark border px-3 py-2"><?= $this->nettoyer($sppolice['codeProduit']) ?></span>
</td>
<td class="text-muted"><?= format_N($this->nettoyer($sppolice['primestat'])) ?></td>
<td class="fw-semibold text-dark"><?= format_N($this->nettoyer($sppolice['prime_acquise'])) ?></td>
<td class="text-danger fw-semibold">
<?= format_N($this->nettoyer($sppolice['consommation'])) ?>
</td>
<td>
<div class="<?= $statusClass ?> mb-1 fs-6">
<?= $this->nettoyer($sppolice['rapportsp']) ?> %
</div>
<div class="progress mx-auto" style="height: 4px; width: 60px;">
<div class="progress-bar <?= $progressColor ?>" role="progressbar" style="width: <?= min($ratio, 100) ?>%"></div>
</div>
</td>
<td class="text-muted small">
<?= $this->nettoyer($sppolice['rapportspgeneral']) ?> %
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<style>
.bg-secondary-subtle { background-color: #f8f9fa; }
.table-hover tbody tr:hover { background-color: rgba(13, 110, 253, 0.02); }
.progress { background-color: #e9ecef; border-radius: 10px; }
</style>