
 
         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid2").val(itemid); 
		  
		  
		   
        });
		
		
		
		
    </script>   
 
 <div class="row">
  	<?PHP
//
 $session_data = $this->session->userdata('logged_in');

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

 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	  echo $this->session->flashdata('deletemsg'); 

				echo $this->session->flashdata('msg'); 
								?>	
   	

   	<div class="col-md-12">

  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>

 <a href="<?php echo base_url();?>user/startsales" class="btn btn-info">  Go back</a>	
            	 <a href="<?php echo base_url();?>user/downloadloggs" class="btn btn-info">Download all loggs </a>	

	  	 <a data-toggle='modal' data-target='#downloadModal' class="btn btn-info">Download loggs by date </a>


 

				
            	</div>
            </div>
			<div class="panel-body">

			
	<div class="widget-content nopadding table_holder table-responsive">				
				<?PHP


								?>	
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	<div class="col-md-12">
	ALL  ACTIVITIES LOGGS
        <?php 
		 echo $this->session->flashdata('msg'); 
        $attr = array("class" => "form-horizontal", "role" => "form", "id" => "search", "name" => "search");
        echo form_open("user/searchallactivities", $attr);?>
            <div class="form-group">
			
                <div class="col-md-5">
                    <input class="form-control" id="searchterm" name="searchterm" placeholder="Search for members.." type="text" value="<?php echo set_value('searchterm'); ?>" />
                </div>
                <div class="col-md-4">
                    <input id="btn_search" name="btn_search" type="submit" class="btn btn-success" value="Search" />
                    <a href="<?php echo base_url(). "user/activityloggs"; ?>" class="btn btn-primary">Refresh</a>
                </div>
				 
            </div>
        <?php echo form_close(); ?>
        </div>
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
    <th>#</th>
     <th>Name</th>
	     <th>Date & Time</th>
<th>Ip Address</th>	
<th>Activity</th>
		<?php
										if($usertype=="superadmin"){
											
											?>
	<th>More</th>	
		<?php
										}
											
											?>

                 </tr>
             </thead><tbody>
<?php

 if(!is_array($loggs)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($loggs as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


?>

              
 <td><?php echo $c->id ; ?></td>
  <td><?php 
  
  $mycustomer=$this->usermodel->populateallarray('people','id', $c->userid);

$surname=$mycustomer[0]['surname'];
			//echo$myname=$mycustomer[0]['firstname']." ".$surname ;
  			echo$myname=$mycustomer[0]['firstname']." ".$surname ."(".$c->userid .")";

  ?></td>
    <td><?php echo $c->timedone ; ?></td>
	 <td><?php echo $c->ip ; ?></td>
	  <td><?php echo $c->actiondone ; ?>
	  										
	  
	  
	  
	  
	  
	  
	  
	  
	  </td>
	 
	 			<?php
										if($usertype=="superadmin"){
											
											?>
  <td> 

     <!--
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
						
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                 
                                      
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#myModals<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Clear Log
                                                </a>
                                                        </li>
									
									

                                        
                                    </ul>
										
                                </div>
						-->		
						
</td>
		<?php
										}
										?>	 
 
             </tr>

	<?php endforeach;} ?>

         

       <tbody> </table>
	   
        <div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "   Loggs. " ;?>   </span>

        
        </div>
   
			
	</div>
						
									
							</div>
						</div>
				

			
			</div>
		</div>
  
  </div>
			
			
			
			
	
	<div id="downloadModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Download stock</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to download  the loggs with this below date range? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
		
		  $todate=date("Y-m-d 23:59:59");
 $fromdate=date("Y-m-d 00:00:00");
		
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/downloadloggsbydate' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>


	

  
	
  <div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdate); ?>" class="form-control" required placeholder="Enter start date">
		 

		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
	

		</span>
	</div>
  </div>
  


<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$todate); ?>" class="form-control" required placeholder="Enter end date">
		 

		<span class="text-danger"> <?php echo form_error('todate'); ?>
	

		</span>
	</div>
  </div>
  




 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="products">

<input type="hidden" name="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproducts" id="view" class="form-control" required placeholder="Enter view">

 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="downtock" value="download" class="btn btn-info"> Download Now  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>				
	
	
	
	

						<div id="myModals" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Cancel</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to Cancel this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deletelogsbyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="activityloggs">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/activityloggs">
 <input type="hidden" id="itemid2"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>
		
		















	
		
		
		
		
		
		
		
		
		
		
		
  

 
</div>




</div>













