

<?php $__env->startSection('pageTitle', 'Vega Soft'); ?>
<?php $__env->startSection('page-content'); ?>

<input type="hidden" id="table_settings_field" branch_id="" branch_name=""  column_heading="<?= $rows->column_heading;?>" column_width="<?= $rows->column_width;?>" column_alighn="<?= $rows->column_alighn;?>"  column_conversion="<?= $rows->column_conversion;?>" settings_row_id="<?= $id;?>" sp_date_picker="<?= $rows->sp_date_picker;?>"  header_from_date="<?=date('d-m-Y', strtotime('-7 days')); ?>"   header_till_date="<?=date('d-m-Y'); ?>"  sp_sort="<?= $rows->menu_id; ?>"  active_mn="<?= $rows->root;?>"  active_mnt="<?= $rows->menu_type;?>">


<style>
#dynamic_ajax_table_length ,.dt-buttons ,#dynamic_ajax_table_filter{
    //float: left;
}
.custom-design-modal{
max-width:70%;
}
.dt-buttons{
    height: 34px;
}

.form-group {
  margin-bottom: 1rem;
}

</style>


<div class="page-header">
<div class="row align-items-center">
<div class="col">
<h3 class="page-title"><?= $rows->menu_name;?></h3>
</div>
<div class="col-auto float-end ms-auto">

</div>
</div>
</div>


<div class="row filter-row">


<div class="card">
<div class="card-body">

<ul class="nav nav-tabs nav-tabs-solid nav-justified">
<?php $__currentLoopData = $settings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $st): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<li class="nav-item"><a class="nav-link " href="#solid-justified-tab<?php echo e($st->st_id); ?>" data-bs-toggle="tab"><?php echo e($st->st_name); ?></a></li>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


</ul>
<div class="tab-content">


<div class="tab-pane" form_id='1' id="solid-justified-tab1">
<div class="col-lg-12">


<div class="col-xl-12 col-lg-12 d-flex">
<div class="card flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">Provident Fund Settings</h4>
</div>
<div class="card-body">

<div class="form-group row">
<label class="col-lg-3 col-form-label">Employee's Contribution (%)</label>
<div class="col-lg-4">
<input type="text" id="pf_e" class="form-control form-control-sm input_txt">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Employer's Contribution (%) </label>
<div class="col-lg-4">
<input type="text" id="pf_er" class="form-control form-control-sm input_txt">
</div>
</div>






</div>
</div>
</div>







</div>



</div>
<div class="tab-pane" form_id='2' id="solid-justified-tab2">


<div class="col-lg-12">


<div class="col-xl-12 col-lg-12 d-flex">
<div class="card flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">ESI Settings</h4>
</div>
<div class="card-body">

<div class="form-group row">
<label class="col-lg-3 col-form-label">Employee's Contribution (%)</label>
<div class="col-lg-4">
<input type="text" id="esi_e" class="form-control form-control-sm">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Employer's Contribution (%) </label>
<div class="col-lg-4">
<input type="text" id="esi_er" class="form-control form-control-sm">
</div>
</div>







</div>
</div>
</div>







</div>





</div>


<div class="tab-pane" form_id='3' id="solid-justified-tab3">
<div class="col-lg-12">


<div class="col-xl-12 col-lg-12 d-flex">
<div class="card flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">DA Settings</h4>
</div>
<div class="card-body">


<div class="form-group row">

<label class="col-lg-2 col-form-label">DA Point</label>
<div class="col-lg-2">
<input type="text" id="da_pt" class="form-control form-control-sm">
</div>
<label class="col-lg-2 col-form-label">Minus(-)</label>
<div class="col-lg-2">
<input type="text" id="da_minus" class="form-control form-control-sm">
</div>
<label class="col-lg-2 col-form-label">Value</label>
<div class="col-lg-2">
<input type="text" id="da_val" class="form-control form-control-sm">
</div>



</div>




</div>
</div>
</div>







</div>

</div>
<div class="tab-pane" form_id='4' id="solid-justified-tab4">
<div class="col-lg-12">


<div class="col-xl-12 col-lg-12 d-flex">
<div class="card flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">Allowence</h4>
</div>
<div class="card-body">

<div class="form-group row">
<label class="col-lg-3 col-form-label">Allowence Per Day</label>
<div class="col-lg-4">
<input type="text" id="alwc_day" class="form-control form-control-sm">
</div>
</div>


