Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function()
- {
- console.log("ready");
- cargarCampos(3);
- obtenerReqAprobacion();
- // TableManageDefault.init();
- });
- function obtenerReqAprobacion()
- {
- let filas, cabecera;
- let resultados=[];
- let formData= new FormData();
- filas="";
- ajaxDinamicoForm("mesa_ayuda/obtenerReqAprobacion", formData, function(data)
- {
- console.log(data);
- resultados=data.resultados;
- cabecera="<tr>";
- cabecera+="<th data-orderable='false'>N°</th>";
- cabecera+="<th>Req</th>";
- cabecera+="<th>Solicitante</th>";
- cabecera+="<th>VB de</th>";
- cabecera+="<th>Descripcion Breve</th>";
- cabecera+="<th>Responsable</th>";
- cabecera+="<th>Observacion</th>";
- cabecera+="<th>Comentario</th>";
- cabecera+="<th>Accion</th>";
- cabecera+="</tr>";
- $("#data-table-default").find("thead").html(cabecera);
- for(let i=0; i < data.resultados.length;i++)
- {
- filas+="<tr>";
- filas+="<td>"+(i+1)+"</td>";
- filas+="<td><a href='mesa_ayuda/detalle?req="+resultados[i].cod_requerimiento+"' class='label label-inverse'>"+resultados[i].cod_requerimiento+"</a> </td>";
- filas+="<td>"+resultados[i].nCreador+"</td>";
- filas+="<td>"+resultados[i].nUsuario+"</td>";
- filas+="<td>"+resultados[i].DescripcionBreve+"</td>";
- filas+="<td>"+resultados[i].nResponsable+"</td>";
- filas+="<td>Ventaja: "+resultados[i].Ventaja+"<br> Desventaja: "+resultados[i].Desventaja+"</td>";
- filas+="<td><textarea id=tbComentario_"+resultados[i].cod_requerimiento+"' name='tbComentario_"+resultados[i].cod_requerimiento+"' maxlength='255' rows='3'></textarea></td>";
- filas+="<td><button type='button' id='btnA"+resultados[i].cod_requerimiento+"' class='btn btn-primary envio aprob'> Aprobar </button> <button type='button' id='btnR"+resultados[i].cod_requerimiento+"' class='btn btn-danger envio neg'> Rechazar</button></td>";
- filas+="</tr>";
- }
- $("#data-table-default").find("tbody").html(filas);
- if ($('#data-table-default').length !== 0)
- {
- $('#data-table-default').DataTable(
- {
- responsive: true,
- "language":
- {
- "decimal": "",
- "emptyTable": "No hay solicitudes de aprobación disponibles.",
- "info": "Mostrando _START_ al _END_ de _TOTAL_ registro(s)",
- "infoEmpty": "Mostrarndo 0 a 0 de 0 registro(s)",
- "infoFiltered": "(filtered from _MAX_ total entries)",
- "infoPostFix": "",
- "thousands": ",",
- "lengthMenu": "Mostrar _MENU_ registros",
- "loadingRecords": "Cargando...",
- "processing": "Procesando...",
- "search": "Buscar:",
- "zeroRecords": "No matching records found",
- "paginate": {
- "first": "Primero",
- "last": "Último",
- "next": "Siguiente",
- "previous": "Anterior"
- },
- "aria": {
- "sortAscending": ": activate to sort column ascending",
- "sortDescending": ": activate to sort column descending"
- }
- }
- });
- $(".envio").click(function(){
- var n = $(this).attr("id").lastIndexOf("_") + 1;
- var id_Req = $(this).attr("id").substring(n,$(this).attr("id").length); //Obtengo el ID
- var comentario = $("#tbComentario_" + id_Req);
- var aprobacion;
- if ($(this).hasClass('aprob') == true)
- { aprobacion = 1; }
- else
- { aprobacion = 0; }
- if ($.trim(comentario.val()) == "")
- { comentario.parent().addClass("error");
- $("#tbComentario_" + id_Req).focus();
- return false; }
- else
- {
- $.post("mesa_ayuda/actualizaResponsableAprob",{ req:id_Req ,
- comentario:comentario.val() ,
- aprobado:aprobacion },
- function(data) {
- { window.location = "baprobacion.asp?m=1" }
- });
- }
- });
- }
- })
Add Comment
Please, Sign In to add comment