@extends('usuarios.funcionarios.master.layout2')
{{-- @extends('usuarios.funcionarios.admin.menu') --}}
{{-- @extends('usuarios.funcionarios.usuario.menu') --}}

@section('conteudo')
<nav class="navbar navbar-expand-lg   navbar-dark bg-success" aria-label="Main navigation">
    <div class="container-fluid">


      <div class="navbar-collapse offcanvas-collapse" id="navbarsExampleDefault">
        <ul class="navbar-nav me-auto mb-2 mb-lg-0">


        </ul>

      </div>
    </div>
  </nav>
  <nav class="w-100 d-none overflow-auto">

        {{ $devicesAlloweds=\App\Models\Dispositivo::where('id',$device_id)->where('estado','permitido')->first()}}
        {{ $acessos=\App\Models\Acesso::where('dispositivo_id',$devicesAlloweds->id)->orderby('sessao','Desc')->get() }}

  </nav>

  <div class="nav-scroller  bg-light shadow-sm">
    <nav class="nav nav-underline " aria-label="Secondary navigation">
      <a class="nav-link btn btn-light shadow-sm border btn-sm m-3" href="">
          DISPOSITIVO IDENTIFICADO
          <span class="badge bg-light text-dark rounded-pill align-text-bottom"> {{ $devicesAlloweds->id }} </span>
      </a>

    </nav>
  </div>


<main class="container p-2">
    <div class="d-flex  bg-success align-items-center p-3 my-3 rounded shadow-sm">
      {{-- <img src="{{ asset('img/logo.png') }}" class="mr-4" width="80" alt="LOGO GESTDOC"> --}}
      <div class=" text-white ">
        <h1 class="h6 mb-0 ml-3   ">LISTA DE DISPOSITIVOS </h1>

      </div>
    </div>

    <div class="my-3 p-3 bg-success rounded shadow ">
      <h6 class="border-bottom text-white pb-2 mb-0">ACESSOS</h6>
      <br>
      <div class="list-group">
          <nav class="col-12 table-responsive">
              <table class="table  table-striped table-hover" id="permitidos">
                  <thead>

                      <tr class="danger text-white">
                       <th>Id</th>
                        <th>Estado</th>
                        <th>Sessão</th>
                        <th>Data</th>
                        <th>Mais</th>


                    </tr>

                 </thead>
                 <tbody>

                    {{-- {{ $devAl->id  }} --}}
                    @foreach($acessos as  $acesso)

                    <tr class="danger text-white">
                        <th> <i class="fa fa-laptop"></i> {{ $acesso->id  }}</th>
                        <th>{{ $acesso->estado  }}</th>
                        <th>{{ $acesso->sessao  }}</th>
                        <th>{{ $acesso->created_at  }}</th>
                        <th>
                            @if($acesso->sessao==="aberta")
                                <a href="{{ route('us.admin.funcionario.ass.terminar',$acesso->id ) }}" class="btn btn-sm btn-info border-warning shadow"> <i class="fa   "></i> Terminar sessão</a>

                            @endif
                        </th>
                    </tr>
                    @endforeach

                 </tbody>
                  <tfoot></tfoot>
              </table>
          </nav>
      </div>
      <br>
      <nav aria-label="Page navigation example">
          <ul class="pagination justify-content-end">

              {{-- {{ $devicesAllowed->links() }} --}}
          </ul>
        </nav>
      <small class="d-block text-end mt-3">
          {{-- <a href=" " class="btn btn-sm btn-outline-success "><i class="fa fa-eye"></i> Ver todos</a> --}}
        </small>
    </div>



    </div>
  </main>
@endsection
