HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/hrms-production/resources/views/components/employee-profile-modal.blade.php
{{-- Update Primary Detail Modal --}}
<div class="modal fade" id="editEmpPrimaryDetail">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">Employee Name <span id="EmployeeProfileName" class="text-info"></span></h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <!-- Main content -->
        <form id="editEmpPrimaryDetailFrom">
          <input type="hidden" name="_token" id="token_profile" value="{{ csrf_token() }}">
          <input type="hidden" id="EditProfileEmployeeId" name="EmployeeId">
          <div class="card-body">
            <div class="row">
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="NameTitle">Name Title <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="NameTitle" id="NameTitle" data-placeholder="Select Name Title">
                    <option value="" disabled selected>Select Title <span class="text-danger">*</span></option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Employees Name">Name of Employee <span class="text-danger">*</span></label>
                  <input type="text" id="EmployeeName" name="EmployeeName" class="form-control form-control-sm"
                    required>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Appointment Order No">Appointment Order No. <span
                      class="text-danger">*</span></label>
                  <input type="text" id="AppointmentOrderNo" name="AppointmentOrderNo"
                    class="form-control form-control-sm">
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="AppointmentOrderDate">Appointment Order Date <span
                      class="text-danger">*</span></label>
                  <div class="input-group date" id="OrderDate" data-target-input="nearest">
                    <input type="text" id="AppointmentOrderDate" name="AppointmentOrderDate"
                      class="form-control form-control-sm datetimepicker-input" data-target="#AppointmentOrderDate"
                      placeholder="DD/MM/YYYY" />
                    <div class="input-group-append" data-target="#AppointmentOrderDate" data-toggle="datetimepicker">
                      <div class="input-group-text"><i class="fa fa-calendar"></i>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="DDO">DDO</label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="DDO" id="DDO" data-placeholder="Select DDO">
                    <option value="" disabled selected>Select DDO <span class="text-danger">*</span>
                    </option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="ControllingOfficer">Controlling Officer <span
                      class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="ControllingOfficer" id="ControllingOfficer" data-placeholder="Select Controlling Officer">
                    <option value="" disabled selected>Select Controlling Officer</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0">Actual Work Place</label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="WorkPlace" id="WorkPlace" data-placeholder="Place Name">
                    <option value="" selected disabled>Place Name</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Department Name">Name of Department <span
                      class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="DepartmentName" id="DepartmentName" data-placeholder="Select Department">
                    <option value="" selected disabled>Select Department</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0">Appointment by <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="AppointmentBy" id="AppointmentBy" data-placeholder="Select One">
                    <option value="" selected disabled>Select One</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2" id="MeritListNo_field">
                  <label class="mb-0" for="MeritListNo">Merit List No. </label>
                  <input type="text" id="MeritListNo" name="MeritListNo" class="form-control form-control-sm" />
                </div>
                <div class="form-group mb-2" style="display: none;" id="LowerCadreSeniority_field">
                  <label class="mb-0" for="Lower Cadre Seniority">Lower Cadre Seniority maintain<span
                      class="text-danger">*</span></label>
                  <input type="text" id="LowerCadreSeniority" name="LowerCadreSeniority"
                    class="form-control form-control-sm" />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0">Group (Class) <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="Group" id="Group" data-placeholder="Select Group">
                    <option value="" selected disabled>Select Group</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0">Cadre <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="Cadre" id="Cadre" data-placeholder="Select Cadre">
                    <option value="" selected disabled>Select Cadre</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0">Designation (Current Post) <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="EmployeeDesignation" id="EmployeeDesignation" data-placeholder="Select Designation">
                    <option value="" selected disabled>Select One</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0">Faculty <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="Faculty" id="Faculty" data-placeholder="Select Faculty">
                    <option value="" selected disabled>Select Faculty</option>
                  </select>
                </div>
              </div>

              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0">Sanction Post <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="SanctionPost" id="SanctionPost" data-placeholder="Select Sanction Post">
                    <option value="" selected disabled>Select Sanction Post</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Scheme Name">Name of Scheme <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="SchemeNameId" id="SchemeNameId" data-placeholder="Select Scheme">
                    <option value="" disabled selected>Select Scheme</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="date">Date of Birth <span class="text-danger">*</span></label>
                  <div class="input-group date" id="BirthDate" data-target-input="nearest">
                    <input type="text" id="DateOfBirth" name="DateOfBirth"
                      class="form-control form-control-sm datetimepicker-input" data-target="#DateOfBirth"
                      placeholder="DD/MM/YYYY" />
                    <div class="input-group-append" data-target="#DateOfBirth" data-toggle="datetimepicker">
                      <div class="input-group-text"><i class="fa fa-calendar"></i>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <div class="form-group clearfix">
                    <label class="mb-0" for="date">Joining Time: </label>
                    <div class="col-sm-12">
                      <div class="icheck-primary d-inline">
                        <input type="radio" id="forenoon" value="Forenoon" name="JoiningTime" checked="">
                        <label class="mb-0" for="forenoon">Forenoon</label>
                      </div>
                      <div class="icheck-primary d-inline">
                        <input type="radio" id="afternoon" value="Afternoon" name="JoiningTime">
                        <label class="mb-0" for="afternoon">Afternoon</label>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="date">Joining Date <span class="text-danger">*</span></label>
                  <div class="input-group date" id="ServiceJoiningDate" data-target-input="nearest">
                    <input type="text" id="JoiningDate" name="JoiningDate"
                      class="form-control form-control-sm datetimepicker-input" data-target="#JoiningDate"
                      placeholder="DD/MM/YYYY" />
                    <div class="input-group-append" data-target="#JoiningDate" data-toggle="datetimepicker">
                      <div class="input-group-text"><i class="fa fa-calendar"></i>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="RetirementAge">Retirement Age <span class="text-danger">*</span></label>
                  <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true"
                    name="RetirementAge" id="RetirementAge" data-placeholder="Select Year">
                    <option value="" selected disabled>Select Year</option>
                    <option value="58 years">58 years</option>
                    <option value="60 years">60 years</option>
                    <option value="62 years">62 years</option>
                    <option value="65 years">65 years</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="date">Retirement Date <span class="text-danger">*</span></label>
                  <div class="input-group date" id="DateOfRetirement" data-target-input="nearest">
                    <input type="text" id="RetirementDate" name="RetirementDate"
                      class="form-control form-control-sm datetimepicker-input" data-target="#RetirementDate"
                      placeholder="DD/MM/YYYY" />
                    <div class="input-group-append" data-target="#RetirementDate" data-toggle="datetimepicker">
                      <div class="input-group-text"><i class="fa fa-calendar"></i>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Probation Period">Probation Period Clear Date </label>
                  <div class="input-group date" id="DateOfProbationPeriod" data-target-input="nearest">
                    <input type="text" id="ProbationPeriodDate" name="ProbationPeriodDate"
                      class="form-control form-control-sm datetimepicker-input" data-target="#ProbationPeriodDate"
                      placeholder="DD/MM/YYYY">
                    <div class="input-group-append" data-target="#ProbationPeriodDate" data-toggle="datetimepicker">
                      <div class="input-group-text"><i class="fa fa-calendar"></i>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <hr />
            <div class="row">
              <div class="col-12">
                <div class="d-flex align-items-center justify-content-center">
                  <button type="button" class="btn btn-sm btn-outline-secondary mx-1" data-dismiss="modal"
                    aria-label="Close">Cancel</button>
                  <button type="submit" name="Update" value="Update" class="btn btn-sm btn-info mx-1">Update</button>
                </div>
              </div>
            </div>
        </form>
      </div>
    </div>
  </div>
  <!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->

