Unverified Commit ceca2996 authored by Gabriel Antônio da Silva's avatar Gabriel Antônio da Silva Committed by GitHub
Browse files

Merge pull request #61 from lmts-ufape/master-test

Master test
parents b83715ab 796fc316
......@@ -35,8 +35,10 @@ class EventoController extends Controller
$eventos = Evento::all();
// $comissaoEvento = ComissaoEvento::all();
// $eventos = Evento::where('coordenadorId', Auth::user()->id)->get();
$hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString();
return view('coordenador.home',['eventos'=>$eventos]);
return view('coordenador.home',['eventos'=>$eventos, 'hoje'=>$hoje]);
}
......
......@@ -10,6 +10,7 @@ use App\User;
use App\Trabalho;
use App\Proponente;
use App\Evento;
use Carbon\Carbon;
class ProponenteController extends Controller
{
......@@ -24,7 +25,9 @@ class ProponenteController extends Controller
public function editais(){
$eventos = Evento::all();
return view('proponente.editais', ['eventos'=> $eventos] );
$hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString();
return view('proponente.editais', ['eventos'=> $eventos, 'hoje'=>$hoje] );
}
public function store(Request $request){
......@@ -89,7 +92,9 @@ class ProponenteController extends Controller
public function projetosEdital($id) {
$edital = Evento::find($id);
$projetos = Trabalho::where('evento_id', '=', $id)->get();
$hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString();
return view('proponente.projetosEdital')->with(['edital' => $edital, 'projetos' => $projetos]);
return view('proponente.projetosEdital')->with(['edital' => $edital, 'projetos' => $projetos, 'hoje'=>$hoje]);
}
}
......@@ -32,6 +32,7 @@ use Illuminate\Support\Str;
use App\Mail\SubmissaoTrabalho;
use App\Mail\EventoCriado;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class TrabalhoController extends Controller
{
......@@ -117,6 +118,7 @@ class TrabalhoController extends Controller
'linkLattesEstudante' => ['required', 'string', 'link_lattes'],
'nomeParticipante.*' => ['required', 'string'],
'emailParticipante.*' => ['required', 'string'],
'funcaoParticipante' => ['required', 'array', 'size:'.$request->countParticipante],
'funcaoParticipante.*' => ['required', 'string'],
'nomePlanoTrabalho.*' => ['nullable', 'string'],
//--Verificando se anexos já foram submetidos
......@@ -678,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, $sube));
$usuario = User::create([
'email' => $value,
'password' => bcrypt($passwordTemporario),
......@@ -705,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 .'/';
......
......@@ -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.',
......
......@@ -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.',
......
......@@ -82,8 +82,10 @@
@if(Auth::user()->proponentes == null)
<br><a href="{{ route('proponente.create' )}}" class="visualizarEvento">Criar projeto</a>
@else
@if($evento->inicioSubmissao <= $hoje && $hoje <= $evento->fimSubmissao)
<br><a href="{{ route('trabalho.index', ['id' => $evento->id] )}}" class="visualizarEvento">Criar projeto</a>
@endif
@endif
@else
<a href="{{ route('evento.visualizarNaoLogado', ['id'=>$evento->id]) }}" class="visualizarEvento">Visualizar edital</a>
@endif
......
......@@ -7,6 +7,14 @@
<div class="card" style="margin-top:50px">
<div class="card-body">
<h5 class="card-title">Enviar Projeto</h5>
{{-- @if($errors->any())
<div class="col-md-12" style="margin-top: 100px;">
<div class="alert alert-success">
<p>{{ $errors}}</p>
</div>
</div>
@endif --}}
<p class="card-text">
<form method="POST" name="formTrabalho" action="{{route('trabalho.store')}}" enctype="multipart/form-data">
@csrf
......@@ -317,7 +325,7 @@
<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" value="{{old('nomeParticipante.'.$i)}}">
@error('nomeParticipante')
@error('nomeParticipante.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
......@@ -326,7 +334,7 @@
<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" value="{{old('emailParticipante.'.$i)}}">
@error('emailParticipante')
@error('emailParticipante.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
......@@ -339,13 +347,12 @@
@foreach($funcaoParticipantes as $funcaoParticipante)
<option @if(old('funcaoParticipante.'.$i)==$funcaoParticipante->id ) selected @endif value="{{$funcaoParticipante->id}}">{{$funcaoParticipante->nome}}</option>
@endforeach
</select>
@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>
......@@ -397,6 +404,9 @@
</div>
</div>
@if($i != 0)
<a href='#' class="btn btn-danger mt-2 mb-2 delete" style='width:100%;margin-top:10px'>Remover participante</a>
@endif
</div>
{{-- </div>
......@@ -609,8 +619,8 @@
"@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'>" +
"@error('funcaoParticipante'. $i)" +
"<span class='invalid-feedback'" + " role='alert'" + " style='overflow: visible; display:block'>" +
"<strong>{{ $message }}</strong>" +
"</span>" +
"@enderror" +
......@@ -663,39 +673,6 @@
"</div>";
}
// function montarLinhaInputPlanoTrabalho(){
// return "<div class="+"row"+">"+
// "<div class="+"col-sm-4"+">"+
// "<label>Nome Completo</label>"+
// "<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+'form-control emailCoautor'+" name="+'nomePlanoTrabalho[]'+" placeholder="+"Nome"+" required>"+
// "</div>"+
// "<div class="+"col-sm-7" +">"+
// "<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>"+
// "</div>"+
// "<div class='custom-file'>"+
// "<input type='file' class='custom-file-input' id='inputGroupFile01'"+
// "aria-describedby='inputGroupFileAddon01' 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>"+
// "@error('arquivo')"+
// "<span class='invalid-feedback' role='alert' style='overflow: visible; display:block'>"+
// "<strong>{{ $message }}</strong>"+
// "</span>"+
// "@enderror"+
// "</div>"+
// "<div class="+"col-sm-1"+">"+
// "<a class="+"deletePlano"+">"+
// "<img src="+"/img/icons/user-times-solid.svg"+" style="+"width:25px;margin-top:35px"+">"+
// "</a>"+
// "</div>"+
// "</div>";
// }
function areas() {
var grandeArea = $('#grandeArea').val();
......
......@@ -478,37 +478,15 @@
});
// Habilitando / desabilitando plano de trabalho
$('.simPlano').click(function(e) {
$(document).on('click', '.simPlano', 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";
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];
var plano = $(this).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');
});
//se há plano de trabalho, esconder a imagem de deletar
......@@ -538,11 +516,18 @@
function montarLinhaInput() {
return "<div id="+"novoParticipante"+">" +
"<div class='row'>"+
"<div class='col-sm-9'>"+
"<br><h4>Dados do participante</h4>" +
"</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"+" required>"+
"<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>" +
......@@ -550,8 +535,8 @@
"@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>" +
"<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>" +
......@@ -559,7 +544,7 @@
"@enderror" +
"</div>"+
"<div class='col-sm-3'>"+
"<label>Função:</label>"+
"<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)"+
......@@ -573,11 +558,15 @@
"</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,15 +574,15 @@
"@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>"+
......@@ -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(){
......
......@@ -49,9 +49,11 @@
<a href="{{ route('proponente.projetosEdital', ['id' => $evento->id]) }}" class="dropdown-item" style="text-align: center">
Projetos submetidos
</a>
@if($evento->inicioSubmissao <= $hoje && $hoje <= $evento->fimSubmissao)
<a href="{{ route('trabalho.index', ['id' => $evento->id] )}}" class="dropdown-item" style="text-align: center">
Criar projeto
</a>
@endif
{{-- <a href="" class="dropdown-item" style="text-align: center">
Visualizar resultado
</a> --}}
......
......@@ -25,8 +25,13 @@
<h3>Projetos do edital {{ $edital->nome }}</h3>
<h6 style="color: rgb(4, 78, 4);">Submissão irá até o dia {{ date('d-m-Y', strtotime($edital->fimSubmissao)) }}</h6>
</div>
<div class="col-sm-3">
<a href="{{ route('trabalho.index', ['id' => $edital->id] )}}" class="btn btn-primary" style="position:relative; float: right;">Criar projeto</a>
<div class="col-sm-1">
<a href="{{ route('proponente.editais') }}" class="btn btn-primary" style="position:relative; float: right;">Voltar</a>
</div>
<div class="col-sm-2">
<a @if($edital->inicioSubmissao <= $hoje && $hoje <= $edital->fimSubmissao) href="{{ route('trabalho.index', ['id' => $edital->id] )}}" class="btn btn-primary" @else href="#" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="O periodo de submissão foi encerrado." @endif style="position:relative; float: right;">Criar projeto</a>
</div>
</div>
</div>
......
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