diff --git a/frontend/assets/css/style.css b/frontend/assets/css/style.css new file mode 100644 index 0000000..c565dc3 --- /dev/null +++ b/frontend/assets/css/style.css @@ -0,0 +1,110 @@ +:root { + --bg: #111827; + --card: #1f2937; + --border: #374151; + --text: #f9fafb; + --accent: #3b82f6; +} + +* { + box-sizing: border-box; +} + +body { + margin: 0; + background: var(--bg); + color: var(--text); + font-family: system-ui; +} + +nav { + display: flex; + gap: 1rem; + + padding: 1rem; + + border-bottom: 1px solid var(--border); +} + +nav a { + color: white; + text-decoration: none; +} + +main { + max-width: 1400px; + + margin: auto; + + padding: 2rem; +} + +.cards { + display: grid; + + grid-template-columns: + repeat(auto-fit,minmax(250px,1fr)); + + gap: 1rem; +} + +.card { + background: var(--card); + + border: 1px solid var(--border); + + border-radius: 12px; + + padding: 1rem; +} + +table { + width: 100%; + border-collapse: collapse; +} + +th, +td { + padding: 1rem; + text-align: left; +} + +tr { + border-bottom: 1px solid var(--border); +} + +input, +select, +button { + + background: #1f2937; + + color: white; + + border: 1px solid var(--border); + + border-radius: 8px; + + padding: .8rem; +} + +button { + cursor: pointer; +} + +button:hover { + background: var(--accent); +} + +@media(max-width:768px){ + + nav{ + flex-wrap:wrap; + } + + table{ + display:block; + overflow:auto; + } + +} \ No newline at end of file diff --git a/frontend/handler.go b/frontend/handler.go index a26a3a0..4c731de 100644 --- a/frontend/handler.go +++ b/frontend/handler.go @@ -5,10 +5,14 @@ import ( "net/http" ) +var dashbaord = template.Must(template.ParseFiles( + "frontend/htmx/contents/dash/base.html", + "frontend/htmx/contents/dash/dashboard.html")) +var home = template.Must(template.ParseFiles("frontend/htmx/home.html")) + func Home(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html") - var tmpl = template.Must(template.ParseFiles("frontend/htmx/home.html")) - err := tmpl.Execute(w, struct { + err := home.Execute(w, struct { Name string }{ Name: "Miau", @@ -17,3 +21,15 @@ func Home(w http.ResponseWriter, r *http.Request) { return } } + +func Dashboard(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/html") + err := dashbaord.Execute(w, struct { + Title string + }{ + Title: "Miau", + }) + if err != nil { + return + } +} diff --git a/frontend/htmx/contents/dash/base.html b/frontend/htmx/contents/dash/base.html new file mode 100644 index 0000000..0e4adac --- /dev/null +++ b/frontend/htmx/contents/dash/base.html @@ -0,0 +1,27 @@ + + + + + + {{ .Title }} + + + + + + + + + + +
+ {{ template "content" . }} +
+ + + \ No newline at end of file diff --git a/frontend/htmx/contents/dash/dashboard.html b/frontend/htmx/contents/dash/dashboard.html new file mode 100644 index 0000000..803c902 --- /dev/null +++ b/frontend/htmx/contents/dash/dashboard.html @@ -0,0 +1,24 @@ +{{ define "content" }} + +

Dashboard

+ +
+ +
+

{{ .Stats.Items }}

+

Items

+
+ +
+

{{ .Stats.Projects }}

+

Projekte

+
+ +
+

{{ .Stats.Locations }}

+

Orte

+
+ +
+ +{{ end }} \ No newline at end of file diff --git a/frontend/htmx/contents/dash/inventory.html b/frontend/htmx/contents/dash/inventory.html new file mode 100644 index 0000000..38f265a --- /dev/null +++ b/frontend/htmx/contents/dash/inventory.html @@ -0,0 +1,21 @@ +{{ define "content" }} + +

Inventar

+ + + +
+
+ +{{ end }} \ No newline at end of file diff --git a/frontend/htmx/contents/dash/itemlist.html b/frontend/htmx/contents/dash/itemlist.html new file mode 100644 index 0000000..1516712 --- /dev/null +++ b/frontend/htmx/contents/dash/itemlist.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + {{ range . }} + + + + + + + + + + + + + + {{ end }} + + + +
NameKategorieGesamtFrei
{{ .Name }}{{ .Category }}{{ .TotalQuantity }}{{ .FreeQuantity }}
\ No newline at end of file diff --git a/frontend/htmx/contents/dash/locations.html b/frontend/htmx/contents/dash/locations.html new file mode 100644 index 0000000..731a1a2 --- /dev/null +++ b/frontend/htmx/contents/dash/locations.html @@ -0,0 +1,11 @@ +{{ define "content" }} + +

Lagerorte

+ +
+
+ +{{ end }} \ No newline at end of file diff --git a/frontend/htmx/contents/dash/projects.html b/frontend/htmx/contents/dash/projects.html new file mode 100644 index 0000000..cdd4ee5 --- /dev/null +++ b/frontend/htmx/contents/dash/projects.html @@ -0,0 +1,21 @@ +{{ define "content" }} + +

Projekte

+ + + +
+
+ + + +{{ end }} \ No newline at end of file diff --git a/server/server.go b/server/server.go index 7817e60..776ec2b 100644 --- a/server/server.go +++ b/server/server.go @@ -58,6 +58,7 @@ func (this *Server) Run() { // FRONTEND // mux.HandleFunc("/", frontend.Home) + mux.HandleFunc("/dashboard", frontend.Dashboard) // // API