Commit c93296a3 authored by Marcos Albano's avatar Marcos Albano 💬

Agendamento funcionando

parent cf150342
......@@ -14,10 +14,12 @@ class DatepickerController extends Controller
public function datepicker(Request $request)
{
$datepicker = new Datepicker();
$datepicker->data = $request->get('data');
// $datepicker->cpf = $request->get('cpf');
$datepicker->save();
// return redirect('datepicker')->with('success', 'Agendamento adicionado com sucesso!');
return redirect()->back();
// return view('dadosAtendimento');
}
}
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Http\Requests\StoreUpdateTituloRequest;
use App\Models\Agendamento;
use App\Models\DocumentoPessoa;
use App\Models\Lote;
use App\Models\LoteTramite;
......@@ -28,12 +29,16 @@ class TituloController extends Controller
*/
public function index()
{
$documentosPessoa = DocumentoPessoa::where('cpf', $this->request->cpf)->with('pessoa')->get();
foreach ($documentosPessoa as $documentoPessoa) {
$pessoasLote = PessoaLote::where('pessoa_id', $documentoPessoa->pessoa_id)->with('lote')->get();
foreach ($pessoasLote as $pessoaLote) {
$lotes = Lote::where('id', $pessoaLote->lote_id)->with('lotesTramites', 'municipio')->get();
$lotes = Lote::where('id', $pessoaLote->lote_id)
->with('lotesTramites', 'municipio', 'situacaoJuridica', 'pessoaLote', 'formasObtencao', 'processos')
->get();
dd($lotes);
foreach ($lotes as $lote) {
$lotesTramites = LoteTramite::where('lote_id', $lote->id)->get();
foreach ($lotesTramites as $loteTramite) {
......@@ -42,23 +47,27 @@ class TituloController extends Controller
->get();
foreach ($tramites as $tramite) {
$titulos = Titulo::where('lote_id', $lote->id)->where('flag_cancelamento', '<>', 'S')->get();
foreach ($titulos as $titulo) {
// echo "<b>Município: {$lote->municipio->nome}" . " | Título: {$titulo->numero_titulo}" . " | Proprietário: {$lote->proprietario}" .
// " | CPF: {$documentoPessoa->cpf}" . " | Tramite Nome: {$tramite->nome}" . " | Localizacao: {$loteTramite->localizacao_nova}" .
// " | Lote: {$lote->numero}" . " | Cancelado?: {$titulo->flag_cancelamento} </b><hr>";
//echo "Titulo: " . "{$titulo}<hr>";
return view(
'admin.pages.titulos.index',
[
'titulos' => $titulos,
'lotes' => $lotes,
'documentosPessoa' => $documentosPessoa,
'loteTramite' => $loteTramite,
'tramite' => $tramite,
]
);
$agendamentos = Agendamento::get()->last();
//dd($agendamentos);
if($agendamentos) {
// echo "<b>Município: {$lote->municipio->nome}" . " | Título: {$titulo->numero_titulo}" . " | Proprietário: {$lote->proprietario}" .
// " | CPF: {$documentoPessoa->cpf}" . " | Tramite Nome: {$tramite->nome}" . " | Localizacao: {$loteTramite->localizacao_nova}" .
// " | Lote: {$lote->numero}" . " | Cancelado?: {$titulo->flag_cancelamento} </b><hr>";
//echo "Titulo: " . "{$titulo}<hr>";
return view(
'admin.pages.titulos.index',
[
'titulos' => $titulos,
'lotes' => $lotes,
'documentosPessoa' => $documentosPessoa,
'loteTramite' => $loteTramite,
'tramite' => $tramite,
'agendamentos' => $agendamentos,
]
);
}
}
}
}
......@@ -93,7 +102,7 @@ class TituloController extends Controller
public function store(Request $request)
{
return $request->name;
}
......@@ -120,6 +129,14 @@ class TituloController extends Controller
'titulos' => $titulos,
]);
}
if (!$agendamentos = Agendamento::get()->last()) {
return redirect()->back();
} else {
return view('admin.pages.titulos.show', [
'agendamentos' => $agendamentos,
]);
}
}
/**
......
......@@ -7,4 +7,5 @@ use Illuminate\Database\Eloquent\Model;
class Datepicker extends Model
{
protected $table = 'agendamento.agendamentos';
}
......@@ -7,19 +7,19 @@ use Illuminate\Database\Eloquent\Model;
class Lote extends Model
{
protected $table = 'sige.lotes';
protected $fillable = ['id', 'area', 'ativo', 'criado_por_id', 'dhc', 'dhm', 'modificado_por_id',
'municipio_id', 'nome', 'numero', 'perimetro', 'proprietario', 'situacao_juridica_id',
'titulo', 'sncr', 'cpf', 'protocolo', 'is_aprovado', 'data_termino_periodo_de_uso',
'status_estrutura', 'status_pessoa', 'status_uso', 'comunidade', 'localidade', 'projeto_especial',
'cnpj', 'status_titulo', 'migrado_para_access', 'cod_imo_rur'];
// protected $fillable = ['id', 'area', 'ativo', 'criado_por_id', 'dhc', 'dhm', 'modificado_por_id',
// 'municipio_id', 'nome', 'numero', 'perimetro', 'proprietario', 'situacao_juridica_id',
// 'titulo', 'sncr', 'cpf', 'protocolo', 'is_aprovado', 'data_termino_periodo_de_uso',
// 'status_estrutura', 'status_pessoa', 'status_uso', 'comunidade', 'localidade', 'projeto_especial',
// 'cnpj', 'status_titulo', 'migrado_para_access', 'cod_imo_rur'];
// public function titulos(){
// return $this->hasMany(Titulo::class, 'lote_id', 'id');
// }
public function secUser(){
return $this->belongsTo(SecUser::class);
}
// public function secUser(){
// return $this->belongsTo(SecUser::class);
// }
public function municipio()
{
......
......@@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Processo extends Model
{
protected $table = 'sige.processos';
protected $fillable = ['id', 'ativo', 'criado_por_id', 'descricao', 'dhc', 'dhm', 'etapa_id', 'lote_id',
'modificado_por_id', 'pendencia_id', 'sem_pendencia', 'situacao', 'conferido',
'data_conferencia', 'conferido_por_id'];
// protected $fillable = ['id', 'ativo', 'criado_por_id', 'descricao', 'dhc', 'dhm', 'etapa_id', 'lote_id',
// 'modificado_por_id', 'pendencia_id', 'sem_pendencia', 'situacao', 'conferido',
// 'data_conferencia', 'conferido_por_id'];
public function search($filter = null)
{
......
......@@ -5,12 +5,11 @@
@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>
<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">
......@@ -40,35 +39,35 @@
<div class="card-body">
<table class="table table-striped">
<thead>
<tr align="center">
<tr>
<th>MUNICÍPIO</th>
<th>PROPRIETÁRIO</th>
<th>NÚMERO TÍTULO</th>
<th>CPF</th>
<th>TRAMITE</th>
<th>LOCALIZAÇÃO</th>
<th width="100">AÇÕES</th>
<th>DATA</th>
<th>ID</th>
{{-- <th width="100">AÇÕES</th> --}}
</tr>
</thead>
<tbody>
@foreach ($documentosPessoa as $documentoPessoa)
@foreach ($lotes as $lote)
@foreach ($titulos as $titulo)
<tr align="center">
<td>{{ $lote->municipio->nome }}</td>
<td>{{ $lote->proprietario }}</td>
<td>{{ $titulo->numero_titulo }}</td>
<td>{{ $documentoPessoa->cpf }}</td>
<td>{{ $tramite->nome }}</td>
<td>{{ $loteTramite->localizacao_nova }}</td>
<td>
<a href="{{ route('titulos.show', $lote->id) }}" class="badge bg-green">Detalhes</a>
</td>
</tr>
@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>
</tr>
@endif
@endforeach
@endforeach
@endforeach
</tbody>
</table>
<div class="container">
<form method="post" action="{{ route('datepicker') }}" enctype="multipart/form-data">
......@@ -78,27 +77,24 @@
<div class="form-group col-md-4">
<strong>Date : </strong>
<input class="date form-control" type="text" id="datepicker" name="data">
</div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="form-group col-md-4" style="margin-top:60px">
<button type="submit" class="btn btn-success">Submit</button>
<button type="submit" class="btn btn-success">AGENDAR</button>
<a href="{{ route('titulos.show', $ ->id) }}"
class="badge bg-green">DADOS DO ATENDIMENTO</a>
</div>
</div>
</form>
{{-- <a href="{{ route('titulos.show', $lote->id) }}"
class="badge bg-green">DADOS DO ATENDIMENTO</a> --}}
</div>
<script type="text/javascript">
$('#datepicker').datepicker({
autoclose: true,
format: 'dd/mm/yyyy'
});
</script>
{{-- <button type="submit" class="btn btn-block btn-primary btn_pesquisa">Agendar</button> --}}
</div>
<div class="card-footer">
{{-- {!! $titulos->appends($filters)->links() !!} --}}
</div>
</div>
@endsection
......@@ -16,7 +16,6 @@
<img class="logoidace" src="{{ asset('img/logo-idace.png') }}">
<h1 class="titulo">Dados do atendimento</h1>
<h4 class="titulo2">Município: <strong> {{ $lotes->municipio->nome }}</strong></h4>
<h4 class="titulo2">Detentor: <strong> {{ $lotes->proprietario }}</strong></h4>
<h4 class="titulo2">CPF: <strong>{{ $lotes->cpf }}</strong></h4>
<div class="row">
......@@ -26,12 +25,12 @@
</div>
<div class="col-sm-6" style="text-align:center;font-size:23px;">
<h4 class="titulo2">Horário:<strong> 09:30AM - 10:00AM</strong></h4>
{{-- <h4 class="titulo2">Horário:<strong> 09:30AM - 10:00AM</strong></h4> --}}
</div>
</div>
<h4 class="titulo2">Número do Atendimento: <strong>423566</strong></h4>
{{-- <h4 class="titulo2">Número do Atendimento: <strong>423566</strong></h4> --}}
<!-- general form elements -->
......
@extends('adminlte::page')
@section('title', 'CPF Inválido')
@section('content')
<form action="{{ route('agendamentos.index', $lote->id) }}" method="post" enctype="multipart/form-data" class="form">
<div class="row">
<!-- left column -->
<div class="col-md-3">
</div>
<div class="col-md-6 tela_cpf_invalido">
<img class="logoidace" src="{{ asset('img/logo-idace.png') }}" >
<h1 class="titulo">Agendamento realizado com sucesso</h1>
<!-- general form elements -->
<!-- /.card-header -->
<!-- form start -->
<button href="/" type="button " style="margin-top:100px" class="btn btn-block btn-primary btn_pesquisa">Voltar</button>
</div>
<!-- /.card -->
<!--/.col (left) -->
<!-- right column -->
<!--/.col (right) -->
<div class="col-md-3">
</div>
</div>
</form>
@endsection
\ No newline at end of file
......@@ -38,6 +38,10 @@ Route::get('/home', 'HomeController@index')->name('home');
// return view('teste');
// });
Route::get('/dadosAtendimento', function () {
return view('dadosAtendimento');
})->name('dadosAtendimento');
Route::get('/cpfinvalido', function () {
return view('cpfInvalido');
})->name('cpfinvalido');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment