<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<? 
    global $vis_language;
    $start=0;
    if($report!=-1) { ?>
<style>  #vis_task_status{  display: inline;   }  </style>
<table cellpadding="0" cellspacing="0" border="0" class="table table-hover b-t b-light m-b-none" id="datatable" style="top:100px;">

<thead class="table_head">
		
		
		 
 			 <tr>
			<th><? echo $vis_language['TXTTASKTITLE']; ?></th>  
			<th><? echo $vis_language['TXTCREATIONDATE']; ?></th>
			<th><? echo $vis_language['TXTENDDATE']; ?></th>
			<th><? echo $vis_language['TXTPRIORITY']; ?></th>
			<th><? echo $vis_language['TXTSTATUS']; ?></th>
			 
			
			 
			 											
		</tr>	
</thead>	

 <?  
		   
 
		   $status = array( 1 => $vis_language['TXTINPROGRESS'], 2 => $vis_language['TXTOVERDUE'], 3 => $vis_language['TXTCOMPLETED'], 4 => $vis_language['TXTCANCELED'], 5 => $vis_language['TXTNOTSTARTED']);
		  foreach($report as $ticket_id => $details) 		  
		  { 
			  
			echo '<tr><td class="txt_nowrap">'.$details['task_title'].'</td> <td class="txt_nowrap">'.format_datetime($details['startdate']).'</td><td class="txt_nowrap">'.format_datetime($details['enddate']).'</td><td class="txt_nowrap">'.$details['title'].'</td>        ';
			
			  if($details['enddate_diff']<=0){ if($details ['task_status']!=3 && $details ['task_status']!=4){?>
				<td> <label id="vis_task_status" class="btn-xs wrapper-xxs vh-danger-bg" ><? echo $vis_language['TXTOVERDUE']; ?></label></td>
				<?} else 
				{ if($details['task_status']==1) {?>
			<td>	<label id="vis_task_status" class="btn-xs wrapper-xxs vh-success-bg"><? echo $status[$details['task_status']]; ?></label></td>
				 <?}else if($details['task_status']==3){?>
				 <td> <label id="vis_task_status" class="btn-xs wrapper-xxs vh-info-bg"><? echo $status[$details['task_status']]; ?></label></td>
				  <?}else if($details['task_status']==4){ ?>
				 <td> <label id="vis_task_status" class="btn-xs wrapper-xxs vh-grey-bg"><? echo $status[$details['task_status']]; ?></label></td><? }
				 else if($details['task_status']==5){ ?>
				 <td> <label id="vis_task_status" class="btn-xs wrapper-xs label label-default"><? echo $status[$details['task_status']]; ?></label></td><? }
				 
				 } ?>
				<?}
				else { if($details['task_status']==1) {?>
				<td><label id="vis_task_status" class="btn-xs wrapper-xxs vh-success-bg"><? echo $status[$details['task_status']]; ?></label></td>
				 <?}else if($details['task_status']==3){?>
				 <td> <label id="vis_task_status" class="btn-xs wrapper-xxs vh-info-bg"><? echo $status[$details['task_status']]; ?></label></td>
				  <?}else if($details['task_status']==4){ ?>
				 <td> <label id="vis_task_status" class="btn-xs wrapper-xxs vh-grey-bg"><? echo $status[$details['task_status']]; ?></label></td><? }
				 else if($details['task_status']==5){ ?>
				 <td> <label id="vis_task_status" class="btn-xs wrapper-xs label label-default"><? echo $status[$details['task_status']]; ?></label></td><? }
				 } ?>
	
		
		<?
		
		 
			
			//echo '<td class="txt_nowrap">' .$task_status[$details['task_status']]. '</td> ';
			 
			echo '  </tr>';
		
		} ?>
		  
               
            </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']);?>&domain_id=<? echo $data['domain_id'];?>&staff_id=<? echo VIS_STAFF_ID//$data['staff_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=73&vis_status=<? echo $data['vis_status'];?>" 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']);?>&domain_id=<? echo $data['domain_id'];?>&staff_id=<? echo VIS_STAFF_ID;?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=73&vis_status=<? echo $data['vis_status'];?>" 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();</script>
            <script> $("#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 }
		]
	});
	
});	
</script>
