Unverified Commit 23fda7b6 authored by Yuri Resende's avatar Yuri Resende Committed by GitHub
Browse files

Merge pull request #782 from yuriresendematias/master

Corrigindo bugs do edital PIBEX
parents 39b596f7 ecf10d5c
......@@ -59,8 +59,7 @@ class StoreTrabalho extends FormRequest
$rules['media_do_curso.' . $value] = ['required', 'string'];
}
if($evento->tipo != "CONTINUO"){
if($evento->tipo != "CONTINUO" && ($this->funcaoParticipante[$value] == "Voluntário" || $this->funcaoParticipante[$value] == "Bolsista")){
$rules['anexoPlanoTrabalho.'.$value] = ['required'];
$rules['nomePlanoTrabalho.'.$value] = ['required', 'string'];
}
......
......@@ -50,9 +50,13 @@
<label for="funcao_participante">Função do Integrante:</label>
<select name="" id="funcao_participante" class="form-control">
@foreach($funcaoParticipantes as $funcao)
@if($funcao->nome != 'Bolsista')
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@elseif($edital->tipo != "CONTINUO")
@if($edital->natureza_id == 3)
@if($edital->tipo == "CONTINUO" && $funcao->nome != 'Bolsista')
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@elseif($funcao->nome != "Consultor" && $funcao->nome != "Pesquisador" && $funcao->nome != "Voluntário")
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@endif
@else
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@endif
@endforeach
......@@ -109,6 +113,25 @@
</div>
</div>
<div class="modal fade" id="aviso-modal-limite-de-integrantes" data-backdrop="static" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="background-color: #dc3545;">
<h5 class="modal-title" id="exampleModalLabel" style="color: white;">Aviso</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" >
<span id="texto-erro">O limite de integrantes para esse projeto foi atingido.</span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary btn-color-dafault" data-dismiss="modal">Ok</button>
</div>
</div>
</div>
</div>
<script>
......@@ -138,6 +161,12 @@
}
function preencherUsuarioExistente() {
if(!document.getElementById(`exampleModal${modal_id}`)){
exibirModalNumeroMaximoDeIntegrantes();
return;
}
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
......@@ -186,6 +215,10 @@
$('#aviso-modal-usuario-nao-existe').modal('show');
}
function exibirModalNumeroMaximoDeIntegrantes() {
$('#aviso-modal-limite-de-integrantes').modal('show');
}
let modal_id = 0;
function exibirUsuarioAdicionado(data) {
......@@ -234,6 +267,16 @@
document.getElementById(`curso[${modal_id}]`).value = data[2]['curso'];
document.getElementById(`curso[${modal_id}]`).setAttribute("readonly", "");
console.log(document.getElementById(`funcaoParticipante${modal_id}`));
document.getElementById(`funcaoParticipante${modal_id}`).value = data[1]['nome'];
if(data[1].nome != "Bolsista" && data[1].nome != "Voluntário"){
document.getElementById(`plano-titulo${modal_id}`).setAttribute('hidden', "");
document.getElementById(`plano-nome${modal_id}`).setAttribute('hidden', "");
document.getElementById(`plano-anexo${modal_id}`).setAttribute('hidden', "");
}
$(`#exampleModal${modal_id}`).modal('show');
}
......
......@@ -69,9 +69,9 @@
<div class="col-md-12">
<div class="container">
<div class="row">
<input type="hidden" name="funcaoParticipante[]" value="4">
<input type="hidden" name="funcaoParticipante[{{$i}}]" id="funcaoParticipante{{$i}}">
<div class="col-md-12 mt-3">
<h5>Dados do discente</h5>
<h5>Dados do integrante</h5>
</div>
<div class="col-6">
@component('componentes.input', ['label' => 'Nome completo'])
......@@ -217,11 +217,12 @@
</div>
<div class="col-6">
@component('componentes.input', ['label' => 'Instituição de Ensino'])
<select style="display: inline" onchange="showInstituicao(this)" class="form-control" name="instituicao[{{$i}}]" id="instituicao[{{$i}}]">
<!-- <select style="display: inline" onchange="showInstituicao(this)" class="form-control" name="instituicao[{{$i}}]" id="instituicao[{{$i}}]">
<option value="" disabled selected hidden>-- Instituição --</option>
<option @if((old('instituicao')[$i] ?? "" )=='UFAPE' )) selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option>
<option @if((old('instituicao')[$i] ?? "" )=='Outra' )) selected @endif value="Outra">Outra</option>
</select>
</select> -->
<input type="text" style="display: inline" class="form-control" name="instituicao[{{$i}}]" id="instituicao[{{$i}}]">
@error('instituicao.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
......@@ -241,7 +242,7 @@
</div>
<div class="col-6">
@component('componentes.input', ['label' => 'Curso'])
<select style="display: inline" class="form-control" name="curso[{{$i}}]" onchange="showCurso(this)" id="curso[{{$i}}]">
<!-- <select style="display: inline" class="form-control" name="curso[{{$i}}]" onchange="showCurso(this)" id="curso[{{$i}}]">
<option value="" disabled selected hidden>-- Selecione uma opção--</option>
<option @if((old('curso')[$i] ?? "" )=='Bacharelado em Agronomia' ) selected @endif value="Bacharelado em Agronomia">Bacharelado em Agronomia</option>
<option @if((old('curso')[$i] ?? "" )=='Bacharelado em Ciência da Computação' ) selected @endif value="Bacharelado em Ciência da Computação">Bacharelado em Ciência da Computação</option>
......@@ -251,7 +252,8 @@
<option @if((old('curso')[$i] ?? "" )=='Licenciatura em Letras' ) selected @endif value="Licenciatura em Letras">Licenciatura em Letras</option>
<option @if((old('curso')[$i] ?? "" )=='Licenciatura em Pedagogia' ) selected @endif value="Licenciatura em Pedagogia">Licenciatura em Pedagogia</option>
<option @if((old('curso')[$i] ?? "" )=='Outro' ) selected @endif value="Outro">Outro</option>
</select>
</select> -->
<input type="text" style="display: inline" class="form-control" name="curso[{{$i}}]" id="curso[{{$i}}]">
@error('curso.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
......@@ -352,10 +354,10 @@
@endif
@if($edital->tipo != "CONTINUO")
<div class="col-md-12">
<div class="col-md-12" id="plano-titulo{{$i}}">
<h5>Plano de trabalho</h5>
</div>
<div class="col-12">
<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}}">
......@@ -367,7 +369,7 @@
@enderror
@endcomponent
</div>
<div class="col-12">
<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)
......
......@@ -91,8 +91,8 @@
<div class="row col-md-12">
<div class="form-group col-md-12">
<label for="ods_id" class="col-form-label" style="font-weight: bold">{{ __('Objetivo de Desenvolvimento Sustentável') }} <span style="color: red; font-weight:bold">*</span></label>
<span>É possível selecionar um ou mais ODS. Para outras informações,
<a href="https://brasil.un.org/pt-br/sdgs" rel='external' target='_blank'> acesse o link.</a></span><br>
<span>Objetivo(s) de Desenvolvimento Sustentável:* (é possível selecionar um ou mais objetivos. Para outras informações, acesse o ,
<a href="https://brasil.un.org/pt-br/sdgs" rel='external' target='_blank'>link).</a></span><br><br>
<div class="row col-md-12">
@foreach($ods as $od)
<div class="col-md-6">
......
......@@ -200,15 +200,27 @@
let planoTrabalho = document.getElementById("nomePlanoTrabalho"+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);
console.log(planoTrabalho);
let funcaoParticipantes = <?php echo json_encode($funcaoParticipantes); ?>;
let nome_funcao = "";
//pega o nome da função do participante
for (var i = 0; i < funcaoParticipantes.length; i++) {
if(funcaoParticipantes[i].id == funcao.value){
nome_funcao = funcaoParticipantes[i].nome;
break;
}
}
if(nome.value != ""){
if(planoTrabalho != null && planoTrabalho.value != ""){
nomePlano.innerText = `Nome: ${nome.value} \n Plano: ${planoTrabalho.value} \n E-mail: ${email.value} \n CPF: ${cpf.value}\nFunção:`;
}else {
nomePlano.innerText = `Nome: ${nome.value} \n E-mail: ${email.value} \n CPF: ${cpf.value}\nFunção:`;
nomePlano.innerText = `Nome: ${nome.value} \n E-mail: ${email.value} \n CPF: ${cpf.value}\nFunção:${nome_funcao}`;
}
}else{
nomePlano.innerText = `Discente `+(id+1);
......@@ -221,7 +233,7 @@
//$("#atribuir1").attr('data-target','#modalIntegrante'+(id+1));
modal_id = id+1;
document.getElementById("part"+id).removeAttribute("hidden");
document.getElementById("exampleModal"+id).modal('hide');
//document.getElementById("exampleModal"+id).modal('hide');
......
......@@ -45,13 +45,15 @@
<div class="form-row d-flex" style="margin-top:10px">
<label for="funcao_participante">Função do Integrante:</label>
<select name="" id="funcao_participante" class="form-control">
@foreach($funcaoParticipantes as $funcao)
@if($funcao->nome != 'Bolsista')
@if($edital->natureza_id == 3)
@if($edital->tipo == "CONTINUO" && $funcao->nome != 'Bolsista')
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@elseif($edital->tipo != "CONTINUO")
@elseif($funcao->nome != "Consultor" && $funcao->nome != "Pesquisador" && $funcao->nome != "Voluntário")
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@endif
@endforeach
@else
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@endif
</select>
</div>
......@@ -157,7 +159,7 @@
}
function preencherUsuarioExistente() {
console.log(modal_id);
//console.log(modal_id);
if(!document.getElementById(`exampleModal${modal_id}`)){
exibirModalNumeroMaximoDeIntegrantes();
return;
......
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