<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<? 

   $link=array(1=>$vis_language['TXTRELATESTO'],2=>$vis_language['TXTISRELATEDTO'],3=> $vis_language['TXTISAPARENTOF'],4=>$vis_language['TXTISACHILDOF'],5=>$vis_language['TXTDEPENDSON'],6=>$vis_language['TXTISDEPENDEDON'],7=>$vis_language['TXTDUPLICATES'],8=>$vis_language['TXTISADUPLICATEDBY']);
   
    global $vis_language;
    $html='';   
    //print_r($post_details);
   // echo "in".$l=$link[$post_details[$i]['link_type']];
    if($post_details!=-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['TXTTICKETHASH']; ?></th>
		    <th><? echo $vis_language['TXTSUBJECT']; ?></th>
			<th><? echo $vis_language['TXTCREATEDON']; ?></th>
			<th><? echo $vis_language['TXTCLIENTNAME']; ?></th>			
			<th><? echo $vis_language['TXTEMAIL']; ?></th>
			<th><? echo $vis_language['TXTORGN']; ?></th>
			<th><? echo $link[$post_details[0]['link_type']]; ?></th>
		
					
		</tr>		
		</thead>
		<tbody>		
     <?  
     
         for($i=0;$i<count($post_details);$i++) {
	 			if($post_details[$i]['first_name'] =='' && $post_details[$i]['last_name']=='')
					$client_name = '-';
				else
					$client_name = $post_details[$i]['first_name'].' '.$post_details[$i]['last_name'];
				
					
            $html.='<tr><td><a href="#/ticket/ticket_details/'.$post_details[$i]['ticket_hash'].'/'.$post_details[$i]['ticket_id'].'">'.$post_details[$i]['ticket_hash'].'</a></td><td>'.$post_details[$i]['subject'].'</td><td>'.format_datetime($post_details[$i]['receive_date']).'</td><td>'.$client_name.'</td><td>'.$post_details[$i]['email'].'</td><td>'.$post_details[$i]['group_name'].'</td><td>'.$post_details[$i]['link_ticket_hash'].'</td>';
			
            
			$html.='</tr></span>';
			
        }  		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_link_type=<? echo $data['vis_link_type'];?>&domain_id=<? echo $data['domain_id'];?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=60" 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_link_type=<? echo $data['vis_link_type'];?>&domain_id=<? echo $data['domain_id'];?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=60" onclick="" type="button"><? echo $vis_language['TXTSCHEDULE']; ?></a>');
		</script> <?
    }   
    else  {
		 $operation['no_record']=1;
         include(VIS_PATH_TEMPLATE.'no_record_yet.php');
        ?>
             <script> $("#vis_export_rpt_<?= $operation['vis_operation'] ?>").hide();
               $("#vis_schedule_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>
