Files
farmcal/templates/crops.html

67 lines
3.1 KiB
HTML

<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FarmCal - Feldfruechte</title>
<link rel="stylesheet" href="/static/styles.css">
</head>
<body>
<header class="top"><h1>FarmCal</h1><p>Feldfruechte verwalten</p></header>
<nav class="tabs">
<a href="/" class="{{if eq .ActivePath "/"}}active{{end}}">Dashboard</a>
<a href="/planning" class="{{if eq .ActivePath "/planning"}}active{{end}}">Anbau planen</a>
<a href="/crops" class="{{if eq .ActivePath "/crops"}}active{{end}}">Feldfruechte</a>
<a href="/fields" class="{{if eq .ActivePath "/fields"}}active{{end}}">Felder & Gruppen</a>
<a href="/general" class="{{if eq .ActivePath "/general"}}active{{end}}">Allgemein</a>
</nav>
<main class="layout">
<section class="card">
<h2>Neue Feldfrucht</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">Anlegen</button>
</form>
</section>
<section class="card full-width">
<h2>Bestehende Feldfruechte</h2>
<div class="table-wrap">
<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>
<button type="submit" formaction="/crops/delete" formnovalidate class="btn-small danger" onclick="return confirm('Feldfrucht wirklich loeschen?')">Loeschen</button>
</td>
</form>
</tr>
{{end}}
{{else}}
<tr><td colspan="4">Keine Feldfruechte vorhanden.</td></tr>
{{end}}
</tbody>
</table>
</div>
</section>
</main>
{{if .Error}}<div class="toast error">{{.Error}}</div>{{end}}
{{if .Info}}<div class="toast info">{{.Info}}</div>{{end}}
</body>
</html>