
  @if (Auth::user()->role_id >= 5)
    <div class="container-fluid" style="height:100%">
    <div>
  @else
    <div class="container" style="margin:0 1em">
  @endif

    <div class="row">
        <div class="col-sm-7">
          <h3>Reportes</h3>
        </div>
        <div class="col-sm-5">
          <div class="pull-right">
            {!! Form::open(['method'=>'GET','url'=>'reports','class'=>'navbar-form navbar-left','role'=>'search'])  !!}
            <div class="input-group">
                <input class="form-control" id="search"
                       value="{{ request()->session()->get('search') }}"
                       placeholder="Buscar" name="search"
                       type="text" id="search"/>
                <div class="input-group-btn">
                    <button type="submit" class="btn btn-primary">
                            <i class="fa fa-search" aria-hidden="true"></i>
                    </button>
                </div>
            </div>
            {!! Form::close() !!}
          </div>
        </div>
    </div>
    <table class="table">
        <thead>
        <tr>
            <th style="vertical-align: middle"><a href="{{url('reports?field=id&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">ID</a></th>
                {{request()->session()->get('field')=='id'?(request()->session()->get('sort')=='asc'?'':''):''}}

            <th style="vertical-align: middle"><a href="{{url('reports?field=contract_id&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">ID de Contrato</a></th>
                {{request()->session()->get('field')=='contract_id'?(request()->session()->get('sort')=='asc'?'':''):''}}

            <th style="vertical-align: middle"><a href="{{url('reports?field=moderator_idt&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">Moderador</a></th>
                {{request()->session()->get('field')=='moderator_id'?(request()->session()->get('sort')=='asc'?'':''):''}}

            <th style="vertical-align: middle"><a href="{{url('reports?field=veredict&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">Veredicto</a></th>
                {{request()->session()->get('field')=='veredict'?(request()->session()->get('sort')=='asc'?'':''):''}}

        </tr>
        </thead>
        <tbody>
        @php
            $i=1;
        @endphp
        @foreach ($reports as $report)
          <tr>
            <th>{{ $report->id }}</th>
            <td>{{ $report->contract_id }}</td>
            <td>{{ $report->user->name }}</td>
            <td>{{ $report->veredict }}</td>
            <td style="width: 10em">
              <a class="btn btn-primary btn-xs" title="Comments"
                href="{{url('reports/'.$report->id.'/comments')}}">
                <i class="fa fa-comments"></i>
              </a>
              <input type="hidden" name="_method" value="delete"/>
                <a class="btn btn-danger btn-xs" title="Delete"
                   href="javascript:if(confirm('¿Estás seguro de que quieres eliminar este reporte?')) javascript:if(confirm('Usualmente no se deben eliminar reportes, solo editarlos ¿Estás seguro?')) ajaxDelete('{{url('reports/delete/'.$report->id)}}','{{csrf_token()}}')">
                   <i class="fa fa-trash"></i>
                </a>
            </td>
        </tr>
        @endforeach

        </tbody>
    </table>

        {{ $reports->links() }}
</div>
