2022-08-11 15:26:55 +00:00
|
|
|
package renderer
|
|
|
|
|
2022-10-31 23:40:20 +00:00
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2022-11-01 16:06:12 +00:00
|
|
|
filestorage "git.coopgo.io/coopgo-apps/parcoursmob/utils/storage"
|
2022-10-31 23:40:20 +00:00
|
|
|
fleetsstorage "git.coopgo.io/coopgo-platform/fleets/storage"
|
|
|
|
)
|
2022-08-11 15:26:55 +00:00
|
|
|
|
|
|
|
const vehiclesmanagementMenu = "vehicles_management"
|
|
|
|
|
2022-10-31 23:40:20 +00:00
|
|
|
func (renderer *Renderer) VehiclesManagementOverview(w http.ResponseWriter, r *http.Request, vehicles []fleetsstorage.Vehicle, vehicles_map map[string]fleetsstorage.Vehicle, bookings []fleetsstorage.Booking) {
|
2022-08-11 15:26:55 +00:00
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.overview.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
|
2022-08-12 12:53:54 +00:00
|
|
|
state.ViewState = map[string]any{
|
2022-10-31 23:40:20 +00:00
|
|
|
"vehicles": vehicles,
|
|
|
|
"bookings": bookings,
|
|
|
|
"vehicles_map": vehicles_map,
|
|
|
|
}
|
|
|
|
|
|
|
|
renderer.Render("fleet overview", w, r, files, state)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (renderer *Renderer) VehiclesManagementBookingsList(w http.ResponseWriter, r *http.Request, vehicles_map map[string]fleetsstorage.Vehicle, bookings []fleetsstorage.Booking, cacheid string) {
|
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.bookings_list.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
|
|
|
|
state.ViewState = map[string]any{
|
|
|
|
"bookings": bookings,
|
|
|
|
"vehicles_map": vehicles_map,
|
|
|
|
"cacheid": cacheid,
|
2022-08-12 12:53:54 +00:00
|
|
|
}
|
2022-08-11 15:26:55 +00:00
|
|
|
|
2022-08-12 12:53:54 +00:00
|
|
|
renderer.Render("fleet overview", w, r, files, state)
|
2022-08-11 15:26:55 +00:00
|
|
|
}
|
|
|
|
|
2022-11-07 00:24:16 +00:00
|
|
|
func (renderer *Renderer) VehiclesFleetAdd(w http.ResponseWriter, r *http.Request, vehicle_types []string) {
|
2022-08-11 15:26:55 +00:00
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.fleet_add.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
|
2022-11-07 00:24:16 +00:00
|
|
|
state.ViewState = map[string]any{
|
|
|
|
"vehicle_types": vehicle_types,
|
|
|
|
}
|
2022-08-11 15:26:55 +00:00
|
|
|
|
2022-08-12 12:53:54 +00:00
|
|
|
renderer.Render("fleet add vehicle", w, r, files, state)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (renderer *Renderer) VehiclesFleetDisplay(w http.ResponseWriter, r *http.Request, vehicle any) {
|
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.fleet_display.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
|
|
|
|
state.ViewState = map[string]any{
|
|
|
|
"vehicle": vehicle,
|
|
|
|
}
|
|
|
|
|
|
|
|
renderer.Render("fleet display vehicle", w, r, files, state)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (renderer *Renderer) VehiclesFleetUpdate(w http.ResponseWriter, r *http.Request, vehicle any) {
|
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.fleet_update.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
|
|
|
|
state.ViewState = map[string]any{
|
|
|
|
"vehicle": vehicle,
|
|
|
|
}
|
|
|
|
|
|
|
|
renderer.Render("fleet display vehicle", w, r, files, state)
|
|
|
|
}
|
|
|
|
|
2022-12-05 19:06:22 +00:00
|
|
|
func (renderer *Renderer) VehicleManagementBookingDisplay(w http.ResponseWriter, r *http.Request, booking any, vehicle any, beneficiary any, group any, documents []filestorage.FileInfo, file_types_map map[string]string, alternative_vehicles []any) {
|
2022-08-12 12:53:54 +00:00
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.booking_display.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
|
|
|
|
state.ViewState = map[string]any{
|
2022-12-05 19:06:22 +00:00
|
|
|
"booking": booking,
|
|
|
|
"vehicle": vehicle,
|
|
|
|
"beneficiary": beneficiary,
|
|
|
|
"group": group,
|
|
|
|
"documents": documents,
|
|
|
|
"file_types_map": file_types_map,
|
|
|
|
"alternative_vehicles": alternative_vehicles,
|
2022-08-12 12:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
renderer.Render("vehicles search", w, r, files, state)
|
2022-08-11 15:26:55 +00:00
|
|
|
}
|
2023-02-22 10:04:09 +00:00
|
|
|
|
2023-03-03 16:23:52 +00:00
|
|
|
func (renderer *Renderer) UnbookingVehicles(w http.ResponseWriter, r *http.Request, vehicles []fleetsstorage.Vehicle) {
|
|
|
|
files := renderer.ThemeConfig.GetStringSlice("views.vehicles_management.unbooking_display.files")
|
|
|
|
state := NewState(r, renderer.ThemeConfig, vehiclesmanagementMenu)
|
|
|
|
state.ViewState = map[string]any{
|
|
|
|
|
|
|
|
"vehicles": vehicles,
|
|
|
|
}
|
|
|
|
|
|
|
|
renderer.Render("fleet display Unbooking vehicle", w, r, files, state)
|
|
|
|
}
|