@@ -0,0 +1,42 @@
|
||||
{{define "title"}}{{if .LocationID}}Ort bearbeiten{{else}}Ort anlegen{{end}}{{end}}
|
||||
|
||||
{{define "main"}}
|
||||
{{$form := .Form}}
|
||||
{{$canSave := canGarden .Garden "locations:create"}}{{if .LocationID}}{{$canSave = canGardenResource .Garden .CurrentUser .LocationCreatedBy "locations:update:own" "locations:update:other"}}{{end}}
|
||||
<div class='{{if .LocationID}}settings-layout{{end}}'>
|
||||
{{if .LocationID}}<aside class='settings-sidebar panel'><nav aria-label='Bearbeitungsbereiche'><a href='#location-general'>Allgemein</a><a href='#location-plants'>Pflanzen</a><a href='#location-history'>Historie</a></nav></aside>{{end}}
|
||||
<div class='settings-content'><section class='panel location-detail' id='location-general'>
|
||||
<h2>{{if .LocationID}}Ort bearbeiten{{else}}Ort anlegen{{end}}</h2>
|
||||
<form id='location-form' action='{{if .LocationID}}{{webPath "location.edit" .Garden.ID .LocationID}}{{else}}{{webPath "location.new" .Garden.ID}}{{end}}' method='POST'>
|
||||
{{template "location_fields" .}}
|
||||
</form>
|
||||
<div class='actions location-form-actions'>
|
||||
{{if $canSave}}<button type='submit' form='location-form'>Speichern</button>{{end}}
|
||||
<a href='{{$form.ReturnTo}}'>Abbrechen</a>
|
||||
{{if and .LocationID (canGardenResource .Garden .CurrentUser .LocationCreatedBy "locations:delete:own" "locations:delete:other")}}<form class='inline-form' method='POST' action='{{webPath "location.delete" .Garden.ID .LocationID}}'><input type='hidden' name='csrf_token' value='{{.CSRFToken}}'><button type='submit' class='danger'>Ort löschen</button></form>{{end}}
|
||||
</div>
|
||||
</section>
|
||||
{{if .LocationID}}
|
||||
<section class='panel location-detail-plants' id='location-plants'>
|
||||
<div class='page-heading'><h3>Pflanzen an diesem Ort</h3><div class='actions'>{{template "view_toggle" "location-plants"}}</div></div>
|
||||
<div class='location-plant-list' data-view-key='location-plants'>
|
||||
{{range .LocationPlants}}
|
||||
{{$canEditPlant := canGardenResource $.Garden $.CurrentUser .Plant.CreatedBy "plants:update:own" "plants:update:other"}}<article class='card location-plant-item {{if $canEditPlant}}card--interactive{{end}}' {{if $canEditPlant}}role='link' tabindex='0' data-card-href='{{webPath "plant.edit" $.Garden.ID .Plant.ID}}'{{end}}><div class='card-content'><h3>{{if $canEditPlant}}<a href='{{webPath "plant.edit" $.Garden.ID .Plant.ID}}'>{{.Plant.Name}}</a>{{else}}{{.Plant.Name}}{{end}}</h3><p>Anzahl: {{.Assignment.Quantity}}{{with .Assignment.PlantedAt}} · gepflanzt am {{humanDate .}}{{end}}</p>{{with .Assignment.Notes}}<p>{{.}}</p>{{end}}</div></article>
|
||||
{{else}}
|
||||
<p>Diesem Ort sind noch keine Pflanzen zugeordnet.</p>
|
||||
{{end}}
|
||||
</div>
|
||||
</section>
|
||||
<section class='panel location-history' id='location-history'>
|
||||
<h3>Historie der letzten 3 Jahre</h3>
|
||||
{{range .LocationHistory}}
|
||||
<section class='location-history-year'><h4>{{.Year}}</h4><div class='card-grid collection'>
|
||||
{{range .Plants}}
|
||||
{{$canEditPlant := canGardenResource $.Garden $.CurrentUser .Plant.CreatedBy "plants:update:own" "plants:update:other"}}<article class='card {{if $canEditPlant}}card--interactive{{end}} {{if .Plant.ImageData}}card--image{{end}}' {{if .Plant.ImageData}}data-background-image='{{.Plant.ImageData}}'{{end}} {{if $canEditPlant}}role='link' tabindex='0' data-card-href='{{webPath "plant.edit" $.Garden.ID .Plant.ID}}'{{end}}><div class='card-content'><h3>{{if $canEditPlant}}<a href='{{webPath "plant.edit" $.Garden.ID .Plant.ID}}'>{{.Plant.Name}}</a>{{else}}{{.Plant.Name}}{{end}}</h3><p>{{plantStatusName .Plant.Status}}{{with .Assignment.RemovedAt}} · entfernt am {{humanDate .}}{{end}}</p>{{with .Assignment.Notes}}<p>{{.}}</p>{{end}}</div></article>
|
||||
{{else}}<p class='muted'>Keine Pflanzen in diesem Jahr.</p>{{end}}
|
||||
</div></section>
|
||||
{{end}}
|
||||
</section>
|
||||
{{end}}
|
||||
</div></div>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user