{{-- Update Contact Detail Modal --}}
<div class="modal fade" id="editEmpContactDetail">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">Employee Name <span id="EditContactEmployeeName" class="text-info"></span></h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <!-- Main content -->
        <form id="editEmpContactDetailForm">
          <input type="hidden" name="_token" id="token_contact" value="{{ csrf_token() }}">
          <input type="hidden" id="EditContactEmployeeId" name="EmployeeId">
          <div class="card-body">
            <div class="row">
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Mobile">Mobile No. <span class="text-danger">*</span></label>
                  <input type="tel" onkeyup="onlyNumbers(this)" id="MobileNo" name="MobileNo"
                    class="form-control form-control-sm">
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="AlternateMobile">Alternate Mobile No.</label>
                  <input type="tel" onkeyup="onlyNumbers(this)" id="AlternateMobileNo" name="AlternateMobileNo"
                    class="form-control form-control-sm">
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Aadhar Card">Aadhar Card No. <span class="text-danger">*</span></label>
                  <input type="text" id="AadharCardNo" name="AadharCardNo" class="form-control form-control-sm"
                    readonly>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Pan Card">Pan Card No. <span class="text-danger">*</span></label>
                  <input type="text" id="PanCardNo" name="PanCardNo" class="form-control form-control-sm"
                    style="text-transform: uppercase">
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group mb-2">
                  <label class="mb-0" for="Email">Email ID</label>
                  <input type="email" id="EmailId" name="EmailId" class="form-control form-control-sm">
                </div>
              </div>
            </div>
            <hr />
            <div class="row">
              <div class="col-12">
                <div class="d-flex align-items-center justify-content-center">
                  <button type="button" class="btn btn-sm btn-outline-secondary mx-1" data-dismiss="modal"
                    aria-label="Close">Cancel</button>
                  <button type="submit" name="Update" value="Update" class="btn btn-sm btn-info mx-1">Update</button>
                </div>
              </div>
            </div>
        </form>
      </div>
    </div>
  </div>
  <!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
{{-- JS Start Here --}}

