diff --git a/Backend/endpoints/time.go b/Backend/endpoints/time.go index 2db1489..7b5acdc 100644 --- a/Backend/endpoints/time.go +++ b/Backend/endpoints/time.go @@ -83,7 +83,7 @@ func getBookings(w http.ResponseWriter, r *http.Request) { return } ctx := context.WithValue(r.Context(), "user", user) - templates.TimeDashboard(bookings).Render(ctx, w) + templates.TimePage(bookings).Render(ctx, w) } func updateBooking(w http.ResponseWriter, r *http.Request) { diff --git a/Backend/endpoints/user.go b/Backend/endpoints/user.go index f821178..ddc8cb3 100644 --- a/Backend/endpoints/user.go +++ b/Backend/endpoints/user.go @@ -34,7 +34,7 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) { func UserHandler(w http.ResponseWriter, r *http.Request) { if !Session.Exists(r.Context(), "user") { - http.Redirect(w, r, "/user/login", http.StatusTemporaryRedirect) + http.Redirect(w, r, "/user/login", http.StatusSeeOther) } switch r.Method { case http.MethodGet: @@ -50,7 +50,7 @@ func UserHandler(w http.ResponseWriter, r *http.Request) { } func showLoginForm(w http.ResponseWriter, r *http.Request, failed bool) { - templates.LoginForm(failed).Render(r.Context(), w) + templates.LoginPage(failed).Render(r.Context(), w) } func loginUser(w http.ResponseWriter, r *http.Request) { @@ -86,8 +86,10 @@ func loginUser(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/time", http.StatusSeeOther) //with this browser always uses GET } else { showLoginForm(w, r, true) + return } showLoginForm(w, r, false) + return } // change user password and store salted hash in db @@ -102,6 +104,7 @@ func changePassword(w http.ResponseWriter, r *http.Request) { newPassword := r.FormValue("new_password") if password == "" || newPassword == "" || newPassword != r.FormValue("new_password_repeat") { showPWForm(w, r, http.StatusBadRequest) + return } user, err := (*models.User).GetByPersonalNummer(nil, Session.GetInt(r.Context(), "user")) if err != nil { @@ -120,5 +123,6 @@ func changePassword(w http.ResponseWriter, r *http.Request) { } func showPWForm(w http.ResponseWriter, r *http.Request, status int) { - templates.UserForm(status).Render(r.Context(), w) + templates.UserPage(status).Render(r.Context(), w) + return } diff --git a/Backend/src/main.css b/Backend/src/main.css index 1309cf2..99c8693 100644 --- a/Backend/src/main.css +++ b/Backend/src/main.css @@ -2,27 +2,59 @@ @source "../templates/*.templ"; @theme { - --color-accent-50: #e7fdea; - --color-accent-100: #cbfbd1; - --color-accent-200: #9cf7a8; - --color-accent-300: #68f37a; - --color-accent-400: #33ef4d; - --color-accent-500: #11db2d; - --color-accent-600: #0eaf23; - --color-accent-700: #0a851b; - --color-accent-800: #075a12; - --color-accent-900: #032b09; - --color-accent-950: #021805; - --color-accent: #0eaf23; - --color-text-50: #f7f8f7; - --color-text-100: #f2f3f2; - --color-text-200: #e2e4e2; - --color-text-300: #d2d6d2; - --color-text-400: #c2c7c2; - --color-text-500: #afb6af; - --color-text-600: #97a097; - --color-text-700: #7d877d; - --color-text-800: #5a625a; - --color-text-900: #161816; - --color-text-950: #000000; + --color-accent-50: #e7fdea; + --color-accent-100: #cbfbd1; + --color-accent-200: #9cf7a8; + --color-accent-300: #68f37a; + --color-accent-400: #33ef4d; + --color-accent-500: #11db2d; + --color-accent-600: #0eaf23; + --color-accent-700: #0a851b; + --color-accent-800: #075a12; + --color-accent-900: #032b09; + --color-accent-950: #021805; + --color-accent: #0eaf23; + --color-text-50: #f7f8f7; + --color-text-100: #f2f3f2; + --color-text-200: #e2e4e2; + --color-text-300: #d2d6d2; + --color-text-400: #c2c7c2; + --color-text-500: #afb6af; + --color-text-600: #97a097; + --color-text-700: #7d877d; + --color-text-800: #5a625a; + --color-text-900: #161816; + --color-text-950: #000000; +} + +@layer components { + .grid-main { + display: grid; + grid-template-columns: repeat(6, 1fr); + align-items: stretch; + } + + .grid-sub { + display: flex; + flex-direction: column; + grid-column: 1 / -1; + border-color: var(--color-neutral-400); + } + + .grid-cell { + padding: calc(var(--spacing) * 2); + border-color: var(--color-neutral-400); + } + + @media (width >=48rem) { + .grid-main { + grid-template-columns: repeat(5, 1fr); + margin: 0 10%; + } + + .grid-sub { + display: grid; + grid-template-columns: subgrid; + } + } } diff --git a/Backend/static/css/styles.css b/Backend/static/css/styles.css index 25acb06..e8bb3df 100644 --- a/Backend/static/css/styles.css +++ b/Backend/static/css/styles.css @@ -541,12 +541,6 @@ } } @layer utilities { - .collapse { - visibility: collapse; - } - .relative { - position: relative; - } .static { position: static; } @@ -556,42 +550,27 @@ .col-span-3 { grid-column: span 3 / span 3; } - .col-span-full { - grid-column: 1 / -1; - } .-my-1 { margin-block: calc(var(--spacing) * -1); } .mt-1 { margin-top: calc(var(--spacing) * 1); } + .mt-auto { + margin-top: auto; + } .mb-2 { margin-bottom: calc(var(--spacing) * 2); } - .block { - display: block; - } .flex { display: flex; } - .grid { - display: grid; - } .hidden { display: none; } .inline { display: inline; } - .inline-flex { - display: inline-flex; - } - .list-item { - display: list-item; - } - .table { - display: table; - } .size-2 { width: calc(var(--spacing) * 2); height: calc(var(--spacing) * 2); @@ -615,18 +594,12 @@ .w-4 { width: calc(var(--spacing) * 4); } - .w-9 { - width: calc(var(--spacing) * 9); - } .w-9\/10 { width: calc(9/10 * 100%); } .w-\[2px\] { width: 2px; } - .w-\[90\%\] { - width: 90%; - } .w-full { width: 100%; } @@ -636,24 +609,12 @@ .grow-1 { flex-grow: 1; } - .border-collapse { - border-collapse: collapse; - } - .transform { - transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y); - } .cursor-pointer { cursor: pointer; } - .resize { - resize: both; - } .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } - .grid-cols-6 { - grid-template-columns: repeat(6, minmax(0, 1fr)); - } .grid-cols-subgrid { grid-template-columns: subgrid; } @@ -698,11 +659,6 @@ border-bottom-width: calc(1px * calc(1 - var(--tw-divide-y-reverse))); } } - .divide-neutral-400 { - :where(& > :not(:last-child)) { - border-color: var(--color-neutral-400); - } - } .justify-self-end { justify-self: flex-end; } @@ -719,10 +675,6 @@ border-style: var(--tw-border-style); border-width: 1px; } - .border-r-0 { - border-right-style: var(--tw-border-style); - border-right-width: 0px; - } .border-neutral-200 { border-color: var(--color-neutral-200); } @@ -780,9 +732,6 @@ .text-accent { color: var(--color-accent); } - .text-accent-600 { - color: var(--color-accent-600); - } .text-neutral-500 { color: var(--color-neutral-500); } @@ -798,20 +747,9 @@ .uppercase { text-transform: uppercase; } - .underline { - text-decoration-line: underline; - } - .outline { - outline-style: var(--tw-outline-style); - outline-width: 1px; - } .filter { filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,); } - .backdrop-filter { - -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,); - backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,); - } .transition { transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter; transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)); @@ -932,11 +870,6 @@ display: block; } } - .md\:grid { - @media (width >= 48rem) { - display: grid; - } - } .md\:hidden { @media (width >= 48rem) { display: none; @@ -952,11 +885,6 @@ width: calc(1/2 * 100%); } } - .md\:grid-cols-5 { - @media (width >= 48rem) { - grid-template-columns: repeat(5, minmax(0, 1fr)); - } - } .md\:px-4 { @media (width >= 48rem) { padding-inline: calc(var(--spacing) * 4); @@ -975,6 +903,33 @@ } } } +@layer components { + .grid-main { + display: grid; + grid-template-columns: repeat(6, 1fr); + align-items: stretch; + } + .grid-sub { + display: flex; + flex-direction: column; + grid-column: 1 / -1; + border-color: var(--color-neutral-400); + } + .grid-cell { + padding: calc(var(--spacing) * 2); + border-color: var(--color-neutral-400); + } + @media (width >=48rem) { + .grid-main { + grid-template-columns: repeat(5, 1fr); + margin: 0 10%; + } + .grid-sub { + display: grid; + grid-template-columns: subgrid; + } + } +} @keyframes spin { to { transform: rotate(360deg); @@ -1001,31 +956,6 @@ animation-timing-function: cubic-bezier(0, 0, 0.2, 1); } } -@property --tw-rotate-x { - syntax: "*"; - inherits: false; - initial-value: rotateX(0); -} -@property --tw-rotate-y { - syntax: "*"; - inherits: false; - initial-value: rotateY(0); -} -@property --tw-rotate-z { - syntax: "*"; - inherits: false; - initial-value: rotateZ(0); -} -@property --tw-skew-x { - syntax: "*"; - inherits: false; - initial-value: skewX(0); -} -@property --tw-skew-y { - syntax: "*"; - inherits: false; - initial-value: skewY(0); -} @property --tw-divide-x-reverse { syntax: "*"; inherits: false; @@ -1045,11 +975,6 @@ syntax: "*"; inherits: false; } -@property --tw-outline-style { - syntax: "*"; - inherits: false; - initial-value: solid; -} @property --tw-blur { syntax: "*"; inherits: false; @@ -1086,42 +1011,6 @@ syntax: "*"; inherits: false; } -@property --tw-backdrop-blur { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-brightness { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-contrast { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-grayscale { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-hue-rotate { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-invert { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-opacity { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-saturate { - syntax: "*"; - inherits: false; -} -@property --tw-backdrop-sepia { - syntax: "*"; - inherits: false; -} @property --tw-duration { syntax: "*"; inherits: false; diff --git a/Backend/static/script.js b/Backend/static/script.js index 405464f..965a5f6 100644 --- a/Backend/static/script.js +++ b/Backend/static/script.js @@ -1,6 +1,6 @@ function editDay(element, event, formId) { var form = element - .closest(".grid-cols-subgrid") + .closest(".grid-sub") .querySelector(".time-component > form"); form.classList.toggle("edit"); element.classList.toggle("edit"); diff --git a/Backend/templates/base.templ b/Backend/templates/base.templ deleted file mode 100644 index aee9b30..0000000 --- a/Backend/templates/base.templ +++ /dev/null @@ -1,11 +0,0 @@ -package templates - -templ Style(){ - - - Arbeitszeit - - - - -} diff --git a/Backend/templates/headerComponent.templ b/Backend/templates/headerComponent.templ new file mode 100644 index 0000000..a44ea10 --- /dev/null +++ b/Backend/templates/headerComponent.templ @@ -0,0 +1,9 @@ +package templates + +templ headerComponent() { +
+ Zeitverwaltung + Mitarbeiter + Nutzer +
+} diff --git a/Backend/templates/base_templ.go b/Backend/templates/headerComponent_templ.go similarity index 82% rename from Backend/templates/base_templ.go rename to Backend/templates/headerComponent_templ.go index ecd5e79..49ef799 100644 --- a/Backend/templates/base_templ.go +++ b/Backend/templates/headerComponent_templ.go @@ -8,7 +8,7 @@ package templates import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -func Style() templ.Component { +func headerComponent() 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 { @@ -29,7 +29,7 @@ func Style() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "Arbeitszeit") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
Zeitverwaltung Mitarbeiter Nutzer
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/Backend/templates/hello.templ b/Backend/templates/hello.templ deleted file mode 100644 index 66aeae0..0000000 --- a/Backend/templates/hello.templ +++ /dev/null @@ -1,5 +0,0 @@ -package templates - -templ Hello(name string) { -
Hello, { name }
-} diff --git a/Backend/templates/hello_templ.go b/Backend/templates/hello_templ.go deleted file mode 100644 index 9a783dd..0000000 --- a/Backend/templates/hello_templ.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.833 -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" - -func Hello(name string) 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
Hello, ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/hello.templ`, Line: 4, Col: 19} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/Backend/templates/pages.templ b/Backend/templates/pages.templ new file mode 100644 index 0000000..b245ee0 --- /dev/null +++ b/Backend/templates/pages.templ @@ -0,0 +1,67 @@ +package templates + +import "arbeitszeitmessung/models" + +templ Base() { + + + Arbeitszeit + + + + +} + +templ TimePage(workDays []models.WorkDay) { + @Base() + @headerComponent() +
+ @inputForm() + for _, bookingGroup := range workDays { + @dayComponent(bookingGroup) + } +
+ @LegendComponent() +} + +templ LoginPage(failed bool) { + @Base() +
+
+

Benutzer Anmelden

+ + + if failed { +

Login fehlgeschlagen, bitte erneut versuchen!

+ } + +
+
+} + +templ UserPage(status int) { + @Base() + @headerComponent() +
+
+
+

Passwort ändern

+
+ + + + switch { + case status == 401: +

Aktuelles Passwort nicht korrekt!

+ case status >= 400: +

Passwortwechsel fehlgeschlagen, bitte erneut versuchen!

+ case status == 200: +

Passwortänderung erfolgreich

+ } +
+
+ +
+
+
+} diff --git a/Backend/templates/pages_templ.go b/Backend/templates/pages_templ.go new file mode 100644 index 0000000..7b18e99 --- /dev/null +++ b/Backend/templates/pages_templ.go @@ -0,0 +1,198 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.833 +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 Base() 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "Arbeitszeit") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func TimePage(workDays []models.WorkDay) 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_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = 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, 2, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = inputForm().Render(ctx, templ_7745c5c3_Buffer) + 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, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = LegendComponent().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func LoginPage(failed bool) 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_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = 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 = 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, 5, "

Login fehlgeschlagen, bitte erneut versuchen!

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func UserPage(status int) 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_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = 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, 7, "

Passwort ändern

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + switch { + case status == 401: + 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, 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, 10, "

Passwortänderung erfolgreich

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/Backend/templates/timeComponents.templ b/Backend/templates/timeComponents.templ index 23bf079..194bc00 100644 --- a/Backend/templates/timeComponents.templ +++ b/Backend/templates/timeComponents.templ @@ -13,22 +13,22 @@ templ inputForm() { urlParams := ctx.Value("urlParams").(url.Values) user := ctx.Value("user").(models.User) }} -
-
+
+

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

Überstunden

4h 32min

-
+ @lineComponent()
-
+
@@ -40,8 +40,8 @@ templ dayComponent(workDay models.WorkDay) { {{ work, pause := workDay.GetWorkTimeString() }} -
-
+
+
@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") }

@@ -54,7 +54,7 @@ templ dayComponent(workDay models.WorkDay) {

{ pause }

-
+
@lineComponent()
for _, booking := range workDay.Bookings { @@ -62,7 +62,7 @@ templ dayComponent(workDay models.WorkDay) { }
-
+
@changeButtonComponent("time-" + workDay.Day.Format("2006-01-02"))
diff --git a/Backend/templates/timeComponents_templ.go b/Backend/templates/timeComponents_templ.go index 93f5cf9..a0c345c 100644 --- a/Backend/templates/timeComponents_templ.go +++ b/Backend/templates/timeComponents_templ.go @@ -40,7 +40,7 @@ func inputForm() templ.Component { urlParams := ctx.Value("urlParams").(url.Values) user := ctx.Value("user").(models.User) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -53,7 +53,7 @@ func inputForm() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

Überstunden

4h 32min

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

Überstunden

4h 32min

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -87,7 +87,7 @@ func inputForm() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" name=\"time_to\" class=\"w-full bg-neutral-100 placeholder:text-neutral-400 text-neutral-700 text-sm border border-neutral-0 rounded-md px-3 py-2 transition duration-300 ease focus:outline-none focus:border-neutral-400 hover:border-neutral-300\" placeholder=\"Zeitraum bis...\">
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" name=\"time_to\" class=\"w-full bg-neutral-100 placeholder:text-neutral-400 text-neutral-700 text-sm border border-neutral-0 rounded-md px-3 py-2 transition duration-300 ease focus:outline-none focus:border-neutral-400 hover:border-neutral-300\" placeholder=\"Zeitraum bis...\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -118,7 +118,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { ctx = templ.ClearChildren(ctx) work, pause := workDay.GetWorkTimeString() - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -193,7 +193,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, 14, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -224,7 +224,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/Backend/templates/timeDashboard.templ b/Backend/templates/timeDashboard.templ deleted file mode 100644 index d33fb64..0000000 --- a/Backend/templates/timeDashboard.templ +++ /dev/null @@ -1,14 +0,0 @@ -package templates - -import "arbeitszeitmessung/models" - -templ TimeDashboard(workDays []models.WorkDay){ - @Style() -
- @inputForm() - for _, bookingGroup := range workDays { - @dayComponent(bookingGroup) - } -
- @LegendComponent() -} diff --git a/Backend/templates/timeDashboard_templ.go b/Backend/templates/timeDashboard_templ.go deleted file mode 100644 index 0aeed82..0000000 --- a/Backend/templates/timeDashboard_templ.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.833 -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 TimeDashboard(workDays []models.WorkDay) 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 = Style().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 = inputForm().Render(ctx, templ_7745c5c3_Buffer) - 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, 2, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = LegendComponent().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/Backend/templates/user.templ b/Backend/templates/user.templ deleted file mode 100644 index ab1f970..0000000 --- a/Backend/templates/user.templ +++ /dev/null @@ -1,37 +0,0 @@ -package templates - -templ LoginForm(failed bool) { - @Style() -
-
-

Benutzer Anmelden

- - - if failed { -

Login fehlgeschlagen, bitte erneut versuchen!

- } - -
-
-} - -templ UserForm(status int) { - @Style() -
-
-

Passwort ändern

- - - - switch { - case status == 401: -

Aktuelles Passwort nicht korrekt!

- case status >= 400: -

Passwortwechsel fehlgeschlagen, bitte erneut versuchen!

- case status == 200: -

Passwortänderung erfolgreich

- } - -
-
-} diff --git a/Backend/templates/user_templ.go b/Backend/templates/user_templ.go deleted file mode 100644 index 5b7a5ae..0000000 --- a/Backend/templates/user_templ.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.833 -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" - -func LoginForm(failed bool) 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 = Style().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Benutzer Anmelden

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

Login fehlgeschlagen, bitte erneut versuchen!

") - 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 - }) -} - -func UserForm(status int) 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_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = Style().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

Passwort ändern

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

Aktuelles Passwort nicht korrekt!

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

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, 7, "

Passwortänderung erfolgreich

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate