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/service-book-approval-modal.blade.php
{{-- All Approval Service Book SweetAlert --}}

{{-- Primay Detail Modal --}}
{{-- Submit for Approval Primay Detail --}}
{{-- Primary Detail --}}
<div class="modal fade" id="ServiceBookApprovalModal">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Submit for <span class="text-info" id="ApprovalModuleName"></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="ServiceBookApprovalForm">
                    <input type="hidden" name="_token" id="token_primary_detail" value="{{ csrf_token() }}">
                    <input type="hidden" name="EmployeeId" id="ApprovalEmployeeId">
                    <input type="hidden" name="ModuleId" id="ApprovalModuleId">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="mb-0" for="ProfileName">Profile<span
                                            class="text-danger">*</label></label>
                                    <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true" name="ApprovalProfile" id="ApprovalProfile" data-placeholder="Select Profile" required>
                                        <option value="" disabled selected>Select Profile</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="mb-0" for="UserId">User Name <span
                                            class="text-danger">*</label></label>
                                    <select class="form-control form-control-sm select2" style="width: 100%;" aria-hidden="true" name="UserId" id="UserId"
                                        data-placeholder="Select User" required>
                                        <option value="" disabled selected>Select User</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label class="mb-0" for="ApprovalRemark">Remark <span class="text-danger">*</label></label>
                                    <textarea rows="4" cols="" class="form-control form-control-sm" name="ApprovalRemark" id="ApprovalRemark" placeholder="Max 250 Char."></textarea>
                                </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" id="SubmitPrimaryDetail"
                                        class="btn btn-sm btn-info mx-1">Submit</button>
                                </div>
                            </div>
                        </div>
                </form>
            </div>
        </div>
    </div>
    <!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->

{{-- Dislppay Modal Form --}}
<script>
    $(document).ready(function(){
      $(".BtnSubmitForApproval").on("click", function(){
          var EmployeeId = $(this).attr("data-id");
          var ModuleId = $(this).attr("data-moduleid");
          var ApprovalModule = $(this).val();
          //alert(EmployeeId + " = " + ApprovalModule);
            $('#ApprovalProfile').val(null).trigger('change');
            $('#UserId').empty();
            $('#ApprovalEmployeeId').val(EmployeeId);
            if (ModuleId) {
                $('#ApprovalModuleId').val(ModuleId);
            } else {
                $('#ApprovalModuleId').val('');
            }
            $('span#ApprovalModuleName').html('#'+ApprovalModule);
            
            $('#ServiceBookApprovalModal').modal('show');
        });
      });
  </script>

<script>
    function SubmitEmpPrimaryDetailApprovals(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-primary-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    //location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Primary Detail --}}
<script>
    function ApproveEmpPrimaryDetail(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Primary Detail?",
                    text: "Are you sure you want to approve this Primary detail?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-primary-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Primary detail has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Primary Detail --}}
<script>
    function RejectEmpPrimaryDetail(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Primary Detail?",
          text: "Are you sure you want to reject this Primary detail?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-primary-detail",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Primary detail has been reject!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- General Detail Modal --}}
{{-- Submit for Approval General Detail --}}
<script>
    function SubmitEmpGeneralDetailApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit General Detail for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-general-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve General Detail --}}
<script>
    function ApproveEmpGeneralDetail(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve General Detail?",
                    text: "Are you sure you want to approve this General detail?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-general-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "General detail has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject General Detail --}}
<script>
    function RejectEmpGeneralDetail(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject General Detail?",
          text: "Are you sure you want to reject this General detail?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-general-detail",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "General detail has been reject!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Category Detail Modal --}}
{{-- Submit for Approval Category Detail --}}
<script>
    function SubmitEmpCategoryDetailApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Category Detail for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-category-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Category Detail --}}
<script>
    function ApproveEmpCategoryDetail(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Category Detail?",
                    text: "Are you sure you want to approve this Primary detail?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-category-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Category detail has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Category Detail --}}
<script>
    function RejectEmpCategoryDetail(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Category Detail?",
          text: "Are you sure you want to reject this category detail?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-category-detail",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Category detail has been reject!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Modal Police Verification --}}
{{-- Submit for Approval Police Verfication --}}
<script>
    function SubmitPoliceVerificationApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Police Verfication for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-police-verification",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Police Verfication --}}
