51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?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(); ?>
|