<div class="form-group row">
<label class="col-lg-3 col-form-label">Monthly Allowance </label>
<div class="col-lg-4">
<input type="text" id="alwc_mth" class="form-control form-control-sm">
</div>



</div>

<div class="form-group row">
<label class="col-lg-3 col-form-label">OverTime Weightage </label>
<div class="col-lg-4">
<input type="text" id="otw" class="form-control form-control-sm">
</div>



</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">City Allowance</label>
<div class="col-lg-4">
<input type="text" id="alwnc_ct" class="form-control form-control-sm">
</div>



</div>



<?php $__currentLoopData = $allownce; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $al): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="form-group row">
<label class="col-lg-3 col-form-label"><?php echo e($al->allowance); ?></label>
<div class="col-lg-4">
<input type="text" id="<?php echo e($al->id); ?>" class="form-control form-control-sm allowance_amount">
</div>



</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>








</div>
</div>
</div>







</div>

</div>
<div class="tab-pane" form_id='5' id="solid-justified-tab5">
<div class="col-lg-12">


<div class="col-xl-12 col-lg-12 d-flex">
<div class="card flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">L.W.F</h4>
</div>
<div class="card-body">

<div class="form-group row">
<label class="col-lg-3 col-form-label">L.W.f</label>
<div class="col-lg-4">
<input type="text" id="lwf" class="form-control form-control-sm">
</div>
</div>






</div>
</div>
</div>







</div>

</div>
<div class="tab-pane" form_id='6' id="solid-justified-tab6">
<div class="col-lg-12">


<div class="col-xl-12 col-lg-12 d-flex">
<div class="card flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">Category</h4>
</div>
<div class="card-body">

<div class="col-lg-12">

<div class="form-group row">

<label class="col-lg-2 col-form-label">Add Category</label>
<div class="col-lg-2">
<input type="text" id="cat" class="form-control form-control-sm">
</div>

<label class="col-lg-2 col-form-label">Select Category</label>
<div class="col-lg-4">

<select class="form-control form-select" id="scat">
<option value="0" >-Select-</option>
<?php $__currentLoopData = $category; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ct): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

<option value="<?php echo e($ct->CategoryCode); ?>" emp_cat_id="<?php echo e($ct->emp_cat_id); ?>">

<?php echo e($ct->Category); ?>

</option>

<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


</select>


</div>




</div>


<div class="form-group row mt-2">
<label class="col-lg-2 col-form-label">Max Working Days</label>
<div class="col-lg-2">
<input type="text" class="form-control form-control-sm input_text" id="max_dys">

</div>
<div class="checkbox col-lg-5 offset-lg-2">
<label>
<input type="checkbox" name="DAFromPoint" class="da_pnt_chk" value="1"> DA From DA Point
</label>
</div>



</div>

<div class="form-group row mt-2">

<div class="col-lg-4">
  

<div class="card mb-0">
<div class="card-header">
<h4 class="card-title mb-0">Salary Calculated</h4>
</div>
<div class="card-body">
  
<div class="col-md-10">

<div class="radio">
<label>
<input type="radio" name="Monthly" value="0">Daily
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="Monthly" value="1">Monthly
</label>
</div>
</div>
</div>
</div>


</div>

<div class="col-lg-4">

<div class="card mb-0">
<div class="card-header">
<h4 class="card-title mb-0">PF Deduction On</h4>
</div>
<div class="card-body">
  
<div class="col-md-10">
<div class="checkbox">
<label>
<input type="checkbox" name="pf_dedc" class="pf_check" value="1"> Basic
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="pf_dedc" class="pf_check" value="2"> DA
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="pf_dedc" class="pf_check" value="3"> HRA
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="pf_dedc" class="pf_check" value="3"> Additional Earning
</label>
</div>
</div>
</div>
</div>
</div>

<div class="col-lg-4">

<div class="card mb-0">
<div class="card-header">
<h4 class="card-title mb-0">ESI Deduction On</h4>
</div>
<div class="card-body">
<div class="col-md-10">
<div class="checkbox">
<label>
<input type="checkbox" name="esi_dedc" class="esi_check" value="1"> Basic
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="esi_dedc" class="esi_check" value="2"> DA
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="esi_dedc" class="esi_check" value="3"> HRA
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="esi_dedc" class="esi_check" value="4"> Additional Earning
</label>
</div>
</div>
</div>
</div>
</div>

