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

<style type="text/css">
.table td, .table th {
    padding: .2rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}
</style>

<form action="" method="post" name="form1" id="form1">
    <input type="hidden" id="IdTransaccion" name="IdTransaccion" value="<?=$IdTransaccion?>">
    <input type="hidden" id="TipoBusqueda" name="TipoBusqueda" value="<?=$TipoBusqueda?>">

    <div class="form-row mx-0 mb-1">
        <div class="table-responsive">
            <table  class="table table-borderless border" style="margin-bottom: 0;">
                <tr>
                    <td  nowrap="nowrap" align="right" scope="row"><label for="NombreCompleto">Descripci&oacute;n :</label></td>
                    <td nowrap="nowrap" ><input type="text" class="form-control form-control-sm" name="NombreCompleto" id="NombreCompleto" onfocus="this.select();" autocomplete="off"></td>
                    <td  nowrap="nowrap" align="right" scope="row"><label for="IdPersona">Codigo :</label></td>
                    <td nowrap="nowrap"><input type="text" class="form-control form-control-sm" name="IdPersona" id="IdPersona" autocomplete="off"></td>
                    <td  nowrap="nowrap" align="right" scope="row"><label for="Nacionalidad">Nacionalidad :</label></td>
                    <td nowrap="nowrap">
                        <select class="form-control" name="Nacionalidad" id="Nacionalidad" onchange="findControl();">
                            <option value=""> - SELECCIONE - </option>
                            <?php foreach ( MST_PersonaMastBN::getArrayNacionalidad() as $s_Id => $s_Valor ) { ?>
                            <option value="<?=$s_Id?>" <?php if( $TipoOrdenCom=="L" && $s_Id == 1 ){ echo "SELECTED"; } if( $TipoOrdenCom=="I" && $s_Id == 2 ){ echo "SELECTED"; } ?> > <?=$s_Valor?> </option>
                            <?php } ?>
                        </select>
                    </td>
                </tr>
            </table>
        </div>
    </div>    
    
</form>

<?php include_partial( "provGrid" ); ?>

<script type="text/javascript">
$( "#NombreCompleto, #IdPersona" ).keyup
(
    function( e ) 
    {
        findControl();
    }
);
</script>

<script>
//ESCAPE, DETECTA EL F5, CTRL+F5
$( document ).bind
(
    'keyup', 
    function( e ) 
    {
        //console.log( e.which );
        if( e.which === 13 ) //+
        {
            findControl();
        }
        if( e.which === 27 ) //ESCAPE
        {
            $( "#NombreCompleto" ).focus();
        }
    }
);

$( "#NombreCompleto" ).focus();
</script>