added Gleitzeit + Kurzarbeit closes #23
All checks were successful
Tests / Run Go Tests (push) Successful in 33s

This commit is contained in:
2025-09-13 14:12:39 +02:00
parent ccded6d76b
commit 2d0b117403
18 changed files with 298 additions and 255 deletions

View File

@@ -1,14 +1,15 @@
package templates
import (
"arbeitszeitmessung/models"
"arbeitszeitmessung/helper"
"arbeitszeitmessung/models"
"time"
)
templ PDFReportEmploye(e models.User, workDays []models.WorkDay, tsStart time.Time, tsEnd time.Time) {
{{
_, kw := tsStart.ISOWeek()
noBorder := ""
}}
@Base()
<content class="p-8 relative flex flex-col gap-4">
@@ -18,33 +19,50 @@ 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_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{
<div class="grid grid-rows-6 grid-cols-[3fr_2fr_2fr_2fr_3fr_3fr_3fr] *:p-2 *:text-center auto-rows-min divide-neutral-300 divide-x-1 divide-y-1">
<p class="">{ kw }</p>
<p class="">Kommen</p>
<p class="">Gehen</p>
<p class="">Arbeitsart</p>
<p class="">Stunden</p>
<p class="">Pause</p>
<p class="border-r-0">Überstunden</p>
for index, day := range workDays {
{{
if index == len(workDays)-1 {
noBorder = "border-b-0"
}
}}
if day.Day.Weekday() == time.Monday {
<p class="p-2 col-span-7 text-center bg-neutral-300">Wochenende</p>
<p class="col-span-full bg-neutral-300">Wochenende</p>
}
<p class="p-2 text-center">{ day.Day.Format("02.01.2006") }</p>
<p class={ noBorder }>{ 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={ "grid grid-cols-subgrid col-span-3 " + noBorder }>
for bookingI := 0; bookingI < len(day.Bookings); bookingI+= 2 {
<p>{ day.Bookings[bookingI].Timestamp.Format("15:04") }</p>
<p>{ day.Bookings[bookingI+1].Timestamp.Format("15:04") }</p>
<p>{ day.Bookings[bookingI].BookingType.Name } </p>
}
if (day.Absence != models.Absence{}) {
<p class="col-span-full">{ day.Absence.AbwesenheitTyp.Name }</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>
{{ work, pause, overtime := day.GetAllWorkTimes(e) }}
@ColorDuration(work, noBorder)
@ColorDuration(pause, noBorder)
@ColorDuration(overtime, noBorder + " border-r-0")
}
</div>
</content>
}
templ ColorDuration(d time.Duration, classes string){
{{
color := ""
if d.Abs() < time.Minute{
color = "text-neutral-300"
}
}}
<p class={ color + " " + classes }>{ helper.FormatDurationFill(d, true) }</p>
}