Add module diags in menu

This commit is contained in:
2024-12-04 17:27:38 +01:00
parent 064cb2df16
commit 42f33a17dd
4 changed files with 23 additions and 16 deletions

View File

@@ -10,7 +10,7 @@ import (
"net/http"
// "strconv"
"strings"
"time"
// "time"
"git.coopgo.io/coopgo-apps/parcoursmob/services"
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
@@ -25,7 +25,7 @@ import (
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/structpb"
"google.golang.org/protobuf/types/known/timestamppb"
// "google.golang.org/protobuf/types/known/timestamppb"
)
type DiagsForm struct {
@@ -39,8 +39,8 @@ type DiagsForm struct {
func (h *ApplicationHandler) DiagsHome(w http.ResponseWriter, r *http.Request) {
resp, err := h.services.GRPC.Diags.GetDiags(context.TODO(), &diags.GetDiagsRequest{
Namespaces: []string{"parcoursmob_diagnostiques"},
Mindate: timestamppb.New(time.Now().Add(-24 * time.Hour)),
Namespaces: []string{"parcoursmob_beneficiaries", "parcoursmob_diagnostiques", "parcoursmob_vehicle"},
// Mindate: timestamppb.New(time.Now().Add(-24 * time.Hour)),
})
if err != nil {
@@ -201,7 +201,7 @@ func parseDiagsForm(r *http.Request) (*DiagsForm, error) {
return formData, nil
}
func (h *ApplicationHandler) DiagsUpdateDiag(w http.ResponseWriter, r *http.Request) {
func (h *ApplicationHandler) DiagUpdate(w http.ResponseWriter, r *http.Request) {
adm := strings.Split(r.URL.Path, "/")
diagID := adm[3]
request := &diags.GetDiagRequest{
@@ -253,10 +253,10 @@ func (h *ApplicationHandler) DiagsUpdateDiag(w http.ResponseWriter, r *http.Requ
http.Redirect(w, r, fmt.Sprintf("/app/diags/%s", resp.Diag.Id), http.StatusFound)
return
}
h.Renderer.DiagsUpdateDiag(w, r, resp.Diag.ToStorageType())
h.Renderer.DiagUpdate(w, r, resp.Diag.ToStorageType())
}
func (h *ApplicationHandler) DiagsDeleteDiag(w http.ResponseWriter, r *http.Request) {
func (h *ApplicationHandler) DiagDelete(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
diagID := vars["diagid"]
@@ -296,7 +296,7 @@ func (h *ApplicationHandler) DiagsDeleteDiag(w http.ResponseWriter, r *http.Requ
http.Redirect(w, r, "/app/diags/", http.StatusFound)
return
}
h.Renderer.DiagsDeleteDiag(w, r, resp.Diag.ToStorageType())
h.Renderer.DiagDelete(w, r, resp.Diag.ToStorageType())
}
func (h *ApplicationHandler) DiagsHistoryDiag(w http.ResponseWriter, r *http.Request) {