<?php



require_once ("../../config/Cado.php");

require_once ("cImpresora.php");

$oImpresora = new cImpresora();



$dts=$oImpresora->filtrar();

$num_rows= mysqli_num_rows($dts);



?>



<section class="content">

	<div class="container-fluid">

	<div class="row">

	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">

		    <div class="card">

				<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;">

	

	<div class="table-responsive">

		

          <table id="tabla_impresora" class="table table-bordered table-striped">

           <thead>

            <tr>

              <th>NOMBRE</th>

              <th>TIPO</th>

              <th>NOMBRE LOCAL</th>

              <th>SERIE</th>

              <th>URL</th>

              <th>IP</th>

              <th>&nbsp;</th>

            </tr>

          </thead>

          <?php

          if($num_rows>=1){

            ?>  

            <tbody>

             <?php while($dt = mysqli_fetch_array($dts)){ ?>

             <tr>

              <td><?php echo $dt['tb_impresora_nom']?></td>

              <td><?php echo ($dt['tb_impresora_tipo']==1)?'TICKET' : 'CODIGO DE BARRAS';?></td>

              <td><?php echo $dt['tb_impresora_nomloc']?></td>

              <td><?php echo $dt['tb_impresora_ser']?></td>

              <td><?php echo $dt['tb_impresora_url']?></td>

              <td><?php echo $dt['tb_impresora_ip']?></td>

              <td>

               

   <button class="btn btn-sm btn-primary" onClick="impresora_form('editar','<?php echo $dt['tb_impresora_id']?>')" ><i class="fas fa-edit"></i></button>

	<button class="btn btn-sm btn-primary" onClick="eliminar_impresora('<?php echo $dt['tb_impresora_id']?>')" ><i class="fas fa-trash"></i></button>

						  

						  

			 </td>

            </tr>

            <?php

          }

          mysqli_free_result($dts);

          ?>

        </tbody>

        <?php }?>

      </table>

	  

	  

    </div>

    </div>

    </div>

  </div>

</div>

</div>

</section>



<script type="text/javascript">

  $(function() {  

    $('#tabla_impresora').DataTable({

 

        "language": {

                "lengthMenu": "Mostrar _MENU_ registros",

                "zeroRecords": "No se encontraron resultados",

                "info": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",

                "infoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",

                "infoFiltered": "(filtrado de un total de _MAX_ registros)",

                "sSearch": "Buscar:",

                "oPaginate": {

                    "sFirst": "Primero",

                    "sLast":"Último",

                    "sNext":"Siguiente",

                    "sPrevious": "Anterior"

			     },

			     "sProcessing":"Procesando...",

            }

    });     

	

  }); 

</script>