Commit 8d366187 authored by Edgarvital's avatar Edgarvital
Browse files

Ajuste temporario na adição de integrantes (Permitindo apenas escolher a função de Bolsista)

parent c7672936
<div class="col-md-12" style="margin-top: 20px"> <div class="col-md-12" style="margin-top: 20px">
<div class="card" style="border-radius: 5px"> <div class="card" style="border-radius: 5px">
<div class="card-body" style="padding-top: 0.2rem;"> <div class="card-body" style="padding-top: 0.2rem;">
<div class="container"> <div class="container">
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
</div> </div>
<div class="col-md-1 text-sm-right"> <div class="col-md-1 text-sm-right">
<a type="button" value="{{ $edital->id }}" id="atribuir1" data-toggle="modal" data-target="#modalIntegrante"> <a type="button" value="{{ $edital->id }}" id="atribuir1" data-toggle="modal"
data-target="#modalIntegrante">
<img class="" src="{{asset('img/icons/add.ico')}}" style="width:30px" alt=""> <img class="" src="{{asset('img/icons/add.ico')}}" style="width:30px" alt="">
</a> </a>
</div> </div>
...@@ -25,9 +26,9 @@ ...@@ -25,9 +26,9 @@
</div> </div>
<!-- MODAL --> <!-- MODAL -->
<div class="modal fade" id="modalIntegrante" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal fade" id="modalIntegrante" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-sm"> <div class="modal-dialog modal-dialog-centered modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
...@@ -39,7 +40,8 @@ ...@@ -39,7 +40,8 @@
<div class="container"> <div class="container">
<div class="row justify-content-center" style="padding-left:35px; padding-right:45px"> <div class="row justify-content-center" style="padding-left:35px; padding-right:45px">
<div class="form-controll" style="margin-left:10px; margin-top:10px; margin-bottom:15px; font-weight:bold;"> <div class="form-controll"
style="margin-left:10px; margin-top:10px; margin-bottom:15px; font-weight:bold;">
<div class="form-row d-flex"> <div class="form-row d-flex">
<label for="cpf_consulta">CPF:</label> <label for="cpf_consulta">CPF:</label>
...@@ -50,20 +52,31 @@ ...@@ -50,20 +52,31 @@
<label for="funcao_participante">Função do Integrante:</label> <label for="funcao_participante">Função do Integrante:</label>
<select name="" id="funcao_participante" class="form-control"> <select name="" id="funcao_participante" class="form-control">
@foreach($funcaoParticipantes as $funcao) @foreach($funcaoParticipantes as $funcao)
@if($funcao->nome == 'Bolsista')
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@endif
<!--
Ajuste temporário para permitir apenas bolsistas
@if($edital->natureza_id == 3) @if($edital->natureza_id == 3)
@if($edital->tipo == "CONTINUO" && $funcao->nome != 'Bolsista') @if($edital->tipo == "CONTINUO" && $funcao->nome != 'Bolsista')
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option> <option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@elseif($funcao->nome != "Consultor" && $funcao->nome != "Pesquisador" && $funcao->nome != "Voluntário") @elseif($funcao->nome != "Consultor" && $funcao->nome != "Pesquisador" && $funcao->nome != "Voluntário")
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option> <option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@endif @endif
@else @else
<option value="{{$funcao->id}}">{{ $funcao->nome }}</option> <option value="{{$funcao->id}}">{{ $funcao->nome }}</option>
@endif @endif
-->
@endforeach @endforeach
</select> </select>
</div> </div>
<div class="form-row justify-content-center" style="margin-top:20px;"> <div class="form-row justify-content-center" style="margin-top:20px;">
<button type="button" class="btn btn-primary" onclick="preencherUsuarioExistente()">Adicionar</button> <button type="button" class="btn btn-primary" onclick="preencherUsuarioExistente()">
Adicionar
</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -75,7 +88,8 @@ ...@@ -75,7 +88,8 @@
<!-- MODAL DE ERRO --> <!-- MODAL DE ERRO -->
<div class="modal fade" id="aviso-modal-usuario-nao-existe" data-backdrop="static" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal fade" id="aviso-modal-usuario-nao-existe" data-backdrop="static" tabindex="-1"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" style="background-color: #dc3545;"> <div class="modal-header" style="background-color: #dc3545;">
...@@ -94,7 +108,8 @@ ...@@ -94,7 +108,8 @@
</div> </div>
</div> </div>
<div class="modal fade" id="aviso-modal-usuario-adicionado" data-backdrop="static" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal fade" id="aviso-modal-usuario-adicionado" data-backdrop="static" tabindex="-1"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" style="background-color: #32CD32;"> <div class="modal-header" style="background-color: #32CD32;">
...@@ -113,7 +128,8 @@ ...@@ -113,7 +128,8 @@
</div> </div>
</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 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-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" style="background-color: #dc3545;"> <div class="modal-header" style="background-color: #dc3545;">
...@@ -122,7 +138,7 @@ ...@@ -122,7 +138,7 @@
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body" > <div class="modal-body">
<span id="texto-erro">O limite de integrantes para esse projeto foi atingido.</span> <span id="texto-erro">O limite de integrantes para esse projeto foi atingido.</span>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
...@@ -133,7 +149,6 @@ ...@@ -133,7 +149,6 @@
</div> </div>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#cpf_consulta").mask("999.999.999-99"); $("#cpf_consulta").mask("999.999.999-99");
...@@ -144,7 +159,7 @@ ...@@ -144,7 +159,7 @@
} }
function preencherUsuarioExistente() { function preencherUsuarioExistente() {
if(!document.getElementById(`exampleModal${modal_id}`)){ if (!document.getElementById(`exampleModal${modal_id}`)) {
exibirModalNumeroMaximoDeIntegrantes(); exibirModalNumeroMaximoDeIntegrantes();
return; return;
} }
...@@ -166,10 +181,10 @@ ...@@ -166,10 +181,10 @@
}, },
success: function (data) { success: function (data) {
if(data == 'inexistente' || $('#cpf_consulta').val() == ""){ if (data == 'inexistente' || $('#cpf_consulta').val() == "") {
exibirModalUsuarioInexistente(); exibirModalUsuarioInexistente();
}else { } else {
if($('#funcao_participante').val() != 4 || data[0].tipo == 'participante'){ if ($('#funcao_participante').val() != 4 || data[0].tipo == 'participante') {
exibirUsuarioAdicionado(data); exibirUsuarioAdicionado(data);
} else { } else {
marcar(modal_id, data); marcar(modal_id, data);
...@@ -201,24 +216,30 @@ ...@@ -201,24 +216,30 @@
document.getElementById(`email${modal_id}`).value = data[0]['email']; document.getElementById(`email${modal_id}`).value = data[0]['email'];
document.getElementById(`email${modal_id}`).setAttribute("readonly", ""); document.getElementById(`email${modal_id}`).setAttribute("readonly", "");
if(data[0]['tipo'] == "participante"){ if (data[0]['tipo'] == "participante") {
let [y, m, d] = data[2]['data_de_nascimento'].split('-'); let [y, m, d] = data[2]['data_de_nascimento'].split('-');
document.getElementById(`data_de_nascimento${modal_id}`).value = (new Date(y,m-1,d)).toLocaleDateString(); document.getElementById(`data_de_nascimento${modal_id}`).value = (new Date(y, m - 1, d)).toLocaleDateString();
document.getElementById(`data_de_nascimento${modal_id}`).setAttribute("readonly", ""); document.getElementById(`data_de_nascimento${modal_id}`).setAttribute("readonly", "");
}else { } else {
document.getElementById(`data_de_nascimento${modal_id}`).value = null; document.getElementById(`data_de_nascimento${modal_id}`).value = null;
document.getElementById(`data_de_nascimento${modal_id}`).setAttribute("readonly", ""); document.getElementById(`data_de_nascimento${modal_id}`).setAttribute("readonly", "");
} }
if (data?.[3]?.cpf) {
document.getElementById(`cpf${modal_id}`).value = data[0]['cpf']; document.getElementById(`cpf${modal_id}`).value = data[0]['cpf'];
document.getElementById(`cpf${modal_id}`).setAttribute("readonly", ""); document.getElementById(`cpf${modal_id}`).setAttribute("readonly", "");
}
if (data?.[3]?.rg) {
document.getElementById(`rg${modal_id}`).value = data[2]['rg']; document.getElementById(`rg${modal_id}`).value = data[2]['rg'];
document.getElementById(`rg${modal_id}`).setAttribute("readonly", ""); document.getElementById(`rg${modal_id}`).setAttribute("readonly", "");
}
if (data?.[3]?.celular) {
document.getElementById(`celular${modal_id}`).value = data[0]['celular']; document.getElementById(`celular${modal_id}`).value = data[0]['celular'];
document.getElementById(`celular${modal_id}`).setAttribute("readonly", ""); document.getElementById(`celular${modal_id}`).setAttribute("readonly", "");
}
if (data?.[3]?.cep) { if (data?.[3]?.cep) {
document.getElementById(`cep${modal_id}`).value = data[3].cep; document.getElementById(`cep${modal_id}`).value = data[3].cep;
...@@ -273,7 +294,7 @@ ...@@ -273,7 +294,7 @@
console.log(document.getElementById(`funcaoParticipante${modal_id}`)); console.log(document.getElementById(`funcaoParticipante${modal_id}`));
document.getElementById(`funcaoParticipante${modal_id}`).value = data[1]['nome']; document.getElementById(`funcaoParticipante${modal_id}`).value = data[1]['nome'];
if(data[1].nome != "Bolsista" && data[1].nome != "Voluntário"){ if (data[1].nome != "Bolsista" && data[1].nome != "Voluntário") {
document.getElementById(`plano-titulo${modal_id}`).setAttribute('hidden', ""); document.getElementById(`plano-titulo${modal_id}`).setAttribute('hidden', "");
document.getElementById(`plano-nome${modal_id}`).setAttribute('hidden', ""); document.getElementById(`plano-nome${modal_id}`).setAttribute('hidden', "");
document.getElementById(`plano-anexo${modal_id}`).setAttribute('hidden', ""); document.getElementById(`plano-anexo${modal_id}`).setAttribute('hidden', "");
...@@ -282,7 +303,7 @@ ...@@ -282,7 +303,7 @@
$(`#exampleModal${modal_id}`).modal('show'); $(`#exampleModal${modal_id}`).modal('show');
} }
function exibirProfessorAdicionado(){ function exibirProfessorAdicionado() {
$('#modalIntegrante').modal('hide'); $('#modalIntegrante').modal('hide');
$(`#aviso-modal-usuario-adicionado`).modal('show'); $(`#aviso-modal-usuario-adicionado`).modal('show');
} }
......
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