Commit 1f7fe929 authored by Gabriel-31415's avatar Gabriel-31415
Browse files

Merge branch 'fixQtdParticipante' of https://github.com/lmts-ufape/submeta into master-test

merged
parents 89ee0f39 7486f122
......@@ -208,7 +208,6 @@ class TrabalhoController extends Controller
if($request->emailParticipante != null){
foreach ($request->emailParticipante as $key => $value) {
$userParticipante = User::where('email', $value)->first();
$participante = new Participante();
if($userParticipante == null){
......@@ -240,9 +239,7 @@ class TrabalhoController extends Controller
$participante->save();
$userParticipante->participantes()->save($participante);
$userParticipante->save();
$participante->trabalhos()->save($trabalho);
$subject = "Participante de Projeto";
$email = $value;
Mail::to($email)
......@@ -276,7 +273,6 @@ class TrabalhoController extends Controller
$pasta = 'trabalhos/' . $request->editalId . '/' . $trabalho->id;
$trabalho = $this->armazenarAnexosFinais($request, $pasta, $trabalho, $evento);
$subject = "Submissão de Trabalho";
$autor = Auth()->user();
$evento = $evento;
......@@ -430,78 +426,6 @@ class TrabalhoController extends Controller
$trabalho->update();
//Planos de trabalho
//Envia email com senha temp para cada participante do projeto
if($request->emailParticipante != null){
foreach ($request->emailParticipante as $key => $value) {
$userParticipante = User::where('email', $value)->first();
$participante = new Participante();
// Se participante ainda não existe
if($userParticipante == null){
$passwordTemporario = Str::random(8);
// Mail::to($value)->send(new EmailParaUsuarioNaoCadastrado(Auth()->user()->name, ' ', 'Participante', $evento->nome, $passwordTemporario));
$usuario = User::create([
'email' => $value,
'password' => bcrypt($passwordTemporario),
'usuarioTemp' => true,
'name' => $request->nomeParticipante[$key],
'tipo' => 'participante',
]);
$participante->user_id = $usuario->id;
$participante->trabalho_id = $trabalho->id;
$participante->funcao_participante_id = $request->funcaoParticipante[$key];
$participante->save();
$usuario->participantes()->save($participante);
$usuario->save();
$participante->trabalhos()->save($trabalho);
}else{
$participante->user_id = $userParticipante->id;
$participante->trabalho_id = $trabalho->id;
$participante->funcao_participante_id = $request->funcaoParticipante[$key];
$participante->save();
$userParticipante->participantes()->save($participante);
$userParticipante->save();
$participante->trabalhos()->save($trabalho);
$subject = "Participante de Projeto";
$email = $value;
// Mail::to($email)
// ->send(new SubmissaoTrabalho($userParticipante, $subject, $evento, $trabalho));
}
if($request->nomePlanoTrabalho[$key] != null){
$usuario = User::where('email', $value)->first();
$participante = Participante::where([['user_id', '=', $usuario->id], ['trabalho_id', '=', $trabalho->id]])->first();
$path = 'trabalhos/' . $request->editalId . '/' . $trabalho->id .'/';
$nome = $request->nomePlanoTrabalho[$key] .".pdf";
$file = $request->anexoPlanoTrabalho[$key];
Storage::putFileAs($path, $file, $nome);
$mytime = Carbon::now('America/Recife');
$mytime = $mytime->toDateString();
$arquivo = new Arquivo();
$arquivo->titulo = $request->nomePlanoTrabalho[$key];
$arquivo->nome = $path . $nome;
$arquivo->trabalhoId = $trabalho->id;
$arquivo->data = $mytime;
$arquivo->participanteId = $participante->id;
$arquivo->versaoFinal = true;
$arquivo->save();
}
}
}
return $trabalho;
}
/**
......
......@@ -106,6 +106,7 @@
@else
value=""
@endif >
<small>Exemplo: http://lattes.cnpq.br/8363536830656923</small>
@error('linkLattesEstudante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
......@@ -129,6 +130,7 @@
<input class="form-control @error('linkGrupo') is-invalid @enderror" type="text" name="linkGrupo"
value="{{old('linkGrupo') !== null ? old('linkGrupo') : (isset($rascunho) ? $rascunho->linkGrupoPesquisa : '')}}">
<small>Exemplo: http://dgp.cnpq.br/dgp/espelhogrupo/228363</small>
@error('linkGrupo')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
......
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