<?php
session_start();
include "../conexion.php";
$id=$_GET['art_id'];  
?>

<table class="table table-striped table-bordered" style="font-size: 9pt;">
    <tr>
        <th><center>SERIAL</center></th>
        <th width="5%"><a  data-id="<?php echo $id;?>" data-toggle="modal" class="btn btn-serial_nuevo btn-xs btn-success" title="Serial"> <i class="btn-icon-only icon-plus"></i></a></th>
    </tr>
    <?php
        $can1=mysqli_query($con,"SELECT * from seriales_articulos where articulos_art_id='$id' and estado='sin vender' ") or die(mysqli_error($con)); 
        while ($roww=mysqli_fetch_array($can1))
        {
    ?>
    <tr>
        <td>  
            <input type="hidden" name="comt_id" id="comt_id" value="<?php echo $roww['se_codigo'];?>" class="form-control name_list"><center><?php echo $roww['se_codigo'];?>  </center>        
        </td>
        <td>
            <a href="#" id="ser-<?php echo $roww["se_id"];?>" title="Eliminar" class="btn btn-xs btn-danger"> <i class="btn-icon-only icon-remove"></i></a>
            <script>
                $("#ser-"+<?php echo $roww["se_id"];?>).click(function(e){
                    e.preventDefault();
                    p = confirm("Estas seguro de eliminar?");
                    if(p){
                        $.get("php_articulo/eliminar_serial.php","se_id="+<?php echo $roww["se_id"];?>,
                        function(data){
                        loadserial();
                        });
                    }
                });
            </script>
        </td>
    </tr>
    <?php } ?>   
</table> 
<script type="text/javascript">  
$(".btn-serial_nuevo").click(function(){
        id = $(this).data("id");
        $.get("./php_articulo/form_nuevo_serial.php","id="+id,function(data){
            $("#form-serial_nuevo").html(data);
        });
        $('#modal_serial_nuevo').modal('show');
    });
</script>