@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="header_listagem small-box bg-gradient-success">
    </div>
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">
    <script src="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script>
    <img style="display: flex;margin-right: auto;margin-left: auto;" src="{{ asset('img/logo-idace.png') }}" />

    <h2 style="text-align:center;margin-top: 50px;margin-bottom: 50px;"> <strong>AGENDAMENTO DE TÍTULOS</strong></h2>
    <div class="card card-outline card-success">
        <div class="card-header">
            <h2 class="card-title"><b>Listagem dos Títulos</b></h2>
        </div>
        <div class="card-body">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>PROTOCOLO</th>
                        <th>MUNICÍPIO</th>
                        <th>LOTE</th>
                        <th>PROPRIETÁRIO</th>
                        <th>IMÓVEL</th>
                        <th>CPF</th>
                        <th>RG</th>
                        <th>ESTADO CIVIL</th>
                        <th>TRÂMITE</th>
                        {{-- <th>TÍTULO</th> --}}
                        <th width="100">STATUS</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($pessoasLote as $pessoaLote)
                    @endforeach

                    @foreach ($lotes as $lote)
                    @endforeach
                    <tr>
                        <td>{{ $agendamento->id}}</td>
                        <td>{{ $lote->municipio->nome }}</td>
                        <td>{{ $lote->numero }}</td>
                        <td>{{ $pessoa->nome }}</td>
                        <td>{{ $lote->nome }}</td>
                        <td>{{ $documentoPessoa->cpf }}</td>
                        <td>{{ $documentoPessoa->numero_documento_identificacao }}</td>
                        <td>{{ $documentoPessoa->estado_civil }}</td>

                        {{-- @foreach ($tramites as $tramite)
                            --}}
                            <td>
                                {{ $nome }}
                            </td>
                            {{-- @endforeach
                        --}}
                        {{-- <td>
                            {{ $titulos->numero_titulo }}
                        </td> --}}
                        <td>
                            <a href="#" class="btn btn-info btn-sm">
                                <span class="glyphicon glyphicon-ok"></span> Ok
                            </a>
                        </td>
                        {{-- <td><a href="{{ route('titulos.show', $lote->id) }}"
                                class="badge bg-green">DETALHES</a></td> --}}
                    </tr>
                   
                </tbody>
            </table>
        </div>
    </div>
    <div class="card card-outline card-success half">
        <div class="card-header">
            <h3 class="card-title"></h3>
        </div>
        <div class="card-body">
            <div class="container">
                <form method="post" id="form"
                    action="{{ route('datepicker', [$agendamento->id]) }}"
                    enctype="multipart/form-data">
                    @csrf
                    <div class="row">
                        <div class="form-group">
                            <h4 style="text-align:center"><strong>Escolha data e hora do agendamento</strong></h4>
                            <input class="text form-control" type="hidden" id="datepicker1" name="id"
                                value="{{ $agendamento->id }}">
                            <input class="text form-control" type="hidden" id="datepicker1" name="titulo"
                                value="{{ $titulos->numero_titulo }}">
                            <input class="text form-control" type="hidden" id="datepicker1" name="municipio"
                                value="{{ $lote->municipio->nome }}">
                            <strong>Data: </strong><br>
                            <input style="margin-top: 5px;" class="data form-control" type="text" id="datepicker"
                                name="data">
                            <input class="text form-control" type="hidden" id="datepicker1" name="detentor"
                                value="{{ $pessoa->nome }}">
                            <input class="text form-control" type="hidden" id="datepicker1" name="atendido"
                                value="false">
                            <input class="text form-control" type="hidden" id="datepicker1" name="cpf"
                                value="{{ $documentoPessoa->cpf }}"><br>
                            <strong>Hora: </strong><br>
                            <input style="margin-top: 5px;margin-bottom: 20px;" class="form-control" type="text"
                                id="timepicker" name="hora">

                            <div class="form-group">
                                <label for="escritorio">Local de Entrega do Título</label>
                                <select class="form-control" name="escritorio">
                                    <option value="null">-- Selecione o Local --</option>
                                    <option value="IDACE">Sede do IDACE</option>
                                    {{-- <option value="Acaraú">Escritório de Acaraú</option>
                                    <option value="Crateús">Escritório de Crateús</option>
                                    <option value="Itapipoca">Escritório de Itapipoca</option>
                                    <option value="Jaguaretama">Escritório de Jaguaretama</option>
                                    <option value="Limoeiro do Norte">Escritório de Limoeiro do Norte</option>
                                    <option value="Quixeramobim">Escritório de Quixeramobim</option>
                                    <option value="Várzea Alegre">Escritório de Várzea Alegre</option> --}}
                                </select>
                            </div>

                            <div align="right">
                                <button type="submit" class="btn btn-success" class="badge bg-green"
                                    style="align-items: ">Agendar</a></button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

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

        $(document).ready(function() {
            $('input.timepicker').timepicker({});
        });

        $('#timepicker').timepicker({
            timeFormat: 'hh:mm p',
            interval: 30,
            minTime: '08',
            maxTime: '5:00pm',
            defaultTime: '11',
            startTime: '08:00',
            dynamic: false,
            dropdown: true,
            scrollbar: true
        });
        $('#form').trigger("reset");
    </script>

@endsection
