<?php use_helper('UrlFunctions'); ?>
<?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"><?=$s_Titulo?></h4>
        </div>
    </div>
</div>

<script>
ejecutarGuardar = function()
{
    x = confirm( "Esta seguro de grabar el formulario?" );
    if( x )
    {
        blockContent( 'content_buttons' );
        var strFormSerialize = $( 'form' ).serialize();
        executeAjaxJson
        ( 
            "<?php echo buildUrl( 'marca/saveAddEdit' ) ?>", 
            strFormSerialize,
            function( o_json )
            {
                unBlockContent( 'content_buttons' );
                if( o_json.error )
                {
                	showAlertBootStrap( 'content_alert', 'alert-danger', o_json.mensaje_error );
                    return false;
                }
                location.href = "<?=buildUrl( 'marca/list', "")?>";
            } 
        );
    }
    return false;
}
</script>

<form id="form1" name="form1" method="POST" onsubmit="return ejecutarGuardar();"  enctype="multipart/form-data">
    <input type="hidden" name="s_TipoProc" id="s_TipoProc" value="<?=$s_TipoProc?>">
    <input type="hidden" name="TypeSub" id="TypeSub" value="0">
    <input type="hidden" name="i_Id" id="i_Id" value="<?=$i_Id?>">
    
    <?php 
    include_partial
    ( 
        "addedit", 
        array( 
            "o_ALM_MarcaBN" => $o_ALM_MarcaBN
        )
    );
    ?>
                                                             
         <div class="form-row mx-0" id="content_buttons">
            <div class="col-md-6 mb-1">
                <button type="button" class="btn btn-danger btn-lg btn-block" onclick="location.href='<?php echo buildUrl( 'marca/list' ) ?>'">CANCELAR</button>
            </div>
            <div class="col-md-6 mb-1">
                <button type="submit" class="btn btn-primary btn-lg btn-block" onclick="$( '#TypeSub' ).val( '1' );">GRABAR Y SALIR</button>
            </div>
		 </div>
                   
</form>

