74 lines
3.3 KiB
PHP
74 lines
3.3 KiB
PHP
<?php
|
|
include 'includes/staff_header.php';
|
|
require_once 'db/config.php';
|
|
|
|
// --- Sample Data Generation ---
|
|
$residents = [];
|
|
for ($i = 1; $i <= 20; $i++) {
|
|
$residents[] = ['id' => $i, 'name' => "Resident #$i"];
|
|
}
|
|
|
|
$domains = [
|
|
'Economic Stability' => 'Enroll in financial literacy workshop and open a savings account.',
|
|
'Education' => 'Complete high school equivalency diploma and apply for vocational training.',
|
|
'Health and Healthcare' => 'Schedule annual physical and attend a nutrition seminar.',
|
|
'Neighborhood and Environment' => 'Report local safety concerns and join a community garden.',
|
|
'Social and Community Context' => 'Join a local support group and volunteer for a community event.'
|
|
];
|
|
|
|
$success_message = '';
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['resident_id'])) {
|
|
$resident_id = $_POST['resident_id'];
|
|
// In a real application, you would save this data to the database.
|
|
// For now, we just show a success message.
|
|
$resident_name = $residents[$resident_id - 1]['name'];
|
|
$success_message = "Successfully generated a new action plan for " . htmlspecialchars($resident_name) . ".";
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="container mt-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h2">Generate New Action Plan</h1>
|
|
<a href="staff_dashboard.php" class="btn btn-secondary"><i class="fas fa-arrow-left me-2"></i>Back to Dashboard</a>
|
|
</div>
|
|
|
|
<?php if ($success_message): ?>
|
|
<div class="alert alert-success">
|
|
<?php echo $success_message; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="card-body">
|
|
<form action="create_action_plan.php" method="POST">
|
|
<div class="mb-3">
|
|
<label for="resident_id" class="form-label">Select Resident</label>
|
|
<select class="form-select" id="resident_id" name="resident_id" required>
|
|
<option value="" disabled selected>Choose a resident...</option>
|
|
<?php foreach ($residents as $resident): ?>
|
|
<option value="<?php echo $resident['id']; ?>"><?php echo htmlspecialchars($resident['name']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<h5 class="mt-4">Action Plan Details (Prefilled Sample)</h5>
|
|
<p class="text-muted">These are pre-filled suggestions. In the future, this content will be AI-generated based on the resident's specific needs.</p>
|
|
|
|
<?php foreach ($domains as $domain => $plan): ?>
|
|
<div class="mb-3">
|
|
<label for="plan_<?php echo str_replace(' ', '_', $domain); ?>" class="form-label fw-bold"><?php echo $domain; ?></label>
|
|
<textarea class="form-control" id="plan_<?php echo str_replace(' ', '_', $domain); ?>" name="plans[<?php echo $domain; ?>]" rows="3"><?php echo htmlspecialchars($plan); ?></textarea>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
|
|
<div class="mt-4 text-end">
|
|
<button type="submit" class="btn btn-primary btn-lg">Generate and Save Plan</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include 'includes/footer.php'; // Assuming a footer file exists ?>
|