feat(heures) : export PDF jour en table unique colonnes fixes + couleur site

This commit is contained in:
2026-06-08 17:46:44 +02:00
parent b7f602bc7b
commit a8750db2eb
2 changed files with 58 additions and 44 deletions
+2 -1
View File
@@ -66,6 +66,7 @@ class WorkHourDayExportProvider implements ProviderInterface
$siteMeta[$siteId] ??= [
'name' => $site->getName(),
'order' => $site->getDisplayOrder(),
'color' => $site->getColor(),
];
}
@@ -82,7 +83,7 @@ class WorkHourDayExportProvider implements ProviderInterface
if ([] === $rows) {
continue;
}
$groups[] = ['siteName' => $meta['name'], 'rows' => $rows];
$groups[] = ['siteName' => $meta['name'], 'siteColor' => $meta['color'], 'rows' => $rows];
}
$options = new Options();
+56 -43
View File
@@ -9,14 +9,14 @@
.title-bar { position: relative; margin: 0 0 3mm 0; }
h1 { text-align: center; font-size: 15px; margin: 0; }
.export-date { position: absolute; top: 0; right: 0; font-size: 8px; color: #333; padding-top: 4px; }
h2 { font-size: 11px; margin: 3mm 0 1mm 0; padding: 2px 6px; background: #e8e8e8; }
table { width: 100%; border-collapse: collapse; table-layout: auto; border: 2px solid #0a0a0a; }
th, td { border: 1px solid #0a0a0a; padding: 1px 3px; vertical-align: middle; white-space: nowrap; text-align: center; }
th { font-weight: 700; background: #f0f0f0; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; border: 2px solid #0a0a0a; }
th, td { border: 1px solid #0a0a0a; padding: 1px 2px; vertical-align: middle; text-align: center; overflow: hidden; }
th { font-weight: 700; background: #f0f0f0; white-space: normal; }
td { white-space: nowrap; }
td.name { text-align: left; }
tr.site-title td { font-weight: bold; font-size: 11px; text-transform: uppercase; text-align: left; padding: 2px 6px; white-space: nowrap; }
tr.weekend td { background: #c0c0c0; }
td.statut { background: #b3e5fc; }
.site-block { page-break-inside: auto; }
</style>
</head>
<body>
@@ -25,44 +25,57 @@
<div class="export-date">Édité le {{ exportedAt }}</div>
</div>
{% for group in groups %}
<div class="site-block">
<h2>{{ group.siteName }}</h2>
<table>
<thead>
<tr>
<th>Nom</th>
<th>Statut</th>
<th>Début matin</th>
<th>Fin matin</th>
<th>Début après-midi</th>
<th>Fin après-midi</th>
<th>Début soir</th>
<th>Fin soir</th>
<th>Jour</th>
<th>Nuit</th>
<th>Total</th>
<table>
<colgroup>
<col style="width: 16%;">
<col style="width: 12%;">
<col style="width: 9%;">
<col style="width: 9%;">
<col style="width: 9%;">
<col style="width: 9%;">
<col style="width: 9%;">
<col style="width: 9%;">
<col style="width: 6%;">
<col style="width: 6%;">
<col style="width: 6%;">
</colgroup>
<thead>
<tr>
<th>Nom</th>
<th>Statut</th>
<th>Début matin</th>
<th>Fin matin</th>
<th>Début après-midi</th>
<th>Fin après-midi</th>
<th>Début soir</th>
<th>Fin soir</th>
<th>Jour</th>
<th>Nuit</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr class="site-title">
<td colspan="11" style="background: {{ group.siteColor ?: '#e8e8e8' }};">{{ group.siteName }}</td>
</tr>
{% for row in group.rows %}
<tr class="{{ row.isWeekend ? 'weekend' : '' }}">
<td class="name">{{ row.employeeName }}</td>
<td class="{{ row.statut ? 'statut' : '' }}">{{ row.statut }}</td>
<td>{{ row.morningFrom }}</td>
<td>{{ row.morningTo }}</td>
<td>{{ row.afternoonFrom }}</td>
<td>{{ row.afternoonTo }}</td>
<td>{{ row.eveningFrom }}</td>
<td>{{ row.eveningTo }}</td>
<td>{{ row.dayHours }}</td>
<td>{{ row.nightHours }}</td>
<td>{{ row.total }}</td>
</tr>
</thead>
<tbody>
{% for row in group.rows %}
<tr class="{{ row.isWeekend ? 'weekend' : '' }}">
<td class="name">{{ row.employeeName }}</td>
<td class="{{ row.statut ? 'statut' : '' }}">{{ row.statut }}</td>
<td>{{ row.morningFrom }}</td>
<td>{{ row.morningTo }}</td>
<td>{{ row.afternoonFrom }}</td>
<td>{{ row.afternoonTo }}</td>
<td>{{ row.eveningFrom }}</td>
<td>{{ row.eveningTo }}</td>
<td>{{ row.dayHours }}</td>
<td>{{ row.nightHours }}</td>
<td>{{ row.total }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
{% endfor %}
{% endfor %}
</tbody>
</table>
</body>
</html>