<?php
session_start();
include "../conexion.php";
$ordt_id=$_GET['ordt_id']; 
$id=$_GET['ordt_id']; 
?>
<table class="table table-striped table-bordered" style="font-size: 9pt;">
    <tr>
        <th><center>SERIAL</center></th>
        <th width="5%"> 
            <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>
        </th>
    </tr>
    <?php
        $can1=mysqli_query($con,"SELECT * from orden_detalle_seriales where ordt_id='$ordt_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>
            <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 el Serial?");
                  if(p){
                    $.get("php_orden_de_servicios/z_eliminar_serial.php","ser_id="+<?php echo $roww["ser_id"];?>,
                      function(data){
                      loadserial();
                    });
                  }
                });
            </script>
        </td>
    </tr>
    <?php } ?>   
</table>

<script>
    $(".btn-nuevo_ser").click(function(){
     id = $(this).data("idd");
      $.get("./php_orden_de_servicios/z_form_serial_nuevo.php","id="+id,function(data){
       $("#form-n_serial").html(data);
     });
      $('#n_serial').modal('show');
    });
 </script> 