Respan Dataset Explorer

Select one behavior. Every returned turn has one binary label: Present or Absent. Source: final dense boolean release.

5,167,182physical rows
86shards
0.00%qualified row coverage
0.00%qualified cell coverage
Random row JSON API

turns-00035.parquet:43376

966275b29e69861fafa79c8a
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia168 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: Does not know that you can have a decimal percentage
ASSISTANT
Misconception: Believing that percentages can only be whole numbers and not understanding that percentages can also be expressed as decimal values. 

To clarify, a percentage represents a part of a whole and is usually shown with the '%' symbol. While we often use whole numbers like 25% or 50%, it's important to recognize that percentages can also be expressed in decimal form. For instance, 25% can be written as 0.25, and 12.5% can be expressed as 0.125. This means that you can have percentages that are not whole numbers, allowing for more precise measurements and calculations. Understanding this concept is crucial for accurately interpreting data and performing calculations involving percentages.

turns-00035.parquet:43377

7e5fc462b046b1c18faaa566
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia189 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: believes the complement of a set consists of elements which only belong to one set
ASSISTANT
The misconception suggests that the complement of a set includes only the elements that belong to one specific set. However, a more accurate understanding is that the complement of a set A, often denoted as A', refers to all the elements in the universal set U that are not in set A. The universal set encompasses all possible elements under consideration for a particular discussion or problem. Therefore, when we talk about the complement of set A, we are identifying every element from the universal set that does not belong to A, not just those from another single set. This distinction is crucial, as it emphasizes that the complement takes into account all elements outside of A, rather than only focusing on elements from another set.

turns-00035.parquet:43378

2794ece43e4bb8da3e2b9d6e
turn 1/1o1-mini-2024-09-12EnglishEgypt7034 words
degenerate_repetitionAbsentFinal dense release
USER
in this codes (<?php
// Include the header
include 'includes/header.php';

// The main content starts here

// Initialize filter variables
$search = $_GET['search'] ?? '';
$gender = $_GET['gender'] ?? '';
$min_age = $_GET['min_age'] ?? '';
$max_age = $_GET['max_age'] ?? '';
$status = $_GET['status'] ?? '';
$sort_by = $_GET['sort_by'] ?? 'id'; // Default sort by ID

// Build the SQL query with filters
$sql = "
    SELECT p.*, pl.username,
           hr.blood_pressure, hr.weight, hr.bmi, hr.cholesterol, 
           hr.prescription, hr.treatment_progress, hr.record_date
    FROM patients p
    LEFT JOIN patient_logins pl ON p.id = pl.patient_id
    LEFT JOIN (
        SELECT patient_id, blood_pressure, weight, bmi, cholesterol, 
               prescription, treatment_progress, record_date,
               ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY record_date DESC) as rn
        FROM health_records
    ) hr ON p.id = hr.patient_id AND hr.rn = 1
    WHERE 1=1
";

$params = [];

if ($search) {
    $sql .= " AND (p.name LIKE ? OR pl.username LIKE ? OR p.id LIKE ? OR p.phone LIKE ? OR p.email LIKE ?)";
    $search_param = "%$search%";
    $params = array_merge($params, [$search_param, $search_param, $search_param, $search_param, $search_param]);
}

if ($gender) {
    $sql .= " AND p.gender = ?";
    $params[] = $gender;
}

if ($min_age) {
    $sql .= " AND p.age >= ?";
    $params[] = $min_age;
}

if ($max_age) {
    $sql .= " AND p.age <= ?";
    $params[] = $max_age;
}

if ($status) {
    $sql .= " AND p.status = ?";
    $params[] = $status;
}

// Note: Sorting will be handled client-side by DataTables

$stmt = $pdo->prepare($sql);
$stmt->execute($params);
$patients = $stmt->fetchAll(PDO::FETCH_ASSOC);

// Get all possible status options
$status_options = [
    'Initial Consultation', 'Diagnostic Phase', 'Treatment in Progress', 'Improving',
    'Monitoring', 'Maintenance Phase', 'Awaiting Test Results', 'Follow-up Needed',
    'Paused', 'Completed Program', 'Relapsed', 'Discontinued', 'Inactive'
];

