CHANGE: added team view, with submitted bookings for team members and send form for own bookings

This commit is contained in:
2025-02-25 15:08:34 +01:00
parent 478fd53d4f
commit d68a19790e
14 changed files with 846 additions and 1766 deletions

View File

@@ -42,21 +42,10 @@ func parseTimestamp(r *http.Request, get_key string, fallback string) (time.Time
// Returns bookings from DB with similar card uid -> checks for card uid in http query params
func getBookings(w http.ResponseWriter, r *http.Request) {
var user models.User
var err error
if helper.GetEnv("GO_ENV", "production") == "debug" {
user, err = (*models.User).GetByPersonalNummer(nil, 123)
} else {
if !Session.Exists(r.Context(), "user") {
log.Println("No user in session storage!")
http.Error(w, "Not logged in!", http.StatusForbidden)
return
}
user, err = (*models.User).GetByPersonalNummer(nil, Session.GetInt(r.Context(), "user"))
}
user, err := (*models.User).GetUserFromSession(nil, Session, r.Context())
if err != nil {
log.Println("No user found with the given personal number!")
http.Error(w, "No user found", http.StatusNotFound)
http.Redirect(w, r, "/user/login", http.StatusSeeOther)
return
}