diff options
author | Julian T <julian@jtle.dk> | 2024-05-26 22:20:40 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2024-05-29 22:25:47 +0200 |
commit | afb0a04fe600575b00d551da7dce6a08679ef7b8 (patch) | |
tree | 8f90720887cf49045d65a9d17dad984dae06275c /templates/parts | |
parent | 9b55b16f3b906958171b4f45002b58d5f77b9705 (diff) |
Diffstat (limited to 'templates/parts')
-rw-r--r-- | templates/parts/entry.html | 37 | ||||
-rw-r--r-- | templates/parts/entryRows.html | 2 | ||||
-rw-r--r-- | templates/parts/taskEntry.html | 8 | ||||
-rw-r--r-- | templates/parts/taskRows.html | 17 |
4 files changed, 48 insertions, 16 deletions
diff --git a/templates/parts/entry.html b/templates/parts/entry.html index 52f2eb3..4be2073 100644 --- a/templates/parts/entry.html +++ b/templates/parts/entry.html @@ -16,17 +16,32 @@ </div> </div> <div class="entry-box"> - <b>Mærker</b><br> - <select> - <option value="-">-</option> - <option value="SVT-232">SVT-232</option> - <option value="Ferie">Ferie</option> - </select><br> - <select> - <option value="-">-</option> - <option value="SVT-232">SVT-232</option> - <option value="Ferie">Ferie</option> - </select> + <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> diff --git a/templates/parts/entryRows.html b/templates/parts/entryRows.html index 8f10ee3..3749ddb 100644 --- a/templates/parts/entryRows.html +++ b/templates/parts/entryRows.html @@ -4,7 +4,7 @@ <td>{{ $entry.Id }}</td> <td><input type="time" disabled value="{{$entry.From }}" /></td> <td><input type="time" disabled value="{{if $entry.To}}{{$entry.To }}{{end}}" /></td> - <td>{{ if $entry.Tag}}{{ $entry.Tag }}{{end}}</td> + <td></td> <td>{{ $entry.Comment }}</td> <td> {{ if $entry.To }}<button hx-trigger="click" hx-swap="outerHTML" hx-target="#entry-form" hx-get="/edit?id={{$entry.Id}}">e</button>{{end}} diff --git a/templates/parts/taskEntry.html b/templates/parts/taskEntry.html new file mode 100644 index 0000000..3c3be3f --- /dev/null +++ b/templates/parts/taskEntry.html @@ -0,0 +1,8 @@ +<option>-</option> +{{ range $group, $tasks := index . 0}} +<optgroup label="{{$group}}"> + {{ range $task := $tasks }} + <option {{if eq $task.Id (index $ 1)}}selected{{end}} value="{{$task.Id}}">{{$task.Text}}</option> + {{ end }} +</optgroup> +{{ end }} diff --git a/templates/parts/taskRows.html b/templates/parts/taskRows.html index a2a6020..bef2366 100644 --- a/templates/parts/taskRows.html +++ b/templates/parts/taskRows.html @@ -1,11 +1,20 @@ <table> <tbody hx-swap="outerHTML" hx-trigger="changedTasks from:body" hx-get="/task/list"> - {{ range $task := .Tasks }} + {{ range $group, $tasks := .GroupToTasks }} <tr> - <td>Trifork</td> - <td /> - <td /> + <td>{{ $group }}</td> + <td></td> + <td></td> + <td></td> </tr> + {{ range $task := $tasks }} + <tr> + <td></td> + <td>{{ $task.Text }}</td> + <td>{{ if $task.Ident }}{{ $task.Ident }}{{end}}</td> + <td><button hx-trigger="click" hx-swap="outerHTML" hx-target="#taskForm" hx-get="/task/edit?id={{$task.Id}}" >e</button></td> + </tr> + {{ end }} {{ end }} </tbody> </table> |