Commit 2d499473 authored by S-Nathalia's avatar S-Nathalia
Browse files

adicao de rotas e views para selecao de cursos dos proponentes

parent 2c8e7fe1
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CursoController extends Controller
{
//
}
...@@ -17,11 +17,12 @@ use App\Notificacao; ...@@ -17,11 +17,12 @@ use App\Notificacao;
use App\Participante; use App\Participante;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use App\Curso;
class ProponenteController extends Controller class ProponenteController extends Controller
{ {
public function index(){ public function index(){
$cursos = Curso::orderBy('nome')->get();
return view('proponente.index'); return view('proponente.index');
} }
......
...@@ -18,6 +18,7 @@ use Carbon\Carbon; ...@@ -18,6 +18,7 @@ use Carbon\Carbon;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use App\Curso;
class UserController extends Controller class UserController extends Controller
{ {
...@@ -25,8 +26,7 @@ class UserController extends Controller ...@@ -25,8 +26,7 @@ class UserController extends Controller
public function index() public function index()
{ {
$eventos = Evento::orderBy('created_at', 'desc')->get(); $eventos = Evento::orderBy('created_at', 'desc')->get();
dd($eventos); if (Auth::check()) {
if(Auth::check()){
Log::debug('UserController check'); Log::debug('UserController check');
return redirect()->route('home'); return redirect()->route('home');
} }
...@@ -34,7 +34,6 @@ class UserController extends Controller ...@@ -34,7 +34,6 @@ class UserController extends Controller
$hoje = Carbon::today('America/Recife'); $hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString(); $hoje = $hoje->toDateString();
return view('index', ['eventos' => $eventos, 'hoje' => $hoje]); return view('index', ['eventos' => $eventos, 'hoje' => $hoje]);
//return view('auth.login');
} }
public function inicial() public function inicial()
{ {
...@@ -42,17 +41,18 @@ class UserController extends Controller ...@@ -42,17 +41,18 @@ class UserController extends Controller
$hoje = Carbon::today('America/Recife'); $hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString(); $hoje = $hoje->toDateString();
return view('index', ['eventos' => $eventos, 'hoje' => $hoje]); return view('index', ['eventos' => $eventos, 'hoje' => $hoje]);
//return view('auth.login');
} }
function perfil(){ function perfil()
{
$user = User::find(Auth::user()->id); $user = User::find(Auth::user()->id);
return view('user.perfilUser',['user'=>$user]); return view('user.perfilUser', ['user' => $user]);
} }
function editarPerfil(Request $request){ function editarPerfil(Request $request)
{
$id = Auth()->user()->id; $id = Auth()->user()->id;
$user = User::find($id); $user = User::find($id);
if ($request->tipo != "proponente") { if ($request->tipo != "proponente") {
...@@ -86,8 +86,8 @@ class UserController extends Controller ...@@ -86,8 +86,8 @@ class UserController extends Controller
'nivel' => ['required_if:bolsistaProdutividade,sim'], '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':''], // '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') ? 'required' : ''],
'linkLattes' => [(isset($request['cargo']) && $request['cargo'] !== 'Estudante') || (isset($request['cargo']) && $request['cargo'] === 'Estudante' && isset($request['vinculo']) && $request['vinculo'] === 'Pós-doutorando') ? 'link_lattes':''], 'linkLattes' => [(isset($request['cargo']) && $request['cargo'] !== 'Estudante') || (isset($request['cargo']) && $request['cargo'] === 'Estudante' && isset($request['vinculo']) && $request['vinculo'] === 'Pós-doutorando') ? 'link_lattes' : ''],
]); ]);
} }
...@@ -100,9 +100,8 @@ class UserController extends Controller ...@@ -100,9 +100,8 @@ class UserController extends Controller
if (!($request->nova_senha === $request->confirmar_senha)) { if (!($request->nova_senha === $request->confirmar_senha)) {
return redirect()->back()->withErrors(['nova_senha' => 'Senhas diferentes']); return redirect()->back()->withErrors(['nova_senha' => 'Senhas diferentes']);
} }
} }
if($user->avaliadors != null && $request->area != null && $user->tipo == "avaliador"){ if ($user->avaliadors != null && $request->area != null && $user->tipo == "avaliador") {
$avaliador = Avaliador::where('user_id', '=', $id)->first(); $avaliador = Avaliador::where('user_id', '=', $id)->first();
$avaliador->user_id = $user->id; $avaliador->user_id = $user->id;
//$avaliador->area_id = $request->area; //$avaliador->area_id = $request->area;
...@@ -119,7 +118,7 @@ class UserController extends Controller ...@@ -119,7 +118,7 @@ class UserController extends Controller
$avaliador = Avaliador::where('user_id', '=', $id)->first(); $avaliador = Avaliador::where('user_id', '=', $id)->first();
$avaliador->user_id = $user->id; $avaliador->user_id = $user->id;
$avaliador->area_id = $request->area; $avaliador->area_id = $request->area;
if($user->usuarioTemp == true){ if ($user->usuarioTemp == true) {
$user->usuarioTemp = false; $user->usuarioTemp = false;
} }
$avaliador->update(); $avaliador->update();
...@@ -147,6 +146,7 @@ class UserController extends Controller ...@@ -147,6 +146,7 @@ class UserController extends Controller
$proponente->linkLattes = $request->linkLattes; $proponente->linkLattes = $request->linkLattes;
$proponente->user_id = $user->id; $proponente->user_id = $user->id;
$proponente->cursos()->sync($request->curso);
$proponente->update(); $proponente->update();
break; break;
case "participante": case "participante":
...@@ -154,7 +154,7 @@ class UserController extends Controller ...@@ -154,7 +154,7 @@ class UserController extends Controller
//$participante = $user->participantes->where('user_id', Auth::user()->id)->first(); //$participante = $user->participantes->where('user_id', Auth::user()->id)->first();
$participante->user_id = $user->id; $participante->user_id = $user->id;
//dd($participante); //dd($participante);
if($user->usuarioTemp == true){ if ($user->usuarioTemp == true) {
$user->usuarioTemp = false; $user->usuarioTemp = false;
} }
...@@ -181,24 +181,26 @@ class UserController extends Controller ...@@ -181,24 +181,26 @@ class UserController extends Controller
$user->update(); $user->update();
return redirect( route('user.perfil') )->with(['mensagem' => 'Dados atualizados com sucesso.']); return redirect(route('user.perfil'))->with(['mensagem' => 'Dados atualizados com sucesso.']);
} }
public function meusTrabalhos(){ public function meusTrabalhos()
{
//$trabalhos = Trabalho::where('autorId', Auth::user()->id)->get(); //$trabalhos = Trabalho::where('autorId', Auth::user()->id)->get();
$proponente = Proponente::with('user')->where('user_id', Auth::user()->id)->first(); $proponente = Proponente::with('user')->where('user_id', Auth::user()->id)->first();
$trabalhos = $proponente->trabalhos; $trabalhos = $proponente->trabalhos;
//dd($trabalhos); //dd($trabalhos);
return view('user.meusTrabalhos',[ return view('user.meusTrabalhos', [
'trabalhos' => $trabalhos, 'trabalhos' => $trabalhos,
'agora' => now(), 'agora' => now(),
]); ]);
} }
public function minhaConta() { public function minhaConta()
{
$id = Auth::user()->id; $id = Auth::user()->id;
$user = User::find($id); $user = User::find($id);
...@@ -206,11 +208,15 @@ class UserController extends Controller ...@@ -206,11 +208,15 @@ class UserController extends Controller
$avaliador = Avaliador::where('user_id', '=', $id)->first(); $avaliador = Avaliador::where('user_id', '=', $id)->first();
$proponente = Proponente::where('user_id', '=', $id)->first(); $proponente = Proponente::where('user_id', '=', $id)->first();
$participante = Participante::where('user_id', '=', $id)->first(); $participante = Participante::where('user_id', '=', $id)->first();
$cursos = Curso::orderBy('nome')->get();
return view('user.perfilUser')->with(['user' => $user, return view('user.perfilUser')->with([
'user' => $user,
'adminResp' => $adminResp, 'adminResp' => $adminResp,
'avaliador' => $avaliador, 'avaliador' => $avaliador,
'proponente' => $proponente, 'proponente' => $proponente,
'participante' => $participante]); 'participante' => $participante,
'cursos' => $cursos
]);
} }
} }
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
<div class="form-group"> <div class="form-group">
<label for="name" class="col-form-label">{{ __('Nome Completo') }} <span style="color: red; font-weight:bold;">*</span></label> <label for="name" class="col-form-label">{{ __('Nome Completo') }} <span style="color: red; font-weight:bold;">*</span></label>
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" placeholder="Digite seu nome completo" value="{{ old('name') }}" required autocomplete="name" autofocus> <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" placeholder="Digite seu nome completo" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name') @error('name')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
...@@ -68,7 +67,7 @@ ...@@ -68,7 +67,7 @@
<select style="display: inline" onchange="showInstituicao()" class="form-control @error('instituicaoSelect') is-invalid @enderror" name="instituicaoSelect" id="instituicaoSelect"> <select style="display: inline" onchange="showInstituicao()" class="form-control @error('instituicaoSelect') is-invalid @enderror" name="instituicaoSelect" id="instituicaoSelect">
<option value="" disabled selected hidden>-- Instituição --</option> <option value="" disabled selected hidden>-- Instituição --</option>
<option @if(old('instituicaoSelect')=='UFAPE' ) selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option> <option @if(old('instituicaoSelect')=='UFAPE' ) selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option>
<option @if(old('instituicaoSelect')=='Outra' ) selected @endif value="Outra" >Outra</option> <option @if(old('instituicaoSelect')=='Outra' ) selected @endif value="Outra">Outra</option>
</select> </select>
@error('instituicaoSelect') @error('instituicaoSelect')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
...@@ -124,11 +123,26 @@ ...@@ -124,11 +123,26 @@
@enderror @enderror
</div> </div>
</div> </div>
{{-- <div style="display:none" id="cursos" class="col-md-12 mb-2">
<label for="curso" class="col-form-label">{{ __('Cursos') }} <span style="color: red; font-weight:bold;">*</span></label>
<br>
<div class="row col-md-12">
@foreach($cursos as $curso)
<div class="col-sm-6">
<input type="checkbox" name="curso[]" id="curso{{$curso->id}}" value="{{$curso->id}}">
<label class="form-check-label" for="curso{{$curso->id}}">
{{ $curso->nome }}
</label>
</div>
@endforeach
</div>
</div> --}}
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group" style="display: block;" id="divOutro"> <div class="form-group" style="display: block;" id="divOutro">
<label for="outro" class="col-form-label">{{ __('Qual?') }} <span style="color: red; font-weight:bold;">*</span></label> <label for="outro" class="col-form-label">{{ __('Qual?') }} <span style="color: red; font-weight:bold;">*</span></label>
<input id="outro" type="text" class="form-control @error('outro') is-invalid @enderror" name="outro" placeholder="Digite aqui o seu vínculo" value="{{ old('outro') }}"> <input id="outro" type="text" class="form-control @error('outro') is-invalid @enderror" name="outro" placeholder="Digite aqui o seu vínculo" value="{{ old('outro') }}">
@error('outro') @error('outro')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
...@@ -289,8 +303,8 @@ ...@@ -289,8 +303,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
@endsection @endsection
...@@ -314,14 +328,20 @@ ...@@ -314,14 +328,20 @@
var divProponente = document.getElementById('proponente'); var divProponente = document.getElementById('proponente');
var comboBoxCargo = document.getElementById('cargo'); var comboBoxCargo = document.getElementById('cargo');
var comboBoxVinculo = document.getElementById('vinculo'); var comboBoxVinculo = document.getElementById('vinculo');
// let cursos = document.getElementById('cursos');
if (comboBoxCargo.value === "Estudante" && comboBoxVinculo.value !== "Pós-doutorando") { if (comboBoxCargo.value === "Estudante" && comboBoxVinculo.value !== "Pós-doutorando") {
divProponente.style.display = "none"; divProponente.style.display = "none";
} else { } else {
document.getElementById("outro").value=""; document.getElementById("outro").value = "";
divProponente.style.display = "block"; divProponente.style.display = "block";
} }
// if (comboBoxCargo.value === "Professor") {
// cursos.style.display = "block";
// } else {
// cursos.style.display = "none";
// }
outroVinculo(); outroVinculo();
} }
...@@ -347,20 +367,20 @@ ...@@ -347,20 +367,20 @@
} }
} }
function showInstituicao(){ function showInstituicao() {
var instituicao = document.getElementById('instituicao'); var instituicao = document.getElementById('instituicao');
var instituicaoSelect = document.getElementById('instituicaoSelect'); var instituicaoSelect = document.getElementById('instituicaoSelect');
if(instituicaoSelect.value === "Outra"){ if (instituicaoSelect.value === "Outra") {
document.getElementById("displayOutro").style.display = "block"; document.getElementById("displayOutro").style.display = "block";
instituicao.parentElement.style.display = ''; instituicao.parentElement.style.display = '';
document.getElementById('instituicao').value=""; document.getElementById('instituicao').value = "";
}else if(instituicaoSelect.value === "UFAPE"){ } else if (instituicaoSelect.value === "UFAPE") {
document.getElementById("displayOutro").style.display = "none"; document.getElementById("displayOutro").style.display = "none";
} }
} }
function onload(){ function onload() {
mudarNivel(); mudarNivel();
outroVinculo(); outroVinculo();
mudar(); mudar();
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<option value="{{ $user->instituicao }}" selected>{{ $user->instituicao }}</option> <option value="{{ $user->instituicao }}" selected>{{ $user->instituicao }}</option>
@endif @endif
<option @if( $user->instituicao == "UFAPE") selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option> <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> <option @if(old('instituicaoSelect')=="Outra" ) selected @endif value="Outra">Outra</option>
</select> </select>
@error('instituicaoSelect') @error('instituicaoSelect')
...@@ -92,6 +92,22 @@ ...@@ -92,6 +92,22 @@
@enderror @enderror
</div> </div>
</div> </div>
@if (Auth()->user()->tipo == 'proponente')
<div class="col-md-12 mb-2">
<label for="curso" class="col-form-label">{{ __('Cursos*:') }}</label>
<br>
<div class="row col-md-12">
@foreach($cursos as $curso)
<div class="col-sm-6">
<input type="checkbox" name="curso[]" id="curso{{$curso->id}}" value="{{$curso->id}}" @if((empty(old('curso')) && $proponente->cursos->contains($curso->id)) || (!empty(old('curso')) && in_array($curso->id, old('curso')))) checked @endif>
<label class="form-check-label" for="curso{{$curso->id}}">
{{ $curso->nome }}
</label>
</div>
@endforeach
</div>
</div>
@endif
<div class="col-md-12" id="displayOutro" style="display: none;"> <div class="col-md-12" id="displayOutro" style="display: none;">
<div class="form-group"> <div class="form-group">
<label for="instituicao" class="col-form-label">{{ __('Digite a Instituição*') }}</label> <label for="instituicao" class="col-form-label">{{ __('Digite a Instituição*') }}</label>
...@@ -113,7 +129,7 @@ ...@@ -113,7 +129,7 @@
@if(Auth()->user()->avaliadors->area_id == $area->id) @if(Auth()->user()->avaliadors->area_id == $area->id)
<option value="{{ $area->id }}" selected>{{ $area->nome }}</option> <option value="{{ $area->id }}" selected>{{ $area->nome }}</option>
@else @else
<option value="{{ $area->id }}" >{{ $area->nome }}</option> <option value="{{ $area->id }}">{{ $area->nome }}</option>
@endif @endif
@endforeach @endforeach
@else @else
...@@ -121,7 +137,7 @@ ...@@ -121,7 +137,7 @@
@if(Auth()->user()->avaliadors->area_id == $area->id) @if(Auth()->user()->avaliadors->area_id == $area->id)
<option value="{{ $area->id }}" selected>{{ $area->nome }}</option> <option value="{{ $area->id }}" selected>{{ $area->nome }}</option>
@else @else
<option value="{{ $area->id }}" >{{ $area->nome }}</option> <option value="{{ $area->id }}">{{ $area->nome }}</option>
@endif @endif
@endforeach @endforeach
@endif @endif
...@@ -170,7 +186,7 @@ ...@@ -170,7 +186,7 @@
<option @if($proponente->vinculo =='Pós-doutorando' ) selected @endif value="Pós-doutorando">Pós-doutorando</option> <option @if($proponente->vinculo =='Pós-doutorando' ) selected @endif value="Pós-doutorando">Pós-doutorando</option>
<option @if($proponente->vinculo =='Outro' ) selected @endif value="Outro">Outro</option> <option @if($proponente->vinculo =='Outro' ) selected @endif value="Outro">Outro</option>
@if ($proponente->vinculo !='Servidor na ativa' && $proponente->vinculo !='Servidor aposentado' && $proponente->vinculo !='Professor visitante' && $proponente->vinculo !='Pós-doutorando' && $proponente->vinculo !='Outro') @if ($proponente->vinculo !='Servidor na ativa' && $proponente->vinculo !='Servidor aposentado' && $proponente->vinculo !='Professor visitante' && $proponente->vinculo !='Pós-doutorando' && $proponente->vinculo !='Outro')
<option value="{{ $proponente->vinculo }}" selected >{{ $proponente->vinculo }}</option> <option value="{{ $proponente->vinculo }}" selected>{{ $proponente->vinculo }}</option>
@endif @endif
@else @else
<option value="Servidor na ativa">Servidor na ativa</option> <option value="Servidor na ativa">Servidor na ativa</option>
...@@ -389,7 +405,9 @@ ...@@ -389,7 +405,9 @@
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div><hr></div> <div>
<hr>
</div>
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div> <div>
<a class="btn btn-light botao-form" href="{{ route('home') }}" style="color:red; margin-left:5px;">Cancelar</a> <a class="btn btn-light botao-form" href="{{ route('home') }}" style="color:red; margin-left:5px;">Cancelar</a>
...@@ -421,18 +439,18 @@ ...@@ -421,18 +439,18 @@
</div> </div>
<form id="formEditUser" method="POST" action="{{ route('perfil.edit') }}"> <form id="formEditUser" method="POST" action="{{ route('perfil.edit') }}">
@csrf @csrf
{{-- Nome | CPF {{-- Nome | CPF
<div class="form-group row"> <div class="form-group row">
<input type="hidden" name="tipo" value="{{ $user->tipo }}"> <input type="hidden" name="tipo" value="{{ $user->tipo }}">
@if(session('mensagem')) @if(session('mensagem'))
<div class="col-md-12" style="margin-top: 5px;"> <div class="col-md-12" style="margin-top: 5px;">
<div class="alert alert-success"> <div class="alert alert-success">
<p>{{session('mensagem')}}</p> <p>{{session('mensagem')}}</p>
</div> </div>
</div> </div>
@endif @endif
<div class="col-md-8"> <div class="col-md-8">
<label for="name" class="col-form-label">{{ __('Nome Completo*') }}</label> <label for="name" class="col-form-label">{{ __('Nome Completo*') }}</label>
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ $user->name }}" required autocomplete="name" autofocus> <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ $user->name }}" required autocomplete="name" autofocus>
...@@ -441,9 +459,9 @@ ...@@ -441,9 +459,9 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="cpf" class="col-form-label">{{ __('CPF*') }}</label> <label for="cpf" class="col-form-label">{{ __('CPF*') }}</label>
<input id="cpf" type="text" class="form-control @error('cpf') is-invalid @enderror" name="cpf" value="{{ $user->cpf }}" required autocomplete="cpf" autofocus> <input id="cpf" type="text" class="form-control @error('cpf') is-invalid @enderror" name="cpf" value="{{ $user->cpf }}" required autocomplete="cpf" autofocus>
...@@ -452,28 +470,28 @@ ...@@ -452,28 +470,28 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
</div> </div>
{{-- Instituição de Ensino e Celular {{-- Instituição de Ensino e Celular
<div class="form-group row"> <div class="form-group row">
<div class="col-md-6"> <div class="col-md-6">
<label class="col-form-label">{{ __('Instituição de Vínculo*') }}</label> <label class="col-form-label">{{ __('Instituição de Vínculo*') }}</label>
<select style="display: inline" onchange="showInstituicao()" class="form-control @error('instituicaoSelect') is-invalid @enderror" name="instituicaoSelect" id="instituicaoSelect"> <select style="display: inline" onchange="showInstituicao()" class="form-control @error('instituicaoSelect') is-invalid @enderror" name="instituicaoSelect" id="instituicaoSelect">
<option value="" disabled hidden>-- Instituição --</option> <option value="" disabled hidden>-- Instituição --</option>
@if($user->instituicao != "UFAPE") @if($user->instituicao != "UFAPE")
<option value="{{ $user->instituicao }}" selected>{{ $user->instituicao }}</option> <option value="{{ $user->instituicao }}" selected>{{ $user->instituicao }}</option>
@endif @endif
<option @if( $user->instituicao == "UFAPE") selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option> <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> <option @if(old('instituicaoSelect')=="Outra" ) selected @endif value="Outra">Outra</option>
</select> </select>
@error('instituicaoSelect') @error('instituicaoSelect')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
<div class='col-md-4' style="display: none;"> <div class='col-md-4' style="display: none;">
<label for="instituicao" class="col-form-label">{{ __('Digite a Instituição*') }}</label> <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> <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>
@error('instituicao') @error('instituicao')
...@@ -481,8 +499,8 @@ ...@@ -481,8 +499,8 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<label for="celular" class="col-form-label">{{ __('Celular*') }}</label> <label for="celular" class="col-form-label">{{ __('Celular*') }}</label>
<input id="celular" type="text" class="form-control @error('celular') is-invalid @enderror" name="celular" value="{{ $user->celular }}" required autocomplete="celular" autofocus> <input id="celular" type="text" class="form-control @error('celular') is-invalid @enderror" name="celular" value="{{ $user->celular }}" required autocomplete="celular" autofocus>
...@@ -491,8 +509,8 @@ ...@@ -491,8 +509,8 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="email" class="col-form-label">{{ __('E-mail*') }}</label> <label for="email" class="col-form-label">{{ __('E-mail*') }}</label>
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $user->email }}" disabled> <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $user->email }}" disabled>
...@@ -501,9 +519,9 @@ ...@@ -501,9 +519,9 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
@if(Auth()->user()->avaliadors) @if(Auth()->user()->avaliadors)
<div class="col-md-4"> <div class="col-md-4">
<label for="area" class="col-form-label">{{ __('Área:') }}</label> <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"> <select style="display: inline" class="form-control @error('area') is-invalid @enderror" name="area" id="area">
@if(Auth()->user()->avaliadors->area_id == null) @if(Auth()->user()->avaliadors->area_id == null)
...@@ -512,7 +530,7 @@ ...@@ -512,7 +530,7 @@
@if(Auth()->user()->avaliadors->area_id == $area->id) @if(Auth()->user()->avaliadors->area_id == $area->id)
<option value="{{ $area->id }}" selected>{{ $area->nome }}</option> <option value="{{ $area->id }}" selected>{{ $area->nome }}</option>
@else @else
<option value="{{ $area->id }}" >{{ $area->nome }}</option> <option value="{{ $area->id }}">{{ $area->nome }}</option>
@endif @endif
@endforeach @endforeach
@else @else
...@@ -520,7 +538,7 @@ ...@@ -520,7 +538,7 @@
@if(Auth()->user()->avaliadors->area_id == $area->id) @if(Auth()->user()->avaliadors->area_id == $area->id)
<option value="{{ $area->id }}" selected>{{ $area->nome }}</option> <option value="{{ $area->id }}" selected>{{ $area->nome }}</option>
@else @else
<option value="{{ $area->id }}" >{{ $area->nome }}</option> <option value="{{ $area->id }}">{{ $area->nome }}</option>
@endif @endif
@endforeach @endforeach
@endif @endif
...@@ -532,29 +550,29 @@ ...@@ -532,29 +550,29 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
@endif @endif
</div> </div>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-4"> <div class="col-md-4">
<input type="checkbox" id="alterarSenhaCheckBox" name="alterarSenhaCheckBox" onchange="habilitando()"> <input type="checkbox" id="alterarSenhaCheckBox" name="alterarSenhaCheckBox" onchange="habilitando()">
<label for="alterarSenhaCheckBox">Desejo alterar minha senha</label> <label for="alterarSenhaCheckBox">Desejo alterar minha senha</label>
</div> </div>
</div> </div>
{{-- Email | Senha | Confirmar Senha {{-- Email | Senha | Confirmar Senha
<div class="form-group row"> <div class="form-group row">
<div class="col-md-4"> <div class="col-md-4">
<label for="senha_atual" class="col-form-label">{{ __('Senha atual*') }}</label> <label for="senha_atual" class="col-form-label">{{ __('Senha atual*') }}</label>
<input id="senha_atual" type="password" class="form-control @error('senha_atual') is-invalid @enderror" name="senha_atual" value="" disabled> <input id="senha_atual" type="password" class="form-control @error('senha_atual') is-invalid @enderror" name="senha_atual" value="" disabled>
@error('senha_atual') @error('senha_atual')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="nova_senha" class="col-form-label">{{ __('Nova senha*') }}</label> <label for="nova_senha" class="col-form-label">{{ __('Nova senha*') }}</label>
<input id="nova_senha" type="password" class="form-control @error('nova_senha') is-invalid @enderror" name="nova_senha" value="" disabled> <input id="nova_senha" type="password" class="form-control @error('nova_senha') is-invalid @enderror" name="nova_senha" value="" disabled>
...@@ -563,9 +581,9 @@ ...@@ -563,9 +581,9 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="confirmar_senha" class="col-form-label">{{ __('Confirmar nova senha*') }}</label> <label for="confirmar_senha" class="col-form-label">{{ __('Confirmar nova senha*') }}</label>
<input id="confirmar_senha" type="password" class="form-control @error('confirmar_senha') is-invalid @enderror" name="confirmar_senha" value="" disabled> <input id="confirmar_senha" type="password" class="form-control @error('confirmar_senha') is-invalid @enderror" name="confirmar_senha" value="" disabled>
...@@ -574,11 +592,11 @@ ...@@ -574,11 +592,11 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</div> </div>
</div> </div>
@if(isset($proponente)) @if(isset($proponente))
<div id="proponente" style="display: block;"> <div id="proponente" style="display: block;">
<div> <div>
<h4>Dados de proponente</h4> <h4>Dados de proponente</h4>
...@@ -610,7 +628,7 @@ ...@@ -610,7 +628,7 @@
<option @if($proponente->vinculo =='Pós-doutorando' ) selected @endif value="Pós-doutorando">Pós-doutorando</option> <option @if($proponente->vinculo =='Pós-doutorando' ) selected @endif value="Pós-doutorando">Pós-doutorando</option>
<option @if($proponente->vinculo =='Outro' ) selected @endif value="Outro">Outro</option> <option @if($proponente->vinculo =='Outro' ) selected @endif value="Outro">Outro</option>
@if ($proponente->vinculo !='Servidor na ativa' && $proponente->vinculo !='Servidor aposentado' && $proponente->vinculo !='Professor visitante' && $proponente->vinculo !='Pós-doutorando' && $proponente->vinculo !='Outro') @if ($proponente->vinculo !='Servidor na ativa' && $proponente->vinculo !='Servidor aposentado' && $proponente->vinculo !='Professor visitante' && $proponente->vinculo !='Pós-doutorando' && $proponente->vinculo !='Outro')
<option value="{{ $proponente->vinculo }}" selected >{{ $proponente->vinculo }}</option> <option value="{{ $proponente->vinculo }}" selected>{{ $proponente->vinculo }}</option>
@endif @endif
</select> </select>
...@@ -750,12 +768,12 @@ ...@@ -750,12 +768,12 @@
@endif @endif
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@endif @endif
</form> </form>
<div class="container"> <div class="container">
<div class="row justify-content-center" style="margin: 20px 0 20px 0"> <div class="row justify-content-center" style="margin: 20px 0 20px 0">
<div class="col-md-6" style="padding-left:0"> <div class="col-md-6" style="padding-left:0">
...@@ -767,13 +785,13 @@ ...@@ -767,13 +785,13 @@
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
--}} --}}
@endsection @endsection
@section('javascript') @section('javascript')
<script type="text/javascript" > <script type="text/javascript">
//var emailInput = document.getElementById('email'); //var emailInput = document.getElementById('email');
//emailInput.disabled = true; //emailInput.disabled = true;
...@@ -784,18 +802,19 @@ ...@@ -784,18 +802,19 @@
function limpa_formulário_cep() { function limpa_formulário_cep() {
//Limpa valores do formulário de cep. //Limpa valores do formulário de cep.
document.getElementById('rua').value=(""); document.getElementById('rua').value = ("");
document.getElementById('bairro').value=(""); document.getElementById('bairro').value = ("");
document.getElementById('cidade').value=(""); document.getElementById('cidade').value = ("");
document.getElementById('uf').value=(""); document.getElementById('uf').value = ("");
} }
function meu_callback(conteudo) { function meu_callback(conteudo) {
if (!("erro" in conteudo)) { if (!("erro" in conteudo)) {
//Atualiza os campos com os valores. //Atualiza os campos com os valores.
document.getElementById('rua').value=(conteudo.logradouro); document.getElementById('rua').value = (conteudo.logradouro);
document.getElementById('bairro').value=(conteudo.bairro); document.getElementById('bairro').value = (conteudo.bairro);
document.getElementById('cidade').value=(conteudo.localidade); document.getElementById('cidade').value = (conteudo.localidade);
document.getElementById('uf').value=(conteudo.uf); document.getElementById('uf').value = (conteudo.uf);
} //end if. } //end if.
else { else {
//CEP não Encontrado. //CEP não Encontrado.
...@@ -803,6 +822,7 @@ ...@@ -803,6 +822,7 @@
alert("CEP não encontrado."); alert("CEP não encontrado.");
} }
} }
function pesquisacep(valor) { function pesquisacep(valor) {
//Nova variável "cep" somente com dígitos. //Nova variável "cep" somente com dígitos.
var cep = valor.replace(/\D/g, ''); var cep = valor.replace(/\D/g, '');
...@@ -811,16 +831,16 @@ ...@@ -811,16 +831,16 @@
//Expressão regular para validar o CEP. //Expressão regular para validar o CEP.
var validacep = /^[0-9]{8}$/; var validacep = /^[0-9]{8}$/;
//Valida o formato do CEP. //Valida o formato do CEP.
if(validacep.test(cep)) { if (validacep.test(cep)) {
//Preenche os campos com "..." enquanto consulta webservice. //Preenche os campos com "..." enquanto consulta webservice.
document.getElementById('rua').value="..."; document.getElementById('rua').value = "...";
document.getElementById('bairro').value="..."; document.getElementById('bairro').value = "...";
document.getElementById('cidade').value="..."; document.getElementById('cidade').value = "...";
document.getElementById('uf').value="..."; document.getElementById('uf').value = "...";
//Cria um elemento javascript. //Cria um elemento javascript.
var script = document.createElement('script'); var script = document.createElement('script');
//Sincroniza com o callback. //Sincroniza com o callback.
script.src = 'https://viacep.com.br/ws/'+ cep + '/json/?callback=meu_callback'; script.src = 'https://viacep.com.br/ws/' + cep + '/json/?callback=meu_callback';
//Insere script no documento e carrega o conteúdo. //Insere script no documento e carrega o conteúdo.
document.body.appendChild(script); document.body.appendChild(script);
} //end if. } //end if.
...@@ -835,6 +855,7 @@ ...@@ -835,6 +855,7 @@
limpa_formulário_cep(); limpa_formulário_cep();
} }
}; };
function mudar() { function mudar() {
var divProponente = document.getElementById('proponente'); var divProponente = document.getElementById('proponente');
var comboBoxTipo = document.getElementById('tipo'); var comboBoxTipo = document.getElementById('tipo');
...@@ -869,7 +890,7 @@ ...@@ -869,7 +890,7 @@
} }
} }
function showInstituicao(){ function showInstituicao() {
var instituicao = document.getElementById('instituicao'); var instituicao = document.getElementById('instituicao');
var instituicaoSelect = document.getElementById('instituicaoSelect'); var instituicaoSelect = document.getElementById('instituicaoSelect');
...@@ -877,10 +898,10 @@ ...@@ -877,10 +898,10 @@
// instituicaoSelect.style.display = "none"; // instituicaoSelect.style.display = "none";
// instituicao.style.display = "inline"; // instituicao.style.display = "inline";
// } // }
if(instituicaoSelect.value === "Outra"){ if (instituicaoSelect.value === "Outra") {
document.getElementById("displayOutro").style.display = "block"; document.getElementById("displayOutro").style.display = "block";
instituicao.parentElement.style.display = ''; instituicao.parentElement.style.display = '';
}else if(instituicaoSelect.value === "UFAPE"){ } else if (instituicaoSelect.value === "UFAPE") {
document.getElementById("displayOutro").style.display = "none"; document.getElementById("displayOutro").style.display = "none";
} }
} }
...@@ -906,5 +927,5 @@ ...@@ -906,5 +927,5 @@
} }
window.onload = showInstituicao(); window.onload = showInstituicao();
</script> </script>
@endsection @endsection
\ No newline at end of file
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