Add crop CRUD, owned fields, and field grouping for planning
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<body>
|
||||
<header class="top">
|
||||
<h1>FarmCal</h1>
|
||||
<p>Planung fuer Felder, Aussaat und Ernte</p>
|
||||
<p>Planung fuer Felder, Feldgruppen, Aussaat und Ernte</p>
|
||||
</header>
|
||||
|
||||
<main class="layout">
|
||||
@@ -28,7 +28,6 @@
|
||||
</label>
|
||||
<button type="submit">Anzeigen</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="/settings" class="grid mt">
|
||||
<label>Tage pro Monat
|
||||
<input type="number" name="days_per_month" min="1" max="31" value="{{.DaysPerMonth}}">
|
||||
@@ -42,9 +41,7 @@
|
||||
{{if .Tasks}}
|
||||
<ul class="tasks">
|
||||
{{range .Tasks}}
|
||||
<li>
|
||||
<strong>{{.Type}}:</strong> {{.Message}}
|
||||
</li>
|
||||
<li><strong>{{.Type}}:</strong> {{.Message}}</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{else}}
|
||||
@@ -53,39 +50,197 @@
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Feld anlegen</h2>
|
||||
<form method="post" action="/fields" class="grid">
|
||||
<h2>Felder verwalten</h2>
|
||||
<form method="post" action="/fields/create" class="grid">
|
||||
<label>Feldnummer
|
||||
<input type="number" name="number" min="1" required>
|
||||
</label>
|
||||
<label>Name (optional)
|
||||
<input type="text" name="name" maxlength="120">
|
||||
</label>
|
||||
<button type="submit">Feld speichern</button>
|
||||
<label class="check">
|
||||
<input type="checkbox" name="owned">
|
||||
Im Besitz
|
||||
</label>
|
||||
<button type="submit">Feld anlegen</button>
|
||||
</form>
|
||||
|
||||
<div class="table-wrap mt">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nummer</th>
|
||||
<th>Name</th>
|
||||
<th>Besitz</th>
|
||||
<th>Gruppe</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if .Fields}}
|
||||
{{range .Fields}}
|
||||
<tr>
|
||||
<form method="post" action="/fields/update">
|
||||
<td>
|
||||
Feld {{.Number}}
|
||||
<input type="hidden" name="id" value="{{.ID}}">
|
||||
</td>
|
||||
<td><input type="text" name="name" value="{{.Name}}" maxlength="120"></td>
|
||||
<td>
|
||||
<label class="check">
|
||||
<input type="checkbox" name="owned" {{if .Owned}}checked{{end}}>
|
||||
Im Besitz
|
||||
</label>
|
||||
</td>
|
||||
<td>{{if .GroupName}}{{.GroupName}}{{else}}-{{end}}</td>
|
||||
<td class="actions">
|
||||
<button type="submit" class="btn-small">Speichern</button>
|
||||
</form>
|
||||
<form method="post" action="/fields/delete" onsubmit="return confirm('Feld wirklich loeschen?');">
|
||||
<input type="hidden" name="id" value="{{.ID}}">
|
||||
<button type="submit" class="btn-small danger">Loeschen</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<tr><td colspan="5">Noch keine Felder vorhanden.</td></tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Anbau planen</h2>
|
||||
<form method="post" action="/plans" class="grid">
|
||||
<label>Feld
|
||||
<select name="field_id" required>
|
||||
<option value="">Bitte waehlen</option>
|
||||
<h2>Feldgruppen</h2>
|
||||
<form method="post" action="/field-groups/create" class="grid">
|
||||
<label class="full">Name (optional)
|
||||
<input type="text" name="name" maxlength="120" placeholder="z.B. Feld 1+2">
|
||||
</label>
|
||||
<label class="full">Felder (1 bis X)
|
||||
<select name="field_ids" multiple size="6">
|
||||
{{range .Fields}}
|
||||
<option value="{{.ID}}">Feld {{.Number}}{{if .Name}} ({{.Name}}){{end}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
<button type="submit">Gruppe speichern</button>
|
||||
</form>
|
||||
<p class="hint">Mehrfachauswahl: mit Strg/Cmd klicken.</p>
|
||||
|
||||
<div class="table-wrap mt">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Felder</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if .Groups}}
|
||||
{{range .Groups}}
|
||||
<tr>
|
||||
<td>{{.Name}}</td>
|
||||
<td>{{.Numbers}}</td>
|
||||
<td>
|
||||
<form method="post" action="/field-groups/delete" onsubmit="return confirm('Gruppe aufloesen?');">
|
||||
<input type="hidden" name="group_key" value="{{.Key}}">
|
||||
<button type="submit" class="btn-small danger">Aufloesen</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<tr><td colspan="3">Noch keine Feldgruppen vorhanden.</td></tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Feldfruechte verwalten</h2>
|
||||
<form method="post" action="/crops/create" class="grid">
|
||||
<label>Name
|
||||
<input type="text" name="name" maxlength="80" required>
|
||||
</label>
|
||||
<label>Aussaat von (Monat)
|
||||
<input type="number" name="sow_start_month" min="1" max="12" required>
|
||||
</label>
|
||||
<label>Aussaat bis (Monat)
|
||||
<input type="number" name="sow_end_month" min="1" max="12" required>
|
||||
</label>
|
||||
<label>Wachstum (Monate)
|
||||
<input type="number" name="grow_months" min="1" max="24" required>
|
||||
</label>
|
||||
<button type="submit">Feldfrucht anlegen</button>
|
||||
</form>
|
||||
|
||||
<div class="table-wrap mt">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Aussaat</th>
|
||||
<th>Wachstum</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if .Crops}}
|
||||
{{range .Crops}}
|
||||
<tr>
|
||||
<form method="post" action="/crops/update">
|
||||
<td>
|
||||
<input type="hidden" name="id" value="{{.ID}}">
|
||||
<input type="text" name="name" value="{{.Name}}" maxlength="80" required>
|
||||
</td>
|
||||
<td class="inline-inputs">
|
||||
<input type="number" name="sow_start_month" min="1" max="12" value="{{.SowStartMonth}}" required>
|
||||
<span>bis</span>
|
||||
<input type="number" name="sow_end_month" min="1" max="12" value="{{.SowEndMonth}}" required>
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="grow_months" min="1" max="24" value="{{.GrowMonths}}" required>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button type="submit" class="btn-small">Speichern</button>
|
||||
</form>
|
||||
<form method="post" action="/crops/delete" onsubmit="return confirm('Feldfrucht wirklich loeschen?');">
|
||||
<input type="hidden" name="id" value="{{.ID}}">
|
||||
<button type="submit" class="btn-small danger">Loeschen</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<tr><td colspan="4">Keine Feldfruechte vorhanden.</td></tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Anbau planen</h2>
|
||||
<form method="post" action="/plans/create" class="grid">
|
||||
<label>Planungsziel
|
||||
<select name="target_ref" required>
|
||||
<option value="">Bitte waehlen</option>
|
||||
{{range .PlanningTargets}}
|
||||
<option value="{{.Ref}}">{{.Label}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
<label>Feldfrucht
|
||||
<select name="crop_id" required>
|
||||
<option value="">Bitte waehlen</option>
|
||||
{{range .Crops}}
|
||||
<option value="{{.ID}}">{{.Name}} (Aussaat Monat {{.SowStartMonth}}-{{.SowEndMonth}})</option>
|
||||
<option value="{{.ID}}">{{.Name}} (Monat {{.SowStartMonth}}-{{.SowEndMonth}})</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label>Startmonat
|
||||
<select name="start_month" required>
|
||||
{{range .Months}}
|
||||
@@ -93,15 +248,12 @@
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label>Starttag
|
||||
<input type="number" name="start_day" min="1" max="{{.DaysPerMonth}}" value="{{.NowDay}}" required>
|
||||
</label>
|
||||
|
||||
<label class="full">Notiz
|
||||
<input type="text" name="notes" maxlength="255">
|
||||
</label>
|
||||
|
||||
<button type="submit">Plan speichern</button>
|
||||
</form>
|
||||
</section>
|
||||
@@ -112,7 +264,7 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Feld</th>
|
||||
<th>Ziel</th>
|
||||
<th>Frucht</th>
|
||||
<th>Aussaat</th>
|
||||
<th>Ernte</th>
|
||||
@@ -123,7 +275,7 @@
|
||||
{{if .Plans}}
|
||||
{{range .Plans}}
|
||||
<tr>
|
||||
<td>Feld {{.FieldNumber}}{{if .FieldName}} ({{.FieldName}}){{end}}</td>
|
||||
<td>{{.TargetName}}</td>
|
||||
<td>{{.CropName}}</td>
|
||||
<td>Monat {{.StartMonth}} Tag {{.StartDay}}</td>
|
||||
<td>Monat {{.HarvestMonth}} Tag {{.HarvestDay}}</td>
|
||||
|
||||
Reference in New Issue
Block a user