minor fixes
This commit is contained in:
@@ -34,7 +34,6 @@ templ PDFReportEmploye(e models.User, workDays []models.WorkDay, tsStart time.Ti
|
||||
}
|
||||
}}
|
||||
<p class={ noBorder }>{ day.Day.Format("02.01.2006") }</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>
|
||||
@@ -48,7 +47,7 @@ templ PDFReportEmploye(e models.User, workDays []models.WorkDay, tsStart time.Ti
|
||||
{{ work, pause, overtime := day.GetAllWorkTimes(e) }}
|
||||
@ColorDuration(work, noBorder)
|
||||
@ColorDuration(pause, noBorder)
|
||||
@ColorDuration(overtime, noBorder + " border-r-0")
|
||||
@ColorDuration(overtime, noBorder+" border-r-0")
|
||||
if day.Day.Weekday() == time.Friday {
|
||||
<p class="col-span-full bg-neutral-300">Wochenende</p>
|
||||
}
|
||||
@@ -57,144 +56,12 @@ templ PDFReportEmploye(e models.User, workDays []models.WorkDay, tsStart time.Ti
|
||||
</content>
|
||||
}
|
||||
|
||||
templ PDFReportEmployeTable(e models.User, workDays []models.WorkDay, tsStart time.Time, tsEnd time.Time) {
|
||||
templ ColorDuration(d time.Duration, classes string) {
|
||||
{{
|
||||
_, 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">Kim Mustermensch</h1>
|
||||
<p>Zeitraum: <span>{ tsStart.Format("02.01.2006") }</span> - <span>{ tsEnd.Format("02.01.2006") }</span></p>
|
||||
<p>Arbeitszeit: <span></span></p>
|
||||
<p>Überstunden: <span></span></p>
|
||||
</div>
|
||||
<table class="*:*:*:border-1 *:text-center border-1 border-collapse">
|
||||
<tr>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">{ kw }</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Kommen</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Gehen</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Arbeitsart</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Stunden</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Pause</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7 border-r-0">Überstunden</th>
|
||||
</tr>
|
||||
for index, day := range workDays {
|
||||
{{
|
||||
if index == len(workDays)-1 {
|
||||
noBorder = "border-b-0"
|
||||
}
|
||||
}}
|
||||
<tr>
|
||||
<td class={ noBorder }>{ day.Day.Format("02.01.2006") }</td>
|
||||
<td colspan="3">
|
||||
<table class={ "w-full border-collapse" + noBorder }>
|
||||
for bookingI := 0; bookingI < len(day.Bookings); bookingI+= 2 {
|
||||
<tr class="flex">
|
||||
<td class="border-r-1 grow">{ day.Bookings[bookingI].Timestamp.Format("15:04") }</td>
|
||||
<td class="border-r-1 grow">{ day.Bookings[bookingI+1].Timestamp.Format("15:04") }</td>
|
||||
<td class="grow">{ day.Bookings[bookingI].BookingType.Name } </td>
|
||||
</tr>
|
||||
}
|
||||
if (day.Absence != models.Absence{}) {
|
||||
if len(day.Bookings) > 0 {
|
||||
<tr class="border-t-1">
|
||||
<td colspan="2" class="col-span-full">{ day.Absence.AbwesenheitTyp.Name }</td>
|
||||
</tr>
|
||||
}
|
||||
else {
|
||||
<tr>
|
||||
<td colspan="2" class="col-span-full">{ day.Absence.AbwesenheitTyp.Name }</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
{{ work, pause, overtime := day.GetAllWorkTimes(e) }}
|
||||
@ColorDuration(work, noBorder)
|
||||
@ColorDuration(pause, noBorder)
|
||||
@ColorDuration(overtime, noBorder + " border-r-0")
|
||||
if day.Day.Weekday() == time.Friday {
|
||||
<tr>
|
||||
<td colspan="7" class="col-span-full bg-neutral-300">Wochenende</td>
|
||||
</tr>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</content>
|
||||
<div class="p-8 relative flex flex-col gap-4 break-after-page">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold">Kim Mustermensch</h1>
|
||||
<p>Zeitraum: <span>{ tsStart.Format("02.01.2006") }</span> - <span>{ tsEnd.Format("02.01.2006") }</span></p>
|
||||
<p>Arbeitszeit: <span></span></p>
|
||||
<p>Überstunden: <span></span></p>
|
||||
</div>
|
||||
<table class="*:*:*:border-1 *:text-center border-1 border-collapse">
|
||||
<tr>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">{ kw }</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Kommen</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Gehen</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Arbeitsart</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Stunden</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7">Pause</th>
|
||||
<th class="bg-neutral-300 border-neutral-600 w-1/7 border-r-0">Überstunden</th>
|
||||
</tr>
|
||||
for index, day := range workDays {
|
||||
{{
|
||||
if index == len(workDays)-1 {
|
||||
noBorder = "border-b-0"
|
||||
}
|
||||
}}
|
||||
<tr>
|
||||
<td class={ noBorder }>{ day.Day.Format("02.01.2006") }</td>
|
||||
<td colspan="3">
|
||||
<table class={ "w-full border-collapse" + noBorder }>
|
||||
for bookingI := 0; bookingI < len(day.Bookings); bookingI+= 2 {
|
||||
<tr class="flex">
|
||||
<td class="border-r-1 grow">{ day.Bookings[bookingI].Timestamp.Format("15:04") }</td>
|
||||
<td class="border-r-1 grow">{ day.Bookings[bookingI+1].Timestamp.Format("15:04") }</td>
|
||||
<td class="grow">{ day.Bookings[bookingI].BookingType.Name } </td>
|
||||
</tr>
|
||||
}
|
||||
if (day.Absence != models.Absence{}) {
|
||||
if len(day.Bookings) > 0 {
|
||||
<tr class="border-t-1">
|
||||
<td colspan="2" class="col-span-full">{ day.Absence.AbwesenheitTyp.Name }</td>
|
||||
</tr>
|
||||
}
|
||||
else {
|
||||
<tr>
|
||||
<td colspan="2" class="col-span-full">{ day.Absence.AbwesenheitTyp.Name }</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
{{ work, pause, overtime := day.GetAllWorkTimes(e) }}
|
||||
@ColorDuration(work, noBorder)
|
||||
@ColorDuration(pause, noBorder)
|
||||
@ColorDuration(overtime, noBorder + " border-r-0")
|
||||
if day.Day.Weekday() == time.Friday {
|
||||
<tr>
|
||||
<td colspan="7" class="col-span-full bg-neutral-300">Wochenende</td>
|
||||
</tr>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ ColorDuration(d time.Duration, classes string){
|
||||
{{
|
||||
color := ""
|
||||
if d.Abs() < time.Minute{
|
||||
if d.Abs() < time.Minute {
|
||||
color = "text-neutral-300"
|
||||
}
|
||||
}}
|
||||
<p class={ color + " " + classes }>{ helper.FormatDurationFill(d, true) }</p>
|
||||
}}
|
||||
<p class={ color + " " + classes }>{ helper.FormatDurationFill(d, true) }</p>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user