diff --git a/create_action_plan.php b/create_action_plan.php index 4dc266a..4a44cfd 100644 --- a/create_action_plan.php +++ b/create_action_plan.php @@ -1,117 +1,73 @@ $i, 'name' => "Resident #$i"]; } -$resident_id = isset($_GET['resident_id']) ? (int)$_GET['resident_id'] : 0; -if ($resident_id === 0) { - header("Location: staff_dashboard.php"); - exit; -} +$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.' +]; -$pdo = db(); - -// Fetch resident details to display on the page -$stmt = $pdo->prepare("SELECT first_name, last_name FROM residents WHERE id = ?"); -$stmt->execute([$resident_id]); -$resident = $stmt->fetch(PDO::FETCH_ASSOC); - -if (!$resident) { - header("Location: staff_dashboard.php"); - exit; -} - -$error_message = ''; $success_message = ''; - -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - if (empty($_POST['title'])) { - $error_message = 'Please provide a title for the action plan.'; - } else { - try { - $stmt = $pdo->prepare("INSERT INTO action_plans (resident_id, staff_id, title, description, status, due_date) VALUES (?, ?, ?, ?, ?, ?)"); - $stmt->execute([ - $resident_id, - $_SESSION['user_id'], - $_POST['title'], - $_POST['description'] ?? null, - $_POST['status'] ?? 'In Progress', - !empty($_POST['due_date']) ? $_POST['due_date'] : null - ]); - header("Location: resident_view.php?id=" . $resident_id . "&success=1"); - exit; - } catch (PDOException $e) { - $error_message = 'Database error: Could not create action plan. ' . $e->getMessage(); - } - } +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) . "."; } + ?> - - -
- - -Creating plan for:
- - - - - -