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

<ul class="nav nav-tabs m-1" id="myTab" role="tablist" style="margin-bottom: 0px !important;">
    <li class="nav-item">
        <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="false">General</a>
    </li>
    <?php if( $o_DefaultBN->getIdConcat() ){ ?>
    <li class="nav-item">
        <a class="nav-link " id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="true">Detalle</a>
    </li>
    <?php } ?>
</ul>

<div class="tab-content card" id="myTabContent">
    <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
        
<form id="form1" name="form1" method="POST" onsubmit="return false;"  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">

    <?php 
    include_partial
    (
        "addedit", 
        array
        ( 
            "o_DefaultBN"       => $o_DefaultBN,
            "a_GSS_Compania"    => $a_GSS_Compania,
            "a_GSS_Sucursal"    => $a_GSS_Sucursal,
            "a_ALM_AlmacenMast" => $a_ALM_AlmacenMast,
            "a_MST_PersonaMast" => $a_MST_PersonaMast,
        )
    ); 
    ?>

	<div class="form-row mx-0">
        <div class="col-md-6 mb-1">
            <button type="button" class="btn btn-primary btn-lg btn-block" onclick="location.href='<?php echo buildUrl( 'stockrep/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 SIGUIENTE</button>
        </div>
	</div>
    <div id="s_ImagenLoad" style="display: none;"><img src="<?php echo Constantes::ROOT_DIR_APP ?>web/images/progress.gif" border="0"/>&nbsp;<label class="laber req">Grabando...</label></div>

</form>
        
        
    </div>
    
    <div class="dropdown-divider" style="border-top: 1px solid #8c8b8b;"></div>
    
</div>

<script type="text/javascript">
$( '#myTab a' ).on
(
    'click', function ( e ) 
    {
        pr( e.target.id );

        if( e.target.id == "profile-tab" )
        {
        	location.href='<?=buildUrl( 'stockrep/detail', "s_TipoProc=$s_TipoProc&i_Id=".$i_Id )?>';
        }
        
        e.preventDefault()
        $( this ).tab( 'show' )
    }
) 
</script>

