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

43 lines
3.9 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"}}Im Garten{{end}}
{{define "main"}}
<header class='page-heading'>
<div><h2>Im Garten</h2></div>
<div class='actions'>{{if canGarden .Garden "plants:create"}}<a class='button' href='{{webPath "plant.new" .Garden.ID}}'>Pflanze erfassen</a>{{end}}{{template "view_toggle" "plants"}}</div>
</header>
<form class='panel filter-bar' method='GET'><div class='filter-fields filter-fields--plants'><div><label for='q'>Suche</label><input id='q' name='q' type='search' value='{{index .Filters "q"}}' placeholder='Name oder Notiz'></div><div><label for='status'>Status</label><select id='status' name='status'><option value=''>Alle</option>{{range plantStatuses}}<option value='{{.Value}}' {{if eqString (index $.Filters "status") .Value}}selected{{end}}>{{.Label}}</option>{{end}}</select></div><div><label for='species'>Art oder Sorte</label><select id='species' name='species'><option value=''>Alle</option>{{range .Species}}<option value='{{.ID}}' {{if eqString (index $.Filters "species") (printf "%d" .ID)}}selected{{end}}>{{.CommonName}}{{with .Cultivar}} · {{.}}{{end}}</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='sort'>Sortierung</label><select id='sort' name='sort'><option value='name_asc'>Name AZ</option><option value='name_desc' {{if eqString (index .Filters "sort") "name_desc"}}selected{{end}}>Name ZA</option><option value='newest' {{if eqString (index .Filters "sort") "newest"}}selected{{end}}>Neueste zuerst</option><option value='oldest' {{if eqString (index .Filters "sort") "oldest"}}selected{{end}}>Älteste zuerst</option></select></div><button class='filter-submit'>Filtern</button></div></form>
<section class='card-grid collection' data-view-key='plants'>
{{range .Plants}}
{{$plant := .}}
<article class='card card--clickable plant-card card--interactive {{if .ImageData}}card--image{{end}}' {{if .ImageData}}data-background-image='{{.ImageData}}'{{end}} role='link' tabindex='0' data-card-href='{{webPath "plant.edit" $.Garden.ID .ID}}'><div class='card-content'>
<p class='status'>{{plantStatusName .Status}}</p>
<h3><a class='card-link' href='{{webPath "plant.edit" $.Garden.ID .ID}}'>{{.Name}}</a></h3>
<p>{{speciesName $.Species .SpeciesID}}</p>
{{with .PlantedByName}}<p class='muted'>Gepflanzt von {{.}}</p>{{end}}
<div class='plant-location-summary'>{{range index $.PlantLocations .ID}}<p><span>{{.Quantity}}</span><span>x</span><span>{{index $.LocationNames .LocationID}}</span></p>{{end}}</div>
{{with .Notes}}<p>{{.}}</p>{{end}}</div>
{{if canGardenResource $.Garden $.CurrentUser .CreatedBy "plants:update:own" "plants:update:other"}}
<details class='user-menu plant-card-menu card-action'>
<summary aria-label='Status von {{.Name}} ändern' title='Status ändern'><span class='burger-icon' aria-hidden='true'></span></summary>
<div class='user-menu-content'>
<span class='menu-heading'>Status ändern</span>
{{range plantStatuses}}
<form method='POST' action='{{webPath "plant.status" $.Garden.ID $plant.ID}}'>
<input type='hidden' name='csrf_token' value='{{$.CSRFToken}}'>
<input type='hidden' name='status' value='{{.Value}}'>
<button type='submit' class='link-button' {{if eqString $plant.Status .Value}}disabled{{end}}>{{.Label}}</button>
</form>
{{end}}
</div>
</details>
{{end}}
</article>
{{else}}
<p>In diesem Garten wurden noch keine Pflanzen erfasst.</p>
{{end}}
</section>
{{template "pagination" .}}
{{end}}