File: /var/www/html/pmw24/app/application/views/admin/layouts/header_21_08_2019.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Punjab motor works</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo base_url()?>/public/admin_assets/images/favicon-32x32.png">
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="<?php echo base_url()?>/public/admin_assets/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="<?php echo base_url()?>/public/admin_assets/plugins/datatables/dataTables.bootstrap.css">
<link rel="stylesheet" href="<?php echo base_url()?>/public/admin_assets/plugins/datatables/buttons.dataTables.min.css">
<link rel="stylesheet" href="<?php echo base_url()?>public/admin_assets/plugins/select2/select2.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="<?php echo base_url()?>/public/admin_assets/dist/css/AdminLTE.min.css">
<link rel="stylesheet" href="<?php echo base_url()?>/public/admin_assets/dist/css/skins/_all-skins.min.css">
<link rel="stylesheet" href="<?php echo base_url()?>/public/admin_assets/dist/css/responsive.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.mtbresize {
margin: 0 auto;
width: 800px;
}
.error{color:red;}
.cstm_view{
font-size:20px;
}
.hite{
height:50px;
width:900px;
}
.superr{
color:red;
font-size:18px;
top: -.1px;
}
.headre{
color: #fff;
position: absolute;
left: 0;
right: 0;
top: 9px;
text-align: center;
font-size: 19px;
font-weight: 700;
pointer-events: none;
}
.mark_read_btn
{
position: relative;
top: -30px;
right: 3px;
cursor: pointer;
float: right;
background: #367fa9;
color: #fff;
padding: 3px 5px;
}
.notifications-menu .dropdown-menu {
width: 384px !important;
}
.admin_tab ul{padding-left:0;}
.admin_tab ul li{display:inline-block;list-style:none;width:9%;text-align:center;}
.admin_tab ul li a{color:#fff;background:#367fa9;padding:6px 12px;border-radius:3px;display:block;margin-right:10px;}
.admin_tab ul li a:hover{background:#367fa9;}
.admin-tab-wrapper{padding:7px 10px;background:#fff;}
</style>
<!-- jQuery 2.2.3 -->
<script src="<?php echo base_url()?>/public/admin_assets/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="<?php echo base_url()?>/public/admin_assets/bootstrap/js/bootstrap.min.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="<?php echo base_url('admin');?>" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>A</b>DP</span>
<!-- logo for regular state and mobile devices -->
<img src="<?php echo base_url().'public/admin_assets/images/Logo.png';?>" style="width:35px;">
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<span class="headre">Punjab motor works </span>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown notifications-menu">
<?php
$date = date('Y-m-d');
//$date = '2018-11-28';
$CI =& get_instance();
$CI->db->select('*');
// $CI->db->from('job_service_date');
// $CI->db->join('job','job.job_id=job_service_date.job_id','left');
// $CI->db->join('job_services','job_services.job_id=job_service_date.job_id','left');
// $CI->db->join('car','car.car_id=job_service_date.car_id','left');
// $where = "(next_service_date='".$date."' OR next_service_date_reminder_before_seven ='".$date."' OR next_service_date_before_three ='".$date."') AND job_services.service_id IN ('7,8,20')";
$CI->db->from('job_service_date_specific');
$CI->db->join('car','car.car_id=job_service_date_specific.car_id','left');
$CI->db->join('service','service.service_id=job_service_date_specific.service_id','left');
$where = "(next_service_date='".$date."' OR next_service_date_reminder_before_seven ='".$date."' OR next_service_date_before_three ='".$date."') AND job_service_date_specific.service_id IN ('7,8,20')";
$CI->db->where($where);
$query=$CI->db->get();
$jobs = $query->result_array();
////////notification count for accept reject////////////////////////////////////////////////////////////
$notification_count = 0;
$CI1 =& get_instance();
$CI1->db->select('*');
$CI1->db->from('notification');
$where1 = "is_read='0' and type='2'";
$CI1->db->where($where1);
$query1=$CI1->db->get();
$notification_count=$query1->num_rows()+count($jobs);
$CI2 =& get_instance();
$CI2->db->select('*');
$CI2->db->from('notification');
$where2 = "type='2'";
$CI2->db->where($where2);
$CI2->db->order_by("is_read","asc");
$query2=$CI2->db->get();
$notification=$query2->result_array();
/////////////for noti array//////////////////////////
?>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning total_noti_count" id="total_noti_count"><?php echo $notification_count;?></span>
</a>
<ul class="dropdown-menu" style="width: auto; height: auto !important;">
<li class="header">You have <span class="total_noti_count"><?php echo $notification_count; ?></span> unread notifications</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<?php foreach($jobs as $job){?>
<li>
<a href="<?php echo base_url();?>admin/servicedue">
<i class="fa fa-lightbulb-o"></i> <?php echo $job['car_no'];?> next service date - <?php echo date("d/m/y",strtotime($job['next_service_date']))." (".$job['service_name'].")";?>
</a>
</li>
<?php } ?>
<?php foreach($notification as $noti){
$noti_details_arr = array();
$CI2 =& get_instance();
$CI2->db->select('job.job_id,car.car_no,job.service,job.job_status');
$CI2->db->from('job');
$CI2->db->join('car','car.car_id=job.car_id','left');
$where2 = "job.job_id='".$noti['details_id']."'";
$CI2->db->where($where2);
$query2=$CI2->db->get();
$noti_details_arr = $query2->result_array();
if($noti['type']==2)
{
$link=base_url('admin/job/rejectlist/'.$noti['details_id']);
}
else
{
$link=base_url('admin/job/');
}
if($noti['is_read']==0)
{
$class="background-color:#D3D3D3";
}
else
{
$class="";
}
?>
<li style="<?php echo $class; ?>" id="noti_<?php echo $noti['id'];?>">
<a href="javascript:void(0);" onclick="noti_redirect('<?php echo $noti['id']; ?>','<?php echo $link; ?>');">
<i class="fa fa-lightbulb-o"></i> <?php echo $noti_details_arr[0]['car_no'].'- '.$noti['description'];?>
</a>
<?php if($noti['is_read']==0){ ?>
<span class="btn btn-default mark_read_btn" onclick="update_status(<?php echo $noti['id'];?>);">Read</span>
<?php } ?>
</li>
<?php } ?>
</ul>
</li>
</ul>
</li>
<?php $admin=$this->session->userdata('admin'); ?>
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<?php if(!empty($admin['profile_image'])){?>
<img src="<?php echo base_url()?>public/admin_assets/images/profilepics/<?php echo $admin['profile_image'];?>" class="user-image" alt="User Image">
<?php }else{?>
<img src="<?php echo base_url()?>public/admin_assets/images/profilepics/Dummy.jpg?>" class="user-image" alt="User Image">
<?php }?>
<span class="hidden-xs"><?php echo $admin['name'];?></span>
</a>
<ul class="dropdown-menu">
<li class="user-header">
<?php if(!empty($admin['profile_image'])){?>
<img src="<?php echo base_url()?>public/admin_assets/images/profilepics/<?php echo $admin['profile_image'];?>" class="img-circle" alt="User Image">
<?php }else{?>
<img src="<?php echo base_url()?>public/admin_assets/images/profilepics/Dummy.jpg" class="img-circle" alt="User Image">
<?php }?>
<p>
<?php echo $admin['name'];?>
<small><?php echo $admin['email'];?></small>
</p>
</li>
<li class="user-footer">
<!--<div class="pull-left">
<a href="<?php echo base_url('admin/settings/profile');?>" class="btn btn-default btn-flat">Profile</a>
</div>-->
<div class="pull-right">
<a href="<?php echo base_url('admin/logout');?>" class="btn btn-default btn-flat">Sign out</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<script type="text/javascript">
function noti_redirect(id,link)
{
update_status(id);
window.location.href=link;
}
function update_status(id)
{
var noti_existing_count=$('#total_noti_count').html();
if(noti_existing_count>0)
{
// alert(noti_existing_count);
var new_noti_count=parseInt(noti_existing_count)-1;
//alert(new_noti_count);
}
else
{
var new_noti_count=0;
}
$.ajax({
type: "POST",
url: '<?php echo base_url('admin/job/update_status')?>',
data: 'id='+id,
dataType:'json',
success: function(response){
$('#noti_'+id).css("background-color", "");
$('.dropdown notifications-menu').addClass('open');
$('.total_noti_count').html(new_noti_count);
$('#noti_'+id+' .mark_read_btn').hide();
}
});
}
</script>