{{-- Change Nomination / Promotion field Appointment by --}}
<script>
  $(document).ready(function() {
          $("#AppointmentBy").change(function() {
              //alert($(this).val())
             // $("#LowerCadreSeniority").val('');
             // $("#MeritListNo").val('');
              if ($(this).val() == "W8whXFgWakAvkHU6OTgvgXBVPZgmQNveI48YY") { // Promotion
                  $("#MeritListNo_field").css('display', 'none');
                  $("#MeritListNo").prop('required', false);
                  $("#LowerCadreSeniority_field").css('display', 'block');
                  $("#LowerCadreSeniority").prop('required', true);
              } else {
                  $("#MeritListNo_field").css('display', 'block');
                  $("#MeritListNo").prop('required', true);
                  $("#LowerCadreSeniority_field").css('display', 'none');
                  $("#LowerCadreSeniority").prop('required', false);
              }
          });
      });
</script>

{{-- Master Data List assign to field --}}
<script>
  // Name Title
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/name-title-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.NameTitle;
              $.each(json, function(i, title) {
                $("#NameTitle").append("<option value='" + title.NameTitleId + "'>" + title.NameTitle + "</option>");
                $('#NameTitle').trigger('change');
              });
            }
          });
      });
    // Appointment By List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/appointment-by-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.AppointmentBy;
              $.each(json, function(i, appointmentBy) {
                $("#AppointmentBy").append("<option value='" + appointmentBy.AppointmentId + "'>" + appointmentBy.AppointmentByName + "</option>");
                $('#AppointmentBy').trigger('change');
              });
            }
          });
      });
    // DDO List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/ddo-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.DDOList;
              $.each(json, function(i, ddo) {
                $("#DDO").append("<option value='" + ddo.DDOId + "'>" + ddo.DDOName + "</option>");
                $('#DDO').trigger('change');
              });
            }
          });
      });
    // Controlling Officer List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/controlling-officer-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.ControllingOfficerList;
              $.each(json, function(i, officer) {
                $("#ControllingOfficer").append("<option value='" + officer.ControllingOfficerId + "'>" + officer.ControllingOfficerName + "</option>");
                $('#ControllingOfficer').trigger('change');
              });
            }
          });
      });
    // Sanction Post List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/sanction-post-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.SanctionPost;
              $.each(json, function(i, SanctionPost) {
                $("#SanctionPost").append("<option value='" + SanctionPost.SanctionPostId + "'>" + SanctionPost.SanctionPostName + "</option>");
                $('#SanctionPost').trigger('change');
              });
            }
          });
      });
  
    // Faculty List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/faculty-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.Faculty;
              $.each(json, function(i, faculty) {
                $("#Faculty").append("<option value='" + faculty.FacultyId + "'>" + faculty.FacultyName + "</option>");
                $('#Faculty').trigger('change');
              });
            }
          });
      });
  
    // PayScale List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/payscale-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.PayScale;
              $.each(json, function(i, payscale) {
                $("#PayScale").append("<option value='" + payscale.PayScaleId + "'>" + payscale.PayScaleName + "</option>");
                $('#PayScale').trigger('change');
              });
            }
          });
      });
  
    // PayBand List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/payband-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.PayBand;
              $.each(json, function(i, payband) {
                $("#PayBandId").append("<option value='" + payband.PayBandId + "'>" + payband.PayBandName + "</option>");
                $('#PayBandId').trigger('change');
              });
            }
          });
      });
    
    // Name Of Scheme List
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/scheme-name-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.SchemeNameList;
              $.each(json, function(i, schemename) {
                $("#SchemeNameId").append("<option value='" + schemename.SchemeNameId + "'>" + schemename.NameOfScheme + "</option>");
                $('#SchemeNameId').trigger('change');
              });
            }
          });
      });
</script>

