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

<?php if($_SESSION['permisos']['agregar cotizacion']) {?>
    <a class="btn btn-primary mb-2" href="<?php echo base_url; ?>pedidos"><i class="fas fa-plus"></i></a>
<?php } ?>
<?php if($_SESSION['permisos']['cambiar tipo cotizacion']) {?>
    <button type="button" class="btn btn-primary mb-2 btn-toolbar-status btn-tipo" disabled onclick="btnType(active_row);" title='Cambiar Tipo'><i class="fa-solid fa-text-height"></i></button>
<?php } ?>
<?php if($_SESSION['permisos']['cambiar estado cotizacion']) {?>
    <button type="button" class="btn btn-warning mb-2 btn-toolbar-status btn-estatus" disabled onclick="btnStatus(active_row);" title='Cambiar Estado'><i class="fa-solid fa-clipboard-list"></i></button>
<?php } ?>
<?php if($_SESSION['permisos']['ver PDF 1']) {?>
    <button type='button' class="btn btn-outline-danger mb-2 btn-toolbar-status" disabled onclick="open_link(base_url +'pedidos/generarPedidoPdf/'+active_row)"><i class="fas fa-file-pdf"></i></button>
<?php } ?>
<?php if($_SESSION['permisos']['ver PDF 2']) {?>
    <button type='button' class="btn btn-outline-success mb-2 btn-toolbar-status" disabled onclick="open_link(base_url +'pedidos/generarPedidoPdf/'+active_row+'/NC')"><i class="far fa-file-pdf"></i></button>
<?php } ?>
<?php if($_SESSION['permisos']['crm del cliente cotizacion']) {?>
    <button type='button' class="btn btn-warning mb-2 btn-toolbar-status" disabled onclick="open_link(base_url +'pedidos/generarCrmCliente/'+active_row)"><i class="fas fa-chart-pie"></i></button>
<?php } ?>
<!-- <button type='button' class="btn btn-primary mb-2" onclick="open_link(base_url +'pedidos')"><i class="fas fa-plus"></i></button> -->

<!-- ESTADO PAGADO Y PENDIENTE -->
<!-- <button type="button" class="btn btn-success mb-2 btn-toolbar-status btn-autorizar" disabled onclick="btnFacturarFel(active_row);" style='display:none;'><i class="fas fa-file-invoice-dollar"></i></button> -->

<div class="card">
    <div class="card-body">
        <div class="row">
            <div class="col-md-2">
                <label for="">Desde</label>
                <input class="form-control" id="min" type="date" name="venta_desde">
            </div>
            <div class="col-md-2">
                <label for="">Hasta</label>
                <input class="form-control" id="max" type="date" name="venta_hasta">
            </div>
            <div class="col-md-3">
                <label for="estados">Estado</label>                
                <select class="form-control" id="estados" name="estados">
                    <option selected value=''>Selecciona una opción</option>
                    <option value="P">PENDIENTE</option>
                    <option value="E">EMITIDO</option>
                    <option value="A">AUTORIZADO</option>
                    <option value="I">IMPRESO</option>
                    <option value="F">FACTURADO</option>
                    <option value="D">DESPACHADO</option>
                    <option value="R">RETENIDO</option>
                    <option value="X">ANULADO</option>                    
                </select>
            </div>

            <div class="col-md-3">
                <label for="tipo">Tipo</label>                
                <select class="form-control" id="tipo" name="tipo">
                    <option selected value=''>Selecciona una opción</option>
                    <option value="P">PEDIDO</option>
                    <option value="C">COMPLEMENTO</option>
                    <option value="R">RAPIDITO</option>
                </select>
            </div>            

            <div class="col-md-2">
                <div class="form-group">
                    <label for="my-input">Registros</label><br>
                    <button class="btn btn-outline-primary btn-block" type="button" name="historial_ventas" onclick="limpiar_busqueda()">Mostrar Todo</button>
                </div>
            </div>
        </div>
        <div class="table-responsive">
            <table class="table table-striped table-hover display responsive nowrap" id="t_ventas" style="width: 100%;">
                <thead>
                    <tr>
                        <th>Cotizacion</th>
                        <th>Cliente</th>
                        <th>Nombre</th>
                        <th>Fecha</th>
                        <th>Total</th>
                        <th>Tipo</th>
                        <th>Estado</th>
                        <th>Vendedor</th>
                        <th>Facturado</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>
    </div>
</div>

<?php include "Views/templates/footer.php"; ?>