diff options
Diffstat (limited to 'web/templates')
| -rw-r--r-- | web/templates/partials/todoist-tasks.html | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/web/templates/partials/todoist-tasks.html b/web/templates/partials/todoist-tasks.html index 7595ac7..25faf47 100644 --- a/web/templates/partials/todoist-tasks.html +++ b/web/templates/partials/todoist-tasks.html @@ -1,17 +1,58 @@ {{define "todoist-tasks"}} -<section class="card"> +<section class="card" id="todoist-list"> <!-- Section Header with Brand Color --> <div class="flex items-center gap-3 mb-6"> <div class="w-1 h-8 bg-todoist rounded"></div> <h2 class="text-2xl font-bold text-gray-900">Todoist Tasks</h2> </div> + <!-- Quick Add Form --> + {{if .Projects}} + <details class="mb-6" open> + <summary class="cursor-pointer text-sm text-indigo-600 hover:text-indigo-800 font-medium transition-colors mb-2"> + + Quick Add Task + </summary> + <form hx-post="/tasks" + hx-target="#todoist-list" + hx-swap="outerHTML" + class="mt-3 space-y-3 bg-white/40 p-4 rounded-lg"> + + <input type="text" + name="content" + placeholder="Task content" + required + class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"> + + <select name="project_id" + class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"> + <option value="">Select project (optional)...</option> + {{range .Projects}} + <option value="{{.ID}}">{{.Name}}</option> + {{end}} + </select> + + <button type="submit" + class="w-full bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors"> + Add Task + </button> + </form> + </details> + {{end}} + + <!-- Tasks List --> {{if .Tasks}} <div class="space-y-3"> {{range .Tasks}} - <div class="task-item"> - <input type="checkbox" {{if .Completed}}checked{{end}} - class="mt-1 h-5 w-5 text-todoist rounded border-gray-300" disabled> + <div class="todoist-task-item task-item"> + <!-- Functional Checkbox --> + <input type="checkbox" + {{if .Completed}}checked{{end}} + hx-post="/tasks/complete" + hx-vals='{"task_id": "{{.ID}}"}' + hx-target="closest .todoist-task-item" + hx-swap="outerHTML" + class="mt-1 h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 cursor-pointer"> + <div class="flex-1"> <p class="font-medium text-gray-900 {{if .Completed}}line-through text-gray-500{{end}}"> {{.Content}} |