{{-- Form Validation and Store Record --}}
<script>
  $(function () {
      $.validator.setDefaults({
        submitHandler: function () {
            event.preventDefault();
            // Get Form Data
          var token = $("#token_add_emp").val();
          var NameTitle = $('#NameTitle :selected').val();
          var EmployeeName = $('#EmployeeName').val();
          var AppointmentOrderNo = $('#AppointmentOrderNo').val();
          var AppointmentOrderDate = $('#AppointmentOrderDate').val();
          var EmpDDO = $('#DDO :selected').val();
          var ControllingOfficer = $('#ControllingOfficer :selected').val();
          var WorkPlace = $('#WorkPlace :selected').val();
          var DepartmentName = $('#DepartmentName :selected').val();
          var AppointmentBy = $('#AppointmentBy :selected').val();
          var MeritListNo = $('#MeritListNo').val();
          var LowerCadreSeniority = $('#LowerCadreSeniority').val();
          var Group = $('#Group :selected').val();
          var Cadre = $('#Cadre :selected').val();
          var EmployeeDesignation = $('#EmployeeDesignation :selected').val();
          var Faculty = $('#Faculty :selected').val();
          var SanctionPost = $('#SanctionPost :selected').val();
          
          // Employee PayMatrix
          var PayScale = $("#PayScale :selected").val();
          var PayBandId = $("#PayBandId :selected").val();
          var GradePayId = $("#GradePayId :selected").val();
          
          var PayLevelAmount = $('#PayLevelAmount').val();
          var PayLevelId = '';
          var PayLevelAmountId = '';
          if(PayScale == "KmmsPcY7uGEnMyRYmSYlD66z6dwLsMtqG19Qs") // 7th Pay
          {
            var PayLevelId = $("#PayLevelId :selected").val();
            var PayLevelAmountId = $('#PayLevelAmountId :selected').val();
            var GetAmount = $('#PayLevelAmountId').find('option :selected').text();
            var PayLevelAmount = $('#PayLevelAmount').val(GetAmount);
          } 
  
          var SchemeNameId = $('#SchemeNameId :selected').val();
          var MobileNo = $('#MobileNo').val();
          var AlternateMobileNo = $('#AlternateMobileNo').val();
          var AadharCardNo = $('#AadharCardNo').val();
          var PanCardNo = $('#PanCardNo').val().toUpperCase();
          var EmailId = $('#EmailId').val();
          var DateOfBirth = $('#DateOfBirth').val();
          var JoiningTime = $('input[name=JoiningTime]:checked').val();
          var JoiningDate = $('#JoiningDate').val();
          var RetirementAge = $('#RetirementAge :selected').val();
          var RetirementDate = $('#RetirementDate').val();
          var ProbationPeriodDate = $("#ProbationPeriodDate").val();
          
        var fd = new FormData();
              fd.append('_token',token);
              fd.append('NameTitleId',NameTitle);
              fd.append('EmployeeName',EmployeeName);
              fd.append('AppointmentOrderNo',AppointmentOrderNo);
              fd.append('AppointmentOrderDate',AppointmentOrderDate);
              fd.append('DDOId',EmpDDO);
              fd.append('ControllingOfficerId',ControllingOfficer);
              fd.append('ActualWorkPlaceId',WorkPlace);
              fd.append('DepartmentId',DepartmentName);
              fd.append('AppointmentBy',AppointmentBy);
              fd.append('MeritListNo',MeritListNo);
              fd.append('LowerCadreSeniority',LowerCadreSeniority);
              fd.append('Group',Group);
              fd.append('CadreId',Cadre);
              fd.append('DesignationId',EmployeeDesignation);
              fd.append('FacultyId',Faculty);
              fd.append('SanctionPostId',SanctionPost);
              fd.append('PayScalePayCommission',PayScale);
              fd.append('PayLevelId',PayLevelId);
              fd.append('PayBandId',PayBandId);
              fd.append('GradePayId',GradePayId);
              fd.append('PayLevelAmount',PayLevelAmount);
              fd.append('PayLevelAmountId',PayLevelAmountId);
              fd.append('SchemeNameId',SchemeNameId);
              fd.append('MobileNo',MobileNo);
              fd.append('AlternateMobileNo',AlternateMobileNo);
              fd.append('AadharCardNo',AadharCardNo);
              fd.append('PanCardNo',PanCardNo);
              fd.append('EmailId',EmailId);
              fd.append('BirthDate',DateOfBirth);
              fd.append('JoiningTime',JoiningTime);
              fd.append('DateOfJoining',JoiningDate);
              fd.append('RetirementAge',RetirementAge);
              fd.append('DateOfRetirement',RetirementDate);
              fd.append('ClearDateOfProbationPeriod',ProbationPeriodDate);
              
        $.ajax({
                type: "post",
                url: "{{ url('store-employee') }}",
                data: fd,
                contentType: false,
                processData: false,
                success: function(response) {
                  const Toast = Swal.mixin({
                      toast: true,
                      position: 'top-end',
                      showConfirmButton: false,
                      timer: 2000,
                      timerProgressBar: true,
                      didOpen: (toast) => {
                        toast.addEventListener('mouseenter', Swal.stopTimer)
                        toast.addEventListener('mouseleave', Swal.resumeTimer)
                      }
                    })
                    Toast.fire({
                      icon: 'success',
                      title: 'Profile created successfully!'
                    });
                    setTimeout(function(){
                    window.location.reload(1);
                  }, 2000);
                },
                error: function(data) {
                  const Toast = Swal.mixin({
                      toast: true,
                      position: 'top-end',
                      showConfirmButton: false,
                      timer: 2000,
                      timerProgressBar: true,
                      didOpen: (toast) => {
                        toast.addEventListener('mouseenter', Swal.stopTimer)
                        toast.addEventListener('mouseleave', Swal.resumeTimer)
                      }
                    })
                    Toast.fire({
                      icon: 'error',
                      title: 'Something went wrong!'
                    });
                }
            });
        }
      });
      $('#AddEmployeeProfileForm').validate({
        rules: {
          NameTitle: {
            required: true,
          },
          EmployeeName: {
            required: true,
            pattern: '[a-z A-Z]+'
          },
          AppointmentOrderNo: {
           required: true,
          },
          AppointmentOrderDate: {
           required: true,
          },
          DDO: {
            required: true,
          },
          ControllingOfficer: {
            required: true,
          },
          WorkPlace: {
            required: true,
          },
          DepartmentName: {
            required: true,
          },
          AppointmentBy: {
            required: true,
          },
          Group: {
            required: true,
          },
          Cadre: {
            required: true,
          },
          EmployeeDesignation: {
            required: true,
          },
          Faculty: {
            required: true,
          },
          SanctionPost: {
            required: true,
          },
          PayScale: {
            required: true,
          },
          SchemeNameId: {
            required: true,
          },
          EmailId: {
            //required: true,
            email: true,
            remote: {
              type: "POST",
              url:'{{ url("/") }}/check-duplicate-email',
              data: {
                EmailId: function() {
                  return $( "#EmailId" ).val();
                },
                '_token':$('meta[name="csrf-token"]').attr('content')
              }
            }
          },
          AadharCardNo: {
            required: true,
            pattern: '^([0-9]){12}$',
            remote: {
              type: "POST",
              url:'{{ url("/") }}/check-duplicate-adhar',
              data: {
                AadharCardNo: function() {
                  return $( "#AadharCardNo" ).val();
                },
                '_token':$('meta[name="csrf-token"]').attr('content')
              }
            }
          },
          PanCardNo: {
            required: true,
            pattern: '[A-Za-z]{5}[0-9]{4}[A-Za-z]{1}$',
            remote: {
              type: "POST",
              url:'{{ url("/") }}/check-duplicate-pan',
              data: {
                PanCardNo: function() {
                  return $( "#PanCardNo" ).val();
                },
                '_token':$('meta[name="csrf-token"]').attr('content')
              }
            }
          },
          MobileNo: {
            required: true,
            pattern: '^([0-9]){10}$',
            remote: {
              type: "POST",
              url:'{{ url("/") }}/check-duplicate-mobile',
              data: {
                MobileNo: function() {
                  return $( "#MobileNo" ).val();
                },
                '_token':$('meta[name="csrf-token"]').attr('content')
              }
            }
          },
          AlternateMobileNo: {
            pattern: '^([0-9]){10}$',
          },
          DateOfBirth: {
            required: true,
          },
          JoiningDate: {
            required: true,
          },
          RetirementAge: {
            required: true,
          },
          RetirementDate: {
            required: true,
          },
          ProbationPeriodDate: {
            required: true,
          },
          PensionSchemeCertificate: {
          //  required: true,
            accept: "image/*, pdf"
          },
          GISCertificate: {
          //  required: true,
            accept: "image/*, pdf"
          },
        },
        messages: {
          NameTitle: {
            required: "Please select title.",
          },
          EmployeeName: {
            required: "Please enter employee name.",
          },
          EmployeeDesignation: {
            required: "Please select designation.",
          },
          AppointmentOrderNo: {
            required: "Please provide Appointment order no. & date.",
            minlength: "Your Order no. must be at least 5 characters long."
          },
          email: {
          required: "Please enter a email address.",
          email: "Please enter a valid email address."
          },
          AadharCardNo: { 
            pattern: 'Please enter a valid Adhar No.',
            required:"Adhar no. is required.",
            remote:"This Adhar no. is already exist."
          },
          PanCardNo: { 
            pattern: 'Please enter a valid PAN no.',
            required:"PAN no. is required.",
            remote:"This PAN no. is already exist."
          },
          MobileNo: { 
            //pattern: 'Please enter without country code',
            required:"Mobile no. is required.",
            remote:"This Mobile no. is already exist."
          }, 
        },
        errorElement: 'span',
        errorPlacement: function (error, element) {
          error.addClass('invalid-feedback');
          element.closest('.form-group').append(error);
        },
        highlight: function (element, errorClass, validClass) {
          $(element).addClass('is-invalid');
        },
        unhighlight: function (element, errorClass, validClass) {
          $(element).removeClass('is-invalid');
        }
      });
    });
