This commit is contained in:
@@ -58,71 +58,70 @@ templ CheckboxComponent(id, label string) {
|
||||
</div>
|
||||
}
|
||||
|
||||
templ PDFReportEmploye(e models.User, overtime, worktime time.Duration, workDays []models.IWorkDay, tsStart time.Time, tsEnd time.Time) {
|
||||
{{
|
||||
_, kw := tsStart.ISOWeek()
|
||||
noBorder := ""
|
||||
}}
|
||||
@Base()
|
||||
<content class="p-8 relative flex flex-col gap-4 break-after-page">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold">{ e.Vorname } { e.Name }</h1>
|
||||
<p>Zeitraum: <span>{ tsStart.Format("02.01.2006") }</span> - <span>{ tsEnd.Format("02.01.2006") }</span></p>
|
||||
<p>Arbeitszeit: <span>{ helper.FormatDuration(worktime) }</span></p>
|
||||
<p>Überstunden: <span>{ helper.FormatDuration(overtime) }</span></p>
|
||||
</div>
|
||||
<div class="grid grid-rows-6 grid-cols-[3fr_2fr_2fr_2fr_3fr_3fr_3fr] *:not-print:p-2 *:text-center auto-rows-min divide-neutral-300 divide-x-1 divide-y-1">
|
||||
<p class="bg-neutral-300 border-neutral-600">{ kw }</p>
|
||||
<p class="bg-neutral-300 border-neutral-600">Kommen</p>
|
||||
<p class="bg-neutral-300 border-neutral-600">Gehen</p>
|
||||
<p class="bg-neutral-300 border-neutral-600">Arbeitsart</p>
|
||||
<p class="bg-neutral-300 border-neutral-600">Stunden</p>
|
||||
<p class="bg-neutral-300 border-neutral-600">Pause</p>
|
||||
<p class="bg-neutral-300 border-neutral-600 border-r-0">Überstunden</p>
|
||||
for index, day := range workDays {
|
||||
{{
|
||||
if index == len(workDays)-1 {
|
||||
noBorder = "border-b-0"
|
||||
}
|
||||
}}
|
||||
<p class={ noBorder }>{ day.Date().Format("02.01.2006") }</p>
|
||||
<div class={ "grid grid-cols-subgrid col-span-3 " + noBorder }>
|
||||
if day.IsWorkDay() {
|
||||
{{
|
||||
workDay, _ := day.(*models.WorkDay)
|
||||
}}
|
||||
for bookingI := 0; bookingI < len(workDay.Bookings); bookingI+= 2 {
|
||||
<p>{ workDay.Bookings[bookingI].Timestamp.Format("15:04") }</p>
|
||||
<p>{ workDay.Bookings[bookingI+1].Timestamp.Format("15:04") }</p>
|
||||
<p>{ workDay.Bookings[bookingI].BookingType.Name } </p>
|
||||
}
|
||||
if workDay.IsKurzArbeit() {
|
||||
{{
|
||||
timeFrom, timeTo := workDay.GenerateKurzArbeitBookings(e)
|
||||
}}
|
||||
<p>{ timeFrom.Format("15:04") }</p>
|
||||
<p>{ timeTo.Format("15:04") }</p>
|
||||
<p>Kurzarbeit</p>
|
||||
}
|
||||
} else {
|
||||
{{
|
||||
absentDay, _ := day.(*models.Absence)
|
||||
}}
|
||||
<p class="col-span-full">{ absentDay.AbwesenheitTyp.Name }</p>
|
||||
}
|
||||
</div>
|
||||
{{ work, pause, overtime := day.GetAllWorkTimesVirtual(e) }}
|
||||
@ColorDuration(work, noBorder)
|
||||
@ColorDuration(pause, noBorder)
|
||||
@ColorDuration(overtime, noBorder+" border-r-0")
|
||||
if day.Date().Weekday() == time.Friday {
|
||||
<p class="col-span-full bg-neutral-300">Wochenende</p>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</content>
|
||||
}
|
||||
|
||||
// templ PDFReportEmploye(e models.User, overtime, worktime time.Duration, workDays []models.IWorkDay, tsStart time.Time, tsEnd time.Time) {
|
||||
// {{
|
||||
// _, kw := tsStart.ISOWeek()
|
||||
// noBorder := ""
|
||||
// }}
|
||||
// @Base()
|
||||
// <content class="p-8 relative flex flex-col gap-4 break-after-page">
|
||||
// <div>
|
||||
// <h1 class="text-2xl font-bold">{ e.Vorname } { e.Name }</h1>
|
||||
// <p>Zeitraum: <span>{ tsStart.Format("02.01.2006") }</span> - <span>{ tsEnd.Format("02.01.2006") }</span></p>
|
||||
// <p>Arbeitszeit: <span>{ helper.FormatDuration(worktime) }</span></p>
|
||||
// <p>Überstunden: <span>{ helper.FormatDuration(overtime) }</span></p>
|
||||
// </div>
|
||||
// <div class="grid grid-rows-6 grid-cols-[3fr_2fr_2fr_2fr_3fr_3fr_3fr] *:not-print:p-2 *:text-center auto-rows-min divide-neutral-300 divide-x-1 divide-y-1">
|
||||
// <p class="bg-neutral-300 border-neutral-600">{ kw }</p>
|
||||
// <p class="bg-neutral-300 border-neutral-600">Kommen</p>
|
||||
// <p class="bg-neutral-300 border-neutral-600">Gehen</p>
|
||||
// <p class="bg-neutral-300 border-neutral-600">Arbeitsart</p>
|
||||
// <p class="bg-neutral-300 border-neutral-600">Stunden</p>
|
||||
// <p class="bg-neutral-300 border-neutral-600">Pause</p>
|
||||
// <p class="bg-neutral-300 border-neutral-600 border-r-0">Überstunden</p>
|
||||
// for index, day := range workDays {
|
||||
// {{
|
||||
// if index == len(workDays)-1 {
|
||||
// noBorder = "border-b-0"
|
||||
// }
|
||||
// }}
|
||||
// <p class={ noBorder }>{ day.Date().Format("02.01.2006") }</p>
|
||||
// <div class={ "grid grid-cols-subgrid col-span-3 " + noBorder }>
|
||||
// if day.IsWorkDay() {
|
||||
// {{
|
||||
// workDay, _ := day.(*models.WorkDay)
|
||||
// }}
|
||||
// for bookingI := 0; bookingI < len(workDay.Bookings); bookingI+= 2 {
|
||||
// <p>{ workDay.Bookings[bookingI].Timestamp.Format("15:04") }</p>
|
||||
// <p>{ workDay.Bookings[bookingI+1].Timestamp.Format("15:04") }</p>
|
||||
// <p>{ workDay.Bookings[bookingI].BookingType.Name } </p>
|
||||
// }
|
||||
// if workDay.IsKurzArbeit() {
|
||||
// {{
|
||||
// timeFrom, timeTo := workDay.GenerateKurzArbeitBookings(e)
|
||||
// }}
|
||||
// <p>{ timeFrom.Format("15:04") }</p>
|
||||
// <p>{ timeTo.Format("15:04") }</p>
|
||||
// <p>Kurzarbeit</p>
|
||||
// }
|
||||
// } else {
|
||||
// {{
|
||||
// absentDay, _ := day.(*models.Absence)
|
||||
// }}
|
||||
// <p class="col-span-full">{ absentDay.AbwesenheitTyp.Name }</p>
|
||||
// }
|
||||
// </div>
|
||||
// {{ work, pause, overtime := day.GetTimesVirtual(e) }}
|
||||
// @ColorDuration(work, noBorder)
|
||||
// @ColorDuration(pause, noBorder)
|
||||
// @ColorDuration(overtime, noBorder+" border-r-0")
|
||||
// if day.Date().Weekday() == time.Friday {
|
||||
// <p class="col-span-full bg-neutral-300">Wochenende</p>
|
||||
// }
|
||||
// }
|
||||
// </div>
|
||||
// </content>
|
||||
// }
|
||||
templ ColorDuration(d time.Duration, classes string) {
|
||||
{{
|
||||
color := ""
|
||||
|
||||
Reference in New Issue
Block a user