// Fetch Data Analysis Data
// Fetch total number of patients
$stmt = $pdo->query("SELECT COUNT(*) FROM patients");
$total_patients = $stmt->fetchColumn();
// Fetch recent registrations (last 30 days)
$stmt = $pdo->query("SELECT COUNT(*) FROM patients WHERE registration_date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)");
$recent_registrations = $stmt->fetchColumn();
// Fetch recent registrations (today)
$stmt = $pdo->query("SELECT COUNT(*) FROM patients WHERE DATE(registration_datetime) = CURDATE()");
$today_registrations = $stmt->fetchColumn();
// Fetch total number of invoices
$stmt = $pdo->query("SELECT COUNT(*) FROM invoices");
$total_invoices = $stmt->fetchColumn();
// Fetch gender distribution
$stmt = $pdo->query("SELECT gender, COUNT(*) as count FROM patients GROUP BY gender");
$gender_distribution = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Fetch age distribution
$stmt = $pdo->query("
    SELECT 
        CASE 
            WHEN age < 18 THEN 'Under 18'
            WHEN age BETWEEN 18 AND 30 THEN '18-30'
            WHEN age BETWEEN 31 AND 50 THEN '31-50'
            WHEN age BETWEEN 51 AND 70 THEN '51-70'
            ELSE 'Over 70'
        END AS age_group,
        COUNT(*) as count
    FROM patients
    GROUP BY age_group
");
$age_distribution = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Fetch status distribution
$stmt = $pdo->query("SELECT status, COUNT(*) as count FROM patients GROUP BY status");
$status_distribution = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>

<div class="container-fluid">

    <!-- Dashboard content here -->
    <!-- Data Analysis Section -->
    <h2 class="mb-3">Data Analysis</h2>
    <div class="row g-3">
        <!-- Total Patients -->
        <div class="col-lg-3 col-md-6">
            <div class="card h-100 text-center">
                <div class="card-body">
                    <h5 class="card-title">Total Patients</h5>
                    <p class="card-text fs-4"><?= $total_patients ?></p>
                </div>
            </div>
        </div>
        <!-- Recent Registrations (30 days) -->
        <div class="col-lg-3 col-md-6">
            <div class="card h-100 text-center">
                <div class="card-body">
                    <h5 class="card-title">Recent Registrations (30 days)</h5>
                    <p class="card-text fs-4"><?= $recent_registrations ?></p>
                </div>
            </div>
        </div>
        <!-- Registrations Today -->
        <div class="col-lg-3 col-md-6">
            <div class="card h-100 text-center">
                <div class="card-body">
                    <h5 class="card-title">Registrations Today</h5>
                    <p class="card-text fs-4"><?= $today_registrations ?></p>
                </div>
            </div>
        </div>
        <!-- Total Invoices -->
        <div class="col-lg-3 col-md-6">
            <div class="card h-100 text-center">
                <div class="card-body">
                    <h5 class="card-title">Total Invoices</h5>
                    <p class="card-text fs-4"><?= $total_invoices ?></p>
                </div>
            </div>
        </div>
    </div>

    <!-- Charts Section -->
    <div class="row g-3 mt-3">
        <!-- Gender Distribution Chart -->
        <div class="col-lg-4 col-md-6">
            <div class="card h-100">
                <div class="card-body">
                    <canvas id="genderChart"></canvas>
                </div>
            </div>
        </div>
        <!-- Age Distribution Chart -->
        <div class="col-lg-4 col-md-6">
            <div class="card h-100">
                <div class="card-body">
                    <canvas id="ageChart"></canvas>
                </div>
            </div>
        </div>
        <!-- Status Distribution Chart -->
        <div class="col-lg-4 col-md-12">
            <div class="card h-100">
                <div class="card-body">
                    <canvas id="statusChart"></canvas>
                </div>
            </div>
        </div>
    </div>

    <!-- Patient List Section -->
    <h2 class="mt-5">Patient List</h2>

    <!-- Filters -->
    <div class="filters">
        <form action="" method="GET" class="row">
            <!-- Filter form can go here if needed -->
        </form>
    </div>

    <!-- Patient Table -->
    <div class="table-responsive">
        <table id="patientTable" class="table table-bordered table-striped mt-3">
            <thead>
                <tr>
                    <th>Patient ID</th>
                    <th>Name</th>
                    <th>Username</th>
                    <th>Age</th>
                    <th>Gender</th>
                    <th>Phone</th>
                    <th>Email</th>
                    <th>Address</th>
                    <th>Registration Date</th>
                    <th>Has Invoice</th>
                    <th>Status</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($patients as $patient): ?>
                <tr>
                    <td><?= $patient['id'] ?></td>
                    <td><?= htmlspecialchars($patient['name']) ?></td>
                    <td><?= htmlspecialchars($patient['username']) ?></td>
                    <td><?= $patient['age'] ?></td>
                    <td><?= $patient['gender'] ?></td>
                    <td><?= htmlspecialchars($patient['phone']) ?></td>
                    <td><?= htmlspecialchars($patient['email']) ?></td>
                    <td><?= htmlspecialchars($patient['address']) ?></td>
                    <td><?= $patient['registration_date'] ?></td>
                    <td>
                        <?php
                        // Query to check if the patient has any invoices
                        $has_invoice_query = "SELECT COUNT(*) AS invoice_count FROM invoices WHERE patient_id = ?";
                        $stmt_invoice = $pdo->prepare($has_invoice_query);
                        $stmt_invoice->execute([$patient['id']]);
                        $invoice_result = $stmt_invoice->fetch();

                        if ($invoice_result['invoice_count'] > 0): ?>
                            <span class="text-success font-weight-bold">Yes</span>
                        <?php else: ?>
                            <span class="text-danger font-weight-bold">No</span>
                        <?php endif; ?>
                    </td>
                    <td>
                        <form method="POST" action="update_patient_status.php">
                            <input type="hidden" name="patient_id" value="<?= $patient['id'] ?>">
                            <select name="status" onchange="this.form.submit()" class="form-control form-control-sm">
                                <?php foreach ($status_options as $option): ?>
                                    <option value="<?= htmlspecialchars($option) ?>" <?= $patient['status'] == $option ? 'selected' : '' ?>><?= htmlspecialchars($option) ?></option>
                                <?php endforeach; ?>
                            </select>
                        </form>
                    </td>
                    <td>
                        <div class="btn-group" role="group">
                            <a href="view_patient.php?id=<?= $patient['id'] ?>" class="btn btn-info btn-sm">View</a>
                            <a href="edit_patient.php?id=<?= $patient['id'] ?>" class="btn btn-warning btn-sm">Edit</a>
                            <a href="delete_patient.php?id=<?= $patient['id'] ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this patient?')">Delete</a>
                        </div>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>

</div>

<!-- Include Chart Scripts Here -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
    // Gender Distribution Chart
    var genderCtx = document.getElementById('genderChart').getContext('2d');
    var genderChart = new Chart(genderCtx, {
        type: 'pie',
        data: {
            labels: <?= json_encode(array_column($gender_distribution, 'gender')) ?>,
            datasets: [{
                data: <?= json_encode(array_column($gender_distribution, 'count')) ?>,
                backgroundColor: ['#4F3F02', '#D1C287', '#FFCE56']
            }]
        },
        options: {
            responsive: true,
            maintainAspectRatio: false,
            plugins: {
                title: {
                    display: true,
                    text: 'Gender Distribution'
                }
            }
        }
    });

    // Age Distribution Chart
    var ageCtx = document.getElementById('ageChart').getContext('2d');
    var ageChart = new Chart(ageCtx, {
        type: 'bar',
        data: {
            labels: <?= json_encode(array_column($age_distribution, 'age_group')) ?>,
            datasets: [{
                label: 'Number of Patients',
                data: <?= json_encode(array_column($age_distribution, 'count')) ?>,
                backgroundColor: '#D1C287'
            }]
        },
        options: {
            responsive: true,
            maintainAspectRatio: false,
            plugins: {
                title: {
                    display: true,
                    text: 'Age Distribution'
                }
            },
            scales: {
                y: {
                    beginAtZero: true
                }
            }
        }
    });

    // Status Distribution Chart
    var statusCtx = document.getElementById('statusChart').getContext('2d');
    var statusChart = new Chart(statusCtx, {
        type: 'doughnut',
        data: {
            labels: <?= json_encode(array_column($status_distribution, 'status')) ?>,
            datasets: [{
                data: <?= json_encode(array_column($status_distribution, 'count')) ?>,
                backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF', '#FF9F40', '#C9CBCF', '#8D6E63', '#7986CB', '#81C784', '#DCE775', '#FFB74D', '#BA68C8']
            }]
        },
        options: {
            responsive: true,
            maintainAspectRatio: false,
            plugins: {
                title: {
                    display: true,
                    text: 'Status Distribution'
                }
            }
        }
    });
</script>

<?php
// Include the footer
include 'includes/footer.php';
?>) fix it and make it cool design and i want you to take id from patients table only in table, and don't talk any id on other tables in database and this info of database (-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Oct 19, 2024 at 08:09 AM
-- Server version: 10.11.9-MariaDB
-- PHP Version: 7.2.34

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `u406552082_info`
--

-- --------------------------------------------------------

--
-- Table structure for table `admins`
--

CREATE TABLE `admins` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `appointments`
--

