diff --git a/handlers/barcodes.go b/handlers/barcodes.go new file mode 100644 index 0000000..bfe636a --- /dev/null +++ b/handlers/barcodes.go @@ -0,0 +1,20 @@ +package handlers + +import ( + "net/http" + "text/template" + + "git.espin.casa/albert/cml04-falcon-ui/storage" + "github.com/julienschmidt/httprouter" +) + +func BarcodesHandler(storage storage.Storager) httprouter.Handle { + return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { + t, _ := template.ParseFiles("templates/base.html", "templates/barcodes.html") + err := t.Execute(w, nil) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + } +} diff --git a/handlers/hbcp.go b/handlers/hbcp.go index d90c165..f94d0de 100644 --- a/handlers/hbcp.go +++ b/handlers/hbcp.go @@ -4,10 +4,11 @@ import ( "net/http" "text/template" + "git.espin.casa/albert/cml04-falcon-ui/storage" "github.com/julienschmidt/httprouter" ) -func HBCPHandler() httprouter.Handle { +func HBCPHandler(storage storage.Storager) httprouter.Handle { return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { t, _ := template.ParseFiles("templates/base.html", "templates/hbcp.html") err := t.Execute(w, nil) diff --git a/routes/routes.go b/routes/routes.go index c9604d7..e18f058 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -8,6 +8,7 @@ import ( func CreateRoutes(r *httprouter.Router, storage storage.Storager) { r.GET("/", handlers.IndexHandler()) - r.GET("/hbcp", handlers.HBCPHandler()) + r.GET("/hbcp", handlers.HBCPHandler(storage)) + r.GET("/barcodes", handlers.BarcodesHandler(storage)) } diff --git a/templates/barcodes.html b/templates/barcodes.html new file mode 100644 index 0000000..1c552a4 --- /dev/null +++ b/templates/barcodes.html @@ -0,0 +1,64 @@ +{{define "title"}}Falcon UI{{end}} + +{{define "body"}} + +
+
+
+ +
+
+ +
+
+
+ +{{ end }} \ No newline at end of file diff --git a/templates/hbcp.html b/templates/hbcp.html index 9e607b5..20bd42b 100644 --- a/templates/hbcp.html +++ b/templates/hbcp.html @@ -42,12 +42,22 @@

- +

+
+
+ + +
+
diff --git a/templates/index.html b/templates/index.html index 859991b..b1f997c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -13,7 +13,7 @@