<script>
    function ApprovePoliceVerification(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Police Verfication?",
                    text: "Are you sure you want to approve this Police Verfication?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-police-verfication",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Police Verfication has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Police Verfication --}}
<script>
    function RejectPoliceVerification(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Police Verfication?",
          text: "Are you sure you want to reject this Police Verfication?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-police-verfication",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Police Verfication has been reject!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Medical Certificate Modal --}}
{{-- Submit for Approval Medical Certificate --}}
<script>
    function SubmitMedicalCertificateApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Medical Certificate for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-medical-certificate",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Medical Certificate --}}
<script>
    function ApproveMedicalCertificate(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Medical Certificate?",
                    text: "Are you sure you want to approve this Medical Certificate?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-medical-certificate",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Medical Certificate has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Medical Certificate --}}
<script>
    function RejectMedicalCertificate(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Medical Certificate?",
          text: "Are you sure you want to reject this Medical Certificate?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-medical-certificate",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Medical Certificate has been reject!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Permanency Modal --}}
{{-- Submit for Approval Permanency --}}
<script>
    function SubmitEmployeePermanencyApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Employee Permanency for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-employee-permanency",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Permanency Approval --}}
<script>
    function ApproveEmployeePermanency(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Employee Permanency?",
                    text: "Are you sure you want to approve this Employee Permanency?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-permanency",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Employee Permanency has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Permanency Approval --}}
<script>
    function RejectEmployeePermanency(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Employee Permanency?",
          text: "Are you sure you want to reject this Employee Permanency?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-permanency",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Primary detail has been reject!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Retirement Order Modal --}}
{{-- Submit for Approval Retirement Order --}}
<script>
    function SubmitEmpRetirementOrderApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-primary-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Retirement Order --}}
<script>
    function ApproveEmpRetirementOrder(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Retirement Order?",
                    text: "Are you sure you want to approve this Retirement Order?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-retirement-order",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Retirement Order has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Retirement Order --}}
<script>
    function RejectEmpRetirementOrder(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Retirement Order?",
          text: "Are you sure you want to reject this Retirement Order?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-retirement-order",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Retirement Order has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Age Relax Modal --}}
{{-- Submit for Approval Age Relax --}}
<script>
    function SubmitEmpAgeRelaxApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Age Relax for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-age-relax",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Primay Detail --}}
<script>
    function ApproveEmpAgeRelax(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Age Relax?",
                    text: "Are you sure you want to approve this Age Relax?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-age-relax",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Age Relax has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Age Relax --}}
<script>
    function RejectEmpAgeRelax(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Age Relax?",
          text: "Are you sure you want to reject this Age Relax?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-age-relax",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Age Relax has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Promotion / Transfer Modal --}}
{{-- Submit for Approval Promotion --}}
<script>
    function SubmitEmpPromotionApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-employee-promotion",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Promotion --}}
<script>
    function ApproveEmpPromotion(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Primary Detail?",
                    text: "Are you sure you want to approve this Inoformation?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-promotion",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Inoformation has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Promotion --}}
<script>
    function RejectEmpPromotion(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Primary Detail?",
          text: "Are you sure you want to reject this Inoformation?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-promotion",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Inoformation has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Loan Allowance Modal --}}
{{-- Submit for Approval Loan Allowance --}}
<script>
    function SubmitLoanAllowanceApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-loan-allowance",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Loan Allowance --}}
<script>
    function ApproveLoanAllowance(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Loan Allowance?",
                    text: "Are you sure you want to approve this Loan Allowance?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-loan-allowance",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Loan Allowance has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Loan Allowance --}}
<script>
    function RejectLoanAllowance(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Loan Allowance?",
          text: "Are you sure you want to reject this Loan Allowance?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-loan-allowance",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Loan Allowance has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Leave Travel Concession Modal --}}
{{-- Submit for Approval Leave Travel Concession --}}
<script>
    function SubmitTravelConcessionApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-leave-travel-concession",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Leave Travel Concession --}}
<script>
    function ApproveTravelConcession(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Leave Travel Concession?",
                    text: "Are you sure you want to approve this Leave Travel Concession?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-leave-travel-concession",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Leave Travel Concession has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Leave Travel Concession --}}
