Compare commits
3 Commits
groupsCovo
...
infoAboutG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
774a3c2301 | ||
|
|
e03f31d3f4 | ||
|
|
a2b644d548 |
2
go.mod
2
go.mod
@@ -4,7 +4,7 @@ go 1.18
|
|||||||
|
|
||||||
// replace git.coopgo.io/coopgo-platform/mobility-accounts => ../../coopgo-platform/mobility-accounts/
|
// replace git.coopgo.io/coopgo-platform/mobility-accounts => ../../coopgo-platform/mobility-accounts/
|
||||||
|
|
||||||
//replace git.coopgo.io/coopgo-platform/groups-management => ../../coopgo-platform/groups-management/
|
replace git.coopgo.io/coopgo-platform/groups-management => ../../coopgo-platform/groups-management/
|
||||||
|
|
||||||
// replace git.coopgo.io/coopgo-platform/fleets => ../../coopgo-platform/fleets/
|
// replace git.coopgo.io/coopgo-platform/fleets => ../../coopgo-platform/fleets/
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -24,16 +25,6 @@ import (
|
|||||||
var Depart any
|
var Depart any
|
||||||
var Arrive any
|
var Arrive any
|
||||||
|
|
||||||
// type Typep string
|
|
||||||
|
|
||||||
// const (
|
|
||||||
// rec Typep = "rec"
|
|
||||||
// pon Typep = "pon"
|
|
||||||
// )
|
|
||||||
|
|
||||||
// var departdate string
|
|
||||||
// var departTime string
|
|
||||||
|
|
||||||
func (h *ApplicationHandler) JourneysSearch(w http.ResponseWriter, r *http.Request) {
|
func (h *ApplicationHandler) JourneysSearch(w http.ResponseWriter, r *http.Request) {
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
|
|
||||||
@@ -193,11 +184,9 @@ func (h *ApplicationHandler) GroupsGestion(w http.ResponseWriter, r *http.Reques
|
|||||||
g := group.ToStorageType()
|
g := group.ToStorageType()
|
||||||
groups = append(groups, g)
|
groups = append(groups, g)
|
||||||
}
|
}
|
||||||
//////////////////
|
|
||||||
|
|
||||||
cacheid := uuid.NewString()
|
cacheid := uuid.NewString()
|
||||||
|
|
||||||
/////////////////
|
|
||||||
sort.Sort(GroupsModule(groups))
|
sort.Sort(GroupsModule(groups))
|
||||||
h.cache.PutWithTTL(cacheid, groups, 1*time.Hour)
|
h.cache.PutWithTTL(cacheid, groups, 1*time.Hour)
|
||||||
|
|
||||||
@@ -224,16 +213,9 @@ func (h *ApplicationHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
|
|||||||
dstinationgeo *geojson.Feature
|
dstinationgeo *geojson.Feature
|
||||||
)
|
)
|
||||||
searched := false
|
searched := false
|
||||||
// var accounts = []any{}
|
|
||||||
// cacheid := uuid.NewString()
|
|
||||||
// accountsBeneficaire, err := h.beneficiaries(r)
|
|
||||||
// if err != nil {
|
|
||||||
// fmt.Println(err)
|
|
||||||
// w.WriteHeader(http.StatusBadRequest)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
if r.FormValue("beneficiaryid") != "" {
|
if r.FormValue("beneficiaryid") != "" {
|
||||||
// Handler form
|
|
||||||
searched = true
|
searched = true
|
||||||
|
|
||||||
requestbeneficiary := &mobilityaccounts.GetAccountRequest{
|
requestbeneficiary := &mobilityaccounts.GetAccountRequest{
|
||||||
@@ -250,8 +232,6 @@ func (h *ApplicationHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
|
|||||||
beneficiary = respbeneficiary.Account.ToStorageType()
|
beneficiary = respbeneficiary.Account.ToStorageType()
|
||||||
|
|
||||||
if r.Method == "POST" {
|
if r.Method == "POST" {
|
||||||
fmt.Println("herrre")
|
|
||||||
///////////////////////////////////////////
|
|
||||||
departure := r.FormValue("departure")
|
departure := r.FormValue("departure")
|
||||||
destination := r.FormValue("destination")
|
destination := r.FormValue("destination")
|
||||||
|
|
||||||
@@ -273,7 +253,6 @@ func (h *ApplicationHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
if r.FormValue("departure") != "" {
|
if r.FormValue("departure") != "" {
|
||||||
var a any
|
var a any
|
||||||
json.Unmarshal([]byte(r.FormValue("departure")), &a)
|
json.Unmarshal([]byte(r.FormValue("departure")), &a)
|
||||||
@@ -288,41 +267,20 @@ func (h *ApplicationHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
|
|||||||
}
|
}
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
|
|
||||||
/////////////////
|
|
||||||
// locTime, errTime := time.LoadLocation("Europe/Paris")
|
|
||||||
// if errTime != nil {
|
|
||||||
// fmt.Println("Loading timezone location Europe/Paris error : ")
|
|
||||||
// fmt.Println("Missing zones in container ? ")
|
|
||||||
// panic(errTime)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// departdate := r.FormValue("departuredate")
|
|
||||||
// departTime := r.FormValue("departuretime")
|
|
||||||
//departuredatetime, _ := time.ParseInLocation("2006-01-02 15:04", fmt.Sprintf("%s %s", departuredate, departuretime), locTime)
|
|
||||||
|
|
||||||
////////////////
|
|
||||||
if r.FormValue("name") == "" {
|
if r.FormValue("name") == "" {
|
||||||
|
|
||||||
fmt.Println("invalid name")
|
fmt.Println("invalid name")
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// if r.FormValue("driver") == "" {
|
|
||||||
|
|
||||||
// fmt.Println("invalid name")
|
|
||||||
// w.WriteHeader(http.StatusBadRequest)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
if r.FormValue("number") == "" {
|
if r.FormValue("number") == "" {
|
||||||
|
|
||||||
fmt.Println("invalid number of personne")
|
fmt.Println("invalid number of personne")
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// planType := map[string]any{
|
|
||||||
// "rrecurrent": r.FormValue("recurrent") == "on",
|
|
||||||
// "pponctuelle": r.FormValue("ponctuelle") == "on",
|
|
||||||
// }
|
|
||||||
planDays := map[string]any{
|
planDays := map[string]any{
|
||||||
"lundi": r.FormValue("lundi") == "on",
|
"lundi": r.FormValue("lundi") == "on",
|
||||||
"mardi": r.FormValue("mardi") == "on",
|
"mardi": r.FormValue("mardi") == "on",
|
||||||
@@ -332,10 +290,9 @@ func (h *ApplicationHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
|
|||||||
"samedi": r.FormValue("samedi") == "on",
|
"samedi": r.FormValue("samedi") == "on",
|
||||||
"dimanche": r.FormValue("dimanche") == "on",
|
"dimanche": r.FormValue("dimanche") == "on",
|
||||||
}
|
}
|
||||||
// var rec bool = r.FormValue("recurrent")
|
|
||||||
// var ponc bool
|
|
||||||
groupidd := uuid.NewString()
|
groupidd := uuid.NewString()
|
||||||
fmt.Println("herrr&e")
|
|
||||||
dataMap := map[string]any{
|
dataMap := map[string]any{
|
||||||
"name": r.FormValue("name"),
|
"name": r.FormValue("name"),
|
||||||
"number": r.FormValue("number"),
|
"number": r.FormValue("number"),
|
||||||
@@ -348,15 +305,12 @@ func (h *ApplicationHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
|
|||||||
"enddate": r.FormValue("enddate"),
|
"enddate": r.FormValue("enddate"),
|
||||||
"departtime": r.FormValue("departtime"),
|
"departtime": r.FormValue("departtime"),
|
||||||
"time": r.FormValue("time"),
|
"time": r.FormValue("time"),
|
||||||
// "ponctdate": r.FormValue("ponctdate"),
|
|
||||||
//"planType": planType,
|
|
||||||
"planDays": planDays,
|
"planDays": planDays,
|
||||||
"recurrent": r.FormValue("recurrent"),
|
"recurrent": r.FormValue("recurrent"),
|
||||||
"pontuelle": r.FormValue("ponctuelle"),
|
"pontuelle": r.FormValue("ponctuelle"),
|
||||||
// "r": rec,
|
|
||||||
// "p": pon,
|
|
||||||
}
|
}
|
||||||
fmt.Println(dataMap["ponctuelle"])
|
|
||||||
data, err := structpb.NewValue(dataMap)
|
data, err := structpb.NewValue(dataMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
@@ -378,25 +332,9 @@ func (h *ApplicationHandler) CreateGroup(w http.ResponseWriter, r *http.Request)
|
|||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////
|
|
||||||
// request_organizatio := &groupsmanagement.AddGroupMemberRequest{
|
|
||||||
// Group: &groupsmanagement.GroupMember{
|
|
||||||
// Id: groupidd,
|
|
||||||
// //Namespace: "parcoursmob_groups_covoiturage",
|
|
||||||
// Data: data.GetStructValue(),
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
|
|
||||||
// _, err = h.services.GRPC.GroupsManagement.AddGroupMember(context.TODO(), request_organizatio)
|
|
||||||
// if err != nil {
|
|
||||||
// fmt.Println(err)
|
|
||||||
// w.WriteHeader(http.StatusInternalServerError)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
////////////////////////////////////////////////
|
|
||||||
http.Redirect(w, r, fmt.Sprintf("/app/journeys/groups_covoiturage/create/%s", request_organization.Group.ToStorageType().ID), http.StatusFound)
|
http.Redirect(w, r, fmt.Sprintf("/app/journeys/groups_covoiturage/create/%s", request_organization.Group.ToStorageType().ID), http.StatusFound)
|
||||||
|
|
||||||
//http.Redirect(w, r, fmt.Print("/app/journeys"), http.StatusFound)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -433,9 +371,7 @@ func (h *ApplicationHandler) DisplayGroupCovoiturage(w http.ResponseWriter, r *h
|
|||||||
}
|
}
|
||||||
|
|
||||||
ressp, _ := h.services.GRPC.MobilityAccounts.GetAccountsBatch(context.TODO(), requesst)
|
ressp, _ := h.services.GRPC.MobilityAccounts.GetAccountsBatch(context.TODO(), requesst)
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
for _, account := range ressp.Accounts {
|
for _, account := range ressp.Accounts {
|
||||||
if filterAcc(r, account) {
|
if filterAcc(r, account) {
|
||||||
a := account.ToStorageType()
|
a := account.ToStorageType()
|
||||||
@@ -448,12 +384,10 @@ func (h *ApplicationHandler) DisplayGroupCovoiturage(w http.ResponseWriter, r *h
|
|||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
|
|
||||||
var beneficiary any
|
var beneficiary any
|
||||||
|
|
||||||
searched := false
|
searched := false
|
||||||
|
|
||||||
// if r.Method == "POST" {
|
|
||||||
if r.FormValue("beneficiaryid") != "" {
|
if r.FormValue("beneficiaryid") != "" {
|
||||||
// Handler form
|
|
||||||
searched = true
|
searched = true
|
||||||
|
|
||||||
requestbeneficiary := &mobilityaccounts.GetAccountRequest{
|
requestbeneficiary := &mobilityaccounts.GetAccountRequest{
|
||||||
@@ -476,6 +410,48 @@ func (h *ApplicationHandler) DisplayGroupCovoiturage(w http.ResponseWriter, r *h
|
|||||||
|
|
||||||
_, err = h.services.GRPC.GroupsManagement.Subscribe(context.TODO(), subscribe)
|
_, err = h.services.GRPC.GroupsManagement.Subscribe(context.TODO(), subscribe)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
/*******************Code to store more information about mermbers groupscovoiturage**************/
|
||||||
|
if r.FormValue("departure") != "" {
|
||||||
|
var a any
|
||||||
|
json.Unmarshal([]byte(r.FormValue("departure")), &a)
|
||||||
|
|
||||||
|
Depart = a
|
||||||
|
}
|
||||||
|
if r.FormValue("destination") != "" {
|
||||||
|
var a any
|
||||||
|
json.Unmarshal([]byte(r.FormValue("destination")), &a)
|
||||||
|
|
||||||
|
Arrive = a
|
||||||
|
}
|
||||||
|
r.ParseForm()
|
||||||
|
dataMap := map[string]any{
|
||||||
|
|
||||||
|
"depart": Depart,
|
||||||
|
"arrive": Arrive,
|
||||||
|
}
|
||||||
|
id := uuid.NewString()
|
||||||
|
data, err := structpb.NewValue(dataMap)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
request_organizatio := &groupsmanagement.AddGroupMemberRequest{
|
||||||
|
Group: &groupsmanagement.GroupMember{
|
||||||
|
Id: id,
|
||||||
|
Memberid: respbeneficiary.Account.Id,
|
||||||
|
Groupid: resp.Group.ToStorageType().ID,
|
||||||
|
Data: data.GetStructValue(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = h.services.GRPC.GroupsManagement.AddGroupMember(context.TODO(), request_organizatio)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
@@ -485,7 +461,27 @@ func (h *ApplicationHandler) DisplayGroupCovoiturage(w http.ResponseWriter, r *h
|
|||||||
http.Redirect(w, r, fmt.Sprintf("/app/journeys/groups_covoiturage/create/%s", resp.Group.ToStorageType().ID), http.StatusFound)
|
http.Redirect(w, r, fmt.Sprintf("/app/journeys/groups_covoiturage/create/%s", resp.Group.ToStorageType().ID), http.StatusFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//////////find all groups to store the adresse passenger///////
|
||||||
|
grp := &groupsmanagement.GetGroupsBatchMemberRequest{
|
||||||
|
|
||||||
|
Groupids: []string{resp.Group.ToStorageType().ID},
|
||||||
|
}
|
||||||
|
s, err := h.services.GRPC.GroupsManagement.GetGroupsBatchMember(context.TODO(), grp)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
groups := map[string]any{}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
for _, g := range s.Groups {
|
||||||
|
groups[g.Memberid] = g.ToStorageType()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var number string = strconv.Itoa(len(resp.Group.Members))
|
||||||
|
/////////////////////
|
||||||
accountsBeneficaire, err := h.beneficiaries(r)
|
accountsBeneficaire, err := h.beneficiaries(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
@@ -493,6 +489,77 @@ func (h *ApplicationHandler) DisplayGroupCovoiturage(w http.ResponseWriter, r *h
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//h.Renderer.BeneficaireSearch(w, r, accounts, searched, beneficiary, resp.Group.ToStorageType())
|
h.Renderer.DisplayGroupCovoiturage(w, r, number, resp.Group.ToStorageType().ID, Depart, Arrive, accounts, cacheid, searched, beneficiary, resp.Group.ToStorageType(), accountsBeneficaire, groups)
|
||||||
h.Renderer.DisplayGroupCovoiturage(w, r, resp.Group.ToStorageType().ID, accounts, cacheid, searched, beneficiary, resp.Group.ToStorageType(), accountsBeneficaire)
|
}
|
||||||
|
|
||||||
|
func (h *ApplicationHandler) UpdateGroupCovoiturage(w http.ResponseWriter, r *http.Request) {
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
id := vars["id"]
|
||||||
|
groupid := vars["groupid"]
|
||||||
|
memberid := vars["memberid"]
|
||||||
|
|
||||||
|
if r.Method == "POST" {
|
||||||
|
|
||||||
|
//////////get groupid covoiturage//////////
|
||||||
|
request := &groupsmanagement.GetGroupRequest{
|
||||||
|
Id: groupid,
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := h.services.GRPC.GroupsManagement.GetGroup(context.TODO(), request)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////get group member////////////////////////////////
|
||||||
|
|
||||||
|
reequest := &groupsmanagement.GetGroupMemberRequest{
|
||||||
|
Id: id,
|
||||||
|
}
|
||||||
|
|
||||||
|
ressp, err := h.services.GRPC.GroupsManagement.GetGroupMember(context.TODO(), reequest)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req := &groupsmanagement.UnsubscribeMemberRequest{
|
||||||
|
Id: ressp.Group.Id,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, errr := h.services.GRPC.GroupsManagement.UnsubscribeMember(context.TODO(), req)
|
||||||
|
if errr != nil {
|
||||||
|
fmt.Println(errr)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
members := resp.Group.Members
|
||||||
|
for i := 0; i < len(members); i++ {
|
||||||
|
if members[i] == memberid {
|
||||||
|
members = append(members[:i], members[(i+1):]...)
|
||||||
|
resp.Group.Members = members
|
||||||
|
reequest := &groupsmanagement.UnsubscribeRequest{
|
||||||
|
Groupid: resp.Group.ToStorageType().ID,
|
||||||
|
Memberid: memberid,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := h.services.GRPC.GroupsManagement.Unsubscribe(context.TODO(), reequest)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
http.Redirect(w, r, fmt.Sprintf("/app/journeys/groups_covoiturage/create/%s", groupid), http.StatusFound)
|
||||||
|
/*
|
||||||
|
I must add "return" to resolve the err
|
||||||
|
http: superfluous response.WriteHeader call from git.coopgo.io/coopgo-apps/parcoursmob/renderer.(*Renderer).Render (renderer.go:50)
|
||||||
|
*/
|
||||||
|
return
|
||||||
|
}
|
||||||
|
h.Renderer.UpdateGroupCovoiturage(w, r, groupid, memberid)
|
||||||
}
|
}
|
||||||
|
|||||||
1
main.go
1
main.go
@@ -112,6 +112,7 @@ func main() {
|
|||||||
application.HandleFunc("/journeys/groups_covoiturage", applicationHandler.GroupsGestion)
|
application.HandleFunc("/journeys/groups_covoiturage", applicationHandler.GroupsGestion)
|
||||||
application.HandleFunc("/journeys/groups_covoiturage/create", applicationHandler.CreateGroup)
|
application.HandleFunc("/journeys/groups_covoiturage/create", applicationHandler.CreateGroup)
|
||||||
application.HandleFunc("/journeys/groups_covoiturage/create/{groupid}", applicationHandler.DisplayGroupCovoiturage)
|
application.HandleFunc("/journeys/groups_covoiturage/create/{groupid}", applicationHandler.DisplayGroupCovoiturage)
|
||||||
|
application.HandleFunc("/journeys/groups_covoiturage/create/{id}/{groupid}/{memberid}", applicationHandler.UpdateGroupCovoiturage)
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
/********************Code Supprt Emailing************************/
|
/********************Code Supprt Emailing************************/
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ type BeneficiariesCovoiturage struct {
|
|||||||
Beneficiaries []any `json:"beneficiaries"`
|
Beneficiaries []any `json:"beneficiaries"`
|
||||||
}
|
}
|
||||||
type BeneficiariesCovoiturageA struct {
|
type BeneficiariesCovoiturageA struct {
|
||||||
//Group string `json:"group"`
|
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
CacheId string `json:"cache_id"`
|
CacheId string `json:"cache_id"`
|
||||||
Beneficiaries []any `json:"beneficiaries"`
|
Beneficiaries []any `json:"beneficiaries"`
|
||||||
@@ -73,11 +72,7 @@ func (s BeneficiariesListstate) JSONWithLimits(a int, b int) template.JS {
|
|||||||
func (renderer *Renderer) GroupsGestion(w http.ResponseWriter, r *http.Request, groups []groupstorage.Group, cacheid string) {
|
func (renderer *Renderer) GroupsGestion(w http.ResponseWriter, r *http.Request, groups []groupstorage.Group, cacheid string) {
|
||||||
files := renderer.ThemeConfig.GetStringSlice("views.journeys.list.files")
|
files := renderer.ThemeConfig.GetStringSlice("views.journeys.list.files")
|
||||||
state := NewState(r, renderer.ThemeConfig, journeysMenu)
|
state := NewState(r, renderer.ThemeConfig, journeysMenu)
|
||||||
// state.ViewState = map[string]any{
|
|
||||||
// "groups": groups,
|
|
||||||
// }
|
|
||||||
|
|
||||||
//state := NewState(r, renderer.ThemeConfig, beneficiariesMenu)
|
|
||||||
state.ViewState = BeneficiariesListstate{
|
state.ViewState = BeneficiariesListstate{
|
||||||
Count: len(groups),
|
Count: len(groups),
|
||||||
CacheId: cacheid,
|
CacheId: cacheid,
|
||||||
@@ -90,14 +85,6 @@ func (renderer *Renderer) GroupsGestion(w http.ResponseWriter, r *http.Request,
|
|||||||
func (renderer *Renderer) CreateGroup(w http.ResponseWriter, r *http.Request, depart any, arrive any, searched bool, beneficiary any, beneficiaries []mobilityaccountsstorage.Account, departure any, destination any) {
|
func (renderer *Renderer) CreateGroup(w http.ResponseWriter, r *http.Request, depart any, arrive any, searched bool, beneficiary any, beneficiaries []mobilityaccountsstorage.Account, departure any, destination any) {
|
||||||
files := renderer.ThemeConfig.GetStringSlice("views.journeys.create.files")
|
files := renderer.ThemeConfig.GetStringSlice("views.journeys.create.files")
|
||||||
state := NewState(r, renderer.ThemeConfig, journeysMenu)
|
state := NewState(r, renderer.ThemeConfig, journeysMenu)
|
||||||
// state.ViewState = map[string]any{
|
|
||||||
// "departure": depart,
|
|
||||||
// "destination": arrive,
|
|
||||||
// //"beneficiary": beneficiary,
|
|
||||||
// //"accounts": accounts,
|
|
||||||
// // "cacheid": cacheid,
|
|
||||||
// // "searched": searched,
|
|
||||||
// }
|
|
||||||
viewstate := map[string]any{
|
viewstate := map[string]any{
|
||||||
"deeparture": depart,
|
"deeparture": depart,
|
||||||
"deestination": arrive,
|
"deestination": arrive,
|
||||||
@@ -105,8 +92,6 @@ func (renderer *Renderer) CreateGroup(w http.ResponseWriter, r *http.Request, de
|
|||||||
"searched": searched,
|
"searched": searched,
|
||||||
"departure": departure,
|
"departure": departure,
|
||||||
"destination": destination,
|
"destination": destination,
|
||||||
// "departuredate": departuredate,
|
|
||||||
// "departuretime": departuretime,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if searched {
|
if searched {
|
||||||
@@ -120,7 +105,7 @@ func (renderer *Renderer) CreateGroup(w http.ResponseWriter, r *http.Request, de
|
|||||||
renderer.Render("journeys", w, r, files, state)
|
renderer.Render("journeys", w, r, files, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (renderer *Renderer) DisplayGroupCovoiturage(w http.ResponseWriter, r *http.Request, groupid string, accounts []any, cacheid string, searched bool, beneficiary any, group any, beneficiaries []mobilityaccountsstorage.Account) {
|
func (renderer *Renderer) DisplayGroupCovoiturage(w http.ResponseWriter, r *http.Request, number string, groupid string, depart any, arrive any, accounts []any, cacheid string, searched bool, beneficiary any, group any, beneficiaries []mobilityaccountsstorage.Account, groups map[string]any) {
|
||||||
files := renderer.ThemeConfig.GetStringSlice("views.journeys.display.files")
|
files := renderer.ThemeConfig.GetStringSlice("views.journeys.display.files")
|
||||||
state := NewState(r, renderer.ThemeConfig, journeysMenu)
|
state := NewState(r, renderer.ThemeConfig, journeysMenu)
|
||||||
|
|
||||||
@@ -128,6 +113,11 @@ func (renderer *Renderer) DisplayGroupCovoiturage(w http.ResponseWriter, r *http
|
|||||||
"beneficiaries": beneficiaries,
|
"beneficiaries": beneficiaries,
|
||||||
"searched": searched,
|
"searched": searched,
|
||||||
"group": group,
|
"group": group,
|
||||||
|
"deeparture": depart,
|
||||||
|
"deestination": arrive,
|
||||||
|
"groups": groups,
|
||||||
|
"ben": accounts,
|
||||||
|
"number": number,
|
||||||
"list": BeneficiariesCovoiturage{
|
"list": BeneficiariesCovoiturage{
|
||||||
Group: groupid,
|
Group: groupid,
|
||||||
Count: len(accounts),
|
Count: len(accounts),
|
||||||
@@ -142,8 +132,19 @@ func (renderer *Renderer) DisplayGroupCovoiturage(w http.ResponseWriter, r *http
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state.ViewState = viewstate
|
state.ViewState = viewstate
|
||||||
|
|
||||||
renderer.Render("journeys", w, r, files, state)
|
renderer.Render("journeys", w, r, files, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (renderer *Renderer) UpdateGroupCovoiturage(w http.ResponseWriter, r *http.Request, groupid string, memberid string) {
|
||||||
|
files := renderer.ThemeConfig.GetStringSlice("views.journeys.update.files")
|
||||||
|
state := NewState(r, renderer.ThemeConfig, journeysMenu)
|
||||||
|
|
||||||
|
state.ViewState = map[string]any{
|
||||||
|
"groupid": groupid,
|
||||||
|
"memberid": memberid,
|
||||||
|
}
|
||||||
|
renderer.Render("journeys", w, r, files, state)
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user