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] ??= [ $siteMeta[$siteId] ??= [
'name' => $site->getName(), 'name' => $site->getName(),
'order' => $site->getDisplayOrder(), 'order' => $site->getDisplayOrder(),
'color' => $site->getColor(),
]; ];
} }
@@ -82,7 +83,7 @@ class WorkHourDayExportProvider implements ProviderInterface
if ([] === $rows) { if ([] === $rows) {
continue; continue;
} }
$groups[] = ['siteName' => $meta['name'], 'rows' => $rows]; $groups[] = ['siteName' => $meta['name'], 'siteColor' => $meta['color'], 'rows' => $rows];
} }
$options = new Options(); $options = new Options();
+56 -43
View File
@@ -9,14 +9,14 @@
.title-bar { position: relative; margin: 0 0 3mm 0; } .title-bar { position: relative; margin: 0 0 3mm 0; }
h1 { text-align: center; font-size: 15px; margin: 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; } .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: fixed; border: 2px solid #0a0a0a; }
table { width: 100%; border-collapse: collapse; table-layout: auto; border: 2px solid #0a0a0a; } th, td { border: 1px solid #0a0a0a; padding: 1px 2px; vertical-align: middle; text-align: center; overflow: hidden; }
th, td { border: 1px solid #0a0a0a; padding: 1px 3px; vertical-align: middle; white-space: nowrap; text-align: center; } th { font-weight: 700; background: #f0f0f0; white-space: normal; }
th { font-weight: 700; background: #f0f0f0; } td { white-space: nowrap; }
td.name { text-align: left; } 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; } tr.weekend td { background: #c0c0c0; }
td.statut { background: #b3e5fc; } td.statut { background: #b3e5fc; }
.site-block { page-break-inside: auto; }
</style> </style>
</head> </head>
<body> <body>
@@ -25,44 +25,57 @@
<div class="export-date">Édité le {{ exportedAt }}</div> <div class="export-date">Édité le {{ exportedAt }}</div>
</div> </div>
{% for group in groups %} <table>
<div class="site-block"> <colgroup>
<h2>{{ group.siteName }}</h2> <col style="width: 16%;">
<table> <col style="width: 12%;">
<thead> <col style="width: 9%;">
<tr> <col style="width: 9%;">
<th>Nom</th> <col style="width: 9%;">
<th>Statut</th> <col style="width: 9%;">
<th>Début matin</th> <col style="width: 9%;">
<th>Fin matin</th> <col style="width: 9%;">
<th>Début après-midi</th> <col style="width: 6%;">
<th>Fin après-midi</th> <col style="width: 6%;">
<th>Début soir</th> <col style="width: 6%;">
<th>Fin soir</th> </colgroup>
<th>Jour</th> <thead>
<th>Nuit</th> <tr>
<th>Total</th> <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> </tr>
</thead> {% endfor %}
<tbody> {% endfor %}
{% for row in group.rows %} </tbody>
<tr class="{{ row.isWeekend ? 'weekend' : '' }}"> </table>
<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 %}
</body> </body>
</html> </html>