summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/index.html6
-rw-r--r--templates/parts/entry.html6
-rw-r--r--templates/parts/entryRows.html2
3 files changed, 8 insertions, 6 deletions
diff --git a/templates/index.html b/templates/index.html
index eecf879..b2dc6b0 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -55,9 +55,9 @@
</head>
<body>
<div id="controls-bar">
- <button>I går</button>
- <input type="date" />
- <button>I morgen</button>
+ <button hx-get="/" hx-replace-url="true" hx-params="date" hx-vals='{"date": "{{.DateInfo.Yesterday}}"}' hx-target="body">I går</button>
+ <input type="date" hx-get="/" hx-replace-url="true" hx-params="date" hx-vals='js:{date: event.target.value}' autocomplete="off" hx-target="body" hx-trigger="change" value="{{.DateInfo.Date}}" />
+ <button hx-get="/" hx-replace-url="true" hx-params="date" hx-vals='{"date": "{{.DateInfo.Tomorrow}}"}' hx-target="body">I morgen</button>
</div>
<div class="flex">
<div>
diff --git a/templates/parts/entry.html b/templates/parts/entry.html
index 9f05ffa..300f543 100644
--- a/templates/parts/entry.html
+++ b/templates/parts/entry.html
@@ -48,13 +48,15 @@
>Gem
</button>
{{end}}
- {{ if .Detached }}
+ {{ if .Detached}}
+ {{ if .DateInfo.IsToday }}
<button
hx-get="/tracking"
hx-trigger="click"
hx-target="#entry-bar"
hx-swap="outerHTML"
>Tilbage</button>
+ {{ end }}
{{ else }}
{{ if .Entry }}
<button
@@ -77,5 +79,5 @@
hx-target="#entry-bar"
hx-swap="outerHTML"
>Manuel</button>
- {{ end }}
+ {{ end }}<input readonly type="text" name="date" {{if .Entry}}value="{{ .Entry.Date }}"{{end}} />
</form>
diff --git a/templates/parts/entryRows.html b/templates/parts/entryRows.html
index fd14608..9e9c0eb 100644
--- a/templates/parts/entryRows.html
+++ b/templates/parts/entryRows.html
@@ -1,4 +1,4 @@
-<tbody hx-swap="outerHTML" hx-trigger="changedEntries from:body" hx-get="/entryRows">
+<tbody hx-swap="outerHTML" hx-trigger="changedEntries from:body" hx-get="/entryRows" hx-params="date" hx-vals='{"date": "{{.DateInfo.Date}}"}'>
{{ range $entry := .Entries }}
<tr>
<td>{{ $entry.Id }}</td>