edit handlers vehicle-management for unbooking a vehicle

This commit is contained in:
Nicolas CARON 2023-05-10 09:52:57 +02:00
parent 31e5eadc73
commit bfd14d7f4c
3 changed files with 5 additions and 4 deletions

2
go.mod
View File

@ -6,7 +6,7 @@ go 1.18
// 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/

View File

@ -494,6 +494,7 @@ func (h ApplicationHandler) VehiclesFleetMakeUnavailable(w http.ResponseWriter,
func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Request) { func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
bookingid := vars["bookingid"] bookingid := vars["bookingid"]
request := &fleets.GetBookingRequest{ request := &fleets.GetBookingRequest{
Bookingid: bookingid, Bookingid: bookingid,
} }
@ -515,7 +516,7 @@ func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Req
Startdate: resp.Booking.Startdate, Startdate: resp.Booking.Startdate,
Enddate: resp.Booking.Enddate, Enddate: resp.Booking.Enddate,
Unavailablefrom: resp.Booking.Unavailablefrom, Unavailablefrom: resp.Booking.Unavailablefrom,
Unavailableto: resp.Booking.Unavailableto, Unavailableto: timestamppb.New(time.Now().Add(-48 * time.Hour)),
Data: resp.Booking.Data, Data: resp.Booking.Data,
Deleted: true, Deleted: true,
}, },
@ -532,5 +533,5 @@ func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Req
http.Redirect(w, r, "/app/vehicles-management/", http.StatusFound) http.Redirect(w, r, "/app/vehicles-management/", http.StatusFound)
return return
} }
h.Renderer.UnbookingVehicle(w, r, bookingid) h.Renderer.UnbookingVehicle(w, r, resp.Booking.ToStorageType())
} }

View File

@ -79,7 +79,7 @@ func (renderer *Renderer) VehicleManagementBookingDisplay(w http.ResponseWriter,
renderer.Render("vehicles search", w, r, files, state) renderer.Render("vehicles search", w, r, files, state)
} }
func (renderer *Renderer) UnbookingVehicle(w http.ResponseWriter, r *http.Request, booking string) { func (renderer *Renderer) UnbookingVehicle(w http.ResponseWriter, r *http.Request, booking any) {
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.delete_booking.files") files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.delete_booking.files")
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu) state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
state.ViewState = map[string]any{ state.ViewState = map[string]any{