<? 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 $operation['view_title'];?></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_configuration/<? echo $vis_language['TXTCONFIGURATIONITEMTYPE'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCONFIGURATIONITEM']; ?>',{'vis_module':'setting','vis_operation':'view_configuration'});" class="link"><? echo $operation['view_title']; ?></a> </li>
         <li class="active"><?echo $vis_language['TXTUPDATECITYPE'];?></li>
      </ul>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTUPDATECITYPE']; ?></header>
      <div class="panel-body">
         <form class="form-horizontal" id="vis_config_form" name="vis_config_form" method="post" >
            <input type="hidden" name="vis_item_id" value="<? echo $config_details['item_id']; ?>" />
            <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_name" id="vis_name" value="<? echo  htmlentities($config_details['name'], ENT_COMPAT, 'UTF-8'); ?>">
               </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" name="vis_displayorder" id="vis_displayorder"  value="<? echo $config_details['display_order']; ?>">
               </div>
            </div>
            <div class="form-group">
			<label class="col-sm-2 text-right"><?= $vis_language['TXTPARENTCATEGORY']; ?></label>
			<div class="col-sm-10">
				<span id="vis_parent_category" name="vis_parent_category" style="margin-top:20px;"><? echo ($parent_item_details!='' && $parent_item_details!=-1) ? $parent_item_details[0]['name'] : $vis_language['TXTROOT'];  ?></span>
				<?if($parent_item_details!='' && $parent_item_details!=-1) {?><span class="vis_button label vh-success-bg m vis-pointer" data-toggle="ajaxModal" data-modal-arguments="vis_module=setting&vis_operation=view_configuration&vis_static_area=vis_client_merge_area&vis_set=1&vis_domain_id=<? echo $operation['vis_domain_id'];?>"><? echo $vis_language['TXTCHANGE']; ?></span><? } ?>
			</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 m-r-lg pull-left"><label>
                  <input type="radio" name="vis_access" <? if($config_details['access_type']==0) echo ' checked="checked"'; ?> id="vis_access_yes" value="0"/><i></i>
                  <? echo $vis_language['TXTPUBLIC']; ?></label>  </div>
                  <div class="radio i-checks m-r-lg pull-left"><label>
                  <input type="radio" name="vis_access" <? if($config_details['access_type']==1) echo ' checked="checked"'; ?> id="vis_access_no" value="1"/><i></i>
                  <? echo $vis_language['TXTPRIVATE']; ?>
                  </label>  </div>
               </div>
            </div>-->
            <div id="department_access123">
            <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" onchange="toggle_dept_list();" name="vis_department_all"  <? if($config_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="<?= ($config_details['department_access']==0)?'display:none':'';?>">
           <!-- <div id="vis_dept_list_section" class="form-group">-->
               <label class="col-sm-2 control-label"></label>
               <div class="col-sm-10">
				   <div class="dept_access_list">
                  <? $dept_list=array();
                      for($i=0;$i<count($department_details);$i++) {?>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" id="vis_department" name="vis_department[]" <? if(in_array($department_details[$i]['department_id'], $config_department)) echo ' checked="checked"'; ?>value="<? echo $department_details[$i]['department_id']; ?>" /> <i></i><? echo $department_details[$i]['domain_name'].' :: '.$department_details[$i]['department_name']; ?></label><br/>
                  <?
                     $dept_list[]=$department_details[$i]['department_id'];
                     } ?>
               </div>
              </div>
            </div>
            </div>
            <? if($language_details!=-1) { ?>
            <div class="form-group">
               <div class="col-sm-12"><h5><? echo $vis_language['MSGLANGTRANSFORCONFIGITEM']; ?></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="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTATUS']; ?></label>
               <div class="col-sm-1">
                  <label class="switch  <? if($config_details['is_enabled']==0) echo 'radio-no-uncheck'; ?>  ">
                  <input type="checkbox"  name="vis_status"  id="vis_status" <? if($config_details['is_enabled']==1) echo ' checked="checked"'; ?>   >
                  <span ></span>
                  </label>
               </div>
            </div>
             <input name="vis_parent" id="vis_parent" type="hidden" value="<? echo $config_details['parent_id'];?>"/>
            <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':'update_config_item', 'vis_form':'vis_config_form'})"><? echo $vis_language['TXTUPDATE']; ?></button>
                <? if($config_details['is_custom']==1){?>
                   <a class="btn btn-primary" data-toggle="ajaxModal" data-modal-arguments="vis_module=setting&vis_operation=get_config_delete&vis_item_id=<? echo $config_details['item_id']; ?>&vis_static_area=vis_config_delete_form" title="<? echo $vis_language['TXTDELETE']; ?>" href="javascript:void(0);" ><? echo $vis_language['TXTDELETE']; ?></a>
                <? }?>
               </div>
            </div>
      </div>
      </form>
      </div>
   </section>
</section>
<script type="text/javascript">
     $(".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>