diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index a2b6c6f8269711bceaf0b92938b0f472c0d8f236..5181960cb01be4db024bf9db1f456a53f5fba2c4 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -48,9 +48,26 @@ class UserController extends Controller function perfil() { - $user = User::find(Auth::user()->id); + $user = Auth::user(); + $cursoPart = null; + if ($user->participantes()->exists() && $user->participantes()->first()->curso_id) + $cursoPart = Curso::find($user->participantes()->first()->curso_id); + $view = 'user.perfilUser'; + if ($user->tipo == 'participante') + $view = 'user.perfilParticipante'; - return view('user.perfilUser', ['user' => $user]); + $naturezas = Natureza::orderBy('nome')->get(); + $cursos = Curso::orderBy('nome')->get(); + $areaTematica = AreaTematica::orderBy('nome')->get(); + + return view($view) + ->with([ + 'user' => $user, + 'cursos' => $cursos, + 'naturezas' => $naturezas, + 'cursoPart' => $cursoPart, + 'areaTematica' => $areaTematica + ]); } function editarPerfil(Request $request) @@ -66,6 +83,21 @@ class UserController extends Controller 'celular' => ['required', 'string'], 'cpf' => ['required', 'cpf'], ]); + } else if ($user->tipo == 'participante') { + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'password' => ['required', 'string', 'min:8', 'confirmed'], + 'cpf' => ['required', 'cpf', 'unique:users'], + 'rg' => ['required', 'unique:participantes'], + 'celular' => ['required', 'string', 'telefone'], + 'instituicao' => ['required_if:instituicaoSelect,Outra', 'max:255'], + 'instituicaoSelect' => ['required_without:instituicao'], + 'outroCursoEstudante' => ['required_if:cursoEstudante,Outro', 'max:255'], + 'cursoEstudante' => ['required_without:outroCursoEstudante'], + 'perfil' => ['required'], + 'linkLattes' => ['required'], + ]); } else { $validated = $request->validate([ 'name' => ['required', 'string', 'max:255'], @@ -113,7 +145,7 @@ class UserController extends Controller } - switch ($request->tipo) { + switch ($user->tipo) { case "administradorResponsavel": $adminResp = AdministradorResponsavel::where('user_id', '=', $id)->first(); $adminResp->user_id = $user->id; @@ -156,22 +188,30 @@ 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->user_id = $user->id; - //dd($participante); - if ($user->usuarioTemp == true) { - $user->usuarioTemp = false; + $participante = $user->participantes()->first(); + $participante->data_de_nascimento = $request->data_de_nascimento; + $participante->linkLattes = $request->linkLattes; + $participante->rg = $request->rg; + if ($request->outroCursoEstudante != null) { + $participante->curso = $request->outroCursoEstudante; + } else if (isset($request->cursoEstudante) && $request->cursoEstudante != "Outro") { + $participante->curso_id = $request->cursoEstudante; } - + $user->usuarioTemp = false; + $endereco = $user->endereco; + $endereco->cep = $request->cep; + $endereco->uf = $request->uf; + $endereco->cidade = $request->cidade; + $endereco->rua = $request->rua; + $endereco->numero = $request->numero; + $endereco->bairro = $request->bairro; + $endereco->complemento = $request->complemento; + $endereco->update(); $participante->update(); - break; } $user->name = $request->name; - $user->tipo = $request->tipo; - // $user->email = $request->email; $user->cpf = $request->cpf; $user->celular = $request->celular; if ($request->instituicao != null) { @@ -209,24 +249,34 @@ class UserController extends Controller { $id = Auth::user()->id; $user = User::find($id); + $cursoPart = null; + if ($user->participantes()->exists() && $user->participantes()->first()->curso_id) + $cursoPart = Curso::find($user->participantes()->first()->curso_id); $adminResp = AdministradorResponsavel::where('user_id', '=', $id)->first(); $avaliador = Avaliador::where('user_id', '=', $id)->first(); $proponente = Proponente::where('user_id', '=', $id)->first(); - $participante = Participante::where('user_id', '=', $id)->first(); + $participante = $user->participantes()->first(); $naturezas = Natureza::orderBy('nome')->get(); $cursos = Curso::orderBy('nome')->get(); $areaTematica = AreaTematica::orderBy('nome')->get(); - - return view('user.perfilUser')->with(['user' => $user, - 'adminResp' => $adminResp, - 'avaliador' => $avaliador, - 'proponente' => $proponente, - 'participante' => $participante, - 'cursos' => $cursos, - 'naturezas' => $naturezas, - 'areaTematica' => $areaTematica]); - } + $view = 'user.perfilUser'; + if ($user->tipo == 'participante') + $view = 'user.perfilParticipante'; + + return view($view) + ->with([ + 'user' => $user, + 'adminResp' => $adminResp, + 'avaliador' => $avaliador, + 'proponente' => $proponente, + 'participante' => $participante, + 'cursos' => $cursos, + 'naturezas' => $naturezas, + 'cursoPart' => $cursoPart, + 'areaTematica' => $areaTematica + ]); +} } diff --git a/app/Http/Requests/StoreTrabalho.php b/app/Http/Requests/StoreTrabalho.php index bd28347d1a6e0020314fab95c3e90942a3cbc6c7..453bb48edb486630363221ef97293b90415a1f7a 100755 --- a/app/Http/Requests/StoreTrabalho.php +++ b/app/Http/Requests/StoreTrabalho.php @@ -6,6 +6,7 @@ use App\Evento; use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Auth; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Contracts\Validation\Validator; class StoreTrabalho extends FormRequest { @@ -19,6 +20,17 @@ class StoreTrabalho extends FormRequest return Auth::check(); } + protected function prepareForValidation() + { + $func = function($value) { + return ['cpf' => $value]; + }; + $this->merge([ + 'cpfs' => array_map($func, $this->cpf), + ]); + } + + /** * Get the validation rules that apply to the request. * @@ -31,6 +43,7 @@ class StoreTrabalho extends FormRequest $rules = []; if($this->has('marcado')){ + $rules['cpfs.*.cpf'] = ['distinct', 'nullable']; foreach ($this->get('marcado') as $key => $value) { if( intval($value) == $key){ //user @@ -139,6 +152,7 @@ class StoreTrabalho extends FormRequest 'anexoPlanoTrabalho.*.required' => 'O :attribute é obrigatório', 'anexoProjeto.required' => 'O :attribute é obrigatório', 'cpf.*.required' => 'O cpf é obrigatório', + 'cpfs.*.cpf.distinct' => 'O integrante com CPF :input não pode ser adicionado mais de uma vez', 'name.*.required' => 'O :attribute é obrigatório', 'email.*.required' => 'O :attribute é obrigatório', 'instituicao.*.required' => 'O :attribute é obrigatório', diff --git a/app/User.php b/app/User.php index 5f590f25eccefca4d06f30af51d113575c67089c..84b76ed1022890192dcf9e463835c8eae0a89048 100755 --- a/app/User.php +++ b/app/User.php @@ -89,7 +89,7 @@ class User extends Authenticatable implements MustVerifyEmail return $this->hasOne('App\AdministradorResponsavel'); } public function participantes(){ - return $this->hasMany('App\Participante'); + return $this->hasMany('App\Participante')->orderBy('id', 'asc'); } public function avaliadors(){ return $this->hasOne('App\Avaliador'); diff --git a/resources/views/evento/formulario/integrantes.blade.php b/resources/views/evento/formulario/integrantes.blade.php index 9697bef772171c1a0360d9e965bb32ca97e0659b..99874ec1215ceff2cc66d2dc9d40054355e7554f 100644 --- a/resources/views/evento/formulario/integrantes.blade.php +++ b/resources/views/evento/formulario/integrantes.blade.php @@ -190,7 +190,7 @@ $('#aviso-modal-limite-de-integrantes').modal('show'); } - let modal_id = 0; + let modal_id = Number(document.getElementById('quantidadeModais').value); function exibirUsuarioAdicionado(data) { $('#modalIntegrante').modal('hide'); diff --git a/resources/views/evento/formulario/participantes.blade.php b/resources/views/evento/formulario/participantes.blade.php index e58492cc9e7975127bbf75350760ce632abf93c7..1ea43a3770f20e7c54baac2a392d090356cf5d66 100755 --- a/resources/views/evento/formulario/participantes.blade.php +++ b/resources/views/evento/formulario/participantes.blade.php @@ -359,38 +359,40 @@ </div> @endif - @if($edital->tipo != "CONTINUO") - <div class="col-md-12" id="plano-titulo{{$i}}"> - <h5>Plano de trabalho</h5> - </div> - <div class="col-12" id="plano-nome{{$i}}"> - @component('componentes.input', ['label' => 'TÃtulo']) - <input type="text" class="form-control" value="{{old('nomePlanoTrabalho')[$i] ?? "" }}" name="nomePlanoTrabalho[{{$i}}]" placeholder="Digite o tÃtulo do plano de trabalho" maxlength="255" id="nomePlanoTrabalho{{$i}}"> - <span style="color: red; font-size: 12px" id="caracsRestantesnomePlanoTrabalho{{$i}}"> - </span> - @error('nomePlanoTrabalho.'.$i) - <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> - <strong>{{ $message }}</strong> - </span> - @enderror - @endcomponent - </div> - <div class="col-12" id="plano-anexo{{$i}}"> - @component('componentes.input', ['label' => 'Anexo (.pdf)']) - <input type="file" class="input-group-text" value="{{old('anexoPlanoTrabalho')[$i] ?? "" }}" name="anexoPlanoTrabalho[{{$i}}]" accept=".pdf" placeholder="Anexo do Plano de Trabalho" /> - @error('anexoPlanoTrabalho.'.$i) - <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> - <strong>{{ $message }}</strong> - </span> - @enderror - @error('anexoPlanoTrabalho') - <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> - <strong>{{ $message }}</strong> - </span> - @enderror - @endcomponent - </div> - @endif + <div style="display: block" @if(old('funcaoParticipante') == null || !array_key_exists($i, old('funcaoParticipante')) || old('funcaoParticipante')[$i] == 'Bolsista') @else hidden @endif> + @if($edital->tipo != "CONTINUO") + <div class="col-md-12" id="plano-titulo{{$i}}"> + <h5>Plano de trabalho</h5> + </div> + <div class="col-12" id="plano-nome{{$i}}"> + @component('componentes.input', ['label' => 'TÃtulo']) + <input type="text" class="form-control" value="{{old('nomePlanoTrabalho')[$i] ?? "" }}" name="nomePlanoTrabalho[{{$i}}]" placeholder="Digite o tÃtulo do plano de trabalho" maxlength="255" id="nomePlanoTrabalho{{$i}}"> + <span style="color: red; font-size: 12px" id="caracsRestantesnomePlanoTrabalho{{$i}}"> + </span> + @error('nomePlanoTrabalho.'.$i) + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + @endcomponent + </div> + <div class="col-12" id="plano-anexo{{$i}}"> + @component('componentes.input', ['label' => 'Anexo (.pdf)']) + <input type="file" class="input-group-text" value="{{old('anexoPlanoTrabalho')[$i] ?? "" }}" name="anexoPlanoTrabalho[{{$i}}]" accept=".pdf" placeholder="Anexo do Plano de Trabalho" /> + @error('anexoPlanoTrabalho.'.$i) + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + @error('anexoPlanoTrabalho') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + @endcomponent + </div> + @endif + </div> {{-- <div class="col-6"> <button data-dismiss="modal" type="button" id="cancelar{{$i}}" class=" btn btn-danger" style="font-size: 16px" onclick="desmarcar({{$i}})" @if(isset(old('marcado')[$i+1])) disabled @endif>Cancelar</button> diff --git a/resources/views/evento/submeterTrabalho.blade.php b/resources/views/evento/submeterTrabalho.blade.php index f8d9b6ca471e376d73b7b8fdc798e68c8abbce24..cfe55375cc7f54d54ea3fb627d66c35afed4bbf4 100755 --- a/resources/views/evento/submeterTrabalho.blade.php +++ b/resources/views/evento/submeterTrabalho.blade.php @@ -7,6 +7,7 @@ <form method="POST" id="criarProjetoForm" action="{{route('trabalho.store')}}" enctype="multipart/form-data" > @csrf <input type="hidden" name="editalId" value="{{$edital->id}}"> + <input type="hidden" name="quantidadeModais" id="quantidadeModais" value="{{old('quantidadeModais', 0)}}" > <div class="container"> @@ -232,16 +233,16 @@ if(nome.value != ""){ estudante.value = true; if(planoTrabalho != null && planoTrabalho.value != ""){ - nomePlano.innerHTML = ` <p style='font-weight: normal; line-height: normal;'><strong>Nome: </strong>${nome.value}<br> + nomePlano.innerHTML = ` <strong>Nome: </strong>${nome.value}<br> <strong>E-mail: </strong>${email.value} <br> <strong>Plano: </strong>${planoTrabalho.value}<br> <strong>CPF: </strong>${cpf.value} <br> - <strong>Função: </strong>${nome_funcao}</p>`; + <strong>Função: </strong>${nome_funcao}`; }else { - nomePlano.innerHTML = ` <p style='font-weight: normal; line-height: normal;'><strong>Nome: </strong>${nome.value}<br> + nomePlano.innerHTML = ` <strong>Nome: </strong>${nome.value}<br> <strong>E-mail: </strong>${email.value} <br> <strong>CPF: </strong>${cpf.value} <br> - <strong>Função: </strong>${nome_funcao}</p>`; + <strong>Função: </strong>${nome_funcao}`; } }else if(data != null) { estudante.value = false; @@ -265,6 +266,7 @@ document.getElementById("checkB"+id).checked = true; //$("#atribuir1").attr('data-target','#modalIntegrante'+(id+1)); modal_id = id+1; + document.getElementById("quantidadeModais").value = modal_id; document.getElementById("part"+id).removeAttribute("hidden"); //document.getElementById("exampleModal"+id).modal('hide'); @@ -279,6 +281,7 @@ document.getElementById("part"+id).setAttribute("hidden",true); //$("#atribuir1").attr('data-target','#exampleModal'+(id)); modal_id -= 1; + document.getElementById("quantidadeModais").value = modal_id; document.getElementById("exampleModal"+id).modal('hide'); } @endif diff --git a/resources/views/projeto/editaFormulario/integrantes.blade.php b/resources/views/projeto/editaFormulario/integrantes.blade.php index 7b29ff1c5f9bc072687d3fa57064b473003bb6d0..c3fc41eda3f0230bab7f6ce6b0cd9a6ebceee7a7 100644 --- a/resources/views/projeto/editaFormulario/integrantes.blade.php +++ b/resources/views/projeto/editaFormulario/integrantes.blade.php @@ -272,6 +272,7 @@ if(<?php echo json_encode($trabalho_user) ?>['funcao']){ modal_id += 1; + document.getElementById("quantidadeModais").value = modal_id; } $('#integrante').append(` diff --git a/resources/views/projeto/editar.blade.php b/resources/views/projeto/editar.blade.php index dfe39830964be22b6f1f1c739a7f2f2dd3296bfc..d56e58c17ba24504b27782f3b876830941469952 100755 --- a/resources/views/projeto/editar.blade.php +++ b/resources/views/projeto/editar.blade.php @@ -260,6 +260,8 @@ document.getElementById("checkB"+id).checked = true; // $("#atribuir1").attr('data-target','#exampleModal'+(id+1)); modal_id += 1; + document.getElementById("quantidadeModais").value = modal_id; + document.getElementById("part"+id).removeAttribute("hidden"); // document.getElementById("exampleModal"+id).modal('hide'); } @@ -274,6 +276,7 @@ // $("#atribuir1").attr('data-target','#exampleModal'+(id)); // document.getElementById("exampleModal"+id).modal('hide'); modal_id -= 1; + document.getElementById("quantidadeModais").value = modal_id; console.log(modal_id); } @endif diff --git a/resources/views/user/perfilParticipante.blade.php b/resources/views/user/perfilParticipante.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..a173cecd48d7c735402dc7d163f8a1af0c6cb7c3 --- /dev/null +++ b/resources/views/user/perfilParticipante.blade.php @@ -0,0 +1,744 @@ +@extends('layouts.app') + +@section('content') + +<div class="container" style="margin-top: 3rem"> + <div class="row" > + @if(session('mensagem')) + <div class="col-md-12" style="margin-top: 30px;"> + <div class="alert alert-success"> + <p>{{session('mensagem')}}</p> + </div> + </div> + @endif + </div> + <form id="formEditUser" method="POST" action="{{ route('perfil.edit') }}"> + @csrf + <div class="row justify-content-center"> + <div class="col-md-8" style="margin-bottom:20px"> + <div class="card shadow bg-white" style="border-radius:12px; border-width:0px;"> + <div class="card-header" style="border-top-left-radius: 12px; border-top-right-radius: 12px; background-color: #fff"> + <div class="d-flex justify-content-between align-items-center" style="margin-top: 9px; margin-bottom:6px"> + <h5 class="card-title mb-0" style="font-size:25px; font-family:Arial, Helvetica, sans-serif; color:#1492E6">Cadastro</h5> + <h6 class="card-title mb-0" style="color:red">* Campos obrigatórios</h6> + </div> + </div> + <div class="card-body"> + <div class="form-row"> + <div class="col-12"> + @if ($errors->any()) + <div class="alert alert-danger"> + <ul> + @foreach ($errors->all() as $error) + <li>{{ $error }}</li> + @endforeach + </ul> + </div> + @endif + </div> + <div class="col-md-12"> + <div class="d-flex justify-content-between align-items-center" style="margin-bottom:6px"> + <h5 class="card-title mb-0" style="font-size:20px; font-family:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif; ">Informações pessoais</h5> + </div> + </div> + <div class="col-md-12"> + <div class="form-group"> + <label for="name" class="col-form-label" style="font-weight:600;">{{ __('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', $user->name) }}" required autocomplete="name" autofocus> + @error('name') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <label for="cpf" class="col-form-label" style="font-weight:600;">{{ __('CPF') }}<span style="color: red; font-weight:bold;">*</span></label> + <input id="cpf" type="text" class="form-control @error('cpf') is-invalid @enderror" name="cpf" placeholder="Digite o número do CPF" value="{{ old('cpf', $user->cpf) }}" required autocomplete="cpf" autofocus> + + @error('cpf') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <label for="rg" class="col-form-label" style="font-weight:600;">{{ __('RG') }}<span style="color: red; font-weight:bold;">*</span></label> + <input id="rg" type="text" class="form-control @error('rg') is-invalid @enderror" name="rg" placeholder="Digite o número do RG" @if($user->participantes()->exists()) value="{{ old('rg', $user->participantes()->first()->rg) }}" @else value="{{ old('rg') }}" @endif required autocomplete="rg" autofocus> + + @error('rg') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <label for="celular" class="col-form-label" style="font-weight:600;">{{ __('Celular') }}<span style="color: red; font-weight:bold;">*</span></label> + <input id="celular" type="text" class="form-control @error('celular') is-invalid @enderror" name="celular" placeholder="Digite o número do seu celular" value="{{ old('celular', $user->celular) }}" required autocomplete="celular" autofocus> + + @error('celular') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-12"> + <div class="d-flex justify-content-between align-items-center" style="margin-bottom:6px"> + <h5 class="card-title mb-0" style="font-size:20px; font-family:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif; ">Instituição</h5> + </div> + </div> + <div class="col-md-12"> + <div class="form-group"> + <label for="instituicaoSelect" class="col-form-label" style="font-weight:600;">{{ __('Instituição de VÃnculo') }}<span style="color: red; font-weight:bold;">*</span></label> + <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 @if(old('instituicaoSelect', $user->instituicao)=='UFAPE' ) selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option> + <option @if(old('instituicaoSelect', $user->instituicao)=='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-12" id="displayOutro" style='display:none'> + <div class="form-group"> + <label for="instituicao" class="col-form-label" style="font-weight:600;">{{ __('Digite a Instituição') }}<span style="color: red; font-weight:bold;">*</span></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" autofocus> + @error('instituicao') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <label for="perfil" class="col-form-label" style="font-weight:600;">{{ __('Perfil') }}<span style="color: red; font-weight:bold;">*</span></label> + <input type="hidden" name="perfil" value="{{$user->tipo}}"> + <select disabled id="perfil" class="form-control @error('perfil') is-invalid @enderror"> + <option value="" disabled selected hidden>-- Perfil --</option> + <option @if(old('perfil')=='Professor' ) selected @endif value="Professor">Professor</option> + <option @if(old('perfil')=='Técnico' ) selected @endif value="Técnico">Técnico</option> + <option @if(old('perfil')=='Estudante' || $user->tipo == 'participante') selected @endif value="Estudante">Estudante</option> + <option @if(old('perfil')=='Outro' ) selected @endif value="Outro">Outro</option> + </select> + @error('perfil') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="outroPerfil"> + <label for="outroPerfil" class="col-form-label" style="font-weight:600;">{{ __('Qual perfil?') }}<span style="color: red; font-weight:bold;">*</span></label> + <input id="outroPerfil" type="text" class="form-control @error('outroPerfil') is-invalid @enderror" name="outroPerfil" placeholder="Digite aqui qual o seu perfil" value="{{ old('outroPerfil') }}"> + @error('outroPerfil') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div style="display:none" id="divCursos" class="col-md-12 mb-2"> + <label for="curso" class="col-form-label" style="font-weight:600;">{{ __('Cursos que Leciona') }}<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> + + <!-- Proponente --> + <div class="col-md-6"> + <div class="form-group" id="divVinculo"> + <label for="vinculo" class="col-form-label" style="font-weight:600;">{{ __('VÃnculo') }}<span style="color: red; font-weight:bold;">*</span></label> + <select name="vinculo" id="vinculo" class="form-control @error('vinculo') is-invalid @enderror" onchange="mudarPerfil()"> + <option value="" disabled selected hidden>-- VÃnculo --</option> + <option @if(old('vinculo')=='Servidor na ativa' ) selected @endif value="Servidor na ativa">Servidor na ativa</option> + <option @if(old('vinculo')=='Servidor aposentado' ) selected @endif value="Servidor aposentado">Servidor aposentado</option> + <option @if(old('vinculo')=='Professor visitante' ) selected @endif value="Professor visitante">Professor visitante</option> + <option @if(old('vinculo')=='Pós-doutorando' ) selected @endif value="Pós-doutorando">Pós-doutorando</option> + <option @if(old('vinculo')=='Outro' ) selected @endif value="Outro">Outro</option> + </select> + + @error('vinculo') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="divOutro"> + <label for="outro" class="col-form-label" style="font-weight:600;">{{ __('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') }}"> + @error('outro') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="divTitulacaoMax" style="display: none"> + <label for="titulacaoMaxima" class="col-form-label" style="font-weight:600;">{{ __('Titulação Máxima') }}<span style="color: red; font-weight:bold;">*</span></label> + <select id="titulacaoMaxima" class="form-control @error('titulacaoMaxima') is-invalid @enderror" name="titulacaoMaxima" value="{{ old('titulacaoMaxima') }}" autocomplete="nome"> + <option value="" disabled selected hidden>-- Titulação --</option> + <option @if(old('titulacaoMaxima')=='Doutorado' ) selected @endif value="Doutorado">Doutorado</option>perfil + <option @if(old('titulacaoMaxima')=='Mestrado' ) selected @endif value="Mestrado">Mestrado</option> + <option @if(old('titulacaoMaxima')=='Especialização' ) selected @endif value="Especialização">Especialização</option> + <option @if(old('titulacaoMaxima')=='Graduação' ) selected @endif value="Graduação">Graduação</option> + <option @if(old('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> + <div class="col-md-6"> + <div class="form-group" id="anoTitulacao" style="display: none"> + <label for="AnoTitulacao" class="col-form-label" style="font-weight:600;">{{ __('Ano da Titulação Máxima') }}<span style="color: red; font-weight:bold;">*</span></label> + <input id="AnoTitulacao" type="text" class="form-control @error('anoTitulacao') is-invalid @enderror" name="anoTitulacao" placeholder="Digite o ano de titulação" value="{{ old('anoTitulacao') }}" autocomplete="nome"> + + @error('anoTitulacao') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6" > + <div class="form-group" id="areaFormacao" style="display: none"> + <label for="areaFormacao" class="col-form-label" style="font-weight:600;">{{ __('Ãrea de Formação') }}<span style="color: red; font-weight:bold;">*</span></label> + <input id="areaFormacao" type="text" class="form-control @error('areaFormacao') is-invalid @enderror" name="areaFormacao" placeholder="Digite a sua área de formação" value="{{ old('areaFormacao') }}" autocomplete="nome"> + + @error('areaFormacao') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="siape" style="display: none"> + <label for="SIAPE" class="col-form-label" style="font-weight:600;">{{ __('SIAPE') }}</label> + <input id="SIAPE" type="text" class="form-control @error('SIAPE') is-invalid @enderror" name="SIAPE" placeholder="Digite o SIAPE" value="{{ old('SIAPE') }}" autocomplete="nome"> + + @error('SIAPE') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="bolsista" style="display: none"> + <label for="bolsistaProdutividade" class="col-form-label" style="font-weight:600;">{{ __('Bolsista de Produtividade') }}<span style="color: red; font-weight:bold;">*</span></label><br> + <select name="bolsistaProdutividade" id="bolsistaProdutividade" class="form-control @error('bolsistaProdutividade') is-invalid @enderror" onchange="mudarNivel()"> + <option value="" disabled selected hidden>-- Bolsista --</option> + <option @if(old('bolsistaProdutividade')=='nao' ) selected @endif value="nao">Não</option> + <option @if(old('bolsistaProdutividade')=='sim' ) selected @endif value="sim">Sim</option> + </select> + @error('bolsistaProdutividade') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="nivelInput" style="display: block;"> + <label for="nivel" class="col-form-label" style="font-weight:600;">{{ __('NÃvel') }}<span style="color: red; font-weight:bold;">*</span></label> + <select name="nivel" id="nivel" class="form-control @error('nivel') is-invalid @enderror"> + <option value="" disabled selected hidden></option> + <option value="1A">1A</option> + <option value="1B">1B</option> + <option value="1C">1C</option> + <option value="1D">1D</option> + <option value="2">2</option> + </select> + @error('nivel') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + + <!-- Estudante --> + <div class="col-md-6"> + <div class="form-group" id="dataNascimento"> + @component('componentes.input', ['label' => 'Data de nascimento']) + <input type="date" class="form-control" @if($user->participantes()->exists()) value="{{old('data_de_nascimento', $user->participantes()->first()->data_de_nascimento)}}" @else value="{{old('data_de_nascimento')}}" @endif name="data_de_nascimento" placeholder="Data de nascimento" /> + @error('data_de_nascimento') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + @endcomponent + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="curso"> + @component('componentes.input', ['label' => 'Curso']) + <select style="display: inline" class="form-control" id='cursoEstudante' name="cursoEstudante" onchange="outroCurso(this)"> + <option value="" disabled selected hidden>-- Selecione uma opção--</option> + @foreach ($cursos as $curso) + <option @isset($cursoPart) @if(old('cursoEstudante', $cursoPart->id) == $curso->id) selected @endif @else @if(old('cursoEstudante') == $curso->id) selected @endif @endisset value='{{$curso->id}}'>{{$curso->nome}}</option> + @endforeach + <option @if(old('cursoEstudante') == "Outro" ) selected @endif value="Outro">Outro</option> + </select> + @error('curso') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + @endcomponent + </div> + </div> + + <div class="col-md-12"> + <div class="form-group" id="divCursoEstudante" style="display:none"> + @component('componentes.input', ['label' => 'Qual curso?']) + <input name="outroCursoEstudante" type="text" id="outroCursoEstudante" value="{{ old('outroCursoEstudante')}}" class="form-control"/> + @error('outroCursoEstudante') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"><strong>{{ $message }}</strong></span> + @enderror + @endcomponent + </div> + </div> + + + + <div class="col-md-12" id='endereco'> + <div class="d-flex justify-content-between align-items-center" style="margin-bottom:6px"> + <h5 class="card-title mb-0" style="font-size:20px; font-family:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif; ">Endereço</h5> + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="divCep"> + @component('componentes.input', ['label' => 'CEP']) + <input name="cep" type="text" id="cep" value="{{ old('cep', $user->endereco->cep)}}" class="form-control cep" onblur="pesquisaCep(this.value)" /> + @error('cep') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"><strong>{{ $message }}</strong></span> + @enderror + @endcomponent + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="divUf"> + @component('componentes.input', ['label' => 'Estado']) + <input name="uf" type="text" class="form-control" value="{{ old('uf', $user->endereco->uf)}}" id="uf" /> + @error('uf') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"><strong>{{ $message }}</strong></span> + @enderror + @endcomponent + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="divCidade"> + @component('componentes.input', ['label' => 'Cidade']) + <input name="cidade" type="text" id="cidade" class="form-control" value="{{ old('cidade', $user->endereco->cidade)}}" /> + @error('cidade') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"><strong>{{ $message }}</strong></span> + @enderror + @endcomponent + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id="divBairro"> + @component('componentes.input', ['label' => 'Bairro']) + <input name="bairro" type="text" id="bairro" class="form-control" value="{{ old('bairro', $user->endereco->bairro)}}" /> + @error('bairro') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"><strong>{{ $message }}</strong></span> + @enderror + @endcomponent + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id='divRua'> + @component('componentes.input', ['label' => 'Rua']) + <input name="rua" type="text" id="rua" class="form-control" value="{{ old('rua', $user->endereco->rua)}}" /> + @error('rua') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"><strong>{{ $message }}</strong></span> + @enderror + @endcomponent + </div> + </div> + <div class="col-md-6"> + <div class="form-group" id='numero'> + @component('componentes.input', ['label' => 'Número']) + <input name="numero" type="text" class="form-control" value="{{ old('numero', $user->endereco->numero)}}" /> + @error('numero') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"><strong>{{ $message }}</strong></span> + @enderror + @endcomponent + </div> + </div> + <div class='col-md-12'> + <div class="form-group" id='complemento'> + <label class=" control-label" for="firstname" style="font-weight:600;">Complemento</label> + <input type="text" class="form-control" value="{{old('complemento', $user->endereco->complemento)}}" name="complemento" placeholder="Complemento" maxlength="75" id="complemento" /> + <span style="color: red; font-size: 12px" id="caracsRestantescomplemento"> + </span> + @error('complemento') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + + + <div class="col-md-12"> + <div class="form-group"> + <label for="linkLattes" class="col-form-label" style="font-weight:600;">{{ __('Link do CurrÃculo Lattes') }}<span style="color: red; font-weight:bold;">*</span></label> + <input id="linkLattes" type="text" class="form-control @error('linkLattes') is-invalid @enderror" name="linkLattes" placeholder="Digite o link do currÃculo Lattes" @if ($user->participantes()->exists()) value="{{ old('linkLattes', $user->participantes()->first()->linkLattes) }}" @else value="{{ old('linkLattes') }}" @endif autocomplete="nome"> + + @error('linkLattes') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-12"> + <div class="d-flex justify-content-between align-items-center" style="margin-bottom:-0.3rem"> + <h5 class="card-title" style="font-size:20px; font-family:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif; ">Acesso ao sistema</h5> + <div class="form-group"> + <input type="checkbox" id="alterarSenhaCheckBox" name="alterarSenhaCheckBox" onchange="habilitando()"> + <label for="alterarSenhaCheckBox" style="color:#909090">Desejo alterar minha senha</label> + </div> + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <label for="emailFix" class="col-form-label">{{ __('E-mail*') }}</label> + <input id="emailFix" type="email" class="form-control" value="{{$user->email}}" disabled> + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <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> + + @error('senha_atual') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <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> + + @error('nova_senha') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="col-md-6"> + <div class="form-group"> + <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> + + @error('confirmar_senha') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + <div class="d-flex justify-content-between col-12"> + <div> + <a class="btn btn-light botao-form" href="{{ route('home') }}" style="color:red; margin-left:5px;">Cancelar</a> + </div> + <div> + <button type="submit" class="btn btn-success botao-form" style=""> + {{ __('Atualizar') }} + </button> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </form> +</div> +@endsection + +@section('javascript') +<script type="text/javascript"> + $(document).ready(function($) { + $('#cpf').mask('000.000.000-00'); + var SPMaskBehavior = function(val) { + return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009'; + }, + spOptions = { + onKeyPress: function(val, e, field, options) { + field.mask(SPMaskBehavior.apply({}, arguments), options); + } + }; + $('#celular').mask(SPMaskBehavior, spOptions); + $('#SIAPE').mask('00000000'); + $('#AnoTitulacao').mask('0000'); + $('#cep').mask('00000-000'); + }); + + function habilitando() { + var checkbox = document.getElementById('alterarSenhaCheckBox'); + if (checkbox.checked) { + document.getElementById('senha_atual').disabled = false; + document.getElementById('nova_senha').disabled = false; + document.getElementById('confirmar_senha').disabled = false; + } else { + document.getElementById('senha_atual').disabled = true; + document.getElementById('nova_senha').disabled = true; + document.getElementById('confirmar_senha').disabled = true; + } + } + function mudarPerfil() { + var divDataNascimento = document.getElementById('dataNascimento'); + var divCurso = document.getElementById('curso'); + var divEndereco = document.getElementById('endereco'); + var divCep = document.getElementById('divCep'); + var divUf = document.getElementById('divUf'); + var divCidade = document.getElementById('divCidade'); + var divBairro = document.getElementById('divBairro'); + var divRua = document.getElementById('divRua'); + var divNumero = document.getElementById('numero'); + var divComplemento = document.getElementById('complemento'); + + var divCursos = document.getElementById('divCursos'); + var divVinculo = document.getElementById('divVinculo'); + var divTitulacaoMax = document.getElementById('divTitulacaoMax'); + var divAnoTitulacao = document.getElementById('anoTitulacao'); + var divAreaFormacao = document.getElementById('areaFormacao'); + var divSIAPE = document.getElementById('siape'); + var divBolsista = document.getElementById('bolsista'); + var divNivel = document.getElementById('nivelInput'); + var divOutroVinculo = document.getElementById('divOutro'); + + var comboBoxPerfil = document.getElementById('perfil'); + + if(comboBoxPerfil.value === "Professor" || comboBoxPerfil.value === "Técnico" || comboBoxPerfil.value === "Outro"){ + divVinculo.style.display = "block"; + divTitulacaoMax.style.display = "block"; + divAnoTitulacao.style.display = "block"; + divAreaFormacao.style.display = "block"; + divSIAPE.style.display = "block"; + divBolsista.style.display = "block"; + + if (comboBoxPerfil.value === "Professor"){ + divCursos.style.display = "block"; + } else { + divCursos.style.display = "none"; + } + + + } else { + divVinculo.style.display = "none"; + divTitulacaoMax.style.display = "none"; + divAnoTitulacao.style.display = "none"; + divAreaFormacao.style.display = "none"; + divSIAPE.style.display = "none"; + divBolsista.style.display = "none"; + divCursos.style.display = "none"; + } + + if(comboBoxPerfil.value === "Estudante"){ + divDataNascimento.style.display = "block"; + divCurso.style.display = "block"; + divEndereco.style.display = "block"; + divCep.style.display = "block"; + divUf.style.display = "block"; + divCidade.style.display = "block"; + divBairro.style.display = "block"; + divRua.style.display = "block"; + divNumero.style.display = "block"; + divComplemento.style.display = "block"; + divNivel.style.display = "none"; + divOutroVinculo.style.display = "none"; + + } else { + divDataNascimento.style.display = "none"; + divCurso.style.display = "none"; + divEndereco.style.display = "none"; + divCep.style.display = "none"; + divUf.style.display = "none"; + divCidade.style.display = "none"; + divBairro.style.display = "none"; + divRua.style.display = "none"; + divNumero.style.display = "none"; + divComplemento.style.display = "none"; + } + + outroPerfil(); + outroVinculo(); + } + + function outroCurso(){ + var comboBoxCurso = document.getElementById('cursoEstudante'); + var divCurso = document.getElementById('divCursoEstudante'); + + if (comboBoxCurso.value === "Outro") { + divCurso.style.display = "block"; + } else { + divCurso.style.display = "none"; + } + } + + function outroPerfil() { + var comboBoxPerfil = document.getElementById('perfil'); + var divOutro = document.getElementById('outroPerfil'); + + if (comboBoxPerfil.value === "Outro") { + divOutro.style.display = "block"; + } else { + divOutro.style.display = "none"; + } + } + + function outroVinculo() { + var comboBoxVinculo = document.getElementById('vinculo'); + var divOutro = document.getElementById('divOutro'); + + if (comboBoxVinculo.value === "Outro" && document.getElementById('perfil').value !== "Estudante") { + divOutro.style.display = "block"; + } else { + divOutro.style.display = "none"; + } + } + + function mudarNivel() { + var bolsista = document.getElementById('bolsistaProdutividade'); + var nivel = document.getElementById('nivelInput'); + + if (bolsista.value === "sim") { + nivel.style.display = "block"; + } else { + nivel.style.display = "none"; + } + } + + function showInstituicao() { + var instituicao = document.getElementById('instituicao'); + var instituicaoSelect = document.getElementById('instituicaoSelect'); + + if (instituicaoSelect.value === "Outra") { + document.getElementById("displayOutro").style.display = "block"; + instituicao.parentElement.style.display = ''; + document.getElementById('instituicao').value = ""; + } else if (instituicaoSelect.value === "UFAPE") { + document.getElementById("displayOutro").style.display = "none"; + } + } + + function onload() { + mudarNivel(); + outroVinculo(); + mudarPerfil(); + showInstituicao(); + outroCurso(); + } + window.onload = onload(); +</script> + +<script> +//----------------------------- Scripts para auto-complete de endereço --------------------------------// + + function limpa_formulário_cep() { + //Limpa valores do formulário de cep. + document.getElementById(`rua`).value = (""); + document.getElementById(`bairro`).value = (""); + document.getElementById(`cidade`).value = (""); + document.getElementById(`uf`).value = (""); + //document.getElementById('ibge').value=(""); + } + + function meu_callback(conteudo) { + if (!("erro" in conteudo)) { + //Atualiza os campos com os valores. + document.getElementById(`rua`).value = (conteudo.logradouro); + document.getElementById(`bairro`).value = (conteudo.bairro); + document.getElementById(`cidade`).value = (conteudo.localidade); + document.getElementById(`uf`).value = (conteudo.uf); + + + //document.getElementById('ibge').value=(conteudo.ibge); + } //end if. + else { + //CEP não Encontrado. + limpa_formulário_cep(); + alert("CEP não encontrado."); + } + } + + function pesquisaCep(valor) { + //Nova variável "cep" somente com dÃgitos. + var cep = valor.replace(/\D/g, ''); + + //Verifica se campo cep possui valor informado. + if (cep != "") { + + //Expressão regular para validar o CEP. + var validacep = /^[0-9]{8}$/; + + //Valida o formato do CEP. + if (validacep.test(cep)) { + + //Preenche os campos com "..." enquanto consulta webservice. + document.getElementById(`rua`).value = "..."; + document.getElementById(`bairro`).value = "..."; + document.getElementById(`cidade`).value = "..."; + document.getElementById(`uf`).value = "..."; + //document.getElementById('ibge').value="..."; + + //Cria um elemento javascript. + var script = document.createElement('script'); + + //Sincroniza com o callback. + script.src = 'https://viacep.com.br/ws/' + cep + '/json/?callback=meu_callback'; + + //Insere script no documento e carrega o conteúdo. + document.body.appendChild(script); + + } //end if. + else { + //cep é inválido. + limpa_formulário_cep(); + alert("Formato de CEP inválido."); + } + } //end if. + else { + //cep sem valor, limpa formulário. + limpa_formulário_cep(); + } + }; +</script> + + +@endsection \ No newline at end of file