{
"tool_response": [
{
"type": "text",
"text": "{\n \"success\": true,\n \"task\": {\n \"id\": 438,\n \"uuid\": \"06f7aa5c-f26a-4e4d-9737-ea93726682cd\",\n \"title\": \"HTMX: tasks\/index.php - Inline Status-Änderung\",\n \"description\": \"# HTMX-Implementation: tasks\/index.php\\n\\n## Ziel\\nStatus-Badge klickbar machen fuer Inline-Status-Aenderung ohne Page-Reload.\\n\\n## Betroffene Datei\\n`\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/tasks\/index.php`\\n\\n## Aktuelle Implementierung (Zeile 64)\\n```php\\n<td><span class=\\\"badge badge--<?= $task['status'] ?>\\\"><?= $task['status'] ?><\/span><\/td>\\n```\\n\\n## Ziel-Implementierung\\n\\n### View: Status-Dropdown (Zeile 64 ersetzen)\\n```php\\n<td>\\n <select class=\\\"badge-select badge-select--<?= $task['status'] ?>\\\"\\n hx-patch=\\\"\/api\/v1\/tasks\/<?= $task['id'] ?>\/status\\\"\\n hx-headers='{\\\"X-CSRF-TOKEN\\\": \\\"<?= $csrfToken ?>\\\"}'\\n hx-target=\\\"closest td\\\"\\n hx-swap=\\\"innerHTML\\\"\\n hx-disabled-elt=\\\"this\\\">\\n <?php foreach (['pending', 'in_progress', 'completed', 'failed', 'cancelled'] as $s): ?>\\n <option value=\\\"<?= $s ?>\\\" <?= $task['status'] === $s ? 'selected' : '' ?>><?= $s ?><\/option>\\n <?php endforeach; ?>\\n <\/select>\\n<\/td>\\n```\\n\\n### Controller: Api\/TasksController::patchStatus()\\n```php\\npublic function patchStatus(int $id): void\\n{\\n $this->requireCsrf();\\n \\n $input = $this->getJsonInput();\\n $newStatus = $input['status'] ?? $_POST['status'] ?? null;\\n \\n if (!$newStatus) {\\n $this->htmxError('Status fehlt');\\n return;\\n }\\n \\n try {\\n $this->tasksUseCase->updateStatus($id, $newStatus);\\n $task = $this->tasksUseCase->getById($id);\\n \\n if ($this->isHtmxRequest()) {\\n $this->partial('tasks.partials.status-select', [\\n 'task' => $task,\\n 'csrfToken' => $_SESSION['_csrf_token']\\n ]);\\n return;\\n }\\n \\n $this->json(['success' => true]);\\n } catch (\\\\Exception $e) {\\n $this->htmxError($e->getMessage());\\n }\\n}\\n```\\n\\n### Partial: tasks\/partials\/status-select.php\\n```php\\n<select class=\\\"badge-select badge-select--<?= $task['status'] ?>\\\"\\n hx-patch=\\\"\/api\/v1\/tasks\/<?= $task['id'] ?>\/status\\\"\\n hx-headers='{\\\"X-CSRF-TOKEN\\\": \\\"<?= $csrfToken ?>\\\"}'\\n hx-target=\\\"closest td\\\"\\n hx-swap=\\\"innerHTML\\\"\\n hx-disabled-elt=\\\"this\\\">\\n <?php foreach (['pending', 'in_progress', 'completed', 'failed', 'cancelled'] as $s): ?>\\n <option value=\\\"<?= $s ?>\\\" <?= $task['status'] === $s ? 'selected' : '' ?>><?= $s ?><\/option>\\n <?php endforeach; ?>\\n<\/select>\\n```\\n\\n### Route\\n```php\\n$router->patch('\/api\/v1\/tasks\/{id}\/status', [Api\\\\TasksController::class, 'patchStatus']);\\n```\\n\\n### CSS (admin.css)\\n```css\\n.badge-select {\\n appearance: none;\\n border: none;\\n padding: 0.25rem 0.75rem;\\n border-radius: var(--radius-sm);\\n cursor: pointer;\\n font-size: var(--font-size-sm);\\n font-weight: 500;\\n}\\n.badge-select--pending { background: var(--color-warning-bg); color: var(--color-warning-text); }\\n.badge-select--in_progress { background: var(--color-info-bg); color: var(--color-info-text); }\\n.badge-select--completed { background: var(--color-success-bg); color: var(--color-success-text); }\\n.badge-select--failed { background: var(--color-danger-bg); color: var(--color-danger-text); }\\n.badge-select--cancelled { background: var(--color-muted-bg); color: var(--color-muted-text); }\\n```\\n\\n## Contract-Compliance (v1.2)\\n- [x] HTMX-C3: hx-patch mit CSRF-Token\\n- [x] HTMX-C6: Controller nutzt htmxError()\\n- [x] HTMX-R4: hx-disabled-elt gegen Doppelklicks\\n\\n## Testplan\\n1. [ ] Status-Dropdown sichtbar in Tabelle\\n2. [ ] Status aendern → Inline-Update ohne Reload\\n3. [ ] Fehlerfall → Alert in #htmx-messages\\n4. [ ] Doppelklick-Schutz: Select disabled waehrend Request\\n5. [ ] CSRF-Fehler → 403 + Alert\",\n \"type\": \"ai_task\",\n \"status\": \"pending\",\n \"created_by\": \"mcp-tasks\",\n \"created_by_type\": \"ai\",\n \"parent_task_id\": null,\n \"due_date\": null,\n \"created_at\": \"2025-12-27T11:34:07.850646\",\n \"updated_at\": \"2025-12-27T11:56:55.808446\",\n \"completed_at\": null,\n \"metadata\": {}\n },\n \"assignments\": [],\n \"results\": []\n}"
}
]
}