Commit badbbf21 authored by Lucas Henrique's avatar Lucas Henrique
Browse files

Adiciona visualização dos relatórios para projetos sem discentes

parent 4b3159a0
...@@ -5,6 +5,7 @@ namespace App\Http\Controllers; ...@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Administrador; use App\Administrador;
use App\AdministradorResponsavel; use App\AdministradorResponsavel;
use App\Area; use App\Area;
use App\Arquivo;
use App\AvaliacaoRelatorio; use App\AvaliacaoRelatorio;
use App\Avaliador; use App\Avaliador;
use App\CoordenadorComissao; use App\CoordenadorComissao;
...@@ -123,6 +124,24 @@ class AdministradorController extends Controller ...@@ -123,6 +124,24 @@ class AdministradorController extends Controller
//$avaliacoesRelatorio = [];->join('users','users.id','=','candidatos.user_id') //$avaliacoesRelatorio = [];->join('users','users.id','=','candidatos.user_id')
$AvalRelatParcial = []; $AvalRelatParcial = [];
$AvalRelatFinal = []; $AvalRelatFinal = [];
if ($evento->numParticipantes == 0) {
$arquivo = Arquivo::where("trabalhoId", $trabalho->id)->first();
if (isset($arquivo)) {
$avals = AvaliacaoRelatorio::where('arquivo_id', $arquivo->id)->get();
} else {
$avals = [];
}
foreach ($avals as $aval) {
if ($aval->tipo == 'Parcial') {
array_push($AvalRelatParcial, $aval);
} else {
array_push($AvalRelatFinal, $aval);
}
}
}
foreach ($trabalho->participantes as $participante) { foreach ($trabalho->participantes as $participante) {
if (isset($participante->planoTrabalho)) { if (isset($participante->planoTrabalho)) {
$avals = AvaliacaoRelatorio::where('arquivo_id', $participante->planoTrabalho->id)->get(); $avals = AvaliacaoRelatorio::where('arquivo_id', $participante->planoTrabalho->id)->get();
......
...@@ -124,6 +124,7 @@ class ArquivoController extends Controller ...@@ -124,6 +124,7 @@ class ArquivoController extends Controller
$trabalho = Trabalho::where('id',$id)->first(); $trabalho = Trabalho::where('id',$id)->first();
$participantes = $trabalho->participantes; $participantes = $trabalho->participantes;
$evento = $trabalho->evento;
// Verficação de pendencia de substituição // Verficação de pendencia de substituição
$aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get()); $aux = count(Substituicao::where('status','Em Aguardo')->whereIn('participanteSubstituido_id',$trabalho->participantes->pluck('id'))->get());
...@@ -139,12 +140,18 @@ class ArquivoController extends Controller ...@@ -139,12 +140,18 @@ class ArquivoController extends Controller
return redirect()->back(); return redirect()->back();
} }
foreach ($participantes as $participante){ if ($evento->numParticipantes != 0) {
array_push($arquivos, $participante->planoTrabalho); foreach ($participantes as $participante){
array_push($arquivos, $participante->planoTrabalho);
}
} else {
$arquivo = Arquivo::where("trabalhoId", $trabalho->id)->first();
array_push($arquivos, $arquivo);
} }
$hoje = Carbon::today('America/Recife'); $hoje = Carbon::today('America/Recife');
$hoje = $hoje->toDateString(); $hoje = $hoje->toDateString();
return view('planosTrabalho.listar')->with(['arquivos' => $arquivos, 'hoje' => $hoje, 'trabalho' => $trabalho]); return view('planosTrabalho.listar')->with(['arquivos' => $arquivos, 'hoje' => $hoje, 'trabalho' => $trabalho, 'evento' => $evento]);
} }
public function anexarRelatorio(Request $request){ public function anexarRelatorio(Request $request){
......
...@@ -141,16 +141,19 @@ ...@@ -141,16 +141,19 @@
</div> </div>
@endif @endif
@if ($evento->numParticipantes == 0) @if ($evento->numParticipantes == 0)
@php
$arquivo = App\Arquivo::where("trabalhoId", $trabalho->id)->first();
@endphp
<div class="col-md-12"> <div class="col-md-12">
<br> <br>
<b style="color: #4D4D4D;">Título do Plano de Trabalho: </b> <b style="color: #4D4D4D;">Título do Plano de Trabalho: </b>
<a style="color: #4D4D4D;">{{$trabalho->proponente->planoTrabalho->titulo}}</a> <a style="color: #4D4D4D;">{{$arquivo->titulo}}</a>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<br> <br>
<label for="anexoProjeto" class="col-form-label font-tam" <label for="anexoProjeto" class="col-form-label font-tam"
style="font-weight: bold">{{ __('Anexo do Plano de Trabalho: ') }}</label> style="font-weight: bold">{{ __('Anexo do Plano de Trabalho: ') }}</label>
<a href="{{ route('baixar.plano', ['id' => $trabalho->proponente->planoTrabalho->id])}}"> <a href="{{ route('baixar.plano', ['id' => $arquivo->id])}}">
<img class="" src="{{asset('img/icons/pdf.ico')}}" style="width:40px" alt=""> <img class="" src="{{asset('img/icons/pdf.ico')}}" style="width:40px" alt="">
</a> </a>
</div> </div>
...@@ -532,7 +535,7 @@ ...@@ -532,7 +535,7 @@
<div class="form-row mt-3"> <div class="form-row mt-3">
<div class="col-sm-9"><h5 style="color: #234B8B; font-weight: bold">Relatórios</h5></div> <div class="col-sm-9"><h5 style="color: #234B8B; font-weight: bold">Relatórios</h5></div>
<div class="col-sm-3 text-sm-right"> <div class="col-sm-3 text-sm-right">
@if($substituicoesPendentes->count() == 0) @if($substituicoesPendentes->count() == 0 || $evento->numParticipantes == 0)
<a href="{{route('planos.listar', ['id' => $trabalho->id])}}" class="button">Listar <a href="{{route('planos.listar', ['id' => $trabalho->id])}}" class="button">Listar
Relatórios</a> Relatórios</a>
@else @else
...@@ -588,7 +591,7 @@ ...@@ -588,7 +591,7 @@
<div class="col-sm-11"><h5 style="color: #234B8B; font-weight: bold">Avaliações de <div class="col-sm-11"><h5 style="color: #234B8B; font-weight: bold">Avaliações de
Relatórios</h5></div> Relatórios</h5></div>
@if((($evento->dt_fimRelatorioParcial < $hoje && $hoje<$evento->dt_inicioRelatorioFinal) @if((($evento->dt_fimRelatorioParcial < $hoje && $hoje<$evento->dt_inicioRelatorioFinal)
|| ($hoje>$evento->dt_fimRelatorioFinal)) && ($substituicoesPendentes->count() == 0) ) || ($hoje>$evento->dt_fimRelatorioFinal)) && ($substituicoesPendentes->count() == 0 || $evento->numParticipantes == 0) )
<div class="col-md-1 text-sm-right"> <div class="col-md-1 text-sm-right">
<a type="button" value="{{ $trabalho->id }}" id="atribuir1" data-toggle="modal" <a type="button" value="{{ $trabalho->id }}" id="atribuir1" data-toggle="modal"
data-target="#avaliacaoRelatorioModal"> data-target="#avaliacaoRelatorioModal">
...@@ -603,7 +606,7 @@ ...@@ -603,7 +606,7 @@
</div> </div>
@endif @endif
<!-- Modal --> <!-- Modal -->
@if($substituicoesPendentes->count() == 0) @if($substituicoesPendentes->count() == 0 || $evento->numParticipantes == 0)
<div class="modal fade" id="avaliacaoRelatorioModal" data-bs-backdrop="static" <div class="modal fade" id="avaliacaoRelatorioModal" data-bs-backdrop="static"
data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel"
aria-hidden="true" style="overflow-y: auto"> aria-hidden="true" style="overflow-y: auto">
...@@ -612,7 +615,7 @@ ...@@ -612,7 +615,7 @@
<div class="modal-header modal-header-submeta"> <div class="modal-header modal-header-submeta">
<div class="col-md-8" style="padding-left: 0px"> <div class="col-md-8" style="padding-left: 0px">
<h5 class="modal-title titulo-table" id="avaliacaoModalLongTitle"> <h5 class="modal-title titulo-table" id="avaliacaoModalLongTitle">
@if($substituicoesPendentes->count() == 0) Seleciones o(s) avaliador(es) @else Pendências de Substituição @endif</h5> @if($substituicoesPendentes->count() == 0 || $evento->numParticipantes == 0) Seleciones o(s) avaliador(es) @else Pendências de Substituição @endif</h5>
</div> </div>
<div class="col-md-4" style="text-align: right"> <div class="col-md-4" style="text-align: right">
<button type="button" id="enviarConviteButton" class="btn btn-info" <button type="button" id="enviarConviteButton" class="btn btn-info"
...@@ -626,7 +629,7 @@ ...@@ -626,7 +629,7 @@
</button> </button>
</div> </div>
</div> </div>
@if(isset($participante->planoTrabalho)) @if(isset($participante->planoTrabalho) || $evento->numParticipantes == 0)
<div class="modal-body"> <div class="modal-body">
@if (session('error')) @if (session('error'))
<div class="col-md-12"> <div class="col-md-12">
...@@ -664,6 +667,26 @@ ...@@ -664,6 +667,26 @@
<input type="text" class="form-control form-control-edit" placeholder="Nome do avaliador" onkeyup="buscarAvalRelatorio(this)"> <img src="{{asset('img/icons/logo_lupa.png')}}" alt=""> <input type="text" class="form-control form-control-edit" placeholder="Nome do avaliador" onkeyup="buscarAvalRelatorio(this)"> <img src="{{asset('img/icons/logo_lupa.png')}}" alt="">
</div> </div>
</div> </div>
@if ($evento->numParticipantes == 0)
<div class="col-md-6">
<label style="font-weight: bold;font-size: 18px">Plano: {{$arquivo->titulo}}</label>
</div>
@php
$avaliacoesId = \App\AvaliacaoRelatorio::where("arquivo_id",$arquivo->id)->where("tipo",$tipoTemp)->pluck('user_id');
$avalProjeto = \Illuminate\Support\Facades\DB::table('users')->join('avaliadors','users.id','=','avaliadors.user_id')->whereNotIn('users.id', $avaliacoesId)->orderBy('users.name')->get();
@endphp
<select name="avaliadores_{{$arquivo->id}}_id[]" multiple
class="form-control" id="avaliacaoSelect"
style="height: 200px;font-size:15px">
@foreach ($avalProjeto as $avaliador)
<option value="{{ $avaliador->user_id }}"> {{ $avaliador->name }}
> {{$avaliador->instituicao ?? 'Instituição Indefinida'}}
> {{$avaliador->tipo}}
> {{$avaliador->email}}</option>
@endforeach
</select>
@else
@foreach($trabalho->participantes as $participante) @foreach($trabalho->participantes as $participante)
<div class="col-md-6"> <div class="col-md-6">
<label style="font-weight: bold;font-size: 18px">Plano: {{$participante->planoTrabalho->titulo}}</label> <label style="font-weight: bold;font-size: 18px">Plano: {{$participante->planoTrabalho->titulo}}</label>
...@@ -685,6 +708,7 @@ ...@@ -685,6 +708,7 @@
@endforeach @endforeach
</select> </select>
@endforeach @endforeach
@endif
<small id="emailHelp" class="form-text text-muted">Segure SHIFT do <small id="emailHelp" class="form-text text-muted">Segure SHIFT do
teclado para selecionar mais de um.</small> teclado para selecionar mais de um.</small>
</div> </div>
......
...@@ -21,18 +21,21 @@ ...@@ -21,18 +21,21 @@
<th scope="col" style="width:400px; text-align: center;">Projeto</th> <th scope="col" style="width:400px; text-align: center;">Projeto</th>
<th scope="col" style="width:400px; text-align: center;">Proponente</th> <th scope="col" style="width:400px; text-align: center;">Proponente</th>
<th scope="col" style="width:400px; text-align: center;">Título do Plano</th> <th scope="col" style="width:400px; text-align: center;">Título do Plano</th>
@if ($evento->numParticipantes != 0)
<th scope="col" style="width:200px; text-align: center;">Discente</th> <th scope="col" style="width:200px; text-align: center;">Discente</th>
<th scope="col" style="width:200px; text-align: center;">Relatório Parcial</th> @endif
<th scope="col" style="width:200px; text-align: center;">Relatório Final</th> <th scope="col" style="width:200px; text-align: center;">Relatório Parcial</th>
<th scope="col" style="width:200px; text-align: center;">Relatório Final</th>
</tr> </tr>
</thead> </thead>
@foreach($arquivos as $arquivo) @foreach($arquivos as $arquivo)
<tbody> <tbody>
<td style="text-align: center;" title="{{$arquivo->trabalho->titulo}}">{{$arquivo->trabalho->titulo}}</td> <td style="text-align: center;" title="{{$arquivo->trabalho->titulo}}">{{$arquivo->trabalho->titulo}}</td>
<td style="text-align: center;" title="{{$arquivo->trabalho->proponente->user->name}}">{{$arquivo->trabalho->proponente->user->name}}</td> <td style="text-align: center;" title="{{$arquivo->trabalho->proponente->user->name}}">{{$arquivo->trabalho->proponente->user->name}}</td>
<td style="text-align: center;" title="{{$arquivo->titulo}}">{{$arquivo->titulo}}</td> <td style="text-align: center;" title="{{$arquivo->titulo}}">{{$arquivo->titulo}}</td>
@if ($evento->numParticipantes != 0)
<td style="text-align: center;" title="{{$arquivo->participante->user->name}}" id="td-nomeAluno">{{$arquivo->participante->user->name}}</td> <td style="text-align: center;" title="{{$arquivo->participante->user->name}}" id="td-nomeAluno">{{$arquivo->participante->user->name}}</td>
@endif
<td style="text-align: center;"> <td style="text-align: center;">
@if((Auth::user()->proponentes != null) && ($arquivo->relatorioParcial == null) && @if((Auth::user()->proponentes != null) && ($arquivo->relatorioParcial == null) &&
($arquivo->trabalho->evento->dt_inicioRelatorioParcial <= $hoje) && ($hoje <= $arquivo->trabalho->evento->dt_fimRelatorioParcial)) ($arquivo->trabalho->evento->dt_inicioRelatorioParcial <= $hoje) && ($hoje <= $arquivo->trabalho->evento->dt_fimRelatorioParcial))
......
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