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

96
templates/dashboard.html Normal file
View File

@@ -0,0 +1,96 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FarmCal - Dashboard</title>
<link rel="stylesheet" href="/static/styles.css">
</head>
<body>
<header class="top">
<h1>FarmCal</h1>
<p>Dashboard</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>Aktuelle Ingame-Zeit</h2>
<p><strong>{{.CurrentMonth}} Tag {{.Settings.CurrentDay}}</strong> bei {{.Settings.DaysPerMonth}} Tagen pro Monat.</p>
<p>{{.PlanningCount}} Plan-Eintraege insgesamt.</p>
<form method="post" action="/settings/time" class="grid">
<label>Monat
<select name="current_month">
<option value="1" {{if eq .Settings.CurrentMonth 1}}selected{{end}}>Januar</option>
<option value="2" {{if eq .Settings.CurrentMonth 2}}selected{{end}}>Februar</option>
<option value="3" {{if eq .Settings.CurrentMonth 3}}selected{{end}}>Maerz</option>
<option value="4" {{if eq .Settings.CurrentMonth 4}}selected{{end}}>April</option>
<option value="5" {{if eq .Settings.CurrentMonth 5}}selected{{end}}>Mai</option>
<option value="6" {{if eq .Settings.CurrentMonth 6}}selected{{end}}>Juni</option>
<option value="7" {{if eq .Settings.CurrentMonth 7}}selected{{end}}>Juli</option>
<option value="8" {{if eq .Settings.CurrentMonth 8}}selected{{end}}>August</option>
<option value="9" {{if eq .Settings.CurrentMonth 9}}selected{{end}}>September</option>
<option value="10" {{if eq .Settings.CurrentMonth 10}}selected{{end}}>Oktober</option>
<option value="11" {{if eq .Settings.CurrentMonth 11}}selected{{end}}>November</option>
<option value="12" {{if eq .Settings.CurrentMonth 12}}selected{{end}}>Dezember</option>
</select>
</label>
<label>Tag
<input type="number" name="current_day" min="1" max="{{.Settings.DaysPerMonth}}" value="{{.Settings.CurrentDay}}">
</label>
<button type="submit">Zeit speichern</button>
</form>
</section>
<section class="card">
<h2>Heute</h2>
{{if .TodayTasks}}
<ul class="tasks">
{{range .TodayTasks}}
<li><strong>{{.Type}}:</strong> {{.Message}}</li>
{{end}}
</ul>
{{else}}
<p>Keine Aufgaben fuer den aktuellen Ingame-Tag.</p>
{{end}}
</section>
<section class="card full-width">
<h2>Kalender ab jetzt (14 Monate)</h2>
<div class="calendar-grid">
{{range .Calendar}}
<article class="month-card">
<h3>{{.Label}}</h3>
<ul class="month-days">
{{range .Days}}
<li>
<strong>Tag {{.Day}}</strong>
{{if .Tasks}}
<ul class="task-sublist">
{{range .Tasks}}
<li>{{.Type}}: {{.Message}}</li>
{{end}}
</ul>
{{else}}
<span class="muted">Keine Eintraege</span>
{{end}}
</li>
{{end}}
</ul>
</article>
{{end}}
</div>
</section>
</main>
{{if .Error}}<div class="toast error">{{.Error}}</div>{{end}}
{{if .Info}}<div class="toast info">{{.Info}}</div>{{end}}
</body>
</html>