diff --git a/Backend/endpoints/team_presence.go b/Backend/endpoints/team_presence.go
index e4ea775..414f8b6 100644
--- a/Backend/endpoints/team_presence.go
+++ b/Backend/endpoints/team_presence.go
@@ -28,10 +28,9 @@ func teamPresence(w http.ResponseWriter, r *http.Request) {
log.Println("Error getting user!", err)
}
team, err := user.GetTeamMembers()
- teamPresence := make(map[bool][]models.User)
+ teamPresence := make(map[models.User]bool)
for _, user := range team {
- present := user.CheckAnwesenheit()
- teamPresence[present] = append(teamPresence[present], user)
+ teamPresence[user] = user.CheckAnwesenheit()
}
if err != nil {
diff --git a/Backend/helper/types.go b/Backend/helper/types.go
index 84fa2c5..7dd6cce 100644
--- a/Backend/helper/types.go
+++ b/Backend/helper/types.go
@@ -3,7 +3,23 @@ package helper
import "time"
type TimeFormValue struct {
- TsFrom time.Time
- TsTo time.Time
+ TsFrom time.Time
+ TsTo time.Time
CardUID string
}
+
+func BoolToInt(b bool) int {
+ var i int = 0
+ if b {
+ i = 1
+ }
+ return i
+}
+
+func BoolToInt8(b bool) int8 {
+ var i int8 = 0
+ if b {
+ i = 1
+ }
+ return i
+}
diff --git a/Backend/models/user.go b/Backend/models/user.go
index ccb188a..e3d94a9 100644
--- a/Backend/models/user.go
+++ b/Backend/models/user.go
@@ -173,7 +173,7 @@ func (u *User) ChangePass(password, newPassword string) (bool, error) {
func (u *User) GetTeamMembers() ([]User, error) {
var teamMembers []User
- qStr, err := DB.Prepare(`SELECT personal_nummer FROM s_personal_daten WHERE vorgesetzter_pers_nr = $1`)
+ qStr, err := DB.Prepare(`SELECT personal_nummer FROM s_personal_daten WHERE vorgesetzter_pers_nr = $1 ORDER BY "nachname";`)
if err != nil {
return teamMembers, err
}
diff --git a/Backend/src/main.css b/Backend/src/main.css
index 85052e2..c54539c 100644
--- a/Backend/src/main.css
+++ b/Backend/src/main.css
@@ -41,7 +41,7 @@
@layer components {
.grid-main {
display: grid;
- grid-template-columns: 4fr 6fr 1fr;
+ grid-template-columns: 4fr 3fr 3fr 1fr;
align-items: stretch;
}
diff --git a/Backend/static/css/styles.css b/Backend/static/css/styles.css
index 387452a..9f5c58c 100644
--- a/Backend/static/css/styles.css
+++ b/Backend/static/css/styles.css
@@ -909,7 +909,7 @@
@layer components {
.grid-main {
display: grid;
- grid-template-columns: 4fr 6fr 1fr;
+ grid-template-columns: 4fr 3fr 3fr 1fr;
align-items: stretch;
}
.grid-sub {
diff --git a/Backend/templates/pages.templ b/Backend/templates/pages.templ
index 8ca8aff..3c60778 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() {
@@ -147,26 +148,36 @@ templ TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) {
}
-templ TeamPresencePage(teamPresence map[bool][]models.User) {
+templ TeamPresencePage(teamPresence map[models.User]bool) {
@Base()
@headerComponent()
-
Anwesend
-
- for _, user := range teamPresence[true] {
- @userPresenceComponent(user, true)
- }
-
+
Mitarbeiter
-
-
Nicht Anwesend
-
- for _, user := range teamPresence[false] {
- @userPresenceComponent(user, false)
- }
+ for user, present := range teamPresence {
+
+
+ @timeGaugeComponent(helper.BoolToInt8(present)*100-1, false)
+
{ user.Vorname } { user.Name }
+
+
+ if present {
+ Anwesend
+ } else {
+ Abwesend
+ }
+
-
+ }
+ //
+ //
Nicht Anwesend
+ //
+ // for _, user := range teamPresence[false] {
+ // @userPresenceComponent(user, false)
+ // }
+ //
+ //
}
diff --git a/Backend/templates/pages_templ.go b/Backend/templates/pages_templ.go
index 3a54c9b..04f8e10 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 {
@@ -246,7 +247,7 @@ func TeamPage(weeks []models.WorkWeek, userWeek models.WorkWeek) templ.Component
})
}
-func TeamPresencePage(teamPresence map[bool][]models.User) templ.Component {
+func TeamPresencePage(teamPresence map[models.User]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 {
@@ -275,27 +276,66 @@ func TeamPresencePage(teamPresence map[bool][]models.User) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
Anwesend
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
Mitarbeiter
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- for _, user := range teamPresence[true] {
- templ_7745c5c3_Err = userPresenceComponent(user, true).Render(ctx, templ_7745c5c3_Buffer)
+ for user, present := range teamPresence {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = timeGaugeComponent(helper.BoolToInt8(present)*100-1, false).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
+ }
+ var templ_7745c5c3_Var8 string
+ templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(user.Vorname)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 162, Col: 22}
+ }
+ _, 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, 19, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var9 string
+ templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(user.Name)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/pages.templ`, Line: 162, Col: 36}
+ }
+ _, 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, 20, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if present {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "Anwesend")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "Abwesend")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
Nicht Anwesend
")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- for _, user := range teamPresence[false] {
- templ_7745c5c3_Err = userPresenceComponent(user, false).Render(ctx, templ_7745c5c3_Buffer)
- 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, 24, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -319,12 +359,12 @@ func LogoutButton() templ.Component {
}()
}
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)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
diff --git a/Backend/templates/timePage.templ b/Backend/templates/timePage.templ
index 5a7da26..eb297d6 100644
--- a/Backend/templates/timePage.templ
+++ b/Backend/templates/timePage.templ
@@ -125,7 +125,7 @@ templ defaultDayComponent(day models.IWorkDay) {
}
-