projectbased/app/Views/tasks/index.php
SHA-256: bc3d0ad0131840871620bb6a11b2d5419781e97e0b80f2dbfefb76c5a444b79b
<?php use App\Lib\Url; ?>
<div class="section-title mb-3">
<div>
<h1 class="h4 m-0">Aufgaben</h1>
<div class="muted">Projekt: <strong><?= htmlspecialchars($project['title']) ?></strong> · <?= htmlspecialchars($project['region']) ?></div>
</div>
<a class="btn btn-outline-light" href="<?= Url::route('project_view',['id'=>(int)$project['id']]) ?>">Zurück</a>
</div>
<div class="row g-4">
<div class="col-lg-5">
<div class="card p-4">
<h2 class="h6 mb-3">Neue Aufgabe</h2>
<form method="post" action="<?= Url::route('task_add') ?>">
<input type="hidden" name="csrf" value="<?= htmlspecialchars($csrf) ?>">
<input type="hidden" name="project_id" value="<?= (int)$project['id'] ?>">
<div class="mb-3">
<label class="form-label">Titel</label>
<input class="form-control" name="title" required>
</div>
<div class="mb-3">
<label class="form-label">Details</label>
<textarea class="form-control" name="detail" rows="4"></textarea>
</div>
<div class="mb-3">
<label class="form-label">Priorität (1–5)</label>
<select class="form-select" name="priority">
<?php for($i=1;$i<=5;$i++): ?>
<option value="<?= $i ?>" <?= $i===3?'selected':'' ?>><?= $i ?></option>
<?php endfor; ?>
</select>
</div>
<button class="btn btn-primary w-100" type="submit">Speichern</button>
</form>
</div>
</div>
<div class="col-lg-7">
<div class="card p-4">
<h2 class="h6 mb-3">Liste</h2>
<?php if (empty($tasks)): ?>
<div class="muted">Noch keine Aufgaben.</div>
<?php else: ?>
<div class="table-responsive">
<table class="table table-sm align-middle mb-0">
<thead><tr><th>Status</th><th>Aufgabe</th><th>Prio</th><th></th></tr></thead>
<tbody>
<?php foreach($tasks as $t): ?>
<tr>
<td><?= (int)$t['is_done']===1 ? '✅' : '⬜' ?></td>
<td>
<div class="fw-semibold"><?= htmlspecialchars($t['title']) ?></div>
<div class="muted small"><?= htmlspecialchars($t['detail'] ?? '') ?></div>
<div class="muted small">von <?= htmlspecialchars($t['created_by_name']) ?> · <?= htmlspecialchars($t['created_at']) ?></div>
</td>
<td><span class="badge badge-soft"><?= (int)$t['priority'] ?></span></td>
<td>
<form method="post" action="<?= Url::route('task_toggle') ?>">
<input type="hidden" name="csrf" value="<?= htmlspecialchars($csrf) ?>">
<input type="hidden" name="project_id" value="<?= (int)$project['id'] ?>">
<input type="hidden" name="task_id" value="<?= (int)$t['id'] ?>">
<button class="btn btn-sm btn-outline-light" type="submit">Toggle</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>