2022-08-11 15:26:55 +00:00
|
|
|
package renderer
|
|
|
|
|
2022-11-07 00:24:16 +00:00
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2023-02-22 10:03:33 +00:00
|
|
|
agendastorage "git.coopgo.io/coopgo-platform/agenda/storage"
|
2022-11-07 00:24:16 +00:00
|
|
|
mobilityaccountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
|
|
|
|
)
|
2022-08-11 15:26:55 +00:00
|
|
|
|
|
|
|
const administrationMenu = "administration"
|
|
|
|
|
2023-02-22 10:03:33 +00:00
|
|
|
func (renderer *Renderer) Administration(w http.ResponseWriter, r *http.Request, accounts any, beneficiaries any, groups any, bookings any, events []agendastorage.Event) {
|
2022-08-11 15:26:55 +00:00
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.administration.home.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, administrationMenu)
|
|
|
|
state.ViewState = map[string]any{
|
2022-12-05 19:06:22 +00:00
|
|
|
"accounts": accounts,
|
|
|
|
"beneficiaries": beneficiaries,
|
|
|
|
"bookings": bookings,
|
|
|
|
"groups": groups,
|
2023-02-22 10:03:33 +00:00
|
|
|
"events": events,
|
2022-08-11 15:26:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2022-11-07 00:24:16 +00:00
|
|
|
func (renderer *Renderer) AdministrationGroupDisplay(w http.ResponseWriter, r *http.Request, group any, groupmembers []mobilityaccountsstorage.Account, admins []mobilityaccountsstorage.Account) {
|
2022-08-11 15:26:55 +00:00
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.administration.display_group.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, administrationMenu)
|
|
|
|
state.ViewState = map[string]any{
|
2022-09-06 13:02:59 +00:00
|
|
|
"group": group,
|
|
|
|
"members": groupmembers,
|
|
|
|
"admins": admins,
|
2022-08-11 15:26:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
renderer.Render("administration", w, r, files, state)
|
|
|
|
}
|