@extends('adminlte::page')

@section('title', 'Pesquisa de Lotes')
    
@section('content_header')

@section('content')
<div class="card card-outline card-success">
    <div class="card-body">
        <form action="{{ route('lotes.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>
  </div>

    <div class="card card-outline card-success">
        <div class="card-header">
          <h3 class="card-title"><b>Listagem dos Lotes</b></h3>
        </div>
        <div class="card-body">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>MUNICIPIO_ID</th>
                        <th>LOTE</th>
                        <th>PROPRIETÁRIO</th>
                        <th>CPF</th>
                        <th>DHC</th>
                        <th>DHM</th>
                        <th>ÁREA</th>
                        <th>ATIVO</th>
                        <th>CRIADO_POR_ID</th>
                        <th>MODIFICADO_POR_ID</th>
                        <th>IMÓVEL</th>
                        <th>SITUAÇÃO JURÍDICA</th>
                        <th width="100">AÇÕES</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($lotes as $lote)
                    <tr>
                        <td>{{ $lote->id }}</td>
                        <td>{{ $lote->municipio_id }}</td>
                        <td>{{ $lote->numero }}</td>
                        <td>{{ $lote->proprietario }}</td>
                        <td>{{ $lote->cpf }}</td>
                        <td>{{ $lote->dhc }}</td>
                        <td>{{ $lote->dhm }}</td>
                        <td>{{ $lote->area }}</td>
                        <td>{{ $lote->ativo }}</td>
                        <td>{{ $lote->criado_por_id }}</td>
                        <td>{{ $lote->modificado_por_id }}</td>
                        <td>{{ $lote->nome }}</td>
                        <td>{{ $lote->situacao_juridica_id }}</td>
                    <td>
                    <a href="{{ route('lotes.show', $lote->id) }}" class="badge bg-green">Detalhes</a>
                    </td>
                    </tr>
                        
                    @endforeach
                </tbody>
            </table>
        </div>
        <div class="card-footer">
            @if (isset($filters))
            {!! $lotes->appends($filters)->links() !!}    
        @endif
            {!! $lotes->links() !!}
        </div>
      </div>
@endsection 


 