From 5a696788edc0ead13550d3c80e6469f18088a13a Mon Sep 17 00:00:00 2001 From: tom Date: Fri, 28 Mar 2025 13:05:26 +0100 Subject: [PATCH] /time now also uses workDay instead of grouped booking --> outsourcing to sql --- Backend/endpoints/time.go | 17 +- Backend/main.go | 1 + Backend/models/booking.go | 10 +- Backend/models/workDay.go | 15 +- Backend/static/css/styles.css | 14 +- Backend/static/script.js | 4 + Backend/templates/pages.templ | 11 +- Backend/templates/pages_templ.go | 50 ++--- Backend/templates/timeComponents.templ | 39 +++- Backend/templates/timeComponents_templ.go | 242 ++++++++++++---------- 10 files changed, 225 insertions(+), 178 deletions(-) diff --git a/Backend/endpoints/time.go b/Backend/endpoints/time.go index 4035e41..4573249 100644 --- a/Backend/endpoints/time.go +++ b/Backend/endpoints/time.go @@ -8,6 +8,7 @@ import ( "encoding/json" "log" "net/http" + "sort" "strconv" "time" ) @@ -69,20 +70,20 @@ func getBookings(w http.ResponseWriter, r *http.Request) { } tsTo = tsTo.AddDate(0, 0, 1) // so that today is inside - bookings, err := (*models.Booking).GetBookingsGrouped(nil, user.CardUID, tsFrom, tsTo) - if err != nil { - log.Println("Error getting bookings: ", err) - http.Error(w, "Internal Server Error", http.StatusInternalServerError) - return - } + workDays := (*models.WorkDay).GetWorkDays(nil, user.CardUID, tsFrom, tsTo) + sort.Slice(workDays, func(i, j int) bool { + return workDays[i].Day.After(workDays[j].Day) + }) + if r.Header.Get("Accept") == "application/json" { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(bookings) + json.NewEncoder(w).Encode(workDays) return } + ctx := context.WithValue(r.Context(), "user", user) - templates.TimePage(bookings).Render(ctx, w) + templates.TimePage(workDays).Render(ctx, w) } func updateBooking(w http.ResponseWriter, r *http.Request) { diff --git a/Backend/main.go b/Backend/main.go index 86b50aa..e999972 100644 --- a/Backend/main.go +++ b/Backend/main.go @@ -40,6 +40,7 @@ func main() { server.HandleFunc("/user/login", endpoints.LoginHandler) server.HandleFunc("/user", endpoints.UserHandler) server.HandleFunc("/team", endpoints.TeamHandler) + server.HandleFunc("/team/presence", endpoints.TeamHandler) server.Handle("/", http.RedirectHandler("/time", http.StatusPermanentRedirect)) server.Handle("/static/", http.StripPrefix("/static/", fs)) diff --git a/Backend/models/booking.go b/Backend/models/booking.go index ba55cf0..9c84e8c 100644 --- a/Backend/models/booking.go +++ b/Backend/models/booking.go @@ -136,7 +136,7 @@ func (b *Booking) GetBookingsGrouped(card_uid string, tsFrom time.Time, tsTo tim return bookings[i].Timestamp.Before(bookings[j].Timestamp) }) workDay := WorkDay{Day: day, Bookings: bookings} - workDay.GetWorkTime() + workDay.getWorkTime() result = append(result, workDay) } @@ -162,10 +162,14 @@ func (b Booking) Save() { func (b *Booking) GetBookingType() string { switch b.CheckInOut { - case 1, 3: //manuelle Änderung + case 1: //manuelle Änderung return "kommen" - case 2, 4: //manuelle Änderung + case 3: + return "kommen manuell" + case 2: //manuelle Änderung return "gehen" + case 4: + return "gehen manuell" case 255: return "abgemeldet" default: diff --git a/Backend/models/workDay.go b/Backend/models/workDay.go index 56a1a28..e69723c 100644 --- a/Backend/models/workDay.go +++ b/Backend/models/workDay.go @@ -89,13 +89,18 @@ func (d *WorkDay) GetWorkDays(card_uid string, tsFrom, tsTo time.Time) []WorkDay } workDay.workTime = time.Duration(workSec * float64(time.Second)) workDay.pauseTime = time.Duration(pauseSec * float64(time.Second)) - workDay.calcPauseTime() - err = json.Unmarshal(bookings, &workDay.Bookings) if err != nil { log.Println("Error parsing bookings JSON!", err) return nil } + + if workDay.Day.Equal(time.Now().Truncate(24 * time.Hour)) { + workDay.getWorkTime() + } else { + workDay.calcPauseTime() + } + workDays = append(workDays, workDay) } if err = rows.Err(); err != nil { @@ -119,7 +124,7 @@ func (d *WorkDay) calcPauseTime() { } // Gets the duration someone worked that day -func (d *WorkDay) GetWorkTime() { +func (d *WorkDay) getWorkTime() { var workTime, pauseTime time.Duration var lastBooking Booking for _, booking := range d.Bookings { @@ -142,6 +147,7 @@ func (d *WorkDay) GetWorkTime() { d.calcPauseTime() } +// Converts duration to string func formatDuration(d time.Duration) string { hours := int(d.Abs().Hours()) minutes := int(d.Abs().Minutes()) % 60 @@ -155,9 +161,6 @@ func formatDuration(d time.Duration) string { } } -// Converts duration to string and replaces 0s with in -// -// -> output xhxmin func (d *WorkDay) GetWorkTimeString() (string, string) { workString := formatDuration(d.workTime) pauseString := formatDuration(d.pauseTime) diff --git a/Backend/static/css/styles.css b/Backend/static/css/styles.css index acefd6d..90786f3 100644 --- a/Backend/static/css/styles.css +++ b/Backend/static/css/styles.css @@ -556,9 +556,6 @@ .col-span-3 { grid-column: span 3 / span 3; } - .col-span-5 { - grid-column: span 5 / span 5; - } .-my-1 { margin-block: calc(var(--spacing) * -1); } @@ -600,10 +597,6 @@ width: calc(var(--spacing) * 4); height: calc(var(--spacing) * 4); } - .size-8 { - width: calc(var(--spacing) * 8); - height: calc(var(--spacing) * 8); - } .h-4 { height: calc(var(--spacing) * 4); } @@ -634,9 +627,6 @@ .flex-grow { flex-grow: 1; } - .grow { - flex-grow: 1; - } .grow-1 { flex-grow: 1; } @@ -770,6 +760,10 @@ font-size: var(--text-xl); line-height: var(--tw-leading, var(--text-xl--line-height)); } + .text-xs { + font-size: var(--text-xs); + line-height: var(--tw-leading, var(--text-xs--line-height)); + } .font-bold { --tw-font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold); diff --git a/Backend/static/script.js b/Backend/static/script.js index 965a5f6..2d10459 100644 --- a/Backend/static/script.js +++ b/Backend/static/script.js @@ -4,8 +4,12 @@ function editDay(element, event, formId) { .querySelector(".time-component > form"); form.classList.toggle("edit"); element.classList.toggle("edit"); + console.log(form); if (element.classList.contains("edit")) { event.preventDefault(); + form.querySelectorAll("input, select").forEach((input) => { + input.disabled = false; + }); } else { form.submit(); } diff --git a/Backend/templates/pages.templ b/Backend/templates/pages.templ index 8d92ba7..ba80498 100644 --- a/Backend/templates/pages.templ +++ b/Backend/templates/pages.templ @@ -22,15 +22,8 @@ templ TimePage(workDays []models.WorkDay) { @headerComponent()
@inputForm() - for _, bookingGroup := range workDays { - @dayComponent(bookingGroup) - // if (bookingGroup.Day.Weekday() == 4) { - //
- //
- //

Wochenende

- //
- //
- // } + for _, day := range workDays { + @dayComponent(day) }
@LegendComponent() diff --git a/Backend/templates/pages_templ.go b/Backend/templates/pages_templ.go index 22da0f1..c16ffac 100644 --- a/Backend/templates/pages_templ.go +++ b/Backend/templates/pages_templ.go @@ -81,17 +81,13 @@ func TimePage(workDays []models.WorkDay) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - for _, bookingGroup := range workDays { - templ_7745c5c3_Err = dayComponent(bookingGroup).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, " ") + for _, day := range workDays { + templ_7745c5c3_Err = dayComponent(day).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -128,17 +124,17 @@ func LoginPage(failed bool) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

Benutzer Anmelden

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

Benutzer Anmelden

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if failed { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

Login fehlgeschlagen, bitte erneut versuchen!

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

Login fehlgeschlagen, bitte erneut versuchen!

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -175,28 +171,28 @@ func UserPage(status int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "

Passwort ändern

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "

Passwort ändern

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } switch { case status == 401: - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "

Aktuelles Passwort nicht korrekt!

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "

Aktuelles Passwort nicht korrekt!

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } case status >= 400: - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "

Passwortwechsel fehlgeschlagen, bitte erneut versuchen!

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "

Passwortwechsel fehlgeschlagen, bitte erneut versuchen!

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } case status == 200: - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "

Passwortänderung erfolgreich

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "

Passwortänderung erfolgreich

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -235,20 +231,20 @@ func TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) templ.Component if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%s %s", userWeek.User.Vorname, userWeek.User.Name)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 89, Col: 111} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 82, Col: 111} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -258,46 +254,46 @@ func TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) templ.Component return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "

Woche: ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "

Woche: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%02d-%d", kw, year)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 97, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 90, Col: 87} } _, 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, 16, "

an Vorgesetzten senden

an Vorgesetzten senden

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -307,7 +303,7 @@ func TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) templ.Component return templ_7745c5c3_Err } } - 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 } @@ -340,7 +336,7 @@ func NavPage() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/Backend/templates/timeComponents.templ b/Backend/templates/timeComponents.templ index 9102f79..8f95a66 100644 --- a/Backend/templates/timeComponents.templ +++ b/Backend/templates/timeComponents.templ @@ -39,26 +39,43 @@ templ inputForm() { templ dayComponent(workDay models.WorkDay) { {{ work, pause := workDay.GetWorkTimeString() + justify := "" + if len(workDay.Bookings) <= 1 { + justify = "justify-content: center" + } }}
@timeGaugeComponent(workDay.GetWorkDayProgress(ctx.Value("user").(models.User)), workDay.Day.Equal(time.Now().Truncate(24*time.Hour)), workDay.RequiresAction())

{ workDay.Day.Format("02.01.2006") }

-

Arbeitszeit:

- if (workDay.RequiresAction()) { -

Bitte anpassen

- } else { -

{ work }

+ if work!="" { +

Arbeitszeit:

+ if (workDay.RequiresAction()) { +

Bitte anpassen

+ } else { +

{ work }

+ } +

{ pause }

} -

{ pause }

@lineComponent() -
- for _, booking := range workDay.Bookings { - @bookingComponent(booking) + + if len(workDay.Bookings) <= 1 && workDay.Bookings[len(workDay.Bookings)-1].CounterId == 0 { +

Keine Buchung gefunden. Bitte Grund der Abwesenheit eingeben!

+ + } else { + for _, booking := range workDay.Bookings { + @bookingComponent(booking) + } }
@@ -71,7 +88,7 @@ templ dayComponent(workDay models.WorkDay) { templ changeButtonComponent(id string) {
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -201,30 +215,50 @@ func dayComponent(workDay models.WorkDay) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\" class=\"flex flex-col gap-2 group w-full justify-between\" style=\"") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - for _, booking := range workDay.Bookings { - templ_7745c5c3_Err = bookingComponent(booking).Render(ctx, templ_7745c5c3_Buffer) + var templ_7745c5c3_Var11 string + templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(justify) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 65, Col: 131} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\" method=\"post\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(workDay.Bookings) <= 1 && workDay.Bookings[len(workDay.Bookings)-1].CounterId == 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "

Keine Buchung gefunden. Bitte Grund der Abwesenheit eingeben!

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + } else { + for _, booking := range workDay.Bookings { + templ_7745c5c3_Err = bookingComponent(booking).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -232,7 +266,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -256,25 +290,25 @@ func changeButtonComponent(id string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var11 := templ.GetChildren(ctx) - if templ_7745c5c3_Var11 == nil { - templ_7745c5c3_Var11 = templ.NopComponent + templ_7745c5c3_Var12 := templ.GetChildren(ctx) + if templ_7745c5c3_Var12 == nil { + templ_7745c5c3_Var12 = templ.NopComponent } ctx = templ.ClearChildren(ctx) templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, templ.JSFuncCall("editDay", templ.JSExpression("this"), templ.JSExpression("event"), id)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\">

Ändern

Absenden

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -298,9 +332,9 @@ func timeGaugeComponent(progress uint8, today bool, warning bool) templ.Componen }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var13 := templ.GetChildren(ctx) - if templ_7745c5c3_Var13 == nil { - templ_7745c5c3_Var13 = templ.NopComponent + templ_7745c5c3_Var14 := templ.GetChildren(ctx) + if templ_7745c5c3_Var14 == nil { + templ_7745c5c3_Var14 = templ.NopComponent } ctx = templ.ClearChildren(ctx) @@ -323,65 +357,65 @@ func timeGaugeComponent(progress uint8, today bool, warning bool) templ.Componen break } if today { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var14 = []any{"flex w-full items-center justify-center overflow-hidden rounded-full", bgColor} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var14...) + var templ_7745c5c3_Var15 = []any{"flex w-full items-center justify-center overflow-hidden rounded-full", bgColor} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var15...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "\" style=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var17 string + templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(fmt.Sprintf("height: %d%%", int(progress))) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 121, Col: 149} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - var templ_7745c5c3_Var17 = []any{"w-2 h-full bg-accent rounded-md", bgColor} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var17...) + var templ_7745c5c3_Var18 = []any{"w-2 h-full bg-accent rounded-md", bgColor} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var18...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -406,12 +440,12 @@ func lineComponent() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var19 := templ.GetChildren(ctx) - if templ_7745c5c3_Var19 == nil { - templ_7745c5c3_Var19 = templ.NopComponent + templ_7745c5c3_Var20 := templ.GetChildren(ctx) + if templ_7745c5c3_Var20 == nil { + templ_7745c5c3_Var20 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -435,64 +469,64 @@ func bookingComponent(booking models.Booking) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var20 := templ.GetChildren(ctx) - if templ_7745c5c3_Var20 == nil { - templ_7745c5c3_Var20 = templ.NopComponent + templ_7745c5c3_Var21 := templ.GetChildren(ctx) + if templ_7745c5c3_Var21 == nil { + templ_7745c5c3_Var21 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var21 string - templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Timestamp.Format("15:04")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 126, Col: 97} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs("booking_" + strconv.Itoa(booking.CounterId)) + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Timestamp.Format("15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 127, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 143, Col: 97} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "\" type=\"time\" value=\"") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "\" type=\"time\" value=\"") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var24 string - templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(booking.GetBookingType()) + templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Timestamp.Format("15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 128, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 144, Col: 126} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\" class=\"text-neutral-700 group-[.edit]:inline hidden bg-neutral-100 text-sm border border-neutral-200 rounded-md px-3 py-2 transition duration-300 ease focus:outline-none focus:border-neutral-400 hover:border-neutral-300\"> ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var25 string + templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(booking.GetBookingType()) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 145, Col: 29} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -516,12 +550,12 @@ func LegendComponent() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var25 := templ.GetChildren(ctx) - if templ_7745c5c3_Var25 == nil { - templ_7745c5c3_Var25 = templ.NopComponent + templ_7745c5c3_Var26 := templ.GetChildren(ctx) + if templ_7745c5c3_Var26 == nil { + templ_7745c5c3_Var26 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "
Fehler
Arbeitszeit unter regulär
Arbeitszeit vollständig
Überstunden
Keine Buchungen
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
Fehler
Arbeitszeit unter regulär
Arbeitszeit vollständig
Überstunden
Keine Buchungen
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }