<form method="POST" id="formTable" >
<div class="pull-right">
<div class="btn-group" style="margin: 20px">
{{ boton('nuevo','','crearOperacionesPredefinidas') }}
{{ boton('editar','','editar_frm()') }}
{{ boton('eliminar','', "eliminar_selection();" ) }}
{{ boton('ver','', "activarModal('verCotizacion');" ) }}
</div>
</div>
<table id="tablaOperaciones" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th></th>
<th>Código</th>
<th>Título</th>
<th>Descripción</th>
<th>Clase de Operación</th>
<th>Centro de Costos</th>
<th>Rubro</th>
</tr>
</thead>
<tfoot>
<th>Código</th>
<th>Título</th>
<th>Descripción</th>
<th>Clase de Operación</th>
<th>Centro de Costos</th>
<th>Rubro</th> </tfoot>
<tbody>
{% for operacionP in operacionesPredefinidas %}
<tr>
<td><input type="checkbox" id="checkb{{ operacionP.operacionPredefinidaID }}" name="checkb[]" value="{{ operacionP.operacionPredefinidaID }}"></td>
<td>{{ operacionP.operacionPredefinidaCODIGO }}</td>
<td>{{ operacionP.operacionPredefinidaTITULO }}</td>
<td>{{ operacionP.operacionPredefinidaDESCRIPCION }}</td>
<td>{{ operacionP.claseOperacionID }}</td>
<td>{{ operacionP.centroCostosID }}</td>
<td>{{ operacionP.rubroID }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
<script type="text/javascript" >
$(document).ready(function () {
$('#tablaOperaciones').DataTable();
});
function eliminar_selection() {
alert($("#formTable").serialize());
var conteo=0;
$("input:checkbox:checked").each(
function() {
conteo++;
//break;
}
);
alert(conteo);
if(conteo>0){
ejecutarOperacion(
"planeador",
"OperacionesPredefinidas",
"eliminar",
$("#formTable").serialize(),
function (response) {
console.log(response);
//var respuesta = JSON.parse(response);
if (response.RESPUESTA == 'EXITO') {
alert("Registro eliminado!");
$("#formTable")[0].reset();
} else {
alert(response['RESPONSE']);
}
}
);
}
}
/*Editar campo*/
function editar_frm() {
var seleccionados = checkSelecionados('tablaOperaciones');
validacionCheckbox(seleccionados, function (){
var json = JSON.stringify(seleccionados);
json = JSON.parse(json);
var consecutivo = json[0]['value'];
cargarVista('planeador','OperacionesPredefinidas','crearOperacionesPredefinidas','operacionPredefinidaCONSECUTIVO='+consecutivo,'Editar Operación Predefinida '+consecutivo, 'crearOperacionesPredefinidas');
}, true);
$("#formTable")[0].reset();
/*
var conteo=0;
$("input:checkbox:checked").each(
function() {
conteo++;
//break;
}
);
if(conteo==1){
cargarVista("planeador",
"OperacionesPredefinidas",
"crearOperacionesPredefinidas",
$("#formTable").serialize(), "Editar Operación 9" , 9);
$("#formTable")[0].reset();
}else{swal("Debe seleccionar solo un registro");}
*/
}
/**************/
</script>