package renderer import ( "net/http" agendastorage "git.coopgo.io/coopgo-platform/agenda/storage" ) const agendaMenu = "agenda" func (renderer *Renderer) AgendaHome(w http.ResponseWriter, r *http.Request, events []agendastorage.Event, groups map[string]any) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.list.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "events": events, "groups": groups, } renderer.Render("agenda home", w, r, files, state) } func (renderer *Renderer) AgendaHistory(w http.ResponseWriter, r *http.Request, events []agendastorage.Event, groups map[string]any) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.history.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "events": events, "groups": groups, } renderer.Render("agenda history", w, r, files, state) } func (renderer *Renderer) AgendaCreateEvent(w http.ResponseWriter, r *http.Request, events_file_types []string, file_types_map map[string]string, documents any) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.create_event.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "events_file_types": events_file_types, "file_types_map": file_types_map, "documents": documents, } renderer.Render("agenda create event", w, r, files, state) } func (renderer *Renderer) AgendaDisplayEvent(w http.ResponseWriter, r *http.Request, event any, group any, events_file_types []string, file_types_map map[string]string, documents any, subscribers map[string]any, beneficiaries any) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.display_event.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "event": event, "group": group, "events_file_types": events_file_types, "file_types_map": file_types_map, "documents": documents, "subscribers": subscribers, "beneficiaries": beneficiaries, } renderer.Render("agenda create event", w, r, files, state) } //////////////////////////DElete subscriber////////////////////////////////// func (renderer *Renderer) AgendaDeleteSubscribeEvent(w http.ResponseWriter, r *http.Request, eventid string) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.delete_subscriber.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "eventid": eventid, } renderer.Render("agenda delete subscriber", w, r, files, state) } ////////////////////////////////////////////////////////// //////////////////////////History Event////////////////////////////////// func (renderer *Renderer) AgendaHistoryEvent(w http.ResponseWriter, r *http.Request, event any, group any, subscribers map[string]any, beneficiaries any) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.history_event.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "event": event, "group": group, "subscribers": subscribers, "beneficiaries": beneficiaries, } renderer.Render("agenda history event", w, r, files, state) } //////////////////////////////////////////////////////////////////////// func (renderer *Renderer) AgendaUpdateEvent(w http.ResponseWriter, r *http.Request, event any) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.update.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "event": event, } renderer.Render("event_update", w, r, files, state) } func (renderer *Renderer) AgendaDeleteEvent(w http.ResponseWriter, r *http.Request, event any) { files := renderer.ThemeConfig.GetStringSlice("views.agenda.delete.files") state := NewState(r, renderer.ThemeConfig, agendaMenu) state.ViewState = map[string]any{ "event": event, } renderer.Render("event_deleteEvent", w, r, files, state) } ////////Event documents//////////////////////// // func (renderer *Renderer) EventDocuments(w http.ResponseWriter, r *http.Request, event any, documents []any) { // files := renderer.ThemeConfig.GetStringSlice("views.agenda.event_files.files") // state := NewState(r, renderer.ThemeConfig, agendaMenu) // state.ViewState = map[string]any{ // "event": event, // "documents": documents, // "eventid": event.(map[string]any)["id"], // "eventtitle": event.(map[string]any)["title"], // } // renderer.Render("event_files", w, r, files, state) // }