<?php $__env->startSection('content'); ?>

    <div class="sixteen wide tablet sixteen wide computer column ">
        <div class="ui segment">
            
            <h4 class="ui dividing header teal centered">DETALLES DE GUIA DE REMISION</h4>

            <div class="ui warning message">
                <div class="ui equal width grid">
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile seven wide tablet  five wide computer column message_header">Personal que emitió la guia :</div>
                        <div class="sixteen wide mobile nine wide tablet  eleven wide computer column"><?php echo e(ucwords(mb_strtolower($data->usuario->nombres))); ?> <?php echo e(ucwords(mb_strtolower($data->usuario->apellidos))); ?> (<?php echo e($data->usuario->username); ?>)</div>
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile seven wide tablet  five wide computer column message_header">Fecha que se emitió la guia :</div>
                        <div class="sixteen wide mobile nine wide tablet  eleven wide computer column"><?php echo e(ucwords(mb_strtolower($data->created_at))); ?></div>
                    </div>
                </div>
            </div>    

            <div class="ui success message">
                <div class="ui equal width grid">
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Nombre de Destinatario :</div>
                        <?php if($data->id_venta != null): ?>
                            <div class="sixteen wide mobile eight wide tablet four wide computer column"><a href="<?php echo e(url('cliente/editar/'.$data->venta->cliente->id_cliente)); ?>" title="Clic para ver informacion"><?php echo e(ucwords(mb_strtolower($data->venta->cliente->nombre))); ?></a></div>
                        <?php else: ?>
                            <div class="sixteen wide mobile eight wide tablet four wide computer column"><a href="<?php echo e(url('cliente/editar/'.$data->cliente->id_cliente)); ?>" title="Clic para ver informacion"><?php echo e(ucwords(mb_strtolower($data->cliente->nombre))); ?></a></div>
                        <?php endif; ?>

                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Nº Documento del Destinatario :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->id_venta != null ? $data->venta->cliente->numero_documento : $data->cliente->numero_documento); ?></div>
                    </div>

                    

                   
                </div>
            </div>

            <div class="ui info message">
                <div class="ui equal width grid">


                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">N° Guia de Remision:</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->nombre_guia); ?></div>
                        <?php if($data->id_venta != null): ?>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Nº de Boleta o Factura</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><a href="<?php echo e(url('venta/detalles/'.$data->id_venta)); ?>" title="Clic para ver informacion"><?php echo e($data->venta->nombre_comprobante); ?></a></div>
                        <?php endif; ?>
                    </div>

                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile six wide tablet  four wide computer column message_header">Direccion de Partida:</div>
                        <div class="sixteen wide mobile ten wide tablet  twelve wide computer column"><?php echo e(ucwords(mb_strtolower($data->punto_partida))); ?></div>
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile six wide tablet  four wide computer column message_header">Direccion de Llegada :</div>
                        <div class="sixteen wide mobile ten wide tablet  twelve wide computer column"><?php echo e(ucwords(mb_strtolower($data->punto_llegada))); ?></div>
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile six wide tablet  four wide computer column message_header">Empresa de Transporte :</div>
                        <div class="sixteen wide mobile ten wide tablet  twelve wide computer column"><?php echo e(ucwords(mb_strtolower($data->nombre_transportista))); ?></div>
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">RUC Empresa de Transporte :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->documento_transportista); ?></div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">DNI Conductor :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->licencia); ?></div>
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Placa del Vechiculo :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->marca_placa); ?></div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Fecha de Traslado :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->fecha_traslado); ?></div>
                    </div>

                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Estado Envio:</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->estado_envio); ?></div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Mensaje SUNAT :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><?php echo e($data->mensaje_envio); ?></div>
                    </div>
                </div>
            </div>
            

            <div class="ui hidden divider"></div>
            <table class="ui table">
                <thead>
                    <tr>
                        <th class="center aligned">Producto</th>
                        <th class="center aligned" data-tooltip="Presentacion del producto" data-position="top center" data-inverted="">Presentacion</th>
                        <th class="center aligned" data-tooltip="Unidad de Medida" data-position="top center" data-inverted="">Unidad de Medida</th>
                        <th class="center aligned" data-tooltip="Cantidad vendida" data-position="top center" data-inverted="">Cantidad</th>
                    </tr>
                </thead>
                <tbody id="tbody">
                    <?php if($data->id_venta != null): ?>

                        <?php $__currentLoopData = $detalle_venta; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $venta): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr data-table="<?php echo e($venta->id_detalle_venta); ?>">
                            <td><a href="<?php echo e(url('producto/editar/'.$venta->id_producto)); ?>" title="Clic para ver informacion"><?php echo e(ucwords(mb_strtolower($venta->producto->nombre))); ?> <?php echo e($venta->producto->descripcion); ?></a></td>
                            <td><?php echo e($venta->producto->tipo_presentacion->nombre); ?></td>
                            <td><?php echo e($venta->producto->unidad_medida->nombre); ?></td>
                            <td><?php echo e($venta->cantidad); ?></td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php else: ?>
                        <?php $__currentLoopData = $detalle_guia; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data3): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr data-table="<?php echo e($data3->id_detalle_guia_remision); ?>">
                            <td><a href="<?php echo e(url('producto/editar/'.$data3->id_producto)); ?>" title="Clic para ver informacion"><?php echo e(ucwords(mb_strtolower($data3->producto->nombre))); ?> <?php echo e($data3->producto->descripcion); ?></a></td>
                            <td><?php echo e($data3->producto->tipo_presentacion->nombre); ?></td>
                            <td><?php echo e($data3->producto->unidad_medida->nombre); ?></td>
                            <td><?php echo e($data3->cantidad); ?></td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    <?php endif; ?>

                </tbody> 
            </table>

            <div class="form_footer" >
                <a class="ui small left  floated default button" href="<?php echo e(URL::previous()); ?>"><i class="arrow left icon"></i>REGRESAR</a>

                <?php if($data->estado_envio != "ACEPTADO"): ?>
                <div class="ui small right floated red button btn_reenviar" data-id="<?php echo e($data->id_guia_remision); ?>"><i class="sync alternate icon"></i>Reenviar</div>
                <?php endif; ?>    

                <?php if( $data->estado_envio == "ACEPTADO" || $data->estado_envio == "RECHAZADO"): ?>
                <a class="ui small right floated blue button btn_cdr" href="<?php echo e(url('../sunat/cdr/guias/R-'.$empresa->ruc.'-'.$data->tipo_comprobante->codigo.'-'.$data->nombre_guia.'.xml')); ?>" target="_blank"><i class="download icon"></i>Descargar CDR</a>
                <?php endif; ?>
                
                <a class="ui small right floated green button btn_cdr" href="<?php echo e(url('../sunat/xml/guias/'.$empresa->ruc.'-'.$data->tipo_comprobante->codigo.'-'.$data->nombre_guia.'.xml')); ?>" target="_blank"><i class="download icon"></i>Descargar XML</a>

                

            </div>  

        </div>
    </div>

    <!--start delete modal -->
    <div class="ui small basic modal" id="delete_modal">
        <div class="ui icon header"><i class="trash alternate icon"></i>Eliminar Registro</div>
        <div class="content" style="text-align: center; font-size: 16px">
          <p>¿Está seguro que quiere eliminar este registro del sistema?</p>
        </div>
        <div class="actions">
            <div class="ui red basic cancel inverted button" title="Haga clic para salir"><i class="remove icon"></i>Cancelar</div>
            <div class="ui green ok inverted button" title="Haga clic para eliminar"> <i class="checkmark icon"></i>Eliminar</div>
        </div>
    </div>
    <!--end delete modal -->
 
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <script src="<?php echo e(asset('js/guia/detalles.js')); ?>"></script>
<?php $__env->stopSection(); ?>



<?php echo $__env->make('layout.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>