parcoursmob/renderer/administration.go

44 lines
1.6 KiB
Go

package renderer
import (
"net/http"
agendastorage "git.coopgo.io/coopgo-platform/agenda/storage"
mobilityaccountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
)
const administrationMenu = "administration"
func (renderer *Renderer) Administration(w http.ResponseWriter, r *http.Request, accounts any, beneficiaries any, groups any, bookings any, events []agendastorage.Event) {
files := renderer.ThemeConfig.GetStringSlice("views.administration.home.files")
state := NewState(r, renderer.ThemeConfig, administrationMenu)
state.ViewState = map[string]any{
"accounts": accounts,
"beneficiaries": beneficiaries,
"bookings": bookings,
"groups": groups,
"events": events,
}
renderer.Render("administration", w, r, files, state)
}
func (renderer *Renderer) AdministrationCreateGroup(w http.ResponseWriter, r *http.Request) {
files := renderer.ThemeConfig.GetStringSlice("views.administration.create_group.files")
state := NewState(r, renderer.ThemeConfig, administrationMenu)
renderer.Render("administration", w, r, files, state)
}
func (renderer *Renderer) AdministrationGroupDisplay(w http.ResponseWriter, r *http.Request, group any, groupmembers []mobilityaccountsstorage.Account, admins []mobilityaccountsstorage.Account) {
files := renderer.ThemeConfig.GetStringSlice("views.administration.display_group.files")
state := NewState(r, renderer.ThemeConfig, administrationMenu)
state.ViewState = map[string]any{
"group": group,
"members": groupmembers,
"admins": admins,
}
renderer.Render("administration", w, r, files, state)
}