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

Agendamento funcionando

parent cf150342
...@@ -14,10 +14,12 @@ class DatepickerController extends Controller ...@@ -14,10 +14,12 @@ class DatepickerController extends Controller
public function datepicker(Request $request) public function datepicker(Request $request)
{ {
$datepicker = new Datepicker(); $datepicker = new Datepicker();
$datepicker->data = $request->get('data'); $datepicker->data = $request->get('data');
// $datepicker->cpf = $request->get('cpf');
$datepicker->save(); $datepicker->save();
// return redirect('datepicker')->with('success', 'Agendamento adicionado com sucesso!');
return redirect()->back(); return redirect()->back();
// return view('dadosAtendimento');
} }
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\StoreUpdateTituloRequest; use App\Http\Requests\StoreUpdateTituloRequest;
use App\Models\Agendamento;
use App\Models\DocumentoPessoa; use App\Models\DocumentoPessoa;
use App\Models\Lote; use App\Models\Lote;
use App\Models\LoteTramite; use App\Models\LoteTramite;
...@@ -29,11 +30,15 @@ class TituloController extends Controller ...@@ -29,11 +30,15 @@ class TituloController extends Controller
public function index() public function index()
{ {
$documentosPessoa = DocumentoPessoa::where('cpf', $this->request->cpf)->with('pessoa')->get(); $documentosPessoa = DocumentoPessoa::where('cpf', $this->request->cpf)->with('pessoa')->get();
foreach ($documentosPessoa as $documentoPessoa) { foreach ($documentosPessoa as $documentoPessoa) {
$pessoasLote = PessoaLote::where('pessoa_id', $documentoPessoa->pessoa_id)->with('lote')->get(); $pessoasLote = PessoaLote::where('pessoa_id', $documentoPessoa->pessoa_id)->with('lote')->get();
foreach ($pessoasLote as $pessoaLote) { 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) { foreach ($lotes as $lote) {
$lotesTramites = LoteTramite::where('lote_id', $lote->id)->get(); $lotesTramites = LoteTramite::where('lote_id', $lote->id)->get();
foreach ($lotesTramites as $loteTramite) { foreach ($lotesTramites as $loteTramite) {
...@@ -42,8 +47,10 @@ class TituloController extends Controller ...@@ -42,8 +47,10 @@ class TituloController extends Controller
->get(); ->get();
foreach ($tramites as $tramite) { foreach ($tramites as $tramite) {
$titulos = Titulo::where('lote_id', $lote->id)->where('flag_cancelamento', '<>', 'S')->get(); $titulos = Titulo::where('lote_id', $lote->id)->where('flag_cancelamento', '<>', 'S')->get();
foreach ($titulos as $titulo) { foreach ($titulos as $titulo) {
$agendamentos = Agendamento::get()->last();
//dd($agendamentos);
if($agendamentos) {
// echo "<b>Município: {$lote->municipio->nome}" . " | Título: {$titulo->numero_titulo}" . " | Proprietário: {$lote->proprietario}" . // 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}" . // " | CPF: {$documentoPessoa->cpf}" . " | Tramite Nome: {$tramite->nome}" . " | Localizacao: {$loteTramite->localizacao_nova}" .
// " | Lote: {$lote->numero}" . " | Cancelado?: {$titulo->flag_cancelamento} </b><hr>"; // " | Lote: {$lote->numero}" . " | Cancelado?: {$titulo->flag_cancelamento} </b><hr>";
...@@ -57,6 +64,7 @@ class TituloController extends Controller ...@@ -57,6 +64,7 @@ class TituloController extends Controller
'documentosPessoa' => $documentosPessoa, 'documentosPessoa' => $documentosPessoa,
'loteTramite' => $loteTramite, 'loteTramite' => $loteTramite,
'tramite' => $tramite, 'tramite' => $tramite,
'agendamentos' => $agendamentos,
] ]
); );
} }
...@@ -66,6 +74,7 @@ class TituloController extends Controller ...@@ -66,6 +74,7 @@ class TituloController extends Controller
} }
} }
} }
}
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
...@@ -120,6 +129,14 @@ class TituloController extends Controller ...@@ -120,6 +129,14 @@ class TituloController extends Controller
'titulos' => $titulos, '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; ...@@ -7,4 +7,5 @@ use Illuminate\Database\Eloquent\Model;
class Datepicker extends Model class Datepicker extends Model
{ {
protected $table = 'agendamento.agendamentos'; protected $table = 'agendamento.agendamentos';
} }
...@@ -7,19 +7,19 @@ use Illuminate\Database\Eloquent\Model; ...@@ -7,19 +7,19 @@ use Illuminate\Database\Eloquent\Model;
class Lote extends Model class Lote extends Model
{ {
protected $table = 'sige.lotes'; protected $table = 'sige.lotes';
protected $fillable = ['id', 'area', 'ativo', 'criado_por_id', 'dhc', 'dhm', 'modificado_por_id', // protected $fillable = ['id', 'area', 'ativo', 'criado_por_id', 'dhc', 'dhm', 'modificado_por_id',
'municipio_id', 'nome', 'numero', 'perimetro', 'proprietario', 'situacao_juridica_id', // 'municipio_id', 'nome', 'numero', 'perimetro', 'proprietario', 'situacao_juridica_id',
'titulo', 'sncr', 'cpf', 'protocolo', 'is_aprovado', 'data_termino_periodo_de_uso', // 'titulo', 'sncr', 'cpf', 'protocolo', 'is_aprovado', 'data_termino_periodo_de_uso',
'status_estrutura', 'status_pessoa', 'status_uso', 'comunidade', 'localidade', 'projeto_especial', // 'status_estrutura', 'status_pessoa', 'status_uso', 'comunidade', 'localidade', 'projeto_especial',
'cnpj', 'status_titulo', 'migrado_para_access', 'cod_imo_rur']; // 'cnpj', 'status_titulo', 'migrado_para_access', 'cod_imo_rur'];
// public function titulos(){ // public function titulos(){
// return $this->hasMany(Titulo::class, 'lote_id', 'id'); // return $this->hasMany(Titulo::class, 'lote_id', 'id');
// } // }
public function secUser(){ // public function secUser(){
return $this->belongsTo(SecUser::class); // return $this->belongsTo(SecUser::class);
} // }
public function municipio() public function municipio()
{ {
......
...@@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Model; ...@@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Processo extends Model class Processo extends Model
{ {
protected $table = 'sige.processos'; protected $table = 'sige.processos';
protected $fillable = ['id', 'ativo', 'criado_por_id', 'descricao', 'dhc', 'dhm', 'etapa_id', 'lote_id', // protected $fillable = ['id', 'ativo', 'criado_por_id', 'descricao', 'dhc', 'dhm', 'etapa_id', 'lote_id',
'modificado_por_id', 'pendencia_id', 'sem_pendencia', 'situacao', 'conferido', // 'modificado_por_id', 'pendencia_id', 'sem_pendencia', 'situacao', 'conferido',
'data_conferencia', 'conferido_por_id']; // 'data_conferencia', 'conferido_por_id'];
public function search($filter = null) public function search($filter = null)
{ {
......
...@@ -5,12 +5,11 @@ ...@@ -5,12 +5,11 @@
@section('content_header') @section('content_header')
@endsection @endsection
@section('content') @section('content')
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <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" <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css"
rel="stylesheet"> rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <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> <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 card-outline card-success">
<div class="card-body"> <div class="card-body">
<form action="{{ route('titulos.search') }}" class="form form-inline" method="POST"> <form action="{{ route('titulos.search') }}" class="form form-inline" method="POST">
...@@ -40,35 +39,35 @@ ...@@ -40,35 +39,35 @@
<div class="card-body"> <div class="card-body">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr align="center"> <tr>
<th>MUNICÍPIO</th> <th>MUNICÍPIO</th>
<th>PROPRIETÁRIO</th> <th>PROPRIETÁRIO</th>
<th>NÚMERO TÍTULO</th>
<th>CPF</th> <th>CPF</th>
<th>TRAMITE</th> <th>TRAMITE</th>
<th>LOCALIZAÇÃO</th> <th>DATA</th>
<th width="100">AÇÕES</th> <th>ID</th>
{{-- <th width="100">AÇÕES</th> --}}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach ($documentosPessoa as $documentoPessoa) @foreach ($documentosPessoa as $documentoPessoa)
@foreach ($lotes as $lote) @foreach ($lotes as $lote)
@foreach ($titulos as $titulo) @foreach ($titulos as $titulo)
<tr align="center"> @if ($agendamentos)
<tr>
<td>{{ $lote->municipio->nome }}</td> <td>{{ $lote->municipio->nome }}</td>
<td>{{ $lote->proprietario }}</td> <td>{{ $lote->proprietario }}</td>
<td>{{ $titulo->numero_titulo }}</td>
<td>{{ $documentoPessoa->cpf }}</td> <td>{{ $documentoPessoa->cpf }}</td>
<td>{{ $tramite->nome }}</td> <td>{{ $tramite->nome }}</td>
<td>{{ $loteTramite->localizacao_nova }}</td> <td>{{ $agendamentos->data }}</td>
<td> <td>{{ $agendamentos->id }}</td>
<a href="{{ route('titulos.show', $lote->id) }}" class="badge bg-green">Detalhes</a>
</td>
</tr> </tr>
@endif
@endforeach @endforeach
@endforeach @endforeach
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
<div class="container"> <div class="container">
<form method="post" action="{{ route('datepicker') }}" enctype="multipart/form-data"> <form method="post" action="{{ route('datepicker') }}" enctype="multipart/form-data">
...@@ -78,15 +77,14 @@ ...@@ -78,15 +77,14 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<strong>Date : </strong> <strong>Date : </strong>
<input class="date form-control" type="text" id="datepicker" name="data"> <input class="date form-control" type="text" id="datepicker" name="data">
</div> <button type="submit" class="btn btn-success">AGENDAR</button>
</div> <a href="{{ route('titulos.show', $ ->id) }}"
<div class="row"> class="badge bg-green">DADOS DO ATENDIMENTO</a>
<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>
</div> </div>
</div> </div>
</form> </form>
{{-- <a href="{{ route('titulos.show', $lote->id) }}"
class="badge bg-green">DADOS DO ATENDIMENTO</a> --}}
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$('#datepicker').datepicker({ $('#datepicker').datepicker({
...@@ -95,10 +93,8 @@ ...@@ -95,10 +93,8 @@
}); });
</script> </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>
</div> </div>
@endsection @endsection
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<img class="logoidace" src="{{ asset('img/logo-idace.png') }}"> <img class="logoidace" src="{{ asset('img/logo-idace.png') }}">
<h1 class="titulo">Dados do atendimento</h1> <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">Detentor: <strong> {{ $lotes->proprietario }}</strong></h4>
<h4 class="titulo2">CPF: <strong>{{ $lotes->cpf }}</strong></h4> <h4 class="titulo2">CPF: <strong>{{ $lotes->cpf }}</strong></h4>
<div class="row"> <div class="row">
...@@ -26,12 +25,12 @@ ...@@ -26,12 +25,12 @@
</div> </div>
<div class="col-sm-6" style="text-align:center;font-size:23px;"> <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>
</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 --> <!-- 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'); ...@@ -38,6 +38,10 @@ Route::get('/home', 'HomeController@index')->name('home');
// return view('teste'); // return view('teste');
// }); // });
Route::get('/dadosAtendimento', function () {
return view('dadosAtendimento');
})->name('dadosAtendimento');
Route::get('/cpfinvalido', function () { Route::get('/cpfinvalido', function () {
return view('cpfInvalido'); return view('cpfInvalido');
})->name('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