Unverified Commit 84e19071 authored by Antônio Durval's avatar Antônio Durval Committed by GitHub
Browse files

Merge pull request #905 from antonioDurval/master

Adição de restrição de datas para poder add integrantes aos editais P…
parents 1a5fa378 66556b90
......@@ -459,6 +459,9 @@ class TrabalhoController extends Controller
}
}
$hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString();
return view('projeto.visualizar')->with(['projeto' => $projeto,
......@@ -478,7 +481,8 @@ class TrabalhoController extends Controller
'trabalhos_user' => $trabalhos_user,
'AvalRelatParcial' => $AvalRelatParcial,
'AvalRelatFinal' => $AvalRelatFinal,
'proponente' => $proponente
'proponente' => $proponente,
'hoje' => $hoje
]);
}
......@@ -1215,6 +1219,10 @@ class TrabalhoController extends Controller
return redirect(route('trabalho.show', ['id' => $id]))->with(['mensagem' => "Já existe um Integrante com esse CPF."]);
}
if(!$this->validarDataResultadoFinalPibex($id)) {
return redirect(route('trabalho.show', ['id' => $id]))->with(['mensagem' => "Só é possivel adicionar integrantes após a data do Resultado final"]);
}
$atributos = ['user_id' => $usuario->id,
'funcao_participante_id' => $request->funcao_participante,
......@@ -1275,6 +1283,19 @@ class TrabalhoController extends Controller
return true;
}
private function validarDataResultadoFinalPibex($id) {
$hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString();
$edital = Trabalho::where('id', $id)->first()->evento;
if($edital->tipo == "PIBEX" && $hoje <= $edital->resultado_final){
return false;
}
return true;
}
public function buscarUsuario(Request $request) {
$usuario = User::where('cpf', $request->cpf_consulta)->first();
$funcao = FuncaoParticipantes::where('id', $request->funcao)->first();
......
......@@ -9,9 +9,11 @@
<a href="{{route('trabalho.trocaParticipante', ['evento_id' => $projeto->evento->id, 'projeto_id' => $projeto->id])}}"
class="button">Solicitar Substituições/Desligamentos</a>
</div>
@if(($projeto->evento->tipo == "PIBEX" && $hoje > $projeto->evento->resultado_final) || $projeto->evento->tipo == "CONTINUO")
<div class="col-sm-3 text-sm-right" >
<a href="" data-toggle="modal" data-target="#modalAdicionarParticipante" class="button">Adicionar Participante</a>
</div>
@endif
</div>
<hr style="border-top: 1px solid#1492E6">
......
......@@ -38,7 +38,7 @@
@endif
@if($edital->natureza_id == 3)
@component('projeto.formularioVisualizar.integrantes', ['projeto' => $projeto, 'edital' => $edital, 'trabalhos_user' => $trabalhos_user,'funcaoParticipantes' =>$funcaoParticipantes])
@component('projeto.formularioVisualizar.integrantes', ['projeto' => $projeto, 'edital' => $edital, 'trabalhos_user' => $trabalhos_user,'funcaoParticipantes' =>$funcaoParticipantes, 'hoje' => $hoje])
@endcomponent
@endif
......
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