Aufgaben-Templates löschbar machen

This commit is contained in:
Kai
2026-02-17 17:33:38 +01:00
parent aa0475c151
commit 4d9b3a2997
3 changed files with 44 additions and 0 deletions

View File

@@ -498,6 +498,27 @@ func (a *App) handleCreateTaskTemplate(w http.ResponseWriter, r *http.Request) {
redirectWithMessage(w, r, "/planning", "info", "Template gespeichert")
}
func (a *App) handleDeleteTaskTemplate(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
if err := r.ParseForm(); err != nil {
redirectWithMessage(w, r, "/planning", "error", "Form ungültig")
return
}
id := mustInt64(r.FormValue("id"), 0)
if id <= 0 {
redirectWithMessage(w, r, "/planning", "error", "Template-ID ungültig")
return
}
if _, err := a.db.Exec(`DELETE FROM custom_task_templates WHERE id=?`, id); err != nil {
redirectWithMessage(w, r, "/planning", "error", "Template konnte nicht gelöscht werden")
return
}
redirectWithMessage(w, r, "/planning", "info", "Template gelöscht")
}
func (a *App) handleCreateCustomTask(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)