<? 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"><? echo $vis_language['TXTCHANNEL']; ?></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><a  class="link" href="#/setting/view_channels/<? echo $vis_language['TXTCHANNEL']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCHANNEL']; ?>',{'vis_module':'setting','vis_operation':'view_channels'});"><? echo $vis_language['TXTCHANNEL']; ?></a> </li>
         <li class="active"><?echo $vis_language['TXTADDCHANNEL'];?></li>
      </ul>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDCHANNEL']; ?></header>
      <div class="panel-body">
         <form class="form-horizontal" id="vis_channel_form" name="vis_channel_form" method="post" >
		 <div class="form-group">
			<label class="col-sm-2 control-label p-d-sm"><?= $vis_language['TXTCHANNELIMAGE']; ?></label>
			<div class="col-sm-10">
				<div><span id="vis_channel_img"><i class="vh vh-channel vh-2x"></i></span>
				<input type="file" name=vis_pro_img class="filestyle" data-icon="false" data-classButton="btn btn-link link p-d-sm" data-buttonText="<? echo $vis_language['TXTUPLOADIMG']; ?>" data-input="false" onchange="$(this).visExecution('upload_file', {'vis_static_area':'#vis_profile_image', 'vis_form':'vis_channel_form', 'vis_form_attachment_area':'#vis_attachments','vis_action':'index.php?vis_module=home&vis_operation=upload_file&vis_switch=0'});">
				<input type="hidden" name="vis_location" value="<? echo VIS_DOMAIN; ?>" />
				<input type="hidden" name="vis_attachments" id="vis_attachments" value="" />
				<span id="clearnewchnImg">
				<? if(isset($channel_details['icon_path']) && $channel_details['icon_path']!='vh vh-channel') {?>
					<button type="button" id="clearnewchnlBtn" class="btn btn-primary btn-xs" onclick="javascript:clear_image1();"><? echo $vis_language['TXTCLEAR']; ?></button>
				<? }?>
				</span>
				</div>
			</div>
		</div>
        <div class="form-group">
         <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTTITLE']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text" name="vis_channelname" id="vis_channelname">
         </div>
      </div>
      <div id="department_access">
        <div class="form-group">
           <label class="col-sm-2 control-label"><? echo $vis_language['TXTDEPARTMENTACCESS']; ?></label>
           <div class="col-sm-10">
              <label class="checkbox-inline i-checks">
              <input type="checkbox" value="1" id="vis_department_all" name="vis_department_all"  checked="checked" onchange="toggle_dept_list();" <? if($department_details['department_access']==0) echo ' checked="checked"'; ?>><i></i>
              <? echo $vis_language['TXTALLDEPARTMENTS']; ?>
              </label>
           </div>
        </div>
        <div id="vis_dept_list_section" class="form-group" style="<?= ($department_details['department_access']==0)?'display:none':'';?>">
           <label class="col-sm-2 control-label"></label>
           <div class="col-sm-10">
               <div class=" dept_access_list">
              <?
                  for($i=0;$i<count($department_details);$i++) {?>
              <label class="checkbox-inline i-checks">
              <input type="checkbox"  name="vis_department[]" value="<? echo $department_details[$i]['department_id']; ?>" /> <i></i><? echo $department_details[$i]['domain_name'].' :: '.$department_details[$i]['department_name']; ?></label><br/>  <? } ?>
              </div>
           </div>
        </div>
      </div>
	  <div class="form-group">
               <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTSTATUS']; ?></label>
               <div class="col-sm-1">
                  <label class="switch">
                  <input type="checkbox" checked="checked" name="vis_status"  id="vis_status" >
                  <span ></span>
                  </label>
               </div>
            </div>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <div class="form-group">
               <div class="col-sm-4 col-sm-offset-2">
                  <button type="button" class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'add_channel', 'vis_form':'vis_channel_form'})"><? echo $vis_language['TXTADD']; ?></button>
               </div>
            </div>
 </form>
      </div>
   </section>
</section>
<script src="<?= VIS_PATH_SCRIPT; ?>file-input/bootstrap-filestyle.min.js"></script>
<script type="text/javascript">
	function clear_image1()
	{
		$('#clearnewchnImg').visExecution('load_area', {'vis_module':'home', 'vis_operation':'remove_profile_img','vis_channel_new':1});
	}
      $(".selectpicker").selectpicker();
   function toggle_dept_list(){
       if($('#vis_department_all').is(":checked")){ $('#vis_dept_list_section').hide();
							}else{ $('#vis_dept_list_section').show();
							$('.dept_access_list').each(function(index) {
        $(this).find('input[type="checkbox"]').removeAttr('checked');
       });
							}
   }
</script>
