Files
farmcal/templates/dashboard.html

170 lines
7.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 - Dashboard</title>
<link rel="icon" type="image/svg+xml" href="/static/farmcal-icon.svg">
<link rel="stylesheet" href="/static/styles.css">
</head>
<body>
<header class="top">
<h1><img src="/static/farmcal-icon.svg" alt="" class="brand-icon">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}}">Feldfrüchte</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> im Zyklus {{.Settings.CurrentCycle}} bei {{.Settings.DaysPerMonth}} Tagen pro Monat.</p>
<p>{{.PlanningCount}} Plan-Einträge 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}}>März</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>Zyklus
<input type="number" name="current_cycle" min="0" value="{{.Settings.CurrentCycle}}">
</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 .TodayGroups}}
<ul class="tasks">
{{range .TodayGroups}}
<li>
<span><strong>{{.Field}}</strong></span>
<ul class="task-sublist">
{{range .Tasks}}
<li class="{{if .Completed}}done-task{{end}}">
<span>{{.Message}}</span>
<form method="post" action="/tasks/toggle" class="inline-form">
<input type="hidden" name="uid" value="{{.UID}}">
<input type="hidden" name="month" value="{{.Month}}">
<input type="hidden" name="day" value="{{.Day}}">
<input type="hidden" name="year_offset" value="{{.YearOffset}}">
<input type="hidden" name="completed" value="{{if .Completed}}1{{else}}0{{end}}">
<button type="submit" class="btn-small {{if .Completed}}secondary{{end}}">{{if .Completed}}Offen{{else}}Erledigt{{end}}</button>
</form>
</li>
{{end}}
</ul>
</li>
{{end}}
</ul>
{{else}}
<p>Keine Aufgaben für den aktuellen Ingame-Tag.</p>
{{end}}
</section>
<section class="card matrix-card">
<h2>Matrix-Chat</h2>
{{if .MatrixEnabled}}
{{if .MatrixError}}
<p class="muted">Chat konnte nicht geladen werden: {{.MatrixError}}</p>
{{else if .MatrixMessages}}
<div class="matrix-scroll" id="matrix-scroll">
<ul class="matrix-list">
{{range .MatrixMessages}}
<li>
<div><strong>{{.Sender}}</strong></div>
{{if .ImageURL}}
<div><img src="{{.ImageURL}}" alt="{{.Body}}" class="matrix-image" loading="lazy"></div>
{{end}}
<div class="matrix-body">{{.Body}}</div>
<div class="muted">{{.Timestamp}}</div>
</li>
{{end}}
</ul>
</div>
{{else}}
<p class="muted">Keine Nachrichten gefunden.</p>
{{end}}
{{else}}
<p class="muted">Matrix-Chat ist nicht konfiguriert.</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 .Groups}}
<ul class="task-sublist">
{{range .Groups}}
<li>
<span><strong>{{.Field}}</strong></span>
<ul class="task-sublist">
{{range .Tasks}}
<li class="{{if .Completed}}done-task{{end}}">
<span>{{.Message}}</span>
<form method="post" action="/tasks/toggle" class="inline-form">
<input type="hidden" name="uid" value="{{.UID}}">
<input type="hidden" name="month" value="{{.Month}}">
<input type="hidden" name="day" value="{{.Day}}">
<input type="hidden" name="year_offset" value="{{.YearOffset}}">
<input type="hidden" name="completed" value="{{if .Completed}}1{{else}}0{{end}}">
<button type="submit" class="btn-small {{if .Completed}}secondary{{end}}">{{if .Completed}}Offen{{else}}Erledigt{{end}}</button>
</form>
</li>
{{end}}
</ul>
</li>
{{end}}
</ul>
{{else}}
<span class="muted">Keine Einträge</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}}
<script>
(function () {
var box = document.getElementById("matrix-scroll");
if (!box) return;
box.scrollTop = box.scrollHeight;
})();
</script>
</body>
</html>