<?php
session_start();
include "../conexion.php";
    $comt_id=$_GET['comt_id']; 
    $id=$_GET['comt_id'];  
?>
<table class="table table-striped table-bordered" style="font-size: 9pt;">
    <tr>
        <th><center>SERIAL</center></th>
        <th width="18%">
            <center>
                <a  data-idd="<?php echo $id;?>"  data-toggle="modal" class="btn btn-nuevo_ser btn-xs btn-success" title="Nuevo"> <i class="btn-icon-only icon-plus"></i></a>

                <a href="php_etiquetas/plantilla_serial_compra.php?comt_id=<?php echo $comt_id; ?>" class="btn btn-xs btn-info" target="_blank" title="Imprimir Seriales" class="btn btn-info" ><i class="btn-icon-only icon-print"></i></a>
            </center> 
        </th>
    </tr>
    <?php
        $can1=mysqli_query($con,"SELECT * from  seriales_com_temp where  compra_detalle_temp_comt_id='$comt_id'") or die(mysqli_error($con)); 
        while ($roww=mysqli_fetch_array($can1))
            {
    ?>
    <tr>
        <td>  
           <center>
                <input type="hidden" name="comt_id" id="comt_id" value="<?php echo $roww['ser_codigo'];?>" class="form-control name_list"><?php echo $roww['ser_codigo'];?>          
            </center>
        </td>
        <td>
            <center>
                <a href="#" id="ser-<?php echo $roww["ser_id"];?>" title="Eliminar" class="btn btn-xs btn-danger"> <i class="btn-icon-only icon-remove"></i></a>
                <script>
                    $("#ser-"+<?php echo $roww["ser_id"];?>).click(function(e){
                    e.preventDefault();
                    p = confirm("Estas seguro de eliminar?");
                    if(p){
                    $.get("php_compras/eliminar_serial.php","ser_id="+<?php echo $roww["ser_id"];?>,
                    function(data){
                    loadserial();
                    });
                    }
                    });
                </script>

                 <input type="hidden" name="ser_codigo" id="ser_codigo" value="<?php echo $roww['ser_codigo'];?>" class="form-control name_list">
               
                <a href="php_etiquetas/plantilla_serial_compra.php?ser_codigo=<?php echo $roww['ser_codigo'];?>" class="btn btn-xs btn-info" target="_blank" title="Imprimir Serial" class="btn btn-info" ><i class="btn-icon-only icon-print"></i></a>
            </center>
        </td>
    </tr>
    <?php } ?>   
</table>   
<script>
    $(".btn-nuevo_ser").click(function(){
     id = $(this).data("idd");
      $.get("./php_compras/form_serial_nuevo.php","id="+id,function(data){
       $("#form-n_serial").html(data);
     });
      $('#n_serial').modal('show');
    });
</script>
     