<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
				<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title> POS</title>
		
		<meta name="description" content="<?php echo $this->lang->line('header_desc'); ?>">
		<meta name="keywords" content="<?php echo $this->lang->line('header_keywords'); ?>">
			
		 <style type="text/css">
  
  

    #printable { display: none; }

    #myprint { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;12px;
  
    


}


#sale{  	
background-image:url(images/add.png) ;

    background-repeat: no-repeat;
  
    width:100px; height:50px;


}
    
    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:16; width:100%; }
		    	#myprint { display: block; font-size:16; width:100%; }

    }
    </style>

			 <link rel="stylesheet" id="non-printable"  href="<?php echo base_url(); ?>assets/bootstrap/css/tcal.css">
			<script src="<?php echo base_url(); ?>assets/bootstrap/css/tcal.js"></script>
		<!--
		<link rel="stylesheet" id="non-printable"  href="<?php echo base_url(); ?><?php echo base_url(); ?>css/bootstrap-theme.css">
	     <link rel="stylesheet" id="non-printable"  href="<?php echo base_url(); ?><?php echo base_url(); ?>css/bootstrap-theme.min.css">
		-->		<link id="non-printable"  href="<?php echo base_url(); ?>assets/bootstrap/css/bootstrap.css" rel="stylesheet">
		<link id="non-printable"  href="<?php echo base_url(); ?>assets/bootstrap/css/dashboard.css" rel="stylesheet">

		
		<link id="non-printable"  href="<?php echo base_url(); ?>assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link id="non-printable"  href="<?php echo base_url(); ?>assets/bootstrap/css/simple-sidebar.css" rel="stylesheet">
    <link id="non-printable"  href="<?php echo base_url(); ?>assets/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	 <script src="<?php echo base_url(); ?>assets/bootstrap/js/jquery-3.1.1.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/bootstrapjs/bootstrap.min.js"></script>
   				<script src="<?php echo base_url(); ?>js/all.js?14.1" type="text/javascript" language="javascript" charset="UTF-8"></script>

		    <script src="<?php echo base_url(); ?>application/js/loader.js"></script>

		

	

		

		<!-- end CSS-->

		
		
		
		
		
					
		

	
		
		
		
		
		
	<title>Home</title>
	
	
	

</head>

<?PHP

 echo $this->session->flashdata('imagemsg1'); 
		 
		    
$session_data = $this->session->userdata('logged_in');


$data['surname'] = $session_data['surname'];
$data['id'] = $session_data['id'];

$surname=$data['surname'];
   $userid=$data['id'];
      $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
$data['usertype'] = $session_data['usertype'];
   $usertype=$data['usertype'];

 $data['branchid'] = $session_data['branchid'];
	 $branch = $data['branchid'];
	 		        		$myconfiguration = $this->usermodel->populateallarray('smsconfig','id',$companyid);
$starthappyhour=$myconfiguration[0]["starthappyhour"];
$endhappyhourse=$myconfiguration[0]["endhappyhourse"];

 $statushappyhour=$myconfiguration[0]["statushappyhour"];
				  $currenttime=date("H:i");

	

?>


