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/storage/framework/views/669704f03ef74dbec5424e93b5b82bf98147efc8.php

<?php $__env->startSection('content'); ?>
<style>
.cmpadding-6
{
    padding:0px;
    margin:0px;
    padding:7px;
}
</style>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <div class="container-fluid">
             <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>All Employees</h1>
                </div>
                <div class="col-sm-6 text-right">
                    <a type="button" class="btn btn-sm btn-outline-info mx-1"
                        href="<?php echo e(url('forward-list')); ?>">Forwarded List
                    </a>
                </div>
            </div> 
        </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->

    <section class="content">
        <div class="container-fluid">

            
            <!-- <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <div class="row">
                                <div class="col-8">
                                    <h5>Employee Application Details</h5>
                                </div>
                                <div class="col-4 text-right">
                                    <a class="  btn btn-outline-secondary" href="<?php //echo url('/employee-leaves'); ?>">Back</a> &nbsp;&nbsp;
                                                           
                                </div>                                                                                                           
                            </div>
                            
                        </div>
 
                        <div class="card-body">
                             
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group row mb-0">
                                            <label for="EmployeeCode"
                                                class="col-sm-4 col-form-label text-right">Employee Code:</label>
                                            <div class="col-sm-8"><p class="cmpadding-6"><?php echo e($EmployeesData->EmployeeCode); ?></p>
                                            </div>
                                        </div>
                                        <div class="form-group row mb-0">
                                            <label for="Department"
                                                class="col-sm-4 col-form-label text-right">Department:</label>
                                            <div class="col-sm-8">
                                                 
                                                <p class="cmpadding-6" id="employeeDepartment"><?php echo e($EmployeesData->DepartmentName); ?></p> 
                                                                                             
                                            </div>
                                        </div>
                                         
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group row mb-0">
                                            <label for="EmployeeName"
                                                class="col-sm-4 col-form-label text-right">Employee Name:</label>
                                            <div class="col-sm-8">
                                                <p class="cmpadding-6" id="employeeName"><?php echo e($EmployeesData->EmployeeName); ?></p>                                                 
                                            </div>
                                        </div>
                                        <div class="form-group row mb-0">
                                            <label for="Designation"
                                                class="col-sm-4 col-form-label text-right">Designation:</label>
                                            <div class="col-sm-8">
                                                <p class="cmpadding-6" id="employeeDesignation"><?php echo e($EmployeesData->DesignationName); ?></p>                                                 
                                            </div>
                                        </div>
                                         
                                    </div>
                                     
                                </div>
                             
                        </div>
                       
                    </div>
                </div>
            </div> -->
            <!-- /.row -->
            <!-- Employee leave list end -->

        </div>
        <!-- /.container-fluid -->
    </section>

    <section class="content">
        <div class="container-fluid">

            
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h5>Leaves For Approval</h5>
                        </div>
                        <!-- /.card-header -->
                        <div class="card-body">
                            <table id="approvalTable" class="table table-bordered table-striped table-sm">
                                <thead>
                                    <tr>
                                        <th>S.No.</th>
                                        <th>Employee Code</th>
                                        <th>Employee Name</th>
                                        <th>Leave Type</th>
                                        <th>No. of Days</th>
                                        <th>From Date</th>
                                        <th>To Date</th>
                                        <th>Description</th>
                                        <th>Status</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php $LeaveId = '';?>
                                <?php $__currentLoopData = $Leaves; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $Leave): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($loop->iteration); ?></td>
                                        <td><a href="<?php echo e(url('view-employee', $Leave->EmployeeId)); ?>"
                                                target="_blank"><?php echo e($Leave->EmployeeCode); ?></a></td>
                                        <td><?php echo e($Leave->EmployeeName); ?></td>
                                        <td><?php echo e($Leave->LeaveTypeName); ?></td>
                                        <td><?php echo e($Leave->TotalLeave); ?></td>
                                        <td><?php echo e(date('d-M-Y', strtotime($Leave->StartDate))); ?></td>
                                        <td><?php echo e(date('d-M-Y', strtotime($Leave->EndDate))); ?></td>
                                        <td><?php echo e($Leave->Description); ?></td>
                                        <td>
                                        <?php if(isset($Leave->ApprovalBy) ? $Leave->ApprovalBy : '') 
                                        {
                                            if ($Leave->ApprovalStatus == '0') { ?>
                                                <span type="button" class="badge badge-warning" data-toggle="tooltip" data-placement="top"
                                                title="Click to Approved"
                                                onclick="ApprovedLeaveApplication('<?php echo e($Leave->LeaveId); ?>')">Pending</span>
                                              <?php }
                                              if ($Leave->ApprovalStatus == '1') { ?>
                                                <span type="button" class="badge badge-success btn-flat btn-xs" title="Click to Rejected"
                                                onclick="ApprovedLeaveApplication('<?php echo e($Leave->LeaveId); ?>')">Approved</span>
                                              <?php } 
                                              if ($Leave->ApprovalStatus == '2') {?>
                                              <span type="button" class="badge badge-danger btn-flat btn-xs" title="Click to Approved"
                                                onclick="ApprovedLeaveApplication('<?php echo e($Leave->LeaveId); ?>')">Rejected</span>
                                              <?php }
                                        }

                                        else {
                                            if ($Leave->ApprovalStatus == '0'){ ?>
                                            <span type="button" class="badge badge-warning btn-flat btn-xs" readonly>Pending</span>
                                            <?php } 
                                            if ($Leave->ApprovalStatus == '1'){ ?>
                                            <span type="button" class="badge badge-success btn-flat btn-xs" readonly>Approved</span>
                                            <?php } 
                                            if ($Leave->ApprovalStatus == '2'){ ?>
                                            <span type="button" class="badge badge-danger btn-flat btn-xs" readonly>Rejected</span>
                                             <?php } } ?>
                                        </td>
                                        <td>
                                            <div class="btn-group">
                                                <button type="button"
                                                    class="btn btn-default btn-sm dropdown-toggle dropdown-icon"
                                                    data-toggle="dropdown" aria-expanded="false">
                                                </button>
                                                <div class="dropdown-menu dropdown-menu-right" role="menu">
                                                    <a href="<?php echo url('/details-application'); ?>/<?php echo e($Leave->LeaveId); ?>" class="dropdown-item btn btn-default" target="_blank">View Application</a>
                                                    <a href="<?php echo url('/application-detail'); ?>/<?php echo e($Leave->LeaveId); ?>" class="dropdown-item btn btn-default" target="_blank"> Application Status</a>
                                                    <button type="button" class="dropdown-item btn btn-default" id="forward">Forward For Concern</button>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                   <?php $LeaveId = isset($Leave->LeaveId) ? $Leave->LeaveId : ''; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.card-body -->
                    </div>
                    <!-- /.card -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
    <div class="modal fade" id="myModal" role="dialog">
        <div class="modal-dialog">
        <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">Reject Application (Add Reason)</h4>
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                </div>
                <div class="modal-body">
                    <div class="form-group modal-body">
                        <lable>Reason:</lable>
                        <input type="text" name="reason" id="reason" placeholder="Please fill the reason" class="form-control" required>
                    </div>
                    <div class="modal-footer">
                    <button  class="btn btn-success rejected" Lid="<?php echo e($LeaveId); ?>">Reject Application</button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
                    </div>
                </div>
        </div>
        </div>
    </div>
    <div class="modal fade" id="concern" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                <h4 class="modal-title">Forward For Concern</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                </div>
                <div class="modal-body">
                    <div class="form-group modal-body">
                        <lable>Concern:</lable>
                        <textarea class="form-control form-control-sm" name="Concern" id="Concern" required></textarea><br>
                        <lable>Forward ProfileName:</lable>
                        <select class="form-control form-control-sm select2"  aria-hidden="true"
                        name="ProfileName" id="ProfileName" data-placeholder="Select Profile Name" required>
                        <option value="" disabled selected>Select Profile Name</option>
                        </select>
                        <input type="hidden" name="ProfileId" id="ProfileId"><br>
                        <lable>Forward Approval Authority:</lable>
                        <select class="form-control form-control-sm select2"
                            aria-hidden="true" name="Authority" id="Authority" data-placeholder="Select Authority Name" required >
                            <option value="" disabled selected>Select Authority Name</option>
                        </select> 
                    </div>
                    <div class="modal-footer">
                    <button  class="btn btn-success send" Lid="<?php echo e($LeaveId); ?>">Forward Application</button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<script>
    $(function() {
        $("#approvalTable").DataTable({
            "responsive": true,
            "lengthChange": true,
            "autoWidth": false,
            "lengthMenu": [10, 20, 50, 100, 250, 500],
            "buttons": ["csv", "excel", "pdf", "print"]
        }).buttons().container().appendTo('#approvalTable_wrapper .col-md-6:eq(0)');
    });


