<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<? 
    global $vis_language;
    if($problems_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 colspan="2" align="center"><? echo $vis_language['TXTTOTALPOSTCOUNT'].":".$report_cnt; ?></th>
		<th colspan="1" align="center"><? echo $vis_language['TXTTOTALTICKETREPLIED'].":".count($replied).'/'.count($report); ?></th>
		<th colspan="1" align="center"><? echo $vis_language['TXTTOTALTICKETREPLIED'].":".count($replied).'/'.count($report); ?></th>
	</tr>    -->   
	<tr>
		<th><? echo $vis_language['TXTPROBLEMHASH']; ?></th>
		<th><? echo $vis_language['TXTSUBJECT']; ?></th>
		<th><? echo $vis_language['TXTCREATIONDATE']; ?></th>
		<th><? echo $vis_language['TXTDEPARTMENT']; ?></th>
		<th><? echo $vis_language['TXTCREATEDBY'];?></th>
		<th><? echo $vis_language['TXTIMPACT']; ?></th>
        <th><? echo $vis_language['TXTPRIORITY']; ?></th>
        <th><? echo $vis_language['TXTSTATUS']; ?></th>
	</tr>
    </thead>
	<tbody>
	  <?   for($i=0;$i<$problems_info['total'];$i++) {

			echo '<tr><td><a href="#/problem/problems_details/'.str_replace('/', ' ', $problems_details[$i]['problem_hash']).'/'.$problems_details[$i]['problem_id'].'">'.$problems_details[$i]['problem_hash'].'</a></td>';
			echo '<td class="txt_nowrap">'.$problems_details[$i]['subject'].'</td>';
			echo '<td class="txt_nowrap">'.format_datetime($problems_details[$i]['date_created']).'</td>';
			echo '<td class="txt_nowrap">'.$problems_details[$i]['domain_name'].' : '.$problems_details[$i]['department_name'].'</td>';
			echo '<td class="txt_nowrap">'.$problems_details[$i]['first_name'].' '.$problems_details[$i]['last_name'].'</td>';
			echo '<td class="txt_nowrap">'.$problems_details[$i]['impact_name'].'</td>';
			echo '<td class="txt_nowrap">'.$problems_details[$i]['priority_name'].'</td>';
			echo '<td class="txt_nowrap">'.$problems_details[$i]['status_name'].'</td></tr>';
        } ?>
	</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']);?>&department_id=<? echo $data['department_id'];?>&group_id=<? echo $data['group_id'];?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=17" 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']);?>&department_id=<? echo $data['department_id'];?>&group_id=<? echo $data['group_id'];?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=17" 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": [[ 2, "desc" ]],
        "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 },
   			{ "bSortable": true },
		]
	});
});	
</script>
