Exemplo n.º 1
0
// GET admin get all vehicles
func AdminVehicleGetAll(w http.ResponseWriter, r *http.Request, c *web.Context) {
	if !c.CheckAuth(w, r, "/login", "admin", "employee", "developer") {
		return
	}
	msgK, msgV := c.GetFlash()
	ts.Render(w, "admin-vehicle.tmpl", tmpl.Model{
		msgK:        msgV,
		"vehicles":  service.FindAllVehicle(),
		"companies": service.CompanyNames(),
	})
	return
}
Exemplo n.º 2
0
// GET admin get driver
func AdminDriverGetOne(w http.ResponseWriter, r *http.Request, c *web.Context) {
	if !c.CheckAuth(w, r, "/login", "admin", "employee", "developer") {
		return
	}
	msgK, msgV := c.GetFlash()
	driver := service.FindOneDriver(c.GetPathVar("id"))
	ts.Render(w, "admin-driver-form.tmpl", tmpl.Model{
		msgK:        msgV,
		"driver":    driver,
		"drivers":   service.FindAllDriver(),
		"companies": service.CompanyNames(),
		"user":      service.FindOneUser(driver.UserId),
	})
	return
}