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();
+23 -10
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,10 +25,20 @@
<div class="export-date">Édité le {{ exportedAt }}</div> <div class="export-date">Édité le {{ exportedAt }}</div>
</div> </div>
{% for group in groups %}
<div class="site-block">
<h2>{{ group.siteName }}</h2>
<table> <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> <thead>
<tr> <tr>
<th>Nom</th> <th>Nom</th>
@@ -45,6 +55,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <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 %} {% for row in group.rows %}
<tr class="{{ row.isWeekend ? 'weekend' : '' }}"> <tr class="{{ row.isWeekend ? 'weekend' : '' }}">
<td class="name">{{ row.employeeName }}</td> <td class="name">{{ row.employeeName }}</td>
@@ -60,9 +74,8 @@
<td>{{ row.total }}</td> <td>{{ row.total }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endfor %}
</tbody> </tbody>
</table> </table>
</div>
{% endfor %}
</body> </body>
</html> </html>