From 855cd6f34faf22dce727a608420f9ef52713e4e0 Mon Sep 17 00:00:00 2001
From: tom_trgr
Date: Wed, 24 Dec 2025 01:38:16 +0100
Subject: [PATCH] working compound days + working public holidays
---
Backend/Makefile | 14 +-
Backend/endpoints/pdf-create.go | 19 +-
Backend/models/absence.go | 9 +-
Backend/models/compoundDay.go | 105 ++++++
Backend/models/iworkday.go | 64 ++--
Backend/models/publicHoliday.go | 9 +-
Backend/models/workDay.go | 5 +
Backend/templates/pages.templ | 28 +-
Backend/templates/pages_templ.go | 112 ++----
Backend/templates/reportPage.templ | 24 ++
Backend/templates/reportPage_templ.go | 70 ++++
Backend/templates/teamComponents.templ | 71 ++--
Backend/templates/teamComponents_templ.go | 435 ++++++++++++----------
Backend/templates/timeComponents.templ | 14 +-
Backend/templates/timeComponents_templ.go | 299 ++++++++-------
Backend/templates/timePage.templ | 54 ++-
Backend/templates/timePage_templ.go | 188 ++++++----
DB/initdb/02_sample_data.sql | 2 +-
DocumentCreator/Dockerfile | 5 +-
pnpm-lock.yaml | 269 +++++++++++++
20 files changed, 1180 insertions(+), 616 deletions(-)
create mode 100644 Backend/models/compoundDay.go
create mode 100644 Backend/templates/reportPage.templ
create mode 100644 Backend/templates/reportPage_templ.go
diff --git a/Backend/Makefile b/Backend/Makefile
index 34598d0..53655ef 100644
--- a/Backend/Makefile
+++ b/Backend/Makefile
@@ -2,5 +2,15 @@ test:
mkdir -p .test
go test ./... -coverprofile=.test/coverage.out -json > .test/report.json
-scan:
- sonar-scanner -Dsonar.token=sqa_ca8394c93a728d6cff96703955288d8902c15200
+# scan:
+# sonar-scanner -Dsonar.token=sqa_ca8394c93a728d6cff96703955288d8902c15200
+
+# complete live run
+live:
+ make -j2 live/templ live/tailwindcss
+
+live/templ:
+ templ generate --watch --proxy="http://localhost:8080" --cmd="go run ." --open-browser=false
+
+live/tailwind:
+ npx --yes tailwindcss -i ./input.css -o ./assets/styles.css --minify --watch
diff --git a/Backend/endpoints/pdf-create.go b/Backend/endpoints/pdf-create.go
index 443a2a1..2ccfad6 100644
--- a/Backend/endpoints/pdf-create.go
+++ b/Backend/endpoints/pdf-create.go
@@ -45,7 +45,8 @@ func convertDaysToTypst(days []models.IWorkDay, u models.User) ([]typstDay, erro
func convertDayToTypstDayParts(day models.IWorkDay, user models.User) []typstDayPart {
var typstDayParts []typstDayPart
- if day.IsWorkDay() {
+ switch day.Type() {
+ case models.DayTypeWorkday:
workDay, _ := day.(*models.WorkDay)
for i := 0; i < len(workDay.Bookings); i += 2 {
var typstDayPart typstDayPart
@@ -64,13 +65,12 @@ func convertDayToTypstDayParts(day models.IWorkDay, user models.User) []typstDay
IsWorkDay: true,
})
}
- if workdayAbsence := workDay.GetWorktimeAbsence(); (workdayAbsence != models.Absence{}) {
- typstDayParts = append(typstDayParts, typstDayPart{IsWorkDay: false, WorkType: workdayAbsence.AbwesenheitTyp.Name})
+ case models.DayTypeCompound:
+ for _, c := range day.(*models.CompoundDay).DayParts {
+ typstDayParts = append(typstDayParts, convertDayToTypstDayParts(c, user)...)
}
-
- } else {
- absentDay, _ := day.(*models.Absence)
- typstDayParts = append(typstDayParts, typstDayPart{IsWorkDay: false, WorkType: absentDay.AbwesenheitTyp.Name})
+ default:
+ typstDayParts = append(typstDayParts, typstDayPart{IsWorkDay: false, WorkType: day.ToString()})
}
return typstDayParts
}
@@ -91,7 +91,7 @@ func PDFCreateController(w http.ResponseWriter, r *http.Request) {
employes, err := models.GetUserByPersonalNrMulti(personalNumbers)
if err != nil {
slog.Warn("Error getting employes!", slog.Any("Error", err))
- return
+ // return
}
n := 0
@@ -102,6 +102,9 @@ func PDFCreateController(w http.ResponseWriter, r *http.Request) {
}
}
employes = employes[:n]
+ if helper.GetEnv("GO_ENV", "production") == "debug" {
+ employes = append(employes, user)
+ }
reportData := createReports(employes, startDate)
diff --git a/Backend/models/absence.go b/Backend/models/absence.go
index afeb79e..8b7e789 100644
--- a/Backend/models/absence.go
+++ b/Backend/models/absence.go
@@ -22,6 +22,11 @@ type Absence struct {
DateTo time.Time
}
+// IsEmpty implements [IWorkDay].
+func (a *Absence) IsEmpty() bool {
+ return false
+}
+
func NewAbsence(card_uid string, abwesenheit_typ int, datum time.Time) (Absence, error) {
if abwesenheit_typ < 0 {
return Absence{
@@ -95,7 +100,7 @@ func (a *Absence) GetTimes(u User, base WorktimeBase, includeKurzarbeit bool) (w
}
func (a *Absence) ToString() string {
- return "Abwesenheit"
+ return a.AbwesenheitTyp.Name
}
func (a *Absence) IsWorkDay() bool {
@@ -107,7 +112,7 @@ func (a *Absence) IsKurzArbeit() bool {
}
func (a *Absence) GetDayProgress(u User) int8 {
- return 100
+ return a.AbwesenheitTyp.WorkTime
}
func (a *Absence) RequiresAction() bool {
diff --git a/Backend/models/compoundDay.go b/Backend/models/compoundDay.go
new file mode 100644
index 0000000..618d919
--- /dev/null
+++ b/Backend/models/compoundDay.go
@@ -0,0 +1,105 @@
+package models
+
+import (
+ "log/slog"
+ "time"
+)
+
+type CompoundDay struct {
+ Day time.Time
+ DayParts []IWorkDay
+}
+
+func NewCompondDay(date time.Time, dayParts ...IWorkDay) *CompoundDay {
+ return &CompoundDay{Day: date, DayParts: dayParts}
+}
+
+func (c *CompoundDay) AddDayPart(dayPart IWorkDay) {
+ c.DayParts = append(c.DayParts, dayPart)
+}
+
+func (c *CompoundDay) GetWorkDay() WorkDay {
+ workday, ok := c.DayParts[0].(*WorkDay)
+ if ok {
+ return *workday
+ }
+ return WorkDay{}
+}
+
+// IsEmpty implements [IWorkDay].
+func (c *CompoundDay) IsEmpty() bool {
+ return len(c.DayParts) > 0
+}
+
+// Date implements [IWorkDay].
+func (c *CompoundDay) Date() time.Time {
+ return c.Day
+}
+
+// GetDayProgress implements [IWorkDay].
+func (c *CompoundDay) GetDayProgress(u User) int8 {
+ var dayProcess int8
+ for _, day := range c.DayParts {
+ dayProcess += day.GetDayProgress(u)
+ }
+ return dayProcess
+}
+
+// GetOvertime implements [IWorkDay].
+func (c *CompoundDay) GetOvertime(u User, base WorktimeBase, includeKurzarbeit bool) time.Duration {
+
+ var overtime time.Duration
+ for _, day := range c.DayParts {
+ overtime += day.GetOvertime(u, base, includeKurzarbeit)
+ }
+ return overtime
+}
+
+// GetPausetime implements [IWorkDay].
+func (c *CompoundDay) GetPausetime(u User, base WorktimeBase, includeKurzarbeit bool) time.Duration {
+ var pausetime time.Duration
+ for _, day := range c.DayParts {
+ pausetime += day.GetPausetime(u, base, includeKurzarbeit)
+ }
+ return pausetime
+}
+
+// GetTimes implements [IWorkDay].
+func (c *CompoundDay) GetTimes(u User, base WorktimeBase, includeKurzarbeit bool) (work time.Duration, pause time.Duration, overtime time.Duration) {
+ return c.GetWorktime(u, base, includeKurzarbeit), c.GetPausetime(u, base, includeKurzarbeit), c.GetOvertime(u, base, includeKurzarbeit)
+}
+
+// GetWorktime implements [IWorkDay].
+func (c *CompoundDay) GetWorktime(u User, base WorktimeBase, includeKurzarbeit bool) time.Duration {
+ var worktime time.Duration
+ for _, day := range c.DayParts {
+ worktime += day.GetWorktime(u, base, includeKurzarbeit)
+ slog.Info("Calc worktime for day", "day", day, "worktime", worktime.String())
+ }
+ return worktime
+}
+
+// IsKurzArbeit implements [IWorkDay].
+func (c *CompoundDay) IsKurzArbeit() bool {
+ return false
+}
+
+// IsWorkDay implements [IWorkDay].
+func (c *CompoundDay) IsWorkDay() bool {
+ return true
+}
+
+// RequiresAction implements [IWorkDay].
+func (c *CompoundDay) RequiresAction() bool {
+ return false
+}
+
+// ToString implements [IWorkDay].
+func (c *CompoundDay) ToString() string {
+ return "Compound Day"
+}
+
+// Type implements [IWorkDay].
+func (c *CompoundDay) Type() DayType {
+ return DayTypeCompound
+}
diff --git a/Backend/models/iworkday.go b/Backend/models/iworkday.go
index aff96ba..6305842 100644
--- a/Backend/models/iworkday.go
+++ b/Backend/models/iworkday.go
@@ -1,8 +1,6 @@
package models
import (
- "arbeitszeitmessung/helper"
- "log"
"log/slog"
"time"
)
@@ -19,57 +17,73 @@ type IWorkDay interface {
GetPausetime(User, WorktimeBase, bool) time.Duration
GetTimes(User, WorktimeBase, bool) (work, pause, overtime time.Duration)
GetOvertime(User, WorktimeBase, bool) time.Duration
+ IsEmpty() bool
}
type DayType int
const (
- DayTypeWorkday DayType = 1
- DayTypeAbsence DayType = 2
- DayTypeHoliday DayType = 3
+ DayTypeWorkday DayType = 1
+ DayTypeAbsence DayType = 2
+ DayTypeHoliday DayType = 3
+ DayTypeCompound DayType = 4
)
func GetDays(user User, tsFrom, tsTo time.Time, orderedForward bool) []IWorkDay {
var allDays map[string]IWorkDay = make(map[string]IWorkDay)
- for _, day := range GetWorkDays(user, tsFrom, tsTo) {
- allDays[day.Date().Format(time.DateOnly)] = &day
- }
+ workdays := GetWorkDays(user, tsFrom, tsTo)
absences, err := GetAbsencesByCardUID(user.CardUID, tsFrom, tsTo)
if err != nil {
- log.Println("Error gettings absences for all Days!", err)
+ slog.Warn("Error gettings absences!", slog.Any("Error", err))
return nil
}
holidays, err := GetHolidaysFromTo(tsFrom, tsTo)
if err != nil {
- slog.Warn("Error getting holidays from DB!", slog.Any("Error", err))
+ slog.Warn("Error getting holidays!", slog.Any("Error", err))
+ return nil
}
- for _, day := range absences {
- if helper.IsWeekend(day.Date()) {
+
+ for _, day := range workdays {
+ allDays[day.Date().Format(time.DateOnly)] = &day
+ }
+
+ for _, absentDay := range absences {
+ // Kurzarbeit should be integrated in workday
+ existingDay, ok := allDays[absentDay.Date().Format(time.DateOnly)]
+ if !ok {
+ allDays[absentDay.Date().Format(time.DateOnly)] = &absentDay
continue
}
- // Absence should be integrated in workday
switch {
- case day.AbwesenheitTyp.WorkTime < 0:
- if workDay, ok := allDays[day.Date().Format(time.DateOnly)].(*WorkDay); ok {
+ case absentDay.AbwesenheitTyp.WorkTime < 0:
+ if workDay, ok := allDays[absentDay.Date().Format(time.DateOnly)].(*WorkDay); ok {
workDay.kurzArbeit = true
- workDay.kurzArbeitAbsence = day
- }
- case day.AbwesenheitTyp.WorkTime < 100:
- if workDay, ok := allDays[day.Date().Format(time.DateOnly)].(*WorkDay); ok {
- workDay.worktimeAbsece = day
+ workDay.kurzArbeitAbsence = absentDay
}
+ case !existingDay.IsEmpty():
+ allDays[absentDay.Date().Format(time.DateOnly)] = NewCompondDay(absentDay.Date(), existingDay, &absentDay)
default:
- allDays[day.Date().Format(time.DateOnly)] = &day
+ allDays[absentDay.Date().Format(time.DateOnly)] = &absentDay
}
}
- for _, day := range holidays {
- if helper.IsWeekend(day.Date()) {
+ for _, holiday := range holidays {
+ existingDay, ok := allDays[holiday.Date().Format(time.DateOnly)]
+ if !ok {
+ allDays[holiday.Date().Format(time.DateOnly)] = &holiday
continue
}
- allDays[day.Date().Format(time.DateOnly)] = &day
- slog.Debug("Logging Holiday: ", slog.String("HolidayName", allDays[day.Date().Format(time.DateOnly)].ToString()), slog.Any("Overtime", day.GetOvertime(user, WorktimeBaseDay, false).String()), "wokrtie", float32(day.worktime)/100)
+ slog.Info("Existing Day", "day", existingDay)
+ switch {
+ case existingDay.Type() == DayTypeCompound:
+ allDays[holiday.Date().Format(time.DateOnly)].(*CompoundDay).AddDayPart(&holiday)
+ case existingDay.Type() != DayTypeCompound && !existingDay.IsEmpty():
+ allDays[holiday.Date().Format(time.DateOnly)] = NewCompondDay(holiday.Date(), existingDay, &holiday)
+ default:
+ allDays[holiday.Date().Format(time.DateOnly)] = &holiday
+ }
+ slog.Debug("Logging Holiday: ", slog.String("HolidayName", allDays[holiday.Date().Format(time.DateOnly)].ToString()), slog.Any("Overtime", holiday.GetOvertime(user, WorktimeBaseDay, false).String()), "wokrtie", float32(holiday.worktime)/100)
}
sortedDays := sortDays(allDays, orderedForward)
diff --git a/Backend/models/publicHoliday.go b/Backend/models/publicHoliday.go
index 97dce3e..567a610 100644
--- a/Backend/models/publicHoliday.go
+++ b/Backend/models/publicHoliday.go
@@ -14,6 +14,11 @@ type PublicHoliday struct {
worktime int8
}
+// IsEmpty implements [IWorkDay].
+func (p *PublicHoliday) IsEmpty() bool {
+ return false
+}
+
func NewHolidayFromFeiertag(f feiertage.Feiertag) PublicHoliday {
return PublicHoliday{
Feiertag: f,
@@ -106,9 +111,9 @@ func (p *PublicHoliday) RequiresAction() bool {
func (p *PublicHoliday) GetWorktime(u User, base WorktimeBase, includeKurzarbeit bool) time.Duration {
switch base {
case WorktimeBaseDay:
- return u.ArbeitszeitProTagFrac(float32(p.worktime / 100))
+ return u.ArbeitszeitProTagFrac(float32(p.worktime) / 100)
case WorktimeBaseWeek:
- return u.ArbeitszeitProWocheFrac(float32(p.worktime/100) * 0.2)
+ return u.ArbeitszeitProWocheFrac(float32(p.worktime) / 500)
}
return 0
}
diff --git a/Backend/models/workDay.go b/Backend/models/workDay.go
index afdcdc9..c995275 100644
--- a/Backend/models/workDay.go
+++ b/Backend/models/workDay.go
@@ -23,6 +23,11 @@ type WorkDay struct {
worktimeAbsece Absence
}
+// IsEmpty implements [IWorkDay].
+func (d *WorkDay) IsEmpty() bool {
+ return len(d.Bookings) == 0
+}
+
type WorktimeBase int
const (
diff --git a/Backend/templates/pages.templ b/Backend/templates/pages.templ
index 01b142f..55735f8 100644
--- a/Backend/templates/pages.templ
+++ b/Backend/templates/pages.templ
@@ -1,6 +1,7 @@
package templates
import "arbeitszeitmessung/models"
+import "arbeitszeitmessung/helper"
templ Base() {
@@ -29,9 +30,7 @@ templ LoginPage(success bool, errorMsg string) {
}
templ SettingsPage(status int) {
- {{
- user := ctx.Value("user").(models.User)
- }}
+ {{ user := ctx.Value("user").(models.User) }}
@Base()
@headerComponent()
@@ -59,6 +58,8 @@ templ SettingsPage(status int) {
Nutzername: { user.Vorname } { user.Name }
Personalnummer: { user.PersonalNummer }
+
Arbeitszeit pro Tag: { helper.FormatDuration(user.ArbeitszeitProTag()) }
+
Arbeitszeit pro Woche: { helper.FormatDuration(user.ArbeitszeitProWoche()) }
@@ -82,27 +83,6 @@ templ statusCheckMark(status models.WeekStatus, target models.WeekStatus) {
}
}
-templ TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) {
- @Base()
- @headerComponent()
-
-
-
-
Eigene Abrechnung
-
-
- @workWeekComponent(userWeek, false)
- if len(weeks) > 0 {
-
-
Abrechnung Mitarbeiter
-
- }
- for _, week := range weeks {
- @workWeekComponent(week, true)
- }
-
-}
-
templ LogoutButton() {
}
diff --git a/Backend/templates/pages_templ.go b/Backend/templates/pages_templ.go
index 933f53c..0e5daff 100644
--- a/Backend/templates/pages_templ.go
+++ b/Backend/templates/pages_templ.go
@@ -9,6 +9,7 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "arbeitszeitmessung/models"
+import "arbeitszeitmessung/helper"
func Base() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
@@ -76,7 +77,7 @@ func LoginPage(success bool, errorMsg string) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(errorMsg)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 24, Col: 46}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 25, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -153,7 +154,7 @@ func SettingsPage(status int) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(user.Vorname)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 60, Col: 64}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 59, Col: 64}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -166,7 +167,7 @@ func SettingsPage(status int) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(user.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 60, Col: 78}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 59, Col: 78}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -179,13 +180,39 @@ func SettingsPage(status int) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(user.PersonalNummer)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 61, Col: 75}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 60, Col: 75}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
Nutzer abmelden
Nutzer von Weboberfläche abmelden.
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "Arbeitszeit pro Tag: ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var8 string
+ templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(helper.FormatDuration(user.ArbeitszeitProTag()))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 61, Col: 108}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
Arbeitszeit pro Woche: ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var9 string
+ templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(helper.FormatDuration(user.ArbeitszeitProWoche()))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 62, Col: 112}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
Nutzer abmelden
Nutzer von Weboberfläche abmelden.
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -209,18 +236,18 @@ func statusCheckMark(status models.WeekStatus, target models.WeekStatus) templ.C
}()
}
ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Var8 := templ.GetChildren(ctx)
- if templ_7745c5c3_Var8 == nil {
- templ_7745c5c3_Var8 = templ.NopComponent
+ templ_7745c5c3_Var10 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var10 == nil {
+ templ_7745c5c3_Var10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
if status >= target {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -229,63 +256,6 @@ func statusCheckMark(status models.WeekStatus, target models.WeekStatus) templ.C
})
}
-func TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) templ.Component {
- return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
- templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
- if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
- return templ_7745c5c3_CtxErr
- }
- templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
- if !templ_7745c5c3_IsBuffer {
- defer func() {
- templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err == nil {
- templ_7745c5c3_Err = templ_7745c5c3_BufErr
- }
- }()
- }
- ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Var9 := templ.GetChildren(ctx)
- if templ_7745c5c3_Var9 == nil {
- templ_7745c5c3_Var9 = templ.NopComponent
- }
- ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = Base().Render(ctx, templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = headerComponent().Render(ctx, templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = workWeekComponent(userWeek, false).Render(ctx, templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- if len(weeks) > 0 {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
Abrechnung Mitarbeiter
")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- }
- for _, week := range weeks {
- templ_7745c5c3_Err = workWeekComponent(week, true).Render(ctx, templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- return nil
- })
-}
-
func LogoutButton() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
@@ -302,12 +272,12 @@ func LogoutButton() templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Var10 := templ.GetChildren(ctx)
- if templ_7745c5c3_Var10 == nil {
- templ_7745c5c3_Var10 = templ.NopComponent
+ templ_7745c5c3_Var11 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var11 == nil {
+ templ_7745c5c3_Var11 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
diff --git a/Backend/templates/reportPage.templ b/Backend/templates/reportPage.templ
new file mode 100644
index 0000000..df2bab2
--- /dev/null
+++ b/Backend/templates/reportPage.templ
@@ -0,0 +1,24 @@
+package templates
+
+import "arbeitszeitmessung/models"
+
+templ TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) {
+ @Base()
+ @headerComponent()
+
+
+
+
Eigene Abrechnung
+
+
+ @workWeekComponent(userWeek, false)
+ if len(weeks) > 0 {
+
+
Abrechnung Mitarbeiter
+
+ }
+ for _, week := range weeks {
+ @workWeekComponent(week, true)
+ }
+
+}
diff --git a/Backend/templates/reportPage_templ.go b/Backend/templates/reportPage_templ.go
new file mode 100644
index 0000000..6a97c20
--- /dev/null
+++ b/Backend/templates/reportPage_templ.go
@@ -0,0 +1,70 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.3.960
+package templates
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import templruntime "github.com/a-h/templ/runtime"
+
+import "arbeitszeitmessung/models"
+
+func TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = Base().Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = headerComponent().Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = workWeekComponent(userWeek, false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if len(weeks) > 0 {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
Abrechnung Mitarbeiter
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ for _, week := range weeks {
+ templ_7745c5c3_Err = workWeekComponent(week, true).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+var _ = templruntime.GeneratedTemplate
diff --git a/Backend/templates/teamComponents.templ b/Backend/templates/teamComponents.templ
index 26501a4..9790ef7 100644
--- a/Backend/templates/teamComponents.templ
+++ b/Backend/templates/teamComponents.templ
@@ -9,9 +9,7 @@ import (
)
templ weekPicker(weekStart time.Time) {
- {{
- year, kw := weekStart.ISOWeek()
- }}
+ {{ year, kw := weekStart.ISOWeek() }}