@extends('adminlte::page')

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

@section('content_header')
@endsection
@section('content')
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css"
        rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
    {{-- <div class="card card-outline card-success">
        <div class="card-body">
            <form action="{{ route('titulos.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> --}}
    <div class="header_listagem small-box bg-gradient-success">
        {{-- @foreach ($documentosPessoa as $documentoPessoa) --}}
            @foreach ($lotes as $lote)
                <h1>DADOS DO ATENDIMENTO</h1>
                <h2>{{ $lote->proprietario }}</h1>
                    <h3>CPF: {{ $documentoPessoa->cpf }} </h1>
                        <h3>NÚMERO DO ATENDIMENTO: {{ $agendamentos->id }} </h1>
                            <h3>DATA DO AGENDAMENTO: {{ $agendamentos->data }} </h1>
            @endforeach
        {{-- @endforeach --}}
    </div>
    <!-- <h1></h1> -->
    <div class="card card-outline card-success">
        <div class="card-header">
            <h3 class="card-title"><b>Listagem dos Títulos</b></h3>
        </div>
        <!-- /.card-header -->
        <div class="card-body">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>MUNICÍPIO</th>
                        <th>PROPRIETÁRIO</th>
                        <th>CPF</th>
                        <th>STATUS</th>
                        {{-- <th>DATA</th> --}}
                        {{-- <th>NÚMERO DO ATENDIMENTO</th> --}}
                        <th width="100">AÇÕES</th>
                    </tr>
                </thead>
                <tbody>
                    {{-- @foreach ($documentosPessoa as $documentoPessoa) --}}
                        @foreach ($lotes as $lote)
                            @foreach ($titulos as $titulo)
                                @if ($agendamentos)
                                    <tr>
                                        <td>{{ $lote->municipio->nome }}</td>
                                        <td>{{ $lote->proprietario }}</td>
                                        <td>{{ $documentoPessoa->cpf }}</td>
                                        <td>{{ $tramite->nome }}</td>
                                        {{-- <td>{{ $agendamentos->data }}</td> --}}
                                        {{-- <td>{{ $agendamentos->id }}</td> --}}
                                        <td>
                                            <a href="{{ route('titulos.show', $lote->id) }}"
                                                class="badge bg-green">DETALHES</a>
                                        </td>
                                    </tr>
                                @endif
                            @endforeach
                        {{-- @endforeach --}}
                    @endforeach
                </tbody>

            </table>
            <div class="container">
                <form method="post" action="{{ route('datepicker') }}" enctype="multipart/form-data">
                    @csrf
                    <div class="row">
                        <div class="col-md-4"></div>
                        <div class="form-group col-md-4">
                            <strong>Date : </strong>
                            <input class="date form-control" type="text" id="datepicker" name="data">
                            <button type="submit" class="btn btn-success">AGENDAR</button>

                        </div>
                    </div>
                </form>
            </div>
            <script type="text/javascript">
                $('#datepicker').datepicker({
                    autoclose: true,
                    format: 'dd/mm/yyyy'
                });

            </script>
        </div>
    </div>
@endsection
