Unverified Commit caaea21e authored by Nathalia Santos's avatar Nathalia Santos Committed by GitHub
Browse files

Merge pull request #727 from Wolf-gangSE/remover-obrigatoriedade-discente

Remover obrigatoriedade do discente em edital
parents 2be90919 4e072167
......@@ -60,7 +60,7 @@
<div class="col-sm-2">
<label for="numParticipantes" class="col-form-label">{{ __('Nº de Discentes:') }}<span style="color:red; font-weight:bold;">*</span></label>
<input id="numParticipantes" type="number" min="1" max="500" class="form-control @error('numParticipantes') is-invalid @enderror" name="numParticipantes" value="{{ old('numParticipantes') }}" required autocomplete="numParticipantes" autofocus>
<input id="numParticipantes" type="number" min="0" max="500" class="form-control @error('numParticipantes') is-invalid @enderror" name="numParticipantes" value="{{ old('numParticipantes') }}" required autocomplete="numParticipantes" autofocus>
@error('numParticipantes')
<span class="invalid-feedback" role="alert">
......
......@@ -64,7 +64,7 @@
</div>
<div class="col-sm-2">
<label for="numParticipantes" class="col-form-label">{{ __('Nº de Discentes:') }}<span style="color: red; font-weight: bold;">*</span></label>
<input id="numParticipantes" type="number" min="1" max="500" class="form-control @error('numParticipantes') is-invalid @enderror" name="numParticipantes" value="{{ $evento->numParticipantes }}" required autocomplete="numParticipantes" autofocus>
<input id="numParticipantes" type="number" min="0" max="500" class="form-control @error('numParticipantes') is-invalid @enderror" name="numParticipantes" value="{{ $evento->numParticipantes }}" required autocomplete="numParticipantes" autofocus>
@error('numParticipantes')
<span class="invalid-feedback" role="alert">
......
......@@ -85,6 +85,38 @@
</div>
@endif
@if ($edital->numParticipantes == 0)
<div class="col-md-3">
<br>
<label for="nomePlanoTrabalho" class="col-form-label font-tam" style="font-weight: bold">{{ __('Título do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label>
</div>
<div class="col-md-9">
<br>
<input type="text" class="form-control" value="{{old('nomePlanoTrabalho') ?? "" }}" name="nomePlanoTrabalho" maxlength="255" id="nomePlanoTrabalho" required>
<span style="color: red; font-size: 12px" id="caracsRestantesnomePlanoTrabalho">
</span>
@error('nomePlanoTrabalho')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-3">
<br>
<label for="anexoPlanoTrabalho" class="col-form-label font-tam"
style="font-weight: bold">{{ __('Anexo do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label>
</div>
<div class="col-md-9">
<br>
<input type="file" class="input-group-text" value="{{old('anexoPlanoTrabalho') ?? "" }}" name="anexoPlanoTrabalho" accept=".pdf" placeholder="Anexo do Plano de Trabalho" required />
@error('anexoPlanoTrabalho')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
@endif
<div class="col-md-2">
<br>
<label for="conflitosInteresse" class="col-form-label font-tam"
......@@ -93,7 +125,7 @@
<div class="col-md-10">
<br>
<textarea class="form-control @error('conflitosInteresse') is-invalid @enderror" autocomplete="conflitosInteresse"
id="conflitosInteresse" name="conflitosInteresse" rows="4">{{ old('conflitosInteresse') }}</textarea>
id="conflitosInteresse" name="conflitosInteresse" rows="3">{{ old('conflitosInteresse') }}</textarea>
@error('conflitosInteresse')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
......
......@@ -24,9 +24,11 @@
@component('evento.formulario.anexos')
@endcomponent
@if ($edital->numParticipantes != 0)
@component('evento.formulario.participantes', ['estados' => $estados, 'enum_turno' => $enum_turno])
@endcomponent
@endif
@component('evento.formulario.finalizar')
@endcomponent
......@@ -34,11 +36,13 @@
</div>
</div>
</form>
@if ($edital->numParticipantes != 0)
<div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent
</div>
@endif
<!-- Modal de Aviso Edit -->
<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">
......
@extends('layouts.app')
@section('content')
<div>
{{-- action="{{route('trabalho.store')}}" --}}
<form method="POST" id="criarProjetoForm" action="{{route('trabalho.store')}}" enctype="multipart/form-data" >
@csrf
<input type="hidden" name="editalId" value="{{$edital->id}}">
<div class="container">
<div class="row justify-content-center" style="margin-top: 35px">
@include('evento.formulario.projeto')
@include('evento.formulario.proponente')
@include('evento.formulario.participantes')
@if($edital->natureza_id == 3)
@include('evento.formulario.integrantes')
@endif
@include('evento.formulario.anexos')
@include('evento.formulario.finalizar')
<style>
.col-form-label {
font-size: 15.5px;
}
</style>
</div>
</div>
</form>
<div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent
</div>
<!-- Modal de Aviso Edit -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<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; margin-top:10px;">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Existe um CPF inválido em um dos discentes por favor corrija para continuar.
</div>
{{-- <div class="modal-footer">
{{-- <button type="button" class="btn btn-secondary"></button>
{{-- <button type="button" class="btn btn-primary">Certo</button>
</div> --}}
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<script>
let buttonSubmit = document.getElementById('idButtonSubmitProjeto');
let buttonRascunho = document.getElementById('idButtonSubmitRascunho');
let parts = document.getElementById('participante');
let partsFirst = document.getElementById('participanteFirst');
const participante = partsFirst.firstElementChild;
let contador = 0;
buttonSubmit.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
})
buttonRascunho.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
const input = '<input id="input_rascunho" type="hidden" name="rascunho" value="true">';
$("#criarProjetoForm").append(input);
})
function gerarPeriodo(e){
var select = e.parentElement.parentElement.nextElementSibling;
selectPeriodos = select.children[0].children[1];
var html = `<option value="" disabled selected>-- TOTAL DE PERÍODOS --</option>`;
for(var i = 0; i < parseInt(e.value); i++) {
html += `<option value="${i+1}">${i+1}º</option>`;
}
$(selectPeriodos).html('');
$(selectPeriodos).append(html);
}
function removerPart(e){
console.log(e)
if(e.parentElement.parentElement){
if(parts.children.length <= 1){
}else{
parts.removeChild(e.parentElement.parentElement);
//contador--;
}
}
}
buttonMais.addEventListener("click", (e) => {
if(parts.children.length >= "{{ $edital->numParticipantes }}"){
alert('Limite de participante.')
}else{
contador++;
var cln = participante.cloneNode(true);
cln.setAttribute('style', " ");
var id = cln.children[2].firstElementChild.id;
var id2 = cln.children[0].firstElementChild.id;
cln.children[2].firstElementChild.setAttribute('id', id + contador);
cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador);
cln.children[0].firstElementChild.setAttribute('id', id2 + contador);
for (i = 0; i < cln.children.length; i++) {
for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) {
let input = cln.children[i].querySelectorAll('input')[index];
let name = input.getAttributeNode("name").value;
name = name.replace("[]", "");
input.getAttributeNode("name").value = name + '['+ contador +']';
let select = cln.children[i].querySelectorAll('select')[index];
if(select){
let selectName = select.getAttributeNode("name").value;
selectName = selectName.replace("[", "");
selectName = selectName.replace("]", "");
select.getAttributeNode("name").value = selectName + '['+ contador +']';
}
}
}
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);
}
};
parts.appendChild(cln);
$("input.cpf:text").val("").mask("000.000.000-00");
$("input.celular:text").val("").mask(SPMaskBehavior, spOptions);
$("input.cep:text").val("").mask("00000-000");
}
});
$("input.rg:text").mask('00.000.000-0');
function marcar(id){
let nome = document.getElementById("nome"+id);
let linkNome = document.getElementById("nomePart"+(id+1));
let nomePlano = document.getElementById("nomePlano"+(id+1));
let linkTituloProj = document.getElementById("tituloProj"+(id+1));
let planoTrabalho = document.getElementById("nomePlanoTrabalho"+id);
if(nome.value != ""){
if(planoTrabalho.value != ""){
nomePlano.innerText = `Nome: ${nome.value} \n Plano: ${planoTrabalho.value}`;
}else {
nomePlano.innerText = `Nome: ${nome.value}`;
}
}else{
nomePlano.innerText = `Discente `+(id+1);
}
if(id >=1){
document.getElementById("cancelar"+(id-1)).setAttribute("disabled", true);
}
document.getElementById("checkB"+id).checked = true;
$("#atribuir1").attr('data-target','#exampleModal'+(id+1));
document.getElementById("part"+id).removeAttribute("hidden");
document.getElementById("exampleModal"+id).modal('hide');
}
function desmarcar(id){
if(id >= 1){;
document.getElementById("cancelar"+(id-1)).removeAttribute("disabled");
}
document.getElementById("checkB"+id).checked = false;
document.getElementById("part"+id).setAttribute("hidden",true);
$("#atribuir1").attr('data-target','#exampleModal'+(id));
document.getElementById("exampleModal"+id).modal('hide');
}
</script>
<script>
$( document ).ready( function () {
$('#nomeParticipante').keyup(function () {
$('#display').text($(this).val());
if($('#nomeParticipante').val() == ""){
$('#display').hide();
$('#pontos').hide();
}else{
$('#display').show();
$('#pontos').show();
}
});
$.validator.addMethod("alpha", function(value, element) {
return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/);
});
$('input.cep:text').mask('00000-000');
$('input.cpf:text').mask('000.000.000-00');
$('.numero').mask('0000000000000');
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);
$('.sus').mask('000 0000 0000 0000');
$("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val('');
}
});
// $.validator.setDefaults( {
// submitHandler: function (form) {
// form.submit();
// }
// } );
// jQuery.extend(jQuery.validator.messages, {
// required: "Este campo &eacute; requerido.",
// remote: "Por favor, corrija este campo.",
// 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.",
// date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
// 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.",
// 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.",
// 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.",
// 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."),
// 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}."),
// 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}.")
// });
// $( "#criarProjetoForm" ).validate( {
// lang: 'PT_BR',
// rules: {
// firstname: "required",
// username: {
// required: true,
// minlength: 2
// },
// password: {
// required: true,
// minlength: 5
// },
// confirm_password: {
// required: true,
// minlength: 5,
// equalTo: "#password"
// },
// email: {
// required: true,
// email: true,
// },
// "complemento[]":{
// },
// "nomeParticipante[]":{
// alpha:true,
// },
// 'rg[]':{
// maxlength: 12,
// },
// agree: "required"
// },
// messages: {
// // nomeProjeto: "O nome do projeto é obrigatório.",
// // 'emailParticipante[]': "Este campo é obrigatório.",
// // 'data_de_nascimento[]': "Este campo é obrigatório.",
// // 'cpf[]': "Este campo é obrigatório.",
// // 'rg[]': {
// // required: "Este campo é obrigatório.",
// // maxlength: "Este campo deve conter no máximo 8 números."
// // },
// // 'celular[]': "Este campo é obrigatório.",
// // 'cep[]': "Este campo é obrigatório.",
// // 'uf[]': "Este campo é obrigatório.",
// // 'cidade[]': "Este campo é obrigatório.",
// // 'bairro[]': "Este campo é obrigatório.",
// // 'rua[]': "Este campo é obrigatório.",
// // 'numero[]': "Este campo é obrigatório.",
// // 'complemento[]': "Este campo é obrigatório.",
// // 'universidade[]': "Este campo é obrigatório.",
// // 'curso[]': "Este campo é obrigatório.",
// // 'turno[]': "Este campo é obrigatório.",
// // 'total_periodos[]': "Este campo é obrigatório.",
// // 'periodo_atual[]': "Este campo é obrigatório.",
// // 'ordem_prioridade[]': "Este campo é obrigatório.",
// // 'media_geral_curso[]': "Este campo é obrigatório.",
// // 'nomePlanoTrabalho[]': "Este campo é obrigatório.",
// // 'anexoPlanoTrabalho[]': "Este campo é obrigatório.",
// // grandeArea: "Escolha uma grande área.",
// // area: "Escolha uma área.",
// // linkGrupo: "Este campo é obrigatório.",
// // pontuacaoPlanilha: "Este campo é obrigatório.",
// // anexoProjeto: "Este campo é obrigatório.",
// // anexoLattesCoordenador: "Este campo é obrigatório.",
// // anexoConsuPreenchido: "Este campo é obrigatório.",
// // anexoGrupoPesquisa: "Este campo é obrigatório.",
// // anexoPlanilha: "Este campo é obrigatório.",
// // anexoComiteEtica: "Este campo é obrigatório.",
// // inputJustificativa: "Este campo é obrigatório.",
// // "nomeParticipante[]": {
// // required: "O nome do participante é obrigatório.",
// // alpha: "Não é permitido números."
// // },
// // username: {
// // required: "Please enter a username",
// // minlength: "Your username must consist of at least 2 characters"
// // },
// // password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long"
// // },
// // confirm_password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long",
// // equalTo: "Please enter the same password as above"
// // },
// // email: "Please enter a valid email address",
// // agree: "Please accept our policy"
// },
// errorElement: "em",
// errorPlacement: function ( error, element ) {
// // Add the `help-block` class to the error element
// error.addClass( "invalid-feedback" );
// if ( element.prop( "type" ) === "checkbox" ) {
// error.insertAfter( element.parent( "label" ) );
// } else {
// error.insertAfter( element );
// }
// },
// highlight: function ( element, errorClass, validClass ) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
// },
// unhighlight: function (element, errorClass, validClass) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
// }
// } );
} );
</script>
<script type="text/javascript">
function validarCPF(valor){
var soma = 0;
var resto;
var inputCPF = valor.match(/\d/g).join('');
if(inputCPF == '00000000000') return false;
if(inputCPF.length >11) return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(9, 10))) return false;
soma = 0;
for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(10, 11))) return false;
return true;
}
/*
* FUNCAO: Gerar as areas
*
*/
function areas() {
var grandeArea = $('#grandeArea').val();
$.ajax({
type: 'POST',
url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados) => {
if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Área --</option>";
}
$('#area').html(option).show();
subareas();
},
error: (data) => {
console.log(data);
}
})
}
/*
* FUNCAO: Gerar as subareas
*
*/
function subareas() {
var area = $('#area').val();
$.ajax({
type: 'POST',
url: '{{ route('subarea.consulta') }}',
data: 'id='+area ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados)=> {
if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Subárea --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Subárea --</option>";
}
$('#subArea').html(option).show();
},
error: (dados) => {
console.log(dados);
}
})
}
/*
* FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?"
*
*/
function displayAutorizacoesEspeciais(valor){
if(valor == "sim"){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else if(valor == "nao"){
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
}
/*
* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF)
*
*/
function verificarArquivoAnexado_pdf(item, legenda){
if(item.files[0].type.split('/')[1] != "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}
/* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS)
*
*/
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].size > 2000000){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}else{
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}
}
/*
* FUNCAO: Gerar periodos 1
*
*/
// function gerarPeriodos1(select) {
// var div = select.parentElement.parentElement;
// var selectPeriodos = div.children[22].children[1];
// var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
// for(var i = 0; i < parseInt(select.value); i++) {
// html += `<option value="${i+1}">${i+1}º</option>`;
// }
// });
// });
// $(document).ready(function(){
// $(".cpf").change(function(){
// console.log(this.parentElement.children[0])
// if (validarCPF(retirarFormatacao(this.value))) {
// this.parentElement.children[1].style.display = "none";
// this.parentElement.children[2].style.display = "block";
// } else {
// this.parentElement.children[1].style.display = "block";
// this.parentElement.children[2].style.display = "none";
// }
// });
// });
function checarCPFdoCampo(input) {
if (input.value.length == 14) {
if (validarCPF(retirarFormatacao(input.value))) {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "block";
} else {
input.parentElement.children[1].style.display = "block";
input.parentElement.children[2].style.display = "none";
}
} else {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "none";
}
}
function validarCPF(strCPF) {
var soma;
var resto;
soma = 0;
// Verifica se foi informado todos os digitos corretamente
if (strCPF.length != 11) {
return false;
}
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if (varificarDigitos(strCPF)) {
return false;
}
// Faz o calculo para validar o CPF
for (var t = 9; t < 11; t++) {
for (var d = 0, c = 0; c < t; c++) {
d += strCPF[c] * ((t + 1) - c);
}
d = ((10 * d) % 11) % 10;
if (strCPF[c] != d) {
return false;
}
}
return true;
}
function retirarFormatacao(strCpf) {
resultado = "";
for(var i = 0; i < strCpf.length; i++) {
if (strCpf[i] != "." && strCpf[i] != "-") {
resultado += strCpf[i];
}
}
return resultado;
}
function varificarDigitos(strCpf) {
var cont = 1;
dig1 = strCpf[0];
for(var i = 1; i < strCpf.length; i++) {
if(dig1 == strCpf[i]) {
cont++;
}
}
if (cont == strCpf.length) {
return true;
}
return false;
}
function checarCpfs() {
var validacoes = document.getElementsByClassName("cpf-invalido");
var count = validacoes.length;
var quant = 0;
for(var i = 0; i < validacoes.length; i++) {
if (validacoes[i].style.display == "none") {
quant++;
}
}
if(quant == count) {
return true;
}
return false;
}
function submeterProposta() {
if (checarCpfs()) {
document.getElementById("submeterFormProposta").click();
} else {
$("#modalCpfInvalido").modal('show');
}
}
function mascaraCPF(input) {
var numeros = "0123456789.-";
var resultado = "";
if (input.value.length < 14) {
for (var i = 0; i < input.value.length; i++) {
if (numeros.indexOf(input.value[i]) > -1) {
if ((i == 2 || i == 6) && input.value[i+1] != ".") {
resultado += input.value[i] + ".";
} else if (i == 10 && input.value[i+1] != "-") {
resultado += input.value[i] + "-";
} else {
resultado += input.value[i];
}
}
}
} else {
for (var i = 0; i < 14; i++) {
resultado += input.value[i];
}
}
input.value = resultado;
}
function showInstituicao(instituicao){
var instituicaoSelect = instituicao;
var idSelect = instituicaoSelect.name;
var instituicao = document.getElementById('outra'+idSelect);
var display = document.getElementById('display'+idSelect);
if(instituicaoSelect.value === "Outra"){
display.style.display = "block";
instituicao.parentElement.style.display = '';
instituicao.value="";
}else if(instituicaoSelect.value === "UFAPE"){
display.style.display = "none";
}
}
function showCurso(curso){
var cursoSelect = curso;
var idSelect = cursoSelect.name;
var curso = document.getElementById('outro'+idSelect);
var displayCurso = document.getElementById('display'+idSelect);
if(cursoSelect.value === "Outro"){
displayCurso.style.display = "block";
curso.parentElement.style.display = '';
curso.value="";
}else{
displayCurso.style.display = "none";
}
}
</script>
@extends('layouts.app')
@section('content')
<div>
{{-- action="{{route('trabalho.store')}}" --}}
<form method="POST" id="criarProjetoForm" action="{{route('trabalho.store')}}" enctype="multipart/form-data" >
@csrf
<input type="hidden" name="editalId" value="{{$edital->id}}">
<div class="container">
<div class="row justify-content-center" style="margin-top: 35px">
@include('evento.formulario.projeto')
@include('evento.formulario.proponente')
@if ($edital->numParticipantes != 0)
@include('evento.formulario.participantes')
@endif
@if($edital->natureza_id == 3)
@include('evento.formulario.integrantes')
@endif
@include('evento.formulario.anexos')
@include('evento.formulario.finalizar')
<style>
.col-form-label {
font-size: 15.5px;
}
</style>
</div>
</div>
</form>
@if ($edital->numParticipantes != 0)
<div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent
</div>
@endif
<!-- Modal de Aviso Edit -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<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; margin-top:10px;">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Existe um CPF inválido em um dos discentes por favor corrija para continuar.
</div>
{{-- <div class="modal-footer">
{{-- <button type="button" class="btn btn-secondary"></button>
{{-- <button type="button" class="btn btn-primary">Certo</button>
</div> --}}
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<script>
let buttonSubmit = document.getElementById('idButtonSubmitProjeto');
let buttonRascunho = document.getElementById('idButtonSubmitRascunho');
@if($edital->numParticipantes != 0)
let parts = document.getElementById('participante');
let partsFirst = document.getElementById('participanteFirst');
const participante = partsFirst.firstElementChild;
@endif
let contador = 0;
buttonSubmit.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
})
buttonRascunho.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
const input = '<input id="input_rascunho" type="hidden" name="rascunho" value="true">';
$("#criarProjetoForm").append(input);
})
@if($edital->numParticipantes != 0)
function gerarPeriodo(e){
var select = e.parentElement.parentElement.nextElementSibling;
selectPeriodos = select.children[0].children[1];
var html = `<option value="" disabled selected>-- TOTAL DE PERÍODOS --</option>`;
for(var i = 0; i < parseInt(e.value); i++) {
html += `<option value="${i+1}">${i+1}º</option>`;
}
$(selectPeriodos).html('');
$(selectPeriodos).append(html);
}
function removerPart(e){
console.log(e)
if(e.parentElement.parentElement){
if(parts.children.length <= 1){
}else{
parts.removeChild(e.parentElement.parentElement);
//contador--;
}
}
}
buttonMais.addEventListener("click", (e) => {
if(parts.children.length >= "{{ $edital->numParticipantes }}"){
alert('Limite de participante.')
}else{
contador++;
var cln = participante.cloneNode(true);
cln.setAttribute('style', " ");
var id = cln.children[2].firstElementChild.id;
var id2 = cln.children[0].firstElementChild.id;
cln.children[2].firstElementChild.setAttribute('id', id + contador);
cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador);
cln.children[0].firstElementChild.setAttribute('id', id2 + contador);
for (i = 0; i < cln.children.length; i++) {
for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) {
let input = cln.children[i].querySelectorAll('input')[index];
let name = input.getAttributeNode("name").value;
name = name.replace("[]", "");
input.getAttributeNode("name").value = name + '['+ contador +']';
let select = cln.children[i].querySelectorAll('select')[index];
if(select){
let selectName = select.getAttributeNode("name").value;
selectName = selectName.replace("[", "");
selectName = selectName.replace("]", "");
select.getAttributeNode("name").value = selectName + '['+ contador +']';
}
}
}
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);
}
};
parts.appendChild(cln);
$("input.cpf:text").val("").mask("000.000.000-00");
$("input.celular:text").val("").mask(SPMaskBehavior, spOptions);
$("input.cep:text").val("").mask("00000-000");
}
});
$("input.rg:text").mask('00.000.000-0');
function marcar(id){
let nome = document.getElementById("nome"+id);
let linkNome = document.getElementById("nomePart"+(id+1));
let nomePlano = document.getElementById("nomePlano"+(id+1));
let linkTituloProj = document.getElementById("tituloProj"+(id+1));
let planoTrabalho = document.getElementById("nomePlanoTrabalho"+id);
if(nome.value != ""){
if(planoTrabalho.value != ""){
nomePlano.innerText = `Nome: ${nome.value} \n Plano: ${planoTrabalho.value}`;
}else {
nomePlano.innerText = `Nome: ${nome.value}`;
}
}else{
nomePlano.innerText = `Discente `+(id+1);
}
if(id >=1){
document.getElementById("cancelar"+(id-1)).setAttribute("disabled", true);
}
document.getElementById("checkB"+id).checked = true;
$("#atribuir1").attr('data-target','#exampleModal'+(id+1));
document.getElementById("part"+id).removeAttribute("hidden");
document.getElementById("exampleModal"+id).modal('hide');
}
function desmarcar(id){
if(id >= 1){;
document.getElementById("cancelar"+(id-1)).removeAttribute("disabled");
}
document.getElementById("checkB"+id).checked = false;
document.getElementById("part"+id).setAttribute("hidden",true);
$("#atribuir1").attr('data-target','#exampleModal'+(id));
document.getElementById("exampleModal"+id).modal('hide');
}
@endif
</script>
<script>
$( document ).ready( function () {
@if($edital->numParticipantes != 0)
$('#nomeParticipante').keyup(function () {
$('#display').text($(this).val());
if($('#nomeParticipante').val() == ""){
$('#display').hide();
$('#pontos').hide();
}else{
$('#display').show();
$('#pontos').show();
}
});
@endif
$.validator.addMethod("alpha", function(value, element) {
return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/);
});
@if($edital->numParticipantes != 0)
$('input.cep:text').mask('00000-000');
$('input.cpf:text').mask('000.000.000-00');
$('.numero').mask('0000000000000');
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);
$('.sus').mask('000 0000 0000 0000');
$("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val('');
}
});
@endif
// $.validator.setDefaults( {
// submitHandler: function (form) {
// form.submit();
// }
// } );
// jQuery.extend(jQuery.validator.messages, {
// required: "Este campo &eacute; requerido.",
// remote: "Por favor, corrija este campo.",
// 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.",
// date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
// 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.",
// 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.",
// 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.",
// 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."),
// 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}."),
// 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}.")
// });
// $( "#criarProjetoForm" ).validate( {
// lang: 'PT_BR',
// rules: {
// firstname: "required",
// username: {
// required: true,
// minlength: 2
// },
// password: {
// required: true,
// minlength: 5
// },
// confirm_password: {
// required: true,
// minlength: 5,
// equalTo: "#password"
// },
// email: {
// required: true,
// email: true,
// },
// "complemento[]":{
// },
// "nomeParticipante[]":{
// alpha:true,
// },
// 'rg[]':{
// maxlength: 12,
// },
// agree: "required"
// },
// messages: {
// // nomeProjeto: "O nome do projeto é obrigatório.",
// // 'emailParticipante[]': "Este campo é obrigatório.",
// // 'data_de_nascimento[]': "Este campo é obrigatório.",
// // 'cpf[]': "Este campo é obrigatório.",
// // 'rg[]': {
// // required: "Este campo é obrigatório.",
// // maxlength: "Este campo deve conter no máximo 8 números."
// // },
// // 'celular[]': "Este campo é obrigatório.",
// // 'cep[]': "Este campo é obrigatório.",
// // 'uf[]': "Este campo é obrigatório.",
// // 'cidade[]': "Este campo é obrigatório.",
// // 'bairro[]': "Este campo é obrigatório.",
// // 'rua[]': "Este campo é obrigatório.",
// // 'numero[]': "Este campo é obrigatório.",
// // 'complemento[]': "Este campo é obrigatório.",
// // 'universidade[]': "Este campo é obrigatório.",
// // 'curso[]': "Este campo é obrigatório.",
// // 'turno[]': "Este campo é obrigatório.",
// // 'total_periodos[]': "Este campo é obrigatório.",
// // 'periodo_atual[]': "Este campo é obrigatório.",
// // 'ordem_prioridade[]': "Este campo é obrigatório.",
// // 'media_geral_curso[]': "Este campo é obrigatório.",
// // 'nomePlanoTrabalho[]': "Este campo é obrigatório.",
// // 'anexoPlanoTrabalho[]': "Este campo é obrigatório.",
// // grandeArea: "Escolha uma grande área.",
// // area: "Escolha uma área.",
// // linkGrupo: "Este campo é obrigatório.",
// // pontuacaoPlanilha: "Este campo é obrigatório.",
// // anexoProjeto: "Este campo é obrigatório.",
// // anexoLattesCoordenador: "Este campo é obrigatório.",
// // anexoConsuPreenchido: "Este campo é obrigatório.",
// // anexoGrupoPesquisa: "Este campo é obrigatório.",
// // anexoPlanilha: "Este campo é obrigatório.",
// // anexoComiteEtica: "Este campo é obrigatório.",
// // inputJustificativa: "Este campo é obrigatório.",
// // "nomeParticipante[]": {
// // required: "O nome do participante é obrigatório.",
// // alpha: "Não é permitido números."
// // },
// // username: {
// // required: "Please enter a username",
// // minlength: "Your username must consist of at least 2 characters"
// // },
// // password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long"
// // },
// // confirm_password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long",
// // equalTo: "Please enter the same password as above"
// // },
// // email: "Please enter a valid email address",
// // agree: "Please accept our policy"
// },
// errorElement: "em",
// errorPlacement: function ( error, element ) {
// // Add the `help-block` class to the error element
// error.addClass( "invalid-feedback" );
// if ( element.prop( "type" ) === "checkbox" ) {
// error.insertAfter( element.parent( "label" ) );
// } else {
// error.insertAfter( element );
// }
// },
// highlight: function ( element, errorClass, validClass ) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
// },
// unhighlight: function (element, errorClass, validClass) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
// }
// } );
} );
</script>
<script type="text/javascript">
function validarCPF(valor){
var soma = 0;
var resto;
var inputCPF = valor.match(/\d/g).join('');
if(inputCPF == '00000000000') return false;
if(inputCPF.length >11) return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(9, 10))) return false;
soma = 0;
for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(10, 11))) return false;
return true;
}
/*
* FUNCAO: Gerar as areas
*
*/
function areas() {
var grandeArea = $('#grandeArea').val();
$.ajax({
type: 'POST',
url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados) => {
if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Área --</option>";
}
$('#area').html(option).show();
subareas();
},
error: (data) => {
console.log(data);
}
})
}
/*
* FUNCAO: Gerar as subareas
*
*/
function subareas() {
var area = $('#area').val();
$.ajax({
type: 'POST',
url: '{{ route('subarea.consulta') }}',
data: 'id='+area ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados)=> {
if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Subárea --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Subárea --</option>";
}
$('#subArea').html(option).show();
},
error: (dados) => {
console.log(dados);
}
})
}
/*
* FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?"
*
*/
function displayAutorizacoesEspeciais(valor){
if(valor == "sim"){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else if(valor == "nao"){
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
}
/*
* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF)
*
*/
function verificarArquivoAnexado_pdf(item, legenda){
if(item.files[0].type.split('/')[1] != "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}
/* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS)
*
*/
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].size > 2000000){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}else{
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}
}
/*
* FUNCAO: Gerar periodos 1
*
*/
// function gerarPeriodos1(select) {
// var div = select.parentElement.parentElement;
// var selectPeriodos = div.children[22].children[1];
// var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
// for(var i = 0; i < parseInt(select.value); i++) {
// html += `<option value="${i+1}">${i+1}º</option>`;
// }
// });
// });
// $(document).ready(function(){
// $(".cpf").change(function(){
// console.log(this.parentElement.children[0])
// if (validarCPF(retirarFormatacao(this.value))) {
// this.parentElement.children[1].style.display = "none";
// this.parentElement.children[2].style.display = "block";
// } else {
// this.parentElement.children[1].style.display = "block";
// this.parentElement.children[2].style.display = "none";
// }
// });
// });
function checarCPFdoCampo(input) {
if (input.value.length == 14) {
if (validarCPF(retirarFormatacao(input.value))) {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "block";
} else {
input.parentElement.children[1].style.display = "block";
input.parentElement.children[2].style.display = "none";
}
} else {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "none";
}
}
function validarCPF(strCPF) {
var soma;
var resto;
soma = 0;
// Verifica se foi informado todos os digitos corretamente
if (strCPF.length != 11) {
return false;
}
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if (varificarDigitos(strCPF)) {
return false;
}
// Faz o calculo para validar o CPF
for (var t = 9; t < 11; t++) {
for (var d = 0, c = 0; c < t; c++) {
d += strCPF[c] * ((t + 1) - c);
}
d = ((10 * d) % 11) % 10;
if (strCPF[c] != d) {
return false;
}
}
return true;
}
function retirarFormatacao(strCpf) {
resultado = "";
for(var i = 0; i < strCpf.length; i++) {
if (strCpf[i] != "." && strCpf[i] != "-") {
resultado += strCpf[i];
}
}
return resultado;
}
function varificarDigitos(strCpf) {
var cont = 1;
dig1 = strCpf[0];
for(var i = 1; i < strCpf.length; i++) {
if(dig1 == strCpf[i]) {
cont++;
}
}
if (cont == strCpf.length) {
return true;
}
return false;
}
function checarCpfs() {
var validacoes = document.getElementsByClassName("cpf-invalido");
var count = validacoes.length;
var quant = 0;
for(var i = 0; i < validacoes.length; i++) {
if (validacoes[i].style.display == "none") {
quant++;
}
}
if(quant == count) {
return true;
}
return false;
}
function submeterProposta() {
if (checarCpfs()) {
document.getElementById("submeterFormProposta").click();
} else {
$("#modalCpfInvalido").modal('show');
}
}
function mascaraCPF(input) {
var numeros = "0123456789.-";
var resultado = "";
if (input.value.length < 14) {
for (var i = 0; i < input.value.length; i++) {
if (numeros.indexOf(input.value[i]) > -1) {
if ((i == 2 || i == 6) && input.value[i+1] != ".") {
resultado += input.value[i] + ".";
} else if (i == 10 && input.value[i+1] != "-") {
resultado += input.value[i] + "-";
} else {
resultado += input.value[i];
}
}
}
} else {
for (var i = 0; i < 14; i++) {
resultado += input.value[i];
}
}
input.value = resultado;
}
function showInstituicao(instituicao){
var instituicaoSelect = instituicao;
var idSelect = instituicaoSelect.name;
var instituicao = document.getElementById('outra'+idSelect);
var display = document.getElementById('display'+idSelect);
if(instituicaoSelect.value === "Outra"){
display.style.display = "block";
instituicao.parentElement.style.display = '';
instituicao.value="";
}else if(instituicaoSelect.value === "UFAPE"){
display.style.display = "none";
}
}
function showCurso(curso){
var cursoSelect = curso;
var idSelect = cursoSelect.name;
var curso = document.getElementById('outro'+idSelect);
var displayCurso = document.getElementById('display'+idSelect);
if(cursoSelect.value === "Outro"){
displayCurso.style.display = "block";
curso.parentElement.style.display = '';
curso.value="";
}else{
displayCurso.style.display = "none";
}
}
</script>
@endsection
\ No newline at end of file
......@@ -21,18 +21,21 @@
<th scope="col" style="width:400px; text-align: center;">Projeto</th>
<th scope="col" style="width:400px; text-align: center;">Proponente</th>
<th scope="col" style="width:400px; text-align: center;">Título do Plano</th>
@if ($evento->numParticipantes != 0)
<th scope="col" style="width:200px; text-align: center;">Discente</th>
<th scope="col" style="width:200px; text-align: center;">Relatório Parcial</th>
<th scope="col" style="width:200px; text-align: center;">Relatório Final</th>
@endif
<th scope="col" style="width:200px; text-align: center;">Relatório Parcial</th>
<th scope="col" style="width:200px; text-align: center;">Relatório Final</th>
</tr>
</thead>
@foreach($arquivos as $arquivo)
<tbody>
<td style="text-align: center;" title="{{$arquivo->trabalho->titulo}}">{{$arquivo->trabalho->titulo}}</td>
<td style="text-align: center;" title="{{$arquivo->trabalho->proponente->user->name}}">{{$arquivo->trabalho->proponente->user->name}}</td>
<td style="text-align: center;" title="{{$arquivo->titulo}}">{{$arquivo->titulo}}</td>
@if ($evento->numParticipantes != 0)
<td style="text-align: center;" title="{{$arquivo->participante->user->name}}" id="td-nomeAluno">{{$arquivo->participante->user->name}}</td>
@endif
<td style="text-align: center;">
@if((Auth::user()->proponentes != null) && ($arquivo->relatorioParcial == null) &&
($arquivo->trabalho->evento->dt_inicioRelatorioParcial <= $hoje) && ($hoje <= $arquivo->trabalho->evento->dt_fimRelatorioParcial))
......
......@@ -181,7 +181,7 @@
</div>
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js%22%3E"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
if("{{old('autorizacaoFlag')}}" == "sim"){
$('#radioSim').click();
......
......@@ -96,6 +96,49 @@
</div>
@endif
@if ($edital->numParticipantes == 0)
@php
$arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first();
@endphp
<div class="col-md-3">
<br>
<label for="nomePlanoTrabalho" class="col-form-label font-tam" style="font-weight: bold">{{ __('Título do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label>
</div>
<div class="col-md-9">
<br>
<input type="text" class="form-control" value="{{old('nomePlanoTrabalho') ?? $arquivo->titulo ?? "" }}" name="nomePlanoTrabalho" maxlength="255" id="nomePlanoTrabalho" required>
<span style="color: red; font-size: 12px" id="caracsRestantesnomePlanoTrabalho">
</span>
@error('nomePlanoTrabalho')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-3">
<br>
<label for="anexoPlanoTrabalho" class="col-form-label font-tam"
style="font-weight: bold">{{ __('Anexo do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label>
@if ($proponente != null && $arquivo)
<a style="margin-left: 5px"
href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}">
<i class="fas fa-file-pdf fa-2x"></i></a>
@else
<p><i class="fas fa-times-circle fa-2x"></i></p>
@endif
</div>
<div class="col-md-9">
<br>
<input type="file" class="input-group-text" value="{{old('anexoPlanoTrabalho') ?? '' }}" name="anexoPlanoTrabalho" accept=".pdf" placeholder="Anexo do Plano de Trabalho" />
@error('anexoPlanoTrabalho')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
@endif
<div class="col-md-2">
<br>
<label for="conflitosInteresse" class="col-form-label font-tam"
......@@ -104,7 +147,7 @@
<div class="col-md-10">
<br>
<textarea class="form-control @error('conflitosInteresse') is-invalid @enderror" autocomplete="conflitosInteresse"
autofocus id="conflitosInteresse" name="conflitosInteresse" rows="4">{{ $projeto->conflitosInteresse }}</textarea>
id="conflitosInteresse" name="conflitosInteresse" rows="4">{{ $projeto->conflitosInteresse }}</textarea>
@error('conflitosInteresse')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
......
@extends('layouts.app')
@section('content')
<div>
{{-- action="{{route('trabalho.store')}}" --}}
<form method="POST" id="updateProjetoForm" action="{{route('trabalho.update', ['id' => $projeto->id])}}" enctype="multipart/form-data" >
@csrf
<input type="hidden" name="editalId" value="{{$edital->id}}">
<div class="container">
{{-- @dd($errors->get('name.*')) --}}
{{-- @dd($errors->has('cpf.*')) --}}
{{-- @dd($errors->getBags()['default']->keys()) --}}
@if (session('mensagem'))
<div class="alert alert-warning" role="alert">
{{ session('mensagem') }}
</div>
@endif
<!-- @if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif -->
<div class="row justify-content-center">
@include('projeto.editaFormulario.projeto')
@include('projeto.editaFormulario.proponente')
@include('projeto.editaFormulario.participantes')
@if($edital->natureza_id == 3)
@include('projeto.editaFormulario.integrantes')
@endif
@include('projeto.editaFormulario.anexos')
@include('projeto.editaFormulario.finalizar')
</div>
</div>
</form>
<div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent
</div>
<!-- Modal de Aviso Edit -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<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; margin-top:10px;">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Existe um CPF inválido em um dos discentes por favor corrija para continuar.
</div>
{{-- <div class="modal-footer">
{{-- <button type="button" class="btn btn-secondary"></button>
{{-- <button type="button" class="btn btn-primary">Certo</button>
</div> --}}
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<script>
if(document.getElementById("radioSim").checked){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else{
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
let buttonSubmit = document.getElementById('idButtonSubmitProjeto');
let buttonRascunho = document.getElementById('idButtonSubmitRascunho');
let parts = document.getElementById('participante');
let partsFirst = document.getElementById('participanteFirst');
const participante = partsFirst.firstElementChild;
let contador = 0;
buttonSubmit.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
})
buttonRascunho.addEventListener('click', (e)=>{
$('.collapse').addClass('show');
const input = '<input id="input_rascunho" type="hidden" name="rascunho" value="true">';
$("#updateProjetoForm").append(input);
})
function gerarPeriodo(e){
var select = e.parentElement.parentElement.nextElementSibling;
selectPeriodos = select.children[0].children[1];
var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
for(var i = 0; i < parseInt(e.value); i++) {
html += `<option value="${i+1}">${i+1}º</option>`;
}
$(selectPeriodos).html('');
$(selectPeriodos).append(html);
}
function removerPart(e){
console.log(e)
if(e.parentElement.parentElement){
if(parts.children.length <= 1){
}else{
parts.removeChild(e.parentElement.parentElement);
//contador--;
}
}
}
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);
}
};
$("input.cpf:text").mask("000.000.000-00");
$("input.celular:text").mask(SPMaskBehavior, spOptions);
$("input.cep:text").mask("00000-000");
buttonMais.addEventListener("click", (e) => {
if(parts.children.length >= "{{ $edital->numParticipantes }}"){
alert('Limite de participante.')
}else{
contador++;
var cln = participante.cloneNode(true);
cln.setAttribute('style', " ");
var id = cln.children[2].firstElementChild.id;
var id2 = cln.children[0].firstElementChild.id;
cln.children[2].firstElementChild.setAttribute('id', id + contador);
cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador);
cln.children[0].firstElementChild.setAttribute('id', id2 + contador);
for (i = 0; i < cln.children.length; i++) {
for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) {
let input = cln.children[i].querySelectorAll('input')[index];
let name = input.getAttributeNode("name").value;
name = name.replace("[]", "");
input.getAttributeNode("name").value = name + '['+ contador +']';
let select = cln.children[i].querySelectorAll('select')[index];
if(select){
let selectName = select.getAttributeNode("name").value;
selectName = selectName.replace("[", "");
selectName = selectName.replace("]", "");
select.getAttributeNode("name").value = selectName + '['+ contador +']';
}
}
}
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);
}
};
parts.appendChild(cln);
$("input.cpf:text").val("").mask("000.000.000-00");
$("input.celular:text").val("").mask(SPMaskBehavior, spOptions);
$("input.cep:text").val("").mask("00000-000");
}
});
function marcar(id){
let nome = document.getElementById("nome"+id);
let linkNome = document.getElementById("nomePart"+(id+1));
let linkTituloProj = document.getElementById("tituloProj"+(id+1));
let planoTrabalho = document.getElementById("nomePlanoTrabalho"+id);
if(nome.value != ""){
if(planoTrabalho.value != ""){
linkNome.innerText = `Nome: ${nome.value} \n Plano: ${planoTrabalho.value}`;
}else {
linkNome.innerText = `Nome: ${nome.value}`;
}
}
if(id >=1){
document.getElementById("cancelar"+(id-1)).setAttribute("disabled", true);
}
document.getElementById("checkB"+id).checked = true;
$("#atribuir1").attr('data-target','#exampleModal'+(id+1));
document.getElementById("part"+id).removeAttribute("hidden");
document.getElementById("exampleModal"+id).modal('hide');
}
function desmarcar(id){
if(id >= 1){;
document.getElementById("cancelar"+(id-1)).removeAttribute("disabled");
}
document.getElementById("checkB"+id).checked = false;
document.getElementById("part"+id).setAttribute("hidden",true);
$("#atribuir1").attr('data-target','#exampleModal'+(id));
document.getElementById("exampleModal"+id).modal('hide');
}
</script>
<script>
$.validator.addMethod("alpha", function(value, element) {
return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/);
});
$('input.cep:text').mask('00000-000');
//$('input.cpf:text').mask('000.000.000-00');
$('.numero').mask('0000000000000');
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);
$('.sus').mask('000 0000 0000 0000');
$("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val('');
}
});
// $.validator.setDefaults( {
// submitHandler: function (form) {
// form.submit();
// }
// } );
// jQuery.extend(jQuery.validator.messages, {
// required: "Este campo &eacute; requerido.",
// remote: "Por favor, corrija este campo.",
// 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.",
// date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
// 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.",
// 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.",
// 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.",
// 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."),
// 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}."),
// 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}.")
// });
// $( "#criarProjetoForm" ).validate( {
// lang: 'PT_BR',
// rules: {
// firstname: "required",
// username: {
// required: true,
// minlength: 2
// },
// password: {
// required: true,
// minlength: 5
// },
// confirm_password: {
// required: true,
// minlength: 5,
// equalTo: "#password"
// },
// email: {
// required: true,
// email: true,
// },
// "complemento[]":{
// },
// "nomeParticipante[]":{
// alpha:true,
// },
// 'rg[]':{
// maxlength: 12,
// },
// agree: "required"
// },
// messages: {
// // nomeProjeto: "O nome do projeto é obrigatório.",
// // 'emailParticipante[]': "Este campo é obrigatório.",
// // 'data_de_nascimento[]': "Este campo é obrigatório.",
// // 'cpf[]': "Este campo é obrigatório.",
// // 'rg[]': {
// // required: "Este campo é obrigatório.",
// // maxlength: "Este campo deve conter no máximo 8 números."
// // },
// // 'celular[]': "Este campo é obrigatório.",
// // 'cep[]': "Este campo é obrigatório.",
// // 'uf[]': "Este campo é obrigatório.",
// // 'cidade[]': "Este campo é obrigatório.",
// // 'bairro[]': "Este campo é obrigatório.",
// // 'rua[]': "Este campo é obrigatório.",
// // 'numero[]': "Este campo é obrigatório.",
// // 'complemento[]': "Este campo é obrigatório.",
// // 'universidade[]': "Este campo é obrigatório.",
// // 'curso[]': "Este campo é obrigatório.",
// // 'turno[]': "Este campo é obrigatório.",
// // 'total_periodos[]': "Este campo é obrigatório.",
// // 'periodo_atual[]': "Este campo é obrigatório.",
// // 'ordem_prioridade[]': "Este campo é obrigatório.",
// // 'media_geral_curso[]': "Este campo é obrigatório.",
// // 'nomePlanoTrabalho[]': "Este campo é obrigatório.",
// // 'anexoPlanoTrabalho[]': "Este campo é obrigatório.",
// // grandeArea: "Escolha uma grande área.",
// // area: "Escolha uma área.",
// // linkGrupo: "Este campo é obrigatório.",
// // pontuacaoPlanilha: "Este campo é obrigatório.",
// // anexoProjeto: "Este campo é obrigatório.",
// // anexoLattesCoordenador: "Este campo é obrigatório.",
// // anexoConsuPreenchido: "Este campo é obrigatório.",
// // anexoGrupoPesquisa: "Este campo é obrigatório.",
// // anexoPlanilha: "Este campo é obrigatório.",
// // anexoComiteEtica: "Este campo é obrigatório.",
// // inputJustificativa: "Este campo é obrigatório.",
// // "nomeParticipante[]": {
// // required: "O nome do participante é obrigatório.",
// // alpha: "Não é permitido números."
// // },
// // username: {
// // required: "Please enter a username",
// // minlength: "Your username must consist of at least 2 characters"
// // },
// // password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long"
// // },
// // confirm_password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long",
// // equalTo: "Please enter the same password as above"
// // },
// // email: "Please enter a valid email address",
// // agree: "Please accept our policy"
// },
// errorElement: "em",
// errorPlacement: function ( error, element ) {
// // Add the `help-block` class to the error element
// error.addClass( "invalid-feedback" );
// if ( element.prop( "type" ) === "checkbox" ) {
// error.insertAfter( element.parent( "label" ) );
// } else {
// error.insertAfter( element );
// }
// },
// highlight: function ( element, errorClass, validClass ) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
// },
// unhighlight: function (element, errorClass, validClass) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
// }
// } );
} );
</script>
<script type="text/javascript">
function validarCPF(valor){
var soma = 0;
var resto;
var inputCPF = valor.match(/\d/g).join('');
if(inputCPF == '00000000000') return false;
if(inputCPF.length >11) return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(9, 10))) return false;
soma = 0;
for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(10, 11))) return false;
return true;
}
/*
* FUNCAO: Gerar as areas
*
*/
function areas() {
var grandeArea = $('#grandeArea').val();
$.ajax({
type: 'POST',
url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados) => {
if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Área --</option>";
}
$('#area').html(option).show();
subareas();
},
error: (data) => {
console.log(data);
}
})
}
/*
* FUNCAO: Gerar as subareas
*
*/
function subareas() {
var area = $('#area').val();
$.ajax({
type: 'POST',
url: '{{ route('subarea.consulta') }}',
data: 'id='+area ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados)=> {
if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Subárea --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Subárea --</option>";
}
$('#subArea').html(option).show();
},
error: (dados) => {
console.log(dados);
}
})
}
/*
* FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?"
*
*/
function displayAutorizacoesEspeciais(valor){
if(valor == "sim"){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else if(valor == "nao"){
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
}
/*
* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF)
*
*/
function verificarArquivoAnexado_pdf(item, legenda){
if(item.files[0].type.split('/')[1] != "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}
/* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS)
*
*/
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].size > 2000000){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}else{
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}
}
/*
* FUNCAO: Gerar periodos 1
*
*/
// function gerarPeriodos1(select) {
// var div = select.parentElement.parentElement;
// var selectPeriodos = div.children[22].children[1];
// var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
// for(var i = 0; i < parseInt(select.value); i++) {
// html += `<option value="${i+1}">${i+1}º</option>`;
// }
// });
// });
// $(document).ready(function(){
// $(".cpf").change(function(){
// console.log(this.parentElement.children[0])
// if (validarCPF(retirarFormatacao(this.value))) {
// this.parentElement.children[1].style.display = "none";
// this.parentElement.children[2].style.display = "block";
// } else {
// this.parentElement.children[1].style.display = "block";
// this.parentElement.children[2].style.display = "none";
// }
// });
// });
function checarCPFdoCampo(input) {
if (input.value.length == 14) {
if (validarCPF(retirarFormatacao(input.value))) {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "block";
} else {
input.parentElement.children[1].style.display = "block";
input.parentElement.children[2].style.display = "none";
}
} else {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "none";
}
}
function validarCPF(strCPF) {
var soma;
var resto;
soma = 0;
// Verifica se foi informado todos os digitos corretamente
if (strCPF.length != 11) {
return false;
}
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if (varificarDigitos(strCPF)) {
return false;
}
// Faz o calculo para validar o CPF
for (var t = 9; t < 11; t++) {
for (var d = 0, c = 0; c < t; c++) {
d += strCPF[c] * ((t + 1) - c);
}
d = ((10 * d) % 11) % 10;
if (strCPF[c] != d) {
return false;
}
}
return true;
}
function retirarFormatacao(strCpf) {
resultado = "";
for(var i = 0; i < strCpf.length; i++) {
if (strCpf[i] != "." && strCpf[i] != "-") {
resultado += strCpf[i];
}
}
return resultado;
}
function varificarDigitos(strCpf) {
var cont = 1;
dig1 = strCpf[0];
for(var i = 1; i < strCpf.length; i++) {
if(dig1 == strCpf[i]) {
cont++;
}
}
if (cont == strCpf.length) {
return true;
}
return false;
}
function checarCpfs() {
var validacoes = document.getElementsByClassName("cpf-invalido");
var count = validacoes.length;
var quant = 0;
for(var i = 0; i < validacoes.length; i++) {
if (validacoes[i].style.display == "none") {
quant++;
}
}
if(quant == count) {
return true;
}
return false;
}
function submeterProposta() {
if (checarCpfs()) {
document.getElementById("submeterFormProposta").click();
} else {
$("#modalCpfInvalido").modal('show');
}
}
function mascaraCPF(input) {
var numeros = "0123456789.-";
var resultado = "";
if (input.value.length < 14) {
for (var i = 0; i < input.value.length; i++) {
if (numeros.indexOf(input.value[i]) > -1) {
if ((i == 2 || i == 6) && input.value[i+1] != ".") {
resultado += input.value[i] + ".";
} else if (i == 10 && input.value[i+1] != "-") {
resultado += input.value[i] + "-";
} else {
resultado += input.value[i];
}
}
}
} else {
for (var i = 0; i < 14; i++) {
resultado += input.value[i];
}
}
input.value = resultado;
}
function showInstituicao(instituicao){
var instituicaoSelect = instituicao;
var idSelect = instituicaoSelect.name;
var instituicao = document.getElementById('outra'+idSelect);
var display = document.getElementById('display'+idSelect);
if(instituicaoSelect.value === "Outra"){
display.style.display = "block";
instituicao.parentElement.style.display = '';
//instituicao.value="";
}else{
display.style.display = "none";
}
}
function showCurso(curso){
var cursoSelect = curso;
var idSelect = cursoSelect.name;
var curso = document.getElementById('outro'+idSelect);
var displayCurso = document.getElementById('display'+idSelect);
if(cursoSelect.value === "Outro"){
displayCurso.style.display = "block";
curso.parentElement.style.display = '';
//curso.value="";
}else{
displayCurso.style.display = "none";
}
}
</script>
@extends('layouts.app')
@section('content')
<div>
{{-- action="{{route('trabalho.store')}}" --}}
<form method="POST" id="updateProjetoForm" action="{{route('trabalho.update', ['id' => $projeto->id])}}" enctype="multipart/form-data" >
@csrf
<input type="hidden" name="editalId" value="{{$edital->id}}">
<div class="container">
{{-- @dd($errors->get('name.*')) --}}
{{-- @dd($errors->has('cpf.*')) --}}
{{-- @dd($errors->getBags()['default']->keys()) --}}
@if (session('mensagem'))
<div class="alert alert-warning" role="alert">
{{ session('mensagem') }}
</div>
@endif
<!-- @if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif -->
<div class="row justify-content-center">
@include('projeto.editaFormulario.projeto')
@include('projeto.editaFormulario.proponente')
@if ($edital->numParticipantes != 0)
@include('projeto.editaFormulario.participantes')
@endif
@if($edital->natureza_id == 3)
@include('projeto.editaFormulario.integrantes')
@endif
@include('projeto.editaFormulario.anexos')
@include('projeto.editaFormulario.finalizar')
</div>
</div>
</form>
@if ($edital->numParticipantes != 0)
<div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent
</div>
@endif
<!-- Modal de Aviso Edit -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<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; margin-top:10px;">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Existe um CPF inválido em um dos discentes por favor corrija para continuar.
</div>
{{-- <div class="modal-footer">
{{-- <button type="button" class="btn btn-secondary"></button>
{{-- <button type="button" class="btn btn-primary">Certo</button>
</div> --}}
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<script>
if(document.getElementById("radioSim").checked){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else{
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
let buttonSubmit = document.getElementById('idButtonSubmitProjeto');
let buttonRascunho = document.getElementById('idButtonSubmitRascunho');
@if($edital->numParticipantes != 0)
let parts = document.getElementById('participante');
let partsFirst = document.getElementById('participanteFirst');
const participante = partsFirst.firstElementChild;
@endif
let contador = 0;
buttonSubmit.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
})
buttonRascunho.addEventListener('click', (e)=>{
$('.collapse').addClass('show');
const input = '<input id="input_rascunho" type="hidden" name="rascunho" value="true">';
$("#updateProjetoForm").append(input);
})
@if($edital->numParticipantes != 0)
function gerarPeriodo(e){
var select = e.parentElement.parentElement.nextElementSibling;
selectPeriodos = select.children[0].children[1];
var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
for(var i = 0; i < parseInt(e.value); i++) {
html += `<option value="${i+1}">${i+1}º</option>`;
}
$(selectPeriodos).html('');
$(selectPeriodos).append(html);
}
function removerPart(e){
console.log(e)
if(e.parentElement.parentElement){
if(parts.children.length <= 1){
}else{
parts.removeChild(e.parentElement.parentElement);
//contador--;
}
}
}
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);
}
};
$("input.cpf:text").mask("000.000.000-00");
$("input.celular:text").mask(SPMaskBehavior, spOptions);
$("input.cep:text").mask("00000-000");
buttonMais.addEventListener("click", (e) => {
if(parts.children.length >= "{{ $edital->numParticipantes }}"){
alert('Limite de participante.')
}else{
contador++;
var cln = participante.cloneNode(true);
cln.setAttribute('style', " ");
var id = cln.children[2].firstElementChild.id;
var id2 = cln.children[0].firstElementChild.id;
cln.children[2].firstElementChild.setAttribute('id', id + contador);
cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador);
cln.children[0].firstElementChild.setAttribute('id', id2 + contador);
for (i = 0; i < cln.children.length; i++) {
for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) {
let input = cln.children[i].querySelectorAll('input')[index];
let name = input.getAttributeNode("name").value;
name = name.replace("[]", "");
input.getAttributeNode("name").value = name + '['+ contador +']';
let select = cln.children[i].querySelectorAll('select')[index];
if(select){
let selectName = select.getAttributeNode("name").value;
selectName = selectName.replace("[", "");
selectName = selectName.replace("]", "");
select.getAttributeNode("name").value = selectName + '['+ contador +']';
}
}
}
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);
}
};
parts.appendChild(cln);
$("input.cpf:text").val("").mask("000.000.000-00");
$("input.celular:text").val("").mask(SPMaskBehavior, spOptions);
$("input.cep:text").val("").mask("00000-000");
}
});
function marcar(id){
let nome = document.getElementById("nome"+id);
let linkNome = document.getElementById("nomePart"+(id+1));
let linkTituloProj = document.getElementById("tituloProj"+(id+1));
let planoTrabalho = document.getElementById("nomePlanoTrabalho"+id);
if(nome.value != ""){
if(planoTrabalho.value != ""){
linkNome.innerText = `Nome: ${nome.value} \n Plano: ${planoTrabalho.value}`;
}else {
linkNome.innerText = `Nome: ${nome.value}`;
}
}
if(id >=1){
document.getElementById("cancelar"+(id-1)).setAttribute("disabled", true);
}
document.getElementById("checkB"+id).checked = true;
$("#atribuir1").attr('data-target','#exampleModal'+(id+1));
document.getElementById("part"+id).removeAttribute("hidden");
document.getElementById("exampleModal"+id).modal('hide');
}
function desmarcar(id){
if(id >= 1){;
document.getElementById("cancelar"+(id-1)).removeAttribute("disabled");
}
document.getElementById("checkB"+id).checked = false;
document.getElementById("part"+id).setAttribute("hidden",true);
$("#atribuir1").attr('data-target','#exampleModal'+(id));
document.getElementById("exampleModal"+id).modal('hide');
}
@endif
</script>
<script>
$( document ).ready( function () {
$.validator.addMethod("alpha", function(value, element) {
return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/);
});
@if($edital->numParticipantes != 0)
$('input.cep:text').mask('00000-000');
//$('input.cpf:text').mask('000.000.000-00');
$('.numero').mask('0000000000000');
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);
$('.sus').mask('000 0000 0000 0000');
$("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val('');
}
});
@endif
// $.validator.setDefaults( {
// submitHandler: function (form) {
// form.submit();
// }
// } );
// jQuery.extend(jQuery.validator.messages, {
// required: "Este campo &eacute; requerido.",
// remote: "Por favor, corrija este campo.",
// 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.",
// date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
// 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.",
// 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.",
// 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.",
// 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."),
// 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}."),
// 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}.")
// });
// $( "#criarProjetoForm" ).validate( {
// lang: 'PT_BR',
// rules: {
// firstname: "required",
// username: {
// required: true,
// minlength: 2
// },
// password: {
// required: true,
// minlength: 5
// },
// confirm_password: {
// required: true,
// minlength: 5,
// equalTo: "#password"
// },
// email: {
// required: true,
// email: true,
// },
// "complemento[]":{
// },
// "nomeParticipante[]":{
// alpha:true,
// },
// 'rg[]':{
// maxlength: 12,
// },
// agree: "required"
// },
// messages: {
// // nomeProjeto: "O nome do projeto é obrigatório.",
// // 'emailParticipante[]': "Este campo é obrigatório.",
// // 'data_de_nascimento[]': "Este campo é obrigatório.",
// // 'cpf[]': "Este campo é obrigatório.",
// // 'rg[]': {
// // required: "Este campo é obrigatório.",
// // maxlength: "Este campo deve conter no máximo 8 números."
// // },
// // 'celular[]': "Este campo é obrigatório.",
// // 'cep[]': "Este campo é obrigatório.",
// // 'uf[]': "Este campo é obrigatório.",
// // 'cidade[]': "Este campo é obrigatório.",
// // 'bairro[]': "Este campo é obrigatório.",
// // 'rua[]': "Este campo é obrigatório.",
// // 'numero[]': "Este campo é obrigatório.",
// // 'complemento[]': "Este campo é obrigatório.",
// // 'universidade[]': "Este campo é obrigatório.",
// // 'curso[]': "Este campo é obrigatório.",
// // 'turno[]': "Este campo é obrigatório.",
// // 'total_periodos[]': "Este campo é obrigatório.",
// // 'periodo_atual[]': "Este campo é obrigatório.",
// // 'ordem_prioridade[]': "Este campo é obrigatório.",
// // 'media_geral_curso[]': "Este campo é obrigatório.",
// // 'nomePlanoTrabalho[]': "Este campo é obrigatório.",
// // 'anexoPlanoTrabalho[]': "Este campo é obrigatório.",
// // grandeArea: "Escolha uma grande área.",
// // area: "Escolha uma área.",
// // linkGrupo: "Este campo é obrigatório.",
// // pontuacaoPlanilha: "Este campo é obrigatório.",
// // anexoProjeto: "Este campo é obrigatório.",
// // anexoLattesCoordenador: "Este campo é obrigatório.",
// // anexoConsuPreenchido: "Este campo é obrigatório.",
// // anexoGrupoPesquisa: "Este campo é obrigatório.",
// // anexoPlanilha: "Este campo é obrigatório.",
// // anexoComiteEtica: "Este campo é obrigatório.",
// // inputJustificativa: "Este campo é obrigatório.",
// // "nomeParticipante[]": {
// // required: "O nome do participante é obrigatório.",
// // alpha: "Não é permitido números."
// // },
// // username: {
// // required: "Please enter a username",
// // minlength: "Your username must consist of at least 2 characters"
// // },
// // password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long"
// // },
// // confirm_password: {
// // required: "Please provide a password",
// // minlength: "Your password must be at least 5 characters long",
// // equalTo: "Please enter the same password as above"
// // },
// // email: "Please enter a valid email address",
// // agree: "Please accept our policy"
// },
// errorElement: "em",
// errorPlacement: function ( error, element ) {
// // Add the `help-block` class to the error element
// error.addClass( "invalid-feedback" );
// if ( element.prop( "type" ) === "checkbox" ) {
// error.insertAfter( element.parent( "label" ) );
// } else {
// error.insertAfter( element );
// }
// },
// highlight: function ( element, errorClass, validClass ) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
// },
// unhighlight: function (element, errorClass, validClass) {
// $( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
// }
// } );
} );
</script>
<script type="text/javascript">
function validarCPF(valor){
var soma = 0;
var resto;
var inputCPF = valor.match(/\d/g).join('');
if(inputCPF == '00000000000') return false;
if(inputCPF.length >11) return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(9, 10))) return false;
soma = 0;
for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(10, 11))) return false;
return true;
}
/*
* FUNCAO: Gerar as areas
*
*/
function areas() {
var grandeArea = $('#grandeArea').val();
$.ajax({
type: 'POST',
url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados) => {
if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Área --</option>";
}
$('#area').html(option).show();
subareas();
},
error: (data) => {
console.log(data);
}
})
}
/*
* FUNCAO: Gerar as subareas
*
*/
function subareas() {
var area = $('#area').val();
$.ajax({
type: 'POST',
url: '{{ route('subarea.consulta') }}',
data: 'id='+area ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados)=> {
if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Subárea --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Subárea --</option>";
}
$('#subArea').html(option).show();
},
error: (dados) => {
console.log(dados);
}
})
}
/*
* FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?"
*
*/
function displayAutorizacoesEspeciais(valor){
if(valor == "sim"){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else if(valor == "nao"){
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
}
/*
* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF)
*
*/
function verificarArquivoAnexado_pdf(item, legenda){
if(item.files[0].type.split('/')[1] != "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}
/* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS)
*
*/
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].size > 2000000){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}else{
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}
}
/*
* FUNCAO: Gerar periodos 1
*
*/
// function gerarPeriodos1(select) {
// var div = select.parentElement.parentElement;
// var selectPeriodos = div.children[22].children[1];
// var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
// for(var i = 0; i < parseInt(select.value); i++) {
// html += `<option value="${i+1}">${i+1}º</option>`;
// }
// });
// });
// $(document).ready(function(){
// $(".cpf").change(function(){
// console.log(this.parentElement.children[0])
// if (validarCPF(retirarFormatacao(this.value))) {
// this.parentElement.children[1].style.display = "none";
// this.parentElement.children[2].style.display = "block";
// } else {
// this.parentElement.children[1].style.display = "block";
// this.parentElement.children[2].style.display = "none";
// }
// });
// });
function checarCPFdoCampo(input) {
if (input.value.length == 14) {
if (validarCPF(retirarFormatacao(input.value))) {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "block";
} else {
input.parentElement.children[1].style.display = "block";
input.parentElement.children[2].style.display = "none";
}
} else {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "none";
}
}
function validarCPF(strCPF) {
var soma;
var resto;
soma = 0;
// Verifica se foi informado todos os digitos corretamente
if (strCPF.length != 11) {
return false;
}
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if (varificarDigitos(strCPF)) {
return false;
}
// Faz o calculo para validar o CPF
for (var t = 9; t < 11; t++) {
for (var d = 0, c = 0; c < t; c++) {
d += strCPF[c] * ((t + 1) - c);
}
d = ((10 * d) % 11) % 10;
if (strCPF[c] != d) {
return false;
}
}
return true;
}
function retirarFormatacao(strCpf) {
resultado = "";
for(var i = 0; i < strCpf.length; i++) {
if (strCpf[i] != "." && strCpf[i] != "-") {
resultado += strCpf[i];
}
}
return resultado;
}
function varificarDigitos(strCpf) {
var cont = 1;
dig1 = strCpf[0];
for(var i = 1; i < strCpf.length; i++) {
if(dig1 == strCpf[i]) {
cont++;
}
}
if (cont == strCpf.length) {
return true;
}
return false;
}
function checarCpfs() {
var validacoes = document.getElementsByClassName("cpf-invalido");
var count = validacoes.length;
var quant = 0;
for(var i = 0; i < validacoes.length; i++) {
if (validacoes[i].style.display == "none") {
quant++;
}
}
if(quant == count) {
return true;
}
return false;
}
function submeterProposta() {
if (checarCpfs()) {
document.getElementById("submeterFormProposta").click();
} else {
$("#modalCpfInvalido").modal('show');
}
}
function mascaraCPF(input) {
var numeros = "0123456789.-";
var resultado = "";
if (input.value.length < 14) {
for (var i = 0; i < input.value.length; i++) {
if (numeros.indexOf(input.value[i]) > -1) {
if ((i == 2 || i == 6) && input.value[i+1] != ".") {
resultado += input.value[i] + ".";
} else if (i == 10 && input.value[i+1] != "-") {
resultado += input.value[i] + "-";
} else {
resultado += input.value[i];
}
}
}
} else {
for (var i = 0; i < 14; i++) {
resultado += input.value[i];
}
}
input.value = resultado;
}
function showInstituicao(instituicao){
var instituicaoSelect = instituicao;
var idSelect = instituicaoSelect.name;
var instituicao = document.getElementById('outra'+idSelect);
var display = document.getElementById('display'+idSelect);
if(instituicaoSelect.value === "Outra"){
display.style.display = "block";
instituicao.parentElement.style.display = '';
//instituicao.value="";
}else{
display.style.display = "none";
}
}
function showCurso(curso){
var cursoSelect = curso;
var idSelect = cursoSelect.name;
var curso = document.getElementById('outro'+idSelect);
var displayCurso = document.getElementById('display'+idSelect);
if(cursoSelect.value === "Outro"){
displayCurso.style.display = "block";
curso.parentElement.style.display = '';
//curso.value="";
}else{
displayCurso.style.display = "none";
}
}
</script>
@endsection
\ No newline at end of file
......@@ -76,6 +76,23 @@
</div>
@endif
@if ($edital->numParticipantes == 0)
@php
$arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first();
@endphp
<div class="col-md-12">
<br>
<b style="color: #4D4D4D;">Título do Plano de Trabalho: </b>
<a style="color: #4D4D4D;">{{$arquivo->titulo}}</a>
</div>
<div class="col-sm-4" style="float: left">
<label for="anexoProjeto" class="col-form-label font-tam" style="font-weight: bold">{{ __('Anexo do Plano de Trabalho: ') }}</label>
<a href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}"><img class="" src="{{asset('img/icons/pdf.ico')}}" style="width:40px" alt=""></a>
</div>
@endif
@if ($projeto->conflitosInteresse != null &&
(Auth::user()->tipo == 'administrador' ||
Auth::user()->tipo == 'administradorResponsavel' ||
......
@extends('layouts.app')
@section('content')
<div>
{{-- action="{{route('trabalho.store')}}" --}}
<form method="POST" id="criarProjetoForm" action="{{route('trabalho.update', ['id' => $projeto->id])}}" enctype="multipart/form-data" >
@csrf
<input type="hidden" name="editalId" value="{{$edital->id}}">
<div class="container">
@if (session('mensagem'))
<div class="alert alert-warning" role="alert">
{{ session('mensagem') }}
</div>
@endif
@if($errors->any())
<div class="alert alert-danger mt-1" >
{{$errors->first()}}
</div>
@endif
<div class="row justify-content-center" style="margin-top: 4rem">
@component('projeto.formularioVisualizar.projeto2',
['edital' => $edital, 'projeto' => $projeto])
@endcomponent
@component('projeto.formularioVisualizar.proponente2', ['projeto' => $projeto, 'edital' => $edital, 'areasTematicas' => $areasTematicas])
@endcomponent
@component('projeto.formularioVisualizar.anexos2', ['edital' => $edital,'projeto' => $projeto])
@endcomponent
@component('projeto.formularioVisualizar.participantes2', ['projeto' => $projeto, 'edital' => $edital])
@endcomponent
@if($edital->natureza_id == 3)
@component('projeto.formularioVisualizar.integrantes', ['projeto' => $projeto, 'edital' => $edital, 'trabalhos_user' => $trabalhos_user])
@endcomponent
@endif
@component('projeto.formularioVisualizar.relatorio',['edital' => $edital,'projeto' => $projeto,'flagSubstituicao' =>$flagSubstituicao,
'AvalRelatParcial' => $AvalRelatParcial, 'AvalRelatFinal' => $AvalRelatFinal, 'cont' => 0])
@endcomponent
@component('projeto.formularioVisualizar.resultado2',
['projeto' => $projeto])
@endcomponent
{{-- @component('projeto.formularioVisualizar.finalizar', ['projeto' => $projeto])
@endcomponent --}}
</div>
<div class="row justify-content-end" style="padding: 15px;">
<a href="{{ url()->previous() }}" class="btn btn-primary" style="font-size: 16px;">Voltar</a>
</div>
</div>
</form>
<div class="modal fade" id="modalSelecionarDiscentes" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="overflow-x:auto; padding-left: 31px">
<h5 class="modal-title" id="exampleModalLabel" style= "color:#1492E6">Selecione os discentes que dejesa solicitar certificado/declaração</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="padding-top: 8px; color:#1492E6">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="padding-right: 32px;padding-left: 32px;padding-top: 20px;padding-bottom: 32px;">
<form id="certificadoForm" action="{{route('trabalho.solicitarCertificado', $projeto)}}" method="POST">
@csrf
<div class="form-check">
<input name="users[]" class="form-check-input" type="checkbox" value="{{$projeto->proponente->user->id}}" id="pa-{{$projeto->proponente->user->id}}">
<label class="form-check-label" for="pa-{{$projeto->proponente->user->id}}">
{{$projeto->proponente->user->name}}
</label>
</div>
@foreach ($projeto->participantes as $participante)
<div class="form-check">
<input name="users[]" class="form-check-input" type="checkbox" value="{{$participante->user->id}}" id="pa-{{$participante->user->id}}">
<label class="form-check-label" for="pa-{{$participante->user->id}}">
{{$participante->user->name}}
</label>
</div>
@endforeach
</form>
</div>
<div class="modal-footer d-flex justify-content-between px-3">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancelar</button>
<button type="submit" form="certificadoForm" class="btn btn-primary">Confirmar</button>
</div>
</div>
</div>
</div>
<div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent
</div>
<!-- Modal de Aviso Edit -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<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; margin-top:10px;">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Existe um CPF inválido em um dos discentes por favor corrija para continuar.
</div>
{{-- <div class="modal-footer">
{{-- <button type="button" class="btn btn-secondary"></button>
{{-- <button type="button" class="btn btn-primary">Certo</button>
</div> --}}
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<style>
body{font-family:Calibri, Tahoma, Arial}
.TabControl{ width:100%; overflow:hidden; height:400px}
.TabControl #header{ width:100%; overflow:hidden}
.TabControl #content{ width:100%; overflow:hidden; height:100%; }
.TabControl .abas{display:inline;}
.TabControl .abas li{float:left}
.aba{width:100px; height:30px; border-radius:5px 5px 0 0;
text-align:center; padding-top:5px;}
.ativa{width:100px; height:30px; border-radius:5px 5px 0 0;
text-align:center; padding-top:5px; background:#27408B;}
.ativa span, .selected span{color:#fff}
.TabControl .conteudo{width:100%; display:none; height:100%;}
.selected{width:100px; height:30px; border-radius:5px 5px 0 0;
text-align:center; padding-top:5px; background:#27408B}
.card:hover{
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.2);
}
.card-body{
font-size:18.4px;
}
h6,h5{
font-size:18.4px;
}
</style>
<script>
if(document.getElementById("radioSim").checked){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else{
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
let buttonSubmit = document.getElementById('idButtonSubmitProjeto');
let parts = document.getElementById('participante');
let partsFirst = document.getElementById('participanteFirst');
const participante = partsFirst.firstElementChild;
let contador = 0;
buttonSubmit.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
})
function gerarPeriodo(e){
var select = e.parentElement.parentElement.nextElementSibling;
selectPeriodos = select.children[0].children[1];
var html = `<option value="" disabled selected>-- TOTAL DE PERÍODOS --</option>`;
for(var i = 0; i < parseInt(e.value); i++) {
html += `<option value="${i+1}">${i+1}º</option>`;
}
$(selectPeriodos).html('');
$(selectPeriodos).append(html);
}
function removerPart(e){
console.log(e)
if(e.parentElement.parentElement){
if(parts.children.length <= 1){
}else{
parts.removeChild(e.parentElement.parentElement);
contador--;
}
}
}
buttonMais.addEventListener("click", (e) => {
if(parts.children.length >= "{{ $edital->numParticipantes }}"){
alert('Limite de participante.')
}else{
contador++;
var cln = participante.cloneNode(true);
cln.setAttribute('style', " ");
var id = cln.children[2].firstElementChild.id;
var id2 = cln.children[0].firstElementChild.id;
cln.children[2].firstElementChild.setAttribute('id', id + contador);
cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador);
cln.children[0].firstElementChild.setAttribute('id', id2 + contador);
for (i = 0; i < cln.children.length; i++) {
for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) {
let input = cln.children[i].querySelectorAll('input')[index];
let name = input.getAttributeNode("name").value;
name = name.replace("[]", "");
input.getAttributeNode("name").value = name + '['+ contador +']';
let select = cln.children[i].querySelectorAll('select')[index];
if(select){
let selectName = select.getAttributeNode("name").value;
selectName = selectName.replace("[", "");
selectName = selectName.replace("]", "");
select.getAttributeNode("name").value = selectName + '['+ contador +']';
}
}
}
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);
}
};
parts.appendChild(cln);
// console.log(cln);
$(cln).find(".cpf").val("").mask("000.000.000-00");
// $("input.cpf:text").val("").mask("000.000.000-00");
$("input.celular:text").val("").mask(SPMaskBehavior, spOptions);
$("input.cep:text").val("").mask("00000-000");
}
});
</script>
<script>
$( document ).ready( function () {
$('#nomeParticipante').keyup(function () {
$('#display').text($(this).val());
if($('#nomeParticipante').val() == ""){
$('#display').hide();
$('#pontos').hide();
}else{
$('#display').show();
$('#pontos').show();
}
});
$.validator.addMethod("alpha", function(value, element) {
return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/);
});
$('.cep').mask('00000000');
// $('.cpf').mask('000.000.000-00');
$('.numero').mask('0000000000000');
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);
$('.sus').mask('000 0000 0000 0000');
$("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val('');
}
});
$.validator.setDefaults( {
submitHandler: function (form) {
form.submit();
}
} );
jQuery.extend(jQuery.validator.messages, {
required: "Este campo &eacute; requerido.",
remote: "Por favor, corrija este campo.",
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.",
date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
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.",
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.",
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.",
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."),
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}."),
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}.")
});
$( "#criarProjetoForm" ).validate( {
lang: 'PT_BR',
rules: {
firstname: "required",
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#password"
},
email: {
required: true,
email: true,
},
"complemento[]":{
},
"nomeParticipante[]":{
required:true,
alpha:true,
},
'rg[]':{
required: true,
maxlength: 12,
},
agree: "required"
},
messages: {
// nomeProjeto: "O nome do projeto é obrigatório.",
// 'emailParticipante[]': "Este campo é obrigatório.",
// 'data_de_nascimento[]': "Este campo é obrigatório.",
// 'cpf[]': "Este campo é obrigatório.",
// 'rg[]': {
// required: "Este campo é obrigatório.",
// maxlength: "Este campo deve conter no máximo 8 números."
// },
// 'celular[]': "Este campo é obrigatório.",
// 'cep[]': "Este campo é obrigatório.",
// 'uf[]': "Este campo é obrigatório.",
// 'cidade[]': "Este campo é obrigatório.",
// 'bairro[]': "Este campo é obrigatório.",
// 'rua[]': "Este campo é obrigatório.",
// 'numero[]': "Este campo é obrigatório.",
// 'complemento[]': "Este campo é obrigatório.",
// 'universidade[]': "Este campo é obrigatório.",
// 'curso[]': "Este campo é obrigatório.",
// 'turno[]': "Este campo é obrigatório.",
// 'total_periodos[]': "Este campo é obrigatório.",
// 'periodo_atual[]': "Este campo é obrigatório.",
// 'ordem_prioridade[]': "Este campo é obrigatório.",
// 'media_geral_curso[]': "Este campo é obrigatório.",
// 'nomePlanoTrabalho[]': "Este campo é obrigatório.",
// 'anexoPlanoTrabalho[]': "Este campo é obrigatório.",
// grandeArea: "Escolha uma grande área.",
// area: "Escolha uma área.",
// linkGrupo: "Este campo é obrigatório.",
// pontuacaoPlanilha: "Este campo é obrigatório.",
// anexoProjeto: "Este campo é obrigatório.",
// anexoLattesCoordenador: "Este campo é obrigatório.",
// anexoConsuPreenchido: "Este campo é obrigatório.",
// anexoGrupoPesquisa: "Este campo é obrigatório.",
// anexoPlanilha: "Este campo é obrigatório.",
// anexoComiteEtica: "Este campo é obrigatório.",
// inputJustificativa: "Este campo é obrigatório.",
// "nomeParticipante[]": {
// required: "O nome do participante é obrigatório.",
// alpha: "Não é permitido números."
// },
// username: {
// required: "Please enter a username",
// minlength: "Your username must consist of at least 2 characters"
// },
// password: {
// required: "Please provide a password",
// minlength: "Your password must be at least 5 characters long"
// },
// confirm_password: {
// required: "Please provide a password",
// minlength: "Your password must be at least 5 characters long",
// equalTo: "Please enter the same password as above"
// },
// email: "Please enter a valid email address",
// agree: "Please accept our policy"
},
errorElement: "em",
errorPlacement: function ( error, element ) {
// Add the `help-block` class to the error element
error.addClass( "invalid-feedback" );
if ( element.prop( "type" ) === "checkbox" ) {
error.insertAfter( element.parent( "label" ) );
} else {
error.insertAfter( element );
}
},
highlight: function ( element, errorClass, validClass ) {
$( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
},
unhighlight: function (element, errorClass, validClass) {
$( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
}
} );
} );
</script>
<script type="text/javascript">
function validarCPF(valor){
var soma = 0;
var resto;
var inputCPF = valor.match(/\d/g).join('');
if(inputCPF == '00000000000') return false;
if(inputCPF.length >11) return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(9, 10))) return false;
soma = 0;
for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(10, 11))) return false;
return true;
}
/*
* FUNCAO: Gerar as areas
*
*/
function areas() {
var grandeArea = $('#grandeArea').val();
$.ajax({
type: 'POST',
url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados) => {
if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Área --</option>";
}
$('#area').html(option).show();
subareas();
},
error: (data) => {
console.log(data);
}
})
}
/*
* FUNCAO: Gerar as subareas
*
*/
function subareas() {
var area = $('#area').val();
$.ajax({
type: 'POST',
url: '{{ route('subarea.consulta') }}',
data: 'id='+area ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados)=> {
if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Subárea --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Subárea --</option>";
}
$('#subArea').html(option).show();
},
error: (dados) => {
console.log(dados);
}
})
}
/*
* FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?"
*
*/
function displayAutorizacoesEspeciais(valor){
if(valor == "sim"){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else if(valor == "nao"){
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
}
/*
* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF)
*
*/
function verificarArquivoAnexado_pdf(item, legenda){
if(item.files[0].type.split('/')[1] != "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}
/* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS)
*
*/
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].size > 2000000){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}else{
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}
}
/*
* FUNCAO: Gerar periodos 1
*
*/
// function gerarPeriodos1(select) {
// var div = select.parentElement.parentElement;
// var selectPeriodos = div.children[22].children[1];
// var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
// for(var i = 0; i < parseInt(select.value); i++) {
// html += `<option value="${i+1}">${i+1}º</option>`;
// }
// });
// });
// $(document).ready(function(){
// $(".cpf").change(function(){
// console.log(this.parentElement.children[0])
// if (validarCPF(retirarFormatacao(this.value))) {
// this.parentElement.children[1].style.display = "none";
// this.parentElement.children[2].style.display = "block";
// } else {
// this.parentElement.children[1].style.display = "block";
// this.parentElement.children[2].style.display = "none";
// }
// });
// });
function checarCPFdoCampo(input) {
if (input.value.length == 14) {
if (validarCPF(retirarFormatacao(input.value))) {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "block";
} else {
input.parentElement.children[1].style.display = "block";
input.parentElement.children[2].style.display = "none";
}
} else {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "none";
}
}
function validarCPF(strCPF) {
var soma;
var resto;
soma = 0;
// Verifica se foi informado todos os digitos corretamente
if (strCPF.length != 11) {
return false;
}
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if (varificarDigitos(strCPF)) {
return false;
}
// Faz o calculo para validar o CPF
for (var t = 9; t < 11; t++) {
for (var d = 0, c = 0; c < t; c++) {
d += strCPF[c] * ((t + 1) - c);
}
d = ((10 * d) % 11) % 10;
if (strCPF[c] != d) {
return false;
}
}
return true;
}
function retirarFormatacao(strCpf) {
resultado = "";
for(var i = 0; i < strCpf.length; i++) {
if (strCpf[i] != "." && strCpf[i] != "-") {
resultado += strCpf[i];
}
}
return resultado;
}
function varificarDigitos(strCpf) {
var cont = 1;
dig1 = strCpf[0];
for(var i = 1; i < strCpf.length; i++) {
if(dig1 == strCpf[i]) {
cont++;
}
}
if (cont == strCpf.length) {
return true;
}
return false;
}
function checarCpfs() {
var validacoes = document.getElementsByClassName("cpf-invalido");
var count = validacoes.length;
var quant = 0;
for(var i = 0; i < validacoes.length; i++) {
if (validacoes[i].style.display == "none") {
quant++;
}
}
if(quant == count) {
return true;
}
return false;
}
function submeterProposta() {
document.getElementById("submeterFormProposta").click();
// if (checarCpfs()) {
// } else {
// $("#modalCpfInvalido").modal('show');
// }
}
function mascaraCPF(input) {
var numeros = "0123456789.-";
var resultado = "";
if (input.value.length < 14) {
for (var i = 0; i < input.value.length; i++) {
if (numeros.indexOf(input.value[i]) > -1) {
if ((i == 2 || i == 6) && input.value[i+1] != ".") {
resultado += input.value[i] + ".";
} else if (i == 10 && input.value[i+1] != "-") {
resultado += input.value[i] + "-";
} else {
resultado += input.value[i];
}
}
}
} else {
for (var i = 0; i < 14; i++) {
resultado += input.value[i];
}
}
input.value = resultado;
}
</script>
@endsection
@extends('layouts.app')
@section('content')
<div>
{{-- action="{{route('trabalho.store')}}" --}}
<form method="POST" id="criarProjetoForm" action="{{route('trabalho.update', ['id' => $projeto->id])}}" enctype="multipart/form-data" >
@csrf
<input type="hidden" name="editalId" value="{{$edital->id}}">
<div class="container">
@if (session('mensagem'))
<div class="alert alert-warning" role="alert">
{{ session('mensagem') }}
</div>
@endif
@if($errors->any())
<div class="alert alert-danger mt-1" >
{{$errors->first()}}
</div>
@endif
<div class="row justify-content-center" style="margin-top: 4rem">
@component('projeto.formularioVisualizar.projeto2',
['edital' => $edital, 'projeto' => $projeto])
@endcomponent
@component('projeto.formularioVisualizar.proponente2', ['projeto' => $projeto, 'edital' => $edital, 'areasTematicas' => $areasTematicas])
@endcomponent
@component('projeto.formularioVisualizar.anexos2', ['edital' => $edital,'projeto' => $projeto])
@endcomponent
@if ($edital->numParticipantes != 0)
@component('projeto.formularioVisualizar.participantes2', ['projeto' => $projeto, 'edital' => $edital])
@endcomponent
@endif
@if($edital->natureza_id == 3)
@component('projeto.formularioVisualizar.integrantes', ['projeto' => $projeto, 'edital' => $edital, 'trabalhos_user' => $trabalhos_user])
@endcomponent
@endif
@component('projeto.formularioVisualizar.relatorio',['edital' => $edital,'projeto' => $projeto,'flagSubstituicao' =>$flagSubstituicao,
'AvalRelatParcial' => $AvalRelatParcial, 'AvalRelatFinal' => $AvalRelatFinal, 'cont' => 0])
@endcomponent
@component('projeto.formularioVisualizar.resultado2',
['projeto' => $projeto])
@endcomponent
{{-- @component('projeto.formularioVisualizar.finalizar', ['projeto' => $projeto])
@endcomponent --}}
</div>
<div class="row justify-content-end" style="padding: 15px;">
<a href="{{ url()->previous() }}" class="btn btn-primary" style="font-size: 16px;">Voltar</a>
</div>
</div>
</form>
<div class="modal fade" id="modalSelecionarDiscentes" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="overflow-x:auto; padding-left: 31px">
<h5 class="modal-title" id="exampleModalLabel" style= "color:#1492E6">Selecione os discentes que dejesa solicitar certificado/declaração</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="padding-top: 8px; color:#1492E6">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="padding-right: 32px;padding-left: 32px;padding-top: 20px;padding-bottom: 32px;">
<form id="certificadoForm" action="{{route('trabalho.solicitarCertificado', $projeto)}}" method="POST">
@csrf
<div class="form-check">
<input name="users[]" class="form-check-input" type="checkbox" value="{{$projeto->proponente->user->id}}" id="pa-{{$projeto->proponente->user->id}}">
<label class="form-check-label" for="pa-{{$projeto->proponente->user->id}}">
{{$projeto->proponente->user->name}}
</label>
</div>
@foreach ($projeto->participantes as $participante)
<div class="form-check">
<input name="users[]" class="form-check-input" type="checkbox" value="{{$participante->user->id}}" id="pa-{{$participante->user->id}}">
<label class="form-check-label" for="pa-{{$participante->user->id}}">
{{$participante->user->name}}
</label>
</div>
@endforeach
</form>
</div>
<div class="modal-footer d-flex justify-content-between px-3">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancelar</button>
<button type="submit" form="certificadoForm" class="btn btn-primary">Confirmar</button>
</div>
</div>
</div>
</div>
<div id="participanteFirst" >
@component('componentes.participante', ['enum_turno' => $enum_turno,'estados' => $estados, ])
@endcomponent
</div>
<!-- Modal de Aviso Edit -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<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; margin-top:10px;">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal"style="width:200px;">Fechar</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<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-content">
<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>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Existe um CPF inválido em um dos discentes por favor corrija para continuar.
</div>
{{-- <div class="modal-footer">
{{-- <button type="button" class="btn btn-secondary"></button>
{{-- <button type="button" class="btn btn-primary">Certo</button>
</div> --}}
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<style>
body{font-family:Calibri, Tahoma, Arial}
.TabControl{ width:100%; overflow:hidden; height:400px}
.TabControl #header{ width:100%; overflow:hidden}
.TabControl #content{ width:100%; overflow:hidden; height:100%; }
.TabControl .abas{display:inline;}
.TabControl .abas li{float:left}
.aba{width:100px; height:30px; border-radius:5px 5px 0 0;
text-align:center; padding-top:5px;}
.ativa{width:100px; height:30px; border-radius:5px 5px 0 0;
text-align:center; padding-top:5px; background:#27408B;}
.ativa span, .selected span{color:#fff}
.TabControl .conteudo{width:100%; display:none; height:100%;}
.selected{width:100px; height:30px; border-radius:5px 5px 0 0;
text-align:center; padding-top:5px; background:#27408B}
.card:hover{
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.2);
}
.card-body{
font-size:18.4px;
}
h6,h5{
font-size:18.4px;
}
</style>
<script>
if(document.getElementById("radioSim").checked){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else{
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
let buttonSubmit = document.getElementById('idButtonSubmitProjeto');
let parts = document.getElementById('participante');
let partsFirst = document.getElementById('participanteFirst');
const participante = partsFirst.firstElementChild;
let contador = 0;
buttonSubmit.addEventListener('click', (e)=>{
$('.collapse').addClass('show')
})
function gerarPeriodo(e){
var select = e.parentElement.parentElement.nextElementSibling;
selectPeriodos = select.children[0].children[1];
var html = `<option value="" disabled selected>-- TOTAL DE PERÍODOS --</option>`;
for(var i = 0; i < parseInt(e.value); i++) {
html += `<option value="${i+1}">${i+1}º</option>`;
}
$(selectPeriodos).html('');
$(selectPeriodos).append(html);
}
function removerPart(e){
console.log(e)
if(e.parentElement.parentElement){
if(parts.children.length <= 1){
}else{
parts.removeChild(e.parentElement.parentElement);
contador--;
}
}
}
buttonMais.addEventListener("click", (e) => {
if(parts.children.length >= "{{ $edital->numParticipantes }}"){
alert('Limite de participante.')
}else{
contador++;
var cln = participante.cloneNode(true);
cln.setAttribute('style', " ");
var id = cln.children[2].firstElementChild.id;
var id2 = cln.children[0].firstElementChild.id;
cln.children[2].firstElementChild.setAttribute('id', id + contador);
cln.children[0].firstElementChild.setAttribute('href', "#collapseParticipante" + contador);
cln.children[0].firstElementChild.setAttribute('id', id2 + contador);
for (i = 0; i < cln.children.length; i++) {
for (let index = 0; index < cln.children[i].querySelectorAll('input').length; index++) {
let input = cln.children[i].querySelectorAll('input')[index];
let name = input.getAttributeNode("name").value;
name = name.replace("[]", "");
input.getAttributeNode("name").value = name + '['+ contador +']';
let select = cln.children[i].querySelectorAll('select')[index];
if(select){
let selectName = select.getAttributeNode("name").value;
selectName = selectName.replace("[", "");
selectName = selectName.replace("]", "");
select.getAttributeNode("name").value = selectName + '['+ contador +']';
}
}
}
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);
}
};
parts.appendChild(cln);
// console.log(cln);
$(cln).find(".cpf").val("").mask("000.000.000-00");
// $("input.cpf:text").val("").mask("000.000.000-00");
$("input.celular:text").val("").mask(SPMaskBehavior, spOptions);
$("input.cep:text").val("").mask("00000-000");
}
});
</script>
<script>
$( document ).ready( function () {
$('#nomeParticipante').keyup(function () {
$('#display').text($(this).val());
if($('#nomeParticipante').val() == ""){
$('#display').hide();
$('#pontos').hide();
}else{
$('#display').show();
$('#pontos').show();
}
});
$.validator.addMethod("alpha", function(value, element) {
return this.optional(element) || value == value.match(/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/);
});
$('.cep').mask('00000000');
// $('.cpf').mask('000.000.000-00');
$('.numero').mask('0000000000000');
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);
$('.sus').mask('000 0000 0000 0000');
$("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val('');
}
});
$.validator.setDefaults( {
submitHandler: function (form) {
form.submit();
}
} );
jQuery.extend(jQuery.validator.messages, {
required: "Este campo &eacute; requerido.",
remote: "Por favor, corrija este campo.",
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.",
date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
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.",
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.",
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.",
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."),
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}."),
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}.")
});
$( "#criarProjetoForm" ).validate( {
lang: 'PT_BR',
rules: {
firstname: "required",
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#password"
},
email: {
required: true,
email: true,
},
"complemento[]":{
},
"nomeParticipante[]":{
required:true,
alpha:true,
},
'rg[]':{
required: true,
maxlength: 12,
},
agree: "required"
},
messages: {
// nomeProjeto: "O nome do projeto é obrigatório.",
// 'emailParticipante[]': "Este campo é obrigatório.",
// 'data_de_nascimento[]': "Este campo é obrigatório.",
// 'cpf[]': "Este campo é obrigatório.",
// 'rg[]': {
// required: "Este campo é obrigatório.",
// maxlength: "Este campo deve conter no máximo 8 números."
// },
// 'celular[]': "Este campo é obrigatório.",
// 'cep[]': "Este campo é obrigatório.",
// 'uf[]': "Este campo é obrigatório.",
// 'cidade[]': "Este campo é obrigatório.",
// 'bairro[]': "Este campo é obrigatório.",
// 'rua[]': "Este campo é obrigatório.",
// 'numero[]': "Este campo é obrigatório.",
// 'complemento[]': "Este campo é obrigatório.",
// 'universidade[]': "Este campo é obrigatório.",
// 'curso[]': "Este campo é obrigatório.",
// 'turno[]': "Este campo é obrigatório.",
// 'total_periodos[]': "Este campo é obrigatório.",
// 'periodo_atual[]': "Este campo é obrigatório.",
// 'ordem_prioridade[]': "Este campo é obrigatório.",
// 'media_geral_curso[]': "Este campo é obrigatório.",
// 'nomePlanoTrabalho[]': "Este campo é obrigatório.",
// 'anexoPlanoTrabalho[]': "Este campo é obrigatório.",
// grandeArea: "Escolha uma grande área.",
// area: "Escolha uma área.",
// linkGrupo: "Este campo é obrigatório.",
// pontuacaoPlanilha: "Este campo é obrigatório.",
// anexoProjeto: "Este campo é obrigatório.",
// anexoLattesCoordenador: "Este campo é obrigatório.",
// anexoConsuPreenchido: "Este campo é obrigatório.",
// anexoGrupoPesquisa: "Este campo é obrigatório.",
// anexoPlanilha: "Este campo é obrigatório.",
// anexoComiteEtica: "Este campo é obrigatório.",
// inputJustificativa: "Este campo é obrigatório.",
// "nomeParticipante[]": {
// required: "O nome do participante é obrigatório.",
// alpha: "Não é permitido números."
// },
// username: {
// required: "Please enter a username",
// minlength: "Your username must consist of at least 2 characters"
// },
// password: {
// required: "Please provide a password",
// minlength: "Your password must be at least 5 characters long"
// },
// confirm_password: {
// required: "Please provide a password",
// minlength: "Your password must be at least 5 characters long",
// equalTo: "Please enter the same password as above"
// },
// email: "Please enter a valid email address",
// agree: "Please accept our policy"
},
errorElement: "em",
errorPlacement: function ( error, element ) {
// Add the `help-block` class to the error element
error.addClass( "invalid-feedback" );
if ( element.prop( "type" ) === "checkbox" ) {
error.insertAfter( element.parent( "label" ) );
} else {
error.insertAfter( element );
}
},
highlight: function ( element, errorClass, validClass ) {
$( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
},
unhighlight: function (element, errorClass, validClass) {
$( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
}
} );
} );
</script>
<script type="text/javascript">
function validarCPF(valor){
var soma = 0;
var resto;
var inputCPF = valor.match(/\d/g).join('');
if(inputCPF == '00000000000') return false;
if(inputCPF.length >11) return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(9, 10))) return false;
soma = 0;
for(i = 1; i <= 10; i++) soma = soma + parseInt(inputCPF.substring(i-1, i))*(12-i);
resto = (soma * 10) % 11;
if((resto == 10) || (resto == 11)) resto = 0;
if(resto != parseInt(inputCPF.substring(10, 11))) return false;
return true;
}
/*
* FUNCAO: Gerar as areas
*
*/
function areas() {
var grandeArea = $('#grandeArea').val();
$.ajax({
type: 'POST',
url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados) => {
if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Área --</option>";
}
$('#area').html(option).show();
subareas();
},
error: (data) => {
console.log(data);
}
})
}
/*
* FUNCAO: Gerar as subareas
*
*/
function subareas() {
var area = $('#area').val();
$.ajax({
type: 'POST',
url: '{{ route('subarea.consulta') }}',
data: 'id='+area ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados)=> {
if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Subárea --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Subárea --</option>";
}
$('#subArea').html(option).show();
},
error: (dados) => {
console.log(dados);
}
})
}
/*
* FUNCAO: funcao responsavel pelo abre e fecha da area "possui autorizacoes especiais?"
*
*/
function displayAutorizacoesEspeciais(valor){
if(valor == "sim"){
document.getElementById("radioSim").checked = true;
document.getElementById("radioNao").checked = false;
document.getElementById("displaySim").style.display = "block";
document.getElementById("displayNao").style.display = "none";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}else if(valor == "nao"){
document.getElementById("radioSim").checked = false;
document.getElementById("radioNao").checked = true;
document.getElementById("displaySim").style.display = "none";
document.getElementById("displayNao").style.display = "block";
document.getElementById("idAvisoAutorizacaoEspecial").style.display = "none";
}
}
/*
* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (PDF)
*
*/
function verificarArquivoAnexado_pdf(item, legenda){
if(item.files[0].type.split('/')[1] != "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else if(item.files[0].size > 2000000 && item.files[0].type.split('/')[1] == "pdf"){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}
/* FUNCAO: funcao responsavel pela verificacao dos arquivos anexados (XLS, XLSX, ODS)
*
*/
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].size > 2000000){
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}else{
document.getElementById(legenda).innerHTML = item.value.split('\\')[2];
}
}else{
document.getElementById("idCorCabecalhoModalDocumento").style.backgroundColor = "red";
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(item.id).value = "";
$("#exampleModalAnexarDocumento").modal({show: true});
}
}
/*
* FUNCAO: Gerar periodos 1
*
*/
// function gerarPeriodos1(select) {
// var div = select.parentElement.parentElement;
// var selectPeriodos = div.children[22].children[1];
// var html = `<option value="" disabled selected>-- TOTAL DE PERIODOS --</option>`;
// for(var i = 0; i < parseInt(select.value); i++) {
// html += `<option value="${i+1}">${i+1}º</option>`;
// }
// });
// });
// $(document).ready(function(){
// $(".cpf").change(function(){
// console.log(this.parentElement.children[0])
// if (validarCPF(retirarFormatacao(this.value))) {
// this.parentElement.children[1].style.display = "none";
// this.parentElement.children[2].style.display = "block";
// } else {
// this.parentElement.children[1].style.display = "block";
// this.parentElement.children[2].style.display = "none";
// }
// });
// });
function checarCPFdoCampo(input) {
if (input.value.length == 14) {
if (validarCPF(retirarFormatacao(input.value))) {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "block";
} else {
input.parentElement.children[1].style.display = "block";
input.parentElement.children[2].style.display = "none";
}
} else {
input.parentElement.children[1].style.display = "none";
input.parentElement.children[2].style.display = "none";
}
}
function validarCPF(strCPF) {
var soma;
var resto;
soma = 0;
// Verifica se foi informado todos os digitos corretamente
if (strCPF.length != 11) {
return false;
}
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if (varificarDigitos(strCPF)) {
return false;
}
// Faz o calculo para validar o CPF
for (var t = 9; t < 11; t++) {
for (var d = 0, c = 0; c < t; c++) {
d += strCPF[c] * ((t + 1) - c);
}
d = ((10 * d) % 11) % 10;
if (strCPF[c] != d) {
return false;
}
}
return true;
}
function retirarFormatacao(strCpf) {
resultado = "";
for(var i = 0; i < strCpf.length; i++) {
if (strCpf[i] != "." && strCpf[i] != "-") {
resultado += strCpf[i];
}
}
return resultado;
}
function varificarDigitos(strCpf) {
var cont = 1;
dig1 = strCpf[0];
for(var i = 1; i < strCpf.length; i++) {
if(dig1 == strCpf[i]) {
cont++;
}
}
if (cont == strCpf.length) {
return true;
}
return false;
}
function checarCpfs() {
var validacoes = document.getElementsByClassName("cpf-invalido");
var count = validacoes.length;
var quant = 0;
for(var i = 0; i < validacoes.length; i++) {
if (validacoes[i].style.display == "none") {
quant++;
}
}
if(quant == count) {
return true;
}
return false;
}
function submeterProposta() {
document.getElementById("submeterFormProposta").click();
// if (checarCpfs()) {
// } else {
// $("#modalCpfInvalido").modal('show');
// }
}
function mascaraCPF(input) {
var numeros = "0123456789.-";
var resultado = "";
if (input.value.length < 14) {
for (var i = 0; i < input.value.length; i++) {
if (numeros.indexOf(input.value[i]) > -1) {
if ((i == 2 || i == 6) && input.value[i+1] != ".") {
resultado += input.value[i] + ".";
} else if (i == 10 && input.value[i+1] != "-") {
resultado += input.value[i] + "-";
} else {
resultado += input.value[i];
}
}
}
} else {
for (var i = 0; i < 14; i++) {
resultado += input.value[i];
}
}
input.value = resultado;
}
</script>
@endsection
......@@ -108,7 +108,7 @@
<hr class="dropdown-hr">
@endif
@if( $projeto->status== 'aprovado')
@if( $projeto->status== 'aprovado' && $projeto->evento->numParticipantes != 0)
<a href="{{route('trabalho.trocaParticipante', ['evento_id' => $projeto->evento->id, 'projeto_id' => $projeto->id])}}" class="dropdown-item" style="text-align: center;">
Solicitar Substituições
</a>
......
......@@ -124,7 +124,7 @@
<hr class="dropdown-hr">
@endif
@if( $projeto->status== 'aprovado')
@if( $projeto->status== 'aprovado' && $projeto->evento->numParticipantes != 0)
<a href="{{route('trabalho.trocaParticipante', ['evento_id' => $projeto->evento->id, 'projeto_id' => $projeto->id])}}" class="dropdown-item" style="text-align: center;">
Solicitar Substituições
</a>
......
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