<script type="text/javascript" src="<?= VIS_PATH_SCRIPT; ?>datatables/data-tables/DT_bootstrap.js"></script>
<? global $vis_language; ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
	<div class="col-sm-4" id="url_header">
	  <h3 class="m-b-xs text-black"><? echo $vis_language['TXTTEAMVIEWER']; ?></h3>
	  <div>
		 <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
			<li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
			<li><a class="link" href="#/remoteaccess/teamviewer_list/<? echo $vis_language['TXTTEAMVIEWER'].' '.$vis_language['TXTMEETING']; ?>"><? echo $vis_language['TXTTEAMVIEWER'].'&nbsp;'.$vis_language['TXTMEETING']; ?></a></li>
			<li class="active"><? echo $vis_language['TXTSEESION']; ?></li>
		 </ul>
	  </div>
	</div>
    <div class="col-sm-8 text-right text-left-xs m-t-lg">
     <div class="btn-group pull-right">
			<a title="<?= $vis_language['TXTFILTERLIST']; ?>" href="javascript:void(0);" class="btn btn-default btn-sm dropdown-toggle" onclick="$('#vis_filter_list').slideToggle();"><i style="font-size:10px;" class="vh vh-filter"></i></a>
	  </div>
		
		<div class="btn-group pull-right">&nbsp;
			<a class="btn btn-rounded btn-primary btn-sm dropdown-toggle" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCREATESESSION']; ?>',{'vis_module':'remoteaccess','vis_operation':'new_session'});"><i style="font-size:10px;" class="vh vh-plus"></i>  <? echo $vis_language['TXTCREATESESSION']; ?></a>
		</div>
	</div>
</section>
<div class="col-lg-12">
   <?  include_once(VIS_PATH_TEMPLATE.'teamviewer_session_search.php'); // filter list?>
</div>

<div class="col-lg-12">
	<form name="vis_<?php echo $operation['vis_operation']; ?>_form" id="vis_<?php echo $operation['vis_operation']; ?>_form">
   <input type="hidden" name="vis_current_operation" value="<?php echo $operation['vis_current_operation']; ?>" />
	  <section class="panel panel-default">
	  <div class="row wrapper clr" id="view_action">
           	<div  class="col-sm-12 pull-right text-center-xs">
              <div class="col-lg-3 m-l-n" id="live_domain">
                 <div class="col-sm-2 text-muted label_page"><?= $vis_language['TXTDOMAIN'];?>:</div>
                 <div class="col-sm-6">
                      <select class='form-control selectpicker' name="vis_domain" id="vis_domain" onchange="vis_change_domain(this)" <? if(count($department) > 10) echo 'data-live-search="true"' ?>>
                          <? for($i=0;$i<count($department);$i++){
								 if($vis_domain == $department[$i]['domain_id'])
								    $chk = 'selected="selected"';
								 else
								    $chk = '';

								if($vis_all_domain!=1){
									for($l=0;$l<count($teamviewer_domain);$l++){
										if($teamviewer_domain[$l]['domain_id'] == $department[$i]['domain_id'] && $teamviewer_domain[$l]['is_enabled']==1){
											echo '<option '.$chk.' value="'.$department[$i]['domain_id'].'">'.$department[$i]['domain_name'].'</option>';
										}
									}
								}else echo '<option '.$chk.' value="'.$department[$i]['domain_id'].'">'.$department[$i]['domain_name'].'</option>';
							 }?>
                      </select>
                  </div>
                </div>
              </div>
         </div>
         <div class="table-responsive scroll-x"  id="vis_teamviewer_session_list">
            <? include_once(VIS_PATH_TEMPLATE.'teamviewer_session_list.php'); // filter list?>
         </div>
      </section>
   </form>

</div>
<script>
    function vis_change_domain(e){
		$("#vis_teamviewer_session_list").hide();
        if(e.value!=0)$('#vis_teamviewer_session_list').visExecution('load_area', {'vis_module':'remoteaccess', 'vis_operation':'teamviewer_session_list','vis_domain':e.value});
    }
	function vis_change_gotomeeting_page(e){
        if(e.value==0) $("#vis_teamviewer_session_list").hide();
        else $('#vis_teamviewer_session_list').visExecution('load_area', {'vis_module':'remoteaccess', 'vis_operation':'teamviewer_session_list','vis_page':e.value, 'vis_domain':<?php echo $vis_domain; ?>});
    }
	function hide_domain(){	$('#live_domain').toggle();	}
	function teamviewer_filter()
	{
		var search_type = $.trim($('#vis_search_type').val());
		var page_no = $.trim($('#page_no').val());
		var vis_domain = $.trim($('#vis_domain_filter').val());
		$('#url_header').html('<h3 class="m-b-xs text-black"><? echo $vis_language['TXTFILTERRESULT']; ?><span id="total_cnt"></span></h3><div><ul class="breadcrumb bg-empty no-border m-b-xxs no-padder"><li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li> <li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>"><? echo $vis_language['TXTSETTINGS'];?></a></li><li><a class="link" href="#/remoteaccess/teamviewer_session_list/<? echo $vis_language['TXTTEAMVIEWER'].' '.$vis_language['TXTSEESION']; ?>" onclick="location.reload();"><? echo $vis_language['TXTTEAMVIEWER'].'&nbsp;'.$vis_language['TXTSEESION']; ?></a></li><li class="active"><? echo $vis_language['TXTFILTERRESULT']; ?></li></ul></div>').show();

		$('#vis_teamviewer_session_list').visExecution('load_area', {'vis_module':'remoteaccess', 'vis_operation':'teamviewer_session_list','vis_page':page_no,'vis_field_search':search_type,'vis_filter_enable':1,'vis_domain':vis_domain});
	}

</script>
