Commit 0a5f7e77 authored by sandroresende's avatar sandroresende

correcao edicao demanda e mod debendures

parent 6d4bcccd
This diff is collapsed.
<?php
namespace App\Http\Controllers\Mod_debendures_reidi;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Mod_debendures_reidi\Projetos;
use App\Mod_debendures_reidi\ViewProjetosDebenduresReidi;
use App\User;
use DB;
use Illuminate\Support\Facades\Auth;
class DebenduresReidiController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
//$this->middleware('redirecionar');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function consultarProjeto()
{
$usuario = Auth::user();
return view('modulo_debendures_reidi.Consultar_projeto', compact('usuario'));
}
public function pesquisarProjeto(Request $request)
{
$usuario = Auth::user();
// return $request->all();
$where = [];
if ($request->estado) {
$where[] = ['sg_uf', $request->estado];
}
if ($request->setor_projeto) {
$where[] = ['setor_projeto_id', $request->setor_projeto];
}
if ($request->tipo_projeto) {
$where[] = ['tipo_projeto_id', $request->tipo_projeto];
}
$projetos = ViewProjetosDebenduresReidi::where($where)->orderBy('sg_uf')->get();
if (count($projetos) == 0) {
flash()->erro("Erro", "Não existe projeto para os parametros selecionados.");
return back();
}
return view('modulo_debendures_reidi.Lista_projeto', compact('usuario', 'projetos'));
return view('modulo_debendures_reidi.consultar_projeto', compact('usuario'));
}
public function dadosProjeto(Projetos $projeto)
{
$projeto->load('tipoProjeto', 'setorProjeto');
return view('modulo_debendures_reidi.dados_projeto', compact('projeto'));
}
}
<?php
namespace App\Mod_debendures_reidi;
use Illuminate\Database\Eloquent\Model;
class Projetos extends Model
{
protected $connection = 'pgsql_corp';
protected $table = 'mcid_debendures_reidi.tab_projetos';
public $timestamps = true; // tabela não possui coluna de data de criação/atualização
public function tipoProjeto()
{
return $this->belongsTo(TipoProjeto::class);
}
public function setorProjeto()
{
return $this->belongsTo(SetorProjeto::class);
}
}
<?php
namespace App\Mod_debendures_reidi;
use Illuminate\Database\Eloquent\Model;
class SetorProjeto extends Model
{
protected $connection = 'pgsql_corp';
protected $table = 'mcid_debendures_reidi.opc_setor_projeto';
public $timestamps = false; // tabela não possui coluna de data de criação/atualização
public function projetos()
{
return $this->hasMany(Projetos::class);
}
}
<?php
namespace App\Mod_debendures_reidi;
use Illuminate\Database\Eloquent\Model;
class TipoProjeto extends Model
{
protected $connection = 'pgsql_corp';
protected $table = 'mcid_debendures_reidi.opc_tipo_projeto';
public $timestamps = false; // tabela não possui coluna de data de criação/atualização
public function projetos()
{
return $this->hasMany(Projetos::class);
}
}
<?php
namespace App\Mod_debendures_reidi;
use Illuminate\Database\Eloquent\Model;
class ViewProjetosDebenduresReidi extends Model
{
protected $connection = 'pgsql_corp';
protected $table = 'mcid_debendures_reidi.view_projetos_debendures_reidi';
public $timestamps = false; // tabela não possui coluna de data de criação/atualização
}
This diff is collapsed.
......@@ -112,8 +112,11 @@ Vue.component('cadastro-encaminhamento', require('./components/mod_codem/Cadastr
Vue.component('cadastro-observacao-demanda', require('./components/mod_codem/CadastroObservacaoDemanda.vue'));
Vue.component('filtro-demandas', require('./components/mod_codem/FiltroDemandas.vue'));
/**DEBENDURES E REIDI */
Vue.component('filtro-debendures-reidi', require('./components/mod_debendures_reidi/FiltroDebenduresReidi.vue'));
Vue.component('projeto-debendures-reidi', require('./components/mod_debendures_reidi/ProjetoDebenduresReidi.vue'));
......
......@@ -270,7 +270,7 @@
municipio:'',
textoEscolhaMunicipio: 'Filtre o Estado',
buscando: false,
situacaoDemanda:'',
situacaoDemanda:'1',
situacaoDemandas:'',
tipoDemanda:'',
tiposDemanda:'',
......@@ -505,7 +505,7 @@
axios.get(this.url + '/api/situacao_demanda').then(resposta => {
//console.log(resposta.data);
this.situacaoDemandas = resposta.data;
this.situacaoDemanda = 1;
}).catch(erro => {
console.log(erro);
});
......
<template>
<div class="form-group">
<div class="row" v-if="!(codSaci || codMCidades)">
<div class="column col-xs-12 col-md-2">
<label for="uf">UF</label>
<select
id="estado"
class="form-select br-select"
name="estado"
@change="onChangeEstado"
v-model="estado">
<option value="">Escolha um Estado:</option>
<option v-for="estado in estados" v-text="estado.sg_uf" :value="estado.sg_uf" :key="estado.sg_uf"></option>
</select>
</div>
<div class="column col-xs-12 col-md-5">
<label for="tipo_projeto">Tipo de Projeto</label>
<select
id="tipo_projeto"
class="form-select br-select"
name="tipo_projeto"
v-model="tipo_projeto">
<option value="">Escolha um tipo projeto:</option>
<option v-for="tipo_projeto in tipo_projetos" v-text="tipo_projeto.txt_tipo_projeto" :value="tipo_projeto.id" :key="tipo_projeto.id"></option>
</select>
</div>
<div class="column col-xs-12 col-md-5">
<label for="setor_projeto">Setor de Projeto</label>
<select
id="setor_projeto"
class="form-select br-select"
name="setor_projeto"
v-model="setor_projeto">
<option value="">Escolha um setor projeto:</option>
<option v-for="setor_projeto in setor_projetos" v-text="setor_projeto.txt_setor_projeto" :value="setor_projeto.id" :key="setor_projeto.id"></option>
</select>
</div>
</div>
</div>
</template>
<script>
export default {
props:['url'],
data(){
return{
estados:'',
estado:'',
tipo_projetos:'',
tipo_projeto:'',
setor_projetos:'',
setor_projeto:'',
}
},
methods:{
onChangeEstado() {
this.textoEscolhaMunicipio = "Buscando...";
this.municipio = '';
this.buscando = true;
if(this.estado != '') {
//busca dados no banco de dados para carregar no componente
axios.get(this.url + '/api/municipios/' + this.estado).then(resposta => {
this.textoEscolhaMunicipio = "Escolha um municipio:";
this.buscando = false;
this.municipios = resposta.data;
console.log(this.municipios);
}).catch(error => {
console.log(error);
});
} else {
this.buscando = false;
this.municipio = '';
this.textoEscolhaMunicipio = "Filtre o Estado"
}
}
} ,
mounted() {
//console.log(this.form._token);
axios.get(this.url + '/api/debendures/ufs').then(resposta => {
//console.log(resposta.data);
this.estados = resposta.data;
this.estado = '';
this.municipio = '';
}).catch(erro => {
console.log(erro);
})
//tipo projeto
axios.get(this.url + '/api/debendures/tipo_projeto').then(resposta => {
//console.log(resposta.data);
this.tipo_projetos = resposta.data;
}).catch(erro => {
console.log(erro);
})
//setor projeto
axios.get(this.url + '/api/debendures/setor_projeto').then(resposta => {
//console.log(resposta.data);
this.setor_projetos = resposta.data;
}).catch(erro => {
console.log(erro);
})
}
}
</script>
<template>
<div class="form-group">
<div class="row" v-if="!(codSaci || codMCidades)">
<div class="column col-xs-12 col-md-2">
<label for="uf">UF</label>
<select
id="estado"
class="form-select br-select"
name="estado"
@change="onChangeEstado"
v-model="estado">
<option value="">Escolha um Estado:</option>
<option v-for="estado in estados" v-text="estado.sg_uf" :value="estado.sg_uf" :key="estado.sg_uf"></option>
</select>
</div>
<div class="column col-xs-12 col-md-5">
<label for="tipo_projeto">Tipo de Projeto</label>
<select
id="tipo_projeto"
class="form-select br-select"
name="tipo_projeto"
v-model="tipo_projeto">
<option value="">Escolha um tipo projeto:</option>
<option v-for="tipo_projeto in tipo_projetos" v-text="tipo_projeto.txt_tipo_projeto" :value="tipo_projeto.id" :key="tipo_projeto.id"></option>
</select>
</div>
<div class="column col-xs-12 col-md-5">
<label for="setor_projeto">Setor de Projeto</label>
<select
id="setor_projeto"
class="form-select br-select"
name="setor_projeto"
v-model="setor_projeto">
<option value="">Escolha um setor projeto:</option>
<option v-for="setor_projeto in setor_projetos" v-text="setor_projeto.txt_setor_projeto" :value="setor_projeto.id" :key="setor_projeto.id"></option>
</select>
</div>
</div>
</div>
</template>
<script>
export default {
props:['url','dados'],
data(){
return{
estados:'',
estado:'',
tipo_projetos:'',
tipo_projeto:'',
setor_projetos:'',
setor_projeto:'',
}
},
methods:{
onChangeEstado() {
this.textoEscolhaMunicipio = "Buscando...";
this.municipio = '';
this.buscando = true;
if(this.estado != '') {
//busca dados no banco de dados para carregar no componente
axios.get(this.url + '/api/municipios/' + this.estado).then(resposta => {
this.textoEscolhaMunicipio = "Escolha um municipio:";
this.buscando = false;
this.municipios = resposta.data;
console.log(this.municipios);
}).catch(error => {
console.log(error);
});
} else {
this.buscando = false;
this.municipio = '';
this.textoEscolhaMunicipio = "Filtre o Estado"
}
}
} ,
mounted() {
//console.log(this.form._token);
axios.get(this.url + '/api/debendures/ufs').then(resposta => {
//console.log(resposta.data);
this.estados = resposta.data;
this.estado = '';
this.municipio = '';
}).catch(erro => {
console.log(erro);
})
//tipo projeto
axios.get(this.url + '/api/debendures/tipo_projeto').then(resposta => {
//console.log(resposta.data);
this.tipo_projetos = resposta.data;
}).catch(erro => {
console.log(erro);
})
//setor projeto
axios.get(this.url + '/api/debendures/setor_projeto').then(resposta => {
//console.log(resposta.data);
this.setor_projetos = resposta.data;
}).catch(erro => {
console.log(erro);
})
if(this.dados){
this.estado = this.dados.sg_uf;
}
}
}
</script>
......@@ -44,6 +44,19 @@
</ul>
</div>
<!-- inicio menu Documentos-->
<div class="menu-folder"><a class="menu-item" href="javascript: void(0)"><span class="icon">
<i class="bi bi-journal-text fa-lg"></i></span><span class="content">Debendures e Reidi</span></a>
<ul>
<li><a class="menu-item" href="{{ url('/debendures_reidi/projetos/consultar') }}" title="Consultar Projeto"><span class="icon">
<i class="bi bi-journal-arrow-up fa-lg"></i></span><span class="content">Consultar Projeto</span></a>
</li>
</ul>
</div>
<!-- inicio menu Seleção de Propostas-->
<div class="menu-folder"><a class="menu-item" href="javascript: void(0)"><span class="icon">
......
@extends('layouts.app')
@section('content')
<historico-navegacao
:url="'{{ url('/home') }}'"
:telanterior01="'Debendures e Reidi'"
:telatual="'Consultar Debendures e Reidi'"
>
</historico-navegacao>
<div class="main-content pl-sm-3 mt-5 container-fluid" id="main-content">
<cabecalho-relatorios
:titulo="'Consultar Debendures e Reidi'"
:linkcompartilhar="'{{ url("/") }}'"
:barracompartilhar="false">
</cabecalho-relatorios>
<form role="form" method="POST" action='{{ url("debendures_reidi/projetos/pesquisar") }}'>
@csrf
<filtro-debendures-reidi :url="'{{ url('/') }}'"></filtro-debendures-reidi>
<div class="p-3 text-right">
<button class="br-button primary mr-3" type="submit" name="Salvar Edição">Pesquisar
</button>
<button class="br-button danger mr-3" type="button" onclick="javascript:window.history.go(-1)">Voltar
</button>
</div>
</form>
</div>
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('content')
<historico-navegacao
:url="'{{ url('/home') }}'"
:telanterior01="'Debendures e Reidi'"
:telanterior02="'Consultar Debendures e Reidi'"
:telanterior03="'Lista Debendures e Reidi'"
:telatual="'Dados do Projeto'"
>
</historico-navegacao>
<div class="main-content pl-sm-3 mt-5 container-fluid" id="main-content">
<cabecalho-relatorios
:titulo="'{{$projeto->txt_titular_projeto}}'"
:subtitulo1="'{{$projeto->tipoProjeto->txt_tipo_projeto}}'"
:subtitulo2="'{{$projeto->setorProjeto->txt_setor_projeto}}'"
:subtitulo3="'{{$projeto->sg_uf}}'"
:linkcompartilhar="'{{ url("/debendures_reidi/projeto/".$projeto->id) }}'"
@if($projeto->updated_at)
:dataatualizacao="'{{date('d/m/Y',strtotime($projeto->updated_at))}}'"
@elseif($projeto->created_at)
:dataatualizacao="'{{date('d/m/Y',strtotime($projeto->created_at))}}'"
@endif
:barracompartilhar="true">
</cabecalho-relatorios>
<form role="form" method="POST" action='{{ url("debendures_reidi/projeto/update") }}'>
@csrf
<projeto-debendures-reidi
:url="'{{ url('/') }}'"
v-bind:dados="{{$projeto}}"
></projeto-debendures-reidi>
<div class="p-3 text-right">
<button class="br-button primary mr-3" type="button" name="imprimir" value="Imprimir" onclick="window.print();">Imprimir
</button>
<button class="br-button danger mr-3" type="button" onclick="javascript:window.history.go(-1)">Voltar
</button>
</div>
</form>
</div>
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('content')
<historico-navegacao
:url="'{{ url('/home') }}'"
:telanterior01="'Debendures e Reidi'"
:telanterior01="'Consultar Debendures e Reidi'"
:telatual="'Lista Debendures e Reidi'"
>
</historico-navegacao>
<div class="main-content pl-sm-3 mt-5 container-fluid" id="main-content">
<cabecalho-relatorios
:titulo="'Lista Debendures e Reidi'"
:linkcompartilhar="'{{ url("/") }}'"
:barracompartilhar="false">
</cabecalho-relatorios>
@if(count($projetos) > 0)
<div class="table-responsive-sm">
<table class="table table-hover">
<thead>
<tr class="text-center" >
<th>
ID
</th>
<th>UF</th>
<th>Tipo Projeto</th>
<th>Setor</th>
<th>Titular do Projeto</th>
<th>Nome do Projeto</th>
<th>Portaria</th>
<th>Data da Portaria</th>
<th>Valor do Projeto</th>
<th>Valor Estimado</th>
<th>Última Atualização</th>
<th class="text-center">Ação</th>
</tr>
</thead>
<tbody>
@foreach($projetos as $dados)
@if($dados->updated_at)
<tr class="text-center" >
@else
<tr class="text-center table-danger" >
@endif
<td>
{{$dados->id}}
</td>
<td>{{$dados->sg_uf}}</td>
<td>{{$dados->txt_tipo_projeto}}</td>
<td>{{$dados->txt_setor_projeto}}</td>
<td>{{$dados->txt_titular_projeto}}</td>
<td>{{$dados->txt_nome_projeto}}</td>
<td>{{$dados->num_portaria}}</td>
<td> {{date('d/m/Y',strtotime($dados->dte_portaria))}} </td>
<td>{{number_format( ($dados->vlr_projeto), 2, ',' , '.')}}</td>
<td>{{number_format( ($dados->vlr_estimado), 2, ',' , '.')}}</td>
<td>@if($dados->updated_at) {{date('d/m/Y',strtotime($dados->updated_at))}} @endif</td>
<td class="p-3 text-right">
<button type="button" class="br-button circle secondary small mr-3" aria-label="Ícone ilustrativo"
onclick='window.location.href="{{ url("debendures_reidi/projeto/$dados->id")}}"'>
<i class="fas fa-eye" aria-hidden="true"></i>
</button>
</td>
</tr>
@endforeach
</tbody><!-- fechar tbody-->
</table><!-- fechar table-->
</div> <!-- table-responsive-sm -->
@endif
<div class="p-3 text-right">
<button class="br-button primary mr-3" type="button" name="imprimir" value="Imprimir" onclick="window.print();">Imprimir
</button>
<button class="br-button danger mr-3" type="button" onclick="javascript:window.history.go(-1)">Voltar
</button>
</div>
</div>
@endsection
\ No newline at end of file
......@@ -155,7 +155,7 @@ Route::get('/rps/situacaoPropostasAjustadas', 'ApiController@listaSituacaoPropos
//DEBENDURES
Route::get('/debendures/ufs', 'ApiController@buscarEstadosDebendures');
Route::get('/debendures/tipo_projeto', 'ApiController@buscarTipoProjetoDebendures');
Route::get('/debendures/setor_projeto', 'ApiController@buscarSetorProjetoDebendures');
......@@ -12,7 +12,7 @@
*/
Route::get('/', function () {
return view('welcome');
});
......@@ -347,3 +347,7 @@ Route::get('/codem/demanda/observacao/excluir/{observacao}', 'Mod_codem\Observac
//////módulo CODEM
//módulo debendures e reidi
Route::get('/debendures_reidi/projetos/consultar', 'Mod_debendures_reidi\DebenduresReidiController@consultarProjeto');
Route::post('/debendures_reidi/projetos/pesquisar', 'Mod_debendures_reidi\DebenduresReidiController@pesquisarProjeto');
Route::get('/debendures_reidi/projeto/{projeto}', 'Mod_debendures_reidi\DebenduresReidiController@dadosProjeto');
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