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

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

        return false;
    }
</script>

<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>

<div id="content_alert" style=""></div>
<form id="form1" name="form1" method="POST" onsubmit="return ejecutarGuardar();"  enctype="multipart/form-data">
    <input type="hidden" name="tipoProc" id="tipoProc" value="<?=$s_TipoProc?>">

    <div id="content_alert" style=""></div>

    <div class="card mb-2" id="content_form">
        <div class="container">
            <div class="form-row mx-0">
                <div class="col-md-12 mb-1">
                    <label class="col-form-label" for="Descripcion">Descripci&oacute;n</label>
                    <input type="text" class="form-control" name="Descripcion" id="Descripcion" autocomplete="off" value=""  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" > ACTIVO </option>
                        <option value="I" > INACTIVO </option>
                    </select>
                </div>
            </div>
            <div class="form-group col-14">
                <div class="dropdown-divider"></div>
            </div>
        </div>
    </div>

    <div class="form-row mx-0">
        <div class="col-md-6 mb-1">
            <button type="button" class="btn btn-danger btn-lg btn-block" onclick="location.href='<?php echo buildUrl( 'talla/list' ) ?>'">CANCELAR</button>
        </div>
        <div class="col-md-6 mb-1">
            <button type="submit" class="btn btn-primary btn-lg btn-block" onclick="">GRABAR Y SALIR</button>
        </div>
    </div>
</form>

