@extends('usuarios.funcionarios.master.layout2')

@section('conteudo') 
 <nav class="d-none">
    {{ $reservas=\App\Models\Reserva::orderBy('created_at','Desc')->get() }}
    {{ $checkin=\App\Models\Checkin::get() }}
</nav>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jQuery.mmenu/8.5.21/mmenu.min.css" integrity="sha512-gIn3+aW4xrkqoIvXsJ7F3woKfU+KTvEzXm0IXKmWqXZ8oyD9TfzFEdGDMF0egqto86E91yZVPzoa82a/dgSMig==" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery.mmenu/8.5.21/mmenu.js" integrity="sha512-lIylIwmEOkr7tetP4IsQcCwAQc7CXNFyVh/dqTSlJwnNGZrlSnF6p9o5oTNQ87jJNylT8zjeiAvniMBuAHzqTg==" crossorigin="anonymous"></script>
<h2><i class="fa fa-bars"></i> Reservas</h2>

<div class="container align">
    <div class="btn-group" role="group" aria-label="Basic example">
        {{-- <a href="{{ route('us.armazem.gestao.caixas.ver.reservas') }}"  class="btn blue-gradient"><i class="fa fa-bars"></i> Outras reservas</a> --}}
        <a href="{{ route('us.armazem.gestao.caixas.nova.reserva') }}"  class="btn btn-sm blue-gradient"><i class="fa fa-plus"></i> Nova reserva</a> 
    </div>
 
       
    <hr>
      <div class="row">
        <div class="col-md-12 mt-5">
             <nav class="col-12 table-responsive">
                    <table id="reservasTable" class="table container  table-striped table-hover">
                        <thead>
                             <tr class="">
                                 <th>#</th>
                                  <th>Código da reserva</th>
                                  <th>Quantidade de caixas</th>
                                  <th>Tipo de caixa</th>
                                  <th>Cliente</th>
                                  <th>Funcionario</th>
                                  <th>Data da reserva</th>
                                  <th>Ver Mais</th>
                                </tr>
                        </thead>
                        <tbody>
                                   <div class="d-none">
                                       {{ $i=1 }}

                                   </div>
                                @foreach($reservas as $reserva)
                                
                                <tr>  
                                    <td>{{ $i++ }}</td>
                                    <td>{{ $reserva->id }}</td>
                                    <td>{{ $reserva->quantcaixas}}</td>
                                    @if($reserva->getTipoCaixa)
                                        <td>{{ $reserva->getTipoCaixa->tipocaixa }}</td>
                                    @else
                                        <td>--------------</td>
                                    @endif
                                    
                                    <td>{{ $reserva->getCliente->getUser->getPessoa->nome }}</td>
                                    <td>{{ $reserva->getUser->getPessoa->nome }}</td>
                                    <td>{{ $reserva->created_at }}</td>
                                    
                                    @if($reserva->getTipoCaixa)
                                        <td><a href="{{ route('us.armazem.gestao.caixas.ver.reserva',$reserva->id ) }}" class="btn btn-sm blue-gradient"> <i class="fa fa-eye"></i> Abrir</a>
                                        {{-- <a  class="btn btn-sm btn-outline-primary btnSelecionarReserva"> <i class="fa fa-check animate__animated animate__infinite animate__bounceIn animate__slower"></i> Escolher
                                            <input type="hidden" class="codigoId" value="{{ $reserva->id }}">
                                        </a> --}}
                                        </td>
                                    @else
                                        <td>--------</td>
                                    @endif
                                </tr>
                                @endforeach                      
                        </tbody>
                        <tfoot></tfoot>
                     </table>
                 </nav>
        </div>
    </div>
 </div>
 
 <script>
    $(function () { 
         $('#reservasTable').DataTable({
                "paging": true,
                "lengthChange": true,
                "searching": true,
                "ordering": true,
                "info": true,
                "autoWidth": true,
            });
    })
 </script>

@endsection