feat(heures) : export PDF des heures (vue jour) par sites (#24)
Auto Tag Develop / tag (push) Successful in 7s
Auto Tag Develop / tag (push) Successful in 7s
## Résumé Ajoute un bouton **Exporter** (admin uniquement) à droite du titre « Heures » qui génère un **PDF d'une journée**, regroupé par site, reprenant les colonnes de la vue Jour **sans la colonne « Valider »**. - Drawer : champ date (préremplit la date affichée) + cases à cocher des sites (préselectionnées sur le filtre courant). - Portée identique à l'écran : non-conducteurs, sous contrat à la date, sites cochés (lignes vides incluses). - Jour/Nuit/Total incluent le crédit d'absence et le crédit virtuel férié. ## Implémentation - Back : `WorkHourDayExport` (ApiResource) + `WorkHourDayExportProvider`, endpoint `GET /work-hours/day-export?workDate=&siteIds=` (ROLE_ADMIN). - Calcul des cellules mutualisé via `YearlyHoursExportBuilder::buildDayRowsForEmployees` (source unique de vérité). - Gabarit `templates/work-hour-day-export/print.html.twig` (A4 portrait compact). - Front : `HoursDayExportDrawer.vue` + câblage dans `pages/hours.vue`. - Docs : `doc/hours-day-export.md`, `documentation-content.ts`, `CLAUDE.md`. ## Tests - Test unitaire `YearlyHoursDayRowsTest` ajouté. - Suite complète verte : 173 tests, 359 assertions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #24 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #24.
This commit is contained in:
@@ -2,8 +2,25 @@
|
||||
<div class="h-full overflow-hidden flex flex-col">
|
||||
<div class="flex flex-wrap items-center justify-between gap-4">
|
||||
<h1 class="text-2xl font-bold text-primary-500 lg:text-4xl">Heures</h1>
|
||||
<MalioButton
|
||||
v-if="isAdmin"
|
||||
label="Export"
|
||||
variant="secondary"
|
||||
icon-name="mdi:download"
|
||||
icon-position="left"
|
||||
@click="isExportDrawerOpen = true"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<HoursDayExportDrawer
|
||||
v-model="isExportDrawerOpen"
|
||||
:sites="sites"
|
||||
:initial-date="selectedDate"
|
||||
:initial-site-ids="selectedSiteIds"
|
||||
:is-loading="isExporting"
|
||||
@submit="handleExport"
|
||||
/>
|
||||
|
||||
<HoursToolbar
|
||||
v-model:selected-date="selectedDate"
|
||||
v-model:view-mode="viewMode"
|
||||
@@ -213,6 +230,21 @@ const {
|
||||
reloadWeeklySummary
|
||||
} = useHoursPage()
|
||||
|
||||
const { printPdf } = usePdfPrinter()
|
||||
const isExportDrawerOpen = ref(false)
|
||||
const isExporting = ref(false)
|
||||
|
||||
const handleExport = async (payload: { date: string; siteIds: number[] }) => {
|
||||
isExporting.value = true
|
||||
try {
|
||||
const siteIdsParam = payload.siteIds.join(',')
|
||||
await printPdf(`/work-hours/day-export?workDate=${payload.date}&siteIds=${siteIdsParam}`)
|
||||
isExportDrawerOpen.value = false
|
||||
} finally {
|
||||
isExporting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
useHead({
|
||||
title: 'Heures'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user