</div>



</div>

</div>
</div>
</div>








</div>

</div>
<div class="tab-pane" form_id='7' id="solid-justified-tab7">
<div class="col-lg-12">


<div class="col-xl-12 col-lg-12 d-flex">
<div class="card flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">Punch Settings</h4>
</div>
<div class="card-body">



<div class="form-group row">
<label class="col-lg-3 col-form-label">Min Punching Gap (Seconds)</label>
<div class="col-lg-4">
<input type="text" id="pnch_gp" class="form-control form-control-sm">
</div>
</div>

<div class="form-group row">
<label class="col-lg-3 col-form-label">Full Day (Min) </label>
<div class="col-lg-3">
<input type="text"  id="f_day_min" class="form-control form-control-sm"   onBlur="calculat_hour_to_index('f_day_min');"  >
</div>
<label class="col-lg-3 col-form-label">Full Day (Max) </label>
<div class="col-lg-3">
<input type="text" id="f_day_max" class="form-control form-control-sm" onBlur="calculat_hour_to_index('f_day_max');" >
</div>


</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Half Day (Min-hrs) </label>
<div class="col-lg-3">
<input type="text" id="h_day_min" class="form-control form-control-sm" onBlur="calculat_hour_to_index('h_day_min');" >
</div>
<label class="col-lg-3 col-form-label">Half Day (Max-hrs) </label>
<div class="col-lg-3">
<input type="text" id="h_day_max" class="form-control form-control-sm"  onBlur="calculat_hour_to_index('h_day_max');">
</div>


</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Quarter Day (Min-hrs) </label>
<div class="col-lg-3">
<input type="text"  id="q_day_min" class="form-control form-control-sm"  onBlur="calculat_hour_to_index('q_day_min');">
</div>
<label class="col-lg-3 col-form-label">Quarter Day (Max-hrs) </label>
<div class="col-lg-3">
<input type="text" id="q_day_max" class="form-control form-control-sm" onBlur="calculat_hour_to_index('q_day_max');">
</div>


</div>







</div>
</div>
</div>







</div>

</div>

<div class="text-end">


<input type="hidden" id="pf_settings_id" value="0">
<input type="hidden" id="da_settings_id" value="0">
<input type="hidden" id="alwc_settings_id" value="0">
<input type="hidden" id="lwf_settings_id" value="0">
<input type="hidden" id="pnch_settings_id" value="0">
<input type="hidden" id="cat_settings_id" value="0">


<button type="button" class="btn btn-primary" onclick="submit_save_form();">Submit</button>
<button type="button" class="btn btn-success" onclick="reset_form();">Reset</button>
</div>




</div>
</div>
</div>


</div>


<input type="hidden" id="hidden_status" value="0">
<input type="hidden" id="row_id" value="0">




<div id="add_employee" class="modal custom-modal fade add_main_modal" role="dialog">
<div class="modal-dialog modal-dialog-centered modal-lg custom-design-modal" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?= $rows->menu_name;?></h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form>


</div>
</div>


</div>
</div>
<?php $__env->stopSection(); ?>




<?php $__env->startSection('page-script'); ?>
<script src="<?php echo e(asset('project-js\vega-front-scripts.js')); ?>"></script>
<script type="text/javascript">
 

set_mn();



 $('.tab-pane:first-child').addClass('active');




