This commit is contained in:
@@ -126,31 +126,8 @@ templ defaultDayComponent(day models.IWorkDay) {
|
||||
<div class="all-booking-component grid-cell flex flex-row md:col-span-3 col-span-2 gap-2 w-full">
|
||||
@lineComponent()
|
||||
<form id={ "time-" + day.Date().Format(time.DateOnly) } class={ "flex flex-col gap-2 w-full", justify } method="post">
|
||||
switch day.Type() {
|
||||
case models.DayTypeWorkday:
|
||||
{{ workDay, _ := day.(*models.WorkDay) }}
|
||||
@workdayComponent(workDay)
|
||||
@newAbsenceComponent()
|
||||
case models.DayTypeAbsence:
|
||||
{{ absentDay, _ := day.(*models.Absence) }}
|
||||
@absenceComponent(absentDay, false)
|
||||
case models.DayTypeCompound:
|
||||
for _, c := range day.(*models.CompoundDay).DayParts {
|
||||
switch c.Type() {
|
||||
case models.DayTypeWorkday:
|
||||
{{ workDay, _ := c.(*models.WorkDay) }}
|
||||
@workdayComponent(workDay)
|
||||
@newAbsenceComponent()
|
||||
case models.DayTypeAbsence:
|
||||
{{ absentDay, _ := c.(*models.Absence) }}
|
||||
@absenceComponent(absentDay, false)
|
||||
default:
|
||||
<p>{ c.ToString() }</p>
|
||||
}
|
||||
}
|
||||
default:
|
||||
<p>{ day.ToString() }</p>
|
||||
}
|
||||
@newAbsenceComponent()
|
||||
@timeDayTypeSwitch(day, false)
|
||||
<input type="hidden" name="action" value="change"/> <!-- default action value for ändern button -->
|
||||
</form>
|
||||
</div>
|
||||
@@ -160,6 +137,23 @@ templ defaultDayComponent(day models.IWorkDay) {
|
||||
</div>
|
||||
}
|
||||
|
||||
templ timeDayTypeSwitch(day models.IWorkDay, fromCompound bool) {
|
||||
switch day.Type() {
|
||||
case models.DayTypeWorkday:
|
||||
{{ workDay, _ := day.(*models.WorkDay) }}
|
||||
@workdayComponent(workDay)
|
||||
case models.DayTypeAbsence:
|
||||
{{ absentDay, _ := day.(*models.Absence) }}
|
||||
@absenceComponent(absentDay, fromCompound)
|
||||
case models.DayTypeCompound:
|
||||
for _, c := range day.(*models.CompoundDay).DayParts {
|
||||
@timeDayTypeSwitch(c, true)
|
||||
}
|
||||
default:
|
||||
<p>{ day.ToString() }</p>
|
||||
}
|
||||
}
|
||||
|
||||
templ workdayComponent(workDay *models.WorkDay) {
|
||||
if len(workDay.Bookings) < 1 {
|
||||
<p class="text group-[.edit]:hidden">Keine Buchung gefunden. Bitte Arbeitsstunden oder Grund der Abwesenheit eingeben!</p>
|
||||
|
||||
Reference in New Issue
Block a user