83 lines
3.2 KiB
PHP
83 lines
3.2 KiB
PHP
<?php
|
|
session_start();
|
|
require_once 'db/config.php';
|
|
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'staff') {
|
|
header("Location: index.php");
|
|
exit;
|
|
}
|
|
|
|
$resident_id = isset($_GET['resident_id']) ? (int)$_GET['resident_id'] : 0;
|
|
if ($resident_id === 0) {
|
|
header("Location: staff_dashboard.php");
|
|
exit;
|
|
}
|
|
|
|
$pdo = db();
|
|
|
|
// Fetch resident details
|
|
$stmt = $pdo->prepare("SELECT * FROM residents WHERE id = ?");
|
|
$stmt->execute([$resident_id]);
|
|
$resident = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!$resident) {
|
|
header("Location: staff_dashboard.php");
|
|
exit;
|
|
}
|
|
|
|
// Fetch partners for the dropdown
|
|
$stmt = $pdo->query("SELECT id, name FROM partners ORDER BY name");
|
|
$partners = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>New Referral - Continuum Nexus</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-dark bg-dark">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="staff_dashboard.php">Continuum Nexus</a>
|
|
<a href="logout.php" class="btn btn-outline-light">Logout</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="container mt-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h2">New Referral for <?php echo htmlspecialchars($resident['first_name'] . ' ' . $resident['last_name']); ?></h1>
|
|
<a href="resident_view.php?id=<?php echo $resident_id; ?>" class="btn btn-secondary">← Back to Resident</a>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<form action="submit_referral.php" method="POST">
|
|
<input type="hidden" name="resident_id" value="<?php echo $resident_id; ?>">
|
|
<input type="hidden" name="staff_id" value="<?php echo $_SESSION['user_id']; ?>">
|
|
<div class="mb-3">
|
|
<label for="partner_id" class="form-label">Refer to Partner</label>
|
|
<select name="partner_id" id="partner_id" class="form-select" required>
|
|
<option value="">Select a partner...</option>
|
|
<?php foreach ($partners as $partner): ?>
|
|
<option value="<?php echo $partner['id']; ?>"><?php echo htmlspecialchars($partner['name']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="notes" class="form-label">Referral Notes</label>
|
|
<textarea name="notes" id="notes" class="form-control" rows="5" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary-custom">Submit Referral</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|