<script>
    function RejectTravelConcession(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Leave Travel Concession?",
          text: "Are you sure you want to reject this Leave Travel Concession?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-leave-travel-concession",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Leave Travel Concession has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Maharashtra Darshan Modal --}}
{{-- Submit for Approval Maharashtra Darshan --}}
<script>
    function SubmitMaharashtraDarshanApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-maharashtra-travel-concession",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Maharashtra Darshan --}}
<script>
    function ApproveMaharashtraDarshan(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Maharashtra Darshan?",
                    text: "Are you sure you want to approve this Maharashtra Darshan?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-maharashtra-travel-concession",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Maharashtra Darshan has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Maharashtra Darshan --}}
<script>
    function RejectMaharashtraDarshan(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Maharashtra Darshan?",
          text: "Are you sure you want to reject this Maharashtra Darshan?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-maharashtra-travel-concession",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Maharashtra Darshan has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Assets & Liability Modal --}}
{{-- Submit for Approval Assets & Liability --}}
<script>
    function SubmitAssetsLiabilitiesApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-assets-liabilities",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Assets & Liability --}}
<script>
    function ApproveAssetsLiabilities(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Assets & Liability?",
                    text: "Are you sure you want to approve this Assets & Liability?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-assets-liabilities",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Assets & Liability has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Assets & Liability --}}
<script>
    function RejectAssetsLiabilities(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Assets & Liability?",
          text: "Are you sure you want to reject this Assets & Liability?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-assets-liabilities",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Assets & Liability has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Confidential Report Modal --}}
{{-- Submit for Approval Confidential Report --}}
<script>
    function SubmitConfidentialReportApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-confidential-report",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Confidential Report --}}
<script>
    function ApproveConfidentialReport(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Confidential Report?",
                    text: "Are you sure you want to approve this Confidential Report?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-confidential-report",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Confidential Report has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Confidential Report --}}
<script>
    function RejectConfidentialReport(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Confidential Report?",
          text: "Are you sure you want to reject this Confidential Report?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-confidential-report",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Confidential Report has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Award Detail Modal --}}
{{-- Submit for Approval Award Detail --}}
<script>
    function SubmitAwardDetailApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-award-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Award Detail --}}
<script>
    function ApproveAwardDetail(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Award Detail?",
                    text: "Are you sure you want to approve this Award detail?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-award-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Award detail has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Award Detail --}}
<script>
    function RejectAwardDetail(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Award Detail?",
          text: "Are you sure you want to reject this Award detail?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-award-detail",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Award detail has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Resignation Modal --}}
{{-- Submit for Approval Emp Resignation --}}
<script>
    function SubmitEmpResignationApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Resignation for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-resignation",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Emp Resignation --}}
<script>
    function ApproveEmpResignation(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Resignation?",
                    text: "Are you sure you want to approve this Resignation?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-resignation",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Resignation has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Emp Resignation --}}
<script>
    function RejectEmpResignation(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Resignation?",
          text: "Are you sure you want to reject this Resignation?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-resignation",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Resignation has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Death Certificate Modal --}}
{{-- Submit for Approval Death Certificate --}}
<script>
    function SubmitEmpDeathCertificateApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Death Certificate for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-death-certificate",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Death Certificate --}}
<script>
    function ApproveEmpDeathCertificate(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Death Certificate?",
                    text: "Are you sure you want to approve this Death Certificate?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-death-certificate",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Death Certificate has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Death Certificate --}}
<script>
    function RejectEmpDeathCertificate(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Death Certificate?",
          text: "Are you sure you want to reject this Death Certificate?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-death-certificate",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Death Certificate has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Gratia Amount Modal --}}
{{-- Submit for Approval Gratia Amount --}}
<script>
    function SubmitEmpGratiaAmountApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Gratia Amount for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-gratia-amount",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Gratia Amount --}}
<script>
    function ApproveEmpGratiaAmount(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Gratia Amount?",
                    text: "Are you sure you want to approve this Gratia Amount?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-gratia-amount",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Gratia Amount has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Gratia Amount --}}
