<?php
require_once ("../../config/Cado.php");
require_once ("cDocumento.php");
$oDocumento = new cDocumento();
require_once ("../modulo/cModulo.php");
$oModulo = new cModulo();
require_once ("../formatos/formatos.php");
?>

<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_documento" class="table table-bordered table-striped">
           <thead>
            <tr>
              <th>ABREVIATURA</th>
              <th>NOMBRE</th>
              <th>ID</th>
              <th>MOSTRAR</th>
              <th>IMPRESORA</th>
              <th>OPCIONES</th>
              <!-- <th>&nbsp;</th> -->
            </tr>
          </thead>
          <tbody>
            <?php
            $dts1=$oModulo->filtrar();
            while($dt1 = mysqli_fetch_array($dts1))
            {
              ?>
              <tr class="bg-gray">
                <th colspan="6" valign="bottom"><strong> MODULO : <?php  echo $dt1['tb_modulo_nom'];?></strong></th>
              </tr>
              <?php 
              $dts=$oDocumento->filtrar($dt1['tb_modulo_id']);
              while($dt = mysqli_fetch_array($dts)){
                ?>
                <tr >
                  <td><?php echo $dt['tb_documento_abr']?></td>
                  <td><?php echo $dt['tb_documento_nom']?></td>
                  <td><?php echo $dt['tb_documento_id']?></td>
                  <td><?php echo mostrar_siigual($dt['tb_documento_def'],1,'Por defecto')?></td>
                  <td><?php echo $dt['tb_impresora_nom']?></td>
                  <td>

	<button class="btn btn-sm btn-primary" onClick="documento_form('editar','<?php echo $dt['tb_documento_id']?>')" ><i class="fas fa-edit"></i></button>
	<button class="btn btn-sm btn-primary" onClick="eliminar_documento('<?php echo $dt['tb_documento_id']?>')" ><i class="fas fa-trash"></i></button>
				
				</td>
               </tr>
               <?php
             }
             mysqli_free_result($dts);
             ?>
             <tr >
              <td colspan="6">&nbsp;</td>
            </tr>
            <?php
          }
          mysqli_free_result($dts1);
          ?>
        </tbody>
      </table>
   
   </div>
   </div>
   </div>
  </div>
</div>
</div>
</section>
<!-- <script type="text/javascript">
  $(function() {  
    $("#tabla_documento").DataTable( {
      "columnDefs": [
      { "orderable": false, "targets": [2] }
      ],
      "searching": false,
      "order":[[0,"asc"]]
    });
  }); 
</script> -->