120 lines
5.7 KiB
PHP
120 lines
5.7 KiB
PHP
<!-- Backlog Tab -->
|
|
<div class="tab-pane fade" id="backlog">
|
|
<!-- Add new backlog item -->
|
|
<form method="POST" action="?tab=backlog" class="mb-4">
|
|
<input type="hidden" name="add_backlog" value="1">
|
|
<div class="row g-2 align-items-end">
|
|
<div class="col-sm-3">
|
|
<label class="form-label">Title</label>
|
|
<input class="form-control" name="backlog_title" required>
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label class="form-label">Description</label>
|
|
<input class="form-control" name="backlog_desc">
|
|
</div>
|
|
<div class="col-sm-2">
|
|
<label class="form-label">Type</label>
|
|
<select class="form-select" name="backlog_type">
|
|
<option value="bug">Bug</option>
|
|
<option value="improvement">Improvement</option>
|
|
<option value="nice-to-have">Nice-to-have</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-sm-2">
|
|
<label class="form-label">Status</label>
|
|
<select class="form-select" name="backlog_status">
|
|
<option value="in progress">In Progress</option>
|
|
<option value="done">Done</option>
|
|
<option value="cancelled">Cancelled</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-sm-2">
|
|
<button class="btn btn-primary w-100">Add new</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<table class="table table-bordered table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>T</th>
|
|
<th>Title</th>
|
|
<th>Description</th>
|
|
<th>Status</th>
|
|
<th>Created</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$backlog = loadBacklog($backlogFile);
|
|
// Custom sorting function
|
|
usort($backlog, function($a, $b) {
|
|
$status_priority = ['in progress' => 1, 'done' => 2, 'cancelled' => 3];
|
|
$type_priority = ['bug' => 1, 'improvement' => 2, 'nice-to-have' => 3];
|
|
// Compare by status first
|
|
if ($status_priority[$a['status']] != $status_priority[$b['status']]) {
|
|
return $status_priority[$a['status']] - $status_priority[$b['status']];
|
|
}
|
|
|
|
// Status is the same, compare by type next
|
|
return $type_priority[$a['type']] - $type_priority[$b['type']];
|
|
});
|
|
foreach ($backlog as $item): ?>
|
|
<tr>
|
|
<td>
|
|
<?php
|
|
$type = $item['type'] ?? '';
|
|
$iconClass = [
|
|
'bug' => 'bi-bug-fill text-danger',
|
|
'improvement' => 'bi-tools text-success',
|
|
'nice-to-have' => 'bi-star text-secondary'
|
|
][$type] ?? '';
|
|
?>
|
|
<?php if ($iconClass): ?>
|
|
<i class="bi <?= $iconClass ?>" title="<?= ucfirst($type) ?>"></i>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><?= htmlspecialchars($item['title']) ?></td>
|
|
<td><?= nl2br(htmlspecialchars($item['desc'])) ?></td>
|
|
<td>
|
|
<?php
|
|
$status = $item['status'] ?? 'in progress';
|
|
$badge = [
|
|
'in progress' => 'warning',
|
|
'done' => 'success',
|
|
'cancelled' => 'secondary'
|
|
][$status] ?? 'light';
|
|
?>
|
|
<span class="badge bg-<?= $badge ?>">
|
|
<?= ucfirst($status) ?>
|
|
</span>
|
|
</td>
|
|
<td><?= htmlspecialchars($item['created']) ?></td>
|
|
<td>
|
|
<button class="btn btn-outline-info" onclick="viewBacklog(
|
|
'<?= htmlspecialchars($item['id']) ?>',
|
|
'<?= htmlspecialchars(addslashes($item['title'])) ?>',
|
|
'<?= htmlspecialchars(addslashes($item['desc'])) ?>',
|
|
'<?= htmlspecialchars($status) ?>',
|
|
'<?= htmlspecialchars($item['type'] ?? '') ?>',
|
|
'<?= htmlspecialchars($item['created']) ?>'
|
|
)" title="View Details"><i class="bi bi-info-circle"></i></button>
|
|
<button class="btn btn-outline-secondary" onclick="editBacklog(
|
|
'<?= htmlspecialchars($item['id']) ?>',
|
|
'<?= htmlspecialchars(addslashes($item['title'])) ?>',
|
|
'<?= htmlspecialchars(addslashes($item['desc'])) ?>',
|
|
'<?= htmlspecialchars($status) ?>',
|
|
'<?= htmlspecialchars($item['type'] ?? '') ?>'
|
|
)" title="Edit"><i class="bi bi-pencil"></i></button>
|
|
<form method="POST" class="d-inline" onsubmit="return confirm('Delete this backlog item?');" action="?tab=backlog">
|
|
<input type="hidden" name="delete_backlog_id" value="<?= htmlspecialchars($item['id']) ?>">
|
|
<button class="btn btn-outline-danger" title="Delete"><i class="bi bi-trash"></i></button>
|
|
</form>
|
|
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|