</script>
{{-- Actual Work Place List --}}
<script>
  $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/actual-work-place-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.AWPList;
              $.each(json, function(i, AWPList) {
                $("#WorkPlace").append("<option value='" + AWPList.ActualWorkPlaceId + "'>" + AWPList.ActualWorkPlaceName + "</option>");
                $('#WorkPlace').trigger('change');
              });
            }
          });
        });
</script>
{{-- Department List based on AWP --}}
<script>
  $('#WorkPlace').on('select2:select', function (e) {
        //alert(e.params.data);
          var data = e.params.data;
          var AwpId = data.id;
          getDepartmentList(AwpId);
      });
      function getDepartmentList(AwpId, department_selected = ''){
          var AwpId = AwpId;
          $('#DepartmentName').empty();
              $.ajax({
              type: "GET",
              url: "{{ url('/') }}/get-department-list/" +AwpId,
              dataType: "json",
              success: function(response) {
                  var json = response.Department;
                  $.each(json, function(i, department) {
                      if (department_selected == department.DepartmentId) {
                        $("#DepartmentName").append("<option selected value='" + department.DepartmentId + "'>" + department.DepartmentName + "</option>");
                      $('#DepartmentName').trigger('change');
                      } else {
                        $("#DepartmentName").append("<option value='" + department.DepartmentId + "'>" + department.DepartmentName + "</option>");
                      $('#DepartmentName').trigger('change');
                      }
                      
                  });
              }
          });
      }
