Commit 82c0b1e1 authored by GuilhermeGz's avatar GuilhermeGz
Browse files

Merge branch 'master' of https://github.com/GuilhermeGz/submeta

parents b8a5b964 e14bff58
...@@ -130,9 +130,9 @@ class AdministradorController extends Controller ...@@ -130,9 +130,9 @@ class AdministradorController extends Controller
} }
// Verficação de pendencia de substituição // Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$trabalho->participantes->pluck('id'))->get()); $aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get());
$flagSubstituicao = 1; $flagSubstituicao = 1;
if($aux != count($trabalho->participantes->pluck('id'))){ if($aux != 0){
$flagSubstituicao = -1; $flagSubstituicao = -1;
} }
......
...@@ -4,6 +4,7 @@ namespace App\Http\Controllers; ...@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Arquivo; use App\Arquivo;
use App\Notificacao; use App\Notificacao;
use App\Substituicao;
use App\Trabalho; use App\Trabalho;
use App\User; use App\User;
use Auth; use Auth;
...@@ -125,8 +126,8 @@ class ArquivoController extends Controller ...@@ -125,8 +126,8 @@ class ArquivoController extends Controller
$participantes = $trabalho->participantes; $participantes = $trabalho->participantes;
// Verficação de pendencia de substituição // Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$trabalho->participantes->pluck('id'))->get()); $aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get());
if($aux != count($trabalho->participantes->pluck('id'))){ if($aux != 0){
return redirect()->back()->withErrors("A proposta ".$trabalho->titulo." possui substituições pendentes"); return redirect()->back()->withErrors("A proposta ".$trabalho->titulo." possui substituições pendentes");
} }
......
...@@ -9,6 +9,7 @@ use App\GrandeArea; ...@@ -9,6 +9,7 @@ use App\GrandeArea;
use App\ParecerInterno; use App\ParecerInterno;
use App\Participante; use App\Participante;
use App\SubArea; use App\SubArea;
use App\Substituicao;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Trabalho; use App\Trabalho;
...@@ -108,9 +109,9 @@ class AvaliadorController extends Controller ...@@ -108,9 +109,9 @@ class AvaliadorController extends Controller
$trabalho = $avaliador->trabalhos->find($request->trabalho_id); $trabalho = $avaliador->trabalhos->find($request->trabalho_id);
$evento = Evento::find($request->evento); $evento = Evento::find($request->evento);
// Verficação de pendencia de substituição // Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$trabalho->participantes->pluck('id'))->get()); $aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get());
if($aux != count($trabalho->participantes->pluck('id'))){ if($aux != 0){
return redirect()->back()->withErrors("A proposta ".$trabalho->titulo." possui substituições pendentes"); return redirect()->back()->withErrors("A proposta ".$trabalho->titulo." possui substituições pendentes");
} }
......
...@@ -52,6 +52,7 @@ use App\SolicitacaoCertificado; ...@@ -52,6 +52,7 @@ use App\SolicitacaoCertificado;
use App\SolicitacaoParticipante; use App\SolicitacaoParticipante;
use App\Substituicao; use App\Substituicao;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use App\Desligamento;
class TrabalhoController extends Controller class TrabalhoController extends Controller
{ {
...@@ -396,9 +397,9 @@ class TrabalhoController extends Controller ...@@ -396,9 +397,9 @@ class TrabalhoController extends Controller
$arquivos = Arquivo::where('trabalhoId', $id)->get(); $arquivos = Arquivo::where('trabalhoId', $id)->get();
// Verficação de pendencia de substituição // Verficação de pendencia de substituição
$aux = count(Arquivo::whereIn('participanteId',$projeto->participantes->pluck('id'))->get()); $aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$projeto->participantes->pluck('id'))->get());
$flagSubstituicao = 1; $flagSubstituicao = 1;
if($aux != count($projeto->participantes->pluck('id'))){ if($aux != 0){
$flagSubstituicao = -1; $flagSubstituicao = -1;
} }
...@@ -1565,6 +1566,7 @@ class TrabalhoController extends Controller ...@@ -1565,6 +1566,7 @@ class TrabalhoController extends Controller
$participantes = $projeto->participantes; $participantes = $projeto->participantes;
$substituicoesProjeto = Substituicao::where('trabalho_id', $projeto->id)->orderBy('created_at', 'DESC')->get(); $substituicoesProjeto = Substituicao::where('trabalho_id', $projeto->id)->orderBy('created_at', 'DESC')->get();
$desligamentosProjeto = Desligamento::where('trabalho_id', $projeto->id)->orderBy('created_at', 'DESC')->get();
return view('administrador.substituirParticipante')->with(['projeto' => $projeto, return view('administrador.substituirParticipante')->with(['projeto' => $projeto,
'edital' => $edital, 'edital' => $edital,
...@@ -1572,6 +1574,7 @@ class TrabalhoController extends Controller ...@@ -1572,6 +1574,7 @@ class TrabalhoController extends Controller
'substituicoesProjeto' => $substituicoesProjeto, 'substituicoesProjeto' => $substituicoesProjeto,
'estados' => $this->estados, 'estados' => $this->estados,
'enum_turno' => Participante::ENUM_TURNO, 'enum_turno' => Participante::ENUM_TURNO,
'desligamentosProjeto' => $desligamentosProjeto,
]); ]);
} }
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
namespace App\Http\Requests; namespace App\Http\Requests;
use App\Arquivo;
use App\Evento; use App\Evento;
use App\Participante;
use App\Trabalho; use App\Trabalho;
use App\User;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
...@@ -33,6 +36,14 @@ class UpdateTrabalho extends FormRequest ...@@ -33,6 +36,14 @@ class UpdateTrabalho extends FormRequest
if($this->has('marcado')){ if($this->has('marcado')){
foreach ($this->get('marcado') as $key => $value) { foreach ($this->get('marcado') as $key => $value) {
if( intval($value) == $key){ if( intval($value) == $key){
$usuario = User::where('email', $this->email[$value])->first();
// if(isset($usuario)){
// $participante = Participante::where('user_id', $usuario->id)->where('trabalho_id', $projeto->id)->first();
// $arquivo = Arquivo::where('trabalhoId', $projeto->id)->where('participanteId', $participante->id)->first();
// }
//user //user
$rules['name.'.$value] = ['required', 'string']; $rules['name.'.$value] = ['required', 'string'];
$rules['email.'.$value] = ['required', 'string']; $rules['email.'.$value] = ['required', 'string'];
...@@ -58,8 +69,14 @@ class UpdateTrabalho extends FormRequest ...@@ -58,8 +69,14 @@ class UpdateTrabalho extends FormRequest
$rules['media_do_curso.' . $value] = ['required', 'string']; $rules['media_do_curso.' . $value] = ['required', 'string'];
} }
$rules['nomePlanoTrabalho.'.$value] = ['required', 'string']; $rules['nomePlanoTrabalho.'.$value] = ['required', 'string'];
$rules['anexoPlanoTrabalho.'.$value] = ['required', 'mimes:pdf'];
if(isset($usuario)){
$participante = Participante::where('user_id', $usuario->id)->where('trabalho_id', $projeto->id)->first();
$arquivo = Arquivo::where('trabalhoId', $projeto->id)->where('participanteId', $participante->id)->first();
$rules['anexoPlanoTrabalho.'.$value] = [Rule::requiredIf($arquivo == null), 'mimes:pdf'];
}else {
$rules['anexoPlanoTrabalho.'.$value] = ['required', 'mimes:pdf'];
}
} }
} }
......
...@@ -39,13 +39,14 @@ ...@@ -39,13 +39,14 @@
<div class="col-2 align-self-center"> <div class="col-2 align-self-center">
<div class="row justify-content-around"> <div class="row justify-content-around">
<a href="" data-toggle="modal" data-target="#modalTestSubParticipante{{$participante->id}}" class="button" <a href="" data-toggle="modal" data-target="#modalTestSubParticipante{{$participante->id}}" class="button"
@if(($substituicoesProjeto->first() != null) && ($substituicoesProjeto->first()->status == 'Em Aguardo')) style="pointer-events: none; cursor: default;" @endif> @if(($substituicoesProjeto->first() != null) && (($substituicoesProjeto->first()->status == 'Em Aguardo') || ($desligamentosProjeto->first()->status == 1))) style="pointer-events: none; cursor: default;" @endif>
<i class="fas fa-exchange-alt fa-2x"></i></a> <i class="fas fa-exchange-alt fa-2x"></i></a>
<a href="" data-toggle="modal" data-target="#modalVizuParticipante{{$participante->id}}" class="button"><i class="far fa-eye fa-2x"></i></a> <a href="" data-toggle="modal" data-target="#modalVizuParticipante{{$participante->id}}" class="button"><i class="far fa-eye fa-2x"></i></a>
<a href="" data-toggle="modal" data-target="#modalSolicitarDesligamentoParticipante{{$participante->id}}" class="button">Solicitar desligamento</a>
<a href="" data-toggle="modal" data-target="#modalSolicitarDesligamentoParticipante{{$participante->id}}" class="button" @if(($substituicoesProjeto->first() != null) && (($substituicoesProjeto->first()->status == 'Em Aguardo') || ($desligamentosProjeto->first()->status == 1))) style="pointer-events: none; cursor: default;" @endif>Solicitar desligamento</a>
</div> </div>
</div> </div>
</div> </div>
<!-- Modal TESTE substituir participante --> <!-- Modal TESTE substituir participante -->
......
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