<? global $vis_language;?>
<div class="m-r-n m-l-n">
  <table class="table table-hover m-b-none" data-ride="datatables">
	<thead class="table_head">
										<th><? echo $vis_language['TXTTICKETHASH']; ?></th>
										<th class="txt_nowrap"><? echo $vis_language['TXTSUBJECT']; ?></th>
										<th class="txt_nowrap"><? echo $vis_language['TXTDEPARTMENT']; ?></th>
										<th class="txt_nowrap"><? echo $vis_language['TXTSTATUS']; ?></th>
		<? if($ticket_priority !=-1) {?><th class="txt_nowrap"><? echo $vis_language['TXTPRIORITY']; ?></th><? }?>
		<? if($ticket_type !=-1) { ?>   <th class="txt_nowrap"><? echo $vis_language['TXTTYPE']; ?></th><? } ?>
										<th class="txt_nowrap"><? echo $vis_language['TXTSUBMITTEDBY']; ?></th>
										<th class="txt_nowrap"><? echo $vis_language['TXTCREATIONDATE']; ?></th>
										
	</thead>
	<tbody>
		<?php if($parentclient['department_access']!=0) $department_access=explode(',',$parentclient['department_access']); 
              else $department_access=0;
			  //print_r($ticket_details);
        if($ticket_details!=-1) for($i=0;$i<count($ticket_details);$i++){ 
            if($department_access==0 || in_array($ticket_details[$i]['department_id'],$department_access)) $access=1;
            else $access=0;
            ?>
		<tr>
            <td><a <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo $ticket_details[$i]['ticket_hash']; ?></a></td>
			
			<td><a <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo $ticket_details[$i]['subject']; ?></a></td>
			
			<td><a <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo $ticket_details[$i]['department_name']; ?></a></td>
			
			<td><a  style="color:<?php echo $ticket_details[$i]['status_color']; ?>"  <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo $ticket_details[$i]['ticket_status']; ?></a></td>
			
			<? if($ticket_priority !=-1) { ?><td><a style="color:<?php echo $ticket_details[$i]['priority_color']; ?>"  <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo $ticket_details[$i]['ticket_priority']; ?></a></td><? } ?>
			
			<? if($ticket_type !=-1) { ?><td><a <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo $ticket_details[$i]['ticket_type']; ?></a></td><? } ?>	
					
			<td><a <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo $ticket_details[$i]['first_name'].' '.$ticket_details[$i]['last_name']; ?></a></td>
			
			<td><a <? if($access==1){ ?>href="<? echo (defined('IS_WHMCS')?'supporttickets.php':'index.php'); ?>?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"<? } else{ ?> href="javascript:void(0);" onclick="$('#vis_submit_err_div').show(); $('#vis_submit_err_div').html('<? echo $vis_language['MSGACCSSDND']; ?>');" <? } ?>><? echo format_datetime($ticket_details[$i]['receive_date']); ?></a></td>
			
			
			
		</tr><? } ?>
	</tbody>
  </table>
  
 </div>
<script> $(document).ready(function() { $(".selectpicker").selectpicker(); });</script>
<script type="text/javascript">
    $(document).ready(function() {	
    	   $('[data-ride="datatables"]').dataTable({
    		"bAutoWidth": false,
            "bPaginate" : false,
            "aaSorting":  [],
    		"sDom": 't', 
    		"aoColumns": [
    		null,
    		null,
    		null,
    		null,
    		<? if($ticket_priority !=-1) {?>null,<? } ?>
    		<? if($ticket_type !=-1) { ?>null,<? } ?>
    		null,
    		null
    		]
    	});
    });
</script>
