package templates import ( "arbeitszeitmessung/helper" "arbeitszeitmessung/models" "net/url" "strconv" "time" ) templ TimePage(workDays []models.WorkDay, lastSub time.Time) { {{ allDays := ctx.Value("days").([]models.IWorkDay) }} @Base() @headerComponent()
@inputForm() for _, day := range allDays { @defaultDayComponent(day) if (day.Date().Weekday() == time.Monday) {
} }
@LegendComponent() } templ inputForm() { {{ urlParams := ctx.Value("urlParams").(url.Values) user := ctx.Value("user").(models.User) }}

{ user.Vorname + " " + user.Name }

Überstunden

{ user.Overtime }

@lineComponent()
} templ defaultDayComponent(day models.IWorkDay) { {{ user := ctx.Value("user").(models.User) justify := "justify-center" if day.IsWorkDay() && len(day.(*models.WorkDay).Bookings) > 1 { justify = "justify-between" } }}
@timeGaugeComponent(day.GetDayProgress(user), day.Date().Equal(time.Now().Truncate(24*time.Hour)))

{ day.Date().Format( "02.01.2006") }

if day.IsWorkDay() { {{ workDay, _ := day.(*models.WorkDay) work, pause, overtime := workDay.GetAllWorkTimesVirtual(user) }} if day.RequiresAction() {

Bitte anpassen

} else { if work > 0 {

Arbeitszeit:

{ helper.FormatDuration(work) }

} if pause > 0 {

{ helper.FormatDuration(pause) }

} if overtime != 0 && len(workDay.Bookings) > 0 {

{ helper.FormatDuration(overtime) }

} } }
@lineComponent()
@newAbsenceComponent() if day.IsWorkDay() { {{ workDay, _ := day.(*models.WorkDay) }} if len(workDay.Bookings) < 1 {

Keine Buchung gefunden. Bitte Arbeitsstunden oder Grund der Abwesenheit eingeben!

} for _, booking := range workDay.Bookings { @bookingComponent(booking) } @newBookingComponent(workDay) if workDay.IsKurzArbeit() { @absentInput(workDay.GetKurzArbeit())

Kurzarbeit

} } else { {{ absentDay, _ := day.(*models.Absence) }} @absentInput(*absentDay)

{ absentDay.AbwesenheitTyp.Name } bis { absentDay.DateTo.Format("02.01.2006") }

}
@changeButtonComponent("time-"+day.Date().Format("2006-01-02"), day.IsWorkDay())
} templ absentInput(a models.Absence) { }