<?php 
session_start();
require_once ("../conexion.php");
require_once('../include/sesiones.php'); 
$cotd_id=$_GET['cotd_id']; 
?>
<input type="hidden" name="cotd_id" id="cotd_id" value="<?php echo $cotd_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 cotizacion_detalle_lote WHERE cotd_id_detalle='$cotd_id'") or die(mysqli_error($con));  
while($dat3=mysqli_fetch_array($can3))
{
    $cotl_id=$dat3['cotl_id'];
    $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 $cotl_id; ?>" class="btn btn-xs btn-danger"> <i class="btn-icon-only icon-remove"></i></a>
        </td>
        <script>
            $("#del_lote-"+<?php echo $cotl_id; ?>).click(function(e){
            e.preventDefault();
            p = confirm("Desea eliminar el Lote?");
            if(p){
                $.get("./php_cotizaciones/z_eliminar_lote.php","cotl_id="+<?php echo $cotl_id; ?>,function(data){
                loadTablalotes();
                //loadTabla();
                });
            }
          });
        </script>
    </tr>
     <?php  }  ?> 
</table>

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

</script>

