Esempio n. 1
0
// GET admin get all drivers
func AdminDriverGetAll(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-driver.tmpl", tmpl.Model{
		msgK:        msgV,
		"drivers":   service.FindAllDriver(),
		"companies": service.CompanyNames(),
	})
	return
}
Esempio 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
}