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

0
views/404.php Normal file
View File

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(); ?>

30
views/home.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
use Hpz937\BillReminder\View\PageRenderer;
session_start();
PageRenderer::renderHeader('Bill Reminder Home');
// views/home.php
session_start(); // Ensure session is started to access session variables
// Check if user is logged in
$loggedIn = isset($_SESSION['user_id']);
?>
<h1>Welcome to Bill Reminder</h1>
<p>Manage your bills efficiently and never miss a payment.</p>
<?php if ($loggedIn): ?>
<p>Hello, <?php echo htmlspecialchars($_SESSION['username']); ?>!</p>
<a href="/dashboard" class="btn btn-primary">Go to Dashboard</a>
<a href="/logout" class="btn btn-secondary">Logout</a>
<?php else: ?>
<a href="/login" class="btn btn-primary">Login</a>
<a href="/register" class="btn btn-secondary">Register</a>
<?php endif; ?>
<?php PageRenderer::renderFooter(); ?>

35
views/login.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
// views/login.php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Handle login logic here
// Use UserManager to verify credentials
// Redirect to home page or dashboard on success
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<link rel="stylesheet" href="path/to/bootstrap/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h2>Login</h2>
<form method="POST" action="/login">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
</div>
</body>
</html>

35
views/register.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
// views/register.php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Handle registration logic here
// Use UserManager to create a new user
// Redirect to login page on success
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Register</title>
<link rel="stylesheet" href="path/to/bootstrap/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h2>Register</h2>
<form method="POST" action="/register">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-success">Register</button>
</form>
</div>
</body>
</html>