<?php 
session_start();
require_once ("../conexion.php");
require_once('../include/sesiones.php'); 
$vent_id=$_GET['vent_id']; 
?>
<input type="hidden" name="vent_id" id="vent_id" value="<?php echo $vent_id; ?>">
<table class="table-responsive col-md-12" >
    <tr>
        <th width="59%"><strong>LOTE</strong></th>
        <th width="20%"><strong>CANTIDAD</strong></th>
        <th width="1%"> 
            <button type="button" class="btn btn-lote btn-success btn-xs" data-toggle="modal" ><i class="btn-icon-only icon-plus"></i></i></button>
        </th>
    </tr>

<?php 
$can3=mysqli_query($con,"SELECT * FROM venta_detalle_temp_lote WHERE vetl_id_detalle_temp='$vent_id'") or die(mysqli_error($con));  
while($dat3=mysqli_fetch_array($can3))
{
    $vetl=$dat3['vetl'];
    $kar_id=$dat3['kar_id'];
    $kar_lote=$dat3['kar_lote'];
    $kar_cantidad=$dat3['kar_cantidad']; 
?>
    <tr>
        <td><input type="text" class="form-control input-sm" name="kar_lote" id="kar_lote" value="<?php echo $kar_lote; ?>" disabled></td>
        <td>
            <input type="number" class="form-control input-sm" name="kar_cantidad" value="<?php echo $kar_cantidad; ?>" disabled> 
        </td>
        <td>
            <a href="#" id="del_lote-<?php echo $vetl; ?>" class="btn btn-xs btn-danger"> <i class="btn-icon-only icon-remove"></i></a>
        </td>
        <script>
            $("#del_lote-"+<?php echo $vetl; ?>).click(function(e){
            e.preventDefault();
            p = confirm("Desea eliminar el Lote?");
            if(p){
                $.get("./php_facturar/eliminar_lote.php","vetl="+<?php echo $vetl; ?>,function(data){
                loadTablalotes();
                //loadTabla();
                });
            }
          });
        </script>
    </tr>
     <?php  }  ?> 
</table>

<script>
$(".btn-lote").click(function(){
    var vent_id=$("#vent_id").val();
    $.get("./php_facturar/form_agregar_lote.php?vent_id="+vent_id,function(data){
    $("#lotes").html(data);
  });
  $('#modal_agregar_lote').modal('show');
});

</script>

