small fixes

This commit is contained in:
2024-12-27 15:39:05 +01:00
parent d46f62d92a
commit 1685d1e1ac
6 changed files with 104 additions and 551 deletions

View File

@@ -329,8 +329,6 @@ func (h *ApplicationHandler) AdministrationGroupInviteMember(w http.ResponseWrit
log.Error().Err(err).Msg("error sending email onboarding.existing_member")
}
// http.Redirect(w, r, "/app/group/settings", http.StatusFound)
// return
} else {
// Onboard new administrator
onboarding := map[string]any{

View File

@@ -26,7 +26,7 @@ import (
)
func (h *ApplicationHandler) VehiclesManagementOverview(w http.ResponseWriter, r *http.Request) {
//Get Vehicles
// Get Vehicles
request := &fleets.GetVehiclesRequest{
Namespaces: []string{"parcoursmob"},
}
@@ -61,7 +61,7 @@ func (h *ApplicationHandler) VehiclesManagementOverview(w http.ResponseWriter, r
}
}
driversMap, _ := h.services.GetBeneficiariesMap()
driversMap, _ := h.services.GetBeneficiariesMap()
sort.Sort(sorting.VehiclesByLicencePlate(vehicles))
sort.Sort(sorting.BookingsByStartdate(bookings))
@@ -69,7 +69,7 @@ func (h *ApplicationHandler) VehiclesManagementOverview(w http.ResponseWriter, r
}
func (h *ApplicationHandler) VehiclesManagementBookingsList(w http.ResponseWriter, r *http.Request) {
//Get Vehicles
// Get Vehicles
request := &fleets.GetVehiclesRequest{
Namespaces: []string{"parcoursmob"},
}
@@ -100,7 +100,7 @@ func (h *ApplicationHandler) VehiclesManagementBookingsList(w http.ResponseWrite
cacheid := uuid.NewString()
h.cache.PutWithTTL(cacheid, bookings, 1*time.Hour)
driversMap, _ := h.services.GetBeneficiariesMap()
driversMap, _ := h.services.GetBeneficiariesMap()
h.Renderer.VehiclesManagementBookingsList(w, r, vehicles_map, driversMap, bookings, cacheid)
}
@@ -168,7 +168,6 @@ func (h *ApplicationHandler) VehiclesFleetAdd(w http.ResponseWriter, r *http.Req
}
_, err = h.services.GRPC.Fleets.AddVehicle(context.TODO(), request)
if err != nil {
log.Error().Err(err).Msg("")
w.WriteHeader(http.StatusInternalServerError)
@@ -198,7 +197,14 @@ func (h *ApplicationHandler) VehiclesFleetDisplay(w http.ResponseWriter, r *http
return
}
h.Renderer.VehiclesFleetDisplay(w, r, resp.Vehicle.ToStorageType())
beneficiaries, err := h.services.GetBeneficiariesMap()
if err != nil {
log.Error().Err(err).Msg("issue retrieving beneficiaries")
w.WriteHeader(http.StatusInternalServerError)
return
}
h.Renderer.VehiclesFleetDisplay(w, r, resp.Vehicle.ToStorageType(), beneficiaries)
}
func filterVehicle(r *http.Request, v *fleets.Vehicle) bool {
@@ -364,7 +370,6 @@ func (h ApplicationHandler) VehicleManagementBookingChangeVehicle(w http.Respons
}
http.Redirect(w, r, fmt.Sprintf("/app/vehicles-management/bookings/%s", bookingid), http.StatusFound)
}
func (h ApplicationHandler) VehiclesFleetMakeUnavailable(w http.ResponseWriter, r *http.Request) { // Get Group
@@ -538,7 +543,6 @@ func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Req
}
_, err := h.services.GRPC.Fleets.UpdateBooking(context.TODO(), request)
if err != nil {
log.Error().Err(err).Msg("")
w.WriteHeader(http.StatusInternalServerError)
@@ -567,7 +571,7 @@ func (h *ApplicationHandler) VehiclesFleetUpdate(w http.ResponseWriter, r *http.
return
}
namespaceV := resp.Vehicle.Namespace
//typeV := resp.Vehicle.Type
// typeV := resp.Vehicle.Type
administratorsV := resp.Vehicle.Administrators
if r.Method == "POST" {
@@ -622,7 +626,6 @@ func (h *ApplicationHandler) VehiclesFleetUpdate(w http.ResponseWriter, r *http.
}
resp, err := h.services.GRPC.Fleets.UpdateVehicle(context.TODO(), request)
if err != nil {
log.Error().Err(err).Msg("")
w.WriteHeader(http.StatusInternalServerError)

View File

@@ -42,7 +42,7 @@ func (h ApplicationHandler) VehiclesSearch(w http.ResponseWriter, r *http.Reques
administrators := []string{}
if r.FormValue("beneficiaryid") != "" && startdate.After(time.Now()) && enddate.After(startdate) {
if r.FormValue("beneficiaryid") != "" && startdate.After(time.Now().Add(-24*time.Hour)) && enddate.After(startdate) {
// Handler form
searched = true