Add task completion toggle, custom task templates, and umlaut UI updates

This commit is contained in:
Kai
2026-02-16 13:40:02 +01:00
parent a1c1ef31a3
commit 723e9142b2
13 changed files with 548 additions and 118 deletions

View File

@@ -36,6 +36,16 @@ func (a *App) handleDashboard(w http.ResponseWriter, r *http.Request) {
http.Error(w, "steps read failed", http.StatusInternalServerError)
return
}
customTasks, err := a.listCustomTasks()
if err != nil {
http.Error(w, "custom tasks read failed", http.StatusInternalServerError)
return
}
doneMap, err := a.listTaskCompletionsMap()
if err != nil {
http.Error(w, "completions read failed", http.StatusInternalServerError)
return
}
data := DashboardPage{
BasePage: BasePage{
ActivePath: "/",
@@ -44,8 +54,8 @@ func (a *App) handleDashboard(w http.ResponseWriter, r *http.Request) {
},
Settings: settings,
CurrentMonth: monthNames[settings.CurrentMonth-1],
TodayTasks: buildTasksForDay(plans, stepMap, settings.CurrentMonth, settings.CurrentDay),
Calendar: buildCalendar(plans, stepMap, settings.CurrentMonth, settings.CurrentDay, settings.DaysPerMonth, 14),
TodayTasks: buildTasksForDay(plans, stepMap, customTasks, doneMap, settings.CurrentMonth, settings.CurrentDay),
Calendar: buildCalendar(plans, stepMap, customTasks, doneMap, settings.CurrentMonth, settings.CurrentDay, settings.DaysPerMonth, 14),
PlanningCount: len(plans),
}
a.renderTemplate(w, "templates/dashboard.html", data)
@@ -125,6 +135,16 @@ func (a *App) handlePlanningPage(w http.ResponseWriter, r *http.Request) {
http.Error(w, "plans read failed", http.StatusInternalServerError)
return
}
taskTemplates, err := a.listCustomTaskTemplates()
if err != nil {
http.Error(w, "templates read failed", http.StatusInternalServerError)
return
}
customTasks, err := a.listCustomTasks()
if err != nil {
http.Error(w, "custom tasks read failed", http.StatusInternalServerError)
return
}
data := PlanningPage{
BasePage: BasePage{
ActivePath: "/planning",
@@ -136,6 +156,8 @@ func (a *App) handlePlanningPage(w http.ResponseWriter, r *http.Request) {
Crops: crops,
Plans: plans,
PlanningTargets: buildPlanningTargets(fields),
TaskTemplates: taskTemplates,
CustomTasks: customTasks,
}
a.renderTemplate(w, "templates/planning.html", data)
}