function submit_save_form(){

form_id=$("div.tab-content div.active").attr('form_id');

status=0;

if(form_id==1){


if($("#pf_e").val()==""){
  status=1;
  alert("Enter Employee's Contribution");
  $("#pf_e").focus().click();
  return;
}

if($("#pf_er").val()==""){
  status=1;
  alert("Enter Employer's Contribution");
  $("#pf_er").focus().click();
  return;
}
  
}

else if(form_id==2)
{


  if($("#esi_e").val()==""){
  status=1;
  alert("Enter Employee's Contribution");
  $("#esi_e").focus().click();
  return;
}

if($("#esi_er").val()==""){
  status=1;
  alert("Enter Employer's Contribution");
  $("#esi_er").focus().click();
  return;
}



}

else if(form_id==3)
{



  if($("#da_pt").val()==""){
  status=1;
  alert("Enter DA Point");
  $("#da_pt").focus().click();
  return;
}

if($("#da_val").val()==""){
  status=1;
  alert("Ente DA Value");
  $("#da_val").focus().click();
  return;
}


}
else if(form_id==4)
{

  if($("#alwc_day").val()==""){
  status=1;
  alert("Ente Daily Allowence");
  $("#alwc_day").focus().click();
  return;
}
  if($("#alwc_mth").val()==""){
  status=1;
  alert("Enter Monthly Allowence");
  $("#alwc_mth").focus().click();
  return;
}
  if($("#otw").val()==""){
  status=1;
  alert("Enter Overtime Weightage");
  $("#otw").focus().click();
  return;
}


}
else if(form_id==5)
{



  if($("#lwf").val()==""){
  status=1;
  alert("Enter LWF ");
  $("#lwf").focus().click();
  return;
}

}
else if(form_id==6)
{

  if($("#max_dys").val()==""){
  status=1;
  alert("Enter Maximum Working days");
  $("#max_dys").focus().click();
  return;
}

}
else if(form_id==7)
{
  if($("#pnch_gp").val()==""){
  status=1;
  alert("Enter Punch GAP");
  $("#pnch_gp").focus().click();
  return;
}
}





if(status==0){
  Save_form();
}



}



set_mn();

//fetch_view_table();



//http://192.168.18.128/prl_api/ij/prl_branch_edit.php

function call_edit_modal(row_id) {





$('#add_btn').hide();
$('#edit_btn').show();

$('#row_id').val(row_id);
$('#hidden_status').val(1);


        $.ajax({
              type: 'POST',
               async: false,
                url: '/get_data',
                data: {
                     '_token': "<?php echo e(csrf_token()); ?>",
                    'cid':"<?php echo e(Session::get('cid')); ?>",
                     row_id: row_id,
              url1:'prl_district_edit.php'
                },
                error: function (request, error) {
                    alert("Please Wait, Loading...");
                },
                success: function (response) {
 datas=response.edit;

          
              $('.add_main_modal').modal('show');
            $('#state_id').val(datas[0]['state_id']); 
            $('#district_name').val(datas[0]['district_name']); 
     
            
       // start_focus();   
        }
          
     });  
}

  function Save_form() {

    form_id=$("div.tab-content div.active").attr('form_id');
    var dataArray = {};
    msg_title='';
    var row_id=0;

    if(form_id==1){
        dataArray['PFEmployee']=$.trim($('#pf_e').val());
        dataArray['PFEmployer']=$.trim($('#pf_er').val());




        row_id = $('#pf_settings_id').val();
                    
        msg_title="PF Setting";
     
     }

     else if(form_id==2){

      dataArray['ESIEmployee']=$.trim($('#esi_e').val());

      dataArray['ESIEmployer']=$.trim($('#esi_er').val());




        row_id = $('#pf_settings_id').val();
                    
        msg_title="ESI Setting";


     }

     else if(form_id==3){

      dataArray['DAPoint']=$.trim($('#da_pt').val());

      dataArray['Value']=$.trim($('#da_val').val());



      




        row_id = $('#da_settings_id').val();
                    
        msg_title="Da Setting";


     }
     else if(form_id==4){
      arr={};

      $(".allowance_amount").each(function(key,val){

arr['allowance_amount']=$(this).val(),
arr['id']=$(this).attr('id')
      });



      var allowance_amount = $(".allowance_amount").map(function(){
    
    return {
      allowance_amount:$(this).val(),
      id: $(this).attr('id'),
    } 
}).get();

      dataArray['Allowance']=$.trim($('#alwc_day').val());

      dataArray['Allowance_month']=$.trim($('#alwc_mth').val());
      dataArray['OTWage']=$.trim($('#otw').val());
      dataArray['city_allowance']=$.trim($('#alwnc_ct').val());
      dataArray['ReliefAmt']=$.trim($('#alwnc_ta').val());
      dataArray['allowance_amount']=arr;




        row_id = $('#alwc_settings_id').val();
                    
        msg_title="Allownece Setting";


     }
     else if(form_id==5){

      dataArray['LWF']=$.trim($('#lwf').val());





        row_id = $('#lwf_settings_id').val();
                    
        msg_title="LWF Setting";


     }
     else if(form_id==6){


      var pf_dedc='';
          pf_dedc = $("input[name='pf_dedc']:checked").map(function(){
                      return $(this).val();
                    }).get().join(',');


                    var esi_dedc='';
          esi_dedc = $("input[name='esi_dedc']:checked").map(function(){
                      return $(this).val();
                    }).get().join(',');
		


                    dataArray['PFOn']=pf_dedc;
        dataArray['ESIOn']=esi_dedc;

      dataArray['Monthly']=$.trim($("input[name='Monthly']:checked").val());

      
        dataArray['DAFromPoint']=$.trim($("input[name='DAFromPoint']:checked").val());
        dataArray['MaxWDays']=$.trim($('#max_dys').val());
      if($('#cat').attr('readonly')){
        dataArray['Category']=$.trim($('#scat option').filter(':selected').html());
        dataArray['CategoryCode']=$.trim($('#scat').val());
        dataArray['emp_cat_id']=$.trim($('#scat option').filter(':selected').attr('emp_cat_id'));
        }else{
        dataArray['Category']=$.trim($('#cat').val());
        dataArray['emp_cat_id']='';
        }




        row_id = $('#cat_settings_id').val();
                    
        msg_title="Category Setting";


     }


     else if(form_id==7){

dataArray['punching_gap']=$.trim($('#pnch_gp').val());
dataArray['full_min_hr']=$.trim($('#f_day_min').val());
dataArray['full_max_hr']=$.trim($('#f_day_max').val());
dataArray['half_min_hr']=$.trim($('#h_day_min').val());
dataArray['half_max_hr']=$.trim($('#h_day_max').val());
dataArray['quater_min_hr']=$.trim($('#q_day_min').val());
dataArray['quater_max_hr']=$.trim($('#q_day_max').val());





  row_id = $('#pnch_settings_id').val();
              
  msg_title="Punch  Setting";


}


  arr={
              "cid":"<?php echo e(Session::get('cid')); ?>",
              "CID":"<?php echo e(Session::get('CID')); ?>",
            
              "row_id":$.trim($('#row_id').val()),

              "form_id":form_id,
              "dataArray":dataArray,
              "msg_title":msg_title,
              "row_id":row_id,
        "added_by":"<?php echo e(Session::get('user_id')); ?>"
  };


  console.log(JSON.stringify(arr));
           $.ajax({
          url: "/store_data",
          type: "POST",
          data:{
             '_token': "<?php echo e(csrf_token()); ?>",
              json_data: JSON.stringify(arr),
              url1:'prl_settings_save.php'
             
          },
          success:function(response){
            
            // console.log(response);
            if (response) {
              alert(response['msg']);
            
               $('.add_main_modal').modal('hide');
               fetch_view_table();
            }else{

            }
          },
          error: function(response) {

            console.log(response)
          }
         });
  }

  $( ".add_main_modal" ).on('hidden.bs.modal', function(){ $('#add_btn').show();
$('#edit_btn').hide();
 $('#hidden_status').val(0);
 $('.add_main_modal .form-control form-control-sm').val('');
});