<body>
    <nav class="navbar navbar-default no-margin">
    <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header fixed-brand">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"  id="menu-toggle">
                      <span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>
                    </button>
                    <a class="navbar-brand" id="non-printable"  href="#"><i class="fa fa-rocket fa-4"></i><span style="color:black"> POS</span></a>
																					
																						     <a id="non-printable"   href="<?php echo base_url(); ?>user/logout">Logout</a>



                </div><!-- navbar-header-->
 
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
     <span class="pull-right"> <a id="non-printable" class="btn btn-info"  href="<?php echo base_url(); ?>user/logout">Logout</a></span>	
    

						   <ul class="nav navbar-nav">
                                <li class="active" ><button class="navbar-toggle collapse in" data-toggle="collapse" id="menu-toggle-2"> <span class="glyphicon glyphicon-th-large" aria-hidden="true"></span></button>
								
								</li>
								
                            </ul>
							<ul class="nav navbar-nav">
                                	<li class="btn  hidden-xs">

				<i class="active"></i> <span class="text">	 
				<?php
				

					//$profile= $this->studentprofilemodel->populateimages($userid);
				$profile = $this->usermodel->populateall('smsconfig','id',$companyid);

	
		if(!is_array($profile)) 

 {
	 $this->session->set_flashdata('msg', '<div class="alert alert-danger fade in">
						 <a id="non-printable"  href="#" class="close" data-dismiss="alert">&times;</a><strong>Error!</strong>Please make sure you fill in your bio data first for you to upload your profile</div>');
							

    }else {

    
          
  	foreach ($profile as $c): 
$photo= $c->logo;
		 	if($photo!=""){
		 
		 
		
		
	
			
		
		$img=$c->logo;
	
		$img1='uploads/';
	$url = base_url().$img1.$img;

 
 ?>
<a id="non-printable"  href="<?php echo base_url(); ?>user/profileform"><img class="img-circle" src="<?php echo $url ?>" height="40" width="40" style="border-radius:15px; max-height:300px; margin:2px;  border-color:#000066;box-shadow:0 2px 4px rgba(30,30,30,0.5)inset; ">		</a>	 





	 <?php }else{
		 ?>
				<a id="non-printable"  href="<?php echo base_url(); ?>user/profileform" ><img class="img-circle" src="<?php echo base_url(); ?>images/img/default.jpg"   height="40" width="40" style="border-radius:15px; max-height:300px; margin:2px; border-color:#000066;box-shadow:0 2px 4px rgba(30,30,30,0.5)inset;"></a>

				<?php
	 }
		 endforeach; ?>

              <?php }?>

				
				</b></span>
				</li>
				  <li>
                    <a id="non-printable"  href="<?php echo base_url(); ?>user/profileform"> Welcome <?php echo$surname;?> To 
	<?php 
					// $branch="";
					 

					 $branch= $this->usermodel->populateall('branch','id',$branch);



if(is_array($branch)) {

   foreach($branch as $branchrow){

   echo $branchrow->name;
 
 
}} else {
    echo 'Main.';
}
	
?>

	</a>

                </li>
				
				
				
								
                            </ul>
                </div>
						
    </nav>
    <div id="wrapper" class="toggled-2">
        <!-- Sidebar -->
        <div id="sidebar-wrapper" class="toggled-2">
            <ul class="sidebar-nav nav-pills nav-stacked" id="menu">
 
                <li class="active">
                    <a id="non-printable"  href="<?php echo base_url(); ?>user/home"><span class="fa-stack fa-lg pull-left"><i class="fa fa-dashboard fa-stack-1x "></i></span> Dashboard <?php  echo "(No ".$userid.")";?></a>
                   
                </li>
                      <?php   
					 
					$allmodules= $this->usermodel->populatealldata('modules','sort','DESC');

   foreach($allmodules as $module) { 
    $moduleid=$module->id;
  
  $permissions= $this->usermodel->populatuserpermissions($moduleid,$userid);

  ?>
     <?php
	  if($permissions==true){
		     ?>
	<?php
	
	if($statushappyhour=="yes")
{
	
		
if($moduleid=="wholesale")
{
	
	if(($starthappyhour  <=   $currenttime) &&($currenttime <=  $endhappyhourse)){
		
	
?>
					<li class="active" ><a id="non-printable"  href="<?php echo base_url("$module->url");?>"><i class="fa fa-<?php echo $module->icon; ?>"></i>       <span class="hidden-minibar"><?php echo $module->name ?></span></a></li>
<?php

	}
	
	
}
}else{
if($moduleid=="wholesale")
{
	
	?>
					<li class="active" ><a id="non-printable"  href="<?php echo base_url("$module->url");?>"><i class="fa fa-<?php echo $module->icon; ?>"></i>       <span class="hidden-minibar"><?php echo $module->name ?></span></a></li>
<?php
}
}
if($moduleid !="wholesale")
{
	if(($statushappyhour=="yes") &&($moduleid =="sales") && ($starthappyhour  <=   $currenttime) &&($currenttime <=  $endhappyhourse)){

		}else{
	
	
	
?>
					<li class="active" ><a id="non-printable"  href="<?php echo base_url("$module->url");?>"><i class="fa fa-<?php echo $module->icon; ?>"></i>       <span class="hidden-minibar"><?php echo $module->name ?></span></a></li>
<?php
	}
}else{
		
}
	  }
		      ?>
			  
				<?php } ?>
							   <?php
	  if($usertype=="superadmin"){
		     ?>
					<li class="active">
						                    <a id="non-printable"  href="<?php echo base_url(); ?>user/viewemployee"><span class="fa-stack fa-lg pull-left"><i class="fa 	fa fa-rss-square fa-stack-1x "></i></span>User Roles</a>
					</li>
	<?php
		
	  }
	  
	  
	  ?>
  			
			<li class="active">
                    <a id="non-printable" class="btn btn-warning" href="<?php echo base_url(); ?>user/logout"><span class="fa-stack fa-lg pull-left"><i class="fa fa fa-lock fa-stack-1x "></i></span>Log out</a>
                </li>	
						

		   </ul>
        </div><!-- /#sidebar-wrapper -->
        <!-- Page Content -->
        <div id="page-content-wrapper">
            <div class="container-fluid xyz">
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			





		

