Draft 1: 10/28/25
This commit is contained in:
parent
1eb216ae12
commit
5152f90703
315
assets/css/custom.css
Normal file
315
assets/css/custom.css
Normal file
@ -0,0 +1,315 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap');
|
||||
|
||||
:root {
|
||||
--primary-color: #3B82F6;
|
||||
--secondary-color: #10B981;
|
||||
--bg-color: #F9FAFB;
|
||||
--surface-color: #FFFFFF;
|
||||
--text-color: #1F2937;
|
||||
--light-gray: #6B7280;
|
||||
|
||||
--primary-color-staff: #3B82F6;
|
||||
--secondary-color-resident: #10B981;
|
||||
--text-color-dark: #1F2937;
|
||||
--text-color-light: #6B7280;
|
||||
--background-light: #F9FAFB;
|
||||
--surface-white: #FFFFFF;
|
||||
--border-color: #E5E7EB;
|
||||
}
|
||||
|
||||
body.login-page {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
max-width: 480px;
|
||||
width: 100%;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
background-color: var(--surface-color);
|
||||
border-radius: 0.75rem;
|
||||
padding: 3rem;
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-card h1 {
|
||||
font-weight: 600;
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.login-card .subtitle {
|
||||
color: var(--light-gray);
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
.btn-block {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
border-radius: 0.5rem;
|
||||
text-decoration: none;
|
||||
transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
|
||||
}
|
||||
|
||||
.btn-block:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.btn-resident {
|
||||
background-color: var(--secondary-color);
|
||||
color: white;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.btn-staff {
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.footer-text {
|
||||
text-align: center;
|
||||
margin-top: 2rem;
|
||||
color: var(--light-gray);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* Landing Page Styles */
|
||||
body:not(.login-page) {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background-color: var(--surface-white);
|
||||
color: var(--text-color-dark);
|
||||
margin: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.site-header {
|
||||
background-color: var(--surface-white);
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||
padding: 1rem 0;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.site-header .container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.site-header .logo {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-color-dark);
|
||||
font-family: 'Nunito', sans-serif;
|
||||
}
|
||||
|
||||
.site-header nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.site-header nav a {
|
||||
text-decoration: none;
|
||||
color: var(--text-color-light);
|
||||
font-weight: 600;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.site-header nav a:hover {
|
||||
color: var(--primary-color-staff);
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 0.5rem;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.button-primary {
|
||||
background-color: var(--primary-color-staff);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.button-primary:hover {
|
||||
background-color: #2563EB;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
|
||||
}
|
||||
|
||||
.button-secondary {
|
||||
background-color: var(--secondary-color-resident);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.button-secondary:hover {
|
||||
background-color: #059669;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
|
||||
}
|
||||
|
||||
|
||||
/* Hero Section */
|
||||
.hero {
|
||||
background: linear-gradient(to right, #EAF4FB, #EAF7EF);
|
||||
padding: 6rem 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.hero-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
align-items: center;
|
||||
gap: 4rem;
|
||||
}
|
||||
|
||||
.hero-text h1 {
|
||||
font-family: 'Nunito', sans-serif;
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 1rem;
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
.hero-text p {
|
||||
font-size: 1.125rem;
|
||||
color: var(--text-color-light);
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.hero-buttons {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.hero-image img {
|
||||
width: 100%;
|
||||
border-radius: 0.75rem;
|
||||
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
/* Mission Section */
|
||||
.mission-section {
|
||||
padding: 6rem 0;
|
||||
background-color: var(--surface-white);
|
||||
}
|
||||
|
||||
.mission-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
align-items: center;
|
||||
gap: 4rem;
|
||||
}
|
||||
|
||||
.mission-text h2 {
|
||||
font-family: 'Nunito', sans-serif;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 1.5rem;
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
.mission-text blockquote {
|
||||
font-size: 1.25rem;
|
||||
font-style: italic;
|
||||
color: var(--text-color-light);
|
||||
border-left: 4px solid var(--secondary-color-resident);
|
||||
padding-left: 1.5rem;
|
||||
margin: 0 0 2rem 0;
|
||||
}
|
||||
|
||||
.cta-link {
|
||||
font-weight: 600;
|
||||
color: var(--primary-color-staff);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.cta-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.mission-image img {
|
||||
width: 100%;
|
||||
border-radius: 0.75rem;
|
||||
}
|
||||
|
||||
/* How It Works Section */
|
||||
.how-it-works-section {
|
||||
padding: 6rem 0;
|
||||
background-color: var(--background-light);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.how-it-works-section h2 {
|
||||
font-family: 'Nunito', sans-serif;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.how-it-works-section p {
|
||||
font-size: 1.125rem;
|
||||
color: var(--text-color-light);
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.site-footer-main {
|
||||
background-color: var(--text-color-dark);
|
||||
color: var(--background-light);
|
||||
padding: 2rem 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Login Form Styles */
|
||||
.btn-primary-custom {
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.btn-primary-custom:hover {
|
||||
background-color: #2563EB;
|
||||
}
|
||||
|
||||
.login-card .form-footer {
|
||||
margin-top: 1.5rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.login-card .form-footer a {
|
||||
color: var(--light-gray);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.login-card .form-footer a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
242
index.php
242
index.php
@ -1,150 +1,110 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
session_start();
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
// If user is already logged in, redirect to their dashboard
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
if ($_SESSION['user_role'] === 'staff') {
|
||||
header("Location: staff_dashboard.php");
|
||||
} else {
|
||||
header("Location: resident_dashboard.php");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/db/config.php';
|
||||
|
||||
$error_message = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (empty($_POST['email']) || empty($_POST['password'])) {
|
||||
$error_message = 'Please enter both email and password.';
|
||||
} else {
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
|
||||
$stmt->execute([$_POST['email']]);
|
||||
$user = $stmt->fetch();
|
||||
|
||||
if ($user && password_verify($_POST['password'], $user['password'])) {
|
||||
// Password is correct, start session
|
||||
$_SESSION['user_id'] = $user['id'];
|
||||
$_SESSION['user_email'] = $user['email'];
|
||||
$_SESSION['user_role'] = $user['role'];
|
||||
|
||||
// Redirect to the appropriate dashboard
|
||||
if ($user['role'] === 'staff') {
|
||||
header("Location: staff_dashboard.php");
|
||||
} else {
|
||||
header("Location: resident_dashboard.php");
|
||||
}
|
||||
exit;
|
||||
} else {
|
||||
$error_message = 'Invalid email or password.';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$error_message = 'Database error. Please try again later.';
|
||||
// In a real app, you would log this error
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<?php endif; ?>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loader {
|
||||
margin: 1.25rem auto 1.25rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Login - Continuum of Healing</title>
|
||||
<meta name="description" content="Login to the Continuum of Healing platform.">
|
||||
|
||||
<!-- Open Graph / Facebook -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="Login - Continuum of Healing">
|
||||
<meta property="og:description" content="Login to the Continuum of Healing platform.">
|
||||
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta property="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:title" content="Login - Continuum of Healing">
|
||||
<meta property="twitter:description" content="Login to the Continuum of Healing platform.">
|
||||
<meta property="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
</div>
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
<body class="login-page">
|
||||
|
||||
<div class="login-container">
|
||||
<div class="login-card">
|
||||
<h1>Sign In</h1>
|
||||
<p class="subtitle">Welcome to the Continuum of Healing™</p>
|
||||
|
||||
<?php if ($error_message): ?>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<?php echo htmlspecialchars($error_message); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST" action="index.php">
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control" id="email" name="email" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-block btn-primary-custom">Sign In</button>
|
||||
</form>
|
||||
<div class="form-footer">
|
||||
<a href="index.php">← Back to Home</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-text">
|
||||
© <?php echo date("Y"); ?> Continuum of Healing. Built with Flatlogic.
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
7
logout.php
Normal file
7
logout.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_unset();
|
||||
session_destroy();
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
?>
|
||||
94
resident_dashboard.php
Normal file
94
resident_dashboard.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
// Check if user is logged in and has the 'resident' role
|
||||
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'resident') {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Fetch the logged-in resident's data
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT * FROM residents WHERE user_id = ?");
|
||||
$stmt->execute([$_SESSION['user_id']]);
|
||||
$resident = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// If no resident profile is linked to this user account, show a message.
|
||||
if (!$resident) {
|
||||
$no_profile_message = "Your profile is not yet linked. Please contact support.";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
$error_message = "Error fetching your data.";
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Resident Dashboard | Continuum of Healing</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">Continuum of Healing</a>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="resident_dashboard.php">Dashboard</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<span class="navbar-text me-3">
|
||||
Logged in as: <?php echo htmlspecialchars($_SESSION['user_email']); ?>
|
||||
</span>
|
||||
<a href="logout.php" class="btn btn-outline-danger">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<?php if (isset($resident) && $resident): ?>
|
||||
<h1 class="h2">Welcome, <?php echo htmlspecialchars($resident['first_name']); ?>!</h1>
|
||||
<?php else: ?>
|
||||
<h1 class="h2">Welcome, Resident!</h1>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (isset($error_message)): ?>
|
||||
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
||||
<?php elseif (isset($no_profile_message)): ?>
|
||||
<div class="alert alert-warning"><?php echo $no_profile_message; ?></div>
|
||||
<?php elseif (isset($resident)): ?>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Your Progress
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p><strong>Name:</strong> <?php echo htmlspecialchars($resident['first_name'] . ' ' . $resident['last_name']); ?></p>
|
||||
<p><strong>Program:</strong> <?php echo htmlspecialchars($resident['program']); ?></p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p><strong>Status:</strong> <span class="badge bg-success"><?php echo htmlspecialchars($resident['status']); ?></span></p>
|
||||
<p><strong>Last Check-in:</strong> <?php echo htmlspecialchars(date("M j, Y, g:i a", strtotime($resident['last_check_in']))); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
98
resident_view.php
Normal file
98
resident_view.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
// Check if user is logged in and has the 'staff' role
|
||||
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'staff') {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get resident ID from URL
|
||||
$resident_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
|
||||
if ($resident_id === 0) {
|
||||
header("Location: staff_dashboard.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Fetch resident details from the database
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT * FROM residents WHERE id = ?");
|
||||
$stmt->execute([$resident_id]);
|
||||
$resident = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$resident) {
|
||||
// No resident found, redirect
|
||||
header("Location: staff_dashboard.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
$error_message = "Error fetching resident data.";
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>View Resident | Continuum of Healing</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="staff_dashboard.php">Continuum of Healing</a>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="staff_dashboard.php">Dashboard</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<span class="navbar-text me-3">
|
||||
Logged in as: <?php echo htmlspecialchars($_SESSION['user_email']); ?>
|
||||
</span>
|
||||
<a href="logout.php" class="btn btn-outline-danger">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="h2">Resident Details</h1>
|
||||
<a href="staff_dashboard.php" class="btn btn-light">« Back to Dashboard</a>
|
||||
</div>
|
||||
|
||||
<?php if (isset($error_message)): ?>
|
||||
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
||||
<?php elseif (isset($resident)): ?>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Viewing <?php echo htmlspecialchars($resident['first_name'] . ' ' . $resident['last_name']); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p><strong>Name:</strong> <?php echo htmlspecialchars($resident['first_name'] . ' ' . $resident['last_name']); ?></p>
|
||||
<p><strong>Program:</strong> <?php echo htmlspecialchars($resident['program']); ?></p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p><strong>Status:</strong> <span class="badge bg-primary"><?php echo htmlspecialchars($resident['status']); ?></span></p>
|
||||
<p><strong>Last Check-in:</strong> <?php echo htmlspecialchars(date("M j, Y, g:i a", strtotime($resident['last_check_in']))); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
106
staff_dashboard.php
Normal file
106
staff_dashboard.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
// Check if user is logged in and has the 'staff' role
|
||||
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'staff') {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Fetch residents from the database
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->query("SELECT id, first_name, last_name, status, program FROM residents ORDER BY last_name, first_name");
|
||||
$residents = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
// Handle DB error - for now, just show a simple message
|
||||
$error_message = "Error fetching resident data.";
|
||||
// In a real app, you'd log this error.
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Staff Dashboard | Continuum of Healing</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">Continuum of Healing</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="staff_dashboard.php">Dashboard</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<span class="navbar-text me-3">
|
||||
Logged in as: <?php echo htmlspecialchars($_SESSION['user_email']); ?>
|
||||
</span>
|
||||
<a href="logout.php" class="btn btn-outline-danger">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="h2">Continuum Control Center</h1>
|
||||
</div>
|
||||
|
||||
<?php if (isset($error_message)): ?>
|
||||
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
All Residents
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Program</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($residents) && !empty($residents)): ?>
|
||||
<?php foreach ($residents as $resident): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($resident['first_name'] . ' ' . $resident['last_name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($resident['program']); ?></td>
|
||||
<td><span class="badge bg-primary"><?php echo htmlspecialchars($resident['status']); ?></span></td>
|
||||
<td>
|
||||
<a href="resident_view.php?id=<?php echo $resident['id']; ?>" class="btn btn-sm btn-outline-primary">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">No residents found.</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user