@extends('admin.layouts.app')

@section('title', 'Pesquisa de glebas')

@section('content')
    <h1>Exibindo os glebas</h1>
    {{-- <a href="{{ route('glebas.create') }}" class="btn btn-primary">Cadastrar</a> --}}
    <hr> 
    <form action="{{ route('glebas.search') }}" class="form form-inline" method="POST">
        @csrf
    <input type="text" name="filter" placeholder="Filtrar:" class="form-control" value="{{ $filters['filter'] ?? '' }}">
        <button type="submit" class="btn btn-info">Pesquisar</button>
    </form>

    <table class="table table-striped">
        <thead>
            <tr>
                <th>ID</th>
                <th>NOME</th>
                <th width="100">AÇÕES</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($glebas as $gleba)
            <tr>
            <td>{{ $gleba->id }}</td>
            <td>{{ $gleba->nome }}</td>

            <td>
            {{-- <a href="{{ route('glebas.edit', $gleba->id) }}">Editar</a> --}}
            <a href="{{ route('glebas.show', $gleba->id) }}">Detalhes</a>
            </td>
            </tr>
                
            @endforeach
        </tbody>
    </table>

    @if (isset($filters))
        {!! $glebas->appends($filters)->links() !!}    
    @endif
        {!! $glebas->links() !!}

@endsection


   