diff --git a/admin/.DS_Store b/admin/.DS_Store new file mode 100644 index 0000000..291f656 Binary files /dev/null and b/admin/.DS_Store differ diff --git a/admin/admin_dashboard.php b/admin/admin_dashboard.php new file mode 100644 index 0000000..18eb110 --- /dev/null +++ b/admin/admin_dashboard.php @@ -0,0 +1,171 @@ +prepare("SELECT COUNT(*) FROM patients"); + $stmt->execute(); + return $stmt->fetchColumn(); +} + +// Function to get the total number of caregivers +function getTotalCaregivers() { + global $pdo; + $stmt = $pdo->prepare("SELECT COUNT(*) FROM caregivers"); + $stmt->execute(); + return $stmt->fetchColumn(); +} + +// Function to get the total number of appointments +function getTotalAppointments() { + global $pdo; + $stmt = $pdo->prepare("SELECT COUNT(*) FROM appointments"); + $stmt->execute(); + return $stmt->fetchColumn(); +} + +// Function to get the number of upcoming appointments (within the next 7 days) +function getUpcomingAppointments() { + global $pdo; + $stmt = $pdo->prepare("SELECT COUNT(*) FROM appointments WHERE appointment_date >= CURDATE() AND appointment_date <= DATE_ADD(CURDATE(), INTERVAL 7 DAY)"); + $stmt->execute(); + return $stmt->fetchColumn(); +} + +// Function to fetch available caregivers +function getAvailableCaregivers() { + global $pdo; + $stmt = $pdo->prepare(" + SELECT c.name + FROM caregivers c + WHERE c.id NOT IN (SELECT caregiver_id FROM caregiver_assignments) + "); + $stmt->execute(); + return $stmt->fetchAll(PDO::FETCH_ASSOC); +} + +// Get statistics +$totalPatients = getTotalPatients(); +$totalCaregivers = getTotalCaregivers(); +$totalAppointments = getTotalAppointments(); +$upcomingAppointments = getUpcomingAppointments(); +$availableCaregivers = getAvailableCaregivers(); // Fetch available caregivers +?> + + + +
+ + + + +This is the dashboard. Here you can monitor and manage various aspects of the healthcare system.
+ + +The total number of registered patients in the system.
+The total number of caregivers available to patients.
+The total number of appointments scheduled in the system.
+Appointments scheduled within the next 7 days.
+| Caregiver Name | +Ongoing Assignments | +Details of Assignments | +
|---|---|---|
| + | + | + |
| Caregiver | +Appointment Date | +Status | +
|---|---|---|
| + | + | + |
Email:
+Address:
+Date of Birth:
+-
+ +No upcoming appointments.
+ +
+
+