<script>
    function RejectEmpGratiaAmount(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Gratia Amount?",
          text: "Are you sure you want to reject this Gratia Amount?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-gratia-amount",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Gratia Amount has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- ReAppraising Modal --}}
{{-- Submit for Approval ReAppraising --}}
<script>
    function SubmitEmpReAppraisingApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit ReAppraising for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-re-appraising",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve ReAppraising --}}
<script>
    function ApproveEmpReAppraising(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve ReAppraising?",
                    text: "Are you sure you want to approve this ReAppraising?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-re-appraising",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "ReAppraising has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject ReAppraising --}}
<script>
    function RejectEmpReAppraising(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject ReAppraising?",
          text: "Are you sure you want to reject this ReAppraising?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-re-appraising",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "ReAppraising has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Commutation Modal --}}
{{-- Submit for Approval Employee Commutation --}}
<script>
    function SubmitEmpCommutationApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Commutation for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-commutation",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Employee Commutation --}}
<script>
    function ApproveEmpCommutation(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Commutation?",
                    text: "Are you sure you want to approve this Commutation?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-commutation",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Commutation has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Employee Commutation --}}
<script>
    function RejectEmpCommutation(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Commutation?",
          text: "Are you sure you want to reject this Commutation?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-commutation",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Commutation has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Gratuity Amount Modal --}}
{{-- Submit for Approval Gratuity Amount --}}
<script>
    function SubmitEmpGratuityAmountApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Gratuity Amount for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-gratuity-amount",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Gratuity Amount --}}
<script>
    function ApproveEmpGratuityAmount(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Gratuity Amount?",
                    text: "Are you sure you want to approve this Gratuity Amount?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-gratuity-amount",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Gratuity Amount has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Gratuity Amount --}}
<script>
    function RejectEmpGratuityAmount(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Gratuity Amount?",
          text: "Are you sure you want to reject this Gratuity Amount?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-gratuity-amount",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Gratuity Amount has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Encashment of Leave Modal --}}
{{-- Submit for Approval Encashment --}}
<script>
    function SubmitEmpEncashmentApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Encashment for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-encashment",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Encashment --}}
<script>
    function ApprovaEmpEncashment(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Encashment?",
                    text: "Are you sure you want to approve this Encashment?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-encashment",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Encashment has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Encashment --}}
<script>
    function RejectEmpEncashment(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Encashment?",
          text: "Are you sure you want to reject this Encashment?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-encashment",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Encashment has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Address Modal --}}
{{-- Submit for Approval Address --}}
<script>
    function SubmitEmployeeAddressApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit address for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-address",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Address --}}
<script>
    function ApproveEmployeeAddress(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Address?",
                    text: "Are you sure you want to approve this Address?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-address",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Address has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Address --}}
<script>
    function RejectEmployeeAddress(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Address?",
          text: "Are you sure you want to reject this Address?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-address",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Address has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- PayMatrix Modal --}}
{{-- Submit for Approval PayMatrix --}}
<script>
    function SubmitEmpPayMatrixApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-paymatrix",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve PayMatrix --}}
<script>
    function ApproveEmpPayMatrix(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve PayMatrix?",
                    text: "Are you sure you want to approve this PayMatrix?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-paymatrix",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "PayMatrix has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    //location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject PayMatrix --}}
<script>
    function RejectEmpPayMatrix(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject PayMatrix?",
          text: "Are you sure you want to reject this PayMatrix?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-paymatrix",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "PayMatrix has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Eligibility Exam Modal --}}
{{-- Submit for Approval Eligibility Exam --}}
<script>
    function SubmitEligibilityExamApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Eligibility exam for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-eligibility-exam",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Eligibility Exam --}}
<script>
    function ApproveEligibilityExam(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Eligibility exam?",
                    text: "Are you sure you want to approve this Eligibility exam?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-eligibility-exam",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Eligibility has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Eligibility Exam --}}
<script>
    function RejectEligibilityExam(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Eligibility exam?",
          text: "Are you sure you want to reject this Eligibility exam?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-eligibility-exam",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Eligibility exam has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Employee Pension Modal --}}
{{-- Submit for Approval Employee Pension --}}
<script>
    function SubmitEmpPensionSchemeApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Pension for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-employee-pension",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Employee Pension --}}
