Backup #1708

ID1708
Dateipfad/var/www/dev.campus.systemische-tools.de/src/View/tasks/show.php
Version6
Typ modified
Größe6.2 KB
Hash6f773cf32f2f9c8236adb897f2d2d392bb3f2d81d629cd83f59e947e3b88ed44
Datum2025-12-27 12:23:59
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Edit-Operation
Datei existiert Ja

Dateiinhalt

<?php

declare(strict_types=1);

// @responsibility: View für Task-Details mit HTMX-Aktionen

ob_start();
?>

<nav class="breadcrumb">
    <a href="/tasks">Tasks</a> &raquo; Task #<?= $task['id'] ?>
</nav>

<h1><?= htmlspecialchars($task['title']) ?></h1>

<table>
    <tr><th>ID</th><td><?= $task['id'] ?></td></tr>
    <tr><th>Status</th><td><span class="badge badge--<?= $task['status'] ?>"><?= $task['status'] ?></span></td></tr>
    <tr><th>Typ</th><td><?= $task['type'] ?></td></tr>
    <tr><th>Erstellt von</th><td><?= htmlspecialchars($task['created_by']) ?> (<?= $task['created_by_type'] ?>)</td></tr>
    <tr><th>Erstellt</th><td><?= $task['created_at'] ?></td></tr>
    <?php if ($task['completed_at']): ?>
    <tr><th>Abgeschlossen</th><td><?= $task['completed_at'] ?></td></tr>
    <?php endif; ?>
</table>

<?php if ($task['description']): ?>
<h2>Beschreibung</h2>
<p><?= nl2br(htmlspecialchars($task['description'])) ?></p>
<?php endif; ?>

<h2>Aktionen</h2>
<div class="action-bar">
    <a href="/tasks/<?= $task['id'] ?>/edit" class="btn">Bearbeiten</a>
    <?php if ($task['status'] === 'pending'): ?>
    <button type="button"
            class="btn btn--light"
            hx-put="/api/v1/tasks/<?= $task['id'] ?>/status"
            hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'
            hx-vals='{"status": "in_progress"}'
            hx-swap="none"
            hx-on::after-request="if(event.detail.successful) location.reload()"
            hx-disabled-elt="this">
        Starten
    </button>
    <?php endif; ?>
    <?php if ($task['status'] === 'in_progress'): ?>
    <button type="button"
            class="btn btn--success"
            hx-put="/api/v1/tasks/<?= $task['id'] ?>/status"
            hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'
            hx-vals='{"status": "completed"}'
            hx-swap="none"
            hx-on::after-request="if(event.detail.successful) location.reload()"
            hx-disabled-elt="this">
        Abschließen
    </button>
    <?php endif; ?>
    <?php if ($task['type'] !== 'human_task' && in_array($task['status'], ['pending', 'in_progress'])): ?>
    <button type="button"
            class="btn btn--primary"
            hx-post="/api/v1/tasks/<?= $task['id'] ?>/execute"
            hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'
            hx-disabled-elt="this">
        Mit KI ausführen
    </button>
    <?php endif; ?>
</div>

<?php if (!empty($assignments)): ?>
<h2>Zuweisungen</h2>
<input type="search" id="assignments-search" class="search-input" placeholder="Zuweisungen durchsuchen...">
<table id="assignments-table" data-sortable>
    <thead>
        <tr>
            <th data-sort="assignee">Bearbeiter</th>
            <th data-sort="type">Typ</th>
            <th data-sort="model">Model</th>
            <th data-sort="status">Status</th>
            <th data-sort="date">Zugewiesen</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($assignments as $a): ?>
        <tr>
            <td><?= htmlspecialchars($a['assignee']) ?></td>
            <td><?= $a['assignee_type'] ?></td>
            <td><?= $a['model_name'] ?: '-' ?></td>
            <td><?= $a['status'] ?></td>
            <td><?= substr($a['assigned_at'], 0, 16) ?></td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php endif; ?>

<?php if (!empty($results)): ?>
<h2>Ergebnisse</h2>
<?php foreach ($results as $r): ?>
<div class="result-box">
    <div class="result-box__header">
        <strong><?= htmlspecialchars($r['executor']) ?> (<?= $r['model_name'] ?: $r['executor_type'] ?>)</strong>
        <span class="badge badge--<?= $r['status'] === 'success' ? 'completed' : 'failed' ?>"><?= $r['status'] ?></span>
    </div>
    <table>
        <tr><th>Tokens</th><td><?= $r['tokens_total'] ?: '-' ?> (In: <?= $r['tokens_input'] ?: '-' ?>, Out: <?= $r['tokens_output'] ?: '-' ?>)</td></tr>
        <tr><th>Dauer</th><td><?= $r['duration_ms'] ? $r['duration_ms'] . 'ms' : '-' ?></td></tr>
        <tr><th>Zeit</th><td><?= substr($r['created_at'], 0, 19) ?></td></tr>
    </table>
    <?php if ($r['response']): ?>
    <div class="result-box__content">
        <strong>Antwort:</strong>
        <pre><?= htmlspecialchars($r['response']) ?></pre>
    </div>
    <?php endif; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>

<?php if (!empty($comments)): ?>
<h2>Kommentare</h2>
<input type="search" id="comments-search" class="search-input" placeholder="Kommentare durchsuchen...">
<table id="comments-table" data-sortable>
    <thead>
        <tr>
            <th data-sort="author">Autor</th>
            <th data-sort="type">Typ</th>
            <th data-sort="content">Inhalt</th>
            <th data-sort="time">Zeit</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($comments as $c): ?>
        <tr>
            <td><?= htmlspecialchars($c['author']) ?></td>
            <td><?= $c['comment_type'] ?></td>
            <td><?= htmlspecialchars($c['content']) ?></td>
            <td><?= substr($c['created_at'], 0, 16) ?></td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php endif; ?>

<p style="margin-top: 2rem;"><a href="/tasks">&larr; Zurück zur Task-Liste</a></p>

<script type="module">
import { init } from '/js/components/data-table.js';
import { domAdapter } from '/js/adapters/domAdapter.js';
import { eventAdapter } from '/js/adapters/eventAdapter.js';

const deps = {
    clock: { now_epoch_ms_utc: () => Date.now() },
    logger: console,
    ui: {
        showMessage: (msg) => { console.log(msg.type + ': ' + msg.text); },
        disableFeature: (key) => { console.warn('Feature disabled: ' + key); },
        offerRetry: () => Promise.resolve(false)
    },
    runId: crypto.randomUUID()
};

const dataTable = init(deps);

const assignmentsTable = domAdapter.getElementById('assignments-table');
if (assignmentsTable !== null) {
    dataTable.create('assignments-table', {
        searchInput: 'assignments-search',
        pageSize: 10
    });
}

const commentsTable = domAdapter.getElementById('comments-table');
if (commentsTable !== null) {
    dataTable.create('comments-table', {
        searchInput: 'comments-search',
        pageSize: 10
    });
}

</script>

<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>

Vollständig herunterladen

Aktionen

Herunterladen

Andere Versionen dieser Datei

ID Version Typ Größe Datum
1708 6 modified 6.2 KB 2025-12-27 12:23
1707 5 modified 7.0 KB 2025-12-27 12:23
1706 4 modified 6.7 KB 2025-12-27 12:23
1705 3 modified 6.6 KB 2025-12-27 12:23
102 2 modified 6.5 KB 2025-12-20 19:18
101 1 modified 6.4 KB 2025-12-20 19:18

← Zurück zur Übersicht