$(document).ready(function(){
    var dataTable = $('.table').DataTable( {
        language: {
            url: '/traslate/es-MX.json',
        },
        responsive: true,
        ordering: false,
        dom: "<'row'<'col-sm-12 col-md-6'f><'col-sm-12 col-md-6'l>>" +
            "<'row'<'col-sm-12'tr>>" +
            "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
        paging: false,
        scrollY: getHeight(),
        processing: true,
        serverSide: true,
        columns: [
            {data: "conv_codigo", name: "conv_codigo", title: 'Codigo'},
            {data: "conv_nombre_cargo", name: "conv_nombre_cargo", title: 'Cargo'},
            {data: "conv_area_oficina", name: "conv_area_oficina", title: 'Oficina'},
            {data: "conv_numero_plazas", name: "conv_numero_plazas", title: 'Plazas'},
            {data: "conv_remuneracion", name: "conv_remuneracion", title: 'Remuneracion'},
            {data: "conv_fecha_desde", name: "conv_fecha_desde", title: 'Desde'},
            {data: "conv_fecha_hasta", name: "conv_fecha_hasta", title: 'Hasta'},
            {data: 'acciones', title: 'Acciones', orderable: false},
        ],
        columnDefs: [
            { width: '10%', targets: 0 },
            { width: '20%', targets: 1 },
            { width: '20%', targets: 2 },
            { width: '10%', targets: 3 },
            { width: '10%', targets: 4 },
            { width: '10%', targets: 5 },
            { width: '10%', targets: 6 },
            { width: '10%', targets: 7 }
        ],
        fixedColumns: true,
        ajax: {
            url: '/query/datatable/ConvocatoriaModel',
            type: 'POST',
            data: function (d) {
                d.ordering = [
                    'conv_codigo desc'
                ];
                d.acciones = [
                    '<a href="#" data-bs-toggle="tooltip" data-bs-placement="top" class="px-2 text-warning btnEdit" title="Editar" @DATA@><i class="bx bx-pencil font-size-22"></i></a>',
                    '<a href="#" data-bs-toggle="tooltip" data-bs-placement="top" class="px-2 text-danger btnDelete" title="Eliminar" @DATA@><i class="bx bx-trash-alt font-size-22"></i></a>',
                ];
            }
        }
    });

    dataTable.on( 'draw', function () {
        funciones.setupTooltip();
    } );

});


