File: /var/www/grapossconnect/admin-dash/dashboard.php
<?php require('include/header.php'); ?>
<?php require('include/sidebar.php'); ?>
<?php
$countQuery = $conn->query("SELECT COUNT(id) AS totalEmployee FROM `grp_employees`");
$countresult = $countQuery->fetch_assoc();
$empBirthdayQuery = "SELECT `id`, CONCAT(`first_name`, ' ', `last_name`) as name, `birth_date`, `email`, `phone_number`, `applying_position`, `created_at`, `gender`, `department` FROM `grp_employees` where status='working' and MONTH(birth_date) = MONTH(CURRENT_DATE()) ORDER BY STR_TO_DATE(birth_date,'%d-%m') DESC";
$empBirthdayData = $conn->query($empBirthdayQuery);
$empAnnQuery = "SELECT `id`, CONCAT(`first_name`, ' ', `last_name`) as name, `anniversary_date`, `email`, `phone_number`, `applying_position`, `created_at`, `gender`, `department` FROM `grp_employees` where status='working' and MONTH(anniversary_date) = MONTH(CURRENT_DATE()) ORDER BY STR_TO_DATE(anniversary_date,'%d-%m') DESC";
$empAnnData = $conn->query($empAnnQuery);
?>
<div id="content" class="app-content">
<div class="block-header">
<div class="row">
<div class="col-lg-7 col-md-6 col-sm-12">
<h1 class="page-header">Dashboard</h1>
</div>
<div class="col-lg-5 col-md-6 col-sm-12">
<ol class="breadcrumb float-xl-end">
<li class="breadcrumb-item"><a href="javascript:;">Home</a></li>
<li class="breadcrumb-item active">Welcome To Dashboard</li>
</ol>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="row">
<div class="col-lg-3">
<a href="hello">
<div class="card">
<div class="card-body no-padding">
<div class="alert alert-callout alert-success no-margin">
<strong class="text-xl"><?php echo $countresult['totalEmployee']; ?></strong><br />
<span class="opacity-50">Total Employee</span>
<h1 class="pull-right text-info" style="opacity: .3!important;"><img src="assets/img/logo.png" width="100px"></h1>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="card border-0 mb-4">
<div class="card-header h6 mb-0 bg-none p-3" style="border-bottom: 1px solid #4caf50;">
<i class="fa fa-birthday-cake fa-lg fa-fw text-dark text-opacity-50 me-1"></i> UPCOMING BIRTHDAY
</div>
<div class="card-body">
<?php
foreach ($empBirthdayData as $empb) {
$empId = $empb['id'];
$getImgQuery = "select document from `grp_document_files` WHERE `employee_id`='$empId' and `document_name`='Profile Picture'";
$getImgData = $conn->query($getImgQuery);
$getImgData1 = $getImgData->fetch_assoc();
?>
<div class="recent-content">
<?php if ($getImgData1['document'] != '') { ?>
<img src="uploads/recent-post1.jpg" alt="RecentPost" width="72" height="72">
<?php } else { ?>
<img src="uploads/<?php echo $empb['gender']; ?>.png" alt="RecentPost" width="72" height="72">
<?php } ?>
<h3><?php echo $empb['name']; ?> | <?php echo $empb['department']; ?></h3>
<a href="#" contenteditable="false" class="datee"><?php echo date('d M', strtotime($empb['birth_date'])); ?></a>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card border-0 mb-4">
<div class="card-header h6 mb-0 bg-none p-3" style="border-bottom: 1px solid #ff5b57;">
<i class="fa fa-calendar fa-lg fa-fw text-dark text-opacity-50 me-1"></i> UPCOMING ANNIVERSARY
</div>
<div class="card-body">
<?php
foreach ($empAnnData as $empa) {
$empId = $empa['id'];
$getImgQuery = "select document from `grp_document_files` WHERE `employee_id`='$empId' and `document_name`='Profile Picture'";
$getImgData = $conn->query($getImgQuery);
$getImgData1 = $getImgData->fetch_assoc();
?>
<div class="recent-content">
<?php if ($getImgData1['document'] != '') { ?>
<img src="uploads/recent-post1.jpg" alt="RecentPost" width="72" height="72">
<?php } else { ?>
<img src="uploads/<?php echo $empa['gender']; ?>.png" alt="RecentPost" width="72" height="72">
<?php } ?>
<h3><?php echo $empa['name']; ?> | <?php echo $empa['department']; ?></h3>
<a href="#" contenteditable="false" class="datee"><?php echo date('d M', strtotime($empa['anniversary_date'])); ?></a>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<style>
.recent-content {
padding-bottom: 20px;
position: relative;
padding-left: 60px;
border-bottom: 1px solid #ccc;
}
.recent-content img {
position: absolute;
left: 0px;
top: 2px;
width: 50px;
height: 50px;
vertical-align: middle;
}
.recent-content h3 {
margin: 0;
font-size: 13px;
color: #222;
text-transform: uppercase;
line-height: 20px;
}
.datee {
color: #feca16;
font-size: 12px;
letter-spacing: 0.84px;
line-height: 20px;
text-decoration: none;
text-transform: uppercase;
cursor: pointer;
font-weight: bold;
}
</style>
</div>
<?php require('include/footer-data.php'); ?>