40 lines
3.2 KiB
Cheetah
40 lines
3.2 KiB
Cheetah
{{define "location_fields"}}
|
|
{{$form := .Form}}
|
|
<input type='hidden' name='csrf_token' value='{{.CSRFToken}}'>
|
|
<input type='hidden' name='return_to' value='{{$form.ReturnTo}}'>
|
|
<label for='location-name'>Name</label>
|
|
<input id='location-name' name='name' value='{{$form.Name}}' required>
|
|
{{with index $form.Errors "name"}}<p class='field-error'>{{.}}</p>{{end}}
|
|
{{template "image_editor" (dict "ImageData" $form.ImageData "ImageID" $form.ImageID "Images" .Images "GardenID" .Garden.ID)}}
|
|
<label for='parent_id'>Übergeordneter Ort</label>
|
|
<select id='parent_id' name='parent_id'>
|
|
<option value='0'>Keiner</option>
|
|
{{range .Locations}}<option value='{{.ID}}' {{if eqInt $form.ParentID .ID}}selected{{end}}>{{.Name}}</option>{{end}}
|
|
</select>
|
|
{{with index $form.Errors "parent_id"}}<p class='field-error'>{{.}}</p>{{end}}
|
|
<label for='kind'>Art des Orts</label>
|
|
<input id='kind' name='kind' value='{{$form.Kind}}' placeholder='z. B. Beet, Topf oder Gewächshaus'>
|
|
<label for='area_sqm'>Fläche in m²</label>
|
|
<input id='area_sqm' name='area_sqm' inputmode='decimal' value='{{$form.AreaSQM}}'>
|
|
{{with index $form.Errors "area_sqm"}}<p class='field-error'>{{.}}</p>{{end}}
|
|
<label for='sun_exposure'>Licht</label>
|
|
<select id='sun_exposure' name='sun_exposure'><option value=''>Nicht angegeben</option><option value='sunny' {{if eqString $form.SunExposure "sunny"}}selected{{end}}>Sonnig</option><option value='partial_shade' {{if eqString $form.SunExposure "partial_shade"}}selected{{end}}>Halbschattig</option><option value='shade' {{if eqString $form.SunExposure "shade"}}selected{{end}}>Schattig</option></select>
|
|
<label for='soil_condition'>Bodenbeschaffenheit</label><select id='soil_condition' name='soil_condition'><option value=''>Nicht angegeben</option><option value='dry' {{if eqString $form.SoilCondition "dry"}}selected{{end}}>Trocken</option><option value='moist' {{if eqString $form.SoilCondition "moist"}}selected{{end}}>Feucht</option><option value='boggy' {{if eqString $form.SoilCondition "boggy"}}selected{{end}}>Sumpfig</option></select>
|
|
<label for='soil_reaction'>Bodenreaktion</label><select id='soil_reaction' name='soil_reaction'><option value=''>Nicht angegeben</option><option value='alkaline' {{if eqString $form.SoilReaction "alkaline"}}selected{{end}}>Basisch</option><option value='acidic' {{if eqString $form.SoilReaction "acidic"}}selected{{end}}>Sauer</option><option value='neutral' {{if eqString $form.SoilReaction "neutral"}}selected{{end}}>Neutral</option></select>
|
|
<label for='description'>Beschreibung</label>
|
|
<textarea id='description' name='description' rows='4'>{{$form.Description}}</textarea>
|
|
{{end}}
|
|
|
|
{{define "location_dialog"}}
|
|
<dialog class='location-dialog'>
|
|
<form action='{{webPath "location.new" .Garden.ID}}' method='POST'
|
|
hx-post='{{webPath "location.new" .Garden.ID}}' hx-target='#location_id' hx-swap='beforeend'>
|
|
<h3>Ort direkt anlegen</h3>
|
|
{{template "location_fields" .}}
|
|
<div class='actions'><button type='submit'>Anlegen und auswählen</button><button type='button' class='secondary' data-close-dialog>Abbrechen</button></div>
|
|
</form>
|
|
</dialog>
|
|
{{end}}
|
|
|
|
{{define "location_option"}}{{range .Locations}}<option value='{{.ID}}' selected>{{.Name}}</option>{{end}}{{end}}
|