<script>
mostrarCargaImg = function(){ $('#s_ImagenLoad')[0].style.display = 'inline'; }
ocultarCargaImg = function(){ $('#s_ImagenLoad')[0].style.display = 'none'; }

mostrarMensajeError = function( s_MensajeError )
{
    $( "#resultContent" ).html( '<div id="mensaje_error_content" class="error">' + s_MensajeError + '</div>' );
    setTimeout( function(){ $( "#mensaje_error_content" ).fadeOut( 800 ).fadeIn( 800 ).fadeOut( 500 ).fadeIn( 500 ).fadeOut( 300 ); }, 4000 );
}
</script>
<script>
ejecutarGuardar = function()
{
	x = confirm( "Esta seguro de grabar el formulario?" );
    if( x )
    {
        blockContent( 'content_buttons' );
    	var strFormSerialize = $( 'form' ).serialize();
        executeAjaxJson
        ( 
            "<?php echo buildUrl( 'linea/saveAddEdit' ) ?>", 
            strFormSerialize,
            function( o_json )
            {
                unBlockContent( 'content_buttons' );
                
                if( o_json.error )
                {
                    mostrarMensajeError( o_json.mensaje_error );
                    return false;
                }
                
                location.href = "<?=buildUrl( 'linea/list' )?>";
            } 
        );
    }
}
</script>
<?php if( $o_MST_ClaseLineaBN->getIdLinea() ){ $s_Disabled = "disabled"; }else{ $s_Disabled = ""; } ?>
<input type="hidden" name="i_Id" id="i_Id" value="<?=$o_MST_ClaseLineaBN->getIdLinea()?>">
<div id="resultContent" style=""></div>



<div class="card">
    <div class="container">
            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="Descripcion">Descripcion</label>
                    <input type="text" class="form-control" name="Descripcion" id="Descripcion" placeholder="" value="<?=$o_MST_ClaseLineaBN->getDescripcion();?>" onblur="this.value=this.value.toUpperCase();" required>
                </div>
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="Codigo">C&oacute;digo</label>
                    <input type="text" class="form-control" disabled="" name="Codigo" id="Codigo" placeholder="" value="" onblur="this.value=this.value.toUpperCase();" required>
                </div>
            </div>
            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="Estado">Estado</label>
                    <select class="form-control form-control-sm custom-select my-0 mr-sm-2" name="Estado" id="Estado" required>
                        <option value=""> - Seleccione - </option>
                        <option value="A" <?php if( $o_MST_ClaseLineaBN->getEstado()=="A" ){ echo "SELECTED"; } ?>> ACTIVO </option>
                        <option value="I" <?php if( $o_MST_ClaseLineaBN->getEstado()=="I" ){ echo "SELECTED"; } ?>> INACTIVO </option>
                    </select>
                </div>
            </div>
            	<?php if( $o_MST_ClaseLineaBN->getIdLinea() ){ ?>
            	<br>
            	<button type="button" class="btn btn-primary btn-lg btn-block" id="btnAudi">Auditoria</button>
                	<script>
                        $( "#btnAudi" )
                        .click
                        (
                            function()
                            {
                                $( '#myIframe' ).attr( 'src', '<?=buildUrl( 'linea/audi', 'block=001&i_Id='.$o_MST_ClaseLineaBN->getIdLinea() )?>' );
                                $( '#dialog' ).dialog( 'open' );
                            }
                        )
                    </script>
                <br>
                <?php } ?>
            
            
            <div class="form-group col-14"><hr style="border-top: 1px solid #8c8b8b;"></div>
        
    </div>
</div>

                                                    
<div id="dialog"><iframe id="myIframe" src="" frameborder="0" height="100%" width="100%"></iframe></div>
<script>
    objMainTab.modalUIDialog( "#dialog", { title : "Auditoria", width : 425, height  : 230 } );
</script>
                                                    
<script>
$.validator.setDefaults
(
    {
        submitHandler: function( form ) 
        {
            ejecutarGuardar();
        }
    }
);
$( "#form1" ).validate();
</script>