<div class="row mt-1">
    <div class="col-md-12 table-responsive">
        <table id="list_data_habis_masa_kerja" class="table table-striped" style="width:100%">
            <thead>
                <tr>
                    <th class="text-center">NO</th>
                    <th class="text-center">NAMA KARYAWAN</th>
                    <th class="text-center">JABATAN</th>
                    <th class="text-center">CABANG<br>DEPARTEMEN</th>
                    <th class="text-center">TANGGAL SELESAI KONTRAK</th>
                    <th class="text-center">AKSI</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
</div>

<script type="text/javascript">
    $(function() {
        var id_cabang       = ($("#cabang").val() == null)?"all":$("#cabang").val();
        var id_departemen   = ($("#departemen").val() == null)?"all":$("#departemen").val();
        var id_karyawan     = ($("#karyawan").val() == null)?"all":$("#karyawan").val();
        var tanggal_mulai   = ($("#tanggal_mulai").val() == null)?"00-00-0000":$("#tanggal_mulai").val();
        var tanggal_selesai = ($("#tanggal_selesai").val() == null)?"00-00-0000":$("#tanggal_selesai").val();

        list_data_habis_masa_kerja = $('#list_data_habis_masa_kerja').DataTable({
                    'searching'   : false,
                    'searchDelay' : 250,
                    'paging'      : true,
                    'lengthChange': true,
                    'ordering'    : false,
                    'info'        : true,
                    'scrollX'     : true,
                    // 'scrollCollapse': true,
                    // 'fixedColumns': true,
                    'language'    :{
                                    'url'         : '<?=base_url("assets/plugins/datatables/dataTables-language-id.json")?>',
                                    'sEmptyTable' : 'Tidak ada data untuk ditampilkan'
                                },
                    "processing"  : true,
                    "serverSide"  : true,
                    "order"       : [],

                    "ajax"        : {
                                        "url": "<?= route('pkwt.baru.kayawan.tabs.content.habis.masa.kerja') ?>"+"/"+tanggal_mulai+"/"+tanggal_selesai+"/"+id_cabang+"/"+id_departemen+"/"+id_karyawan,
                                        "type": "GET",
                                        "data"  : function (d) {
                                            delete d.columns;
                                        },
                                        "complete" : function(data){
                                                reconfigure(data);
                                        }
                                    },

                    "aoColumnDefs": [
                                        { "aTargets": [0,-1], "bSortable": false },
                                    ],
                    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
                            $('td:eq(0)', nRow).css({'text-align':'center','width':'10px'});
                            $('td:eq(4)', nRow).css({'text-align':'center'});
                            $('td:eq(5)', nRow).css({'text-align':'center'});
                    }
        });
    });
</script>