@extends('usuarios.funcionarios.digitalizacao.dashboard.master')
@section('conteudo')

<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<link href="{{asset('js/digitalizacao_plugins/css/plugins/dataTables/datatables.min.css" rel="stylesheet')}}">


<script src="{{asset('js/jquery.dataTables.min.js') }}"></script>
<link href="{{url('css/alertaTemporario.css')}}" rel="stylesheet" />
<link href="{{asset('js/digitalizacao_plugins/css/bootstrap.min.css')}}" rel="stylesheet">
<link href="{{asset('js/jquery.css/plugins/dataTables/datatables.min.css')}}" rel="stylesheet">




<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <br>
        <h2>Listagem dos Acessos dos Clientes</h2>
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                <a href="{{ route('us.digit.confdigi.index') }}">home</a>
            </li>
            <li class="breadcrumb-item">
                <a>acessos ao documentos</a>
            </li>
            <li class="breadcrumb-item active">
                <strong>acessos</strong>
            </li>
        </ol>
    </div>
</div>

<div class="row wrapper border-bottom white-bg page-heading">

    <div class="table-responsive">
        <div class="container">
          <div class="list-group">
              <nav class="col-12 table-responsive">
                <br> <br>
                <table class="table table-striped table-bordered table-hover dataTables-example" >
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>Cliente</th>
                        <th>categoria</th>
                        <th>Empresa</th>
                        <th>Acesso</th>
                        <th>Acesso_por</th>
                        <th>Acção</th>
                    </tr>
                    </thead>
                    <tbody>



                        @php $clientes=\App\Models\Cliente::all();
                        $i=1; @endphp
                          @forelse ($dados as $dado)

                          <tr>
                              <td>{{$i++}}</td>
                                  @php


                                        $clientes_dados=\App\Models\Cliente::join('users','users.id','clientes.usuario_id')
                                                                          ->join('pessoas','pessoas.id','users.pessoa_id')
                                                                          ->where('clientes.id',$dado->cliente_id)->select('pessoas.nome')->first();
                                        //dd($clientes_dados);
                                        $catgeoria=\App\Models\User::find($dado->funcionario_user)->getFuncionarioCliente->getCategoria;
                                        $autor_acesso=\App\Models\User::find($dado->autor_user)->getPessoa;
                               @endphp

                              <td>{{$dado->nome}}</td>
                              <td>{{$catgeoria->categoriacliente}}</td>
                              <td>{{$clientes_dados->nome}}</td>

                                    @if($dado->tipoparametrosub==="subparametro")
                                        @php $parametro_data1=\App\Models\SubParametroDocumental::where('id',$dado->subparametro_id)->first();
                                            //if(empty($parametro_data1))
                                              //  return route('us.digit.confdigi.index');
                                           // dd($parametro_data1);
                                        @endphp
                                        <td>view Pasta {{$parametro_data1->subseriedoc}}</td>
                                     @else
                                        @php $parametro_data=\App\Models\ParametroDocumental::where('id',$dado->parametro_id)->first();
                                             //if(empty($parametro_data))
                                               // return  route('us.digit.confdigi.index');
                                        @endphp
                                        <td>view Pasta  {{$parametro_data->seriedoc}}</td>
                                    @endif

                                    <td>{{$autor_acesso->nome}}</td>
                          <td>


                                        <form action="" method="post">
                                            @csrf

                                            <input value="" name="solicitacao_id" hidden/>
                                            <input value="" name="mycliente" hidden/>
                                            <button type="submit" class="btn btn-sm btn-outline-primary btnSelecionarReserva"> <i class="fa fa-edit"></i> Alterar</button>

                                        </form>
                          </tr>
                          @empty

                          @endforelse



                    </tbody>
                    <tfoot>
                    <tr>
                        <th>#</th>
                        <th>Cliente</th>
                        <th>categoria</th>
                        <th>Empresa</th>
                        <th>Acesso</th>
                        <th>Acesso_por</th>
                        <th>Acção</th>
                    </tr>
                    </tfoot>
            </table>
              </nav>
          </div>


        </div>


    </div>


    <br>
</div>
<br>




    <!-- Mainly scripts -->
    <script src="{{asset('js/digitalizacao_plugins/js/jquery-3.1.1.min.js')}}"></script>


<script src="{{asset('js/digitalizacao_plugins/js/plugins/dataTables/datatables.min.js')}}"></script>
<script src="{{asset('js/digitalizacao_plugins/js/plugins/dataTables/dataTables.bootstrap4.min.js')}}"></script>

<!-- Custom and plugin javascript -->
<script src="{{asset('js/digitalizacao_plugins/js/inspinia.js')}}"></script>
<script src="{{asset('js/digitalizacao_plugins/js/plugins/pace/pace.min.js')}}"></script>

<!-- Page-Level Scripts -->
<script>
    $(document).ready(function(){
        $('.dataTables-example').DataTable({
            pageLength: 25,
            responsive: true,
            dom: '<"html5buttons"B>lTfgitp',
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'ExampleFile'},
                {extend: 'pdf', title: 'ExampleFile'},

                {extend: 'print',
                 customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                                .addClass('compact')
                                .css('font-size', 'inherit');
                }
                }
            ]

        });

    });

</script>


@endsection
