Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.68 KB | None | 0 0
  1. @extends('layout.master')
  2. @section('assets_css')
  3. <link rel="stylesheet" type="text/css" href="{{ URL::asset('template/adminLTE2/plugins/datatables1.10.15/media/css/dataTables.bootstrap.min.css') }}"/>
  4. <link rel="stylesheet" type="text/css" href="{{ URL::asset('template/adminLTE2/plugins/datatables1.10.15/extensions/RowReorder/css/rowReorder.dataTables.min.css') }}"/>
  5. <link rel="stylesheet" type="text/css" href="{{ URL::asset('template/adminLTE2/plugins/toogle/toogle.css') }}"/>
  6. @endsection
  7. @section('content')
  8. <div class="row">
  9.     <div class="col-md-12">
  10.         <div class="box box-default">        
  11.             <div class="overlay" id="loading" >
  12.                 <i class="fa fa-refresh fa-spin"></i>
  13.             </div>
  14.             <div class="box box-default">
  15.                 <div class="box-header">
  16.                     <!--<h3 class="box-title">Listado     </h3>-->
  17.                     <div class="box-tools pull-right">  
  18.                         <button class="btn-import btn-box-tool btn btn-sm btn-success" id="btnExcel" style="color: white"><i class="fa fa-file-excel-o"> EXPORTAR EXCEL</i></button>
  19.                         <!--select  id="slcCredential" class="btn-box-tool">  
  20.                             <option value="" selected="">SELECCIONAR CREDENCIALES</option>
  21.                             <option value="0">SIN CREDENCIAL</option>                                        
  22.                             <option value="1">CON CREDENCIAL</option>                      
  23.                         </select>                        
  24.                         <select  id="slcTipo" class="btn-box-tool">  
  25.                             <option value="" selected="">SELECCIONE ESTADO</option>
  26.                             <option value="0">INACTIVO</option>                                        
  27.                             <option value="1">ACTIVO</option>                      
  28.                         </select-->                        
  29.                     </div>
  30.                 </div><!-- /.box-header -->
  31.                 <div class="box-body">
  32.                     <table id="tblView" class="table table-bordered table-hover">
  33.                         <thead>
  34.                             <tr>
  35.                                 <th>Fecha de registro</th>                                                    
  36.                                 <th>RUC / Código de empresa</th>
  37.                                 <th>Empresa</th>                                                              
  38.                                 <th>Representante legal</th>
  39.                                 <th>Email personal</th>
  40.                                 <th>Email corporativo</th>
  41.                                 <th>País</th>
  42.                                 <th>Tipo de empresa</th>
  43.                                 <!--th>Creación de credenciales</th>
  44.                                 <th>Credenciales</th>
  45.                                 <th>Estado</th>
  46.                                 <th>Acciones</th-->
  47.                             </tr>
  48.                         </thead>
  49.                         <tbody>
  50.                         </tbody>
  51.                     </table>
  52.                 </div><!-- /.box-body -->
  53.             </div><!-- /.box -->
  54.         </div><!-- /.col -->
  55.     </div><!-- /.col -->
  56. </div><!-- /.col -->
  57. <form id="frmImport">    
  58.     <input type="hidden" name="importType" value="excel" id="importType" >
  59.     <input type="hidden" name="importSearch"  value="" id="importSearch">
  60.     <input type="hidden" name="importColum"  value="" id="importColum">
  61.     <input type="hidden" name="importOrder"  value="" id="importOrder">    
  62.     <!--input type="hidden" name="importStatus"  value="" id="importStatus"-->    
  63.     <!--input type="hidden" name="importCredential"  value="" id="importCredential"-->    
  64.  
  65. </form>
  66. @endsection
  67. @section('assets_js')
  68. <script type="text/javascript" src="{{ URL::asset("template/adminLTE2/plugins/datatables1.10.15/media/js/dataTables.bootstrap.min.js") }}"></script>
  69. <script type="text/javascript" src="{{ URL::asset("template/adminLTE2/plugins/datatables1.10.15/media/js/jquery.dataTables.min.js") }}"></script>
  70. <script type="text/javascript" src="{{ URL::asset("template/adminLTE2/plugins/datatables1.10.15/extensions/RowReorder/js/dataTables.rowReorder.min.js") }}"></script>
  71. <script type="text/javascript" src="{{ URL::asset("template/adminLTE2/plugins/toogle/toogle.js") }}"></script>
  72. <script  type="text/javascript">
  73. $(document).ready(function () {
  74.     $("#slcTipo").change(function () {
  75.         dataTable.ajax.reload();
  76.     })
  77.     $("#slcCredential").change(function () {
  78.         dataTable.ajax.reload();
  79.     })
  80.     var dataTable = $("#tblView").DataTable({
  81.         "order": [[0, "desc"]],
  82.         "language": configuracion.dataTable_Languaje,
  83.         "serverSide": true,
  84.         "ajax": {
  85.             "url": "{{url(route('company_load'))}}",
  86.             "type": "POST",
  87.             "data": function (d) {
  88.                 return $.extend({}, d, {
  89.                     status: $("#slcTipo").val(),
  90.                     credential: $("#slcCredential").val(),
  91.                 });
  92.             }
  93.         },
  94.         "columns":
  95.                 [
  96.                     {"data": "created"},
  97.                     {"data": "ruc"},
  98.                     {"data": "company_name"},
  99.                     {"data": "legal_represent"},
  100.                     {"data": "email"},
  101.                     {"data": "email_company"},
  102.                     {"data": "es"},
  103.                     {"data": "company_type"},
  104.                     {"data": "credential_date"},
  105.                 ],
  106.        /* "aoColumnDefs": [
  107.             {
  108.                 "aTargets": [9],
  109.                 "mData": null,
  110.                 "mRender": function (data, type, full) {
  111.                     var button = '<a class="btn btn-xs btn-success disabled" data-type="2" >Generar</a>';
  112. <?php if (isset($user->permissions[12]['children'][22]) && $user->permissions[12]['children'][22]['permission'] != "R") { ?>
  113.                         if (full.status == 1) {
  114.                             if (full.credential == '1') {
  115.                                 button = '<a class="btn btn-xs btn-success btn-credential" data-type="1" data-codigo="' + full.id + '">Reenviar </a>';
  116.                             } else {
  117.                                 button = '<a class="btn btn-xs btn-success btn-credential" data-type="2" data-codigo="' + full.id + '">Generar</a>';
  118.                             }
  119.                         } else {
  120.                             button = '<a class="btn btn-xs btn-success disabled" data-type="2" >Generar</a>';
  121.                         }
  122. <?php } ?>
  123.                     return button;
  124.                 }
  125.             },
  126.             {
  127.                 "aTargets": [10],
  128.                 "mData": null,
  129.                 "mRender": function (data, type, full) {
  130.                     var style = (full.status) ? 'green' : 'red';
  131.                     var txt = (full.status) ? 'Activo' : 'Inactivo';
  132.                     var button = '<small class="label bg-' + style + '">' + txt + '</small>';
  133. <?php if (isset($user->permissions[12]['children'][22]) && $user->permissions[12]['children'][22]['permission'] != "R") { ?>
  134.                         button = '<input class="toogle_acceso toogle_status" type="checkbox" data-id="' + full.id + '" ' + (full.status == 1 ? "checked" : "") + ' data-toggle="toggle" data-onstyle="success" data-on="ACTIVO" data-off="INACTIVO" data-size="mini"/>';
  135. <?php } ?>
  136.                     return button;
  137.                 }
  138.             },
  139.             {
  140.                 "aTargets": [11],
  141.                 "mData": null,
  142.                 "mRender": function (data, type, full) {
  143.                     var button = '';
  144. <?php if (isset($user->permissions[12]['children'][22]) && $user->permissions[12]['children'][22]['permission'] != "R") { ?>
  145.                         var url_editar = "{{url(route('company')) }}/detail/" + full.id;
  146.                         button = '<a href="' + url_editar + '" class="btn btn-xs btn-info "  rel="2"><i class="fa fa-edit"></i> Editar</a> ';
  147. <?php } ?>
  148.                     return button;
  149.                 }
  150.             },
  151.         ],*/
  152.         "preDrawCallback": function (settings) {
  153.             $('#loading').show();
  154.         },
  155.         "drawCallback": function () {
  156.             $(".overlay").hide();
  157.             $('#loading').hide();
  158. /*<?php if (isset($user->permissions[12]['children'][22]) && $user->permissions[12]['children'][22]['permission'] != "R") { ?>
  159.                 $('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle();
  160.                 $('.toogle_status').change(function () {
  161.                     var acceso = $(this).prop('checked') ? 1 : 0;
  162.                     var id = $(this).data("id");
  163.                     $(".overlay").show();
  164.                     $.ajax({
  165.                         type: "POST",
  166.                         url: "{{url(route('company_change_status'))}}",
  167.                         data: {id: id, status: acceso},
  168.                         success: function (data) {
  169.                             $(".overlay").hide();
  170.                             dataTable.ajax.reload();
  171.                         },
  172.                         error: function (xhr, ajaxOptions, thrownError) {
  173.                             $(".overlay").hide();
  174.                         }
  175.  
  176.                     });
  177.                 });
  178. <?php } ?>*/
  179.         }
  180.     });
  181.  
  182. /*<?php if (isset($user->permissions[12]['children'][22]) && $user->permissions[12]['children'][22]['permission'] != "R") { ?>
  183.  
  184.         $("#tblView").on("click", ".btn-credential", function () {
  185.             var codigo = $(this).data('codigo');
  186.             var type = $(this).data('type');
  187.             $(".overlay").show();
  188.             $.ajax({
  189.                 url: '{{url(route('company_credential'))}}',
  190.                 type: "POST",
  191.                 data: {
  192.                     codigo: codigo,
  193.                     type: type,
  194.                 },
  195.                 success: function (data, textStatus, jqXHR)
  196.                 {
  197.                     dataTable.ajax.reload();
  198.                 },
  199.                 error: function (jqXHR, textStatus, errorThrown)
  200.                 {
  201.                     dataTable.ajax.reload();
  202.                 }
  203.             });
  204.         });
  205. <?php } ?>*/
  206.  
  207.     $('#btnExcel').click(function () {
  208.  
  209.         $('#frmImport').attr('method', 'post');
  210.         var order = dataTable.order()[0];
  211.         $('#importColum').val(order[0]);
  212.         $('#importOrder').val(order[1]);
  213.         $('#importSearch').val(dataTable.search());
  214.         /*$('#importStatus').val($('#slcTipo').val());*/
  215.         /*$('#importCredential').val($('#slcCredential').val());*/
  216.         $('#frmImport').submit();
  217.     })
  218. });
  219.  
  220. </script>
  221. @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement