����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 162.0.232.25 / Your IP : 3.135.247.24 Web Server : LiteSpeed System : Linux premium276.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : kwacuqig ( 988) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/kwacuqig/gateman.skilltainment.org/ |
Upload File : |
<?php include './head.php'; include './header.php'; include './sidebar.php'; function compareDay($id, $loop) { global $conn; $run = mysqli_query($conn, "SELECT * FROM `attendance` WHERE `user_id`=$id") or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($run)) { $day = date('d', $row['date']); $month = date('n', $row['date']); if ($loop == $day && $month == date('n', time())) { return $row['in_time']; } } return false; } function getInTime($id) { global $conn; $run = mysqli_query($conn, "SELECT * FROM `attendance` WHERE `user_id`=$id") or die(mysqli_error($conn)); $row = mysqli_fetch_array($run); return $row['in_time']; } function countPunctual($id) { global $conn; $punctual = 0; $notPunctual = 0; $run = mysqli_query($conn, "SELECT * FROM `attendance` WHERE `user_id`=$id") or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($run)) { $month = date('n', $row['date']); $hour = date('H', $row['in_time']); $minutes = date('i', $row['in_time']); if ($hour <= 7 && $minutes <= 30 && $month == date('n', time())) { ++$punctual; } else if (($hour >= 7 || $minutes > 30) && $month == date('n', time())) { ++$notPunctual; } } return "$punctual/" . ($punctual + $notPunctual); } ?> <!--********************************** Content body start ***********************************--> <div class="content-body"> <!-- row --> <div class="page-titles"> <ol class="breadcrumb"> <li> <h5 class="bc-title">Dashboard</h5> </li> <li class="breadcrumb-item"><a href="javascript:void(0)"> <svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M2.125 6.375L8.5 1.41667L14.875 6.375V14.1667C14.875 14.5424 14.7257 14.9027 14.4601 15.1684C14.1944 15.4341 13.8341 15.5833 13.4583 15.5833H3.54167C3.16594 15.5833 2.80561 15.4341 2.53993 15.1684C2.27426 14.9027 2.125 14.5424 2.125 14.1667V6.375Z" stroke="#2C2C2C" stroke-linecap="round" stroke-linejoin="round" /> <path d="M6.375 15.5833V8.5H10.625V15.5833" stroke="#2C2C2C" stroke-linecap="round" stroke-linejoin="round" /> </svg> Home </a> </li> <li class="breadcrumb-item active"><a href="javascript:void(0)">Dashboard</a></li> </ol> </div> <div class="container-fluid"> <div class="row"> <div class="col-6"> <div class="card chart-grd same-card"> <div class="card-body depostit-card p-0"> <div class="depostit-card-media d-flex justify-content-between pb-0"> <div> <h6>Check In | Today</h6> <h1 class="in-time"></h1> </div> </div> </div> </div> </div> <div class="col-6"> <div class="card chart-grd same-card"> <div class="card-body depostit-card p-0"> <div class="depostit-card-media d-flex justify-content-between pb-0"> <div> <h6>Check Out | Today</h6> <h1 class="out-time"></h1> </div> </div> </div> </div> </div> <div class="col-xl-12 up-shd"> <div class="card"> <div class="card-header pb-0 border-0"> <h4 class="heading mb-0">Punctuality Check</h4> </div> <div class="card-body"> <canvas id="evaluationChart" height="120"></canvas> </div> </div> </div> <div class="col-xl-12 up-shd"> <div class="card"> <div class="card-header pb-0 border-0"> <h4 class="heading mb-0">Attendance</h4> </div> <div class="card-body"> <canvas id="attendanceChart" height="120"></canvas> </div> </div> </div> <div class="col-xl-12"> <div class="card"> <div class="card-body p-0"> <div class="table-responsive active-projects style-1"> <div class="tbl-caption"> <h4 class="heading mb-0"> Weekly Attendance </h4> </div> <table id="empoloyees-tblwrapper" class="table"> <thead> <tr> <th>Day</th> <th>Date</th> <th>In Time</th> <th>Out Time</th> <th>Status</th> </tr> </thead> <tbody> <?php $run = mysqli_query($conn, "SELECT * FROM `attendance` WHERE `user_id`=" . $_SESSION['uid'] . " ORDER BY `aid` DESC LIMIT 5") or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($run)) { ?> <tr> <td><?php echo date('D', $row['date']); ?></td> <td><span><?php echo date('d M Y', $row['date']); ?></span></td> <td><span><?php echo date('H:i', $row['in_time']); ?></span></td> <td> <span> <?php if ($row['out_time'] == '-') { echo "--:--"; } else { echo date('H:i', $row['out_time']); } ?> </span> </td> <td> <span> <?php $hour = date('H', $row['in_time']); $minutes = date('i', $row['in_time']); if ($hour <= 7 && $minutes <= 30) { echo "Punctual"; } else { echo 'Not Punctual'; } ?> </span> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> <div class="col-xl-12"> <div class="card"> <div class="card-body p-0"> <div class="table-responsive active-projects style-1 attendance-tbl"> <div class="tbl-caption"> <h4 class="heading mb-0">Monthly Punctuality</h4> </div> <table id="attendance-tbl" class="table"> <thead> <tr> <th></th> <?php $month = date('n'); $year = date('Y'); $total_days = cal_days_in_month(CAL_GREGORIAN, $month, $year); for ($i = 1; $i <= $total_days; $i++) { $day = date('D', strtotime($i . '-' . date('m-Y'))); ?> <th> <span><?php echo $i; ?></span> <p><?php echo $day; ?></p> </th> <?php } ?> <th class="text-center"> <span>Total</span> </th> </tr> </thead> <tbody> <?php $run = mysqli_query($conn, "SELECT * FROM `users` WHERE `uid`=" . $_SESSION['uid']) or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($run)) { $user_id = $row['uid']; ?> <tr> <td></td> <?php for ($i = 1; $i <= $total_days; $i++) { if (compareDay($user_id, $i) != false) { $in_time = compareDay($user_id, $i); $hour = date('H', $in_time); $minutes = date('i', $in_time); if ($hour <= 7 && $minutes <= 30) { ?> <td><span class="text-success"><i class="fa-solid fa-check"></i></span></td> <?php } else { ?> <td><span class="text-danger"><i class="fa-regular fa-xmark"></i></span></td> <?php } ?> <?php } else { ?> <td><span class="text-primary"><i class="fa-solid fa-minus"></i></span></td> <?php } } ?> <td><?php echo countPunctual($user_id); ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> <!--********************************** Content body end ***********************************--> <?php include './footer.php'; include './scripts.php'; ?> <script> window.onload = function() { loadData(); } function loadData() { var url = "./php/read_all.php?uid=<?php echo $_SESSION['uid']; ?>"; $.getJSON(url, function(data) { var inTime = data['gateman'][0]['in_time']; var outTime = data['gateman'][0]['out_time']; var punctual = data['gateman'][0]['punctual']; var notPunctual = 100 - punctual; var attended = data['gateman'][0]['attended']; var notAttended = 100 - attended; // Single Value Variable document.querySelector(".in-time").innerHTML = inTime; document.querySelector(".out-time").innerHTML = outTime; /******************************* Doughnut Chart For Punctuality ******************************/ // Sample data for nutrient levels var dataBar = { labels: ['Punctual (%)', 'Not Punctual (%)'], datasets: [{ label: 'Nutrient Levels', backgroundColor: ['rgb(75, 192, 192)', 'rgb(255, 99, 132)'], data: [punctual, notPunctual], }] }; // Get the context of the canvas element var ctxBar = document.getElementById('evaluationChart').getContext('2d'); // Create a bar chart var myBarChart = new Chart(ctxBar, { type: 'doughnut', data: dataBar, options: { responsive: true, animation: false, scales: { x: { type: 'category', labels: dataBar.labels, }, y: { beginAtZero: true, } } } }); /******************************* Doughnut Chart For Attendance ******************************/ // Sample data for nutrient levels var dataBar1 = { labels: ['Days Present (%)', 'Days Absent (%)'], datasets: [{ label: 'Nutrient Levels', backgroundColor: ['rgb(0, 255, 0)', 'rgb(255, 0, 0)'], data: [attended, notAttended], }] }; // Get the context of the canvas element var ctxBar1 = document.getElementById('attendanceChart').getContext('2d'); // Create a bar chart var myBarChart = new Chart(ctxBar1, { type: 'doughnut', data: dataBar1, options: { responsive: true, animation: false, scales: { x: { type: 'category', labels: dataBar.labels, }, y: { beginAtZero: true, } } } }); }); } window.setInterval(function() { loadData(); }, 500); document.querySelector('title').innerHTML = "Gateman ~ Dashboard"; </script>