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

18 lines
5.6 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 "plant_template_tasks"}}<div id='plant-template-tasks' class='plant-task-list'>{{if .SpeciesID}}{{range index .TaskTemplates .SpeciesID}}<div class='plant-template-task-row'><button type='button' class='plant-task-name' hx-get='{{pathWithQuery (webPath "plant.template-task" $.Garden.ID .ID) "species_id" $.SpeciesID}}' hx-target='#plant-task-dialog-host' hx-swap='innerHTML'>{{.Title}}</button><input type='hidden' name='plant_template_active_{{.ID}}' value='{{if index $.TemplateOptOuts .ID}}false{{else}}true{{end}}' data-toggle-value><label class='switch' aria-label='{{.Title}} aktivieren oder deaktivieren'><input type='checkbox' data-toggle-control {{if not (index $.TemplateOptOuts .ID)}}checked{{end}}><span></span></label></div>{{else}}<p class='muted'>Für diese Art sind keine Aufgabenvorlagen hinterlegt.</p>{{end}}{{else}}<p class='muted'>Nach Auswahl einer Art erscheinen hier deren Aufgabenvorlagen.</p>{{end}}</div>{{end}}
{{define "plant_task_row_fragment"}}{{range .PlantTasks}}
<div id='{{.RowKey}}' class='plant-task-row' data-plant-task-row>
<input type='hidden' name='plant_task_row_key' value='{{.RowKey}}'><input type='hidden' name='plant_task_id' value='{{.ID}}'><input type='hidden' name='plant_task_plant_id' value='{{.PlantID}}'><input type='hidden' name='pending_plant_name' value='{{.PendingPlantName}}'>
<input type='hidden' name='plant_task_title' value='{{.Title}}'><input type='hidden' name='plant_task_description' value='{{.Description}}'><input type='hidden' name='plant_task_due_at_start' value='{{.DueAtStart}}'><input type='hidden' name='plant_task_due_at_end' value='{{.DueAtEnd}}'><input type='hidden' name='plant_task_priority' value='{{.Priority}}'><input type='hidden' name='plant_task_location_id' value='{{.LocationID}}'><input type='hidden' name='plant_task_recurrence' value='{{.Recurrence}}'><input type='hidden' name='plant_task_recurrence_interval' value='{{.RecurrenceInterval}}'><input type='hidden' name='plant_task_keywords' value='{{.Keywords}}'><input type='hidden' name='plant_task_status_on_completion' value='{{.PlantStatusOnCompletion}}'><input type='hidden' name='plant_task_active' value='{{if .Active}}true{{else}}false{{end}}' data-toggle-value><input type='hidden' name='plant_task_delete' value='false' data-plant-task-delete>
<button type='button' class='plant-task-name' hx-get='{{webPath "plant.task-row" $.Garden.ID}}' hx-include='closest [data-plant-task-row]' hx-target='#plant-task-dialog-host' hx-swap='innerHTML'>{{.Title}}</button><label class='switch' aria-label='{{.Title}} aktivieren oder deaktivieren'><input type='checkbox' data-toggle-control {{if .Active}}checked{{end}}><span></span></label><button type='button' class='template-remove' data-remove-plant-task aria-label='{{.Title}} löschen' title='Aufgabe löschen'>×</button>
</div>{{end}}{{end}}
{{define "plant_task_dialog"}}{{$form := .Form}}
<dialog class='plant-task-dialog'><form method='POST' action='{{webPath "plant.task-row" .Garden.ID}}' hx-post='{{webPath "plant.task-row" .Garden.ID}}' hx-target='{{if .TaskDialogNew}}#plant-manual-tasks{{else}}#{{$form.RowKey}}{{end}}' hx-swap='{{if .TaskDialogNew}}beforeend{{else}}outerHTML{{end}}'>
<h3>{{if .TaskDialogNew}}Aufgabe hinzufügen{{else}}Aufgabe bearbeiten{{end}}</h3><input type='hidden' name='csrf_token' value='{{.CSRFToken}}'><input type='hidden' name='new' value='{{if .TaskDialogNew}}true{{else}}false{{end}}'><input type='hidden' name='plant_task_row_key' value='{{$form.RowKey}}'><input type='hidden' name='plant_task_id' value='{{$form.ID}}'><input type='hidden' name='plant_task_plant_id' value='{{$form.PlantID}}'><input type='hidden' name='pending_plant_name' value='{{.PendingPlantName}}'><input type='hidden' name='plant_task_active' value='{{if $form.Active}}true{{else}}false{{end}}'><input type='hidden' name='plant_task_delete' value='false'>
{{template "task_fields" (dict "Form" $form "Prefix" "plant_task_" "ShowPlant" true "LockPlant" true "PendingPlantName" .PendingPlantName "Plants" .Plants "Locations" .Locations "TaskPriorities" .TaskPriorities "TagSuggestions" .TagSuggestions)}}
<div class='actions'><button type='submit'>Übernehmen</button><button type='button' class='secondary' data-close-dialog>Abbrechen</button></div>
</form></dialog>{{end}}
{{define "plant_template_task_dialog"}}{{range index .TaskTemplates .SpeciesID}}<dialog class='plant-task-dialog'><p class='eyebrow'>Aufgabenvorlage{{if and .Origin (not (eqString .Origin "manual"))}} · automatisch{{end}}</p><h3>{{.Title}}</h3>{{with .Description}}<p>{{.}}</p>{{else}}<p class='muted'>Keine Beschreibung hinterlegt.</p>{{end}}<dl class='task-detail-list'><dt>Typ</dt><dd>{{if eqString .TriggerType "month_of_year"}}Datum{{else if eqString .TriggerType "relative_to_planting"}}Nach Pflanzdatum{{else if eqString .TriggerType "relative_to_species_planting"}}Nach Pflanzsaison{{else if eqString .TriggerType "relative_to_sowing"}}Nach Aussaat{{else if eqString .TriggerType "relative_to_harvest"}}Nach Ernte{{else}}Nach letzter Erledigung{{end}}</dd>{{if eqString .TriggerType "month_of_year"}}<dt>Ab</dt><dd>{{with .DayFrom}}{{.}}.{{end}}{{with .MonthFrom}}{{.}}{{end}}</dd>{{else}}<dt>Nach</dt><dd>{{durationDescription .TriggerOffset .TriggerOffsetUnit}}</dd>{{end}}<dt>Bis in</dt><dd>{{durationDescription .Duration .DurationUnit}}</dd><dt>Priorität</dt><dd>{{configuredPriorityName $.TaskPriorities .Priority}}</dd><dt>Wiederholung</dt><dd>{{with recurrenceDescription .Recurrence .RecurrenceInterval}}{{.}}{{else}}Keine{{end}}</dd></dl><div class='actions'><button type='button' class='secondary' data-close-dialog>Schließen</button></div></dialog>{{end}}{{end}}