parcoursmob/renderer/vehicles.go

51 lines
1.6 KiB
Go

package renderer
import "net/http"
const vehiclesMenu = "vehicles"
func (renderer *Renderer) VehiclesSearch(w http.ResponseWriter, r *http.Request, beneficiaries []any, searched bool, vehicles []any, beneficiary any, startdate any, enddate any) {
files := renderer.ThemeConfig.GetStringSlice("views.vehicles.search.files")
state := NewState(r, renderer.ThemeConfig, vehiclesMenu)
viewstate := map[string]any{
"beneficiaries": beneficiaries,
"searched": searched,
}
if searched {
viewstate["search"] = map[string]any{
"startdate": startdate,
"enddate": enddate,
"vehicles": vehicles,
"beneficiary": beneficiary,
}
}
state.ViewState = viewstate
renderer.Render("vehicles search", w, r, files, state)
}
func (renderer *Renderer) VehicleBookingDisplay(w http.ResponseWriter, r *http.Request, booking any, vehicle any, beneficiary any, group any) {
files := renderer.ThemeConfig.GetStringSlice("views.vehicles.booking_display.files")
state := NewState(r, renderer.ThemeConfig, vehiclesMenu)
state.ViewState = map[string]any{
"booking": booking,
"vehicle": vehicle,
"beneficiary": beneficiary,
"group": group,
}
renderer.Render("vehicles search", w, r, files, state)
}
func (renderer *Renderer) VehicleBookingsList(w http.ResponseWriter, r *http.Request, bookings []any) {
files := renderer.ThemeConfig.GetStringSlice("views.vehicles.bookings_list.files")
state := NewState(r, renderer.ThemeConfig, vehiclesMenu)
state.ViewState = map[string]any{
"bookings": bookings,
}
renderer.Render("vehicles search", w, r, files, state)
}