</script>
{{-- Group List --}}
<script>
  $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/group-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.Group;
              $.each(json, function(i, group) {
                $("#Group").append("<option value='" + group.GroupId + "'>" + group.GroupName + "</option>");
                $('#Group').trigger('change');
              });
            }
          });
    }); 
</script>
{{-- Cadre List based on Group --}}
<script>
  $('#Group').on('select2:select', function (e) {
        //alert(e.params.data);
          var data = e.params.data;
          var GroupID = data.id;
          getCadreList(GroupID);
      });
      function getCadreList(GroupID, cadre_selected = ''){
          var GroupID = GroupID;
          $('#Cadre').empty();
              $.ajax({
              type: "GET",
              url: "{{ url('/') }}/get-cadre-list/" +GroupID,
              dataType: "json",
              success: function(response) {
                  var json = response.Cadre;
                  $.each(json, function(i, cadre) {
                      if (cadre_selected == cadre.CadreId) {
                        $("#Cadre").append("<option selected value='" + cadre.CadreId + "'>" + cadre.CadreName + "</option>");
                      $('#Cadre').trigger('change');
                      } else {
                        $("#Cadre").append("<option value='" + cadre.CadreId + "'>" + cadre.CadreName + "</option>");
                      $('#Cadre').trigger('change');
                      }
                      
                  });
              }
          });
      }
</script>

{{-- Designation List based on Cadre --}}
<script>
  $('#Cadre').on('select2:select', function (e) {
        //alert(e.params.data);
          var data = e.params.data;
          var CadreID = data.id;
          getDesignationList(CadreID);
      });
      function getDesignationList(CadreID, designation_selected = ''){
          var CadreID = CadreID;
          $('#Designation').empty();
              $.ajax({
              type: "GET",
              url: "{{ url('/') }}/get-designation-list/" +CadreID,
              dataType: "json",
              success: function(response) {
                  var json = response.Designation;
                  $.each(json, function(i, designation) {
                      if (designation_selected == designation.DesignationId) {
                        $("#EmployeeDesignation").append("<option selected value='" + designation.DesignationId + "'>" + designation.DesignationName + "</option>");
                      $('#EmployeeDesignation').trigger('change');
                      } else {
                        $("#EmployeeDesignation").append("<option value='" + designation.DesignationId + "'>" + designation.DesignationName + "</option>");
                      $('#EmployeeDesignation').trigger('change');
                      }
                      
                  });
              }
          });
      }
</script>

