Guest User

Untitled

a guest
Oct 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. var tabla=null;
  2.  
  3. var tabla='tabla_roles';
  4.  
  5. $(document).ready(function() {
  6. muestrapermisos();
  7. $('#tabla_roles').DataTable({
  8. "order": [0, "asc"],
  9. "aLengthMenu": [[50, -1],[50, "All"]],
  10. keys: true,
  11. paging: true,
  12. language:{
  13. search:"Buscar:",
  14. paginate: {
  15. "next": "Siguente",
  16. "previous": "Anterior"
  17. }
  18. }
  19. });
  20. });
  21. function muestrapermisos() {
  22. $.ajax({
  23. data: "&_token={{ csrf_token() }}&tipo_id="+$('#tipo_id').val()+"&rol_id={{isset($datos['id'])?$datos['id']:'0'}}",
  24. type: "POST",
  25. url: "{{URL::to('/')}}/base/configuracion/roles/permisos.json",
  26. success: function(data){
  27. var html = '';
  28. var tdatos=Math.round(data.total,0);
  29. var datos = data.datos;
  30. var no=((Math.round(tdatos,2)/tdatos) >= 0)?Math.round(tdatos,0):Math.round(tdatos,0);
  31. $('#'+tabla+"_npage").html(no+1);
  32. if(datos.length > 0){
  33. var nx=$('#'+tabla+'_paginaactual').val();
  34. n=(nx==1)?nx:(((nx*($('#'+tabla+'_rows').val()))+1)-($('#'+tabla+'_rows').val()));
  35. $.each(datos, function(i,item){
  36. html += '<tr align="center">'
  37. html += '<td><i class="'+item.app_icono+'"></i> '+item.aplicacion_nombre+'</td>'
  38. html += '<td><i class="'+item.cat_icono+'"></i> '+item.categoria_nombre+'</td>'
  39. html += '<td><i class="'+item.icono+'"></i> '+item.nombre+'</td>'
  40. html += '<td ><input type="checkbox" onclick="actualizadatos('+item.id+',1)" id="l'+item.id+'" '+((item.leer==1)?'checked="checked"':'')+' /><label for="l'+item.leer+'"></td>'
  41. html += '<td ><input type="checkbox" onclick="actualizadatos('+item.id+',2)" id="e'+item.id+'" '+((item.escribir==1)?'checked="checked"':'')+' /><label for="l'+item.escribir+'"></td>'
  42. html += '<td ><input type="checkbox" onclick="actualizadatos('+item.id+',3)" id="m'+item.id+'" '+((item.modificar==1)?'checked="checked"':'')+' /><label for="l'+item.modificar+'"></td>'
  43. html += '<td ><input type="checkbox" onclick="actualizadatos('+item.id+',4)" id="i'+item.id+'" '+((item.eliminar==1)?'checked="checked"':'')+' /><label for="l'+item.eliminar+'"></td>'
  44. html += '</tr>';
  45. n++;
  46. });
  47. }
  48. if(html == '') html = '<tr><td colspan="7" align="center">No se encontraron registros..</td></tr>';
  49. $("#"+tabla+" tbody" ).html(html);
  50. }
  51. });
  52. }`
  53.  
  54. <div class="table-responsive">
  55. <table id="tabla_roles" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0">
  56. <thead>
  57. <tr class='bg-blue'>
  58. <th>Aplicación</th>
  59. <th>Categoria</th>
  60. <th>Modulo</th>
  61. <th >Leer</th>
  62. <th >Escribir</th>
  63. <th>Crear</th>
  64. <th>Eliminar</th>
  65. </tr>
  66. </thead>
  67. <tbody id="body_roles">
  68.  
  69. </tbody>
  70. <tfoot>
  71. <tr class='bg-blue'>
  72. <th>Aplicación</th>
  73. <th>Categoria</th>
  74. <th>Modulo</th>
  75. <th >Leer</th>
  76. <th >Escribir</th>
  77. <th>Crear</th>
  78. <th>Eliminar</th>
  79. </tr>
  80. </tfoot>
  81. </table>
  82. </div>
Add Comment
Please, Sign In to add comment