<?php include "views/templates/header.php";?>



<div class="container">
    <div class="card">
        <div class="card-header bg-primary text-white">
            <h4>NUEVA COMPRA</h4>
        </div>
        <div class="card-body">
            <form id="frmCompra">
                <div class="row">
                    <div class="col-md-3">
                        <div class="form-group">
                            <label for="codigo"><i class="fa-solid fa-barcode" style="color: #0056eb;"></i>     CODIGO O PRODUCTO</label>
                            <input type="hidden" id="id" name="id">
                            <input id="codigo" class="form-control" type="text" name="codigo" placeholder="CODIGO DE BARRAS" onkeyup="buscarCodigo(event)">
                        </div>
                    </div>

                    <div class="col-md-3">
                        <div class="form-group">
                            <label for="nombre"><i class="fa-solid fa-pen-to-square" style="color: #005eff;"></i>         DESCRIPCION</label>
                            <input id="nombre" class="form-control" type="text" name="nombre" placeholder="DESCRIPCION" disabled>
                        </div>
                    </div>
                    <div class="col-md-2">
                        <div class="form-group">
                            <label for="cantidad"><i class="fa-solid fa-layer-group" style="color: #005eff;"></i>   CANTIDAD</label>
                            <input id="cantidad" class="form-control" type="number" name="cantidad" placeholder="0" onkeyup="calcularPrecio(event)" disabled>
                        </div>
                    </div>
                    <div class="col-md-2">
                        <div class="form-group">
                            <label for="precio">PRECIO</label>
                            <input id="precio" class="form-control" type="text" name="precio" placeholder="S/ 00.00" disabled>
                        </div>
                    </div>
                    <div class="col-md-2">
                        <div class="form-group">
                            <label for="sub_total">SUBTOTAL</label>
                            <input id="sub_total" class="form-control" type="text" name="sub_total" placeholder="S/ 00.00" disabled>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <table class="table table-striped">
        <thead class="thead-dark">
            <tr>
                <th>ID</th>
                <th>DESCRIPCION</th>
                <th>CANTIDAD</th>
                <th>PRECIO</th>
                <th>SUBTOTAL</th>
                <th></th>
            </tr>
        </thead>
        <tbody id="tblDetalle">
          
        </tbody>
    </table>

    <div class="row">
        <div class="col-md-3  ml-auto">
            <div class="form-group">
                <label for="total">TOTAL</label>
                <input id="total" class="form-control" type="text" name="total" placeholder="TOTAL S/ 00.00" disabled>
                <div class="col-md-12"></div>
            <button class="btn btn-primary mt-2" type="button" style="width: 100%;" onclick="procesar(1)">GENERAR COMPRA</button>
        </div>
            
        </div>
    </div>
</div>
<script src="config/config.php"></script>
<?php include "views/templates/footer.php"; ?>