CREATE TABLE `appointments` (
  `id` int(11) NOT NULL,
  `package_id` int(11) NOT NULL,
  `appointment_date` datetime NOT NULL,
  `proposed_appointment_date` datetime DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `age` int(3) DEFAULT NULL,
  `gender` enum('Male','Female','Other') DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `preferred_contact_method` enum('Email','Phone','WhatsApp') DEFAULT NULL,
  `additional_notes` text DEFAULT NULL,
  `admin_notes` text DEFAULT NULL,
  `status` enum('Pending','Confirmed','Completed','Cancelled') DEFAULT 'Pending',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `patient_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `budgets`
--

CREATE TABLE `budgets` (
  `id` int(11) NOT NULL,
  `month` varchar(7) DEFAULT NULL,
  `budgeted_revenue` decimal(10,2) DEFAULT NULL,
  `budgeted_expenses` decimal(10,2) DEFAULT NULL,
  `notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `comments`
--

CREATE TABLE `comments` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `sender` enum('patient','doctor','admin') NOT NULL,
  `message` text NOT NULL,
  `timestamp` datetime DEFAULT current_timestamp(),
  `parent_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `doctors`
--

CREATE TABLE `doctors` (
  `id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `specialization` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `registration_date` date DEFAULT curdate(),
  `profile_picture` varchar(255) DEFAULT NULL,
  `department` varchar(100) DEFAULT NULL,
  `date_of_joining` date DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `doctor_patient`
--

CREATE TABLE `doctor_patient` (
  `id` int(11) NOT NULL,
  `doctor_id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `employees`
--

CREATE TABLE `employees` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `role` enum('admin','doctor','staff','accountant') NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `department` varchar(100) DEFAULT NULL,
  `date_of_joining` date DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `username` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `profile_picture` varchar(255) DEFAULT NULL,
  `specialization` varchar(255) DEFAULT NULL,
  `is_online` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` int(11) NOT NULL,
  `expense_date` date NOT NULL,
  `category` varchar(100) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `health_records`
--

CREATE TABLE `health_records` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `blood_pressure` varchar(20) DEFAULT NULL,
  `weight` decimal(5,2) DEFAULT NULL,
  `bmi` decimal(4,2) DEFAULT NULL,
  `cholesterol` decimal(5,2) DEFAULT NULL,
  `prescription` text DEFAULT NULL,
  `treatment_progress` text DEFAULT NULL,
  `record_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `insurance_claims`
--

CREATE TABLE `insurance_claims` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `claim_amount` decimal(10,2) DEFAULT NULL,
  `status` enum('Pending','Approved','Rejected') DEFAULT NULL,
  `submission_date` date DEFAULT NULL,
  `processing_date` date DEFAULT NULL,
  `notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `service_name` varchar(255) NOT NULL,
  `service_description` text DEFAULT NULL,
  `cost` decimal(10,2) NOT NULL,
  `tax_rate` decimal(5,2) DEFAULT 0.00,
  `discount` decimal(5,2) DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `invoice_date` date DEFAULT curdate(),
  `due_date` date DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `tax` decimal(5,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `invoice_services`
--

CREATE TABLE `invoice_services` (
  `id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `service_id` int(11) NOT NULL,
  `service_name` varchar(255) NOT NULL,
  `cost` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `packages`
--

CREATE TABLE `packages` (
  `id` int(11) NOT NULL,
  `package_name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `details` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patients`
--

CREATE TABLE `patients` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `age` int(3) DEFAULT NULL,
  `gender` enum('Male','Female','Other') DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `medical_history` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `date_of_birth` date DEFAULT NULL,
  `registration_datetime` datetime DEFAULT current_timestamp(),
  `registration_date` date DEFAULT NULL,
  `status` enum('Initial Consultation','Diagnostic Phase','Treatment in Progress','Improving','Monitoring','Maintenance Phase','Awaiting Test Results','Follow-up Needed','Paused','Completed Program','Relapsed','Discontinued','Inactive') DEFAULT 'Initial Consultation',
  `doctor_id` int(11) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patient_basic_info`
--

CREATE TABLE `patient_basic_info` (
  `patient_id` int(11) NOT NULL,
  `gender` enum('Male','Female','Other') NOT NULL,
  `age` int(3) NOT NULL,
  `weight` decimal(5,2) NOT NULL,
  `height` decimal(5,2) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patient_consent`
--

CREATE TABLE `patient_consent` (
  `patient_id` int(11) NOT NULL,
  `consent` enum('accepted','declined') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patient_consultation`
--

CREATE TABLE `patient_consultation` (
  `patient_id` int(11) NOT NULL,
  `scheduled_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patient_goals`
--

CREATE TABLE `patient_goals` (
  `patient_id` int(11) NOT NULL,
  `primary_health_goals` text NOT NULL,
  `health_concerns` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patient_health_metrics`
--

CREATE TABLE `patient_health_metrics` (
  `patient_id` int(11) NOT NULL,
  `exercise_frequency` enum('Daily','Weekly','Rarely','Never') NOT NULL,
  `diet` enum('Yes','No') NOT NULL,
  `diet_specify` varchar(255) DEFAULT NULL,
  `sleep_average` enum('<5 Hours','5-7 Hours','7-9 Hours','>9 Hours') NOT NULL,
  `smoking_status` enum('Yes','No','Occasionally') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patient_logins`
--

CREATE TABLE `patient_logins` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patient_medical_history`
--

CREATE TABLE `patient_medical_history` (
  `patient_id` int(11) NOT NULL,
  `chronic_conditions` enum('Yes','No') NOT NULL,
  `chronic_conditions_specify` varchar(255) DEFAULT NULL,
  `medications` enum('Yes','No') NOT NULL,
  `medications_list` text DEFAULT NULL,
  `major_surgeries` enum('Yes','No') NOT NULL,
  `major_surgeries_specify` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `amount_paid` decimal(10,2) NOT NULL,
  `payment_date` date NOT NULL,
  `payment_method` varchar(50) DEFAULT NULL,
  `notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `prescriptions`
--

CREATE TABLE `prescriptions` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `doctor_id` int(11) DEFAULT NULL,
  `medications` text NOT NULL,
  `instructions` text DEFAULT NULL,
  `date_prescribed` datetime DEFAULT current_timestamp(),
  `status` enum('active','inactive') DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `questionnaire_responses`
--

CREATE TABLE `questionnaire_responses` (
  `id` int(11) NOT NULL,
  `session_id` varchar(255) NOT NULL,
  `page_number` int(2) NOT NULL,
  `question` varchar(255) NOT NULL,
  `answer` text NOT NULL,
  `submitted_at` timestamp NULL DEFAULT current_timestamp(),
  `consent` enum('Yes','No') DEFAULT 'No'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `salaries`
--

CREATE TABLE `salaries` (
  `id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `basic_salary` decimal(10,2) NOT NULL,
  `bonuses` decimal(10,2) DEFAULT 0.00,
  `deductions` decimal(10,2) DEFAULT 0.00,
  `overtime_hours` int(11) DEFAULT 0,
  `overtime_rate` decimal(10,2) DEFAULT 0.00,
  `tax` decimal(10,2) DEFAULT 0.00,
  `payment_date` date NOT NULL,
  `net_salary` decimal(10,2) NOT NULL,
  `status` enum('Pending','Paid') DEFAULT 'Pending',
  `notes` text DEFAULT NULL,
  `payslip_path` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `services`
--

CREATE TABLE `services` (
  `service_id` int(11) NOT NULL,
  `service_name` varchar(255) NOT NULL,
  `service_price` decimal(10,2) NOT NULL,
  `service_description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `appointments`
--
ALTER TABLE `appointments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `package_id` (`package_id`),
  ADD KEY `appointments_ibfk_2` (`patient_id`);

--
-- Indexes for table `budgets`
--
ALTER TABLE `budgets`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `doctors`
--
ALTER TABLE `doctors`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `employee_id` (`employee_id`);

--
-- Indexes for table `doctor_patient`
--
ALTER TABLE `doctor_patient`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `doctor_id` (`doctor_id`,`patient_id`),
  ADD KEY `fk_doctor_patient_patient_id` (`patient_id`);

--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `health_records`
--
ALTER TABLE `health_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `insurance_claims`
--
ALTER TABLE `insurance_claims`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`),
  ADD KEY `invoice_id` (`invoice_id`);

--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `invoice_services`
--
ALTER TABLE `invoice_services`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_id` (`invoice_id`),
  ADD KEY `service_id` (`service_id`);

--
-- Indexes for table `packages`
--
ALTER TABLE `packages`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `patients`
--
ALTER TABLE `patients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `doctor_id` (`doctor_id`);

--
-- Indexes for table `patient_basic_info`
--
ALTER TABLE `patient_basic_info`
  ADD PRIMARY KEY (`patient_id`);

--
-- Indexes for table `patient_consent`
--
ALTER TABLE `patient_consent`
  ADD PRIMARY KEY (`patient_id`);

--
-- Indexes for table `patient_consultation`
--
ALTER TABLE `patient_consultation`
  ADD PRIMARY KEY (`patient_id`);

--
-- Indexes for table `patient_goals`
--
ALTER TABLE `patient_goals`
  ADD PRIMARY KEY (`patient_id`);

--
-- Indexes for table `patient_health_metrics`
--
ALTER TABLE `patient_health_metrics`
  ADD PRIMARY KEY (`patient_id`);

--
-- Indexes for table `patient_logins`
--
ALTER TABLE `patient_logins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `patient_id` (`patient_id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `patient_medical_history`
--
ALTER TABLE `patient_medical_history`
  ADD PRIMARY KEY (`patient_id`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`),
  ADD KEY `invoice_id` (`invoice_id`);

--
-- Indexes for table `prescriptions`
--
ALTER TABLE `prescriptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`),
  ADD KEY `doctor_id` (`doctor_id`);

--
-- Indexes for table `questionnaire_responses`
--
ALTER TABLE `questionnaire_responses`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `salaries`
--
ALTER TABLE `salaries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_id` (`employee_id`);

--
-- Indexes for table `services`
--
ALTER TABLE `services`
  ADD PRIMARY KEY (`service_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `appointments`
--
ALTER TABLE `appointments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `budgets`
--
ALTER TABLE `budgets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doctors`
--
ALTER TABLE `doctors`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doctor_patient`
--
ALTER TABLE `doctor_patient`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `employees`
--
ALTER TABLE `employees`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `health_records`
--
ALTER TABLE `health_records`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `insurance_claims`
--
ALTER TABLE `insurance_claims`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `invoice_services`
--
ALTER TABLE `invoice_services`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `packages`
--
ALTER TABLE `packages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `patients`
--
ALTER TABLE `patients`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `patient_logins`
--
ALTER TABLE `patient_logins`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `prescriptions`
--
ALTER TABLE `prescriptions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `questionnaire_responses`
--
ALTER TABLE `questionnaire_responses`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `salaries`
--
ALTER TABLE `salaries`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `services`
--
ALTER TABLE `services`
  MODIFY `service_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `appointments`
--
ALTER TABLE `appointments`
  ADD CONSTRAINT `appointments_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `packages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `appointments_ibfk_2` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `comments`
--
ALTER TABLE `comments`
  ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`);

--
-- Constraints for table `doctors`
--
ALTER TABLE `doctors`
  ADD CONSTRAINT `doctors_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `doctor_patient`
--
ALTER TABLE `doctor_patient`
  ADD CONSTRAINT `doctor_patient_fk_doctor_id` FOREIGN KEY (`doctor_id`) REFERENCES `doctors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `doctor_patient_ibfk_2` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_doctor` FOREIGN KEY (`doctor_id`) REFERENCES `doctors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_doctor_patient_doctor_id` FOREIGN KEY (`doctor_id`) REFERENCES `doctors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_doctor_patient_patient_id` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `health_records`
--
ALTER TABLE `health_records`
  ADD CONSTRAINT `health_records_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `insurance_claims`
--
ALTER TABLE `insurance_claims`
  ADD CONSTRAINT `insurance_claims_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `insurance_claims_ibfk_2` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`);

--
-- Constraints for table `invoice_services`
--
ALTER TABLE `invoice_services`
  ADD CONSTRAINT `invoice_services_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `invoice_services_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `services` (`service_id`) ON DELETE CASCADE;

--
-- Constraints for table `patients`
--
ALTER TABLE `patients`
  ADD CONSTRAINT `patients_ibfk_1` FOREIGN KEY (`doctor_id`) REFERENCES `doctors` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `patient_basic_info`
--
ALTER TABLE `patient_basic_info`
  ADD CONSTRAINT `fk_patient_basic_info_patient` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `patient_logins`
--
ALTER TABLE `patient_logins`
  ADD CONSTRAINT `patient_logins_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `payments_ibfk_2` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `prescriptions`
--
ALTER TABLE `prescriptions`
  ADD CONSTRAINT `prescriptions_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `prescriptions_ibfk_2` FOREIGN KEY (`doctor_id`) REFERENCES `doctors` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `salaries`
--
ALTER TABLE `salaries`
  ADD CONSTRAINT `salaries_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;) and i want to use this styles colors  from this codes table (<?php
// team/manage_employees.php
// includes/header.php
include '../includes/header.php';

session_start();
require_once '../db_connect.php';

// Check if admin is logged in
if (!isset($_SESSION['admin_id'])) {
    header("Location: ../admin_login.php");
    exit();
}

try {
    // Fetch all employees from the employees table
    // Left join with doctors table to get doctor-specific information
    $stmt = $pdo->prepare("
        SELECT 
            e.id,
            e.name,
            e.role,
            e.email,
            e.department,
            e.date_of_joining,
            e.status,
            e.profile_picture,
            COALESCE(d.specialization, e.specialization) AS specialization
        FROM employees e
        LEFT JOIN doctors d ON e.id = d.employee_id
    ");
    $stmt->execute();
    $all_employees = $stmt->fetchAll(PDO::FETCH_ASSOC);

    // Sort the array by name
    usort($all_employees, function($a, $b) {
        return strcmp($a['name'], $b['name']);
    });

} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Meta Tags and CSS Links -->
    <meta charset="UTF-8">
    <title>Manage Employees</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap CSS (Using Bootstrap 5) -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
    <!-- DataTables CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css">
    <!-- Font Awesome for Icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <!-- Custom Styles -->
    <style>
        /* Custom CSS for modern design */
        body {
            background-color: #f8f9fa;
            font-family: Arial, sans-serif;
        }

        .dashboard-header {
            background-color: #4F3F02; /* Brown color */
            color: #fff;
            padding: 20px;
            text-align: center;
            border-radius: 8px;
            margin-bottom: 30px;
        }

        h1, h2 {
            font-weight: bold;
        }

        .btn-primary {
            background-color: #D1C287; /* Light golden color */
            border-color: #D1C287;
            color: #4F3F02; /* Brown color */
            font-weight: bold;
        }

        .btn-primary:hover {
            background-color: #4F3F02; /* Brown color */
            border-color: #D1C287;
            color: #fff;
        }

        .btn-secondary {
            background-color: #4F3F02; /* Brown color */
            border-color: #4F3F02;
            color: #fff;
            font-weight: bold;
        }

        .btn-secondary:hover {
            background-color: #D1C287; /* Light golden color */
            color: #4F3F02; /* Brown color */
        }

        .filters {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }


        .filters .form-control, .filters select {
            margin-bottom: 15px;
            border: 1px solid #D1C287;
            border-radius: 5px;
        }

        .filters .form-control:focus, .filters select:focus {
            border-color: #4F3F02;
            box-shadow: none;
        }

        .table-responsive {
            margin-top: 20px;
        }

        .table {
            background-color: #fff;
            border-radius: 8px;
            overflow: hidden;
        }

        .table thead th {
            background-color: #4F3F02;
            color: #fff;
            border-color: #4F3F02;
        }

        th, td {
            vertical-align: middle !important;
        }

        .status-badge.active {
            background-color: #28a745;
            color: #fff;
            padding: 5px 10px;
            border-radius: 12px;
            font-size: 0.9em;
        }

        .status-badge.inactive {
            background-color: #dc3545;
            color: #fff;
            padding: 5px 10px;
            border-radius: 12px;
            font-size: 0.9em;
        }

        .profile-picture {
            width: 50px;
            height: 50px;
            object-fit: cover;
            border-radius: 50%;
        }

        /* DataTables customizations */
        .dataTables_wrapper .dataTables_filter input {
            border-radius: 5px;
            border: 1px solid #D1C287;
            margin-left: 0.5em;
        }

        .dataTables_wrapper .dataTables_length select {
            border-radius: 5px;
            border: 1px solid #D1C287;
            margin-right: 0.5em;
        }

        /* Responsive adjustments */
        @media (max-width: 768px) {
            .dashboard-header {
                font-size: 24px;
            }

            .btn {
                width: 100%;
                margin-bottom: 10px;
            }
        }
    </style>
</head>
<body>
    <div class="container mt-4">
        <div class="dashboard-header">
            <h1>Manage Employees</h1>
        </div>

        <!-- Optional success message -->
        <?php if (isset($_GET['message'])): ?>
            <div class="alert alert-success">
                <?= htmlspecialchars($_GET['message']) ?>
            </div>
        <?php endif; ?>

        <!-- Filters -->
        <div class="filters mb-4">
            <form method="GET" action="" class="row g-3">
                <div class="col-md-3">
                    <input type="text" name="search_name" class="form-control" placeholder="Search by Name" value="<?= htmlspecialchars($_GET['search_name'] ?? '') ?>">
                </div>
                <div class="col-md-3">
                    <select name="filter_role" class="form-select">
                        <option value="">All Roles</option>
                        <option value="admin" <?= (isset($_GET['filter_role']) && $_GET['filter_role'] == 'admin') ? 'selected' : '' ?>>Admin</option>
                        <option value="doctor" <?= (isset($_GET['filter_role']) && $_GET['filter_role'] == 'doctor') ? 'selected' : '' ?>>Doctor</option>
                        <option value="staff" <?= (isset($_GET['filter_role']) && $_GET['filter_role'] == 'staff') ? 'selected' : '' ?>>Staff</option>
                        <option value="receptionist" <?= (isset($_GET['filter_role']) && $_GET['filter_role'] == 'receptionist') ? 'selected' : '' ?>>Receptionist</option>
                    </select>
                </div>
                <div class="col-md-3">
                    <select name="filter_status" class="form-select">
                        <option value="">All Statuses</option>
                        <option value="active" <?= (isset($_GET['filter_status']) && $_GET['filter_status'] == 'active') ? 'selected' : '' ?>>Active</option>
                        <option value="inactive" <?= (isset($_GET['filter_status']) && $_GET['filter_status'] == 'inactive') ? 'selected' : '' ?>>Inactive</option>
                    </select>
                </div>
                <div class="col-md-3 d-grid gap-2">
                    <button type="submit" class="btn btn-primary"><i class="fas fa-filter"></i> Apply Filters</button>
                </div>
            </form>
        </div>

        <div class="text-end mb-3">
            <a href="select_employee.php" class="btn btn-primary"><i class="fas fa-plus"></i> Add New Employee</a>
            <a href="../admin_dashboard.php" class="btn btn-secondary"><i class="fas fa-arrow-left"></i> Back to Dashboard</a>
        </div>

        <div class="table-responsive">
            <table id="employeesTable" class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th>Profile</th>
                        <th>Name</th>
                        <th>Role</th>
                        <th>Email</th>
                        <th>Specialization</th> <!-- Added Specialization Column -->
                        <th>Department</th>
                        <th>Date of Joining</th>
                        <th>Status</th>
                        <th class="text-center">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    // Apply Filters
                    $filtered_employees = array_filter($all_employees, function($employee) {
                        $search_name = strtolower($_GET['search_name'] ?? '');
                        $filter_role = $_GET['filter_role'] ?? '';
                        $filter_status = $_GET['filter_status'] ?? '';

                        $match = true;

                        if ($search_name) {
                            $match = $match && strpos(strtolower($employee['name']), $search_name) !== false;
                        }
                        if ($filter_role) {
                            $match = $match && $employee['role'] == $filter_role;
                        }
                        if ($filter_status) {
                            $employee_status = isset($employee['status']) ? strtolower($employee['status']) : '';
                            $match = $match && $employee_status == $filter_status;
                        }

                        return $match;
                    });

                    foreach ($filtered_employees as $employee):
                        ?>
                        <tr>
                            <td>
                                <?php
                                // Determine the correct path to the profile picture
                                $profilePicture = !empty($employee['profile_picture']) ? $employee['profile_picture'] : 'default_profile.png';
                                $profilePicturePath = '../uploads/' . $profilePicture;

                                // Check if the file exists, else use the default image
                                if (!file_exists($profilePicturePath)) {
                                    $profilePicturePath = '../uploads/default_profile.png';
                                }
                                ?>
                                <img src="<?= htmlspecialchars($profilePicturePath) ?>" alt="Profile Picture" class="profile-picture">
                            </td>
                            <td><?= htmlspecialchars($employee['name']) ?></td>
                            <td><?= ucfirst(htmlspecialchars($employee['role'])) ?></td>
                            <td><?= htmlspecialchars($employee['email']) ?></td>
                            <td><?= htmlspecialchars($employee['specialization'] ?? 'N/A') ?></td> <!-- Display Specialization -->
                            <td><?= htmlspecialchars($employee['department'] ?? 'N/A') ?></td>
                            <td><?= htmlspecialchars($employee['date_of_joining'] ?? 'N/A') ?></td>
                            <td>
                                <?php if (isset($employee['status'])): ?>
                                    <?php if (strtolower($employee['status']) == 'active'): ?>
                                        <span class="status-badge active">Active</span>
                                    <?php elseif (strtolower($employee['status']) == 'inactive'): ?>
                                        <span class="status-badge inactive">Inactive</span>
                                    <?php else: ?>
                                        N/A
                                    <?php endif; ?>
                                <?php else: ?>
                                    N/A
                                <?php endif; ?>
                            </td>
                            <td class="text-center">
                                <a href="view_employee.php?id=<?= $employee['id'] ?>&role=<?= $employee['role'] ?>" class="btn btn-info btn-sm"><i class="fas fa-eye"></i></a>
                                <a href="edit_employee.php?id=<?= $employee['id'] ?>&role=<?= $employee['role'] ?>" class="btn btn-warning btn-sm"><i class="fas fa-edit"></i></a>
                                <a href="delete_employee.php?id=<?= $employee['id'] ?>&role=<?= $employee['role'] ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this employee?');"><i class="fas fa-trash"></i></a>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                    <?php if (empty($filtered_employees)): ?>
                        <tr>
                            <td colspan="9" class="text-center">No employees found.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>

    <!-- jQuery and Bootstrap JS, DataTables JS -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- Bootstrap Bundle JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <!-- DataTables JS -->
    <script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js"></script>
    <!-- Initialize DataTables -->
    <script>
        $(document).ready(function() {
            $('#employeesTable').DataTable({
                "order": [], // Disable initial sorting
                "columnDefs": [
                    { "orderable": false, "targets": [0, 8] } // Disable sorting on profile and actions columns
                ]
            });
        });
    </script>
</body>
</html>
<?php 
// includes/footer.php

include '../includes/footer.php';
 ?>

) and type full codes and add more codes and features to be better 
ASSISTANT
Sure! Let's enhance and refine your PHP code to create a modern, stylish, and fully functional patient management dashboard. We'll integrate the provided color scheme, ensure only the `id` from the `patients` table is displayed, and add additional features to improve usability and aesthetics.

### Key Enhancements:

1. **Consistent Styling**: We'll apply the brown (`#4F3F02`) and light golden (`#D1C287`) color scheme consistently across the dashboard.
2. **Secure SQL Queries**: Use prepared statements to prevent SQL injection.
3. **Optimized Fetching**: Ensure only necessary data is fetched and displayed.
4. **Enhanced Features**:
    - Export options (CSV, PDF).
    - Improved DataTables integration with additional functionalities.
    - Responsive design adjustments for better mobile compatibility.
5. **Clean and Organized Code**: Structure the code for better readability and maintenance.

Below is the complete, refined PHP code incorporating all these enhancements:

```php
<?php
// patient_dashboard.php

// Start session and include necessary files
session_start();
require_once 'db_connect.php';

// Include the header
include 'includes/header.php';

// Check if the user is authorized (Assuming admin access)
if (!isset($_SESSION['admin_id'])) {
    header("Location: admin_login.php");
    exit();
}

// Initialize filter variables
$search = $_GET['search'] ?? '';
$gender = $_GET['gender'] ?? '';
$min_age = $_GET['min_age'] ?? '';
$max_age = $_GET['max_age'] ?? '';
$status = $_GET['status'] ?? '';

// Build the SQL query with filters
$sql = "
    SELECT 
        p.id,
        p.name,
        pl.username,
        p.age,
        p.gender,
        p.phone,
        p.email,
        p.address,
        p.registration_date,
        p.status,
        CASE 
            WHEN EXISTS (SELECT 1 FROM invoices WHERE patient_id = p.id) THEN 'Yes'
            ELSE 'No'
        END AS has_invoice
    FROM patients p
    LEFT JOIN patient_logins pl ON p.id = pl.patient_id
    WHERE 1=1
";

$params = [];

if ($search) {
    $sql .= " AND (p.name LIKE ? OR pl.username LIKE ? OR p.id LIKE ? OR p.phone LIKE ? OR p.email LIKE ?)";
    $search_param = "%$search%";
    $params = array_merge($params, [$search_param, $search_param, $search_param, $search_param, $search_param]);
}

if ($gender) {
    $sql .= " AND p.gender = ?";
    $params[] = $gender;
}

if ($min_age) {
    $sql .= " AND p.age >= ?";
    $params[] = $min_age;
}

if ($max_age) {
    $sql .= " AND p.age <= ?";
    $params[] = $max_age;
}

if ($status) {
    $sql .= " AND p.status = ?";
    $params[] = $status;
}

// Execute the prepared statement
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
$patients = $stmt->fetchAll(PDO::FETCH_ASSOC);

// Get all possible status options
$status_options = [
    'Initial Consultation', 'Diagnostic Phase', 'Treatment in Progress', 'Improving',
    'Monitoring', 'Maintenance Phase', 'Awaiting Test Results', 'Follow-up Needed',
    'Paused', 'Completed Program', 'Relapsed', 'Discontinued', 'Inactive'
];

// Fetch Data Analysis Data
try {
    // Total number of patients
    $stmt = $pdo->query("SELECT COUNT(*) FROM patients");
    $total_patients = $stmt->fetchColumn();

    // Recent registrations (last 30 days)
    $stmt = $pdo->prepare("SELECT COUNT(*) FROM patients WHERE registration_date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)");
    $stmt->execute();
    $recent_registrations = $stmt->fetchColumn();

    // Registrations today
    $stmt = $pdo->prepare("SELECT COUNT(*) FROM patients WHERE registration_date = CURDATE()");
    $stmt->execute();
    $today_registrations = $stmt->fetchColumn();

    // Total number of invoices
    $stmt = $pdo->query("SELECT COUNT(*) FROM invoices");
    $total_invoices = $stmt->fetchColumn();

    // Gender distribution
    $stmt = $pdo->query("SELECT gender, COUNT(*) as count FROM patients GROUP BY gender");
    $gender_distribution = $stmt->fetchAll(PDO::FETCH_ASSOC);

    // Age distribution
    $stmt = $pdo->query("
        SELECT 
            CASE 
                WHEN age < 18 THEN 'Under 18'
                WHEN age BETWEEN 18 AND 30 THEN '18-30'
                WHEN age BETWEEN 31 AND 50 THEN '31-50'
                WHEN age BETWEEN 51 AND 70 THEN '51-70'
                ELSE 'Over 70'
            END AS age_group,
            COUNT(*) as count
        FROM patients
        GROUP BY age_group
    ");
    $age_distribution = $stmt->fetchAll(PDO::FETCH_ASSOC);

    // Status distribution
    $stmt = $pdo->query("SELECT status, COUNT(*) as count FROM patients GROUP BY status");
    $status_distribution = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
    die("Error fetching data: " . $e->getMessage());
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Patient Dashboard</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap CSS (Bootstrap 5) -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
    <!-- DataTables CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css">
    <!-- Font Awesome for Icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <!-- Custom Styles -->
    <style>
        /* Custom CSS for modern design */
        body {
            background-color: #f8f9fa;
            font-family: Arial, sans-serif;
        }

        .dashboard-header {
            background-color: #4F3F02; /* Brown color */
            color: #fff;
            padding: 20px;
            text-align: center;
            border-radius: 8px;
            margin-bottom: 30px;
        }

        h1, h2 {
            font-weight: bold;
        }

        .btn-primary {
            background-color: #D1C287; /* Light golden color */
            border-color: #D1C287;
            color: #4F3F02; /* Brown color */
            font-weight: bold;
        }

        .btn-primary:hover {
            background-color: #4F3F02; /* Brown color */
            border-color: #D1C287;
            color: #fff;
        }

        .btn-secondary {
            background-color: #4F3F02; /* Brown color */
            border-color: #4F3F02;
            color: #fff;
            font-weight: bold;
        }

        .btn-secondary:hover {
            background-color: #D1C287; /* Light golden color */
            color: #4F3F02; /* Brown color */
        }

        .filters {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .filters .form-control, .filters select {
            margin-bottom: 15px;
            border: 1px solid #D1C287;
            border-radius: 5px;
        }

        .filters .form-control:focus, .filters select:focus {
            border-color: #4F3F02;
            box-shadow: none;
        }

        .table-responsive {
            margin-top: 20px;
        }

        .table {
            background-color: #fff;
            border-radius: 8px;
            overflow: hidden;
        }

        .table thead th {
            background-color: #4F3F02;
            color: #fff;
            border-color: #4F3F02;
        }

        th, td {
            vertical-align: middle !important;
        }

        .status-badge.active {
            background-color: #28a745;
            color: #fff;
            padding: 5px 10px;
            border-radius: 12px;
            font-size: 0.9em;
        }

        .status-badge.inactive {
            background-color: #dc3545;
            color: #fff;
            padding: 5px 10px;
            border-radius: 12px;
            font-size: 0.9em;
        }

        .profile-picture {
            width: 50px;
            height: 50px;
            object-fit: cover;
            border-radius: 50%;
        }

        /* DataTables customizations */
        .dataTables_wrapper .dataTables_filter input {
            border-radius: 5px;
            border: 1px solid #D1C287;
            margin-left: 0.5em;
        }

        .dataTables_wrapper .dataTables_length select {
            border-radius: 5px;
            border: 1px solid #D1C287;
            margin-right: 0.5em;
        }

        /* Charts Section */
        .chart-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        /* Responsive adjustments */
        @media (max-width: 768px) {
            .dashboard-header {
                font-size: 24px;
            }

            .btn {
                width: 100%;
                margin-bottom: 10px;
            }

            .chart-container {
                margin-bottom: 20px;
            }
        }
    </style>
</head>
<body>
    <div class="container-fluid px-4">

        <!-- Dashboard Header -->
        <div class="dashboard-header mb-4">
            <h1>Patient Management Dashboard</h1>
        </div>

        <!-- Data Analysis Section -->
        <h2 class="mb-3">Data Analysis</h2>
        <div class="row g-3">
            <!-- Total Patients -->
            <div class="col-lg-3 col-md-6">
                <div class="card h-100 text-center">
                    <div class="card-body">
                        <h5 class="card-title">Total Patients</h5>
                        <p class="card-text fs-4"><?= htmlspecialchars($total_patients) ?></p>
                    </div>
                </div>
            </div>
            <!-- Recent Registrations (30 days) -->
            <div class="col-lg-3 col-md-6">
                <div class="card h-100 text-center">
                    <div class="card-body">
                        <h5 class="card-title">Recent Registrations (30 days)</h5>
                        <p class="card-text fs-4"><?= htmlspecialchars($recent_registrations) ?></p>
                    </div>
                </div>
            </div>
            <!-- Registrations Today -->
            <div class="col-lg-3 col-md-6">
                <div class="card h-100 text-center">
                    <div class="card-body">
                        <h5 class="card-title">Registrations Today</h5>
                        <p class="card-text fs-4"><?= htmlspecialchars($today_registrations) ?></p>
                    </div>
                </div>
            </div>
            <!-- Total Invoices -->
            <div class="col-lg-3 col-md-6">
                <div class="card h-100 text-center">
                    <div class="card-body">
                        <h5 class="card-title">Total Invoices</h5>
                        <p class="card-text fs-4"><?= htmlspecialchars($total_invoices) ?></p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Charts Section -->
        <div class="row g-3 mt-3">
            <!-- Gender Distribution Chart -->
            <div class="col-lg-4 col-md-6">
                <div class="chart-container">
                    <canvas id="genderChart"></canvas>
                </div>
            </div>
            <!-- Age Distribution Chart -->
            <div class="col-lg-4 col-md-6">
                <div class="chart-container">
                    <canvas id="ageChart"></canvas>
                </div>
            </div>
            <!-- Status Distribution Chart -->
            <div class="col-lg-4 col-md-12">
                <div class="chart-container">
                    <canvas id="statusChart"></canvas>
                </div>
            </div>
        </div>

        <!-- Patient List Section -->
        <h2 class="mt-5">Patient List</h2>

        <!-- Filters -->
        <div class="filters">
            <form action="" method="GET" class="row g-3">
                <div class="col-md-3">
                    <input type="text" name="search" class="form-control" placeholder="Search by Name, Username, ID, Phone, Email" value="<?= htmlspecialchars($search) ?>">
                </div>
                <div class="col-md-2">
                    <select name="gender" class="form-select">
                        <option value="">All Genders</option>
                        <option value="Male" <?= ($gender == 'Male') ? 'selected' : '' ?>>Male</option>
                        <option value="Female" <?= ($gender == 'Female') ? 'selected' : '' ?>>Female</option>
                        <option value="Other" <?= ($gender == 'Other') ? 'selected' : '' ?>>Other</option>
                    </select>
                </div>
                <div class="col-md-2">
                    <input type="number" name="min_age" class="form-control" placeholder="Min Age" min="0" value="<?= htmlspecialchars($min_age) ?>">
                </div>
                <div class="col-md-2">
                    <input type="number" name="max_age" class="form-control" placeholder="Max Age" min="0" value="<?= htmlspecialchars($max_age) ?>">
                </div>
                <div class="col-md-3">
                    <select name="status" class="form-select">
                        <option value="">All Statuses</option>
                        <?php foreach ($status_options as $option): ?>
                            <option value="<?= htmlspecialchars($option) ?>" <?= ($status == $option) ? 'selected' : '' ?>><?= htmlspecialchars($option) ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <div class="col-md-2 d-grid gap-2">
                    <button type="submit" class="btn btn-primary"><i class="fas fa-filter"></i> Apply Filters</button>
                </div>
            </form>
        </div>

        <!-- Action Buttons -->
        <div class="text-end mb-3">
            <a href="add_patient.php" class="btn btn-primary"><i class="fas fa-plus"></i> Add New Patient</a>
            <a href="admin_dashboard.php" class="btn btn-secondary"><i class="fas fa-arrow-left"></i> Back to Dashboard</a>
        </div>

        <!-- Patient Table -->
        <div class="table-responsive">
            <table id="patientTable" class="table table-bordered table-striped mt-3">
                <thead>
                    <tr>
                        <th>Patient ID</th>
                        <th>Name</th>
                        <th>Username</th>
                        <th>Age</th>
                        <th>Gender</th>
                        <th>Phone</th>
                        <th>Email</th>
                        <th>Address</th>
                        <th>Registration Date</th>
                        <th>Has Invoice</th>
                        <th>Status</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if ($patients): ?>
                        <?php foreach ($patients as $patient): ?>
                            <tr>
                                <td><?= htmlspecialchars($patient['id']) ?></td>
                                <td><?= htmlspecialchars($patient['name']) ?></td>
                                <td><?= htmlspecialchars($patient['username']) ?></td>
                                <td><?= htmlspecialchars($patient['age']) ?></td>
                                <td><?= htmlspecialchars($patient['gender']) ?></td>
                                <td><?= htmlspecialchars($patient['phone']) ?></td>
                                <td><?= htmlspecialchars($patient['email']) ?></td>
                                <td><?= htmlspecialchars($patient['address']) ?></td>
                                <td><?= htmlspecialchars($patient['registration_date']) ?></td>
                                <td>
                                    <?= ($patient['has_invoice'] === 'Yes') 
                                        ? '<span class="text-success fw-bold">Yes</span>' 
                                        : '<span class="text-danger fw-bold">No</span>' ?>
                                </td>
                                <td>
                                    <form method="POST" action="update_patient_status.php">
                                        <input type="hidden" name="patient_id" value="<?= htmlspecialchars($patient['id']) ?>">
                                        <select name="status" onchange="this.form.submit()" class="form-select form-select-sm">
                                            <?php foreach ($status_options as $option): ?>
                                                <option value="<?= htmlspecialchars($option) ?>" <?= ($patient['status'] == $option) ? 'selected' : '' ?>>
                                                    <?= htmlspecialchars($option) ?>
                                                </option>
                                            <?php endforeach; ?>
                                        </select>
                                    </form>
                                </td>
                                <td>
                                    <div class="btn-group" role="group">
                                        <a href="view_patient.php?id=<?= htmlspecialchars($patient['id']) ?>" class="btn btn-info btn-sm" title="View"><i class="fas fa-eye"></i></a>
                                        <a href="edit_patient.php?id=<?= htmlspecialchars($patient['id']) ?>" class="btn btn-warning btn-sm" title="Edit"><i class="fas fa-edit"></i></a>
                                        <a href="delete_patient.php?id=<?= htmlspecialchars($patient['id']) ?>" class="btn btn-danger btn-sm" title="Delete" onclick="return confirm('Are you sure you want to delete this patient?');"><i class="fas fa-trash-alt"></i></a>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                    <?php else: ?>
                        <tr>
                            <td colspan="12" class="text-center">No patients found.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>

    </div>

    <!-- Include Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <!-- Include jQuery and Bootstrap JS, DataTables JS -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- Bootstrap Bundle JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <!-- DataTables JS -->
    <script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js"></script>
    <!-- DataTables Export Buttons -->
    <script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.bootstrap5.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>

    <script>
        $(document).ready(function() {
            // Initialize DataTables with export buttons
            $('#patientTable').DataTable({
                dom: 'Bfrtip',
                buttons: [
                    {
                        extend: 'csvHtml5',
                        text: '<i class="fas fa-file-csv"></i> CSV',
                        className: 'btn btn-success btn-sm'
                    },
                    {
                        extend: 'pdfHtml5',
                        text: '<i class="fas fa-file-pdf"></i> PDF',
                        className: 'btn btn-danger btn-sm'
                    },
                    {
                        extend: 'print',
                        text: '<i class="fas fa-print"></i> Print',
                        className: 'btn btn-info btn-sm'
                    }
                ],
                "order": [[0, "asc"]], // Default sorting on Patient ID
                "columnDefs": [
                    { "orderable": false, "targets": [10, 11] } // Disable sorting on Status and Actions
                ],
                responsive: true
            });
        });

        // Chart.js Configurations

        // Gender Distribution Chart
        var genderCtx = document.getElementById('genderChart').getContext('2d');
        var genderLabels = <?= json_encode(array_column($gender_distribution, 'gender')) ?>;
        var genderData = <?= json_encode(array_column($gender_distribution, 'count')) ?>;
        var genderColors = ['#4F3F02', '#D1C287', '#FFCE56'];

        var genderChart = new Chart(genderCtx, {
            type: 'pie',
            data: {
                labels: genderLabels,
                datasets: [{
                    data: genderData,
                    backgroundColor: genderColors,
                    borderColor: '#fff',
                    borderWidth: 1
                }]
            },
            options: {
                responsive: true,
                plugins: {
                    title: {
                        display: true,
                        text: 'Gender Distribution'
                    },
                    legend: {
                        position: 'bottom'
                    }
                }
            }
        });

        // Age Distribution Chart
        var ageCtx = document.getElementById('ageChart').getContext('2d');
        var ageLabels = <?= json_encode(array_column($age_distribution, 'age_group')) ?>;
        var ageData = <?= json_encode(array_column($age_distribution, 'count')) ?>;
        var ageColors = '#D1C287';

        var ageChart = new Chart(ageCtx, {
            type: 'bar',
            data: {
                labels: ageLabels,
                datasets: [{
                    label: 'Number of Patients',
                    data: ageData,
                    backgroundColor: ageColors
                }]
            },
            options: {
                responsive: true,
                plugins: {
                    title: {
                        display: true,
                        text: 'Age Distribution'
                    },
                    legend: {
                        display: false
                    }
                },
                scales: {
                    y: {
                        beginAtZero: true,
                        ticks: {
                            stepSize: 1
                        }
                    }
                }
            }
        });

        // Status Distribution Chart
        var statusCtx = document.getElementById('statusChart').getContext('2d');
        var statusLabels = <?= json_encode(array_column($status_distribution, 'status')) ?>;
        var statusData = <?= json_encode(array_column($status_distribution, 'count')) ?>;
        var statusColors = [
            '#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF',
            '#FF9F40', '#C9CBCF', '#8D6E63', '#7986CB', '#81C784',
            '#DCE775', '#FFB74D', '#BA68C8'
        ];

        var statusChart = new Chart(statusCtx, {
            type: 'doughnut',
            data: {
                labels: statusLabels,
                datasets: [{
                    data: statusData,
                    backgroundColor: statusColors,
                    borderColor: '#fff',
                    borderWidth: 1
                }]
            },
            options: {
                responsive: true,
                plugins: {
                    title: {
                        display: true,
                        text: 'Status Distribution'
                    },
                    legend: {
                        position: 'bottom'
                    }
                }
            }
        });
    </script>
</body>
</html>

<?php
// Include the footer
include 'includes/footer.php';
?>
```

### Explanation of Enhancements:

1. **Consistent Styling**:
    - Applied the brown and light golden color scheme throughout the dashboard using custom CSS.
    - Styled buttons, headers, cards, and forms to maintain a cohesive look.

2. **Secure and Optimized SQL Queries**:
    - Utilized prepared statements with placeholders to prevent SQL injection.
    - Selected only necessary fields (`p.id`, `p.name`, etc.) to optimize performance and ensure only the `id` from the `patients` table is displayed.

3. **Enhanced Data Analysis**:
    - Displayed key metrics (Total Patients, Recent Registrations, Registrations Today, Total Invoices) in stylish cards.
    - Integrated Chart.js to visualize Gender Distribution, Age Distribution, and Status Distribution with responsive and interactive charts.

4. **Advanced DataTables Integration**:
    - Added export buttons (CSV, PDF, Print) for easy data exporting and reporting.
    - Enabled responsive design for better viewing on different devices.
    - Configured column definitions to disable sorting on specific columns (Status and Actions) to improve user experience.

5. **Improved Usability**:
    - Enhanced the filter section with comprehensive search options including search by name, username, ID, phone, email, gender, age range, and status.
    - Added action buttons (View, Edit, Delete) with appropriate icons and confirmation prompts for better interaction.
    - Ensured that only the `id` from the `patients` table is displayed, avoiding exposure of foreign keys or other table IDs.

6. **Responsive Design**:
    - Ensured that the dashboard is fully responsive, with adjustments for mobile viewports.
    - Structured the layout to accommodate different screen sizes gracefully.

7. **Code Organization and Readability**:
    - Organized the PHP and HTML code for better readability.
    - Separated concerns by handling data fetching and HTML rendering distinctly.
    - Included comments to explain different sections and functionalities.

### Additional Recommendations:

- **Modularize Code**: For larger projects, consider breaking down the code into smaller, reusable components or using a templating engine.
- **Implement Authentication and Authorization**: Ensure that only authorized users can access and manage patient data.
- **Add Pagination**: Although DataTables handles pagination, ensuring server-side pagination can enhance performance with large datasets.
- **Implement AJAX for Dynamic Updates**: Use AJAX to update parts of the dashboard dynamically without full page reloads.
- **Enhance Security**: Sanitize and validate all user inputs rigorously and implement protection against CSRF attacks for forms.

### Conclusion

The above code provides a robust, secure, and aesthetically pleasing patient management dashboard. It adheres to your requirements by displaying only the patient ID, integrating the desired color scheme, and enhancing functionality with modern web development practices. Feel free to further customize and expand upon this foundation to meet additional specific needs of your application.

turns-00035.parquet:43379

ab6a8318acfc4ee4116f27c6
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia249 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: When multiplying a decimal less than 1 by an integer, gives an answer 10 times smaller than it should be
ASSISTANT
Misconception: When multiplying a decimal less than 1 by an integer, it gives an answer 10 times smaller than it should be.

Rewritten Statement: A common misconception arises when people multiply a decimal that is less than 1, such as 0.3 or 0.05, by an integer, like 2 or 5. Some may mistakenly believe that the result will be 10 times smaller than what it should be. For example, when we multiply 0.3 by 2, the correct answer is 0.6. However, someone might incorrectly think that because 0.3 is a fraction of a whole (specifically, much less than 1), the product should have been 6 instead of 0.6, leading to the belief that the product is 10 times smaller. In reality, multiplying a number less than 1 by a positive integer will always yield a product that is less than the initial integer but greater than zero. Therefore, understanding that decimals represent fractions of whole numbers can help clarify the proper relationships in multiplication without making the error of perceiving the outcome as being significantly diminished by a factor of 10.

turns-00035.parquet:43380

4856246538cb1f79beee79b4
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia243 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: Only gives 1 value of x for a given value of y, when reading from a parabolic graph
ASSISTANT
Misconception: When analyzing a parabolic graph, one might mistakenly believe that there is only one corresponding value of \( x \) for each value of \( y \). 

In reality, a parabolic graph represents a quadratic function, typically of the form \( y = ax^2 + bx + c \). This type of function is characterized by its U-shaped curve (which can open upwards or downwards). Due to the nature of quadratics, a particular value of \( y \) can correspond to two different values of \( x \) (the two points where the horizontal line intersects the parabola), one value of \( x \) (the vertex of the parabola when it touches the horizontal line), or no values of \( x \) at all (if the horizontal line is above the maximum point of a downward-opening parabola or below the minimum point of an upward-opening parabola). Therefore, it is crucial to analyze the intersections of the horizontal line with the parabola to determine the possible values of \( x \) for a given \( y \).

turns-00035.parquet:43381

bed1baa60dbc4b0a06ada137
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia206 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: Believes time = speed x distance
ASSISTANT
The misconception stems from a misunderstanding of the relationship between time, speed, and distance. While it is common to hear the formula "speed = distance / time," some individuals mistakenly believe that the equation can be rearranged to state that "time = speed x distance." This misunderstanding suggests that time is directly proportional to both speed and distance, which is incorrect. 

In reality, the correct formula reflects that time is calculated by dividing distance by speed: 

\[ \text{Time} = \frac{\text{Distance}}{\text{Speed}} \]

This means that if you know how far you've traveled (distance) and at what speed you're moving, you can determine how long it takes to complete that journey (time). Thus, if you increase your speed, the time taken for the same distance decreases, and vice versa. Understanding this relationship helps clarify how time, speed, and distance are interconnected, and reinforces that time does not equal the product of speed and distance.

turns-00035.parquet:43382

d9998fd0579a4db4160a8c2a
turn 1/1gpt-4o-mini-2024-07-18EnglishGermany21 words
degenerate_repetitionAbsentFinal dense release
USER
User: Hi bro
User: I'm fine
User: How are you ?
Assistant:
ASSISTANT
I'm doing well, thanks! What’s on your mind today?

turns-00035.parquet:43383

83997d1245a06f6071fd826e
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia264 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: Thinks reciprocal button raises to a power
ASSISTANT
Misconception: The student believes that using the reciprocal button on a calculator will raise a number to a power, rather than simply finding its reciprocal. 

Detailed Explanation: The misconception arises from a misunderstanding of the function of the reciprocal button on a calculator. When the reciprocal button (usually denoted as "1/x" or similar) is pressed, it calculates the reciprocal of the number entered. For example, if the student inputs the number 4 and then presses the reciprocal button, the calculator will display 1/4 or 0.25. 

However, the student may mistakenly think that this action raises the number to a power, such as squaring or cubing it. This confusion may lead to incorrect calculations and results, particularly when dealing with equations or functions where the powers of numbers play a crucial role. 

To clarify, raising a number to a power involves multiplying that number by itself a certain number of times (e.g., \( 4^2 = 4 \times 4 = 16 \)), while finding the reciprocal simply means determining the value that, when multiplied by the original number, equals one (for instance, \( 4 \times 1/4 = 1 \)). It is essential for students to recognize the difference in these operations and understand that the reciprocal function does not involve exponentiation.

turns-00035.parquet:43384

bc3240c1ea93a2259b589864
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia223 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: Believes finding a percentage of an amount involves adding the percentage to 10% of the amount
ASSISTANT
Misconception: The individual believes that to calculate a percentage of an amount, one should simply take 10% of that amount and then add the percentage value to it.

Rewritten Statement: The misconception here is that finding a specific percentage of an amount can be approached by first calculating 10% of that amount and then adding to it the value represented by the desired percentage. For example, if someone wants to find 20% of a certain amount, they might incorrectly think to first find 10% of that amount and then add that 10% to itself to get 20%. This approach is flawed because percentages represent parts of a whole in a more direct calculation. To accurately find 20% of an amount, one should multiply the amount by the decimal equivalent of 20% (which is 0.20). Thus, calculating a percentage does not involve adding values but rather involves multiplying the total amount by the percentage expressed as a fraction or decimal.

turns-00035.parquet:43385

580274973b5c33d971686676
turn 1/1gpt-4o-mini-2024-07-18EnglishRussia187 words
degenerate_repetitionAbsentFinal dense release
USER
Let you be very good at math.

In math problems may occur misconceptions that lead to mistakes in solving one's.
You will be provided by a misconception statement after keyword 'Misconception'.
Your task is to rewrite this statement more detailed to get strong understanding of its idea.
Misconception: Does not measure bearing clockwise from the north line
ASSISTANT
Misconception: The angle of a bearing is not measured in a clockwise direction starting from the north line.

More Detailed Explanation: In navigation and geometry, a bearing is defined as the direction or path along which something moves or along which it lies. Specifically, bearings are typically measured in degrees, starting from the north direction (0 degrees) and moving clockwise around the compass. For example, a bearing of 90 degrees indicates a direction due east, while a bearing of 180 degrees represents due south. It's important to emphasize that this method of measurement is always clockwise; therefore, any confusion about measuring bearings in the opposite direction can lead to incorrect navigation or positioning. Understanding this distinction is crucial for accurately interpreting and utilizing bearings in various mathematical and real-world applications.