add members data
This commit is contained in:
@@ -52,10 +52,16 @@ func (h *ApplicationHandler) VehiclesManagementOverview(w http.ResponseWriter, r
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
vehiicles := []fleetsstorage.Vehicle{}
|
||||
for i, vehiicle := range resp.Vehicles {
|
||||
if len(resp.Vehicles[i].Bookings) == 0 {
|
||||
v := vehiicle.ToStorageType()
|
||||
vehiicles = append(vehiicles, v)
|
||||
}
|
||||
}
|
||||
fmt.Println(vehiicles)
|
||||
sort.Sort(sorting.VehiclesByLicencePlate(vehicles))
|
||||
sort.Sort(sorting.BookingsByStartdate(bookings))
|
||||
|
||||
h.Renderer.VehiclesManagementOverview(w, r, vehicles, vehicles_map, bookings)
|
||||
}
|
||||
|
||||
@@ -184,7 +190,10 @@ func (h *ApplicationHandler) VehiclesFleetDisplay(w http.ResponseWriter, r *http
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
if len(resp.Vehicle.ToStorageType().Bookings) == 0 {
|
||||
fmt.Println("lol")
|
||||
}
|
||||
fmt.Println(resp.Vehicle.ToStorageType().Bookings)
|
||||
h.Renderer.VehiclesFleetDisplay(w, r, resp.Vehicle.ToStorageType())
|
||||
}
|
||||
|
||||
@@ -457,3 +466,28 @@ func (h ApplicationHandler) VehiclesFleetMakeUnavailable(w http.ResponseWriter,
|
||||
|
||||
http.Redirect(w, r, fmt.Sprintf("/app/vehicles-management/fleet/%s", vehicleid), http.StatusFound)
|
||||
}
|
||||
|
||||
// func (h *ApplicationHandler) UnbookingVehicles(w http.ResponseWriter, r *http.Request) {
|
||||
// request := &fleets.GetVehiclesRequest{
|
||||
// Namespaces: []string{"parcoursmob"},
|
||||
// }
|
||||
// resp, err := h.services.GRPC.Fleets.GetVehicles(context.TODO(), request)
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// w.WriteHeader(http.StatusInternalServerError)
|
||||
// }
|
||||
// vehicles := []fleetsstorage.Vehicle{}
|
||||
// fmt.Println(resp.Vehicles[0].Bookings)
|
||||
// for i, vehicle := range resp.Vehicles {
|
||||
// if len(resp.Vehicles[i].Bookings) == 0 {
|
||||
// v := vehicle.ToStorageType()
|
||||
// vehicles = append(vehicles, v)
|
||||
// }
|
||||
// }
|
||||
// // if len(resp.Vehicle.ToStorageType().Bookings) == 0 {
|
||||
// // h.Renderer.UnbookingVehicles(w, r, resp.Vehicle.ToStorageType())
|
||||
// // }
|
||||
// // fmt.Println(resp.Vehicle.ToStorageType().Bookings)
|
||||
// fmt.Println(vehicles)
|
||||
// h.Renderer.UnbookingVehicles(w, r, vehicles)
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user