<? 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']; ?>"><? echo $vis_language['TXTSETTINGS']; ?></a></li>
         <li><a class="link" href="#/setting/view_location/<? echo $vis_language['TXTLOCATION']; ?>" class="link"><? echo $operation['view_title']; ?></a> </li>
         <li class="active"><? echo $vis_language['TXTADDLOCATION'];?></li>
      </ul>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDLOCATION']; ?></header>
      <div class="panel-body">
         <form class="form-horizontal" id="vis_config_form" name="vis_config_form" method="post" >
            <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">
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTEMAIL']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_email" id="vis_email">
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTPHONE']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_phone" id="vis_phone">
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTADDRESS']; ?></label>
               <div class="col-sm-10">
                  <textarea class="form-control input-sm" name="vis_address" id="vis_address"></textarea>
               </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 ($operation['vis_parent_id']==0) ? $vis_language['TXTROOT'] : $parent_item_details['name']; ?></span>
				<?if($operation['vis_parent_id']!=0) {?><span class="vis_button label vh-success-bg m vis-pointer" data-toggle="ajaxModal" data-modal-arguments="vis_module=setting&vis_operation=view_location&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 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>
           <!-- <div id="vis_dept_list_section" class="form-group" style="<?= ($department_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[]" 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 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>
             <input name="vis_parent" id="vis_parent" type="hidden" value="<? echo ($operation['vis_parent_id']==0) ? 0 : $operation['vis_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':'add_location', 'vis_form':'vis_config_form'})"><? echo $vis_language['TXTADD']; ?></button>
               </div>
            </div>
      </form>
      </div>
   </section>
</section>
<script type="text/javascript">
	if($('#vis_department_all').is(":checked")) $('#vis_dept_list_section').hide();
function toggle_dept_list(){
   if($('#vis_department_all').is(":checked")) $('#vis_dept_list_section').hide();
   else $('#vis_dept_list_section').show();
}
</script>
