diff --git a/handlers/application/group_module.go b/handlers/application/group_module.go index 6fb6e93..e6da0aa 100644 --- a/handlers/application/group_module.go +++ b/handlers/application/group_module.go @@ -2,6 +2,7 @@ package application import ( "context" + "encoding/json" "fmt" "net/http" "sort" @@ -16,6 +17,8 @@ import ( "google.golang.org/protobuf/types/known/structpb" ) +var Addres any + type BeneficiariesGroupForm struct { FirstName string `json:"first_name" validate:"required"` LastName string `json:"last_name" validate:"required"` @@ -61,6 +64,12 @@ func (h *ApplicationHandler) Groups(w http.ResponseWriter, r *http.Request) { func (h *ApplicationHandler) CreateGroupModule(w http.ResponseWriter, r *http.Request) { if r.Method == "POST" { + if r.PostFormValue("address") != "" { + var a any + json.Unmarshal([]byte(r.PostFormValue("address")), &a) + + Addres = a + } r.ParseForm() if r.FormValue("name") == "" { @@ -79,8 +88,10 @@ func (h *ApplicationHandler) CreateGroupModule(w http.ResponseWriter, r *http.Re groupid := uuid.NewString() dataMap := map[string]any{ - "name": r.FormValue("name"), - "type": r.FormValue("type"), + "name": r.FormValue("name"), + "type": r.FormValue("type"), + "description": r.FormValue("description"), + "address": Addres, } data, err := structpb.NewValue(dataMap) @@ -149,7 +160,6 @@ func (h *ApplicationHandler) DisplayGroupModule(w http.ResponseWriter, r *http.R // if err != nil { // return err // } - for _, account := range ressp.Accounts { if filterAcccount(r, account) { a := account.ToStorageType()