Files
Gardomatic/internal/web/templates/pages/tasks.tmpl
T
kleiax 904d14b64c
CI / test (push) Canceled after 0s
Initial commit
2026-09-12 22:22:17 +02:00

33 lines
5.0 KiB
Cheetah
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{define "title"}}Aufgaben{{end}}
{{define "main"}}
<header class='page-heading'>
<div><h2>Aufgaben</h2></div>
<div class='actions'><a class='button secondary' href='{{webPath "tasks.calendar" .Garden.ID}}'>Kalender</a>{{if canGarden .Garden "tasks:create"}}<a class='button' href='{{webPath "task.new" .Garden.ID}}'>Aufgabe anlegen</a>{{end}}{{template "view_toggle" "tasks"}}</div>
</header>
<form class='panel filter-bar' method='GET'><div class='filter-fields filter-fields--tasks'><div><label for='status'>Status</label><select id='status' name='status'><option value=''>Alle</option><option value='open' {{if eqString (index .Filters "status") "open"}}selected{{end}}>Offen</option><option value='done' {{if eqString (index .Filters "status") "done"}}selected{{end}}>Erledigt</option></select></div><div><label for='plant'>Pflanze</label><select id='plant' name='plant'><option value=''>Alle</option>{{range .Plants}}<option value='{{.ID}}' {{if eqString (index $.Filters "plant") (printf "%d" .ID)}}selected{{end}}>{{.Name}}</option>{{end}}</select></div><div><label for='location'>Ort</label><select id='location' name='location'><option value=''>Alle</option>{{range .Locations}}<option value='{{.ID}}' {{if eqString (index $.Filters "location") (printf "%d" .ID)}}selected{{end}}>{{.Name}}</option>{{end}}</select></div><div><label for='priority'>Priorität</label><select id='priority' name='priority'><option value=''>Alle</option>{{range .TaskPriorities}}<option value='{{.Value}}' {{if eqString (index $.Filters "priority") (printf "%d" .Value)}}selected{{end}}>{{.Name}}</option>{{end}}</select></div><div><label for='month'>Monat</label><select id='month' name='month'><option value=''>Alle</option>{{range months}}<option value='{{.Value}}' {{if eqString (index $.Filters "month") (printf "%d" .Value)}}selected{{end}}>{{.Label}}</option>{{end}}</select></div><div><label for='year'>Jahr</label><select id='year' name='year'><option value=''>Alle</option>{{range .TaskYears}}<option value='{{.}}' {{if eqString (index $.Filters "year") (printf "%d" .)}}selected{{end}}>{{.}}</option>{{end}}</select></div><div><label for='sort'>Sortierung</label><select id='sort' name='sort'><option value='due_asc'>Fälligkeit aufsteigend</option><option value='due_desc' {{if eqString (index .Filters "sort") "due_desc"}}selected{{end}}>Fälligkeit absteigend</option><option value='month_asc' {{if eqString (index .Filters "sort") "month_asc"}}selected{{end}}>Monat aufsteigend</option><option value='month_desc' {{if eqString (index .Filters "sort") "month_desc"}}selected{{end}}>Monat absteigend</option><option value='period_asc' {{if eqString (index .Filters "sort") "period_asc"}}selected{{end}}>Zeitraum kurzlang</option><option value='period_desc' {{if eqString (index .Filters "sort") "period_desc"}}selected{{end}}>Zeitraum langkurz</option><option value='name_asc' {{if eqString (index .Filters "sort") "name_asc"}}selected{{end}}>Name AZ</option><option value='name_desc' {{if eqString (index .Filters "sort") "name_desc"}}selected{{end}}>Name ZA</option><option value='priority_desc' {{if eqString (index .Filters "sort") "priority_desc"}}selected{{end}}>Priorität</option></select></div><button class='filter-submit'>Filtern</button></div></form>
{{if .Tasks}}
<section class='task-list collection' data-view-key='tasks'>
{{range .Tasks}}
{{$editable := canGardenResource $.Garden $.CurrentUser .CreatedBy "tasks:update:own" "tasks:update:other"}}
{{$canComplete := canGardenResource $.Garden $.CurrentUser .CreatedBy "tasks:complete:own" "tasks:complete:other"}}
<article class='panel task-card{{if $editable}} card--interactive{{end}}{{if .CompletedAt}} completed{{end}}'{{if $editable}} role='link' tabindex='0' data-card-href='{{webPath "task.edit" $.Garden.ID .ID}}' aria-label='{{.Title}} bearbeiten'{{end}}>
<div class='task-heading'><div><span class='status'>{{configuredPriorityName $.TaskPriorities .Priority}}</span><h3>{{.Title}}</h3></div><strong>{{taskDueDate .}}</strong></div>
{{with .Description}}<p>{{.}}</p>{{end}}
{{with recurrenceDescription .Recurrence .RecurrenceInterval}}<p class='muted'>Wiederholung: {{.}}</p>{{end}}
<div class='task-card-footer'>
<p class='task-links'>{{with plantName $.Plants .PlantID}}Pflanze: {{.}}{{end}}{{with locationName $.Locations .LocationID}} · Ort: {{.}}{{end}}</p>
{{if $canComplete}}<div class='actions task-card-actions'>
{{if .CompletedAt}}
<form method='POST' action='{{webPath "task.reopen" $.Garden.ID .ID}}' class='inline-form'><input type='hidden' name='csrf_token' value='{{$.CSRFToken}}'><button type='submit'>Wieder öffnen</button></form>
{{else}}
<form method='POST' action='{{webPath "task.complete" $.Garden.ID .ID}}' class='inline-form'><input type='hidden' name='csrf_token' value='{{$.CSRFToken}}'><button type='submit'>Erledigt</button></form>
{{end}}
</div>{{end}}
</div>
</article>
{{end}}
</section>
{{else}}<p>In diesem Garten gibt es noch keine Aufgaben.</p>{{end}}
{{template "pagination" .}}
{{end}}