37487-vm/bugs.php
2026-01-15 17:13:40 +00:00

76 lines
3.0 KiB
PHP

<?php
require_once 'db/config.php';
$pdo = db();
$stmt = $pdo->query('SELECT * FROM bugs ORDER BY created_at DESC');
$bugs = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bug Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<style>
body { background-color: #f8fafc; }
.card { border: 1px solid #e2e8f0; }
</style>
</head>
<body>
<div class="container py-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3">Bug Dashboard</h1>
<a href="add_bug.php" class="btn btn-primary d-inline-flex align-items-center">
<i data-feather="plus" class="me-2"></i>Add New Bug
</a>
</div>
<div class="card">
<div class="card-body">
<?php if (empty($bugs)): ?>
<div class="text-center py-5">
<p class="mb-0">No bugs found.</p>
</div>
<?php else: ?>
<div class="table-responsive">
<table class="table table-hover">
<thead class="table-light">
<tr>
<th scope="col">Title</th>
<th scope="col">Status</th>
<th scope="col">Created At</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($bugs as $bug): ?>
<tr>
<td><?php echo htmlspecialchars($bug['title']); ?></td>
<td><span class="badge bg-secondary"><?php echo htmlspecialchars($bug['status']); ?></span></td>
<td><?php echo htmlspecialchars($bug['created_at']); ?></td>
<td>
<a href="#" class="btn btn-sm btn-outline-secondary d-inline-flex align-items-center">
<i data-feather="eye" class="me-2"></i>View
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
<div class="text-center mt-4">
<a href="index.php">Back to Home</a>
</div>
</div>
<script>
feather.replace()
</script>
</body>
</html>