fetch_settings();

function fetch_settings() {

        $.ajax({
              type: 'POST',
               async: false,
                url: '/get_data',
                data: {
                     '_token': "<?php echo e(csrf_token()); ?>",
                    'cid':"<?php echo e(Session::get('cid')); ?>",
                     row_id: 1,
                     CID: "<?php echo e(Session::get('CID')); ?>",
              url1:'prl_fetch_settings.php'
                },
                error: function (request, error) {
                    alert("Please Wait, Loading...");
                },
                success: function (response) {
pfsettings=response.pfsettings;
dasettings=response.dasettings;
allowneces=response.allowneces;
alenc_mstr=response.alenc_mstr;
pnch=response.pnch;


$("#pf_e").val(pfsettings[0]['PFEmployee']);
$("#pf_er").val(pfsettings[0]['PFEmployer']);
$("#pf_settings_id").val(pfsettings[0]['pf_st_id']);

$("#esi_e").val(pfsettings[0]['ESIEmployee']);
$("#esi_er").val(pfsettings[0]['ESIEmployer']);
$("#pf_settings_id").val(pfsettings[0]['pf_st_id']);



$("#da_pt").val(dasettings[0]['DAPoint']);
$("#da_val").val(dasettings[0]['Value']);
$("#pf_settings_id").val(pfsettings[0]['pf_st_id']);


$("#alwc_day").val(allowneces[0]['Allowance']);
$("#alwc_mth").val(allowneces[0]['Allowance_month']);
$("#otw").val(allowneces[0]['OTWage']);
$("#alwnc_ct").val(allowneces[0]['city_allowance']);
$("#alwc_settings_id").val(allowneces[0]['Allowance_id']);


$("#lwf").val(allowneces[0]['LWF']);
$("#lwf_settings_id").val(allowneces[0]['Allowance_id']);






$("#pnch_gp").val(pnch[0]['punching_gap']);
$("#f_day_min").val(pnch[0]['full_min_hr2']);
$("#f_day_max").val(pnch[0]['full_max_hr2']);
$("#h_day_min").val(pnch[0]['half_min_hr2']);
$("#h_day_max").val(pnch[0]['half_max_hr2']);
$("#q_day_min").val(pnch[0]['quater_min_hr2']);
$("#q_day_max").val(pnch[0]['quater_max_hr2']);

$("#pnch_settings_id").val(pnch[0]['p_id']);



$(alenc_mstr).each(function(key,val){


$(".allowance_amount[id='"+val['id']+"']").val(val['allowance_amount']);

});

          
         
     
            
        
        }
          
     });  
}






