<? global $vis_language; 
if($client_details==-1){ ?>
<?
    include(VIS_PATH_TEMPLATE.'no_record_yet.php'); 
	//echo '<script> $("#view_action").hide(); $("#vis_client_form .panel-footer").hide(); $("#vis_client_list").hide(); $(".fullFrame").removeClass("b-t").addClass("m-t-lg m-b-lg"); </script>';
 } else { ?>
<script> /*$("#view_action").show(); $("#vis_client_form .panel-footer").show(); $("#vis_client_list").show();*/ </script>
<style type="text/css">.spancolor{color:#a1a8ac; cursor:context-menu;}</style>
<table class="table table-hover b-t b-light m-b-none" data-ride="datatables">
	<thead class="table_head">
		<tr>
  <? if(!isset($operation['vis_client']) && $operation['vis_client']!=1 && $operation['vis_action']!='history'){ ?>
			<th>
				 <div class="btn-group">
               <label class="checkbox m-n m-r-sm i-checks"  style="float: left;"><input type="checkbox"><i></i></label>		
            </div>
			</th>
   <? }?>
   <th></th>
			<th><? echo $vis_language['TXTFIRSTNAME']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTLASTNAME']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTEMAIL']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTUSERNAME']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTCONTACTNUMBER']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTDOMAIN']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTORGANIZATION']; ?></th>
			<!--<th class="txt_nowrap"><? //echo $vis_language['TXTCONTACTS']; ?></th>-->
			<th class="txt_nowrap"><? echo $vis_language['TXTSTATUS']; ?></th>
			<th></th>
		</tr>
	</thead>
	<tbody>			  
	<? 
		if($client_details!=-1) for($i=0;$i<$client_info['client_count'];$i++) {
		$vis_domain =  (VIS_SATELLITE_HELPDESK == 2 || VIS_SATELLITE_HELPDESK == 3) ? $client_details[$i]['option_domain_name']:$client_details[$i]['domain_name'];
		
		$clienttype=($client_details[$i]['client_type']==1)?"<i class='vh vh-call'></i>":"<i class='vh vh-ticket'></i>";
		$clienttype_title=($client_details[$i]['client_type']==1)?"Call client":"Mail client";
		if( $client_details[$i]['is_banned']==1 ) {
			$strike='<span class="label vh-danger-bg">'.$vis_language['TXTBANNED'].'</span>';
		}else if($client_details[$i]['is_banned']!=1 && $client_details[$i]['is_spam']==1 )  {
			$strike='<span class="label vh-grey-bg ">'.$vis_language['TXTSPAM'].'</span>';
		} else  if($client_details[$i]['is_banned']!=1 && $client_details[$i]['is_spam']!=1 && $client_details[$i]['is_approved']==1 ) {
			$strike='<span class="label vh-green-bg ">'.$vis_language['TXTAPPROVED'].'</span>';
		} else {
			$strike='<span class="label label-default">'.$vis_language['TXTPENDING'].'</span>'; }      
			 
        echo '<tr>';
								if(!isset($operation['vis_client']) && $operation['vis_client']!=1 && $operation['vis_action']!='history'){
								echo '<td class="p-r-none list_chkbox_action"><label class="checkbox m-n i-checks"><input class="vis_list_checkbox" type="checkbox" name="vis_global_mass_chk_'.$i.'" id="vis_global_mass_chk_'.$i.'" value="'.$client_details[$i]['client_id'].'" /><i></i></label></td>';
								}
			echo '<td><span class="spancolor" title="'.$clienttype_title.'" id="client_'.$client_details[$i]['client_id'].'" >'.$clienttype.'</span></td>';
		echo '<td><a href="#/client/client_details/'.str_replace('/', ' ', $client_details[$i]['first_name'].' '.$client_details[$i]['last_name']).'/'.$client_details[$i]['client_id'].'">'.$client_details[$i]['first_name'].'</a></td>';
		echo '<td><a href="#/client/client_details/'.str_replace('/', ' ', $client_details[$i]['first_name'].' '.$client_details[$i]['last_name']).'/'.$client_details[$i]['client_id'].'">'.$client_details[$i]['last_name'].'</a></td>';
		echo '<td><a href="#/client/client_details/'.str_replace('/', ' ', $client_details[$i]['first_name'].' '.$client_details[$i]['last_name']).'/'.$client_details[$i]['client_id'].'">'.$client_details[$i]['email'].'</a></td>';
		echo '<td><a href="#/client/client_details/'.$client_details[$i]['first_name'].' '.$client_details[$i]['last_name'].'/'.$client_details[$i]['client_id'].'">'.$client_details[$i]['user_name'].'</a></td>';
		echo '<td><a href="#/client/client_details/'.str_replace('/', ' ', $client_details[$i]['first_name'].' '.$client_details[$i]['last_name']).'/'.$client_details[$i]['client_id'].'">'.$client_details[$i]['contact_number'].'</a></td>';
		echo '<td><a href="#/client/client_details/'.str_replace('/', ' ', $client_details[$i]['first_name'].' '.$client_details[$i]['last_name']).'/'.$client_details[$i]['client_id'].'">'.$vis_domain.'</a></td>';
		echo '<td><a href="#/client/client_details/'.str_replace('/', ' ', $client_details[$i]['first_name'].' '.$client_details[$i]['last_name']).'/'.$client_details[$i]['client_id'].'">'.$client_details[$i]['group_name'].'</a></td>';
       /*$cnt=0;  for($j=0;$j<$contact_details[0]['total'];$j++)
         {
			if($client_details[$i]['client_id']==$contact_details[1][$j]['parent_id'])
			{
				$cnt=$cnt+1;
			}
		 }*/
        //echo '<td>'.$client_details[$i]['contact_count'].'</td>';
        echo '<td>'.$strike.'</td>';
        ?>
	   <td align="center"><a class="text-muted" href="javascript:void(0);"  data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=get_client_delete&vis_client_id=<?= $client_details[$i]['client_id']; ?>&vis_static_area=conform_delete_form&vis_form=<?= $view_info['form_name']; ?>" title="<? echo $vis_language['TXTDELETE']; ?>"><i class="vh vh-delete-round"></i></a>
       </td> </tr>
    <? } ?>
	</tbody>
</table>
<? } ?>
<script type="text/javascript">
$(".selectpicker").selectpicker();
$(document).ready(function() {	
$('[data-ride="datatables"]').dataTable({		
       "bPaginate" : false,	
		"sDom": 't', "bAutoWidth": false,"bDeferRender": true,
		"aoColumns": [
			<? if(!isset($operation['vis_client']) && $operation['vis_client']!=1 && $operation['vis_action']!='history'){?>{ "bSortable": false },<? }?>
				{ "bSortable": false },
		  	null,
		  	null,
		  	null,
		  	null,
		  	null,
		  	null,
		  	null,
			null,
			{ "bSortable": false }
		]
	});
});
</script>
