<html>
 
<!--Modal para Editar--->
<div class="modal fade" id="editar<?php echo $producto['Cod']; ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"
  data-bs-backdrop="static" data-bs-keyboard="false">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-5" id="exampleModalLabel">Editar Producto</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">


     <form method="POST" action="./controladores/Producto/edit_producto.php" enctype="multipart/form-data">
         <div class="form-group">
         	<label for="recipient-name" class="col-form-label">Cod_Producto</label>
         	<input type="" name="codigo" class="form-control" value="<?php echo $producto['Cod']; ?>" readonly onmousedown="return false;">
         </div>

                <div class="form-group">
                  <label for="recipient-name" class="col-form-label">Nombre</label>
                  <input type="text" name="nombre" class="form-control" value="<?php echo $producto['Nombre']; ?>" required="true">
                </div>

                <div class="form-group">
                  <label for="recipient-name" class="col-form-label">Descripcion</label>
                  <input type="text" name="descripcion" class="form-control" value="<?php echo $producto['Descripcion']; ?>" required="true">
                </div>

                <div class="form-group">
                  <label for="recipient-name" class="col-form-label">Imagen</label>
                  <input type="file" name="foto" id="foto" class="form-control"  required="true">
                </div>

                <div class="form-group">
                  <label for="recipient-name" class="col-form-label">Precio Compra</label>
                  <input type="number" min="0.0"  step="0.01" pattern="\d+(\.\d{1,2})?" name="precioc" class="form-control" value="<?php echo $producto['Precio_Compra']; ?>" required="true">
                </div>

                <div class="form-group">
                  <label for="recipient-name" class="col-form-label">Precio Venta</label>
                  <input type="number" min="0.0"  step="0.01" pattern="\d+(\.\d{1,2})?" name="preciov" class="form-control" value="<?php echo $producto['Precio_Venta']; ?>" required="true">
                </div>

                <div class="form-group">
                       <label for="recipient-name" class="col-form-label">Categoria</label>
                            <select class="form-select" aria-label="Default select example" name="Categoria" id="Categoria" required>
                                  <?php
                                     include '../../Clases/db.php';
                                        $conn= new conn();
                                        $conex= $conn->crearconn();
                                        $consulta = "SELECT * FROM categoria where Estado = 1";
                                        $ejecutar=mysqli_query($conex,$consulta) or die (mysqli_error($conex)); 
                                  ?>
                                    
                                    <option></option>
                                  <?php  foreach($ejecutar as $opciones){  ?>
                      
                                     <option value="<?php echo $opciones['ID'] ?>" ><?php echo $opciones['Nombre'] ?></option>
                                  <?php } ?>
                             </select>
                </div>

               <div class="form-group">
                       <label for="recipient-name" class="col-form-label">Proveedor</label>
                            <select class="form-select" aria-label="Default select example" name="Proveedor" id="Proveedor" required>
                                  <?php
                                     include '../../Clases/db.php';
                                        $conn= new conn();
                                        $conex= $conn->crearconn();
                                        $consulta = "SELECT prov.ID,prov.CI_Datos as CI, d.Nombre as Nombre_proveedor, d.Cedula as Cedula_proveedor  FROM proveedores prov 
                                        INNER JOIN datos_personales d on prov.CI_Datos = d.Cedula where Estado = 1";
                                        $ejecutar=mysqli_query($conex,$consulta) or die (mysqli_error($conex)); 
                                  ?>
                                     
                                     <option></option>
                                  <?php  foreach($ejecutar as $opciones){  ?>
                      
                                     <option value="<?php echo $opciones['ID'] ?>" ><?php echo $opciones['CI'] ?>/<?php echo $opciones['Nombre_proveedor'] ?></option>
                                  <?php } ?>
                             </select>
              </div>
     
            <div class="modal-footer">
                   <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cerrar</button>
                   <button type="submit" class="btn btn-primary">Guardar</button>
            </div>
          </form>  
        </div>
    </div>
  </div>
</div>


<div class="modal fade" id="eliminar<?php echo $producto['Cod']; ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"
  data-bs-backdrop="static" data-bs-keyboard="false">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">
                ¿Realmente deseas eliminar este producto ?
            </h4>
      </div>
      <div class="modal-body">
        <form method="POST" action="./controladores/Producto/delet_producto.php">
      <input type="hidden" name="cod" value="<?php echo $producto['Cod']; ?>">
           <strong style="text-align: center !important"> 
            <?php echo $producto['Cod']; ?>
        
           </strong>

   
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        
        <button type="submit" id="btnel" class="btn btn-danger botonborrar" data-bs-dismiss="modal" >
        Borrar</button>
      </div>
      </form>
     </div>
    </div>
  </div>
</div>




<div tabindex="-1" arial-labelledby="modalImage" aria-hidden="true" class="modal fade" id="modalImage<?php echo $producto['Cod']; ?>">
  <div class="modal-dialog  modal-dialog-centered">
    <div class="modal-content">
      <img class="img-thumbnail" src="../Imagenes/<?php echo $producto['Imagen']; ?>">
    </div>
  </div>
</div>

<script src="../ArchivosJS/jquery-3.6.0.min.js"></script> 
   
  
</html>