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/admin/Reports/employee-seniority-list.blade.php
@extends('admin.include.master')

@section('content')
<!-- 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 justify-content-between">
                <div class="col-sm-6">
                    <h1 id="page-title">Seniority List</h1>
                </div>
                <div class="col-sm-4">
                    <div class="form-group mb-2">
                        <label class="mb-0" for="Designation Name">Select Designation</label>
                        <select class="form-control form-control-sm select2" aria-hidden="true" name="DesignationNameId"
                            id="DesignationNameId" data-placeholder="Select Designation">
                            <option value="" disabled selected>Select Designation</option>
                        </select>
                    </div>
                </div>


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

    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            {{-- Country List --}}
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <!-- /.card-header -->
                        <div class="card-body">
                            <table id="emplaoyeeTable" class="table table-bordered table-striped table-sm">
                                <thead>
                                    <tr>
                                        <th>S.No.</th>
                                        <th>Emp Name</th>
                                        <th>D.O.B.</th>
                                        <th>Qualification</th>
                                        <th>Pervious Post</th>
                                        <th>Joining date of current post</th>
                                        <th>Nomination / Promotion</th>
                                        <th>Employee Category</th>
                                        <th>Appointment Category</th>
                                        <th>Retirement Date</th>
                                        <th>Remarks</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {{-- @foreach ($EmpSeniorityList as $EmpSeniorityList)
                                    <tr>
                                        <td>{{ $loop->iteration }}</td>
                                    <td><a href="{{ url('view-employee', $EmpSeniorityList->EmployeeId) }}"
                                            target="_blank"
                                            rel="noopener noreferrer">{{ $EmpSeniorityList->EmployeeName }}</a></td>
                                    <td>{{ date('d-M-y', strtotime($EmpSeniorityList->DateOfBirth)) }}</td>
                                    <td></td>
                                    <td>
                                        @if ($EmpSeniorityList->PrevDesignation)
                                        {{ $EmpSeniorityList->PrevDesignation }}
                                        @else
                                        --
                                        @endif
                                    </td>
                                    <td>
                                        @if ($EmpSeniorityList->PrevDesignation &&
                                        $EmpSeniorityList->PreviousJoiningDate)
                                        {{ date('d-M-y', strtotime($EmpSeniorityList->PreviousJoiningDate)) }}
                                        @else
                                        --
                                        @endif
                                    </td>
                                    <td>{{ $EmpSeniorityList->DesignationName }}</td>
                                    <td>{{ date('d-M-y', strtotime($EmpSeniorityList->PromotionTransferDate)) }}
                                    </td>
                                    <td>{{ $EmpSeniorityList->AppointmentStatus }}</td>
                                    <td>{{ $EmpSeniorityList->BasicCategoryName }}</td>
                                    <td>{{ $EmpSeniorityList->AppointmentCategoryName }}</td>
                                    <td>{{ date('d-M-y', strtotime($EmpSeniorityList->RetirementDate)) }}</td>
                                    </tr>
                                    @endforeach --}}
                                </tbody>
                            </table>
                        </div>
                        <!-- /.card-body -->
                    </div>
                    <!-- /.card -->
                    </form>
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->

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

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

{{-- Designation List --}}
<script>
    $(document).ready(function() {
          $.ajax({
            type: "GET",
            url: "{{ url('/designation-list') }}",
            dataType: "json",
            success: function(response) {
              var json = response.Designation;
              $.each(json, function(i, designation) {
                $("#DesignationNameId").append("<option value='" + designation.DesignationId + "'>" + designation.DesignationName + "</option>");
                $('#DesignationNameId').trigger('change');
              });
            }
          });
    }); 

    $(document).ready(function() {
        var nodata = '<tr class="odd"><td valign="top" colspan="12" class="text-center">No data available in table, please select designation.</td></tr>';
            $('#emplaoyeeTable').find('tbody').html('#' +nodata);
    });
    // Get Selected Designation Id
    $('#DesignationNameId').on('select2:select', function (e) {
            //alert(e.params.data);
            var data = e.params.data;
            var DesignationId = data.id;
            //alert(DesignationId);
        if (DesignationId == null) {
            var nodata = '<tr class="odd"><td valign="top" colspan="8" class="text-center">No data available in table</td></tr>';
            $('#emplaoyeeTable').find('tbody').html('#' +nodata);
           return false;
        } else {
            $("#emplaoyeeTable tbody").empty();
            $('#emplaoyeeTable').dataTable().fnClearTable();
            $('#emplaoyeeTable').dataTable().fnDestroy();
                $.ajax({
                type: "POST",
                url: "{{ url('/') }}/get-seniority-list",
                dataType: 'json',
                data: {
                    DesignationId: DesignationId,
                    _token: "{{ csrf_token() }}",
                },
                success: function (response) {
                        $('#emplaoyeeTable').find('tbody').append(response.output);
                        
                        $("#emplaoyeeTable").DataTable({
                        "responsive": true,
                        "ordering": false,
                        "buttons": ["excel", "pdf", "print", "colvis"]
                        }).buttons().container().appendTo('#emplaoyeeTable_wrapper .col-md-6:eq(0)');
                }
            });
        }
            
    });
</script>
<!-- /.content-wrapper -->
@endsection