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

<?php
/** @var MST_PersonaMastBN[] $a_MST_PersonaMast */
?>

<script>
    ejecutarGuardar = function()
    {
        x = confirm( "Esta seguro de continuar con los cambios?" )
        if( x )
        {
            blockContent('form1');
            var strFormSerialize = $('form').serialize();
            executeAjaxJson
            (
                "<?php echo buildUrl( 'prodref/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( 'prodref/edit', 'id=' )?>" + o_json.id;
                }
            );
        }
        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="IdProveedor">Proveedor</label>
                    <select class="form-control form-control-sm custom-select my-0 mr-sm-2" name="IdProveedor" id="IdProveedor" required>
                        <option value=""> - Seleccione - </option>
                        <?php foreach ( $a_MST_PersonaMast as $o_MST_PersonaMastBN ){ ?>
                            <option value="<?=$o_MST_PersonaMastBN->getIdPersona()?>"> <?=$o_MST_PersonaMastBN->getNombreCompleto()?> </option>
                        <?php } ?>
                    </select>
                </div>
            </div>
            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="Codigo">Codigo</label>
                    <input type="text" class="form-control" name="Codigo" id="Codigo" autocomplete="off" value="" DISABLED >
                </div>
            </div>
            <div class="form-row mx-0">
                <div class="col-md-12 mb-1">
                    <label class="col-form-label" for="Descripcion">Codigo de Zapatilla</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</label>
                    <input type="text" class="form-control" name="" id="" autocomplete="off" value="" DISABLED >
                </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( 'prodref/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 CONTINUAR</button>
        </div>
    </div>
</form>