@extends('layout.main')
@section('content')

    <div class="sixteen wide tablet sixteen wide computer column ">
        <div class="ui segment">
            
            <h4 class="ui dividing header teal centered">DETALLES DE COMPROBANTE DADO DE BAJA</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 registró la baja :</div>
                        <div class="sixteen wide mobile nine wide tablet  eleven wide computer column">{{ ucwords(mb_strtolower($data->usuario->nombres)) }} {{ ucwords(mb_strtolower($data->usuario->apellidos)) }} ({{ $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 dio de baja :</div>
                        <div class="sixteen wide mobile nine wide tablet  eleven wide computer column">{{ ucwords(mb_strtolower($data->created_at)) }}</div>
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet  five wide computer column message_header">Tienda donde se realizó se dio de baja:</div>
                        <div class="sixteen wide mobile eight wide tablet  eleven wide computer column">{{ ucwords(mb_strtolower($data->local->nombre)) }} ({{ ucwords(mb_strtolower($data->local->direccion)) }})</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">Tipo de Comprobante :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column">{{ $data->tipo_comprobante->nombre }}</div>

                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">N° Comprobante :</div>

                        @if($data->id_tipo_comprobante == 1 ||  $data->id_tipo_comprobante == 2)
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><a href="{{ url('venta/detalles/'.$data->id_venta) }}">{{ $data->serie }}-{{ $data->numero }}</a></div>
                        @endif
                        @if($data->id_tipo_comprobante == 3 ||  $data->id_tipo_comprobante == 4)
                        <div class="sixteen wide mobile eight wide tablet four wide computer column"><a href="{{ url('nota/detalles/'.$data->id_nota) }}">{{ $data->serie }}-{{ $data->numero }}</a></div>
                        @endif
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Motivo de Baja :</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column">{{ $data->motivo }}</div>
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Fecha de Referencia:</div>
                         <div class="sixteen wide mobile eight wide tablet four wide computer column">{{ $data->fecha_referencia }}</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">Mensaje de envio a SUNAT :</div>
                        <div class="sixteen wide mobile eight wide tablet  twelve wide computer column">PENDIENTE - El comprobante se encuentra pendiente de envio a la SUNAT</div>                    
                    </div> --}}
                    
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Mensaje de envio a SUNAT :</div>
                        <div class="sixteen wide mobile eight wide tablet  twelve wide computer column">{{ ($data->estado_envio) }} - {{ $data->mensaje_envio }}</div>
                    </div>
                    <div class="row" style="padding-bottom: 0px !important">
                        <div class="sixteen wide mobile eight wide tablet four wide computer column message_header">Fecha de Envio:</div>
                        <div class="sixteen wide mobile eight wide tablet  twelve wide computer column">{{ ($data->updated_at) }}</div>
                    </div>
                    
                </div>
            </div>    


            <div class="ui hidden divider"></div>


            <div class="form_footer" >
                <a class="ui small left  floated default button" href="{{ URL::previous() }}"><i class="arrow left icon"></i>REGRESAR</a>
                
                @if($data->estado_envio == "PENDIENTE")
                    <div class="ui small right floated orange button btn_cdr" data-id="{{$data->id_baja}}"><i class="sync alternate icon"></i>Obtener CDR</div>
                @endif 
                @if($data->estado_envio == "NO ENVIADO" || $data->estado_envio == "PENDIENTE")
                    <div class="ui small right floated red button btn_reenviar" data-id="{{$data->id_baja}}"><i class="sync alternate icon"></i>Reenviar</div>
                @endif 
                @if($data->estado_envio == "ACEPTADO" || $data->estado_envio == "RECHAZADO")
                    <a class="ui small right floated primary button" href="{{ url('../sunat/cdr/bajas/R-'.$empresa->ruc.'-'.$data->nombre_baja.'.xml') }}" target="_blank"><i class="download icon"></i>Descargar CDR</a>
                @endif
                <a class="ui small right floated green button" href="{{ url('../sunat/xml/bajas/'.$empresa->ruc.'-'.$data->nombre_baja.'.xml') }}" target="_blank"><i class="download icon"></i>Descargar XML</a>
            </div> 

        </div>
    </div>

@stop

@section('scripts')
    <script src="{{ asset('js/baja/detalles.js') }}"></script>
@stop



