Unverified Commit 292ba98e authored by Gabriel Antônio da Silva's avatar Gabriel Antônio da Silva Committed by GitHub
Browse files

Merge pull request #67 from lmts-ufape/editarProjeto

add de planos de trabalho em avaliador e restricao em editar projeto
parents 7ccae9d4 6804f40a
......@@ -86,8 +86,11 @@ class ProponenteController extends Controller
$proponente = Proponente::where('user_id', Auth()->user()->id)->first();
$projetos = Trabalho::where('proponente_id', $proponente->id)->get();
$hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString();
return view('proponente.projetos')->with(['projetos' => $projetos]);
return view('proponente.projetos')->with(['projetos' => $projetos, 'hoje'=>$hoje]);
}
public function projetosEdital($id) {
$edital = Evento::find($id);
......
......@@ -38,7 +38,7 @@ class UserController extends Controller
public function inicial()
{
$eventos = Evento::all();
$hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString();
return view('index', ['eventos' => $eventos, 'hoje' => $hoje]);
......@@ -48,7 +48,7 @@ class UserController extends Controller
function perfil(){
$user = User::find(Auth::user()->id);
return view('user.perfilUser',['user'=>$user]);
}
function editarPerfil(Request $request){
......@@ -85,34 +85,41 @@ class UserController extends Controller
'bolsistaProdutividade' => Rule::requiredIf((isset($request['cargo']) && $request['cargo'] !== 'Estudante') || (isset($request['cargo']) && $request['cargo'] === 'Estudante' && isset($request['vinculo']) && $request['vinculo'] === 'Pós-doutorando')),
'nivel' => ['required_if:bolsistaProdutividade,sim'],
//'nivel' => [(isset($request['cargo']) && $request['cargo'] !== 'Estudante') || (isset($request['cargo']) && $request['cargo'] === 'Estudante' && isset($request['vinculo']) && $request['vinculo'] === 'Pós-doutorando') ? 'required':''],
'linkLattes' => ['required_with:titulacaoMaxima,anoTitulacao,areaFormacao,bolsistaProdutividade'],
'linkLattes' => ['required_with:titulacaoMaxima,anoTitulacao,areaFormacao,bolsistaProdutividade'],
'linkLattes' => [(isset($request['cargo']) && $request['cargo'] !== 'Estudante') || (isset($request['cargo']) && $request['cargo'] === 'Estudante' && isset($request['vinculo']) && $request['vinculo'] === 'Pós-doutorando') ? 'required':''],
'linkLattes' => [(isset($request['cargo']) && $request['cargo'] !== 'Estudante') || (isset($request['cargo']) && $request['cargo'] === 'Estudante' && isset($request['vinculo']) && $request['vinculo'] === 'Pós-doutorando') ? 'link_lattes':''],
]);
}
if ($request->alterarSenhaCheckBox != null) {
if (!(Hash::check($request->senha_atual, $user->password))) {
return redirect()->back()->withErrors(['senha_atual' => 'Senha atual não correspondente']);
}
if (!($request->nova_senha === $request->confirmar_senha)) {
return redirect()->back()->withErrors(['nova_senha' => 'Senhas diferentes']);
}
}
if(Auth()->user()->avaliadors != null && $request->area != null && Auth()->user()->tipo != "avaliador"){
$avaliador = Avaliador::where('user_id', '=', $id)->first();
$avaliador->user_id = $user->id;
$avaliador->area_id = $request->area;
$avaliador->update();
}
switch ($request->tipo) {
case "administradorResponsavel":
case "administradorResponsavel":
$adminResp = AdministradorResponsavel::where('user_id', '=', $id)->first();
$adminResp->user_id = $user->id;
$adminResp->update();
break;
case "avaliador":
case "avaliador":
$avaliador = Avaliador::where('user_id', '=', $id)->first();
$avaliador->user_id = $user->id;
$avaliador->area_id = $request->area;
$avaliador->update();
break;
case "proponente":
case "proponente":
$proponente = Proponente::where('user_id', '=', $id)->first();
if ($request->SIAPE != null) {
$proponente->SIAPE = $request->SIAPE;
......@@ -138,8 +145,8 @@ class UserController extends Controller
$proponente->update();
break;
case "participante":
$participante = Participante::where('user_id', '=', $id)->first();
//$participante = $user->participantes->where('user_id', Auth::user()->id)->first();
$participante = Participante::where('user_id', '=', $id)->first();
//$participante = $user->participantes->where('user_id', Auth::user()->id)->first();
$participante->user_id = $user->id;
//dd($participante);
if($user->usuarioTemp == true){
......@@ -187,7 +194,7 @@ class UserController extends Controller
public function minhaConta() {
$id = Auth::user()->id;
$user = User::find($id);
$adminResp = AdministradorResponsavel::where('user_id', '=', $id)->first();
$avaliador = Avaliador::where('user_id', '=', $id)->first();
$proponente = Proponente::where('user_id', '=', $id)->first();
......
......@@ -7,14 +7,14 @@
<div class="container" >
<div class="row" >
<div class="col-sm-12">
<h3>Meus Editais</h3>
<h3>Meus Editais</h3>
</div>
</div>
</div>
<hr>
<table class="table table-bordered">
<thead>
<tr>
<tr>
<th scope="col">Nome do Edital</th>
<th scope="col">Data de Inicio da Revisão</th>
<th scope="col">Data de Fim da Revisão</th>
......@@ -24,7 +24,7 @@
<tbody>
@foreach ($eventos as $evento)
<tr>
<td>
<td>
{{ $evento->nome }}
</td>
<td>{{ date('d/m/Y', strtotime($evento->inicioRevisao)) }}</td>
......@@ -32,15 +32,15 @@
<td>
<div class="btn-group dropright dropdown-options">
<a id="options" class="dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="{{asset('img/icons/ellipsis-v-solid.svg')}}" style="width:8px">
<img src="{{asset('img/icons/ellipsis-v-solid.svg')}}" style="width:8px">
</a>
<div class="dropdown-menu">
@if(!is_null(Auth::user()->avaliadors->eventos->where('id', 1)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == true )
@if(!is_null(Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == true )
<a href="{{ route('avaliador.visualizarTrabalho', ['evento_id' => $evento->id]) }}" class="dropdown-item">
<img src="{{asset('img/icons/eye-regular.svg')}}" class="icon-card" alt="">
Projetos para avaliar
</a>
@elseif(!is_null(Auth::user()->avaliadors->eventos->where('id', 1)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == false)
@elseif(!is_null(Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == false)
<button disabled="disabled" class="dropdown-item">
Convite recusado
</button>
......@@ -54,10 +54,10 @@
Recusar Convite
</a>
@endif
</div>
</div>
</td>
......@@ -71,6 +71,6 @@
@section('javascript')
<script>
</script>
@endsection
......@@ -7,17 +7,18 @@
<div class="container" >
<div class="row" >
<div class="col-sm-10">
<h3>Trabalhos do Edital: {{ $evento->nome }}</h3>
<h3>Trabalhos do Edital: {{ $evento->nome }}</h3>
</div>
</div>
</div>
<hr>
<table class="table table-bordered">
<thead>
<tr>
<tr>
<th scope="col">Nome do Projeto</th>
<th scope="col">Data de Criação</th>
<th scope="col">Baixar</th>
<th scope="col">Projeto</th>
<th scope="col">Plano de Trabalho</th>
<th scope="col">Parecer</th>
</tr>
</thead>
......@@ -32,6 +33,24 @@
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:20px">
</a>
</td>
<td>
@foreach( $trabalho->participantes as $participante)
@php
if( App\Arquivo::where('participanteId', $participante->pivot->participante_id)->first() != null){
$planoTrabalho = App\Arquivo::where('participanteId', $participante->pivot->participante_id)->first()->nome;
}else{
$planoTrabalho = null;
}
@endphp
@if ($planoTrabalho != null)
<a href="{{route('download', ['file' => $planoTrabalho])}}" target="_new" style="font-size: 20px; color: #114048ff;" >
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:20px">
</a>
@else
Não planos de trabalho.
@endif
@endforeach
</td>
<td>
<div class="row">
<form action="{{ route('avaliador.parecer', ['evento' => $evento]) }}" method="POST">
......@@ -40,7 +59,7 @@
<button type="submit" class="btn btn-primary mr-2 ml-2" >
Parecer
</button>
</form>
</div>
</td>
......@@ -54,6 +73,6 @@
@section('javascript')
<script>
</script>
@endsection
......@@ -14,14 +14,14 @@
<div class="container" >
<div class="row" >
<div class="col-sm-12">
<h3>Meus Projetos</h3>
<h3>Meus Projetos</h3>
</div>
</div>
</div>
<hr>
<table class="table table-bordered">
<thead>
<tr>
<tr>
<th scope="col">Nome do projeto</th>
<th scope="col">Status</th>
<th scope="col">Data de Criação</th>
......@@ -30,7 +30,7 @@
</thead>
<tbody>
@foreach ($projetos as $projeto)
<tr>
<td>
{{ $projeto->titulo }}
......@@ -42,16 +42,19 @@
@elseif($projeto->status == 'Rascunho')
<td style="color: rgb(0, 0, 0)">Rascunho</td>
@endif
<td>{{ date('d-m-Y', strtotime($projeto->updated_at)) }}</td>
<td>{{ date('d-m-Y', strtotime($projeto->updated_at)) }}</td>
<td>
<div class="btn-group dropright dropdown-options">
<a id="options" class="dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="{{asset('img/icons/ellipsis-v-solid.svg')}}" style="width:8px">
<img src="{{asset('img/icons/ellipsis-v-solid.svg')}}" style="width:8px">
</a>
<div class="dropdown-menu">
@if($projeto->evento->inicioSubmissao <= $hoje && $hoje <= $projeto->evento->fimSubmissao)
<a href="{{ route('trabalho.editar', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center;">
Editar projeto
</a>
@else
@endif
<a href="{{ route('trabalho.show', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center">
Visualizar projeto
</a>
......@@ -61,13 +64,13 @@
<a href="" class="dropdown-item" style="text-align: center">
Resultado
</a> --}}
@if($projeto->status == 'Submetido')
@if($projeto->status == 'Submetido')
<!-- Button trigger modal -->
<button type="button" class="dropdown-item" style="text-align: center" data-toggle="modal" data-target="#modal{{$projeto->id}}">
Excluir projeto
</button>
@endif
</div>
</div>
</td>
......@@ -105,4 +108,4 @@
<script>
</script>
@endsection
\ No newline at end of file
@endsection
......@@ -66,9 +66,12 @@
<img src="{{asset('img/icons/ellipsis-v-solid.svg')}}" style="width:8px">
</a>
<div class="dropdown-menu">
@if($edital->inicioSubmissao <= $hoje && $hoje <= $edital->fimSubmissao)
<a href="{{ route('trabalho.editar', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center;">
Editar projeto
</a>
@else
@endif
<a href="{{ route('trabalho.show', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center">
Visualizar projeto
</a>
......
......@@ -59,13 +59,13 @@
<option @if( $user->instituicao == "UFAPE") selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option>
<option @if(old('instituicaoSelect') == "Outra") selected @endif value="Outra">Outra</option>
</select>
@error('instituicaoSelect')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class='col-md-4' style="display: none;">
<label for="instituicao" class="col-form-label">{{ __('Digite a Instituição*') }}</label>
<input id="instituicao" type="text" class="form-control @error('instituicao') is-invalid @enderror" name="instituicao" value="{{ old('instituicao') }}" placeholder="Digite o nome da Instituição" autocomplete="instituicao" autofocus>
......@@ -73,7 +73,7 @@
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
@enderror
</div>
<div class="col-md-2">
<label for="celular" class="col-form-label">{{ __('Celular*') }}</label>
......@@ -95,6 +95,38 @@
</span>
@enderror
</div>
@if(Auth()->user()->avaliadors)
<div class="col-md-4">
<label for="area" class="col-form-label">{{ __('Área:') }}</label>
<select style="display: inline" class="form-control @error('area') is-invalid @enderror" name="area" id="area">
@if(Auth()->user()->avaliadors->area_id == null)
<option value="" selected>Indefinida</option>
@foreach (App\Area::all() as $area)
@if(Auth()->user()->avaliadors->area_id == $area->id)
<option value="{{ $area->id }}" selected>{{ $area->nome }}</option>
@else
<option value="{{ $area->id }}" >{{ $area->nome }}</option>
@endif
@endforeach
@else
@foreach (App\Area::all() as $area)
@if(Auth()->user()->avaliadors->area_id == $area->id)
<option value="{{ $area->id }}" selected>{{ $area->nome }}</option>
@else
<option value="{{ $area->id }}" >{{ $area->nome }}</option>
@endif
@endforeach
@endif
</select>
@error('area')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
@endif
</div>
<div class="form-group row">
<div class="col-md-4">
......@@ -137,7 +169,7 @@
@enderror
</div>
</div>
@if(isset($proponente))
<div id="proponente" style="display: block;">
......@@ -153,14 +185,14 @@
<option @if( $proponente->cargo =='Técnico' ) selected @endif value="Técnico">Técnico</option>
<option @if( $proponente->cargo =='Estudante' ) selected @endif value="Estudante">Estudante</option>
</select>
@error('cargo')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-4">
<label for="vinculo" class="col-form-label">{{ __('Vínculo*') }}</label>
<select name="vinculo" id="vinculo" class="form-control @error('vinculo') is-invalid @enderror" onchange="outroVinculo()">
......@@ -174,18 +206,18 @@
<option value="{{ $proponente->vinculo }}" selected >{{ $proponente->vinculo }}</option>
@endif
</select>
@error('vinculo')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-4" style="display: none;" id="divOutro">
<label for="outro" class="col-form-label">{{ __('Qual?*') }}</label>
<input id="outro" type="text" class="form-control @error('outro') is-invalid @enderror" name="outro" value="{{ old('outro') }}">
@error('outro')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
......@@ -193,7 +225,7 @@
@enderror
</div>
</div>
<div style="display: block;">
<div class="form-group row">
<div class="col-md-4">
......@@ -206,18 +238,18 @@
<option @if( $proponente->titulacaoMaxima =='Graduação' ) selected @endif value="Graduação">Graduação</option>
<option @if( $proponente->titulacaoMaxima =='Técnico' ) selected @endif value="Técnico">Técnico</option>
</select>
@error('titulacaoMaxima')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-4">
<label for="anoTitulacao" class="col-form-label">{{ __('Ano da Titulação*') }}</label>
<input id="anoTitulacao" type="text" class="form-control @error('anoTitulacao') is-invalid @enderror" name="anoTitulacao" value="{{ $proponente->anoTitulacao }}" autocomplete="nome">
@error('anoTitulacao')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
......@@ -227,7 +259,7 @@
<div class="col-md-4">
<label for="areaFormacao" class="col-form-label">{{ __('Área de Formação*') }}</label>
<input id="areaFormacao" type="text" class="form-control @error('areaFormacao') is-invalid @enderror" name="areaFormacao" value="{{ $proponente->areaFormacao }}" autocomplete="nome">
@error('areaFormacao')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
......@@ -235,31 +267,31 @@
@enderror
</div>
</div>
<div class="form-group row">
<div class="col-md-4">
<label for="SIAPE" class="col-form-label">{{ __('SIAPE') }}</label>
<input id="SIAPE" type="text" class="form-control @error('SIAPE') is-invalid @enderror" name="SIAPE" value="{{ $proponente->SIAPE }}" autocomplete="nome">
@error('SIAPE')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-4">
<label for="linkLattes" class="col-form-label">{{ __('Link do currículo Lattes*') }}</label>
<input id="linkLattes" type="text" class="form-control @error('linkLattes') is-invalid @enderror" name="linkLattes" value="{{ $proponente->linkLattes }}" autocomplete="nome">
@error('linkLattes')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-3">
<label for="bolsistaProdutividade" class="col-form-label">{{ __('Bolsista de Produtividade*') }}</label><br>
<select name="bolsistaProdutividade" id="bolsistaProdutividade" class="form-control @error('bolsistaProdutividade') is-invalid @enderror" onchange="mudarNivel()">
......@@ -273,12 +305,12 @@
</span>
@enderror
</div>
@if ($proponente->bolsistaProdutividade =='sim')
<div class="col-md-1" id="nivelInput" style="display: block;">
<label for="nivel" class="col-form-label">{{ __('Nível*') }}</label>
<select name="nivel" id="nivel" class="form-control @error('nivel') is-invalid @enderror">
<option value="" disabled selected hidden></option>
<option value="" disabled selected hidden></option>
<option @if( $proponente->nivel =='1A' ) selected @endif value="1A">1A</option>
<option @if( $proponente->nivel =='1B' ) selected @endif value="1B">1B</option>
<option @if( $proponente->nivel =='1C' ) selected @endif value="1C">1C</option>
......@@ -295,7 +327,7 @@
<div class="col-md-1" id="nivelInput" style="display: none;">
<label for="nivel" class="col-form-label">{{ __('Nível*') }}</label>
<select name="nivel" id="nivel" class="form-control @error('nivel') is-invalid @enderror">
<option value="" disabled selected hidden></option>
<option value="" disabled selected hidden></option>
<option value="1A">1A</option>
<option value="1B">1B</option>
<option value="1C">1C</option>
......@@ -315,10 +347,10 @@
</div>
@endif
</form>
<div class="container">
<div class="row justify-content-center" style="margin: 20px 0 20px 0">
<div class="col-md-6" style="padding-left:0">
<a class="btn btn-secondary botao-form" href="{{ route('home') }}" style="width:100%">Cancelar</a>
</div>
......@@ -393,14 +425,14 @@
function mudar() {
var divProponente = document.getElementById('proponente');
var comboBoxTipo = document.getElementById('tipo');
if (comboBoxTipo.value == "proponente") {
divProponente.style.display = "block";
} else {
divProponente.style.display = "none";
}
}
function outroVinculo() {
var comboBoxVinculo = document.getElementById('vinculo');
......@@ -432,7 +464,7 @@
// instituicaoSelect.style.display = "none";
// instituicao.style.display = "inline";
// }
if(instituicaoSelect.value === "Outra"){
if(instituicaoSelect.value === "Outra"){
instituicaoSelect.parentElement.className = 'col-md-2';
instituicao.parentElement.style.display = '';
}else if(instituicaoSelect.value === "UFAPE"){
......
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