{{-- Edit Primary Detail Modal --}}
<script>
  function editEmpPrimaryDetail(EmployeeId)
  {
      var EmployeeId = EmployeeId;
      $.ajax({
          type: "POST",
          url: "{{ url('/') }}/get-employee-detail",
          dataType: 'json',
          data: {
            EmployeeId: EmployeeId,
            _token: "{{ csrf_token() }}",
          },
          success: function (response) {
              $('#EditProfileEmployeeId').val(response.GetEmployee.EmployeeId);
              $('#EditProfileEmployeeCode').val(response.GetEmployee.EmployeeCode);
              $('span#EmployeeProfileName').html('#' +response.GetEmployee.EmployeeName);
              $('#NameTitle').val(response.GetEmployee.NameTitleId);
              $('#NameTitle').trigger('change');
              $('#EmployeeName').val(response.GetEmployee.EmployeeName);
              $('#AppointmentOrderNo').val(response.GetEmployee.AppointmentOrderNo);

              var order = response.GetEmployee.AppointmentOrderDate;
              var AppointmentOrderDate = order.split("-").join("/");
              $('#AppointmentOrderDate').val(AppointmentOrderDate);
              
              $('#DDO').val(response.GetEmployee.DDOId);
              $('#DDO').trigger('change');

              $('#ControllingOfficer').val(response.GetEmployee.ControllingOfficerId);
              $('#ControllingOfficer').trigger('change');

              $('#WorkPlace').val(response.GetEmployee.ActualWorkPlaceId);
              getDepartmentList(response.GetEmployee.ActualWorkPlaceId, response.GetEmployee.DepartmentId)
              $('#WorkPlace').trigger('change');

              $('#DepartmentName').val(response.GetEmployee.DepartmentId);
              $('#DepartmentName').trigger('change');

              $('#AppointmentBy').val(response.GetEmployee.AppointmentBy);
              $('#AppointmentBy').trigger('change');

              var AppointmentByName =  response.GetEmployee.AppointmentByName;
              if (AppointmentByName == 'Promotion') {
                $('#LowerCadreSeniority_field').css('display', 'block');
                $('#LowerCadreSeniority').val(response.GetEmployee.LowerCadreSeniority);
                $('#MeritListNo_field').css('display', 'none');
              } else {
                $('#LowerCadreSeniority_field').css('display', 'none');
                $('#MeritListNo_field').css('display', 'block');
                $('#MeritListNo').val(response.GetEmployee.MeritListNo);
              }

              $('#Group').val(response.GetEmployee.Group);
              getCadreList(response.GetEmployee.Group, response.GetEmployee.CadreId)
              $('#Group').trigger('change');

              $('#Cadre').val(response.GetEmployee.CadreId);
              getDesignationList(response.GetEmployee.CadreId, response.GetEmployee.DesignationId)
              $('#Cadre').trigger('change');

              $('#EmployeeDesignation').val(response.GetEmployee.DesignationId);
              $('#EmployeeDesignation').trigger('change');

              $('#Faculty').val(response.GetEmployee.FacultyId);
              $('#Faculty').trigger('change');

              $('#SanctionPost').val(response.GetEmployee.SanctionPostId);
              $('#SanctionPost').trigger('change');

              $('#SchemeNameId').val(response.GetEmployee.SchemeNameId);
              $('#SchemeNameId').trigger('change');

              var Birth = new Date(response.GetEmployee.DateOfBirth);
              $('#DateOfBirth').val(((Birth.getDate() > 9) ? Birth.getDate() : ('0' + Birth.getDate())) + '/' + ((Birth.getMonth() > 8) ? (Birth.getMonth() + 1) : ('0' + (Birth.getMonth() + 1))) + '/' + Birth.getFullYear());

              if (response.GetEmployee.JoiningTime == 'Forenoon') {
                    $("input#forenoon").prop('checked', true);
                } else {
                    $("input#afternoon").prop('checked', true);
              }

              var Joining = new Date(response.GetEmployee.JoiningDate);
              $('#JoiningDate').val(((Joining.getDate() > 9) ? Joining.getDate() : ('0' + Joining.getDate())) + '/' + ((Joining.getMonth() > 8) ? (Joining.getMonth() + 1) : ('0' + (Joining.getMonth() + 1))) + '/' + Joining.getFullYear());

              $('#RetirementAge').val(response.GetEmployee.RetirementAge);
              $('#RetirementAge').trigger('change');

              var Retirement = new Date(response.GetEmployee.RetirementDate);
              $('#RetirementDate').val(((Retirement.getDate() > 9) ? Retirement.getDate() : ('0' + Retirement.getDate())) + '/' + ((Retirement.getMonth() > 8) ? (Retirement.getMonth() + 1) : ('0' + (Retirement.getMonth() + 1))) + '/' + Retirement.getFullYear());

              if (response.GetEmployee.ProbationPeriodClearDate) {
                var Probation = new Date(response.GetEmployee.ProbationPeriodClearDate);
                $('#ProbationPeriodDate').val(((Probation.getDate() > 9) ? Probation.getDate() : ('0' + Probation.getDate())) + '/' + ((Probation.getMonth() > 8) ? (Probation.getMonth() + 1) : ('0' + (Probation.getMonth() + 1))) + '/' + Probation.getFullYear());
              }

          }
      });
      $('#editEmpPrimaryDetail').modal('show');
  }
</script>

{{-- Primary Detail Validate form and Update data --}}
<script>
  $(function () {
      $.validator.setDefaults({
        submitHandler: function () {
            event.preventDefault();
            // Get Form Data
        $.ajax({
                type: "post",
                url: "{{ url('update-employee-primary-detail') }}",
                data: $("#editEmpPrimaryDetailFrom").serialize(),
                success: function(response) {
                  const Toast = Swal.mixin({
                      toast: true,
                      position: 'top-end',
                      showConfirmButton: false,
                      timer: 2000,
                      timerProgressBar: true,
                      didOpen: (toast) => {
                        toast.addEventListener('mouseenter', Swal.stopTimer)
                        toast.addEventListener('mouseleave', Swal.resumeTimer)
                      }
                    })
                    Toast.fire({
                      icon: 'success',
                      title: 'Primary detail updated successfully!'
                    });
                    setTimeout(function(){
                    window.location.reload(1);
                  }, 2000);
                },
                error: function(data) {
                  const Toast = Swal.mixin({
                      toast: true,
                      position: 'top-end',
                      showConfirmButton: false,
                      timer: 2000,
                      timerProgressBar: true,
                      didOpen: (toast) => {
                        toast.addEventListener('mouseenter', Swal.stopTimer)
                        toast.addEventListener('mouseleave', Swal.resumeTimer)
                      }
                    })
                    Toast.fire({
                      icon: 'error',
                      title: 'Something went wrong!'
                    });
                }
            });
        }
      });
      $('#editEmpPrimaryDetailFrom').validate({
        rules: {
            NameTitle: {
            required: true,
          },
          EmployeeName: {
            required: true,
          },
          AppointmentOrderNo: {
            required: true,
          },
          AppointmentOrderDate: {
            required: true,
          },
          DDO: {
            required: true,
          },
          ControllingOfficer: {
            required: true,
          },
          WorkPlace: {
            required: true,
          },
          DepartmentName: {
            required: true,
          },
          AppointmentBy: {
            required: true,
          },
          Group: {
            required: true,
          },
          EmployeeDesignation: {
            required: true,
          },
          Faculty: {
            required: true,
          },
          SanctionPost: {
            required: true,
          },
          DateOfBirth: {
            required: true,
          },
          JoiningDate: {
            required: true,
          },
          RetirementAge: {
            required: true,
          },
          RetirementDate: {
            required: true,
          },
          ProbationPeriodDate: {
          //  required: true,
          },
          
        },
        errorElement: 'span',
        errorPlacement: function (error, element) {
          error.addClass('invalid-feedback');
          element.closest('.form-group').append(error);
        },
        highlight: function (element, errorClass, validClass) {
          $(element).addClass('is-invalid');
        },
        unhighlight: function (element, errorClass, validClass) {
          $(element).removeClass('is-invalid');
        }
      });
    });
