Add sales-month planning for crops/products and fix today task label format

This commit is contained in:
Kai
2026-02-16 14:03:19 +01:00
parent 723e9142b2
commit b1c502a919
8 changed files with 216 additions and 15 deletions

View File

@@ -25,6 +25,9 @@
<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>
<label>Bestpreis-Monat (0=kein Hinweis)
<input type="number" name="best_sale_month" min="0" max="12" value="0">
</label>
<label class="check"><input type="checkbox" name="regrow_enabled"> Wächst nach Ernte erneut</label>
<label>Zusatz-Ernten (0 = unendlich)
<input type="number" name="regrow_cycles" min="0" max="120" value="0">
@@ -37,7 +40,7 @@
<h2>Bestehende Feldfrüchte</h2>
<div class="table-wrap">
<table>
<thead><tr><th>Name</th><th>Aussaat</th><th>Wachstum</th><th>Aktionen</th></tr></thead>
<thead><tr><th>Name</th><th>Aussaat</th><th>Wachstum</th><th>Bestpreis</th><th>Aktionen</th></tr></thead>
<tbody>
{{if .Crops}}
{{range .Crops}}
@@ -54,6 +57,7 @@
<label class="check mt-xs"><input type="checkbox" name="regrow_enabled" {{if .RegrowEnabled}}checked{{end}}> Regrow</label>
<input type="number" name="regrow_cycles" min="0" max="120" value="{{.RegrowCycles}}" title="0 = unendlich">
</td>
<td><input type="number" name="best_sale_month" min="0" max="12" value="{{.BestSaleMonth}}"></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 löschen?')">Löschen</button>
@@ -62,7 +66,44 @@
</tr>
{{end}}
{{else}}
<tr><td colspan="4">Keine Feldfrüchte vorhanden.</td></tr>
<tr><td colspan="5">Keine Feldfrüchte vorhanden.</td></tr>
{{end}}
</tbody>
</table>
</div>
</section>
<section class="card full-width">
<h2>Produktionsgüter</h2>
<form method="post" action="/products/create" class="grid">
<label>Name
<input type="text" name="name" maxlength="120" required placeholder="z.B. Mehl">
</label>
<label>Bestpreis-Monat
<input type="number" name="best_sale_month" min="1" max="12" required>
</label>
<button type="submit">Produktionsgut anlegen</button>
</form>
<div class="table-wrap mt">
<table>
<thead><tr><th>Name</th><th>Bestpreis-Monat</th><th>Aktionen</th></tr></thead>
<tbody>
{{if .Products}}
{{range .Products}}
<tr>
<form method="post" action="/products/update">
<td><input type="hidden" name="id" value="{{.ID}}"><input type="text" name="name" value="{{.Name}}" maxlength="120" required></td>
<td><input type="number" name="best_sale_month" min="1" max="12" value="{{.BestSaleMonth}}" required></td>
<td class="actions">
<button type="submit" class="btn-small">Speichern</button>
<button type="submit" formaction="/products/delete" formnovalidate class="btn-small danger" onclick="return confirm('Produktionsgut wirklich löschen?')">Löschen</button>
</td>
</form>
</tr>
{{end}}
{{else}}
<tr><td colspan="3">Keine Produktionsgüter vorhanden.</td></tr>
{{end}}
</tbody>
</table>

View File

@@ -56,7 +56,7 @@
<ul class="tasks">
{{range .TodayTasks}}
<li class="{{if .Completed}}done-task{{end}}">
<span><strong>{{.Type}}:</strong> {{.Message}}</span>
<span>{{.Field}}: {{.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}}">