<!-- Vista: app/Views/ventas_view.php -->
<!DOCTYPE html>

<div class="conatiner-fluid content-inner pb-0">
        <div class="row">
            <div class="row">
              <div class="col-sm-12">
                 <div class="card">
                     <div class="card-header d-flex justify-content-between">
                       <div class="header-title">
    <h2 class="mb-4">Ventas por Cliente</h2>
    </div></div>
    <div class="card-body">
    <div class="filter-container mb-4">
    <form method="GET" action="<?= site_url('reporteVentasCliente') ?>" class="mb-4">
        <div class="row">
            <div class="col-md-4">
                <label class="form-label">Producto:</label>
                <select name="cliente_id" class="form-select">
                    <option>SELECCIONAR</option>
                    <?php foreach ($clientes as $cliente): ?>
                        <option value="<?= $cliente['Cli_Id'] ?>"><?= $cliente['Cli_Nombre'] ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
            
            <div class="col-md-2 d-flex align-items-end">
                <button type="submit" class="btn btn-primary w-100">Filtrar</button>
            </div>
        </div>
    </form>
    </div>
   <div class="table-responsive">
    <table class="table table-striped table-bordered">
        <thead class="">
            <tr>
                <th>ID Venta</th>
                <th>Fecha</th>
                <th>Cliente</th>
                <th>Producto</th>
                <th>Cantidad</th>
                <th>Precio Unitario</th>
                <th>Total</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($ventas as $venta): ?>
                <tr>
                    <td><?= $venta['Ven_Id'] ?></td>
                    <td><?= $venta['Ven_FechaVenta'] ?></td>
                    <td><?= $venta['Cli_Nombre'] ?></td>
                    <td><?= $venta['Pro_Nombre'] ?></td>
                    <td><?= $venta['Ved_Cantidad'] ?></td>
                    <td><?= $venta['Ved_ValorUnitario'] ?></td>
                    <td><?= $venta['Ved_ValorUnitario']*$venta['Ved_Cantidad']; ?></td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table></div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</div></div></div></div></div></div>

<style>
        .filter-container {
            border: 1px solid #dee2e6;
            border-radius: 10px;
            padding: 20px;
            background-color: #f8f9fa;
        }
    </style>
