<?  global $vis_language;
 $paging_list='';
   for($i=0;$i<$total_session_page;$i++) $paging_list.='<option value="'.$i.'" '.(($page==$i)?'selected="selected"':'').'>'.($i+1).'</option>';

   ?>
<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['TXTGOTOASSIST']; ?><span id="total_cnt"> (<?php echo $total_pages;?>)</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 class="active"><? echo $vis_language['TXTGOTOASSIST']; ?></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['TXTADDASSIST']; ?>',{'vis_module':'remoteaccess','vis_operation':'new_gotoassist', 'cache':true});"><i style="font-size:10px;" class="vh vh-plus"></i>  <? echo $vis_language['TXTCREATESESSION']; ?></a>
		</div>
	</div>
</section>

<div class="col-lg-12">
	<input type="hidden" value="" name="vis_filter_enable" id="vis_filter_enable">
   <? include_once(VIS_PATH_TEMPLATE.'gotoassist_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">
           	<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 vis_doamin_div">
						  <select class='form-control selectpicker' name="vis_domain" id="vis_domain" onchange="vis_change_domain(this.value)" <? 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($gotoassist_setting);$l++){
											if($gotoassist_setting[$l]['domain_id'] == $department[$i]['domain_id'] && $gotoassist_setting[$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 class="col-sm-12 pull-right text-center-xs">
                <div  class="pull-right tkt_right_menu" id="paging">
				  <?php if($paging_list!=''){?>
					   <select name="pageing" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="return vis_change_gotomeeting_page(this.value);">
					   <? echo $paging_list;?>
					   </select>
					   <div class="text-muted pull-right label_page"><? echo $vis_language['TXTPAGE']; ?>:</div>
				   <?php }?>
				</div>
				</div>
              </div>
         <div class="table-responsive scroll-x"  id="vis_assist_list">
            <? include_once(VIS_PATH_TEMPLATE.'gotoassist_list.php'); ?>
         </div>
      </section>
   </form>

</div>
<script>
    function vis_change_domain(e){
		if(e!=0)$('#vis_workpanel_div').visExecution('load_area', {'vis_module':'remoteaccess', 'vis_operation':'gotoassist','vis_domain':e});
    }
	function vis_change_gotomeeting_page(e){
        $('#vis_assist_list').visExecution('load_area', {'vis_module':'remoteaccess', 'vis_operation':'gotoassist','vis_page':e, 'vis_domain':<?php echo $vis_domain; ?>});
    }
	function hide_domain(){	$('#live_domain').toggle();	}

	$('.from_date').datetimepicker();
	$('.to_date').datetimepicker();

	function vis_apply_filter(vis_page){

		vis_page = (vis_page!=undefined && typeof(vis_page)!=undefined && vis_page != '') ? vis_page:'';
		var data = {'vis_filter_enable':'1', 'vis_page':vis_page, 'vis_domain':'<?php echo $vis_domain; ?>', 'vis_action': $("#vis_filter_list input, #vis_filter_list select").serialize() };
		$.ajax({
			url: 'index.php?vis_module=remoteaccess&vis_operation=gotoassist',
			data: data,
			type: "POST",
			dataType: "json",
			success: function(data) {
				$(".tkt_right_menu").show();
				$('#url_header').html('<h3 class="m-b-xs text-black"><? echo $vis_language['TXTFILTERRESULT']; ?><span id="total_cnt"> ('+data.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="#/remoteaccess/gotoassist/<? echo $vis_language['TXTGOTOASSIST'];?>/1"><? echo $vis_language['TXTGOTOASSIST'];?></a></li><li class="active"><? echo $vis_language['TXTFILTERRESULT']; ?></li></ul></div>').show();
				$(".vis_doamin_div").html(data.domain);
				$(".tkt_right_menu").html(data.paging);
				$("#vis_assist_list").html(data.list);
				if(data.total_cnt==0){
					$(".tkt_right_menu").hide();
					$("#vis_no_record_search1").show();
					$("#vis_no_record_search1").html(data.list);
				}else $("#vis_no_record_search1").hide();
				toggle_mass_actions(); // To disable header & footer mass actions on list pages
			},
			error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
		});
    }
</script>
