<? global $vis_language; ?>
<form method="post" name="vis_integration_app_form" id="vis_integration_app_form" class="form-horizontal">
		<div class="form-group">
			 <label class="col-sm-2 control-label"><? echo $vis_language['TXTDOMAIN']; ?></label>
			 <div class="col-sm-2">	
				<div class="checkbox m-n i-checks pull-left "><label><input type="checkbox" name="vis_sign_all_domain" id="vis_sign_all_domain" onchange="toggle_dept_list();" value="1" <? if($vis_all_domain_gotomeeting==1 || $vis_all_domain_gotoassist==1 || $vis_all_domain_teamviewer==1 || $vis_all_domain_webex==1) echo ' checked="checked"'; ?>/><i></i><? echo $vis_language['TXTALLDOMAIN']; ?></label></div>
			 </div>
		</div>
		<div class="form-group vis_doamin_div">
			 <label class="col-sm-2 control-label"><? echo $vis_language['TXTSELECTDOMAIN']; ?></label>
			<div class='col-sm-10'>
				<select class='form-control input-sm selectpicker' name="vis_domain" id="vis_domain" onchange="vis_change_domain_int(this.value)" <? if(count($integration_details) > 10) echo 'data-live-search="true"' ?>>
					<option value="0" selected='selected'>-- <? echo $vis_language['TXTSELECTDOMAIN']; ?> --</option>
					<? for($i=0;$i<count($department);$i++){
							if($vis_all_domain_gotomeeting!=1 || $vis_all_domain_gotoassist!=1 || $vis_all_domain_teamviewer!=1 || $vis_all_domain_webex!=1){
								for($j=0;$j<count($domain_array);$j++){
									if($department[$i]['domain_id']==$domain_array[$j]){
										echo '<option value="'.$department[$i]['domain_id'].'">'.$department[$i]['domain_name'].'</option>';
									}
								}
							}else{echo '<option value="'.$department[$i]['domain_id'].'">'.$department[$i]['domain_name'].'</option>';}
						}  ?>
				</select>	
			</div>
		</div>	
		<div id="vis_app_area"></div>
</form>	
<script>
function vis_change_domain_int(e){
	if(e==0) $("#vis_app_area").hide();
	else $('#vis_app_area').visExecution('load_area', {'vis_module':'staff', 'vis_operation':'integration','vis_domain':''+e+''});
}
function toggle_dept_list(){
	if($('#vis_sign_all_domain').is(":checked")) {$('.vis_doamin_div').hide(); vis_change_domain_int('all');}
    else {
		$('#vis_app_area').hide();
		$('.vis_doamin_div').show();
		$("div.vis_doamin_div select").val("0").change();
	}
}
if($('#vis_sign_all_domain').is(":checked")){
	$('.vis_doamin_div').hide();
	vis_change_domain_int('all');
}
</script>
