<?  global $vis_language;?>

<section id="breadcrumb" class="row m-b m-l-none m-r-none">
	<div class="col-sm-6">
		<h3 class="m-b-xs text-black"><span><? echo $vis_language['TXTINTERCOM'];?></span></h3>
		<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'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<?echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><?echo $vis_language['TXTSETTINGS'];?></a></li>
			<li class="active"><?echo $vis_language['TXTINTERCOM'];?></li>
		</ul>
	</div>
</section>
<section class="padder">
	<section class="panel panel-default">
		<header class="panel-heading sub_header"><? echo $vis_language['TXTINTERCOM']; ?></header>
		<div class="panel-body">
		<form class="form-horizontal" id="vis_integration_form" name="vis_integration_form" method="post" >
		<div class="form-group">
			<label class="col-sm-2 control-label"><? echo $vis_language['TXTDOMAIN']; ?></label>
			<!--<div class="col-sm-2" id="vis_domain_list">
				<label class="checkbox m-n i-checks pull-left">
					<input type="checkbox" name="vis_all_domains" id="vis_all_domains" value="1" onchange="toggle_domain_list();"/><i></i>
				<label class="control-label m-l-xs"><? echo $vis_language['TXTALLDOMAINS']; ?></label>
				</label>
			</div>-->
   <input type="hidden" name="vis_all_domains" id="vis_all_domains" value="0"  />
			<div class="col-sm-10" id="vis_department_list">
				<select name="vis_domain" id="vis_domain" class="form-control input-sm selectpicker" <? if(count($department)>10) echo 'data-live-search="true"';?>  onchange="vis_change_domain(this)" >
					<option value="0">-- <? echo $vis_language['TXTSELECTDOMAIN']; ?> --</option>
					<?	for($i=0;$i<count($department);$i++){ ?>
					<option value="<?php echo $department[$i]['domain_id'] ?>" ><?php echo $department[$i]['domain_name'] ?></option>
					<? } ?>
				</select>
			</div>
			</div>
			<div id="vis_domain_details">
				<? //include_once(VIS_PATH_TEMPLATE.'add_intercom.php'); ?>
			</div>
		</form>
		</div>
	</section>
</section>
<script>
var id= $('#vis_domain').val();
$(".selectpicker").selectpicker();

	function vis_change_domain(e){
		if(e.value==0) $("#vis_domain_details").hide();
		else
        $('#vis_domain_details').visExecution('load_area', {'vis_module':'setting', 'vis_operation':'integration_intercom', 'vis_integration_type':47,'vis_domain':e.value});
     }
	function toggle_dept_list(){
	
		$('#vis_domain_details').visExecution('load_area', {'vis_module':'setting', 'vis_operation':'integration_intercom', 'vis_integration_type':47,'vis_domain':<?php echo ($domainId!='')?$domainId:$department[$i]['domain_id']; ?> });
	}
// toggle_dept_list();
 function toggle_domain_list()
	{
	  	 if($('#vis_all_domains').is(":checked")) $('#vis_department_list').hide();
     	  else $('#vis_department_list').show();
	}
 </script>