<script>
    function ApproveEmpPensionScheme(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Employee Pension?",
                    text: "Are you sure you want to approve this Employee Pension?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-pension",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Employee Pension has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Employee Pension --}}
<script>
    function RejectEmpPensionScheme(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Employee Pension?",
          text: "Are you sure you want to reject this Employee Pension?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-pension",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Employee Pension has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Employee Deputation Modal --}}
{{-- Submit for Approval Deputation Detail --}}
<script>
    function SubmitDeputationApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-deputation-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Deputation Detail --}}
<script>
    function ApproveDeputation(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Primary Detail?",
                    text: "Are you sure you want to approve this Deputation Detail?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-deputation-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Deputation Detail has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Deputation Detail --}}
<script>
    function RejectDeputation(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Primary Detail?",
          text: "Are you sure you want to reject this Deputation Detail?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-deputation-detail",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Deputation Detail has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Probation Period Modal --}}
{{-- Submit for Approval Probation Period --}}
<script>
    function SubmitProbationPeriodApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-probation-period",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Probation Period --}}
<script>
    function ApproveProbationPeriod(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Primary Detail?",
                    text: "Are you sure you want to approve this Probation Period?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-probation-period",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Probation Period has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Probation Period --}}
<script>
    function RejectProbationPeriod(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Primary Detail?",
          text: "Are you sure you want to reject this Probation Period?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-probation-period",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Probation Period has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Family Detail Modal --}}
{{-- Submit for Approval Family Member --}}
<script>
    function SubmitFamilyMemberApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-family-member",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Family Member --}}
<script>
    function ApproveFamilyMember(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Family Member?",
                    text: "Are you sure you want to approve this Family Member?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-family-member",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Family Member has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Family Member --}}
<script>
    function RejectFamilyMember(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Family Member?",
          text: "Are you sure you want to reject this Family Member?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-family-member",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Family Member has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Nominee Detail Modal --}}
{{-- Submit for Approval Nominee Detail --}}
<script>
    function SubmitNomineeDetailApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Nominee Detail for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-nominee-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Nominee Detail --}}
<script>
    function ApproveNomineeDetail(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Nominee Detail?",
                    text: "Are you sure you want to approve this Nominee detail?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-nominee-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Nominee detail has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Nominee Detail --}}
<script>
    function RejectNomineeDetail(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Nominee Detail?",
          text: "Are you sure you want to reject this Nominee detail?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-nominee-detail",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Nominee detail has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Name Change Modal --}}
{{-- Submit for Approval Name Change --}}
<script>
    function SubmitNameChangeApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-name-change",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Name Change --}}
<script>
    function ApproveNameChange(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Primary Detail?",
                    text: "Are you sure you want to approve this Name Change?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-name-change",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Name Change has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Name Change --}}
<script>
    function RejectNameChange(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Primary Detail?",
          text: "Are you sure you want to reject this Name Change?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-name-change",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Name Change has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Foreign Visit Modal --}}
{{-- Submit for Approval Foreign Visit --}}
<script>
    function SubmitForeignVisitApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-foreign-visit",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Foreign Visit --}}
<script>
    function ApproveForeignVisit(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Foreign Visit?",
                    text: "Are you sure you want to approve this Foreign Visit?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-foreign-visit",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Foreign Visit has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Foreign Visit --}}
<script>
    function RejectForeignVisit(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Foreign Visit?",
          text: "Are you sure you want to reject this Foreign Visit?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-foreign-visit",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Foreign Visit has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Disciplinary Action Modal --}}
{{-- Submit for Approval Disciplinary Action --}}
<script>
    function SubmitDisciplinaryActionApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-disciplinary-action",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Disciplinary Action --}}
<script>
    function ApproveDisciplinaryAction(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Disciplinary Action?",
                    text: "Are you sure you want to approve this Disciplinary Action?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-disciplinary-action",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Disciplinary Action has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Disciplinary Action --}}
<script>
    function RejectDisciplinaryAction(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Disciplinary Action?",
          text: "Are you sure you want to reject this Disciplinary Action?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-disciplinary-action",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Disciplinary Action has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Training Detail Modal --}}
{{-- Submit for Approval Training Detail --}}
<script>
    function SubmitTrainingDetailApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-training-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Training Detail --}}
