diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index c30162e53e54c6415116e06c0e3fdf1134303fa2..183ef4856d71506924abd79b7c94f147cd9381cb 100644 --- a/app/Http/Controllers/TrabalhoController.php +++ b/app/Http/Controllers/TrabalhoController.php @@ -93,7 +93,7 @@ class TrabalhoController extends Controller // return view('proponente.cadastro'); // } //$trabalho->proponentes()->save($proponente); - + //dd($proponente); $trabalho = "trabalho"; if($evento->inicioSubmissao > $mytime){ if($mytime >= $evento->fimSubmissao){ @@ -131,7 +131,7 @@ class TrabalhoController extends Controller 'anexoPlanilha' => [($request->anexoPlanilhaPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf,xls,xlsx', 'max:2048'], 'anexoPlanoTrabalho.*' => ['nullable', 'file', 'mimes:pdf', 'max:2048'], ]); - dd($request->all()); + if(gettype($this->validarAnexosRascunho($request, $trabalho)) != 'integer'){ return $this->validarAnexosRascunho($request, $trabalho); } @@ -680,7 +680,8 @@ class TrabalhoController extends Controller $userParticipante = User::where('email', $value)->first(); if($userParticipante == null){ $passwordTemporario = Str::random(8); - Mail::to($value)->send(new EmailParaUsuarioNaoCadastrado(Auth()->user()->name, ' ', 'Participante', $evento->nome, $passwordTemporario)); + $subject = "Participante de Projeto"; + Mail::to($value)->send(new EmailParaUsuarioNaoCadastrado(Auth()->user()->name, ' ', 'Participante', $evento->nome, $passwordTemporario, $subject)); $usuario = User::create([ 'email' => $value, 'password' => bcrypt($passwordTemporario), @@ -707,7 +708,7 @@ class TrabalhoController extends Controller $subject = "Participante de Projeto"; $email = $value; Mail::to($email) - ->send(new SubmissaoTrabalho($userParticipante, $subject)); + ->send(new SubmissaoTrabalho($userParticipante, $subject, $evento, $trabalho)); } $path = 'trabalhos/' . $request->editalId . '/' . $trabalho->id .'/'; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 093006b1da49859c04a869657789dfe1edf96a6e..cb838250a97edd20bbc35c26091f17ba8ba99836 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -68,7 +68,7 @@ return [ 'numeric' => ':Attribute deve ser :size.', 'file' => ':Attribute deve ter :size kilobytes.', 'string' => ':Attribute deve ter :size caracteres.', - 'array' => ':Attribute deve conter :size itens.', + 'array' => 'Preencha todos os campos.', ], 'string' => ':Attribute deve ser uma string', 'timezone' => ':Attribute deve ser uma timezone válida.', diff --git a/resources/lang/pt-BR/validation.php b/resources/lang/pt-BR/validation.php index 1bcee72c520ded8c68967dd41791cbced8f85a01..ba416d5c5bcd7927225abb705ccf69435f436c16 100644 --- a/resources/lang/pt-BR/validation.php +++ b/resources/lang/pt-BR/validation.php @@ -69,7 +69,7 @@ return [ 'numeric' => ':Attribute deve ser :size.', 'file' => ':Attribute deve ter :size kilobytes.', 'string' => ':Attribute deve ter :size caracteres.', - 'array' => ':Attribute deve conter :size itens.', + 'array' => 'Preencha todos os campos.', ], 'string' => ':Attribute deve ser uma string', 'timezone' => ':Attribute deve ser uma timezone válida.', diff --git a/resources/views/evento/submeterTrabalho.blade.php b/resources/views/evento/submeterTrabalho.blade.php index 4fe622eee2c0c1b0cb8b2bd911103aff2a319d93..0d0885eb69a73e6ceccba719e4ef6fb031a310d7 100644 --- a/resources/views/evento/submeterTrabalho.blade.php +++ b/resources/views/evento/submeterTrabalho.blade.php @@ -437,7 +437,7 @@ @if (Auth()->user()->administradors != null) <a href="{{ route('admin.editais') }}" class="btn btn-secondary" style="width:100%">Cancelar</a> @else - <a href="{{ route('projetos.edital', ['id' => $edital->id]) }}" class="btn btn-secondary" style="width:100%">Cancelar</a> + <a href="{{ route('proponente.projetosEdital', ['id' => $edital->id]) }}" class="btn btn-secondary" style="width:100%">Cancelar</a> @endif </form> </div> diff --git a/resources/views/projeto/editar.blade.php b/resources/views/projeto/editar.blade.php index 161cc7b48ff3ba8de39f3682f6b6ac762ebedde6..21d9ffc7fe3e46c3ee8c3692ac30020633e205de 100644 --- a/resources/views/projeto/editar.blade.php +++ b/resources/views/projeto/editar.blade.php @@ -317,13 +317,13 @@ @enderror </select> </div> - </div> - <div class="row"> - <div class='col-sm-11'> + </div> + <div class="row"> + <div class='col-sm-11'> <h6 class="mb-1">Possui plano de trabalho?</h6> <button class="btn btn-primary mt-2 mb-2 simPlano" id="simPlano">Sim</button> - <button class="btn btn-primary mt-2 mb-2 naoPlano">Não</button> - <input type="hidden" name="semPlano[]" value=""> + <button class="btn btn-primary mt-2 mb-2 naoPlano">Não</button> + <input type="hidden" name="semPlano[]" value=""> </div> <div class="col-sm-1 deletarSemPlano" > <a class="delete"> @@ -331,12 +331,12 @@ </a> </div> </div> - <div id="planoHabilitado" > + <div id="planoHabilitado" > @foreach ($arquivos as $arquivo) @if($arquivo->participanteId === $participante->id) <input type="hidden" class="exibirPlano"> <h5>Dados do plano de trabalho</h5> - <a href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}">Plano de trabalho atual</a> + <a href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}">Plano de trabalho atual</a> <div class="row"> <div class="col-sm-12"> <div id="planoTrabalho"> @@ -344,7 +344,7 @@ <div class="col-sm-4"> <label>Titulo </label> <input type="text" value="{{$arquivo->titulo}}" style="margin-bottom:10px" class="form-control @error('nomePlanoTrabalho') is-invalid @enderror" name="nomePlanoTrabalho[]" placeholder="Nome"> - + @error('nomePlanoTrabalho') <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> <strong>{{ $message }}</strong> @@ -385,7 +385,7 @@ @endif @endforeach @endforeach - </div> + </div> <a href="#" class="btn btn-primary" id="addCoautor" style="width:100%;margin-top:10px">Participantes +</a> </div> </div> @@ -429,7 +429,7 @@ } }); - + // $('#addPlanoTrabalho').click(function(e) { // e.preventDefault(); // if (qtdLinhas < 4) { @@ -465,7 +465,7 @@ //replace the "Choose a file" label $(this).next('#custom-file-label').html(fileName); }) - + $('#buttonSim').on('click', function(e) { e.preventDefault(); $('#inputEtica').prop('disabled', false); @@ -474,52 +474,30 @@ $('#buttonNao').on('click', function(e) { e.preventDefault(); $('#inputEtica').prop('disabled', true); - $('#inputJustificativa').prop('disabled', false); + $('#inputJustificativa').prop('disabled', false); }); - // Habilitando / desabilitando plano de trabalho - $('.simPlano').click(function(e) { - e.preventDefault(); - var possuiPlano = $(this).parent().parent().next(); - - //se o participante não tem plano, adicionar; se ele já tem, apenas exibir - if(possuiPlano[0].firstElementChild == null){ - linha = linhaPlanoTrabalho(); - possuiPlano.append(linha); - possuiPlano[0].style.display = 'block'; - }else if(possuiPlano[0].firstElementChild.className == 'exibirPlano'){ - possuiPlano[0].style.display = 'block'; - } - - //esconder a imagem de deletar - deletar = $(this).parent().next()[0]; - deletar.style.display = "none"; - + // Habilitando / desabilitando plano de trabalho + $(document).on('click', '.simPlano', function(e) { + e.preventDefault(); + var plano = $(this).next().next()[0]; + plano.style.display = 'block'; }); - - // se não há plano de trabalho, esconder a div planoHabilitado e exibir imagem de deletar $(document).on('click', '.naoPlano', function(e) { e.preventDefault(); - var plano = $(this).parent().parent().next()[0]; - plano.style.display = 'none'; - - deletar = $(this).parent().next()[0] - deletar.style.display = "block"; - - //comunicar ao controller para deletar somente o plano - $(this).next().val('sim'); - + var plano = $(this).next()[0]; + plano.style.display = 'none'; }); - + //se há plano de trabalho, esconder a imagem de deletar - $(function() { + $(function() { var simPlano = document.getElementsByClassName('simPlano'); for(var i=0; i< simPlano.length;i++){ - var planoHabilitado = simPlano[i].parentElement.parentElement.nextElementSibling; + var planoHabilitado = simPlano[i].parentElement.parentElement.nextElementSibling; if(planoHabilitado.firstElementChild != null && planoHabilitado.firstElementChild.className == 'exibirPlano'){ - simPlano[i].parentElement.nextElementSibling.style.display = "none"; - } - } + simPlano[i].parentElement.nextElementSibling.style.display = "none"; + } + } }); }); // Remover Coautor @@ -537,47 +515,58 @@ function montarLinhaInput() { - return "<div id="+"novoParticipante"+">" + + return "<div id="+"novoParticipante"+">" + + "<div class='row'>"+ + "<div class='col-sm-9'>"+ "<br><h4>Dados do participante</h4>" + - "<div class="+"row"+">"+ - "<div class="+"col-sm-5"+">"+ - "<label>Nome Completo</label>"+ - "<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+'form-control' + " @error('nomeParticipante') is-invalid @enderror" + "name=" +'nomeParticipante[]'+" placeholder="+"Nome"+" required>"+ - "@error('nomeParticipante')" + - "<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + - "<strong>{{ $message }}</strong>" + - "</span>" + - "@enderror" + - "</div>"+ - "<div class="+"col-sm-4"+">"+ - "<label>E-mail</label>"+ - "<input type='email'" + "style='margin-bottom:10px'" + "class=" + "form-control @error('emailParticipante') is-invalid @enderror" + "name='emailParticipante[]'" + "placeholder='email' required>" + - "@error('emailParticipante')" + - "<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + - "<strong>{{ $message }}</strong>" + - "</span>" + - "@enderror" + - "</div>"+ - "<div class='col-sm-3'>"+ - "<label>Função:</label>"+ - "<select class=" + "form-control @error('funcaoParticipante') is-invalid @enderror" + "name='funcaoParticipante[]'" + "id='funcaoParticipante'> " + - "<option value='' disabled selected hidden> Função </option>"+ - "@foreach($funcaoParticipantes as $funcaoParticipante)"+ - "<option value='{{$funcaoParticipante->id}}'>{{$funcaoParticipante->nome}}</option>"+ - "@endforeach"+ - "@error('funcaoParticipante')" + - "<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + - "<strong>{{ $message }}</strong>" + - "</span>" + - "@enderror" + - "</select>"+ - "</div>"+ - "</div>" + + "</div>"+ + "<div class='col-sm-3'>"+ + + "</div>"+ + "</div>"+ + "<div class="+"row"+">"+ + "<div class="+"col-sm-5"+">"+ + "<label>Nome Completo*</label>"+ + "<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+'form-control' + " @error('nomeParticipante') is-invalid @enderror" + "name=" +'nomeParticipante[]'+" placeholder="+"Nome"+">"+ + "@error('nomeParticipante')" + + "<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + + "<strong>{{ $message }}</strong>" + + "</span>" + + "@enderror" + + "</div>"+ + "<div class="+"col-sm-4"+">"+ + "<label>E-mail*</label>"+ + "<input type='email'" + "style='margin-bottom:10px'" + "class=" + "form-control @error('emailParticipante') is-invalid @enderror" + "name='emailParticipante[]'" + "placeholder='email' >" + + "@error('emailParticipante')" + + "<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + + "<strong>{{ $message }}</strong>" + + "</span>" + + "@enderror" + + "</div>"+ + "<div class='col-sm-3'>"+ + "<label>Função*:</label>"+ + "<select class=" + "form-control @error('funcaoParticipante') is-invalid @enderror" + "name='funcaoParticipante[]'" + "id='funcaoParticipante'> " + + "<option value='' disabled selected hidden> Função </option>"+ + "@foreach($funcaoParticipantes as $funcaoParticipante)"+ + "<option value='{{$funcaoParticipante->id}}'>{{$funcaoParticipante->nome}}</option>"+ + "@endforeach"+ + "@error('funcaoParticipante')" + + "<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + + "<strong>{{ $message }}</strong>" + + "</span>" + + "@enderror" + + "</select>"+ + "</div>"+ + "</div>" + + "<h6 class='mb-1'>Possui plano de trabalho?</h6>"+ + "<button class="+"'btn btn-primary mt-2 mb-2 mr-1 simPlano'"+">Sim</button>"+ + "<button class="+"'btn btn-primary mt-2 mb-2 mr-1 naoPlano'"+">Não</button>"+ + "<div id="+"planoHabilitado"+" style="+"'display:none;'"+">" + "<h5>Dados do plano de trabalho</h5>" + "<div class="+"row"+">"+ "<div class="+"col-sm-4"+">"+ - "<label>Titulo</label>"+ - "<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+"form-control @error('nomePlanoTrabalho') is-invalid @enderror"+" name="+'nomePlanoTrabalho[]'+" placeholder="+"Nome"+" required>"+ + "<label>Titulo*</label>"+ + "<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+"form-control @error('nomePlanoTrabalho') is-invalid @enderror"+" name="+'nomePlanoTrabalho[]'+" placeholder="+"Nome"+">"+ "@error('nomePlanoTrabalho')" + "<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + "<strong>{{ $message }}</strong>" + @@ -585,17 +574,17 @@ "@enderror" + "</div>"+ "<div class="+"col-sm-7" +">"+ - "<label for="+"nomeTrabalho"+">Anexo </label>"+ + "<label for="+"nomeTrabalho"+">Anexo* </label>"+ "<div class="+"input-group"+">"+ "<div class='input-group-prepend'>"+ - "<span class='input-group-text' id='inputGroupFileAddon01'>Selecione um arquivo:</span>"+ + "<span class='input-group-text' id='anexoPlanoTrabalho'>Selecione um arquivo:</span>"+ "</div>"+ "<div class='custom-file'>"+ - "<input type='file' class='custom-file-input @error('anexoPlanoTrabalho') is-invalid @enderror" + "id='anexoPlanoTrabalho'" + "aria-describedby='anexoPlanoTrabalho'" + "name='anexoPlanoTrabalho[]' required"+ - "aria-describedby='inputGroupFileAddon01'>"+ + "<input type='file' class='custom-file-input @error('anexoPlanoTrabalho') is-invalid @enderror" + "id='anexoPlanoTrabalho'"+ + " aria-describedby='anexoPlanoTrabalho' name='anexoPlanoTrabalho[]'>"+ "<label class='custom-file-label' id='custom-file-label' for='inputGroupFile01'>O arquivo deve ser no formato PDF de até 2mb.</label>"+ - "</div>"+ + "</div>"+ "</div>"+ "@error('anexoPlanoTrabalho')"+ "<span class='invalid-feedback' role='alert' style='overflow: visible; display:block'>"+ @@ -605,10 +594,13 @@ "</div>"+ "<div class="+"col-sm-1"+">"+ "<a class="+"delete"+">"+ - "<img src="+"/img/icons/user-times-solid.svg"+" style="+"width:25px;margin-top:35px"+">"+ + "<img src="+"{{ asset('/img/icons/user-times-solid.svg') }}"+" style="+"width:25px;margin-top:35px"+">"+ "</a>"+ "</div>"+ "</div>"+ + "</div>"+ + + "<a href='#' class="+"'btn btn-danger mt-2 mb-2 delete'"+" style='width:100%;margin-top:10px'"+">Remover participante</a>"+ "</div>"; } // function montarLinhaInputPlanoTrabalho(){ @@ -636,7 +628,7 @@ // "<strong>{{ $message }}</strong>"+ // "</span>"+ // "@enderror"+ - // "</div>"+ + // "</div>"+ // "<div class="+"col-sm-1"+">"+ // "<a class="+"deletePlano"+">"+ // "<img src="+"/img/icons/user-times-solid.svg"+" style="+"width:25px;margin-top:35px"+">"+ @@ -646,7 +638,7 @@ // } function linhaPlanoTrabalho(){ - return "<input"+" type="+"hidden"+" class="+"exibirPlano"+">"+ + return "<input"+" type="+"hidden"+" class="+"exibirPlano"+">"+ "<h5>Dados do plano de trabalho</h5>" + "<div class="+"row"+">"+ "<div class="+"col-sm-4"+">"+ @@ -675,44 +667,44 @@ "<span class='invalid-feedback' role='alert' style='overflow: visible; display:block'>"+ "<strong>{{ $message }}</strong>"+ "</span>"+ - "@enderror"+ + "@enderror"+ "</div>"+ "<div class="+"col-sm-1"+">"+ "<a class="+"delete"+">"+ "<img src="+"{{ asset('/img/icons/user-times-solid.svg') }}"+" style="+"width:25px;margin-top:35px"+">"+ "</a>"+ - "</div>"+ - "</div>"; + "</div>"+ + "</div>"; } - function areas() { + function areas() { var grandeArea = $('#grandeArea').val(); $.ajax({ type: 'POST', url: '{{ route('area.consulta') }}', data: 'id='+grandeArea , - headers: + headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: (dados) => { - - if (dados.length > 0) { - if($('#oldArea').val() == null || $('#oldArea').val() == ""){ + + 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){ + $.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 { + } else { var option = "<option selected disabled>-- Ãrea --</option>"; } - $('#area').html(option).show(); - subareas(); + $('#area').html(option).show(); + subareas(); }, error: (data) => { console.log(data); @@ -727,7 +719,7 @@ type: 'POST', url: '{{ route('subarea.consulta') }}', data: 'id='+area , - headers: + headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, @@ -736,7 +728,7 @@ if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){ var option = '<option selected disabled>-- Sub Ãrea --</option>'; } - $.each(dados, function(i, obj) { + $.each(dados, function(i, obj) { if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){ option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>'; }else{ @@ -756,4 +748,4 @@ } </script> -@endsection \ No newline at end of file +@endsection