<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<?  
    global $vis_language;
    $html='';
	if($report!=-1) {
		 ?>
	
<table cellpadding="0" cellspacing="0" border="0" class="table table-hover b-t b-light m-b-none" id="datatable">
		<thead class="table_head">
	     <tr>
		    <th><? echo $vis_language['TXTNAME']; ?></th>
			<th><? echo $vis_language['TXTCITYPE']; ?></th>
			<th><? echo $vis_language['TXTDEPARTMENT']; ?></th>
			<th><? echo $vis_language['TXTLOCATION']; ?></th>
			<th><? echo $vis_language['TXTMANAGEDBY']; ?></th>
   <th><? echo $vis_language['TXTUSEDBY']; ?></th>
   <th><? echo $vis_language['TXTEXPIRYDATE']; ?></th>        
		</tr>		
		</thead>
		<tbody>	
		  <?  for($i=0;$i<count($report);$i++) {
		  		if($report[$i]['staff_id']===''){
					$managed_by = '---';
				}else{
					$managed_by = $report[$i]['first_name'].' '.$report[$i]['last_name'];
				}
		  		$html.='<tr><td><a href="#/cmdb/cmdb_assets_details/'.str_replace('/', ' ', $report[$i]['name']).'/'.$report[$i]['assets_id'].'">'.$report[$i]['name'].'</a></td><td>'.$report[$i]['CNAME'].'</td><td>'.$report[$i]['domain_name'].' : '.$report[$i]['department_name'].'</td><td>'.$report[$i]['LNAME'].'</td><td>'.$managed_by.'</td><td>'.$report[$i]['used_by'].'</td>';
					
				if($report[$i]['status']!='--')	
				{					
					$html.='<td><span style="background-color: #e33244; color: #fff; font-weight: normal" class="btn btn-xs l-h-1x text-xs">'.$report[$i]['status'].'</span></td>';
				}
				else
				{		
					$html.='<td>'.$report[$i]['status'].'</td>';
				}
			
			  	$html.='</tr>';
			 
			 } echo $html;?>
        </tbody>		
 
</table>
         
		  
        <script>
			$("#vis_export_rpt_<?= $operation['vis_operation'] ?>").show(); 
		    $("#vis_export_rpt_<?= $operation['vis_operation'] ?>").html('<a href="javascript:void(0);" class="vis_button_export btn btn-primary btn-sm" data-toggle="ajaxModal" data-modal-arguments="vis_module=report&vis_operation=add_report_inqueue&vis_static_area=vis_open_new_dialog&duration=<? echo $data['duration']; ?>&from_date=<? echo strtotime($data['from_date']); ?>&to_date=<? echo strtotime($data['to_date']);?>&vis_asset_id=<? echo $data['vis_asset_id'];?>&vis_ci_type=<? echo $data['vis_ci_type'];?>&vis_criteria=<? $data['vis_criteria'];?>&location_id=<? echo $data['location_id'];?>&report_type=72" onclick="" type="button"><? echo $vis_language['TXTEXPORT']; ?></a>'); 
		    
		    $("#vis_schedule_rpt_<?= $operation['vis_operation'] ?>").show(); 
		    $("#vis_schedule_rpt_<?= $operation['vis_operation'] ?>").html('<a href="javascript:void(0);" class="vis_button_export btn btn-primary btn-sm" data-toggle="ajaxModal" data-modal-arguments="vis_module=report&vis_operation=add_schedule_report_inqueue&vis_static_area=vis_open_new_dialog&duration=<? echo $data['duration']; ?>&from_date=<? echo strtotime($data['from_date']); ?>&to_date=<? echo strtotime($data['to_date']);?>&vis_asset_id=<? echo $data['vis_asset_id'];?>&vis_ci_type=<? echo $data['vis_ci_type'];?>&vis_criteria=<? $data['vis_criteria'];?>&location_id=<? echo $data['location_id'];?>&report_type=72" onclick="" type="button"><? echo $vis_language['TXTSCHEDULE']; ?></a>'); 
		  </script> 
		 
		  
		<? 
    }   
    else  {
		 $operation['no_record']=1;
         include(VIS_PATH_TEMPLATE.'no_record_yet.php');
        ?>	<script> $("#vis_schedule_rpt_<?= $operation['vis_operation'] ?>").hide();</script>
             <script> $("#vis_export_rpt_<?= $operation['vis_operation'] ?>").hide();</script>          
        <?php
 } 
?>
	<script>
$(document).ready(function() {	
$('#datatable').dataTable({		
        "bPaginate" : true,
        "aaSorting":  [],
        "iDisplayLength": <?php echo SECURITY_DATA_PER_PAGE;?>,
		"sDom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>', 		
	    "bFilter" : false,
		"bLengthChange": false,
		"bInfo": false,
		"aoColumns": [
		  	{ "bSortable": true },			
			{ "bSortable": true },
			{ "bSortable": true },		
			{ "bSortable": true },	  
			{ "bSortable": true },
   { "bSortable": true },
			{ "bSortable": true }				
					
		]
	});
});	
</script>
