<? 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['TXTDEPARTMENT'];?><span id="total_cnt"></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><a  class="link" href="#/setting/view_departments/<? echo $vis_language['TXTDEPARTMENT'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTDEPARTMENT'];?>',{'vis_module':'setting','vis_operation':'view_departments'});" class="link"><? echo $vis_language['TXTDEPARTMENT'];?></a> </li>
         <li class="active"><?echo $vis_language['TXTADDDEPARTMENT'];?></li>
      </ul>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDDEPARTMENT']; ?></header>
      <div class="panel-body">
         <form class="form-horizontal" id="vis_department_form" name="vis_department_form" method="post" >
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTDOMAIN']; ?></label>
               <div class="col-sm-10">
                  <select class="form-control input-sm selectpicker" <? if(count($domain_details)>10) echo 'data-live-search="true"';?>  name="vis_domain" id="vis_domain"><?
                     for($i=0;$i<count($domain_details);$i++) echo '<option value="'.$domain_details[$i]['domain_id'].'">'.$domain_details[$i]['domain_name'].'</option>'; ?>
                  </select>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTTITLE']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_departmentname" id="vis_departmentname">
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTAUTORESPONDEREMAIL']; ?></label>
               <div class="col-sm-10">
                  <select class="form-control input-sm selectpicker" <? if(count($templates)>10) echo 'data-live-search="true"';?> name="vis_autorespond_id"><option><? echo $vis_language['TXTNONE']; ?></option>
                     <?
                        for($i=0;$i<count($templates);$i++) echo '<option value="'.$templates[$i]['etemplate_id'].'"'.(($templates[$i]['etemplate_id']==2)?' selected="selected"':'').'>'.$templates[$i]['etemplate_name'].'</option>'; ?>
                  </select>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label" ><? echo $vis_language['TXTDISPLAYORDER']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" value="0" name="vis_displayorder" id="vis_displayorder">
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTACCESS']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks pull-left m-r-lg">
				  <label>
                  <input type="radio" name="vis_access" id="vis_access_yes" checked="checked" value="0" /><i></i>
                  <? echo $vis_language['TXTPUBLIC']; ?></label></div>
                  <div class="radio i-checks pull-left ">
				  <label>
                  <input type="radio" name="vis_access" id="vis_access_no" value="1"  /><i></i>
                  <? echo $vis_language['TXTPRIVATE']; ?></label></div>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTISPAID']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks pull-left m-r-lg">
				  <label>
                  <input type="radio" name="vis_paid" id="vis_paid_yes" value="1" /><i></i>
                  <? echo $vis_language['TXTYES']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input type="radio" name="vis_paid" id="vis_paid_no" value="0" checked="checked" /><i></i>
                  <? echo $vis_language['TXTNO']; ?></label></div>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTAUTORESPONDER']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks pull-left m-r-lg">
				  <label>
                  <input type="radio" name="vis_autorespond" id="vis_autorespond_yes" value="1" checked="checked"/><i></i>
                  <? echo $vis_language['TXTYES']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input type="radio" name="vis_autorespond" id="vis_autorespond_no" value="0" /><i></i>
                  <? echo $vis_language['TXTNO']; ?></label></div>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTREGISTRATIONREQUIRED']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks pull-left m-r-lg">
				  <label>
                  <input type="radio" name="vis_registered" id="vis_registered_yes" value="1" /><i></i>
                  <? echo $vis_language['TXTYES']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input type="radio" name="vis_registered" id="vis_registered_no" value="0" checked="checked"/><i></i>
                  <? echo $vis_language['TXTNO']; ?></label></div>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTAFFGROUPACCESS']; ?></label>
               <div class="col-sm-10">
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" id="vis_team_access_all" checked="checked" onchange="toggle_team_list();" name="vis_team_access_all"><i></i><? echo $vis_language['TXTALLTEAM']; ?></label>
               </div>
            </div>
            <div class="form-group" id="vis_team_section" style="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($staff_group); $i++) { ?>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" value="<? echo $staff_group[$i]['group_id']; ?>" name="vis_staff_department_access[]" /> <i></i><? echo $staff_group[$i]['group_name']; ?></label><br/>
                  <? } ?>
                </div>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTAFFACCESS']; ?></label>
               <div class="col-sm-10">
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" id="vis_staff_access_all" checked="checked" onchange="toggle_dept_list();" name="vis_staff_access_all"><i></i><? echo $vis_language['TXTALLSTAFF']; ?></label>
               </div>
            </div>
            <div id="vis_dept_list_section" class="form-group" style="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($staff_list); $i++) { ?>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox"  class="vis_list_checkbox" value="<? echo $staff_list[$i]['staff_id']; ?>" name="vis_staff_access[]" /> <i></i><? echo $staff_list[$i]['first_name'].' '. $staff_list[$i]['last_name']; ?></label><br/>
                  <? } ?>
               </div>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? 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>
            <? if($language_details!=-1) { ?>
            <div class="form-group">
               <div class="col-sm-12"><h5><? echo $vis_language['MSGLANGTRANSFORDEPARTMENT']; ?></h5></div>
            </div>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <?
               for($i=0;$i<count($language_details);$i++) { ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $language_details[$i]['language_name']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_language_<? echo $language_details[$i]['language_id']; ?>" type="text" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" />
               </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_department', 'vis_form':'vis_department_form'})"><? echo $vis_language['TXTADD']; ?></button>
               </div>
         </form>
         </div>
      </div>
   </section>
</section>
<script>
   $(".selectpicker").selectpicker();
   function toggle_dept_list(){
       if($('#vis_staff_access_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');
       });
   }
   function toggle_team_list(){
       if($('#vis_team_access_all').is(":checked")) $('#vis_team_section').hide();
       else $('#vis_team_section').show();
	   $('.dept_access_list').each(function(index) {
        $(this).find('input[type="checkbox"]').removeAttr('checked');
       });
   }
   
   
</script>


