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

<style type="text/css">
/*
#example_wrapper .row
{
    margin-right: 0;
    margin-left: 0;
}
table.dataTable tbody tr:hover 
{
   background-color: #DAE6FE !important;;
}
*/
.table td, .table th 
{
    /*padding: 8px;*/
    font-size: 13px;
    vertical-align: middle;
}
th { white-space: nowrap; }
</style>

<style type="text/css">
.buttonpr.micro 
{
    margin: 0 0 0.5rem 0;
    padding: 0.25em 0.25rem;
    font-size: 0.6rem;
    font-weight: bold;
    line-height: 1;
    color: #ffffff; 
}

.buttonpr.success 
{
    background-color: #619518;
    /*color: #0a0a0a;*/
}

.buttonpr.alert 
{
    background-color: #BE3047;
    /*color: #fefefe;*/
}

.buttonpr 
{
    display: inherit;
    vertical-align: middle;
    margin: 0 0 1rem 0;
    font-family: inherit;
    padding: 0.85em 1em;
    -webkit-appearance: none;
    border: 1px solid transparent;
    border-radius: 14px;
    transition: background-color 0.25s ease-out, color 0.25s ease-out;
    font-size: 0.9rem;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    background-color: #0078EB;
    color: #fefefe;
}
</style>


<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">Detalle Devoluci&oacute;n - Transacciones</h4>
        </div>
    </div>
</div>

<div class="marco">
    <div class="table-responsive">
        <table class="table table-borderless" style="margin-bottom: 0px; line-height: 0.5; padding: .50rem; ">
            <tbody>
                <tr>
                    <th class="text-nowrap" scope="row">Devoluci&oacute;n:</th>
                    <td class="text-nowrap" style="color: #fc6d00;"><?=str_pad( $o_SR_DevolucionCabeceraBN->getDevolucionCabId(), 10, "0", STR_PAD_LEFT )?></td>
                    <th class="text-nowrap" scope="row"><?=$o_VTA_PrsProyectosBN->getClienteTipoDocu()?>:</th>
                    <td class="text-nowrap"><?=$o_VTA_PrsProyectosBN->getClienteNroDocu()?></td>
                    <th class="text-nowrap" scope="row">Cliente:</th>
                    <td class="text-nowrap" ><?=$o_VTA_PrsProyectosBN->getClienteNombre();?></td>
                    <th class="text-nowrap" scope="row">Estado:</th>
                    <td class="text-nowrap" ><?=$o_SR_DevolucionCabeceraBN->getEstadoDesc()?></td> 
                </tr>
                <tr>
                    <th class="text-nowrap" scope="row">&nbsp;</th>
                    <td class="text-nowrap" style="color: #fc6d00;" >&nbsp;</td>
                    <th class="text-nowrap" scope="row">&nbsp;</th>
                    <td class="text-nowrap" >&nbsp;</td>
                    <th class="text-nowrap" scope="row">Fecha Inicio Alq:</th>
                    <td class="text-nowrap" ><?=$o_SR_DevolucionCabeceraBN->getFechaInicioAlq()?></td>
                    <th class="text-nowrap" scope="row">Fecha Devolucion:</th>
                    <td class="text-nowrap" ><?=$o_SR_DevolucionCabeceraBN->getFechaDevolucion()?></td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

<div class="dropdown-divider"></div>

<form id="form1" name="form1" method="POST" onsubmit=""  enctype="multipart/form-data">
    <input type="hidden" name="Control" id="Control" value="1"/>
    
    <div class="table-responsive">
        <!-- <table class="table table-striped table-bordered" style="width:100%" id="example" > -->
        <table class="table table-sm table-bordered table-hover" id="example">
            <thead id="">
                <tr class="table-primary">
                    <th width="1%"  align="center" ><b>No</b></th>
                    <th width="20%" align="center"  ><b>Estado</b></th>
                    <th width="20%" align="center"  ><b>Almacen Origen</b></th>
                    <th width="10%" align="center" ><b>Almacen Destino</b></th>
                    <th width="5%" align="center" >&nbsp;</th>
                </tr>
            </thead>
            
            <tbody id="content_all_row">
                <?php $f_MontoTotal = 0.00 ?>
                <?php foreach ( $o_SR_DevolucionCabeceraBN->getArrayTransacciones() as $i_Key => $o_SR_DevolucionTransaccionBN ){ ?>
                    <?php
                    $s_ConcatIdTrx = $o_SR_DevolucionTransaccionBN->getIdCompania()."_".$o_SR_DevolucionTransaccionBN->getIdTipoDocumento()."_".$o_SR_DevolucionTransaccionBN->getIdNumeroDocumento();
                    ?>
                <tr class="content_row">
                    <td align="center"><?=( $i_Key + 1 )?></td>
                    <td align="left"><?=$o_SR_DevolucionTransaccionBN->getEstadoDevolucionDesc()?></td>
                    <td align="center"><?=$o_SR_DevolucionTransaccionBN->getAlmacenOrigenDesc()?></td>
                    <td align="center"><?=$o_SR_DevolucionTransaccionBN->getAlmacenDestinoDesc()?></td>
                    <td align="center"> 
                        <label class='buttonpr micro' onclick="redirectFunction('<?= buildUrlComplet( "alm.php/transacciones/viewdel", "s_TipoProc=shw&i_Id=".$s_ConcatIdTrx )?>')">TRX</label>
                    </td>
                </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
</form>
<script type="text/javascript">
redirectFunction = function( link )
{
    window.open( link, "_BLANK" )
}

anularGuiaRemision = function( id )
{
    x = confirm( "Esta seguro de Anular la Guia seleccionada?" );
    if( x )
    {
        $( "#TipoProceso" ).val( "anular" );
        $( "#GuiaRemisionId" ).val( id );
    
        $( "#form1" ).submit();
    }
}

configurarDataTable = function()
{
    $( '#example' ).DataTable
    (
        {
            language:       { "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json" },
            responsive:     false,
            searching:      false,
            info:           false,
            lengthChange:   false,
            paging:         false,
            dom:            'lrtip'/*,
            fixedHeader: 
            {
                header: true,
                footer: true
            }*/
        }
    );
}

setTimeout
(
    function () 
    {
        configurarDataTable();
    }, 
    1000
);
</script>