Commit ef18bc0a authored by Gabriel Alves's avatar Gabriel Alves
Browse files

ajuste notificacao e parametrizacao ODS

parent 16fc0a38
...@@ -932,15 +932,25 @@ class AdministradorController extends Controller ...@@ -932,15 +932,25 @@ class AdministradorController extends Controller
public function adicionar(Request $request) public function adicionar(Request $request)
{ {
$evento = Evento::where('id', $request->evento_id)->first(); $evento = Evento::where('id', $request->evento_id)->first();
$aval = Avaliador::where('id', $request->avaliador_id)->first(); $avaliador = Avaliador::where('id', $request->avaliador_id)->first();
$aval->eventos()->attach($evento); $avaliador->eventos()->attach($evento);
$aval->save(); $avaliador->save();
$user = $aval->user()->first(); $user = $avaliador->user()->first();
$subject = 'Convite para avaliar projetos da UPE'; $subject = 'Convite para avaliar projetos da UPE';
Mail::to($user->email) Mail::to($user->email)
->send(new EmailParaUsuarioNaoCadastrado($user->name, ' ', 'Avaliador-Cadastrado', $evento->nome, ' ', $subject, $evento->tipo, $evento->natureza_id)); ->send(new EmailParaUsuarioNaoCadastrado($user->name, ' ', 'Avaliador-Cadastrado', $evento->nome, ' ', $subject, $evento->tipo, $evento->natureza_id));
$notificacao = Notificacao::create([
'remetente_id' => Auth::user()->id,
'destinatario_id' => $avaliador->user_id,
'trabalho_id' => $evento->id,
'lido' => false,
'tipo' => 5,
]);
$notificacao->save();
return redirect()->back(); return redirect()->back();
} }
......
...@@ -170,7 +170,7 @@ class EventoController extends Controller ...@@ -170,7 +170,7 @@ class EventoController extends Controller
$evento->fim_recurso = $request->fim_recurso; $evento->fim_recurso = $request->fim_recurso;
$evento->resultado_preliminar = $request->resultado_preliminar; $evento->resultado_preliminar = $request->resultado_preliminar;
$evento->resultado_final = $request->resultado_final; $evento->resultado_final = $request->resultado_final;
$evento-> quantidade_ods = $request->quantidade_ods;
if ($request->dt_inicioRelatorioParcial) { if ($request->dt_inicioRelatorioParcial) {
$evento->dt_inicioRelatorioParcial = $request->dt_inicioRelatorioParcial; $evento->dt_inicioRelatorioParcial = $request->dt_inicioRelatorioParcial;
} }
......
...@@ -8,6 +8,7 @@ use App\SolicitacaoCertificado; ...@@ -8,6 +8,7 @@ use App\SolicitacaoCertificado;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use App\Evento;
class NotificacaoController extends Controller class NotificacaoController extends Controller
...@@ -97,7 +98,6 @@ class NotificacaoController extends Controller ...@@ -97,7 +98,6 @@ class NotificacaoController extends Controller
public function listarTrab() public function listarTrab()
{ {
$notificacoes = Notificacao::where('destinatario_id', Auth()->user()->id)->get()->sortByDesc('created_at'); $notificacoes = Notificacao::where('destinatario_id', Auth()->user()->id)->get()->sortByDesc('created_at');
return view('notificacao.listar', ['notificacoes' => $notificacoes]); return view('notificacao.listar', ['notificacoes' => $notificacoes]);
} }
...@@ -122,13 +122,6 @@ class NotificacaoController extends Controller ...@@ -122,13 +122,6 @@ class NotificacaoController extends Controller
} }
} elseif ($notificacao->tipo == 3 || $notificacao->tipo == 4) { } elseif ($notificacao->tipo == 3 || $notificacao->tipo == 4) {
return redirect()->route('planos.listar', ['id' => $notificacao->trabalho->id]); return redirect()->route('planos.listar', ['id' => $notificacao->trabalho->id]);
} elseif ($notificacao->tipo == 5) {
if (!is_null(Auth::user()->avaliadors->eventos->where('id', $notificacao->trabalho->evento->id)->first()->pivot->convite)
&& Auth::user()->avaliadors->eventos->where('id', $notificacao->trabalho->evento->id)->first()->pivot->convite == true) {
return redirect()->route('avaliador.visualizarTrabalho', ['evento_id' => $notificacao->trabalho->evento->id]);
} else {
return redirect()->route('avaliador.editais');
}
}elseif ($notificacao->tipo == 7) { }elseif ($notificacao->tipo == 7) {
if ($notificacao->destinatario_id == Auth()->user()->id && Auth()->user()->tipo != 'proponente') { if ($notificacao->destinatario_id == Auth()->user()->id && Auth()->user()->tipo != 'proponente') {
return redirect()->route('admin.analisarProposta', ['id' => $notificacao->trabalho->id]); return redirect()->route('admin.analisarProposta', ['id' => $notificacao->trabalho->id]);
...@@ -136,7 +129,14 @@ class NotificacaoController extends Controller ...@@ -136,7 +129,14 @@ class NotificacaoController extends Controller
} elseif ($notificacao->tipo == 6) { } elseif ($notificacao->tipo == 6) {
return redirect()->route('trabalho.show', ['id' => $notificacao->trabalho->id]); return redirect()->route('trabalho.show', ['id' => $notificacao->trabalho->id]);
} }
$avaliadorEvento = Auth::user()->avaliadors->eventos->where('id', $notificacao->trabalho->evento->id)->first();
if ($avaliadorEvento && !is_null($avaliadorEvento->pivot) && $avaliadorEvento->pivot->convite == true) {
return redirect()->route('avaliador.visualizarTrabalho', ['evento_id' => $notificacao->trabalho->evento->id]);
} else {
return redirect()->route('avaliador.editais');
}
} }
......
...@@ -95,12 +95,13 @@ class TrabalhoController extends Controller ...@@ -95,12 +95,13 @@ class TrabalhoController extends Controller
public function index($id) public function index($id)
{ {
$edital = Evento::find($id); $edital = Evento::find($id);
$quantidade_ods = $edital->quantidade_ods;
$grandeAreas = GrandeArea::orderBy('nome')->get(); $grandeAreas = GrandeArea::orderBy('nome')->get();
$areaTematicas = AreaTematica::orderBy('nome')->get(); $areaTematicas = AreaTematica::orderBy('nome')->get();
$ODS = ObjetivoDeDesenvolvimentoSustentavel::with('metas')->get(); $ODS = ObjetivoDeDesenvolvimentoSustentavel::with('metas')->get();
$funcaoParticipantes = FuncaoParticipantes::orderBy('nome')->get(); $funcaoParticipantes = FuncaoParticipantes::orderBy('nome')->get();
$proponente = Proponente::where('user_id', Auth::user()->id)->first(); $proponente = Proponente::where('user_id', Auth::user()->id)->first();
if($proponente == null){ if($proponente == null){
return view('proponente.cadastro')->with(['mensagem' => 'Você não possui perfil de Proponente, para submeter algum projeto preencha o formulário.']);; return view('proponente.cadastro')->with(['mensagem' => 'Você não possui perfil de Proponente, para submeter algum projeto preencha o formulário.']);;
} }
...@@ -117,8 +118,9 @@ class TrabalhoController extends Controller ...@@ -117,8 +118,9 @@ class TrabalhoController extends Controller
'rascunho' => $rascunho, 'rascunho' => $rascunho,
'enum_turno' => Participante::ENUM_TURNO, 'enum_turno' => Participante::ENUM_TURNO,
'estados' => $this->estados, 'estados' => $this->estados,
'areaTematicas' => $areaTematicas, 'areaTematicas' => $areaTematicas,
'ods' =>$ODS, 'ods' =>$ODS,
'quantidade_ods' =>$quantidade_ods
]); ]);
} }
...@@ -2263,6 +2265,8 @@ class TrabalhoController extends Controller ...@@ -2263,6 +2265,8 @@ class TrabalhoController extends Controller
} }
} }
} }
\ No newline at end of file
...@@ -18,7 +18,8 @@ class CreateEventosTable extends Migration ...@@ -18,7 +18,8 @@ class CreateEventosTable extends Migration
$table->timestamps(); $table->timestamps();
$table->string('nome')->nullable(); $table->string('nome')->nullable();
$table->text('descricao')->nullable(); $table->text('descricao')->nullable();
$table->string('tipo')->nullable(); $table->string('tipo')->nullable();
$table->unsignedBigInteger('quantidade_ods')->nullable();
$table->unsignedBigInteger('natureza_id')->nullable(); $table->unsignedBigInteger('natureza_id')->nullable();
$table->date('inicioSubmissao')->nullable(); $table->date('inicioSubmissao')->nullable();
$table->date('fimSubmissao')->nullable(); $table->date('fimSubmissao')->nullable();
......
...@@ -58,7 +58,16 @@ ...@@ -58,7 +58,16 @@
</span> </span>
@enderror @enderror
</div> </div>
<div class="col-sm-2">
<label for="quantidade_ods" class="col-form-label">{{ __('Quantidade de ODS\'s:') }}<span style="color:red; font-weight:bold;">*</span></label>
<select id="quantidade_ods" class="form-control" name="quantidade_ods" required>
@for ($i = 1; $i <= 5; $i++)
<option value="{{ $i }}" @if(old('quantidade_ods') == $i) selected @endif>{{ $i }}</option>
@endfor
</select>
</div>
<div class="col-sm-3"> <div class="col-sm-3">
<label for="natureza" class="col-form-label">{{ __('Natureza:') }}<span style="color:red; font-weight:bold;">*</span></label> <label for="natureza" class="col-form-label">{{ __('Natureza:') }}<span style="color:red; font-weight:bold;">*</span></label>
<select onchange="selecionar_decisao_camara()" id="natureza" type="text" class="form-control @error('natureza') is-invalid @enderror" name="natureza" value="{{ old('natureza') }}"> <select onchange="selecionar_decisao_camara()" id="natureza" type="text" class="form-control @error('natureza') is-invalid @enderror" name="natureza" value="{{ old('natureza') }}">
......
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div> <div>
{{-- action="{{route('trabalho.store')}}" --}} {{-- action="{{route('trabalho.store')}}" --}}
<form method="POST" id="criarProjetoForm" action="{{route('trabalho.store')}}" enctype="multipart/form-data" > <form method="POST" id="criarProjetoForm" action="{{route('trabalho.store')}}" enctype="multipart/form-data" >
@csrf @csrf
<input type="hidden" name="editalId" value="{{$edital->id}}"> <input type="hidden" name="editalId" value="{{$edital->id}}">
<input type="hidden" name="quantidadeModais" id="quantidadeModais" value="{{old('quantidadeModais', 0)}}" > <input type="hidden" name="quantidadeModais" id="quantidadeModais" value="{{old('quantidadeModais', 0)}}" >
<div class="container"> <div class="container">
<div class="row justify-content-center" style="margin-top: 35px"> <div class="row justify-content-center" style="margin-top: 35px">
<div class="alert alert-danger" id="notificacao-erro" style="display: none;" role="alert"> <div class="alert alert-danger" id="notificacao-erro" style="display: none;" role="alert">
não pode selecionar mais de 3 ods não pode selecionar mais de 3 ods
</div> </div>
@include('evento.formulario.projeto') @include('evento.formulario.projeto')
@include('evento.formulario.proponente') @include('evento.formulario.proponente')
@if ($edital->numParticipantes != 0) @if ($edital->numParticipantes != 0)
@include('evento.formulario.integrantes') @include('evento.formulario.integrantes')
@endif @endif
@include('evento.formulario.anexos') @include('evento.formulario.anexos')
@include('evento.formulario.finalizar') @include('evento.formulario.finalizar')
<style> <style>
.col-form-label { .col-form-label {
font-size: 15.5px; font-size: 15.5px;
} }
</style> </style>
</div> </div>
</div> </div>
</form> </form>
@if ($edital->numParticipantes != 0) @if ($edital->numParticipantes != 0)
<div id="participanteFirst" > <div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ]) @component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent @endcomponent
</div> </div>
@endif @endif
<!-- Modal de Aviso Edit --> <!-- Modal de Aviso Edit -->
<div class="modal fade" id="exampleModalAnexarDocumento" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel2" aria-hidden="true"> <div class="modal fade" id="exampleModalAnexarDocumento" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel2" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" id="idCorCabecalhoModalDocumento"> <div class="modal-header" id="idCorCabecalhoModalDocumento">
<h5 class="modal-title" id="exampleModalLabel2" style="font-size:20px; margin-top:7px; color:white; font-weight:bold; font-family: 'Roboto', sans-serif;">Aviso</h5> <h5 class="modal-title" id="exampleModalLabel2" style="font-size:20px; margin-top:7px; color:white; font-weight:bold; font-family: 'Roboto', sans-serif;">Aviso</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
<div class="col-12" style="font-family: 'Roboto', sans-serif;"><label id="idTituloDaMensagemModalDocumento"></label></div> <div class="col-12" style="font-family: 'Roboto', sans-serif;"><label id="idTituloDaMensagemModalDocumento"></label></div>
<div class="col-12" style="font-family: 'Roboto', sans-serif; margin-top:10px;"> <div class="col-12" style="font-family: 'Roboto', sans-serif; margin-top:10px;">
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button> <button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="modalCpfInvalido" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel2" aria-hidden="true"> <div class="modal fade" id="modalCpfInvalido" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel2" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" style="background-color: red;"> <div class="modal-header" style="background-color: red;">
<h5 class="modal-title" id="exampleModalLabel2" style="font-size:20px; margin-top:7px; color:white; font-weight:bold; font-family: 'Roboto', sans-serif;">Aviso</h5> <h5 class="modal-title" id="exampleModalLabel2" style="font-size:20px; margin-top:7px; color:white; font-weight:bold; font-family: 'Roboto', sans-serif;">Aviso</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
Existe um CPF inválido em um dos discentes por favor corrija para continuar. Existe um CPF inválido em um dos discentes por favor corrija para continuar.
</div> </div>
{{-- <div class="modal-footer"> {{-- <div class="modal-footer">
{{-- <button type="button" class="btn btn-secondary"></button> {{-- <button type="button" class="btn btn-secondary"></button>
{{-- <button type="button" class="btn btn-primary">Certo</button> {{-- <button type="button" class="btn btn-primary">Certo</button>
</div> --}} </div> --}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection
@section('javascript') @section('javascript')
<script> <script>
let buttonSubmit = document.getElementById('idButtonSubmitProjeto'); let buttonSubmit = document.getElementById('idButtonSubmitProjeto');
let buttonRascunho = document.getElementById('idButtonSubmitRascunho'); let buttonRascunho = document.getElementById('idButtonSubmitRascunho');
@if($edital->numParticipantes != 0) @if($edital->numParticipantes != 0)
let parts = document.getElementById('participante'); let parts = document.getElementById('participante');
let partsFirst = document.getElementById('participanteFirst'); let partsFirst = document.getElementById('participanteFirst');
const participante = partsFirst.firstElementChild; const participante = partsFirst.firstElementChild;
@endif @endif
let contador = 0; let contador = 0;
var quantidadeOds = "{{ $quantidade_ods }}"
buttonSubmit.addEventListener('click', (e)=>{ buttonSubmit.addEventListener('click', (e)=>{
$('.collapse').addClass('show') $('.collapse').addClass('show')
}) })
buttonRascunho.addEventListener('click', (e)=>{ buttonRascunho.addEventListener('click', (e)=>{
$('.collapse').addClass('show') $('.collapse').addClass('show')
$("form#criarProjetoForm").prepend('<input id="input_rascunho" type="hidden" name="rascunho" value="true" />'); $("form#criarProjetoForm").prepend('<input id="input_rascunho" type="hidden" name="rascunho" value="true" />');
$("form#criarProjetoForm").submit(); $("form#criarProjetoForm").submit();
}) })
@if($edital->numParticipantes != 0) @if($edital->numParticipantes != 0)
function gerarPeriodo(e){ function gerarPeriodo(e){
var select = e.parentElement.parentElement.nextElementSibling; var select = e.parentElement.parentElement.nextElementSibling;
selectPeriodos = select.children[0].children[1]; selectPeriodos = select.children[0].children[1];
var html = `<option value="" disabled selected>-- TOTAL DE PERÍODOS --</option>`; var html = `<option value="" disabled selected>-- TOTAL DE PERÍODOS --</option>`;
for(var i = 0; i < parseInt(e.value); i++) { for(var i = 0; i < parseInt(e.value); i++) {
html += `<option value="${i+1}">${i+1}º</option>`; html += `<option value="${i+1}">${i+1}º</option>`;
} }
$(selectPeriodos).html(''); $(selectPeriodos).html('');
$(selectPeriodos).append(html); $(selectPeriodos).append(html);
} }
function removerPart(e){ function removerPart(e){
console.log(e) console.log(e)
if(e.parentElement.parentElement){ if(e.parentElement.parentElement){
if(parts.children.length <= 1){ if(parts.children.length <= 1){
}else{ }else{
parts.removeChild(e.parentElement.parentElement); parts.removeChild(e.parentElement.parentElement);
//contador--; //contador--;
} }
} }
} }
buttonMais.addEventListener("click", (e) => { buttonMais.addEventListener("click", (e) => {
if(parts.children.length >= "{{ $edital->numParticipantes }}"){ if(parts.children.length >= "{{ $edital->numParticipantes }}"){
alert('Limite de participante.') alert('Limite de participante.')
}else{ }else{
contador++; contador++;
var cln = participante.cloneNode(true); var cln = participante.cloneNode(true);
cln.setAttribute('style', " "); cln.setAttribute('style', " ");
var id = cln.children[2].firstElementChild.id; var id = cln.children[2].firstElementChild.id;
var id2 = cln.children[0].firstElementChild.id; var id2 = cln.children[0].firstElementChild.id;
cln.children[2].firstElementChild.setAttribute('id', id + contador); cln.children[2].firstElementChild.setAttribute('id', id + contador);
cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador); cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador);
cln.children[0].firstElementChild.setAttribute('id', id2 + contador); cln.children[0].firstElementChild.setAttribute('id', id2 + contador);
for (i = 0; i < cln.children.length; i++) { for (i = 0; i < cln.children.length; i++) {
for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) { for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) {
let input = cln.children[i].querySelectorAll('input')[index]; let input = cln.children[i].querySelectorAll('input')[index];
let name = input.getAttributeNode("name").value; let name = input.getAttributeNode("name").value;
name = name.replace("[]", ""); name = name.replace("[]", "");
input.getAttributeNode("name").value = name + '['+ contador +']'; input.getAttributeNode("name").value = name + '['+ contador +']';
let select = cln.children[i].querySelectorAll('select')[index]; let select = cln.children[i].querySelectorAll('select')[index];
if(select){ if(select){
let selectName = select.getAttributeNode("name").value; let selectName = select.getAttributeNode("name").value;
selectName = selectName.replace("[", ""); selectName = selectName.replace("[", "");
selectName = selectName.replace("]", ""); selectName = selectName.replace("]", "");
select.getAttributeNode("name").value = selectName + '['+ contador +']'; select.getAttributeNode("name").value = selectName + '['+ contador +']';
} }
} }
} }
var SPMaskBehavior = function (val) { var SPMaskBehavior = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009'; return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
}, },
spOptions = { spOptions = {
onKeyPress: function(val, e, field, options) { onKeyPress: function(val, e, field, options) {
field.mask(SPMaskBehavior.apply({}, arguments), options); field.mask(SPMaskBehavior.apply({}, arguments), options);
} }
}; };
parts.appendChild(cln); parts.appendChild(cln);
$("input.cpf:text").val("").mask("000.000.000-00"); $("input.cpf:text").val("").mask("000.000.000-00");
$("input.celular:text").val("").mask(SPMaskBehavior, spOptions); $("input.celular:text").val("").mask(SPMaskBehavior, spOptions);
$("input.cep:text").val("").mask("00000-000"); $("input.cep:text").val("").mask("00000-000");
} }
}); });
$("input.rg:text").mask('00.000.000-0'); $("input.rg:text").mask('00.000.000-0');
function get_funcao(id){ function get_funcao(id){
let funcao = document.getElementById("funcao_participante"); let funcao = document.getElementById("funcao_participante");
let fun_part = <?php echo json_encode($funcaoParticipantes); ?>; let fun_part = <?php echo json_encode($funcaoParticipantes); ?>;
let nome_funcao = ""; let nome_funcao = "";
fun_part.forEach(function(func, i){ fun_part.forEach(function(func, i){
if(func.id == id){ if(func.id == id){
nome_funcao = func.nome; nome_funcao = func.nome;
} }
}); });
return nome_funcao; return nome_funcao;
} }
function marcar(id, data = null){ function marcar(id, data = null){
let nome = document.getElementById("nome"+id); let nome = document.getElementById("nome"+id);
let linkNome = document.getElementById("nomePart"+(id+1)); let linkNome = document.getElementById("nomePart"+(id+1));
let nomePlano = document.getElementById("nomePlano"+(id+1)); let nomePlano = document.getElementById("nomePlano"+(id+1));
let linkTituloProj = document.getElementById("tituloProj"+(id+1)); let linkTituloProj = document.getElementById("tituloProj"+(id+1));
let planoTrabalho = document.getElementById("nomePlanoTrabalho"+id); let planoTrabalho = document.getElementById("nomePlanoTrabalho"+id);
let instituicao = document.getElementById('instituicao['+id+']'); let instituicao = document.getElementById('instituicao['+id+']');
let celular = document.getElementById('celular'+id); let celular = document.getElementById('celular'+id);
let estudante = document.getElementById("estudante["+id+"]"); let estudante = document.getElementById("estudante["+id+"]");
let cpf = document.getElementById("cpf"+id); let cpf = document.getElementById("cpf"+id);
let funcao = document.getElementById("funcao_participante"); let funcao = document.getElementById("funcao_participante");
let email = document.getElementById("email"+id); let email = document.getElementById("email"+id);
let funcaoParticipantes = <?php echo json_encode($funcaoParticipantes); ?>; let funcaoParticipantes = <?php echo json_encode($funcaoParticipantes); ?>;
let nome_funcao = get_funcao(funcao.value); let nome_funcao = get_funcao(funcao.value);
let curso = document.getElementById('curso['+id+']').value; let curso = document.getElementById('curso['+id+']').value;
if(nome.value != ""){ if(nome.value != ""){
estudante.value = true; estudante.value = true;
nomePlano.innerHTML = exibirInformacoesGeraisDoIntegrante(nome.value, email.value, celular.value, curso, nome_funcao); nomePlano.innerHTML = exibirInformacoesGeraisDoIntegrante(nome.value, email.value, celular.value, curso, nome_funcao);
if (nome_funcao == "Bolsista") { if (nome_funcao == "Bolsista") {
nomePlano.innerHTML += `<br><strong>Plano: </strong>${planoTrabalho.value !== null ? planoTrabalho.value : ''}`; nomePlano.innerHTML += `<br><strong>Plano: </strong>${planoTrabalho.value !== null ? planoTrabalho.value : ''}`;
} }
}else if(data != null) { }else if(data != null) {
estudante.value = false; estudante.value = false;
nome.value = data[0].name; nome.value = data[0].name;
email.value = data[0].email; email.value = data[0].email;
instituicao.value = data[0].instituicao; instituicao.value = data[0].instituicao;
cpf.value = data[0].cpf; cpf.value = data[0].cpf;
celular.value = data[0].celular; celular.value = data[0].celular;
nome_funcao = data[1].nome; nome_funcao = data[1].nome;
curso = data[2].curso; curso = data[2].curso;
nomePlano.innerHTML = exibirInformacoesGeraisDoIntegrante(nome.value, email.value, celular.value, curso, nome_funcao); nomePlano.innerHTML = exibirInformacoesGeraisDoIntegrante(nome.value, email.value, celular.value, curso, nome_funcao);
} }
if(id >=1){ if(id >=1){
document.getElementById("cancelar"+(id-1)).setAttribute("disabled", true); document.getElementById("cancelar"+(id-1)).setAttribute("disabled", true);
} }
document.getElementById("checkB"+id).checked = true; document.getElementById("checkB"+id).checked = true;
//$("#atribuir1").attr('data-target','#modalIntegrante'+(id+1)); //$("#atribuir1").attr('data-target','#modalIntegrante'+(id+1));
modal_id = id+1; modal_id = id+1;
document.getElementById("quantidadeModais").value = modal_id; document.getElementById("quantidadeModais").value = modal_id;
document.getElementById("part"+id).removeAttribute("hidden"); document.getElementById("part"+id).removeAttribute("hidden");
//document.getElementById("exampleModal"+id).modal('hide'); //document.getElementById("exampleModal"+id).modal('hide');
} }
function exibirInformacoesGeraisDoIntegrante(nome, email, celular, curso, nomeFuncao) { function exibirInformacoesGeraisDoIntegrante(nome, email, celular, curso, nomeFuncao) {
return `<strong>Nome: </strong>${nome}<br> return `<strong>Nome: </strong>${nome}<br>
<strong>E-mail: </strong>${email}<br> <strong>E-mail: </strong>${email}<br>
<strong>Telefone: </strong>${celular !== null ? celular : ''}<br> <strong>Telefone: </strong>${celular !== null ? celular : ''}<br>
<strong>Curso: </strong>${curso !== null ? curso : ''}<br> <strong>Curso: </strong>${curso !== null ? curso : ''}<br>
<strong>Função: </strong>${nomeFuncao}`; <strong>Função: </strong>${nomeFuncao}`;
} }
function desmarcar(id){ function desmarcar(id){
if(id >= 1){; if(id >= 1){;
document.getElementById("cancelar"+(id-1)).removeAttribute("disabled"); document.getElementById("cancelar"+(id-1)).removeAttribute("disabled");
} }
document.getElementById("checkB"+id).checked = false; document.getElementById("checkB"+id).checked = false;
document.getElementById("part"+id).setAttribute("hidden",true); document.getElementById("part"+id).setAttribute("hidden",true);
//$("#atribuir1").attr('data-target','#exampleModal'+(id)); //$("#atribuir1").attr('data-target','#exampleModal'+(id));
modal_id -= 1; modal_id -= 1;
document.getElementById("quantidadeModais").value = modal_id; document.getElementById("quantidadeModais").value = modal_id;
document.getElementById("exampleModal"+id).modal('hide'); document.getElementById("exampleModal"+id).modal('hide');
} }
@endif @endif
</script> </script>
<script> <script>
$( document ).ready( function () { $( document ).ready( function () {
@if($edital->numParticipantes != 0) @if($edital->numParticipantes != 0)
$('#nomeParticipante').keyup(function () { $('#nomeParticipante').keyup(function () {
$('#display').text($(this).val()); $('#display').text($(this).val());
if($('#nomeParticipante').val() == ""){ if($('#nomeParticipante').val() == ""){
$('#display').hide(); $('#display').hide();
$('#pontos').hide(); $('#pontos').hide();
}else{ }else{
$('#display').show(); $('#display').show();
$('#pontos').show(); $('#pontos').show();
} }
}); });
@endif @endif
$.validator.addMethod("alpha", function(value, element) { $.validator.addMethod("alpha", function(value, element) {
return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/); return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/);
}); });
@if($edital->numParticipantes != 0) @if($edital->numParticipantes != 0)
$('input.cep:text').mask('00000-000'); $('input.cep:text').mask('00000-000');
$('input.cpf:text').mask('000.000.000-00'); $('input.cpf:text').mask('000.000.000-00');
$('.numero').mask('0000000000000'); $('.numero').mask('0000000000000');
var SPMaskBehavior = function (val) { var SPMaskBehavior = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009'; return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
}, },
spOptions = { spOptions = {
onKeyPress: function(val, e, field, options) { onKeyPress: function(val, e, field, options) {
field.mask(SPMaskBehavior.apply({}, arguments), options); field.mask(SPMaskBehavior.apply({}, arguments), options);
} }
}; };
$('.celular').mask(SPMaskBehavior, spOptions); $('.celular').mask(SPMaskBehavior, spOptions);
$('.sus').mask('000 0000 0000 0000'); $('.sus').mask('000 0000 0000 0000');
$("input[type='file']").on("change", function () { $("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) { if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" )) // console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!"); alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val(''); $(this).val('');
} }
}); });
@endif @endif
// $.validator.setDefaults( { // $.validator.setDefaults( {
// submitHandler: function (form) { // submitHandler: function (form) {
// form.submit(); // form.submit();
// } // }
// } ); // } );
// jQuery.extend(jQuery.validator.messages, { // jQuery.extend(jQuery.validator.messages, {
// required: "Este campo &eacute; requerido.", // required: "Este campo &eacute; requerido.",
// remote: "Por favor, corrija este campo.", // remote: "Por favor, corrija este campo.",
// email: "Por favor, forne&ccedil;a um endere&ccedil;o eletr&ocirc;nico v&aacute;lido.", // email: "Por favor, forne&ccedil;a um endere&ccedil;o eletr&ocirc;nico v&aacute;lido.",
// url: "Por favor, forne&ccedil;a uma URL v&aacute;lida.", // url: "Por favor, forne&ccedil;a uma URL v&aacute;lida.",
// date: "Por favor, forne&ccedil;a uma data v&aacute;lida.", // date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
// dateISO: "Por favor, forne&ccedil;a uma data v&aacute;lida (ISO).", // dateISO: "Por favor, forne&ccedil;a uma data v&aacute;lida (ISO).",
// number: "Por favor, forne&ccedil;a um n&uacute;mero v&aacute;lido.", // number: "Por favor, forne&ccedil;a um n&uacute;mero v&aacute;lido.",
// digits: "Por favor, forne&ccedil;a somente d&iacute;gitos.", // digits: "Por favor, forne&ccedil;a somente d&iacute;gitos.",
// creditcard: "Por favor, forne&ccedil;a um cart&atilde;o de cr&eacute;dito v&aacute;lido.", // creditcard: "Por favor, forne&ccedil;a um cart&atilde;o de cr&eacute;dito v&aacute;lido.",
// equalTo: "Por favor, forne&ccedil;a o mesmo valor novamente.", // equalTo: "Por favor, forne&ccedil;a o mesmo valor novamente.",
// accept: "Por favor, forne&ccedil;a um valor com uma extens&atilde;o v&aacute;lida.", // accept: "Por favor, forne&ccedil;a um valor com uma extens&atilde;o v&aacute;lida.",
// maxlength: jQuery.validator.format("Por favor, forne&ccedil;a n&atilde;o mais que {0} caracteres."), // maxlength: jQuery.validator.format("Por favor, forne&ccedil;a n&atilde;o mais que {0} caracteres."),
// minlength: jQuery.validator.format("Por favor, forne&ccedil;a ao menos {0} caracteres."), // minlength: jQuery.validator.format("Por favor, forne&ccedil;a ao menos {0} caracteres."),
// rangelength: jQuery.validator.format("Por favor, forne&ccedil;a um valor entre {0} e {1} caracteres de comprimento."), // rangelength: jQuery.validator.format("Por favor, forne&ccedil;a um valor entre {0} e {1} caracteres de comprimento."),
// range: jQuery.validator.format("Por favor, forne&ccedil;a um valor entre {0} e {1}."), // range: jQuery.validator.format("Por favor, forne&ccedil;a um valor entre {0} e {1}."),
// max: jQuery.validator.format("Por favor, forne&ccedil;a um valor menor ou igual a {0}."), // max: jQuery.validator.format("Por favor, forne&ccedil;a um valor menor ou igual a {0}."),
// min: jQuery.validator.format("Por favor, forne&ccedil;a um valor maior ou igual a {0}.") // min: jQuery.validator.format("Por favor, forne&ccedil;a um valor maior ou igual a {0}.")
// }); // });
// $( "#criarProjetoForm" ).validate( { // $( "#criarProjetoForm" ).validate( {
// lang: 'PT_BR', // lang: 'PT_BR',
// rules: { // rules: {
// firstname: "required", // firstname: "required",
// username: { // username: {
// required: true, // required: true,
// minlength: 2 // minlength: 2
// }, // },
// password: { // password: {
// required: true, // required: true,
// minlength: 5 // minlength: 5
// }, // },
// confirm_password: { // confirm_password: {
// required: true, // required: true,
// minlength: 5, // minlength: 5,
// equalTo: "#password" // equalTo: "#password"
// }, // },
// email: { // email: {
// required: true, // required: true,
// email: true, // email: true,
// }, // },
// "complemento[]":{ // "complemento[]":{
// }, // },
// "nomeParticipante[]":{ // "nomeParticipante[]":{
// alpha:true, // alpha:true,
// }, // },
// 'rg[]':{ // 'rg[]':{
// maxlength: 12, // maxlength: 12,
// }, // },
// agree: "required" // agree: "required"
// }, // },
// messages: { // messages: {
// // nomeProjeto: "O nome do projeto é obrigatório.", // // nomeProjeto: "O nome do projeto é obrigatório.",
// // 'emailParticipante[]': "Este campo é obrigatório.", // // 'emailParticipante[]': "Este campo é obrigatório.",
// // 'data_de_nascimento[]': "Este campo é obrigatório.", // // 'data_de_nascimento[]': "Este campo é obrigatório.",
// // 'cpf[]': "Este campo é obrigatório.", // // 'cpf[]': "Este campo é obrigatório.",
// // 'rg[]': { // // 'rg[]': {
// // required: "Este campo é obrigatório.", // // required: "Este campo é obrigatório.",
// // maxlength: "Este campo deve conter no máximo 8 números." // // maxlength: "Este campo deve conter no máximo 8 números."
// // }, // // },
// // 'celular[]': "Este campo é obrigatório.", // // 'celular[]': "Este campo é obrigatório.",
// // 'cep[]': "Este campo é obrigatório.", // // 'cep[]': "Este campo é obrigatório.",
// // 'uf[]': "Este campo é obrigatório.", // // 'uf[]': "Este campo é obrigatório.",
// // 'cidade[]': "Este campo é obrigatório.", // // 'cidade[]': "Este campo é obrigatório.",
// // 'bairro[]': "Este campo é obrigatório.", // // 'bairro[]': "Este campo é obrigatório.",
// // 'rua[]': "Este campo é obrigatório.", // // 'rua[]': "Este campo é obrigatório.",
// // 'numero[]': "Este campo é obrigatório.", // // 'numero[]': "Este campo é obrigatório.",
// // 'complemento[]': "Este campo é obrigatório.", // // 'complemento[]': "Este campo é obrigatório.",
// // 'universidade[]': "Este campo é obrigatório.", // // 'universidade[]': "Este campo é obrigatório.",
// // 'curso[]': "Este campo é obrigatório.", // // 'curso[]': "Este campo é obrigatório.",
// // 'turno[]': "Este campo é obrigatório.", // // 'turno[]': "Este campo é obrigatório.",
// // 'total_periodos[]': "Este campo é obrigatório.", // // 'total_periodos[]': "Este campo é obrigatório.",
// // 'periodo_atual[]': "Este campo é obrigatório.", // // 'periodo_atual[]': "Este campo é obrigatório.",
// // 'ordem_prioridade[]': "Este campo é obrigatório.", // // 'ordem_prioridade[]': "Este campo é obrigatório.",
// // 'media_geral_curso[]': "Este campo é obrigatório.", // // 'media_geral_curso[]': "Este campo é obrigatório.",
// // 'nomePlanoTrabalho[]': "Este campo é obrigatório.", // // 'nomePlanoTrabalho[]': "Este campo é obrigatório.",
// // 'anexoPlanoTrabalho[]': "Este campo é obrigatório.", // // 'anexoPlanoTrabalho[]': "Este campo é obrigatório.",
// // grandeArea: "Escolha uma grande área.", // // grandeArea: "Escolha uma grande área.",
// // area: "Escolha uma área.", // // area: "Escolha uma área.",
// // linkGrupo: "Este campo é obrigatório.", // // linkGrupo: "Este campo é obrigatório.",
// // pontuacaoPlanilha: "Este campo é obrigatório.", // // pontuacaoPlanilha: "Este campo é obrigatório.",
// // anexoProjeto: "Este campo é obrigatório.", // // anexoProjeto: "Este campo é obrigatório.",
// // anexoLattesCoordenador: "Este campo é obrigatório.", // // anexoLattesCoordenador: "Este campo é obrigatório.",
// // anexoConsuPreenchido: "Este campo é obrigatório.", // // anexoConsuPreenchido: "Este campo é obrigatório.",
// // anexoGrupoPesquisa: "Este campo é obrigatório.", // // anexoGrupoPesquisa: "Este campo é obrigatório.",
// // anexoPlanilha: "Este campo é obrigatório.", // // anexoPlanilha: "Este campo é obrigatório.",
// // anexoComiteEtica: "Este campo é obrigatório.", // // anexoComiteEtica: "Este campo é obrigatório.",
// // inputJustificativa: "Este campo é obrigatório.", // // inputJustificativa: "Este campo é obrigatório.",
// // "nomeParticipante[]": { // // "nomeParticipante[]": {
// // required: "O nome do participante é obrigatório.", // // required: "O nome do participante é obrigatório.",
// // alpha: "Não é permitido números." // // alpha: "Não é permitido números."
// // }, // // },
// // username: { // // username: {
// // required: "Please enter a username", // // required: "Please enter a username",
// // minlength: "Your username must consist of at least 2 characters" // // minlength: "Your username must consist of at least 2 characters"
// // }, // // },
// // password: { // // password: {
// // required: "Please provide a password", // // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long" // // minlength: "Your password must be at least 5 characters long"
// // }, // // },
// // confirm_password: { // // confirm_password: {
// // required: "Please provide a password", // // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long", // // minlength: "Your password must be at least 5 characters long",
// // equalTo: "Please enter the same password as above" // // equalTo: "Please enter the same password as above"
// // }, // // },
// // email: "Please enter a valid email address", // // email: "Please enter a valid email address",
// // agree: "Please accept our policy" // // agree: "Please accept our policy"
// }, // },
// errorElement: "em", // errorElement: "em",
// errorPlacement: function ( error, element ) { // errorPlacement: function ( error, element ) {
// // Add the `help-block` class to the error element // // Add the `help-block` class to the error element
// error.addClass( "invalid-feedback" ); // error.addClass( "invalid-feedback" );
// if ( element.prop( "type" ) === "checkbox" ) { // if ( element.prop( "type" ) === "checkbox" ) {
// error.insertAfter( element.parent( "label" ) ); // error.insertAfter( element.parent( "label" ) );
// } else { // } else {
// error.insertAfter( element ); // error.insertAfter( element );
// } // }
// }, // },
// highlight: function ( element, errorClass, validClass ) { // highlight: function ( element, errorClass, validClass ) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" ); // $( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
// }, // },
// unhighlight: function (element, errorClass, validClass) { // unhighlight: function (element, errorClass, validClass) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" ); // $( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
// } // }
// } ); // } );
} ); } );
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function validarCPF(valor){ function validarCPF(valor){
var soma = 0; var soma = 0;
var resto; var resto;
var inputCPF = valor.match(/\d/g).join(''); var inputCPF = valor.match(/\d/g).join('');
if(inputCPF == '00000000000') return false; if(inputCPF == '00000000000') return false;
if(inputCPF.length >11) return false; if(inputCPF.length >11) return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i); for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11; resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0; if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(9, 10))) return false; if(resto != parseInt(inputCPF.substring(9, 10))) return false;
soma = 0; soma = 0;
for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i); for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i);
resto = (soma * 10) % 11; resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0; if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(10, 11))) return false; if(resto != parseInt(inputCPF.substring(10, 11))) return false;
return true; return true;
} }
/* /*
* FUNCAO: Gerar as areas * FUNCAO: Gerar as areas
* *
*/ */
function areas() { function areas() {
var grandeArea = $('#grandeArea').val(); var grandeArea = $('#grandeArea').val();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '{{ route('area.consulta') }}', url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea , data: 'id='+grandeArea ,
headers: headers:
{ {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: (dados) => { success: (dados) => {
if (dados.length > 0) { if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){ if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>'; var option = '<option selected disabled>-- Área --</option>';
} }
$.each(dados, function(i, obj) { $.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){ if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>'; option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{ }else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>'; option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
} }
}) })
} else { } else {
var option = "<option selected disabled>-- Área --</option>"; var option = "<option selected disabled>-- Área --</option>";
} }
$('#area').html(option).show(); $('#area').html(option).show();
subareas(); subareas();
}, },
error: (data) => { error: (data) => {
console.log(data); console.log(data);
} }
}) })
} }
/* /*
* FUNCAO: Gerar as subareas * FUNCAO: Gerar as subareas
* *
*/ */
function subareas() { function subareas() {
var area = $('#area').val(); var area = $('#area').val();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '{{ route('subarea.consulta') }}', url: '{{ route('subarea.consulta') }}',
data: 'id='+area , data: 'id='+area ,
headers: headers:
{ {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: (dados)=> { success: (dados)=> {
if (dados.length > 0) { if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){ if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Subárea --</option>'; var option = '<option selected disabled>-- Subárea --</option>';
} }
$.each(dados, function(i, obj) { $.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){ if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>'; option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{ }else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>'; option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
} }
}) })
} else { } else {
var option = "<option selected disabled>-- Subárea --</option>"; var option = "<option selected disabled>-- Subárea --</option>";
} }
$('#subArea').html(option).show(); $('#subArea').html(option).show();
}, },
error: (dados) => { error: (dados) => {
console.log(dados); console.log(dados);
} }
}) })
} }
/* /*
* FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?" * FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?"
* *
*/ */
function displayAutorizacoesEspeciais(valor){ function displayAutorizacoesEspeciais(valor){
if(valor == "sim"){ if(valor == "sim"){
document.getElementById("radioSim").checked = true; document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false; document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block"; document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none"; document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none"; document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else if(valor == "nao"){ }else if(valor == "nao"){
document.getElementById("radioSim").checked = false; document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true; document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none"; document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block"; document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none"; document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
} }
} }
/* /*
* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF) * FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF)
* *
*/ */
function verificarArquivoAnexado_pdf(item, legenda){ function verificarArquivoAnexado_pdf(item, legenda){
if(item.files[0].type.split('/')[1] != "pdf"){ if(item.files[0].type.split('/')[1] != "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red"; document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado não é do tipo PDF! "; document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado não é do tipo PDF! ";
document.getElementById(legenda).innerHTML = "O arquivo deve ser no formato PDF de até 2MB."; document.getElementById(legenda).innerHTML = "O arquivo deve ser no formato PDF de até 2MB.";
document.getElementById(item.id).value = ""; document.getElementById(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true}); $("#exampleModalAnexarDocumento").modal({show: true});
}else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){ }else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red"; document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado é maior que 2MB!"; document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado é maior que 2MB!";
document.getElementById(legenda).innerHTML = "O arquivo deve ser no formato PDF de até 2MB."; document.getElementById(legenda).innerHTML = "O arquivo deve ser no formato PDF de até 2MB.";
document.getElementById(item.id).value = ""; document.getElementById(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true}); $("#exampleModalAnexarDocumento").modal({show: true});
}else{ }else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2]; document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
} }
} }
/* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS) /* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS)
* *
*/ */
function verificarArquivoAnexado_xls_xlsx_ods(item, legenda){ function verificarArquivoAnexado_xls_xlsx_ods(item, legenda){
if(item.files[0].name.split('.')[1] == "xls" || item.files[0].name.split('.')[1] == "ods" || item.files[0].name.split('.')[1] == "xlsx"){ if(item.files[0].name.split('.')[1] == "xls" || item.files[0].name.split('.')[1] == "ods" || item.files[0].name.split('.')[1] == "xlsx"){
if(item.files[0].size > 2000000){ if(item.files[0].size > 2000000){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red"; document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado é maior que 2MB!"; document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado é maior que 2MB!";
document.getElementById(legenda).innerHTML = "Formato do arquivo: XLS, XLSX ou ODS de até 2MB."; document.getElementById(legenda).innerHTML = "Formato do arquivo: XLS, XLSX ou ODS de até 2MB.";
document.getElementById(item.id).value = ""; document.getElementById(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true}); $("#exampleModalAnexarDocumento").modal({show: true});
}else{ }else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2]; document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
} }
}else{ }else{
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red"; document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado não é do tipo XLS, XLSX ou ODS! "; document.getElementById("idTituloDaMensagemModalDocumento").innerHTML = "O arquivo selecionado não é do tipo XLS, XLSX ou ODS! ";
document.getElementById(legenda).innerHTML = "Formato do arquivo: XLS, XLSX ou ODS de até 2MB."; document.getElementById(legenda).innerHTML = "Formato do arquivo: XLS, XLSX ou ODS de até 2MB.";
document.getElementById(item.id).value = ""; document.getElementById(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true}); $("#exampleModalAnexarDocumento").modal({show: true});
} }
} }
/* /*
* FUNCAO: Gerar periodos 1 * FUNCAO: Gerar periodos 1
* *
*/ */
// function gerarPeriodos1(select) { // function gerarPeriodos1(select) {
// var div = select.parentElement.parentElement; // var div = select.parentElement.parentElement;
// var selectPeriodos = div.children[22].children[1]; // var selectPeriodos = div.children[22].children[1];
// var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`; // var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
// for(var i = 0; i < parseInt(select.value); i++) { // for(var i = 0; i < parseInt(select.value); i++) {
// html += `<option value="${i+1}">${i+1}º</option>`; // html += `<option value="${i+1}">${i+1}º</option>`;
// } // }
// }); // });
// }); // });
// $(document).ready(function(){ // $(document).ready(function(){
// $(".cpf").change(function(){ // $(".cpf").change(function(){
// console.log(this.parentElement.children[0]) // console.log(this.parentElement.children[0])
// if (validarCPF(retirarFormatacao(this.value))) { // if (validarCPF(retirarFormatacao(this.value))) {
// this.parentElement.children[1].style.display = "none"; // this.parentElement.children[1].style.display = "none";
// this.parentElement.children[2].style.display = "block"; // this.parentElement.children[2].style.display = "block";
// } else { // } else {
// this.parentElement.children[1].style.display = "block"; // this.parentElement.children[1].style.display = "block";
// this.parentElement.children[2].style.display = "none"; // this.parentElement.children[2].style.display = "none";
// } // }
// }); // });
// }); // });
function checarCPFdoCampo(input) { function checarCPFdoCampo(input) {
if (input.value.length == 14) { if (input.value.length == 14) {
if (validarCPF(retirarFormatacao(input.value))) { if (validarCPF(retirarFormatacao(input.value))) {
input.parentElement.children[1].style.display = "none"; input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "block"; input.parentElement.children[2].style.display = "block";
} else { } else {
input.parentElement.children[1].style.display = "block"; input.parentElement.children[1].style.display = "block";
input.parentElement.children[2].style.display = "none"; input.parentElement.children[2].style.display = "none";
} }
} else { } else {
input.parentElement.children[1].style.display = "none"; input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "none"; input.parentElement.children[2].style.display = "none";
} }
} }
function validarCPF(strCPF) { function validarCPF(strCPF) {
var soma; var soma;
var resto; var resto;
soma = 0; soma = 0;
// Verifica se foi informado todos os digitos corretamente // Verifica se foi informado todos os digitos corretamente
if (strCPF.length != 11) { if (strCPF.length != 11) {
return false; return false;
} }
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11 // Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if (varificarDigitos(strCPF)) { if (varificarDigitos(strCPF)) {
return false; return false;
} }
// Faz o calculo para validar o CPF // Faz o calculo para validar o CPF
for (var t = 9; t < 11; t++) { for (var t = 9; t < 11; t++) {
for (var d = 0, c = 0; c < t; c++) { for (var d = 0, c = 0; c < t; c++) {
d += strCPF[c] * ((t + 1) - c); d += strCPF[c] * ((t + 1) - c);
} }
d = ((10 * d) % 11) % 10; d = ((10 * d) % 11) % 10;
if (strCPF[c] != d) { if (strCPF[c] != d) {
return false; return false;
} }
} }
return true; return true;
} }
function retirarFormatacao(strCpf) { function retirarFormatacao(strCpf) {
resultado = ""; resultado = "";
for(var i = 0; i < strCpf.length; i++) { for(var i = 0; i < strCpf.length; i++) {
if (strCpf[i] != "." && strCpf[i] != "-") { if (strCpf[i] != "." && strCpf[i] != "-") {
resultado += strCpf[i]; resultado += strCpf[i];
} }
} }
return resultado; return resultado;
} }
function varificarDigitos(strCpf) { function varificarDigitos(strCpf) {
var cont = 1; var cont = 1;
dig1 = strCpf[0]; dig1 = strCpf[0];
for(var i = 1; i < strCpf.length; i++) { for(var i = 1; i < strCpf.length; i++) {
if(dig1 == strCpf[i]) { if(dig1 == strCpf[i]) {
cont++; cont++;
} }
} }
if (cont == strCpf.length) { if (cont == strCpf.length) {
return true; return true;
} }
return false; return false;
} }
function checarCpfs() { function checarCpfs() {
var validacoes = document.getElementsByClassName("cpf-invalido"); var validacoes = document.getElementsByClassName("cpf-invalido");
var count = validacoes.length; var count = validacoes.length;
var quant = 0; var quant = 0;
for(var i = 0; i < validacoes.length; i++) { for(var i = 0; i < validacoes.length; i++) {
if (validacoes[i].style.display == "none") { if (validacoes[i].style.display == "none") {
quant++; quant++;
} }
} }
if(quant == count) { if(quant == count) {
return true; return true;
} }
return false; return false;
} }
function submeterProposta() { function submeterProposta() {
if (checarCpfs()) { if (checarCpfs()) {
document.getElementById("submeterFormProposta").click(); document.getElementById("submeterFormProposta").click();
} else { } else {
$("#modalCpfInvalido").modal('show'); $("#modalCpfInvalido").modal('show');
} }
} }
function mascaraCPF(input) { function mascaraCPF(input) {
var numeros = "0123456789.-"; var numeros = "0123456789.-";
var resultado = ""; var resultado = "";
if (input.value.length < 14) { if (input.value.length < 14) {
for (var i = 0; i < input.value.length; i++) { for (var i = 0; i < input.value.length; i++) {
if (numeros.indexOf(input.value[i]) > -1) { if (numeros.indexOf(input.value[i]) > -1) {
if ((i == 2 || i == 6) && input.value[i+1] != ".") { if ((i == 2 || i == 6) && input.value[i+1] != ".") {
resultado += input.value[i] + "."; resultado += input.value[i] + ".";
} else if (i == 10 && input.value[i+1] != "-") { } else if (i == 10 && input.value[i+1] != "-") {
resultado += input.value[i] + "-"; resultado += input.value[i] + "-";
} else { } else {
resultado += input.value[i]; resultado += input.value[i];
} }
} }
} }
} else { } else {
for (var i = 0; i < 14; i++) { for (var i = 0; i < 14; i++) {
resultado += input.value[i]; resultado += input.value[i];
} }
} }
input.value = resultado; input.value = resultado;
} }
function showInstituicao(instituicao){ function showInstituicao(instituicao){
var instituicaoSelect = instituicao; var instituicaoSelect = instituicao;
var idSelect = instituicaoSelect.name; var idSelect = instituicaoSelect.name;
var instituicao = document.getElementById('outra'+idSelect); var instituicao = document.getElementById('outra'+idSelect);
var display = document.getElementById('display'+idSelect); var display = document.getElementById('display'+idSelect);
if(instituicaoSelect.value === "Outra"){ if(instituicaoSelect.value === "Outra"){
display.style.display = "block"; display.style.display = "block";
instituicao.parentElement.style.display = ''; instituicao.parentElement.style.display = '';
instituicao.value=""; instituicao.value="";
}else if(instituicaoSelect.value === "UFAPE"){ }else if(instituicaoSelect.value === "UFAPE"){
display.style.display = "none"; display.style.display = "none";
} }
} }
function showCurso(curso){ function showCurso(curso){
var cursoSelect = curso; var cursoSelect = curso;
var idSelect = cursoSelect.name; var idSelect = cursoSelect.name;
var curso = document.getElementById('outro'+idSelect); var curso = document.getElementById('outro'+idSelect);
var displayCurso = document.getElementById('display'+idSelect); var displayCurso = document.getElementById('display'+idSelect);
if(cursoSelect.value === "Outro"){ if(cursoSelect.value === "Outro"){
displayCurso.style.display = "block"; displayCurso.style.display = "block";
curso.parentElement.style.display = ''; curso.parentElement.style.display = '';
curso.value=""; curso.value="";
}else{ }else{
displayCurso.style.display = "none"; displayCurso.style.display = "none";
} }
} }
function showAlert($id, $mensagem){ function showAlert($id, $mensagem){
$('#notificacao-erro').html($mensagem) $('#notificacao-erro').html($mensagem)
$($id).fadeIn(); $($id).fadeIn();
$($id)[0].scrollIntoView({ behavior: 'smooth' }); $($id)[0].scrollIntoView({ behavior: 'smooth' });
setTimeout(function() { setTimeout(function() {
$($id).fadeOut(); $($id).fadeOut();
}, 5000); }, 5000);
} }
// Form dinâmico da ODS // Form dinâmico da ODS
$(document).ready(function(){ $(document).ready(function(){
var selectedOds = []; var selectedOds = [];
$('.form-check-input').change(function(){ $('.form-check-input').change(function(){
selectedOds = []; selectedOds = [];
$('#metas-container').empty(); $('#metas-container').empty();
$('.form-check-input:checked').each(function(){ $('.form-check-input:checked').each(function(){
selectedOds.push($(this).val()); selectedOds.push($(this).val());
}); });
if(selectedOds.length > 3){ if(selectedOds.length > quantidadeOds){
showAlert('#notificacao-erro','Você atingiu o limite maximo de ODS selecionadas(3 ODS)') showAlert('#notificacao-erro',`Você atingiu o limite maximo de ODS\'s selecionadas(${quantidadeOds})`)
$(this).prop('checked', false); $(this).prop('checked', false);
selectedOds.pop() selectedOds.pop()
} }
selectedOds.forEach(function(odsId){ selectedOds.forEach(function(odsId){
$.ajax({ $.ajax({
url: '/metas/' + odsId, url: '/metas/' + odsId,
method: 'GET', method: 'GET',
success: function(response){ success: function(response){
var metaOptions = '<hr><div class="col-12"><div class="row subtitulo"><div class="col-sm-12"><p>Metas para ' + response.ods + '</p></div></div></div></div>' + '<div class="form-group">'; var metaOptions = '<hr><div class="col-12"><div class="row subtitulo"><div class="col-sm-12"><p>Metas para ' + response.ods + '</p></div></div></div></div>' + '<div class="form-group">';
response.metas.forEach(function(meta){ response.metas.forEach(function(meta){
metaOptions += '<div class=" card form-check meta-item" style="margin-bottom : 1 rem "><div class="card-body">' + metaOptions += '<div class=" card form-check meta-item" style="margin-bottom : 1 rem "><div class="card-body">' +
'<input type="checkbox" name="metas[' + odsId + '][]" value="' + meta.id + '" class="form-check-input meta-checkbox" id="meta' + meta.id + '">' + '<input type="checkbox" name="metas[' + odsId + '][]" value="' + meta.id + '" class="form-check-input meta-checkbox" id="meta' + meta.id + '">' +
'<label class="form-check-label" for="meta' + meta.id + '">' + meta.nome + '</label>' + '<label class="form-check-label" for="meta' + meta.id + '">' + meta.nome + '</label>' +
'<p class="form-text text-muted">' + meta.descricao + '</p>' + '<p class="form-text text-muted">' + meta.descricao + '</p>' +
'</div></div>'; '</div></div>';
}); });
metaOptions += '</div>' metaOptions += '</div>'
$('#metas-container').append(metaOptions); $('#metas-container').append(metaOptions);
}, },
error: function(jqXHR, textStatus, errorThrown){ error: function(jqXHR, textStatus, errorThrown){
console.error('Erro ao carregar as metas:', textStatus, errorThrown); console.error('Erro ao carregar as metas:', textStatus, errorThrown);
alert('Erro ao carregar as metas.'); alert('Erro ao carregar as metas.');
} }
}); });
}); });
}); });
$(document).on('change', '.meta-checkbox', function() { $(document).on('change', '.meta-checkbox', function() {
totalSelectedMetas = $('.meta-checkbox:checked').length; totalSelectedMetas = $('.meta-checkbox:checked').length;
if (totalSelectedMetas > 3) { if (totalSelectedMetas > 5) {
showAlert('#notificacao-erro','Você atingiu o limite maximo de metas selecionadas(3 metas)') showAlert('#notificacao-erro','Você atingiu o limite maximo de metas selecionadas(5)')
$(this).prop('checked', false); $(this).prop('checked', false);
return; return;
} }
}); });
}); });
</script> </script>
@endsection @endsection
\ No newline at end of file
@extends('layouts.app') @extends('layouts.app')
@php
use App\Evento;
@endphp
@section('content') @section('content')
<div class="row justify-content-center" <div class="row justify-content-center"
...@@ -104,7 +107,8 @@ ...@@ -104,7 +107,8 @@
@if ($notificacao->destinatario_id == Auth::user()->id) @if ($notificacao->destinatario_id == Auth::user()->id)
<div class="col-sm-11"> <div class="col-sm-11">
<h6 style="font-size: 18px">Avaliação <h6 style="font-size: 18px">Avaliação
para {{ $notificacao->trabalho->titulo }}</h6> para {{
Evento::where('id', $notificacao->trabalho_id)->first()->nome}}</h6>
</div> </div>
@if (!$notificacao->lido) @if (!$notificacao->lido)
<div class="col-sm-1"> <div class="col-sm-1">
...@@ -138,7 +142,7 @@ ...@@ -138,7 +142,7 @@
</div> </div>
@endif @endif
<p style="font-size: 14px; margin-bottom: 0;"> <p style="font-size: 14px; margin-bottom: 0;">
Projeto: {{ $notificacao->trabalho->titulo }}</p> Projeto: {{ Evento::where('id', $notificacao->trabalho_id)->first()->nome }}</p>
<div style="text-align: right"> <div style="text-align: right">
<a href="{{ route('notificacao.ler', ['id' => $notificacao->id]) }}">Visualizar</a> <a href="{{ route('notificacao.ler', ['id' => $notificacao->id]) }}">Visualizar</a>
</div> </div>
...@@ -159,4 +163,5 @@ ...@@ -159,4 +163,5 @@
margin: auto; margin: auto;
} }
</style> </style>
@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