Commit 99b9bf57 authored by alinetenorio's avatar alinetenorio
Browse files

delete de participante após erro de validação

parent f37bbaf2
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
@section('content') @section('content')
<div class="container content"> <div class="container content">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="card" style="margin-top:50px"> <div class="card" style="margin-top:50px">
...@@ -76,14 +75,6 @@ ...@@ -76,14 +75,6 @@
</div> </div>
</div> </div>
<hr> <hr>
<h3>Coordenador</h3> <h3>Coordenador</h3>
...@@ -96,8 +87,7 @@ ...@@ -96,8 +87,7 @@
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="linkLattesEstudante" class="col-form-label">Link Lattes do Proponente*</label> <label for="linkLattesEstudante" class="col-form-label">Link Lattes do Proponente*</label>
<input class="form-control @error('linkLattesEstudante') is-invalid @enderror" type="text" name="linkLattesEstudante" <input class="form-control @error('linkLattesEstudante') is-invalid @enderror" type="text" name="linkLattesEstudante" @if(Auth()->user()->proponentes->linkLattes != null)
@if(Auth()->user()->proponentes->linkLattes != null)
value="{{ Auth()->user()->proponentes->linkLattes }}" value="{{ Auth()->user()->proponentes->linkLattes }}"
@else @else
value="" value=""
...@@ -172,10 +162,6 @@ ...@@ -172,10 +162,6 @@
@enderror @enderror
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="botao" class="col-form-label @error('botao') is-invalid @enderror">{{ __('Possui autorização do Comitê de Ética*:') }}</label> <label for="botao" class="col-form-label @error('botao') is-invalid @enderror">{{ __('Possui autorização do Comitê de Ética*:') }}</label>
<button id="buttonSim" class="btn btn-primary mt-2 mb-2">Sim</button> <button id="buttonSim" class="btn btn-primary mt-2 mb-2">Sim</button>
...@@ -271,11 +257,9 @@ ...@@ -271,11 +257,9 @@
@if(old('countParticipante') != null) @if(old('countParticipante') != null)
@php $countParticipante = old('countParticipante') @endphp @php $countParticipante = old('countParticipante') @endphp
@endif @endif
{{$countParticipante}}
@if ($countParticipante != null && $countParticipante > 0) @if ($countParticipante != null && $countParticipante > 0)
@for ($i = 0; $i < $countParticipante; $i++) @for ($i = 0; $i < $countParticipante; $i++) <div id="novoParticipante" style="display: block;">
<div id="novoParticipante" style="display: block;">
<br> <br>
<h5>Dados do participante</h5> <h5>Dados do participante</h5>
<div class="row"> <div class="row">
...@@ -380,7 +364,6 @@ ...@@ -380,7 +364,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection
...@@ -388,20 +371,18 @@ ...@@ -388,20 +371,18 @@
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
var qtdLinhas = 1; var qtdLinhas = 1;
var qtdParticipantes = 2;
// Coautores // Coautores
$('#addCoautor').click(function(e) { $('#addCoautor').click(function(e) {
if (qtdParticipantes < 100) { var countParticipante = document.getElementById('countParticipante');
if (countParticipante.value < 100) {
e.preventDefault(); e.preventDefault();
linha = montarLinhaInput(); linha = montarLinhaInput();
$('#participantes').append(linha); $('#participantes').append(linha);
setParticipanteDiv(qtdParticipantes); setParticipanteDiv(parseInt(countParticipante.value) + 1);
qtdParticipantes++;
} }
}); });
function setParticipanteDiv(qtdParticipante){ function setParticipanteDiv(qtdParticipante) {
var countParticipante = document.getElementById('countParticipante'); var countParticipante = document.getElementById('countParticipante');
countParticipante.value = qtdParticipante; countParticipante.value = qtdParticipante;
} }
...@@ -413,7 +394,6 @@ ...@@ -413,7 +394,6 @@
$('#planoTrabalho').append(linha); $('#planoTrabalho').append(linha);
qtdLinhas++; qtdLinhas++;
} }
}); });
// // Exibir modalidade de acordo com a área // // Exibir modalidade de acordo com a área
// $("#area").change(function() { // $("#area").change(function() {
...@@ -421,9 +401,9 @@ ...@@ -421,9 +401,9 @@
// addModalidade($(this).val()); // addModalidade($(this).val());
// }); // });
$(document).on('click', '.delete', function() { $(document).on('click', '.delete', function() {
if (qtdParticipantes > 2) { var countParticipante = document.getElementById('countParticipante');
qtdParticipantes--; if (countParticipante.value >= 2) {
setParticipanteDiv(qtdParticipantes-1); setParticipanteDiv(parseInt(countParticipante.value) - 1);
$(this).closest('#novoParticipante').remove(); $(this).closest('#novoParticipante').remove();
return false; return false;
} }
...@@ -462,17 +442,17 @@ ...@@ -462,17 +442,17 @@
}); });
}); });
function exibirErro(campo){ function exibirErro(campo) {
console.log("o campo " + campo); console.log("o campo " + campo);
var botao = document.getElementById('botao'); var botao = document.getElementById('botao');
botao.value = "sim"; botao.value = "sim";
var comiteErro = document.getElementById('comiteErro'); var comiteErro = document.getElementById('comiteErro');
var justificativaErro = document.getElementById('justificativaErro'); var justificativaErro = document.getElementById('justificativaErro');
if(campo === 'comite'){ if (campo === 'comite') {
comiteErro.style.display = "block"; comiteErro.style.display = "block";
justificativaErro.style.display = "none"; justificativaErro.style.display = "none";
}else if(campo === 'justificativa'){ } else if (campo === 'justificativa') {
comiteErro.style.display = "none"; comiteErro.style.display = "none";
justificativaErro.style.display = "block"; justificativaErro.style.display = "block";
} }
...@@ -566,6 +546,7 @@ ...@@ -566,6 +546,7 @@
"</div>"+ "</div>"+
"</div>"; "</div>";
} }
// function montarLinhaInputPlanoTrabalho(){ // function montarLinhaInputPlanoTrabalho(){
// return "<div class="+"row"+">"+ // return "<div class="+"row"+">"+
...@@ -603,11 +584,11 @@ ...@@ -603,11 +584,11 @@
function areas() { function areas() {
var grandeArea = $('#grandeArea').val(); var grandeArea = $('#grandeArea').val();
$.getJSON("{{ config('app.url') }}/naturezas/areas/" + grandeArea, $.getJSON("{{ config('app.url') }}/naturezas/areas/" + grandeArea,
function (dados){ function(dados) {
if (dados.length > 0){ if (dados.length > 0) {
var option = '<option>-- Área --</option>'; var option = '<option>-- Área --</option>';
$.each(dados, function(i, obj){ $.each(dados, function(i, obj) {
option += '<option value="'+obj.id+'">'+obj.nome+'</option>'; option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}) })
} else { } else {
var option = "<option>-- Área --</option>"; var option = "<option>-- Área --</option>";
...@@ -619,11 +600,11 @@ ...@@ -619,11 +600,11 @@
function subareas() { function subareas() {
var area = $('#area').val(); var area = $('#area').val();
$.getJSON("{{ config('app.url') }}/naturezas/subarea/" + area, $.getJSON("{{ config('app.url') }}/naturezas/subarea/" + area,
function (dados){ function(dados) {
if (dados.length > 0){ if (dados.length > 0) {
var option = '<option>-- Sub Área --</option>'; var option = '<option>-- Sub Área --</option>';
$.each(dados, function(i, obj){ $.each(dados, function(i, obj) {
option += '<option value="'+obj.id+'">'+obj.nome+'</option>'; option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}) })
} else { } else {
var option = "<option>-- Sub Área --</option>"; var option = "<option>-- Sub Área --</option>";
......
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