Split app into subpages, persist ingame time, and add 14-month dashboard calendar
This commit is contained in:
66
templates/crops.html
Normal file
66
templates/crops.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<!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>
|
||||
96
templates/dashboard.html
Normal file
96
templates/dashboard.html
Normal 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>
|
||||
102
templates/fields.html
Normal file
102
templates/fields.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>FarmCal - Felder</title>
|
||||
<link rel="stylesheet" href="/static/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top"><h1>FarmCal</h1><p>Felder und Feldgruppen</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>Feld anlegen</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>
|
||||
<label class="check"><input type="checkbox" name="owned"> Im Besitz</label>
|
||||
<button type="submit">Anlegen</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card full-width">
|
||||
<h2>Felder verwalten</h2>
|
||||
<div class="table-wrap">
|
||||
<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>
|
||||
<button type="submit" formaction="/fields/delete" formnovalidate class="btn-small danger" onclick="return confirm('Feld wirklich loeschen?')">Loeschen</button>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<tr><td colspan="5">Keine Felder vorhanden.</td></tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card full-width">
|
||||
<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="8">
|
||||
{{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.</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">
|
||||
<input type="hidden" name="group_key" value="{{.Key}}">
|
||||
<button type="submit" class="btn-small danger" onclick="return confirm('Gruppe aufloesen?')">Aufloesen</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<tr><td colspan="3">Keine Gruppen 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>
|
||||
34
templates/general.html
Normal file
34
templates/general.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>FarmCal - Allgemein</title>
|
||||
<link rel="stylesheet" href="/static/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top"><h1>FarmCal</h1><p>Allgemeine Einstellungen</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>Tage pro Monat</h2>
|
||||
<form method="post" action="/settings/days" class="grid">
|
||||
<label>Tage pro Ingame-Monat
|
||||
<input type="number" name="days_per_month" min="1" max="31" value="{{.Settings.DaysPerMonth}}" required>
|
||||
</label>
|
||||
<button type="submit">Speichern</button>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
{{if .Error}}<div class="toast error">{{.Error}}</div>{{end}}
|
||||
{{if .Info}}<div class="toast info">{{.Info}}</div>{{end}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,297 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>FarmCal</title>
|
||||
<link rel="stylesheet" href="/static/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
<h1>FarmCal</h1>
|
||||
<p>Planung fuer Felder, Feldgruppen, Aussaat und Ernte</p>
|
||||
</header>
|
||||
|
||||
<main class="layout">
|
||||
<section class="card">
|
||||
<h2>Ingame-Zeit</h2>
|
||||
<form method="get" action="/" class="grid">
|
||||
<label>Monat
|
||||
<select name="month">
|
||||
{{range .Months}}
|
||||
<option value="{{.Value}}" {{if eq $.NowMonth .Value}}selected{{end}}>{{.Label}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
<label>Tag
|
||||
<input type="number" name="day" min="1" max="{{.DaysPerMonth}}" value="{{.NowDay}}">
|
||||
</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}}">
|
||||
</label>
|
||||
<button type="submit">Speichern</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Heutige Aufgaben</h2>
|
||||
{{if .Tasks}}
|
||||
<ul class="tasks">
|
||||
{{range .Tasks}}
|
||||
<li><strong>{{.Type}}:</strong> {{.Message}}</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<p>Keine Aufgaben fuer diesen Ingame-Tag.</p>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<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>
|
||||
<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>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}} (Monat {{.SowStartMonth}}-{{.SowEndMonth}})</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
<label>Startmonat
|
||||
<select name="start_month" required>
|
||||
{{range .Months}}
|
||||
<option value="{{.Value}}" {{if eq $.NowMonth .Value}}selected{{end}}>{{.Label}}</option>
|
||||
{{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>
|
||||
|
||||
<section class="card">
|
||||
<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">Noch 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>
|
||||
83
templates/planning.html
Normal file
83
templates/planning.html
Normal 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>
|
||||
Reference in New Issue
Block a user