<? global $vis_language;

if($assets_details==-1){ 
	 ?>	<section class="wrapper fullFrame" id="no_record_found" <? if($assets_details!=-1) echo 'style="display:none;"'; ?>>
				   <div class="fullMiddle m-xl text-center h4"><?= $vis_language['TXTNOTHINGTODISPLAY']; ?></div>
       </section>			
 <?
	if(!isset($view_only)) {echo '<script> $("#view_action").hide(); $("#vis_assets_form .panel-footer").hide(); $("#vis_assets_list").hide(); $(".fullFrame").removeClass("b-t").addClass("m-t-lg m-b-lg"); </script>';}
 } else { ?>

				
				
				
<section class="container m-t-md">
  
					<!--<form class="form-horizontal" name="vis_submit_ticket" method="post">-->
	<div class="list-unstyled padder m-b-none table-responsive scroll-x">
	<div class="m-r-n m-l-n">
		  <table class="table table-hover m-b-none" data-ride="datatables" style="font-size: 14px;">
   <thead class="table_head">
      <tr>
		
         <th><? echo $vis_language['TXTNAME']; ?></th>
		 <th class="txt_nowrap"><? echo $vis_language['TXTCITYPE'];?></th>
		 <th class="txt_nowrap"><? echo $vis_language['TXTDEPARTMENT']; ?></th>
		 <th class="txt_nowrap"><? echo $vis_language['TXTLOCATION']; ?></th>
		
		 <th class="txt_nowrap"><? echo $vis_language['TXTSTATUS']; ?></th>
        
      </tr>
   </thead>
   <tbody>
      <?
	  	 for($i=0;$i<count($assets_details);$i++) {
			//echo "assets_details   ==>"; echo  $assets_details[$i]['assets_id'];
			 
			 if($assets_details[$i]['staff_id']==''){
			 	$managed_by = '---';
			 }else{
			 	$managed_by = $assets_details[$i]['first_name'].' '.$assets_details[$i]['last_name'];
			 }
			 
			 echo "<tr>";
			echo '<td><a href="?/cmdb/cmdb_assets_details/'.rawurlencode(str_replace('/', ' ', $assets_details[$i]['name']).'/'.$assets_details[$i]['assets_id']).'">'.$assets_details[$i]['name'].'</a></td>';
			echo '<td><a href="?/cmdb/cmdb_assets_details/'.rawurlencode(str_replace('/', ' ', $assets_details[$i]['name']).'/'.$assets_details[$i]['assets_id']).'">'.$assets_details[$i]['CNAME'].'</a></td>';
			echo '<td><a href="?/cmdb/cmdb_assets_details/'.rawurlencode(str_replace('/', ' ', $assets_details[$i]['name']).'/'.$assets_details[$i]['assets_id']).'">'.$assets_details[$i]['domain_name'].' : '.$assets_details[$i]['department_name'].'</a></td>';
			echo '<td><a href="?/cmdb/cmdb_assets_details/'.rawurlencode(str_replace('/', ' ', $assets_details[$i]['name']).'/'.$assets_details[$i]['assets_id']).'">'.$assets_details[$i]['LNAME'].'</a></td>';
			
			
			$is_expired ='--';
			if($assets_details[$i]['ci_type_id']==2 || $assets_details[$i]['ci_type_id']==3){
				$total_month = ($assets_details[$i]['warranty_year']*12)+$assets_details[$i]['warranty_month'];
				$current_date = strtotime(date('Y-m-d h:i:s'));
				$expiry_date = strtotime(date('Y-m-d h:i:s', $assets_details[$i]['installation_date']) . $total_month.' month');
				if($expiry_date <= $current_date){
					$is_expired='<span style="background-color: #e33244; color: #fff; font-weight: normal" class="btn btn-xs l-h-1x text-xs">'.$vis_language['TXTITILEXPIRED'].'</span>';
				}
			}
			echo '<td>'.$is_expired.'</td>';
			?></tr> 
			
			<!--<div class="col-lg-offset-2 col-lg-8 m-b-lg">
			
			
                          <button type="submit" class="btn btn-primary"><? echo $vis_language['TXTADD']; ?></button>
						  <input type="hidden" name="vis_operation" value="add_client" />
						  <input type="hidden" name="vis_module" value="client" /><input type="hidden" name="vis_client_id" value="<? echo $parent_id; ?>" />
					</div>-->
			
			
	  <? } ?>
   </tbody>
</table>
		</div>
			</div>
	        <!-- /.col-md-12 -->
                    
                  
                   <!-- </form>-->
               
               
            <!-- / .panel -->
		<!-- /.row -->
 </section> <!-- / .panel -->
<? } ?>
<script type="text/javascript">
   $(".selectpicker").selectpicker(); 
   $(document).ready(function() {	
   $('[data-ride="datatables"]').dataTable({		
          "bPaginate" : false,	
   		"sDom": 't', "bAutoWidth": false,
   		"aoColumns": [
   			<? if(!isset($view_only)){?>{ "bSortable": false },<?php }?>
   		  	null,
   		  	null,
   		  	null,
   		  	null,
			null
			<? if(!isset($view_only)){?>,	{ "bSortable": false }<?php }?>
   		]
   	});
   });
</script>

