From 627f5b7e5bbb9e5157eb94760ea96260d1e59058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Tr=C3=B6ger?= Date: Tue, 7 Oct 2025 12:55:47 +0200 Subject: [PATCH] fixed #50, added default action input to defaultDayComponent --- Backend/endpoints/time.go | 20 +++++++++++--------- Backend/templates/headerComponent_templ.go | 2 +- Backend/templates/pages_templ.go | 2 +- Backend/templates/pdf_templ.go | 2 +- Backend/templates/teamComponents_templ.go | 2 +- Backend/templates/timeComponents_templ.go | 2 +- Backend/templates/timePage.templ | 1 + Backend/templates/timePage_templ.go | 12 ++++++------ 8 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Backend/endpoints/time.go b/Backend/endpoints/time.go index b92d3b5..102c3f2 100644 --- a/Backend/endpoints/time.go +++ b/Backend/endpoints/time.go @@ -127,6 +127,7 @@ func updateBooking(w http.ResponseWriter, r *http.Request) { log.Println("No user found!", err) return } + switch r.FormValue("action") { case "add": timestamp, err := time.ParseInLocation("2006-01-02|15:04", r.FormValue("date")+"|"+r.FormValue("timestamp"), loc) @@ -149,14 +150,14 @@ func updateBooking(w http.ResponseWriter, r *http.Request) { log.Printf("Error inserting booking %v -> %v\n", newBooking, err) } case "change": - absenceType, err := strconv.Atoi(r.FormValue("absence")) - if err != nil { - log.Println("Error parsing absence type.", err) - absenceType = 0 - } - if absenceType != 0 { - createAbsence(absenceType, user, loc, r) - } + // absenceType, err := strconv.Atoi(r.FormValue("absence")) + // if err != nil { + // log.Println("Error parsing absence type.", err) + // absenceType = 0 + // } + // if absenceType != 0 { + // createAbsence(absenceType, user, loc, r) + // } for index, possibleBooking := range r.PostForm { if len(index) > 7 && index[:7] == "booking" { booking_id, err := strconv.Atoi(index[8:]) @@ -174,10 +175,11 @@ func updateBooking(w http.ResponseWriter, r *http.Request) { log.Println("Error parsing time!", err) continue } - // log.Println("Parsing time", parsedTime) booking.UpdateTime(parsedTime) } } + default: + log.Println("No action from /time found") } getBookings(w, r) } diff --git a/Backend/templates/headerComponent_templ.go b/Backend/templates/headerComponent_templ.go index 8e59160..aeef6ec 100644 --- a/Backend/templates/headerComponent_templ.go +++ b/Backend/templates/headerComponent_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.943 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/pages_templ.go b/Backend/templates/pages_templ.go index 14fae96..6283fc4 100644 --- a/Backend/templates/pages_templ.go +++ b/Backend/templates/pages_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.943 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/pdf_templ.go b/Backend/templates/pdf_templ.go index 321301b..3c73ded 100644 --- a/Backend/templates/pdf_templ.go +++ b/Backend/templates/pdf_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.943 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/teamComponents_templ.go b/Backend/templates/teamComponents_templ.go index c1d475e..ec539f2 100644 --- a/Backend/templates/teamComponents_templ.go +++ b/Backend/templates/teamComponents_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.943 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/timeComponents_templ.go b/Backend/templates/timeComponents_templ.go index 565d2bc..1d1f764 100644 --- a/Backend/templates/timeComponents_templ.go +++ b/Backend/templates/timeComponents_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.943 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/timePage.templ b/Backend/templates/timePage.templ index b831ff1..1c68483 100644 --- a/Backend/templates/timePage.templ +++ b/Backend/templates/timePage.templ @@ -149,6 +149,7 @@ templ defaultDayComponent(day models.IWorkDay) { }} @absenceComponent(absentDay, false) } +
diff --git a/Backend/templates/timePage_templ.go b/Backend/templates/timePage_templ.go index ce7b4ea..77a339c 100644 --- a/Backend/templates/timePage_templ.go +++ b/Backend/templates/timePage_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.943 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -463,7 +463,7 @@ func defaultDayComponent(day models.IWorkDay) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -507,7 +507,7 @@ func absentInput(a models.Absence) templ.Component { var templ_7745c5c3_Var21 string templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(a.DateFrom.Format("2006-01-02")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 161, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 162, Col: 78} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) if templ_7745c5c3_Err != nil { @@ -520,7 +520,7 @@ func absentInput(a models.Absence) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(a.DateTo.Format("2006-01-02")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 162, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 163, Col: 74} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { @@ -533,7 +533,7 @@ func absentInput(a models.Absence) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(a.AbwesenheitTyp.Id) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 163, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 164, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -546,7 +546,7 @@ func absentInput(a models.Absence) templ.Component { var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(a.CounterId) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 164, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timePage.templ`, Line: 165, Col: 54} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil {