<?php $__env->startSection('content'); ?>
<!-- can_employments content -->
<div class="right_col" role="main">
  <div class="row x_panel">
    <div class="col-md-12 col-sm-12 col-xs-12">
    <h1>Employment</h1>
<?php if(isset($data)){ ?>
<form action="<?php echo url('/'); ?>/admin/can_employments/edit" id="" class="form-horizontal " method="post" enctype="multipart/form-data">
<?php echo e(csrf_field()); ?>

<input type="hidden" name="emp_id" value="<?php echo $data->emp_id; ?>">


<!-- Designation Start -->
<div class="form-group">
  <label for="designation" class="col-sm-3 control-label"> Designation <span style="color: red">*</span></label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="designation" name="designation" value="<?php echo e($data->designation); ?>" >
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("designation")); ?></div>
      </div>
</div> 
<!-- Designation End -->



<!-- Organization Start -->
<div class="form-group">
  <label for="organization" class="col-sm-3 control-label"> Organization <span style="color: red">*</span></label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="organization" name="organization" value="<?php echo e($data->organization); ?>" >
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("organization")); ?></div>
      </div>
</div> 
<!-- Organization End -->


    <div class="form-group">
      <label class="col-sm-3 control-label">Industry</label>
      <div class="col-sm-4" id="industryOther">
        <select class="form-control select2" name="industry" id="industry">
          <option value="">Select</option>
          <?php $__currentLoopData = $industries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $industry): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
          <option value="<?php echo e($industry->indu_id); ?>" <?php if($data->industry==$industry->indu_id){echo 'selected';}?>><?php echo e($industry->indu_title); ?></option>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          <option value="0" <?php if($data->industry=="0"){echo 'selected';}?>>Other</option>
        </select><br><br>
        <input type="text" class="form-control" name="other_industry" id="otherInd" <?php if($data->industry_other==""): ?> style="display: none;" <?php else: ?> value="<?php echo e($data->industry_other); ?>" <?php endif; ?>>
        <meta charset="utf-8" name="m_industry_other" content="<?php echo e($data->industry_other); ?>">
      </div>
    </div>
      
    <div class="form-group">
      <label class="col-sm-3 control-label">Functional Area</label>
      <div class="col-sm-4" id="functionOther">
        <select class="form-control select2" name="functional_area" id="functional_area" onchange="getRoles(this.value)">
          <option value="">Select</option>
          <?php $__currentLoopData = $functional_areas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $functional_area): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
          <option value="<?php echo e($functional_area->fun_id); ?>" <?php if($data->functional_area==$functional_area->fun_id){echo 'selected';}?>><?php echo e($functional_area->fun_functional_area); ?></option>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          <option value="0" <?php if($data->functional_area=='0'){echo "selected";}?>>Other</option>
        </select><br><br>
        <input type="text" class="form-control" name="other_functional_area" id="otherFun" <?php if($data->functional_area_other==""): ?> style="display: none" <?php else: ?> value="<?php echo e($data->functional_area_other); ?>" <?php endif; ?>>
        <meta charset="utf-8" name="m_functional_area_other" content="<?php echo e($data->functional_area_other); ?>">
      </div>
    </div>    

    <div class="form-group">
      <label class="col-sm-3 control-label">Role</label>
      <div class="col-sm-4" id="roleOther">
        <select class="form-control select2" name="role" id="role">
          <option value="">Select</option>
        </select><br><br>
        <input type="text" class="form-control" name="other_roles" id="otherRole" <?php if($data->sub_functional_area_other==""): ?> style="display: none" <?php else: ?> value="<?php echo e($data->sub_functional_area_other); ?>" <?php endif; ?>>
        <meta charset="utf-8" name="m_role" content="<?php echo e($data->sub_functional_area); ?>">
        <meta charset="utf-8" name="m_role_other" content="<?php echo e($data->sub_functional_area_other); ?>">
      </div>
    </div>

    <!-- Current_company Start -->
    <div class="form-group">
        <label class="col-sm-3 control-label">Current Company <span style="color: red">*</span></label>
        <div class="col-sm-4">
            <span style="margin-right:20px;"><input type="radio" style="width:20px; height:20px;" <?php echo $data->current_company=="1"?'checked="checked"':""; ?> name="current_company" value="1" onclick="checkRadio()"> Yes </span>
            <span style="margin-right:20px;"><input type="radio" style="width:20px; height:20px;" <?php echo $data->current_company=="0"?'checked="checked"':""; ?> name="current_company" value="0" onclick="checkRadio()"> No </span>
        </div>
    </div>
    <!-- Current_company End -->

    

<!-- Work_from_year Start -->
<div class="form-group">
  <label for="work_from_year" class="col-sm-3 control-label"> Work From <span style="color: red">*</span></label>
  <div class="col-sm-2">
    <input type="text" class="form-control year" id="work_from_year" name="work_from_year" value="<?php echo e($data->work_from_year); ?>" placeholder="Year">
  </div>
  <div class="col-sm-2">
    <input type="text" class="form-control month" id="work_from_month" name="work_from_month" value="<?php echo e($data->work_from_month); ?>" placeholder="Month">
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("work_from_year")); ?></div>
         <div class="label label-danger"><?php echo e($errors->first("work_from_month")); ?></div>
      </div>
</div> 
<!-- Work_from_year End -->



<!-- Work_till_year Start -->
<div class="form-group">
  <label for="work_till_year" class="col-sm-3 control-label"> Work Till <span style="color: red">*</span></label>
  <div class="col-sm-4" id="pdiv">
      <input type="text" class="form-control " id="work_till" name="work_till" value="Present" readonly style="background-color: #fff;">
  </div>
  <div id="radioDiv" style="display: none">
    <div class="col-sm-2">
      <input type="text" class="form-control year" id="work_till_year" name="work_till_year" value="<?php echo e($data->work_till_year); ?>" placeholder="Year">
    </div>
    <div class="col-sm-2">
      <input type="text" class="form-control month" id="work_till_month" name="work_till_month" value="<?php echo e($data->work_till_month); ?>" placeholder="Month">
    </div>
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("work_till_year")); ?></div>
         <div class="label label-danger"><?php echo e($errors->first("work_till_month")); ?></div>
      </div>
</div> 
<!-- Work_till_year End -->


<!-- Current_salary_lacs Start -->
<div class="form-group">
  <label for="current_salary_lacs" class="col-sm-3 control-label"> Current Salary <span style="color: red">*</span></label>
  <div class="col-sm-2">
    <input type="number" class="form-control" id="current_salary_lacs" name="current_salary_lacs" value="<?php echo e($data->current_salary_lacs); ?>" placeholder="In Lacs">
  </div>
  <div class="col-sm-2">
    <input type="number" class="form-control" id="current_salary_thousand" name="current_salary_thousand" value="<?php echo e($data->current_salary_thousand); ?>" placeholder="In Thousand">
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("current_salary_lacs")); ?></div>
         <div class="label label-danger"><?php echo e($errors->first("current_salary_thousand")); ?></div>
      </div>
</div> 
<!-- Current_salary_lacs End -->


    <!-- Currency Start -->
    <div class="form-group">
        <label class="col-sm-3 control-label">Currency</label>
        <div class="col-sm-4">
            <span style="margin-right:20px;"><input type="radio" style="width:20px; height:20px;" <?php echo $data->currency=="1"?'checked="checked"':""; ?> name="currency" value="1"> Indian Rupees </span>
            <span style="margin-right:20px;"><input type="radio" style="width:20px; height:20px;" <?php echo $data->currency=="2"?'checked="checked"':""; ?> name="currency" value="2"> Us Dollers </span>
        </div>
    </div>
    <!-- Currency End -->

    

<!-- Skill Start -->
<div class="form-group">
  <label for="skill" class="col-sm-3 control-label"> Skill </label>
  <div class="col-sm-4">
    <select class="form-control select2" id="skill" name="skill" multiple>
          <?php $__currentLoopData = $skills; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
          <option value="<?php echo e($value->skills_id); ?>" <?php ($data->skill==$value->skills_id) ? 'selected' : '';?>><?php echo e($value->skills); ?></option>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("skill")); ?></div>
      </div>
</div> 
<!-- Skill End -->


<!-- Job_profile Start -->

<div class="form-group">
  <label for="job_profile" class="col-sm-3 control-label"> Job Profile </label>
  <div class="col-sm-4">
    <textarea class="form-control" id="job_profile" name="job_profile"><?php echo e($data->job_profile); ?></textarea>
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("job_profile")); ?></div>
      </div>
</div> 

<!-- Job_profile End -->


