<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<?
    global $vis_language;
    if(isset($surveyList) && $surveyList!=-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['TXTCLIENT']; ?></th>
		<th><? echo $vis_language['TXTEMAIL']; ?></th>	
		<th><? echo $vis_language['TXTORGN']; ?></th>
		<th><? echo $vis_language['TXTSURVEY']; ?></th>	
		<th><? echo $vis_language['TXTSURVEYDATE']; ?></th>
		<th></th>
		<th></th>				
		</tr>
		</thead>
		<tbody>	
		<?
        for($i=0;$i<count($surveyList);$i++) {
            echo '<tr><td><a href="#/client/client_details/'.$surveyList[$i]['first_name'].' '.$surveyList[$i]['last_name'].'/'.$surveyList[$i]['client_id'].'">'.$surveyList[$i]['first_name'].' '.$surveyList[$i]['last_name'].'</a> </td><td><a href="#/client/client_details/'.$surveyList[$i]['first_name'].' '.$surveyList[$i]['last_name'].'/'.$surveyList[$i]['client_id'].'">'.$surveyList[$i]['email'].'</a></td><td>'.$surveyList[$i]['group_name'].'</td><td>'.$surveyList[$i]['customgroup_name'].'</td><td>'.format_datetime($surveyList[$i]['entry_date']).'</td>'; ?>
			<td><a class="text-muted link" data-toggle="ajaxModal" data-modal-arguments="vis_module=report&vis_operation=display_client_survey&vis_client_id=<? echo $clientId ?>&vis_survey_id=<? echo $surveyList[$i]['customgroup_id']; ?>&vis_static_area=vis_survey_display_form" title="<? echo $vis_language['TXTVIEW']; ?>" href="javascript:void(0);" ><?  echo $vis_language['TXTVIEW']; ?></a></td><td><a href="index.php?vis_module=report&vis_operation=export_survey&vis_type=pdf&vis_client_id=<? echo $clientId; ?>&vis_survey_id=<? echo $surveyList[$i]['customgroup_id']; ?>&vis_survey_dt=<? echo format_datetime($surveyList[$i]['entry_date']); ?>" target="_blank" class="link"><? echo $vis_language['TXTEXPORTTOPDF']; ?></a>
			</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 $data['from_date']; ?>&to_date=<? echo $data['to_date'];?>&domain_id=<? echo $data['domain_id'];?>&survey_id=<? echo $data['survey_id'];?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=13" 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 $data['from_date']; ?>&to_date=<? echo $data['to_date'];?>&domain_id=<? echo $data['domain_id'];?>&survey_id=<? echo $data['survey_id'];?>&vis_client_id=<? echo $data['vis_client_id'];?>&vis_criteria=<? $data['vis_criteria'];?>&report_type=13" 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>
