feat: gestion manuelle des statuts de réservation véhicule

This commit is contained in:
Arnaud Delcasse
2026-02-26 17:56:25 +01:00
parent b79cc08b06
commit 95365ff8ce
9 changed files with 182 additions and 51 deletions

View File

@@ -355,6 +355,30 @@ func (h *Handler) UnbookingVehicleHTTPHandler() http.HandlerFunc {
}
}
func (h *Handler) VehicleManagementUpdateBookingStatusHTTPHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
bookingID := vars["bookingid"]
r.ParseForm()
newStatus := r.FormValue("new_status")
comment := r.FormValue("comment")
currentUserToken := r.Context().Value(identification.IdtokenKey).(*oidc.IDToken)
currentUserClaims := r.Context().Value(identification.ClaimsKey).(map[string]any)
currentGroup := r.Context().Value(identification.GroupKey)
err := h.applicationHandler.UpdateBookingStatus(r.Context(), bookingID, newStatus, comment, currentUserToken.Subject, currentUserClaims, currentGroup)
if err != nil {
log.Error().Err(err).Msg("error updating booking status")
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
return
}
http.Redirect(w, r, fmt.Sprintf("/app/vehicles-management/bookings/%s", bookingID), http.StatusFound)
}
}
func (h *Handler) VehiclesFleetUpdateHTTPHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)