<?php use_helper( 'UrlFunctions' ); ?>
<?php use_helper( 'UtilFunctions' ); ?>
<?php use_helper( 'IncludePartial' ); ?>

<div class="shadow-sm p-3 mb-2 bg-white rounded card card-body">
    <div class="row">
        <div class="col mb-1">
            <h4 class="text-info text-nowrap mb-0">Lista de Ordenes de Compra</h4>
        </div>
        <div class="col mb-1 text-right">
        	<button type="button" class="btn btn-primary" onclick="location.href='<?=buildUrl( "oc/addedit", "s_TipoProc=nvo" )?>';" title="Nueva Orden de Compra">Nuevo</button>
        </div>
    </div>
</div>

<?php
include_partial
(
    "list",
    array
    (
        "a_EstadosOC"           => $a_EstadosOC,
        "a_OrdenClasificacion"  => COM_OrdenItemClasificacionFN::selectActivos( "CA00001" ), //COM_OrdenItemClasificacionFN::selectActivos(), //COM_OrdenItemClasificacionFN::selectActivos(),
        "a_TipoOrdenCompra"     => COM_OrdenCompraCabeceraBN::getArrayTipoOrdenCompra()
    ),
    array( "Module" => "oc" )
);
?>

<script type="text/javascript">
    //$( "#Estado option[value='']" ).remove();
    //$( "#TipoOrden option[value='']" ).remove();
    $( "#IdOrdenClasificacion option[value='']" ).remove();
</script>

<?php include_partial( "grid", array( "edit"=>true, "view"=>true, "delete"=>true, "roladmin" => true ) ); ?>

<script>
$( document ).bind
(
    'keyup', 
    function( e ) 
    {
        if( e.which === 13 ) //ENTER
        {
            findControl();
        }
        if( e.which == 107 || e.which == 27 || e.which == 109 ) //tecla + | ESC | -
        {
            $( "#cotent_a_collapse" ).trigger( "click" );
        }
    }
);
</script>