<!-- Notice_period Start -->
<div class="form-group">
  <label for="notice_period" class="col-sm-3 control-label"> Notice Period <span style="color: red">*</span></label>
  <div class="col-sm-4">
     <select class="form-control" id="notice_period" name="notice_period">
          <option value="">Select</option>
          <option value="1" <?php echo ($data->notice_period=='1') ? "selected":"";?>>15 Days Or Less</option>
          <option value="2" <?php echo ($data->notice_period=='2') ? "selected":"";?>>1 Months</option>
          <option value="3" <?php echo ($data->notice_period=='3') ? "selected":"";?>>2 Months</option>
          <option value="4" <?php echo ($data->notice_period=='4') ? "selected":"";?>>3 Months</option>
          <option value="5" <?php echo ($data->notice_period=='5') ? "selected":"";?>>More than 3 Months</option>
          <option value="6" <?php echo ($data->notice_period=='6') ? "selected":"";?>>Serving Notice Period</option>
        </select>
  </div>
  <div class="col-sm-5">
         <div class="label label-danger"><?php echo e($errors->first("notice_period")); ?></div>
      </div>
</div> 
<!-- Notice_period End -->



    <!-- Status Start -->
     <div class="form-group">
        <label class="control-label col-md-3">Status</label>                    
         <div class=" col-md-4 switch">
                    <div class="onoffswitch">
     <input type="checkbox" class="onoffswitch-checkbox"  data-on-label="Yes" data-off-label="No"  name="status" value="1" id="status" <?php if($data->status == 1){echo "checked=checked";}?> style="width:20px; height:20px;"/>
                    </div>
                </div>
      </div>
      <!-- Status End -->


  <div class="form-group">
  <div class="col-sm-3">
  </div>
   <div class="col-sm-6">
    <input type="hidden" name="rel_field" id="rel_field" value="<?php echo $rel_field; ?>">
    <input type="hidden" name="rel_id" id="rel_id" value="<?php echo $rel_id; ?>">
    <button type="reset" class="btn btn-default ">Reset</button>
    <button type="submit" class="btn btn-info ">Update</button>
   </div>
  </div>
</form>
<?php } else{
    echo '<h2 align="center" class="text-danger">No record found!</h2>';
  } ?>
    </div>
  </div>
</div>
<!-- /can_employments content -->
<script type="text/javascript">
  $(document).ready(function(){
    checkRadio();
    getRoles($('#functional_area').val());

    var textbox = '';
    var selectedText = $('#industry').val();
    // console.log(selectedText);
    if(selectedText!=null && selectedText.includes('0'))
    {
      $('#otherInd').show();
    }else{
      $('#otherInd').hide();
    }
    $('input[name="other_industry"]').val($('meta[name="m_industry_other"]').attr('content'));    
  });

  function checkRadio()
  {
    var radio = $('input[name="current_company"]:checked').val();
    if(radio==1)
    {
      $('#pdiv').show();
      $('#radioDiv').hide();
    }
    else
    {
      $('#pdiv').hide();
      $('#radioDiv').show();     
    }
  }

  function getRoles(fun_id)
  {
    var selectedText = $('#functional_area').val();
    // console.log(selectedText);
    if(selectedText!=null && selectedText.includes('0'))
    {
      $('#otherFun').show();
    }else{
      $('#otherFun').hide();
    }
    $('input[name="other_functional_area"]').val($('meta[name="m_functional_area_other"]').attr('content'));

    $.ajax({
      type:'post',
      url:'<?php echo e(url("/")); ?>/admin/getRoles',
      data:{'_token':'<?php echo e(csrf_token()); ?>','fun_id':fun_id},
      dataType:'json',
      success:function(res)
      {
        // console.log(res);
        var role = '';
        role += '<option value="">Select</option>';
        if(res.length>0)
        {
          for(var i=0;i<res.length;i++)
          {
            role += '<option value='+res[i].sub_id+'>'+res[i].sub_functional_title+'</option>';
          }
        }
        role += '<option value="0">Other</option>';

        $('#role').html(role);
        $('#role').val($('meta[name="m_role"]').attr('content')).trigger('change');
      }
    });
  }

    $('#industry').change(function(){
    var selectedText = $(this).val();
    // console.log(selectedText);
    if(selectedText!=null && selectedText.includes('0'))
    {
      $('#otherInd').show();
    }else{
      $('#otherInd').hide();
    }
  });

  $('#role').change(function(){
    var selectedText = $(this).val();
    // console.log(selectedText);
    if(selectedText!=null && selectedText.include('0'))
    {
      $('#otherRole').show();
    }else{
      $('#otherRole').hide();
    }
    $('input[name="other_roles"]').val($('meta[name="m_role_other"]').attr('content'));
  });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>