Esempio n. 1
0
func AdminDriverDocumentSave(w http.ResponseWriter, r *http.Request, c *web.Context) {
	if !c.CheckAuth(w, r, "/login", "admin", "employee", "developer") {
		return
	}
	document := service.FindOneDocument(r.FormValue("id"))
	document.Data = r.FormValue("data")
	service.SaveDocument(document)
	c.SetFlash("alertSuccess", "Successfully save document")
	fmt.Fprintf(w, "/admin/driver/%s/document", c.GetPathVar("driverId"))
}
Esempio n. 2
0
func AdminDriverDocumentGetOne(w http.ResponseWriter, r *http.Request, c *web.Context) {
	if !c.CheckAuth(w, r, "/login", "admin", "employee", "developer") {
		return
	}
	driver := service.FindOneDriver(c.GetPathVar("driverId"))
	document := service.FindOneDocument(c.GetPathVar("documentId"))
	ts.Render(w, document.Name+".tmpl", tmpl.Model{
		"driver":   driver,
		"company":  service.FindOneCompany(driver.CompanyId),
		"document": document,
		"admin":    true,
	})
}