Split app into subpages, persist ingame time, and add 14-month dashboard calendar

This commit is contained in:
Kai
2026-02-16 12:53:35 +01:00
parent 5c37a7ba43
commit 5528d3e688
15 changed files with 1522 additions and 1145 deletions

83
templates/planning.html Normal file
View File

@@ -0,0 +1,83 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FarmCal - Anbau planen</title>
<link rel="stylesheet" href="/static/styles.css">
</head>
<body>
<header class="top"><h1>FarmCal</h1><p>Anbau planen</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>Neuer Plan</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}} (Monat {{.SowStartMonth}}-{{.SowEndMonth}})</option>
{{end}}
</select>
</label>
<label>Startmonat
<select name="start_month" required>
{{range .Months}}
<option value="{{.Value}}" {{if eq $.Settings.CurrentMonth .Value}}selected{{end}}>{{.Label}}</option>
{{end}}
</select>
</label>
<label>Starttag
<input type="number" name="start_day" min="1" max="{{.Settings.DaysPerMonth}}" value="{{.Settings.CurrentDay}}" required>
</label>
<label class="full">Notiz
<input type="text" name="notes" maxlength="255">
</label>
<button type="submit">Plan speichern</button>
</form>
</section>
<section class="card full-width">
<h2>Geplante Durchlaeufe</h2>
<div class="table-wrap">
<table>
<thead><tr><th>Ziel</th><th>Frucht</th><th>Aussaat</th><th>Ernte</th><th>Notiz</th></tr></thead>
<tbody>
{{if .Plans}}
{{range .Plans}}
<tr>
<td>{{.TargetName}}</td>
<td>{{.CropName}}</td>
<td>Monat {{.StartMonth}} Tag {{.StartDay}}</td>
<td>Monat {{.HarvestMonth}} Tag {{.HarvestDay}}</td>
<td>{{.Notes}}</td>
</tr>
{{end}}
{{else}}
<tr><td colspan="5">Keine Planung 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>