function calculat_hour_to_index(element_id){

var working_hours = $('#'+element_id).val();

var ResArr = working_hours.split(':'); 	
var hr = ResArr[0];

 var firstportion = hr.slice(0, 1);

if(firstportion=="-")
{
var neg=-1;	
hr=(parseFloat(hr) * -1);
}
else
{
var neg=1;	
}

ResArr[1] = ResArr[1] || 0;
var mm = ResArr[1].length;

if(mm<2)
{
ResArr[1]+=0	
}

if(hr>23 || ResArr[1]>59)
{
	   alert("Invalid Time format is HH:MM (Limit -23:59 to 23:59)");
	   $('#'+element_id).val('0:00');
	   $('#'+element_id).attr('working_index',index_hr);
}
else
{

var minute = (parseFloat(ResArr[1]) / 60);
var index_hr = parseFloat(hr) + parseFloat(minute);
index_hr = (parseFloat(index_hr) * neg);
$('#'+element_id).attr('working_index',index_hr);

}
}



$('#scat').change(function() {
   if($(this).val()!='') {
     $('#save_btn').val('Edit');
     $('#CategoryCode').val($('#scat').val());
     $('#cat').val($('#scat option').filter(':selected').html());
     $('#cat').attr('readonly',true);
     $.ajax({
                type: 'POST',
                async:false,
                url: '/fetch_emp_cat',


                data: {
                     '_token': "<?php echo e(csrf_token()); ?>",
                    'cid':"<?php echo e(Session::get('cid')); ?>",
                     row_id: 1,
                     CID: "<?php echo e(Session::get('CID')); ?>",
              url1:'prl_fetch_emp_cat.php',
              emp_cat_id:$('#scat option').filter(':selected').attr('emp_cat_id')
                },
              
               
                error: function (request, error) {
                    alert("Please Wait, Loading...");
                },
                success: function (response) {
                  
                  console.log(response);

                  $("input[name='DAFromPoint'][value='"+response[0]['DAFromPoint']+"']").prop('checked', true);

                  $("#max_dys").val(response[0]['MaxWDays']);
                  $("input[name='Monthly'][value='"+ response[0]['Monthly']+"']").prop('checked', true);
                  $('input[name="pf_dedc"]').prop('checked',false);
                  $('input[name="esi_dedc"]').prop('checked',false);
                   pf_strg = response[0]['PFOn'].split(",");
                   $(pf_strg).each(function(key,val){

                    $("input[name='pf_dedc'][value='"+val+"']").prop('checked', true);
                   });
                   esi_strg = response[0]['ESIOn'].split(",");
                   $(esi_strg).each(function(key,val){

                    $("input[name='esi_dedc'][value='"+val+"']").prop('checked', true);
                   });



                }
                                                    
            });
   }else{
      $('#save_btn').val('Save');
      $('#cat').attr('readonly',false);
      $('#CategoryCode').val('');
      $('#scat').val('');
      $('#MaxWDays').val('');
      $("input[name='DAFromPoint']").prop('checked', false);
      $('input[name="pf_dedc"]').prop('checked',false);
      $('input[name="esi_dedc"]').prop('checked',false);
   }
});





</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\xampp\htdocs\payroll\resources\views/setting_master.blade.php ENDPATH**/ ?>