69 lines
2.8 KiB
PHP
69 lines
2.8 KiB
PHP
<?php
|
|
session_start();
|
|
require_once 'db/config.php';
|
|
|
|
if (!isset($_SESSION['user_id']) || !in_array($_SESSION['user_role'], ['partner', 'staff'])) {
|
|
header("Location: index.php");
|
|
exit;
|
|
}
|
|
|
|
$pdo = db();
|
|
|
|
// Fetch staff users to populate the 'To' dropdown
|
|
$stmt = $pdo->query("SELECT id, email FROM users WHERE role = 'staff' ORDER BY email");
|
|
$staff_users = $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>Compose Message - 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="#">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">Compose New Message</h1>
|
|
<a href="partner_dashboard.php" class="btn btn-secondary">← Back to Dashboard</a>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<form action="send_message.php" method="POST">
|
|
<div class="mb-3">
|
|
<label for="recipient" class="form-label">To</label>
|
|
<select name="recipient_user_id" id="recipient" class="form-select" required>
|
|
<option value="">Select a staff member...</option>
|
|
<?php foreach ($staff_users as $staff): ?>
|
|
<option value="<?php echo $staff['id']; ?>"><?php echo htmlspecialchars($staff['email']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="subject" class="form-label">Subject</label>
|
|
<input type="text" name="subject" id="subject" class="form-control" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="body" class="form-label">Message</label>
|
|
<textarea name="body" id="body" class="form-control" rows="8" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary-custom">Send Message</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>
|