</script>

{{-- Update Contact Detail Modal --}}
<script>
  function editEmpContactDetail(EmployeeId)
  {
      var EmployeeId = EmployeeId;
      $('#editEmpContactDetail').modal('show');
      $.ajax({
          type: "POST",
          url: "{{ url('/') }}/get-employee-detail",
          dataType: 'json',
          data: {
            EmployeeId: EmployeeId,
            _token: "{{ csrf_token() }}",
          },
          success: function (response) {
              $('#EditContactEmployeeId').val(response.GetEmployee.EmployeeId);
              $('span#EditContactEmployeeName').html('#' +response.GetEmployee.EmployeeName);

              $('#MobileNo').val(response.GetEmployee.MobileNo);
              $('#AlternateMobileNo').val(response.GetEmployee.AlternateMobileNo);
              $('#AadharCardNo').val(response.GetEmployee.AadharCardNo);
              $('#PanCardNo').val(response.GetEmployee.PanCardNo);
              $('#EmailId').val(response.GetEmployee.EmailId);

          }
      });
  }
</script>

{{-- Cantact Detail Validate form and Update data --}}
<script>
  $(function () {
      $.validator.setDefaults({
        submitHandler: function () {
            event.preventDefault();
            // Get Form Data
        $.ajax({
                type: "post",
                url: "{{ url('update-employee-contact-detail') }}",
                data: $("#editEmpContactDetailForm").serialize(),
                success: function(response) {
                  const Toast = Swal.mixin({
                      toast: true,
                      position: 'top-end',
                      showConfirmButton: false,
                      timer: 2000,
                      timerProgressBar: true,
                      didOpen: (toast) => {
                        toast.addEventListener('mouseenter', Swal.stopTimer)
                        toast.addEventListener('mouseleave', Swal.resumeTimer)
                      }
                    })
                    Toast.fire({
                      icon: 'success',
                      title: 'Contact detail updated successfully!'
                    });
                    setTimeout(function(){
                    window.location.reload(1);
                  }, 2000);
                },
                error: function(data) {
                  const Toast = Swal.mixin({
                      toast: true,
                      position: 'top-end',
                      showConfirmButton: false,
                      timer: 2000,
                      timerProgressBar: true,
                      didOpen: (toast) => {
                        toast.addEventListener('mouseenter', Swal.stopTimer)
                        toast.addEventListener('mouseleave', Swal.resumeTimer)
                      }
                    })
                    Toast.fire({
                      icon: 'error',
                      title: 'Something went wrong!'
                    });
                }
            });
        }
      });
      $('#editEmpContactDetailForm').validate({
        rules: {
            MobileNo: {
            required: true,
            pattern: '^([0-9]){10}$',
            remote: {
                type: "POST",
                url:'{{ url("/") }}/check-duplicate-mobile-edit',
                data: {
                MobileNo: function() {
                    return $( "#MobileNo" ).val();
                },
                EmployeeId: function() {
                    return $( "#EditContactEmployeeId" ).val();
                },
                '_token':$('meta[name="csrf-token"]').attr('content')
                }
            }
          },
          PanCardNo: {
            required: true,
            pattern: '[A-Za-z]{5}[0-9]{4}[A-Za-z]{1}$',
            remote: {
                type: "POST",
                url:'{{ url("/") }}/check-duplicate-pan-edit',
                data: {
                PanCardNo: function() {
                    return $( "#PanCardNo" ).val();
                },
                EmployeeId: function() {
                    return $( "#EditContactEmployeeId" ).val();
                },
                '_token':$('meta[name="csrf-token"]').attr('content')
                }
            }
          },
          
        },
        messages: {
            MobileNo: {
            remote: "This Mobile number is already exist.",
            },
            PanCardNo: { 
            pattern: 'Please enter a valid PAN no.',
            required:"PAN no. is required.",
            remote:"This PAN no. is already exist."
            },
        },
        errorElement: 'span',
        errorPlacement: function (error, element) {
          error.addClass('invalid-feedback');
          element.closest('.form-group').append(error);
        },
        highlight: function (element, errorClass, validClass) {
          $(element).addClass('is-invalid');
        },
        unhighlight: function (element, errorClass, validClass) {
          $(element).removeClass('is-invalid');
        }
      });
    });
</script>