76 lines
3.3 KiB
PHP
76 lines
3.3 KiB
PHP
<?php
|
|
use Hpz937\BillReminder\Database\SqLiteAdapter;
|
|
use Hpz937\BillReminder\Bill\Bill;
|
|
// Assuming session_start() is called in the front controller or app.php
|
|
|
|
// Redirect to login page if the user is not logged in
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header('Location: /');
|
|
exit;
|
|
}
|
|
|
|
$content = function () {
|
|
/* use ($bills) if fetching bills from the database */
|
|
|
|
?>
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-8">
|
|
<h2 class="mt-5">Dashboard</h2>
|
|
<button type="button" class="btn btn-primary mb-3" data-bs-toggle="modal" data-bs-target="#addBillModal">Add New Bill</button>
|
|
|
|
<!-- Bills Table -->
|
|
<table class="table" id="billsTable">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Description</th>
|
|
<th scope="col">Amount</th>
|
|
<th scope="col">Due Date</th>
|
|
<th scope="col">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<!-- Bills will be loaded here by Axios -->
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
<!-- Add Bill Modal -->
|
|
<div class="modal fade" id="addBillModal" tabindex="-1" role="dialog" aria-labelledby="addBillModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="addBillModalLabel">Add New Bill</h5>
|
|
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<form id="addBillForm">
|
|
<div class="modal-body">
|
|
<div class="form-group">
|
|
<label for="description">Description</label>
|
|
<input type="text" class="form-control" id="description" name="description" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="amount">Amount</label>
|
|
<input type="number" class="form-control" id="amount" name="amount" step="0.01" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="due_date">Due Date</label>
|
|
<input type="date" class="form-control" id="due_date" name="due_date" required>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
<button type="submit" class="btn btn-primary">Add Bill</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<?php };
|
|
|
|
require __DIR__ . '/layouts/app.php';
|