blob: 4be2073a5c8560ae66fad226051f262f165aa9a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
<form id="entry-form" autocomplete="off" class="status-{{if .Detached}}detached{{else}}{{if .Entry}}started{{else}}stopped{{end}}{{end}}">
<input style="display: none;" value="{{ if .Entry }}{{ .Entry.Id }}{{end}}" type="text" name="id" />
{{ if .Detached }}
<span>{{ if gt .Entry.Id -1 }}Redigerer opgave {{ .Entry.Id }}{{else}}Redigerer ny opgave{{end}}{{ if .Tracking }}, med opgave i baggrunden!{{else}}.{{end}}</span><br>
{{end}}
<div class="flex just-start">
<div class="entry-box">
<b>Interval</b>
<div>
<label for="fromTime">Fra: </label>
<input name="from" id="fromTime" type="time" class="form-control" {{if .Entry}}value="{{.Entry.From}}" required{{end}} aria-label="Time start">
</div>
<div>
<label for="toTime">Til: </label>
<input name="to" id="toTime" type="time" class="form-control" {{if .Entry}}value="{{if .Entry.To}}{{.Entry.To}}{{end}}" required{{end}} {{if not .Detached}}disabled{{end}} aria-label="Time stop">
</div>
</div>
<div class="entry-box">
<b>Opgaver</b><br>
<input readonly style="display: none;" name="task-count" value="{{ .TaskCount }}" />
<table>
<tbody>
{{ if .Entry }}
{{ range $x := taskMapToArr .Entry.Tasks }}
<tr>
<td>
<select name="task-{{$x.Key}}-id" hx-trigger="changedTasks from:body" hx-get="/task/select?selected={{$x.Id}}">
{{ template "taskEntry.html" arr $.GroupToTasks $x.Id }}
</select>
</td>
<td><input name="task-{{$x.Key}}-part" type="text" class="short" {{if $x.Sel}}value="{{$x.Sel}}"{{end}}/></td>
</tr>
{{ end }}
{{ end }}
<tr>
<td>
<select name="task-new-id" hx-trigger="changedTasks from:body" hx-get="/task/select">
{{ template "taskEntry.html" (arr .GroupToTasks -1) }}
</select>
</td>
<td><input disabled name="task-new-part" type="text" class="short" /></td>
</tr>
</tbody>
</table>
</div>
<div class="entry-box">
<b>Kommentar</b><br>
<textarea name="comment">{{if .Entry}}{{.Entry.Comment}}{{end}}</textarea>
</div>
<div class="entry-box">
<b>Status</b><br>
{{ if not .Detached}}<i>{{ if .Entry }}I gang{{ else }}Stoppet{{ end }}</i><br>{{end}}
{{ if .Entry }}<span>1:34 timer</span>{{ end }}
</div>
</div>
{{ if .Entry }}
<button
hx-put="/save{{if .Detached}}?detached=true{{end}}"
hx-trigger="click"
hx-target="#entry-form"
hx-swap="outerHTML"
>Gem
</button>
{{end}}
{{ if .Detached}}
{{ if .DateInfo.IsToday }}
<button
hx-get="/tracking"
hx-trigger="click"
hx-target="#entry-form"
hx-swap="outerHTML"
>Tilbage</button>
{{ end }}
{{ else }}
{{ if .Entry }}
<button
hx-post="/stop"
hx-trigger="click"
hx-target="#entry-form"
hx-swap="outerHTML"
>Stop</button>
{{ else }}
<button
hx-post="/start"
hx-trigger="click"
hx-target="#entry-form"
hx-swap="outerHTML"
>Start ny</button>
{{ end }}
<button
hx-get="/newDetached"
hx-trigger="click"
hx-target="#entry-form"
hx-swap="outerHTML"
>Manuel</button>
{{ end }}<input readonly type="text" name="date" {{if .Entry}}value="{{ .Entry.Date }}"{{end}} />
</form>
|