<?php
session_start();
include "../conexion.php";
$venad_id=$_GET['venad_id']; 
$id=$_GET['venad_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;?>" class="btn btn-ser_n 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_apartados where venad_id='$venad_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['sear_codigo'];?>" class="form-control name_list"><?php echo $roww['sear_codigo'];?></center>
        </td>
        <td>
            <a href="#" id="ser-<?php echo $roww["seap_id"];?>" title="Eliminar" class="btn btn-xs btn-danger"> <i class="btn-icon-only icon-remove"></i></a>
            <script>
                $("#ser-"+<?php echo $roww["seap_id"];?>).click(function(e){
                  e.preventDefault();
                  p = confirm("Estas seguro de eliminar?");
                  if(p){
                    $.get("php_apartados/eliminar_serial.php","seap_id="+<?php echo $roww["seap_id"];?>,
                      function(data){
                      loadserial();
                    });
                  }
                });
            </script>
        </td>
    </tr>
    <?php  }  ?>   
</table>

<script>
$(".btn-ser_n").click(function(){
  id = $(this).data("id");
  $.get("./php_apartados/form_seriales_nuevo.php","id="+id,function(data){
    $("#form-ser_n").html(data);
  });
  $('#serModal_n').modal('show');
});
</script>
