Commit 1d822319 authored by Marcos Albano's avatar Marcos Albano 💬

Implementado a funcionalidade do show

parent 428a5184
...@@ -15,10 +15,10 @@ class TituloController extends Controller ...@@ -15,10 +15,10 @@ class TituloController extends Controller
{ {
protected $request; protected $request;
//Injeção de dependência //Injeção de dependência
public function __construct(Request $request, Titulo $titulo) public function __construct(Request $request, Lote $lote)
{ {
$this->request = $request; $this->request = $request;
$this->repository = $titulo; $this->repository = $lote;
} }
/** /**
...@@ -30,77 +30,44 @@ class TituloController extends Controller ...@@ -30,77 +30,44 @@ class TituloController extends Controller
{ {
$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) {
$pessoasLotes = PessoaLote::where('pessoa_id', $documentoPessoa->pessoa_id)->with('lote')->get(); //echo "Documento/Pessoa: " . "{$documentoPessoa}<hr>";
foreach ($pessoasLotes as $pessoaLote) { $pessoasLote = PessoaLote::where('pessoa_id', $documentoPessoa->pessoa_id)->with('lote')->get();
foreach ($pessoasLote as $pessoaLote) {
//echo "Pessoa/Pessoa_Lote: " . "{$pessoaLote}<hr>";
$lotes = Lote::where('id', $pessoaLote->lote_id)->with('lotesTramites', 'municipio')->get(); $lotes = Lote::where('id', $pessoaLote->lote_id)->with('lotesTramites', 'municipio')->get();
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) {
$tramites = Tramite::where('id', $loteTramite->tramite_id)->with('setor')->where('documento_tipo', 'TITULO DO IMOVEL') //echo "LOte/Tramite: " . "{$loteTramite}<hr>";
$tramites = Tramite::where('id', $loteTramite->tramite_id)->where('documento_tipo', 'TITULO DO IMOVEL')
->where('id', 67) ->where('id', 67)
->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) {
// 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}" . " | Lote: {$lote->numero}" . " | Cancelado?: {$titulo->flag_cancelamento} </b><hr>"; // " | CPF: {$documentoPessoa->cpf}" . " | Tramite Nome: {$tramite->nome}" . " | Localizacao: {$loteTramite->localizacao_nova}" . " | Lote: {$lote->numero}" . " | Cancelado?: {$titulo->flag_cancelamento} </b><hr>";
//echo "Titulo: " . "{$titulo}<hr>"; //echo "Titulo: " . "{$titulo}<hr>";
return view(
'admin.pages.titulos.index',
[
'titulos' => $titulos,
'lotes' => $lotes,
'documentosPessoa' => $documentosPessoa,
'loteTramite' => $loteTramite,
'tramite' => $tramite,
]
);
} }
} }
} }
} }
} }
return view(
'admin.pages.titulos.index',
[
'titulos' => $titulos,
'lotes' => $lotes,
'documentosPessoa' => $documentosPessoa,
'loteTramite' => $loteTramite,
'tramite' => $tramite,
'pessoasLotes' => $pessoasLotes,
]
);
} }
} }
//------------------FUNCIONANDO----------------------------------
// $documentosPessoa = DocumentoPessoa::where('cpf', $this->request->cpf)->with('pessoa')->get();
// foreach ($documentosPessoa as $documentoPessoa) {
// $pessoasLotes = PessoaLote::where('pessoa_id', $documentoPessoa->pessoa_id)->with('lote')->get();
// foreach ($pessoasLotes as $pessoaLote) {
// $lotes = Lote::where('id', $pessoaLote->lote_id)->with('lotesTramites', 'municipio')->get();
// foreach ($lotes as $lote) {
// $lotesTramites = LoteTramite::where('lote_id', $lote->id)->get();
// foreach ($lotesTramites as $loteTramite) {
// $tramites = Tramite::where('id', $loteTramite->tramite_id)->with('setor')->where('documento_tipo', 'TITULO DO IMOVEL')
// ->where('id', 67)
// ->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,
// 'pessoasLotes' => $pessoasLotes,
// ]
// );
// }
// }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* *
...@@ -138,13 +105,27 @@ class TituloController extends Controller ...@@ -138,13 +105,27 @@ class TituloController extends Controller
*/ */
public function show($id) public function show($id)
{ {
if (!$titulo = Titulo::find($id)) { if (!$lotes = Lote::find($id)) {
return redirect()->back(); return redirect()->back();
} else {
foreach ($lotes as $lote) {
return view('admin.pages.titulos.show', [
'lotes' => $lotes,
]);
}
} }
return view('admin.pages.titulos.show', [ if (!$titulos = Titulo::where('lote_id', $id)->get()) {
'titulos' => $titulo, return redirect()->back();
]); }else{
foreach ($titulos as $titulo) {
return view('admin.pages.titulos.show', [
'titulos' => $titulos,
]);
}
}
} }
/** /**
......
...@@ -65,7 +65,7 @@ return [ ...@@ -65,7 +65,7 @@ return [
| |
*/ */
'usermenu_enabled' => true, 'usermenu_enabled' => false,
'usermenu_header' => false, 'usermenu_header' => false,
'usermenu_header_class' => 'bg-primary', 'usermenu_header_class' => 'bg-primary',
'usermenu_image' => false, 'usermenu_image' => false,
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<td>{{ $tramite->nome }}</td> <td>{{ $tramite->nome }}</td>
<td>{{ $loteTramite->localizacao_nova }}</td> <td>{{ $loteTramite->localizacao_nova }}</td>
<td> <td>
<a href="{{ route('titulos.show', $tramite->id) }}" <a href="{{ route('titulos.show', $lote->id) }}"
class="badge bg-green">Detalhes</a> class="badge bg-green">Detalhes</a>
</td> </td>
</tr> </tr>
......
@extends('adminlte::page') @extends('adminlte::page')
@section('title', "Detalhes do Título {$titulos->numero_titulo}") @section('title', "Detalhes do Título")
@section('content_header') @section('content_header')
...@@ -11,12 +11,9 @@ ...@@ -11,12 +11,9 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<ul> <ul>
<li><strong>NÚMERO TÍTULO: </strong> {{ $titulos->numero_titulo }}</li> <li><strong>MUNICÍPIO: </strong> {{ $lotes->municipio->nome }}</li>
<li><strong>DHC: </strong> {{ $titulos->dhc }}</li> <li><strong>DETENTOR: </strong> {{ $lotes->proprietario }}</li>
<li><strong>DHM: </strong> {{ $titulos->dhm }}</li> <li><strong>CPF: </strong> {{ $lotes->cpf }}</li>
<li><strong>Lote_id: </strong> {{ $titulos->lote_id }}</li>
<li><strong>Gleba_id: </strong> {{ $titulos->gleba_id }}</li>
<li><strong>Ano Titulo: </strong> {{ $titulos->ano_titulo }}</li>
</ul> </ul>
</div> </div>
<div class="card-footer"> <div class="card-footer">
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
@endif> @endif>
{{-- Small brand logo --}} {{-- Small brand logo --}}
<img src="{{ asset(config('adminlte.logo_img', 'vendor/adminlte/dist/img/AdminLTELogo.png')) }}" <img src="{{ asset(config('adminlte.logo_img', 'img/ligoidace.png')) }}"
alt="{{ config('adminlte.logo_img_alt', 'AdminLTE') }}" alt="{{ config('adminlte.logo_img_alt', 'AdminLTE') }}"
class="{{ config('adminlte.logo_img_class', 'brand-image img-circle elevation-3') }}" class="{{ config('adminlte.logo_img_class', 'brand-image img-circle elevation-3') }}"
style="opacity:.8"> style="opacity:.8">
......
...@@ -11,7 +11,8 @@ Route::get('one-to-many', 'OneToManyController@oneToMany'); ...@@ -11,7 +11,8 @@ Route::get('one-to-many', 'OneToManyController@oneToMany');
Route::get('one-to-one', 'OneToOneController@oneToOne'); Route::get('one-to-one', 'OneToOneController@oneToOne');
Route::any('agendamentos/search', 'AgendamentoController@search')->name('agendamentos.search')->middleware('auth');//->middleware('auth'); Route::any('agendamentos/search', 'AgendamentoController@search')->name('agendamentos.search')->middleware('auth');//->middleware('auth');
Route::any('titulos/search', 'TituloController@search')->name('titulos.search')->middleware('auth');//->middleware('auth'); Route::any('titulos/search', 'TituloController@search')->name('titulos.search')->middleware('auth');//->middleware('auth');
Route::resource('titulos', 'TituloController')->middleware('auth'); Route::resource('titulos', 'TituloController');//->middleware('auth');
// Route::get('titulos/{id}', 'TituloController@show')->name('titulos.show');//->middleware('auth');
Route::resource('agendamentos', 'AgendamentoController')->middleware('auth'); Route::resource('agendamentos', 'AgendamentoController')->middleware('auth');
Route::any('lotes/search', 'LoteController@search')->name('lotes.search'); Route::any('lotes/search', 'LoteController@search')->name('lotes.search');
Route::resource('lotes', 'LoteController')->middleware('auth'); Route::resource('lotes', 'LoteController')->middleware('auth');
......
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