diff --git a/Backend/endpoints/pdf-create.go b/Backend/endpoints/pdf-create.go index 5c74326..c98232f 100644 --- a/Backend/endpoints/pdf-create.go +++ b/Backend/endpoints/pdf-create.go @@ -96,10 +96,14 @@ func PDFCreateController(w http.ResponseWriter, r *http.Request) { if err != nil { slog.Warn("Could not create pdf report", slog.Any("Error", err)) } - - w.Header().Set("Content-type", "application/pdf") - output.WriteTo(w) - w.WriteHeader(http.StatusOK) + switch pp.ParseStringFallback("output", "render") { + case "render": + w.Header().Set("Content-type", "application/pdf") + output.WriteTo(w) + w.WriteHeader(http.StatusOK) + case "download": + panic("Not implemented") + } default: http.Error(w, "Method not allowed!", http.StatusMethodNotAllowed) diff --git a/Backend/models/workDay.go b/Backend/models/workDay.go index f6e88d1..e8f1bd6 100644 --- a/Backend/models/workDay.go +++ b/Backend/models/workDay.go @@ -231,7 +231,6 @@ func GetWorkDays(user User, tsFrom, tsTo time.Time) []WorkDay { return workDays } defer rows.Close() - // emptyDays, _ := strconv.ParseBool(helper.GetEnv("EMPTY_DAYS", "false")) for rows.Next() { var workDay WorkDay var bookings []byte diff --git a/Backend/templates/headerComponent_templ.go b/Backend/templates/headerComponent_templ.go index b13c034..39e8195 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.924 +// templ: version: v0.3.943 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 7753eaa..6e32b44 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.924 +// templ: version: v0.3.943 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/pdf.templ b/Backend/templates/pdf.templ index 332ab33..7bed3a1 100644 --- a/Backend/templates/pdf.templ +++ b/Backend/templates/pdf.templ @@ -10,7 +10,7 @@ import ( templ PDFForm(teamMembers []models.User) { @Base() @headerComponent() -
+

PDF Abrechnung erstellen

@@ -18,7 +18,7 @@ templ PDFForm(teamMembers []models.User) {
Zeitraum wählen
- +
@@ -30,7 +30,7 @@ templ PDFForm(teamMembers []models.User) { for _, member := range teamMembers { - @CheckboxComponent(fmt.Sprintf("pdf-%d", member.PersonalNummer), fmt.Sprintf("%s %s", member.Vorname, member.Name)) + @CheckboxComponent(member.PersonalNummer, fmt.Sprintf("%s %s", member.Vorname, member.Name)) }
@@ -38,17 +38,20 @@ templ PDFForm(teamMembers []models.User) {
PDFs Bündeln
- - + +
- + } -templ CheckboxComponent(id, label string) { +templ CheckboxComponent(pNr int, label string) { + {{ + id := fmt.Sprintf("pdf-%d", pNr) + }}
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -257,9 +285,9 @@ func ColorDuration(d time.Duration, classes string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var9 := templ.GetChildren(ctx) - if templ_7745c5c3_Var9 == nil { - templ_7745c5c3_Var9 = templ.NopComponent + templ_7745c5c3_Var11 := templ.GetChildren(ctx) + if templ_7745c5c3_Var11 == nil { + templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) @@ -267,38 +295,38 @@ func ColorDuration(d time.Duration, classes string) templ.Component { if d.Abs() < time.Minute { color = "text-neutral-300" } - var templ_7745c5c3_Var10 = []any{color + " " + classes} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var10...) + var templ_7745c5c3_Var12 = []any{color + " " + classes} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var12...) 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, 15, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var12 string - templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(helper.FormatDurationFill(d, true)) + var templ_7745c5c3_Var14 string + templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(helper.FormatDurationFill(d, true)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pdf.templ`, Line: 132, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pdf.templ`, Line: 135, Col: 72} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) 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, 16, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/Backend/templates/presencePage_templ.go b/Backend/templates/presencePage_templ.go index c7eca82..b2820e0 100644 --- a/Backend/templates/presencePage_templ.go +++ b/Backend/templates/presencePage_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.924 +// templ: version: v0.3.943 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 8cdc91c..b23c68b 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.924 +// templ: version: v0.3.943 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 d14abca..09fd2c6 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.924 +// templ: version: v0.3.943 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/timePage_templ.go b/Backend/templates/timePage_templ.go index 506f94c..1a87a94 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.924 +// templ: version: v0.3.943 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present.