<form method="POST" id="formTable" >
    <div class="pull-right">
        <div class="btn-group" style="margin: 20px">
                {{ boton('nuevo',"crearSolicitudPeronal") }}
                {{ boton('editar','',"editar_solicitudPersonal();") }}
                {{ boton('eliminar','', "eliminar_selection();" ) }}
                {{ boton('ver','', "activarModal('verCotizacion');" ) }}
    

        </div>  
    </div>
     <table id="tablaSolicitudPersonal" class="table table-striped table-bordered" cellspacing="0" width="100%">
        <thead>
            <tr>
                   <th></th> 
                 <th>Actividad</th>
                 <th>Responsable</th>
                 <th>Personal Presupuestado</th> 
                 <th>Funcion a Desempeñar</th>
                <th>Descripción</th>
                <th>No. de Personas</th>
                <th>Cuanto Tiempo</th>

            </tr>
        </thead>
        <tfoot>
                   <th></th> 
                <th>Actividad</th>
                 <th>Responsable</th>
                 <th>Personal Presupuestado</th> 
                 <th>Funcion a Desempeñar</th>
                <th>Descripción</th>
                <th>No. de Personas</th>
                <th>Cuanto Tiempo</th>     
                
                </tfoot>
                
        <tbody>
            {% for solicitudPersonal in SolicitudesPersonal  %}
            <tr>
                <td><input type="checkbox" id="checkb{{ solicitudPersonal.solicitudPersonalID }}" name="checkb[]" value="{{solicitudPersonal.solicitudPersonalID }}"></td>
                <td>{{ solicitudPersonal.actividadID }}</td>
                <td>{{ solicitudPersonal.cargoID }}</td>
                <td>{{ solicitudPersonal.personalPresupuestadoID }}</td>
                <td>{{ solicitudPersonal.solicitudPersonalFUNCIONES }}</td>
                <td>{{ solicitudPersonal.solicitudPersonalOBSERVACIONES }}</td>
                <td>{{ solicitudPersonal.solicitudPersonalCANTIDAD }}</td>
                <td>{{ solicitudPersonal.solicitudPersonalMESES }}</td>
            </tr>
            {% endfor %}

        </tbody>
    </table>
</form>        

<script type="text/javascript" >
    $(document).ready(function () {
        $('#tablaSolicitudPersonal').DataTable();
    });
    function eliminar_selection() {
        
        alert($("#formTable").serialize());
        var conteo=0;
$("input:checkbox:checked").each(   
    function() {
            conteo++;
            //break;
    }
);

//alert(conteo);
if(conteo>0){
        ejecutarOperacion(
                "planeador",
                "SolicitudPersonal",
                "eliminar",
                $("#formTable").serialize(),
                function (response) {
                    console.log(response);
                    //var respuesta = JSON.parse(response);
                    if (response.RESPUESTA == 'EXITO') {
                        alert("Operación reazalida con Exito!");
                        $("#formTable")[0].reset();
                    } else {
                        alert(response['RESPONSE']);
                    }
                }
        );    
}
}
 function editar_solicitudPersonal()
        {
        var seleccionados = checkSelecionados('tablaSolicitudPersonal');
         validacionCheckbox(seleccionados, function (){
            var json = JSON.stringify(seleccionados);
            json = JSON.parse(json);
            var consecutivo = json[0]['value'];
            alert('paso 1');
            cargarVista('planeador','SolicitudPersonal','crearSolicitudPersonal','solicitudPersonalID='+consecutivo,'Editar SolicitudPersonal '+consecutivo, 'crearSolicitudPersonal');
        }, true);
        $("#formTable")[0].reset();


    }
   </script> 
               
                
                
                
               
