Backup #101

ID101
Dateipfad/var/www/dev.campus.systemische-tools.de/src/View/tasks/show.php
Version1
Typ modified
Größe6.4 KB
Hashb31c74a5bfb3ee7e42e23ea30ba7519cb9571030b54703c54f4e81545af0eec0
Datum2025-12-20 19:18:31
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Edit-Operation
Datei existiert Ja

Dateiinhalt

<?php 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'): ?>
    <form method="POST" action="/api/v1/tasks/<?= $task['id'] ?>/status" class="inline-form">
        <input type="hidden" name="status" value="in_progress">
        <button type="submit" class="btn btn--light">Starten</button>
    </form>
    <?php endif; ?>
    <?php if ($task['status'] === 'in_progress'): ?>
    <form method="POST" action="/api/v1/tasks/<?= $task['id'] ?>/status" class="inline-form">
        <input type="hidden" name="status" value="completed">
        <button type="submit" class="btn btn--success">Abschließen</button>
    </form>
    <?php endif; ?>
    <?php if ($task['type'] !== 'human_task' && in_array($task['status'], ['pending', 'in_progress'])): ?>
    <form method="POST" action="/api/v1/tasks/<?= $task['id'] ?>/execute" class="inline-form">
        <button type="submit" class="btn btn--primary">Mit KI ausführen</button>
    </form>
    <?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
    });
}

domAdapter.querySelectorAll(document, '.inline-form').forEach(form => {
    eventAdapter.on(form, 'submit', async (e) => {
        e.preventDefault();
        const formData = new FormData(form);
        const data = Object.fromEntries(formData.entries());
        const response = await fetch(form.action, {
            method: 'POST',
            headers: {'Content-Type': 'application/json'},
            body: JSON.stringify(data)
        });
        const result = await response.json();
        if (result.success === true) {
            location.reload();
        } else {
            deps.ui.showMessage({ type: 'error', text: 'Fehler: ' + result.error });
        }
    }, deps, 'TASK_INLINE_FORM', 'tasks');
});
</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
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