    @extends('usuarios.funcionarios.master.layout2')
    @section('conteudo')
    
    @push('mycss')
    <script src="{{asset('js/jquery.dataTables.min.js') }}"></script>
    <link href="{{url('css/alertaTemporario.css')}}" rel="stylesheet" />
    @endpush

<nav class="container animate__animated animate__zoomInDown">

    <div class="row">
        <nav class="12">
            <br>
            <h4>
                <i class="fa fa-hourglass-half"></i>
                Pedidos e Consultas<br>
                <i>Lista dos Autos --- </i><small>(Fisicos)</small>
            </h4>
            <br>
            <hr>
            @php $i=1; @endphp
            <div class="table-responsive">
                <div class="container">
                  <div class="list-group">
                      <nav class="col-12 table-responsive">
                         <table id="example1" class="table container  table-striped table-hover">
                              <thead>
                                  <tr class="">
                                   <th>#</th>
                                    <th>Tipo Auto</th>
                                   <th>Numero</th>
                                    <th>Elaborado_por</th>
                                    <th>Assunto</th>
                                    <th>Data_criação</th>
                                    <th>Solicitado_por</th>
                                    <th>Ver_Ficheiro</th>
                                  
                                  </tr>
                                  </thead>
                                  <tbody>
                                    @foreach ($dados as $dado)
                                    
                                    <tr> 
                                        <td>{{$i++}}</td>
                                        <td>{{$dado->tipoauto}}</td>
                                        <td>{{$dado->numeroauto}}</td>
                                        @php $meu_nome=\App\Models\User::find($dado->autor_id)->getPessoa; @endphp
                                        <td>{{$meu_nome->nome}}</td>
                                        <td>{{$dado->assuntosolicitacao}}</td>
                                        <td>{{$dado->created_at }}</td>

                                        @php $meu_nome2=\App\Models\User::find($dado->user_id)->getPessoa; @endphp
                                        <td>{{$meu_nome2->nome }}</td>
                                        <td>
                                        @php 
                                            //use Illuminate\Support\Facades\Crypt;
                                          
                                    
                                    
                                            try {
                                                 
                                            $decrypted =Crypt::encryptString($dado->id);
                                             
                                            } catch (DecryptException $e) {
                                                $decrypted=0;
                                            }
                                        @endphp
                                            @if($dado->tipoauto ==="Recepção e Custódia" || $dado->tipoauto==="recolha" )
                                                  <form action="{{route('us.servext.solicitacoes.solici.imprimir.print')}}" method="post">
                                                    @csrf
                                                 
                                                    <input value="{{$decrypted}}" name="solicitacao_id" hidden/>
                                                    <button type="submit"class="btn btn-sm btn-outline-primary btnSelecionarReserva"> <i class="fa fa-cog "></i> imprimir</button>
                                                    <button type="submit"class="btn btn-sm btn-outline-primary btnSelecionarReserva"> <i class="fa fa-cog "></i> Baixar</button>
                                                </form>
                                            @else
                                                  <form action="{{route('us.pedidosconsulta.confpedidosconsulta.pedidos.autos.generate.virtual.pdf')}}">
                                                    @csrf
                                                 
                                                    <input value="{{$decrypted}}" name="id_auto" hidden/>
                                                    <button type="submit"class="btn btn-sm btn-outline-primary btnSelecionarReserva"> <i class="fa fa-cog "></i>Baixar</button>
                                                </form>
                                                <form action="{{route('us.pedidosconsulta.confpedidosconsulta.pedidos.autos.generate.virtual')}}">
                                                    @csrf
                                                 
                                                    <input value="{{$decrypted}}" name="id_auto" hidden/>
                                                    <button type="submit"class="btn btn-sm btn-outline-primary btnSelecionarReserva"> <i class="fa fa-cog "></i> imprimir</button>
                                                </form>
                                            
                                            @endif
                                        </td>
                                        
                                    </tr>
                                    @endforeach
                                    </tbody>
                                    
                              <tfoot></tfoot>
                          </table>
                      </nav>
                  </div>
                
                
                </div>
          
          
              </div>
        </nav>


    </div>
</nav>


<script src="{{url('js/msgSucessss.js')}}"></script>
<script>
 
    $(function () {
        $("#example1").DataTable();
        $('#example2').DataTable({
            "paging": true,
            "lengthChange": false,
            "searching": false,
            "ordering": true,
            "info": true,
            "autoWidth": false,
        });
    });
    </script>

    <script>
            $(function () {
                $("#tabela").DataTable();
                $('#example2').DataTable({
                    "paging": true,
                    "lengthChange": false,
                    "searching": false,
                    "ordering": true,
                    "info": true,
                    "autoWidth": false,
                });
            });
    </script>

@endsection