function editLeave(LeaveId='')
{
    window.location.href="<?php echo url('/edit-application'); ?>/"+LeaveId;
}

</script>

<script>
    // ApprovalStatus
    function ApprovedLeaveApplication(LeaveId) {
        var LeaveId = LeaveId;
        Swal.fire({
            title: 'Approved/Rejected Leave Application?',
            text: "Are you sure you want to Approved/Rejected Leave Application!",
            icon: 'warning',
            showDenyButton: true,
            showCancelButton: true,
            confirmButtonText: 'Approve it!',
            denyButtonText: 'Rejected it!',
         }).then((result) => {
            if (result.isConfirmed) {
                $.ajax({
                    type: "get",
                    url: "<?php echo e(url('/')); ?>/approved-leave-application/" + LeaveId,
                    data:{status:1,reason:''},
                    success: function(response) {
                        Swal.fire({
                            icon: 'success',
                            title: 'Leave Application has been Approved!',
                            showConfirmButton: false,
                            timer: 1500
                        }).then(function() {
                            location.reload();
                        });
                    }
                });
            }
            else if (result.isDenied){
                $('#myModal').modal('show');
                $('.rejected').click(function(){
                    var reason = $('#reason').val();
                    if(reason == "") {
                        Swal.fire({
                                icon: 'warning',
                                title: 'Reason is required!',
                                showConfirmButton: false,
                                timer: 2000
                            });
                    } 
                    // console.log(reason);die;
                    else{
                        $.ajax({
                            type: "get",
                            url: "<?php echo e(url('/')); ?>/approved-leave-application/" + LeaveId,
                            data:{status:2,reason:reason},
                            success: function(response) {
                                Swal.fire({
                                    icon: 'success',
                                    title: 'Leave Application has been Rejected!',
                                    showCancelButton: false,
                                    timer: 1500
                                }).then(function() {
                                    location.reload();
                                });
                            }
                        });
                    }
                });
            }
        });
    }
    $(document).ready(function() {
        $.ajax({
          type: "GET",
          url: "<?php echo e(url('/officer-name-list')); ?>",
          dataType: "json",
          success: function(response) {
            var json = response.officerNameList;
            $.each(json, function(i, ProfileName) {
                if(ProfileName.ProfileName != "User"){
                    $("#ProfileName").append("<option value='" + ProfileName.ProfileId + "'>" + ProfileName.ProfileName + "</option>");
                    $('#ProfileName').trigger('change');
                }
            });
          }
        });
    });
    $(document).ready(function(e) {
        $('#ProfileName').change(function(e) {
        var ProfileId = $(this).val();
            if (ProfileId == null) {
            return false;
            }
            else{
                $("#Authority").empty();
                $.ajax({
                    type: "GET",
                    url: "<?php echo e(url('/profile-wise-officer/')); ?>/"+ProfileId,
                    dataType: "json",
                    success: function(response) {
                        var json = response.officerWiseName;
                        $.each(json, function(i, UserDetails) {
                        $("#Authority").append("<option value='" + UserDetails.UserId + "'>" + UserDetails.FirstName + "</option>");
                        $('#Authority').trigger('change');
                        });
                    }
                });
            }
            e.preventDefault();
        });
    });
    // Forward
    $('#forward').click(function(){
        $('#concern').modal('show');
        var ProfileId = $(this).val();
            if (ProfileId == null) {
            return false;
            }
        $('.send').click(function(){
            var LeaveId = $(this).attr('Lid');
            var Concern = $('#Concern').val();
            var ProfileName = $('#ProfileName').val();
            var Authority = $('#Authority').val();
            if(Concern == "") {
                Swal.fire({
                        icon: 'warning',
                        title: 'Concern is required!',
                        showConfirmButton: false,
                        timer: 2000
                    });
            } 
            else if(ProfileName == null) {
                Swal.fire({
                        icon: 'warning',
                        title: 'ProfileName is required!',
                        showConfirmButton: false,
                        timer: 2000
                    });
            } 
            else if(Authority == "") {
                Swal.fire({
                        icon: 'warning',
                        title: 'AuthorityName is required!',
                        showConfirmButton: false,
                        timer: 2000
                    });
                } 
            else{
                $.ajax({
                    type: "get",
                    url: "<?php echo e(url('/')); ?>/forward-leave-application/" + LeaveId,
                    data:{status:3,Concern:Concern,ProfileId:Authority},
                    success: function(response) {
                        Swal.fire({
                            icon: 'success',
                            title: 'Leave Application has been Forworded!',
                            showCancelButton: false,
                            timer: 1500
                        }).then(function() {
                            location.reload();
                        });
                    }
                });
            } 
        });
    });
</script>
<!-- /.content-wrapper -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.include.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/hrms-production/resources/views/admin/LeaveManagement/approval-list.blade.php ENDPATH**/ ?>