<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard</title>
    <link rel="stylesheet" href="dashboard.css">
    <link href='https://fonts.googleapis.com/css?family=Ramabhadra' rel='stylesheet'>
    <style>
         @import url('https://fonts.googleapis.com/css2?family=Days+One&family=Lexend:wght@100..900&family=Teko:wght@300..700&display=swap');
         </style>
</head>
<body>
<nav class="navbar">
                <div class="navbar-container">
                    <a href="#" class="navbar-brand">
                        <img src="logo.png" alt="PharmaEase Logo">
                        <span>PharmaEase</span> </a>
                    <ul class="navbar-nav">
                        <li class="nav-item">
                            <a href="home.php" class="nav-link">Home</a>
                        </li>
                        <li class="nav-item">
                            <a href="dashboard.php" class="nav-link">Dashboard</a>
                        </li>
                        <li class="nav-item">
                            <a href="user-profile.php" class="nav-link">Profile</a>
                        </li>
                        <li class="nav-item">
                            <a href="index.php" class="nav-link">Logout</a>
                        </li>
                    </ul>
                </div>
            </nav>
<div class="header">Dashboard</div>

    <div class="container">
        <div class="nav">
            <a href="#">User</a>
            <a href="#">Manage</a>
            <a href="#">Settings</a>
            <input type="text" id="search-bar" placeholder="Search...">
            </div>

        
        <div class="info-section">
            <div class="table-header">
                <div class="col-id">Id</div>
                <div class="col-name">Name</div>
                <div class="col-email">Email</div>
                <div class="col-queue">Queue #</div>
                <div class="col-status">Status</div>
                <div class="col-action">Action</div>
            </div>
            <div class="table-rows">
                <div class="row">
                    <div class="col-id">001</div>
                    <div class="col-name">Margrethe Glipo</div>
                    <div class="col-email">mg@gmail.com</div>
                    <div class="col-queue">3</div>
                    <div class="col-status active">Active</div>
                    <div class="col-action"><a href = "generate.php"class="delete-btn">Edit</a></div>
                </div>
                <div class="row">
                    <div class="col-id">002</div>
                    <div class="col-name">Glory Mae Plateros</div>
                    <div class="col-email">glorymei@gmail.com</div>
                    <div class="col-queue">5</div>
                    <div class="col-status active">Active</div>
                    <div class="col-action"><a href = "generate.php"class="delete-btn">Edit</a></div>
                </div>
                <div class="row">
                    <div class="col-id">003</div>
                    <div class="col-name">Franz Robert Padios</div>
                    <div class="col-email">robert@gmail.com</div>
                    <div class="col-queue">1</div>
                    <div class="col-status active">Active</div>
                    <div class="col-action"><a href = "generate.php" class="delete-btn">Edit</a></div>
            </div>
            <div class="row">
                    <div class="col-id">004</div>
                    <div class="col-name">Skibidi Sigma</div>
                    <div class="col-email">sigma@yahoo.com</div>
                    <div class="col-queue">10</div>
                    <div class="col-status inactive">Inactive</div>
                    <div class="col-action"><a href = "generate.php"class="delete-btn">Edit</a></div>
                </div>
        </div>
        <?php require_once '../../controller/process.php';  
              $femaleTotal   =  getUsersPerGender("female");//3
              $maleTotal     =  getUsersPerGender("male");//4
              $othersTotal   =  getUsersPerGender("others");//4
             ?>
            <canvas id="myChart"></canvas>
</body>
</html>
<script>
        var femaleTotal = <?php echo $femaleTotal; ?>;
    var maleTotal = <?php echo $maleTotal; ?>;
    var othersTotal = <?php echo $othersTotal; ?>;
        var ctx = document.getElementById('myChart').getContext('2d');
        var myChart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels: ['Male', 'Female', 'Others'],
            datasets: [{
                label: 'Total Users',
                data: [maleTotal, femaleTotal, othersTotal],
                backgroundColor: [
                    'rgba(0, 0, 235, 0.2)',
                    'rgba(255, 99, 132, 0.2)',
                    'rgba(0, 255, 255, 0.2)'
                    
                ],
                borderColor: [                    
                    'rgba(54, 162, 235, 1)',
                    'rgba(255, 99, 132, 1)',
                    'rgba(0, 255, 255, 1)'
                ],
                borderWidth: 1
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero: true
                    }
                }]
            }
        }
    });

    </script>