add bookings on dashboard & kilometers on vehicles management
Build and Push Docker Image / build_and_push (push) Failing after 59s
Details
Build and Push Docker Image / build_and_push (push) Failing after 59s
Details
This commit is contained in:
parent
a0557b0971
commit
8de170a009
8
go.mod
8
go.mod
|
@ -2,13 +2,13 @@ module git.coopgo.io/coopgo-apps/parcoursmob
|
||||||
|
|
||||||
go 1.18
|
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/
|
||||||
|
|
||||||
// replace git.coopgo.io/coopgo-platform/agenda => ../../coopgo-platform/agenda/
|
replace git.coopgo.io/coopgo-platform/agenda => ../../coopgo-platform/agenda/
|
||||||
|
|
||||||
// replace git.coopgo.io/coopgo-platform/emailing => ../../coopgo-platform/emailing/
|
// replace git.coopgo.io/coopgo-platform/emailing => ../../coopgo-platform/emailing/
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ import (
|
||||||
"git.coopgo.io/coopgo-platform/groups-management/storage"
|
"git.coopgo.io/coopgo-platform/groups-management/storage"
|
||||||
mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
fleets "git.coopgo.io/coopgo-platform/fleets/grpcapi"
|
||||||
|
fleetstorage "git.coopgo.io/coopgo-platform/fleets/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *ApplicationHandler) Dashboard(w http.ResponseWriter, r *http.Request) {
|
func (h *ApplicationHandler) Dashboard(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -76,6 +78,18 @@ func (h *ApplicationHandler) Dashboard(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
sort.Sort(sorting.EventsByStartdate(events))
|
sort.Sort(sorting.EventsByStartdate(events))
|
||||||
|
|
||||||
h.Renderer.Dashboard(w, r, accounts, count, count_members, events)
|
bookings := []fleetstorage.Booking{}
|
||||||
|
|
||||||
|
bookingsresp, err := h.services.GRPC.Fleets.GetBookings(context.TODO(), &fleets.GetBookingsRequest{
|
||||||
|
Namespaces: []string{"parcoursmob_dispositifs"},
|
||||||
|
})
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
for _, b := range bookingsresp.Bookings {
|
||||||
|
bookings = append(bookings, b.ToStorageType())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h.Renderer.Dashboard(w, r, accounts, count, count_members, events, bookings)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,9 @@ func (h *ApplicationHandler) VehiclesFleetAdd(w http.ResponseWriter, r *http.Req
|
||||||
fmt.Println(v)
|
fmt.Println(v)
|
||||||
dataMap["automatic"] = (v == "on")
|
dataMap["automatic"] = (v == "on")
|
||||||
}
|
}
|
||||||
|
if v := r.FormValue("kilometers"); v != "" {
|
||||||
|
dataMap["kilometers"] = v
|
||||||
|
}
|
||||||
|
|
||||||
data, err := structpb.NewValue(dataMap)
|
data, err := structpb.NewValue(dataMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -614,6 +617,9 @@ func (h *ApplicationHandler) VehiclesFleetUpdate(w http.ResponseWriter, r *http.
|
||||||
if v := r.FormValue("licence_plate"); v != "" {
|
if v := r.FormValue("licence_plate"); v != "" {
|
||||||
dataMap["licence_plate"] = v
|
dataMap["licence_plate"] = v
|
||||||
}
|
}
|
||||||
|
if v := r.FormValue("kilometers"); v != "" {
|
||||||
|
dataMap["kilometers"] = v
|
||||||
|
}
|
||||||
if v := r.FormValue("automatic"); v != "" {
|
if v := r.FormValue("automatic"); v != "" {
|
||||||
fmt.Println(v)
|
fmt.Println(v)
|
||||||
dataMap["automatic"] = (v == "on")
|
dataMap["automatic"] = (v == "on")
|
||||||
|
|
|
@ -4,11 +4,12 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
agendastorage "git.coopgo.io/coopgo-platform/agenda/storage"
|
agendastorage "git.coopgo.io/coopgo-platform/agenda/storage"
|
||||||
|
fleetstorage "git.coopgo.io/coopgo-platform/fleets/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
const dashboardMenu = "dashboard"
|
const dashboardMenu = "dashboard"
|
||||||
|
|
||||||
func (renderer *Renderer) Dashboard(w http.ResponseWriter, r *http.Request, accounts []any, nbaccounts int, count_members int, events []agendastorage.Event) {
|
func (renderer *Renderer) Dashboard(w http.ResponseWriter, r *http.Request, accounts []any, nbaccounts int, count_members int, events []agendastorage.Event, fleets []fleetstorage.Booking) {
|
||||||
files := renderer.ThemeConfig.GetStringSlice("views.dashboard.files")
|
files := renderer.ThemeConfig.GetStringSlice("views.dashboard.files")
|
||||||
state := NewState(r, renderer.ThemeConfig, dashboardMenu)
|
state := NewState(r, renderer.ThemeConfig, dashboardMenu)
|
||||||
state.ViewState = map[string]any{
|
state.ViewState = map[string]any{
|
||||||
|
@ -18,6 +19,7 @@ func (renderer *Renderer) Dashboard(w http.ResponseWriter, r *http.Request, acco
|
||||||
},
|
},
|
||||||
"count_members": count_members,
|
"count_members": count_members,
|
||||||
"events": events,
|
"events": events,
|
||||||
|
"fleets": fleets,
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer.Render("dashboard", w, r, files, state)
|
renderer.Render("dashboard", w, r, files, state)
|
||||||
|
|
Loading…
Reference in New Issue