<?  global $vis_language;
 $paging_list='';
   for($i=0;$i<$total_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['TXTWEBEX']; ?></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['TXTWEBEX']; ?></li>
		 </ul>
	  </div>
	</div>
    <div class="col-sm-8 text-right text-left-xs m-t-lg">
		<div class="btn-group pull-right">
			<a class="btn btn-rounded btn-primary btn-sm dropdown-toggle" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCREATEMEETING']; ?>',{'vis_module':'remoteaccess','vis_operation':'new_webex_meeting', 'cache':true});"><i style="font-size:10px;" class="vh vh-plus"></i>  <? echo $vis_language['TXTCREATEMEETING']; ?></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.'webex_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">
				  <div 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.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($webex_setting);$l++){
											if($webex_setting[$l]['domain_id'] == $department[$i]['domain_id'] && $webex_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>
			  <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_webexmeeting_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_webex_list">
            <? include_once(VIS_PATH_TEMPLATE.'webex_list.php'); // filter list?>
         </div>

      </section>
   </form>

</div>
<script>
    function vis_change_domain(e){
		$("#vis_webex_list").hide();
        if(e!=0)$('#vis_webex_list').visExecution('load_area', {'vis_module':'remoteaccess', 'vis_operation':'webex','vis_domain':e});
    }
	function vis_change_webexmeeting_page(e){
        $('#vis_webex_list').visExecution('load_area', {'vis_module':'remoteaccess', 'vis_operation':'webex','vis_page':e, 'vis_domain':'1<?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=webex',
			data: data,
			type: "POST",
			dataType: "json",
			success: function(data) {
				$(".tkt_right_menu").html(data.paging);
				$("#vis_webex_list").html(data.list);
				if(data.total_cnt==0){
					$("#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>