<script>
    function ApproveTrainingDetail(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Training Detail?",
                    text: "Are you sure you want to approve this Training detail?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-training-detail",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Training detail has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Training Detail --}}
<script>
    function RejectTrainingDetail(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Training Detail?",
          text: "Are you sure you want to reject this Training detail?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-training-detail",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Training detail has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Employee Qualification Modal --}}
{{-- Submit for Approval Qualification --}}
<script>
    function SubmitQualificationApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-qualification",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Qualification --}}
<script>
    function ApproveQualification(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Qualification?",
                    text: "Are you sure you want to approve this Qualification?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-qualification",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Qualification has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Qualification --}}
<script>
    function RejectQualification(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Qualification?",
          text: "Are you sure you want to reject this Qualification?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-qualification",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Qualification has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Previous Job Detail Modal --}}
{{-- Submit for Approval Previous Job Detail --}}
<script>
    function SubmitPrevJobApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Previous Job for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-previous-job",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Previous Job Detail --}}
<script>
    function ApprovePrevJob(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Previous Job?",
                    text: "Are you sure you want to approve this Previous Job?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-previous-job",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Previous Job has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Previous Job Detail --}}
<script>
    function RejectPrevJob(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Previous Job?",
          text: "Are you sure you want to reject this Previous Job?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-previous-job",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Previous Job has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Tenure Period Modal --}}
{{-- Submit for Approval Tenure Period --}}
<script>
    function SubmitTenurePeriodApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Tenure Period for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-tenure-period",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Tenure Period --}}
<script>
    function ApproveTenurePeriod(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Tenure Period?",
                    text: "Are you sure you want to approve this Tenure Period?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-employee-tenure-period",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Tenure Period has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Tenure Period --}}
<script>
    function RejectTenurePeriod(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Tenure Period?",
          text: "Are you sure you want to reject this Tenure Period?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-employee-tenure-period",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Tenure Period has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- ICard Modal --}}
{{-- Submit for Approval ICard --}}
<script>
    function SubmitICardApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit ICard for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-icard",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve ICard --}}
