working on pdf export

This commit is contained in:
2025-09-09 11:07:14 +02:00
parent 2eab598348
commit 133e73a55c
19 changed files with 296 additions and 193 deletions

View File

@@ -1,8 +1,8 @@
package templates
import (
"arbeitszeitmessung/helper"
"arbeitszeitmessung/models"
"arbeitszeitmessung/helper"
"time"
)
@@ -18,29 +18,33 @@ templ PDFReportEmploye(e models.User, workDays []models.WorkDay, tsStart time.Ti
<p>Arbeitszeit: <span></span></p>
<p>Überstunden: <span></span></p>
</div>
<div class="grid grid-rows-6 grid-cols-[auto_1fr_1fr_1fr_1fr_1fr] divide-x-1 divide-y-1">
<p class="px-2 ">KW</p>
<p class="px-2 text-center">Montag</p>
<p class="px-2 text-center">Dienstag</p>
<p class="px-2 text-center">Mittwoche</p>
<p class="px-2 text-center">Donnerstag</p>
<p class="px-2 text-center">Freitag</p>
// <p class="px-2 text-center">Samstag</p>
<p>{ kw }</p>
for d := time.Monday; d < tsStart.Weekday(); d++ {
<p></p>
}
for _, day := range workDays {
<div class="grid grid-rows-6 grid-cols-[auto_1fr_1fr_1fr_1fr_1fr_1fr] divide-x-1 divide-y-1">
<p class="p-2 text-center">{ kw }</p>
<p class="p-2 text-center">Kommen</p>
<p class="p-2 text-center">Gehen</p>
<p class="p-2 text-center">Arbeitsart</p>
<p class="p-2 text-center">Stunden gesamt</p>
<p class="p-2 text-center">Pause</p>
<p class="p-2 text-center">Überstunden</p>
for _, day := range workDays{
if day.Day.Weekday() == time.Monday {
<p>{ helper.GetKW(day.Day) } </p>
<p class="p-2 col-span-7 text-center bg-neutral-300">Wochenende</p>
}
<p class="p-2 text-center">{ day.Day.Format("02.01.2006") }</p>
<div class="grid grid-cols-subgrid col-span-3">
for bookingI := 0; bookingI < len(day.Bookings); bookingI+= 2 {
<p class="p-2 text-center">{ day.Bookings[bookingI].Timestamp.Format("15:04") }</p>
<p class="p-2 text-center">{ day.Bookings[bookingI+1].Timestamp.Format("15:04") }</p>
<p class="p-2 text-center">{ day.Bookings[bookingI].BookingType.Name } </p>
}
<div class="flex flex-col gap-2">
<p>{ helper.GetFirst(day.GetWorkTimeString()) }</p>
for i := 0; i < len(day.Bookings); i += 2 {
<p>{ day.Bookings[i].Timestamp.Format("15:04") } - { day.Bookings[i+1].Timestamp.Format("15:04") }</p>
}
</div>
{{ work, pause := day.GetWorkTimeString() }}
<p class="p-2 text-center">{ work }</p>
<p class="p-2 text-center">{ pause }</p>
<p class="p-2 text-center">{ helper.FormatDuration(day.CalcOvertime(e)) }</p>
}
</div>
</content>
}