initial code commit

This commit is contained in:
2024-02-09 20:52:11 -06:00
parent f5d267ea98
commit 532df6b9be
18 changed files with 583 additions and 1 deletions

50
views/dashboard.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
use Hpz937\BillReminder\View\PageRenderer;
session_start();
// Redirect to login if not logged in
if (!isset($_SESSION['user_id'])) {
header('Location: /login');
exit;
}
PageRenderer::renderHeader('My Bills Dashboard');
// Fetch user's bills from the database
// $bills = fetchBillsForUser($_SESSION['user_id']);
?>
<h2>My Bills</h2>
<a href="/add-bill" class="btn btn-success">Add New Bill</a>
<div class="mt-3">
<table class="table">
<thead>
<tr>
<th>Due Date</th>
<th>Amount</th>
<th>Description</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($bills as $bill): ?>
<tr>
<td><?php echo htmlspecialchars($bill->dueDate); ?></td>
<td><?php echo htmlspecialchars($bill->amount); ?></td>
<td><?php echo htmlspecialchars($bill->description); ?></td>
<td><?php echo $bill->isPaid ? 'Paid' : 'Pending'; ?></td>
<td>
<a href="/edit-bill/<?php echo $bill->id; ?>" class="btn btn-primary btn-sm">Edit</a>
<a href="/delete-bill/<?php echo $bill->id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');">Delete</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php PageRenderer::renderFooter(); ?>