<? 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['TXTDEPRECIATIONTYPE'];?></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_finance_management/<? echo $vis_language['TXTDEPRECIATIONTYPE'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTFINANCEMANAGEMENT']; ?>',{'vis_module':'setting','vis_operation':'view_finance_management'});" class="link"><? echo $vis_language['TXTDEPRECIATIONTYPE']; ?></a> </li>
         <li class="active"><?echo $vis_language['TXTUPDATEDEPRECIATIONTYPE'];?></li>
      </ul>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTUPDATEDEPRECIATIONTYPE']; ?></header>
      <div class="panel-body">
         <form class="form-horizontal" id="vis_config_form" name="vis_config_form" method="post" >
            <input type="hidden" name="vis_finance_id" value="<? echo $finance_details['finance_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 $finance_details['name']; ?>">
               </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 $finance_details['display_order']; ?>">
               </div>
            </div>
             <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTITILDEPRECIATION']; ?></label>
               <div class="col-sm-10">
                <select name="vis_finance_type" id="vis_finance_type" class="form-control input-sm selectpicker">
                	<option <? echo $finance_details['finance_type_id']==0? 'selected="selected"':''; ?> value="0"><? echo $vis_language['TXTSELECTDEPRECIATIONMETHOD']; ?></option>
                    <option <? echo $finance_details['finance_type_id']==1? 'selected="selected"':''; ?> value="1"><? echo $vis_language['TXTITILSTRAIGHTLINE']; ?></option>
                    <option <? echo $finance_details['finance_type_id']==2? 'selected="selected"':''; ?> value="2"><? echo $vis_language['TXTITILDECLINEBALANCE']; ?></option>
                    <option <? echo $finance_details['finance_type_id']==3? 'selected="selected"':''; ?> value="3"><? echo $vis_language['TXTITILDOUBLEDECLINEBALANCE']; ?></option>
                    <option <? echo $finance_details['finance_type_id']==4? 'selected="selected"':''; ?> value="4"><? echo $vis_language['TXTITILSUMOFYEARDIGIT']; ?></option>
			    </select>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTUSEFULLIFE']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_useful_life" id="vis_useful_life" value="<? echo $finance_details['useful_life']; ?>" >
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTDESCRIPTION']; ?></label>
               <div class="col-sm-10">
                  <textarea class="form-control input-sm" type="text" name="vis_description" id="vis_description"  ><? echo $finance_details['description']; ?></textarea>
               </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($finance_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($finance_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($finance_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="<?= ($finance_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'], $finance_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>
            <?
               }
        }*/ if($finance_details['finance_id']!=1){?>
            <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($finance_details['is_enabled']==0) echo 'radio-no-uncheck'; ?>  ">
                  <input type="checkbox"  name="vis_status"  id="vis_status" <? if($finance_details['is_enabled']==1) echo ' checked="checked"'; ?>   >
                  <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':'update_finance', 'vis_form':'vis_config_form'})"><? echo $vis_language['TXTUPDATE']; ?></button>
                  <!-- <a class="btn btn-primary" data-toggle="ajaxModal" data-modal-arguments="vis_module=setting&vis_operation=get_config_delete&vis_item_id=<? echo $finance_details['finance_id']; ?>&vis_static_area=vis_config_delete_form" title="<? echo $vis_language['TXTDELETE']; ?>" href="javascript:void(0);" ><? echo $vis_language['TXTDELETE']; ?></a>-->

              <!-- <a class="text-muted" href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=setting&vis_operation=get_config_delete&vis_item_id=<? echo $config_details[$i]['item_id']; ?>&vis_static_area=vis_config_delete_form" title="<? echo $vis_language['TXTDELETE']; ?>"><i class="vh vh-delete-round"></a>-->
               </div>
            </div>
      </div>
      </form>
      </div>
   </section>
</section>
<script type="text/javascript">
   /*if ($(vis_access_yes).is(":checked"))
   {
    $('#department_access123').hide();
   }
	$(document).ready(function () {
	   $('#vis_access_yes').click(function () {
		  $('#department_access123').hide();
   });
   $('#vis_access_no').click(function () {
		 $('#department_access123').show();
	});
  });*/
      $(".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>