<script>
    function ApproveICard(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve ICard?",
                    text: "Are you sure you want to approve this ICard?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-icard",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "ICard has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject ICard --}}
<script>
    function RejectICard(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject ICard?",
          text: "Are you sure you want to reject this ICard?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-icard",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "ICard has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>

{{-- Writ Petition Modal --}}
{{-- Submit for Approval Writ Petition --}}
<script>
    function SubmitWritPetitionApproval(EmployeeId) {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Submit for Approval?",
                    text: "Are you sure you want to submit Writ Petition for approval?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Send it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/submit-approval-writ-petition",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "Information has been sent for approval!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Approve Writ Petition --}}
<script>
    function ApproveWritPetition(EmployeeId='',ModuleId='',ApprovalStatus='') {
    var EmployeeId = EmployeeId;
                Swal.fire({
                    title: "Approve Writ Petition?",
                    text: "Are you sure you want to approve this Writ Petition?",
                    icon: "warning",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "Yes, Approve it!",
                }).then((result) => {
                    if (result.isConfirmed) {
                        $.ajax({
                            type: "post",
                            url: "{{ url('/') }}/approve-writ-petition",
                            dataType: "json",
                            data: {
                                _token: "{{csrf_token()}}",
                                EmployeeId: EmployeeId,
                                ModuleId: ModuleId,
                                ApprovalStatus: ApprovalStatus,
                            },
                            success: function (response) {
                                Swal.fire({
                                    icon: "success",
                                    title: "ICard has been approved!",
                                    showConfirmButton: false,
                                    timer: 1500,
                                }).then(function () {
                                    location.reload();
                                });
                            },
                        });
                    }
                });
    }
</script>
{{-- Reject Writ Petition --}}
<script>
    function RejectWritPetition(EmployeeId='', ModuleId='', ApprovalStatus=''){
      (async () => {
      const { value: comment } = await Swal.fire({
          title: "Reject Writ Petition?",
          text: "Are you sure you want to reject this Writ Petition?",
          icon: "warning",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Yes, Reject it!",
          input: 'textarea',
          //inputLabel: 'Your comment',
          inputPlaceholder: 'Enter your comment',
          inputValidator: (value) => {
              return new Promise((resolve) => {
                if (value) {
                  resolve()
                } else {
                  resolve('Please insert the comment!')
                }
              })
          }
        })
  
        if (comment) {
          //Swal.fire(`Entered email: ${comment}`)
          var reject = comment;
          $.ajax({
            type: "post",
            url: "{{ url('/') }}/reject-writ-petition",
            dataType: "json",
            data: {
              _token: "{{csrf_token()}}",
              EmployeeId: EmployeeId,
              RejectComment:  reject,
              ModuleId: ModuleId,
              ApprovalStatus: ApprovalStatus,
              
            },
            success: function (response) {
            Swal.fire({
              icon: "success",
              title: "Writ Petition has been rejected!",
              showConfirmButton: false,
              timer: 1500,
              }).then(function () {
                 location.reload();
              });
            },
        });
      }
  
      })()
    }
</script>


{{-- Assign Value in modal form --}}
<script>
    $(document).ready(function() {
        $.ajax({
          type: "GET",
          url: "{{ url('/officer-name-list') }}",
          dataType: "json",
          success: function(response) {
            var json = response.officerNameList;
            $.each(json, function(i, officer) {
              $("#ApprovalProfile").append("<option value='" + officer.ProfileId + "'>" + officer.ProfileName + "</option>");
              $('#ApprovalProfile').trigger('change');
            });
          }
        });
    });
</script>

{{-- Get Person Name on select Profile --}}
<script>
    $('#ApprovalProfile').on('select2:select', function (e) {
      //alert(e.params.data);
        var data = e.params.data;
        var ProfileId = data.id;
        getProfileId(ProfileId);
    });
    function getProfileId(ProfileId){
        var ProfileId = ProfileId;
        $('#UserId').empty();
            $.ajax({
            type: "GET",
            url: "{{ url('/') }}/profile-wise-officer/" +ProfileId,
            dataType: "json",
            success: function(response) {
                var json = response.officerWiseName;
                $.each(json, function(i, officerWiseName) {
                    var FirstName = officerWiseName.FirstName;
                    
                    var MiddleName = '';
                    if (officerWiseName.MiddleName) {
                        var MiddleName = officerWiseName.MiddleName
                    }
                    var LastName = '';
                    if (officerWiseName.LastName) {
                        var LastName = officerWiseName.LastName
                    }
                    
                    $("#UserId").append("<option value='" + officerWiseName.UserId + "'>" + FirstName +' '+ MiddleName + ' ' + LastName + "</option>");
                    $('#UserId').val(null).trigger('change');
                    
                });
            }
        });
    }
</script>

{{-- Validate form and Submit data --}}
<script>
    $(function () {
      $.validator.setDefaults({
        submitHandler: function () {
            event.preventDefault();
            // Get Form Data
            var token = $("#token_primary_detail").val();
            var EmployeeId = $("#ApprovalEmployeeId").val();
            var ProfileId = $('#ApprovalProfile').val();
            var UserId = $('#UserId').val();
            var ApprovalRemark = $('textarea[name="ApprovalRemark"]').val();
            var ModuleId = $('#ApprovalModuleId').val();
            if (ModuleId) {
                var ModuleId = ModuleId;
            } else {
                var ModuleId = '';
            }
            var ApprovalModuleName = $('span#ApprovalModuleName').text().substring(1);
             var url = '';
            // if (ApprovalModuleName == 'Primary Detail Approval') {
            //     var url = 'submit-approval-primary-detail';
            // } else if (ApprovalModuleName == 'Category Detail Approval') {
            //     var url = 'submit-approval-category-detail';
            // } else if (ApprovalModuleName == 'General Detail Approval') {
            //     var url = 'submit-approval-general-detail';
            // }
            switch (ApprovalModuleName) {
                case 'Primary Detail Approval':
                    var url = 'submit-approval-primary-detail';
                    break;

                case 'Category Detail Approval':
                    var url = 'submit-approval-category-detail';
                    break;

                case 'General Detail Approval':
                    var url = 'submit-approval-general-detail';
                    break;

                case 'Police Verification Approval':
                    var url = 'submit-approval-police-verification';
                    break;
                
                case 'Medical Certificate Approval':
                    var url = 'submit-approval-medical-certificate';
                    break;
                
                case 'Employee Permanency Approval':
                    var url = 'submit-approval-employee-permanency';
                    break;
                
                case 'Retirement Order Approval':
                    var url = 'submit-approval-employee-retirement-order';
                    break;
                
                case 'Age Relax Approval':
                    var url = 'submit-approval-age-relax';
                    break;

                case 'Employee Resignation Approval':
                    var url = 'submit-approval-resignation';
                    break;

                case 'Death Certificate Approval':
                    var url = 'submit-approval-death-certificate';
                    break;

                case 'Gratia Amount Approval':
                    var url = 'submit-approval-gratia-amount';
                    break;

                case 'Employee ReAppraising Approval':
                    var url = 'submit-approval-re-appraising';
                    break;

                case 'Employee Pension Approval':
                    var url = 'submit-approval-pension';
                    break;

                case 'Employee Commutation Approval':
                    var url = 'submit-approval-commutation';
                    break;

                case 'Gratuity Amount Approval':
                    var url = 'submit-approval-gratuity-amount';
                    break;

                case 'Employee Encashment Approval':
                    var url = 'submit-approval-encashment';
                    break;

                case 'PayMatrix Detail Approval':
                    var url = 'submit-approval-paymatrix';
                    break;

                case 'Eligibility Exam Approval':
                    var url = 'submit-approval-eligibility-exam';
                    break;

                case 'Address Detail Approval':
                    var url = 'submit-approval-address';
                    break;

                case 'Qualification Detail Approval':
                    var url = 'submit-approval-qualification';
                    break;

                case 'Promotion/Transfer Approval':
                    var url = 'submit-approval-employee-promotion';
                    break;

                case 'Pensionary Benefit Approval':
                    var url = 'submit-approval-employee-pension';
                    break;

                case 'Name Change Approval':
                    var url = 'submit-approval-name-change';
                    break;

                case 'Deputation Detail Approval':
                    var url = 'submit-approval-deputation-detail';
                    break;

                case 'Probation Period Approval':
                    var url = 'submit-approval-probation-period';
                    break;
                    
                case 'Family Member Approval':
                    var url = 'submit-approval-family-member';
                    break;

                case 'Nominee Detail Approval':
                    var url = 'submit-approval-nominee-detail';
                    break;

                case 'Previous Job Approval':
                    var url = 'submit-approval-previous-job';
                    break;

                case 'Training Detail Approval':
                    var url = 'submit-approval-training-detail';
                    break;

                case 'Foreign Visit Approval':
                    var url = 'submit-approval-foreign-visit';
                    break;

                case 'Disciplinary Action Approval':
                    var url = 'submit-approval-disciplinary-action';
                    break;

                case 'Loan Allowance Approval':
                    var url = 'submit-approval-loan-allowance';
                    break;

                case 'Hometown LTC Approval':
                    var url = 'submit-approval-leave-travel-concession';
                    break;

                case 'Maharashtra Darshan Approval':
                    var url = 'submit-approval-maharashtra-travel-concession';
                    break;

                case 'Asset & Liability Approval':
                    var url = 'submit-approval-assets-liabilities';
                    break;

                case 'Confidential Report Approval':
                    var url = 'submit-approval-confidential-report';
                    break;

                case 'Award Detail Approval':
                    var url = 'submit-approval-award-detail';
                    break;
            }
        var fd = new FormData();
            fd.append('_token',token);
            fd.append('EmployeeId',EmployeeId);
            fd.append('ProfileId',ProfileId);
            fd.append('UserId',UserId);
            fd.append('ApprovalRemark',ApprovalRemark);
            fd.append('ModuleId',ModuleId);
        $.ajax({
                type: "post",
                url: "{{ url('/') }}/" + url,
                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: ApprovalModuleName + ' submitted successfully!'
                    });
                    setTimeout(function(){
                    window.location.reload();
                  }, 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!'
                    });
                }
            });
        }
      });
      $('#ServiceBookApprovalForm').validate({
        rules: {
            ApprovalProfile: {
            required: true,
          },
          PersonName: {
            required: true,
          },
          ApprovalRemark: {
            required: true,
          },
        },
        messages: {
            ApprovalProfile: {
            required: "Please select the Profile.",
          }, 
          PersonName: {
            required: "Please select the Name.",
          }, 
        },
        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>