Commit 0c0a5479 authored by Guilherme Silva's avatar Guilherme Silva
Browse files

Montagem de ranking na página de resultados

parent 038a1251
...@@ -130,6 +130,24 @@ class AdministradorController extends Controller ...@@ -130,6 +130,24 @@ class AdministradorController extends Controller
public function showResultados(Request $request){ public function showResultados(Request $request){
$evento = Evento::where('id', $request->evento_id)->first(); $evento = Evento::where('id', $request->evento_id)->first();
$trabalhos = $evento->trabalhos; $trabalhos = $evento->trabalhos;
//foreach($trabalho->avaliadors as $avaliador)
foreach($trabalhos as $trabalho){
$trabalho->pontuacao = 0;
foreach($trabalho->avaliadors as $avaliador){
if($avaliador->tipo == "Interno"){
$parecerInterno = ParecerInterno::where([['avaliador_id',$avaliador->id],['trabalho_id',$trabalho->id]])->first();
if($parecerInterno != null){
$trabalho->pontuacao += $parecerInterno->statusAnexoPlanilhaPontuacao;
}
}
}
}
$trabalhos = $trabalhos->sort(function ($item, $next) {
return $item->pontuacao >= $next->pontuacao ? -1 : 1;
});
$trabalhos = $this->paginate($trabalhos)
->withPath('/usuarios/showResultados?evento_id='.$evento->id);;
return view('administrador.resultadosProjetos')->with(['evento' => $evento, 'trabalhos' => $trabalhos]); return view('administrador.resultadosProjetos')->with(['evento' => $evento, 'trabalhos' => $trabalhos]);
} }
......
...@@ -33,17 +33,21 @@ ...@@ -33,17 +33,21 @@
<table class="table table-bordered" style="display: block; white-space: nowrap; border-radius:10px; margin-bottom:0px"> <table class="table table-bordered" style="display: block; white-space: nowrap; border-radius:10px; margin-bottom:0px">
<thead> <thead>
<tr> <tr>
<th scope="col">Pontuação</th>
<th scope="col" style="width: 100%;">Nome do projeto</th> <th scope="col" style="width: 100%;">Nome do projeto</th>
<th scope="col">Proponente</th> <th scope="col">Proponente</th>
<th scope="col">Área</th> <th scope="col">Área</th>
<th scope="col">N. Planos</th> <th scope="col">N. Planos</th>
<th scope="col">Avaliador Externo</th> <th scope="col">Avaliador</th>
<th scope="col">Status</th> <th scope="col">Status</th>
<th scope="col">Bolsas</th>
</tr> </tr>
</thead> </thead>
<tbody id="projetos"> <tbody id="projetos">
@foreach($trabalhos as $trabalho) @foreach($trabalhos as $trabalho)
@if($trabalho->status == 'aprovado')
<tr> <tr>
<td>{{$trabalho->pontuacao}}</td>
<td style="max-width:100px; overflow-x:hidden; text-overflow:ellipsis"> <td style="max-width:100px; overflow-x:hidden; text-overflow:ellipsis">
{{$trabalho->titulo}} {{$trabalho->titulo}}
</td> </td>
...@@ -61,22 +65,138 @@ ...@@ -61,22 +65,138 @@
@foreach($trabalho->avaliadors as $avaliador) @foreach($trabalho->avaliadors as $avaliador)
{{$avaliador->user->name}}<br> {{$avaliador->user->name}}<br>
@endforeach @endforeach
@else
Sem Atribuição
@endif @endif
</td> </td>
@if($trabalho->avaliadors->count() > 0) @if($trabalho->avaliadors->count() > 0)
<td> <td>
@foreach($trabalho->avaliadors as $avaliador) @foreach($trabalho->avaliadors as $avaliador)
@if($avaliador->tipo == "Externo")
{{$avaliador->pivot->recomendacao}}<br> {{$avaliador->pivot->recomendacao}}<br>
@php
$parecer = App\ParecerInterno::where([['avaliador_id',$avaliador->id],['trabalho_id',$trabalho->id]])->first();
@endphp
@if($parecer != null && $parecer->statusParecer !=null){{$parecer->statusParecer}} @else Pendente @endif
@endif
@endforeach @endforeach
</td> </td>
@else
<td>Pendente</td>
@endif @endif
<td>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalConfirmTrab{{$trabalho->id}}" >
Definir
</button>
</td>
</tr> </tr>
@endif
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="row justify-content-center" >
<div class="col-md-12">
<br>
{{ $trabalhos->links() }}
</div>
</div>
</div> </div>
{{--Janelas--}}
@foreach($trabalhos as $trabalho)
<div class="modal fade" id="modalConfirmTrab{{$trabalho->id}}" tabindex="-1" role="dialog"
aria-labelledby="modalConfirmLabel" aria-hidden="true">
<div class="modal-dialog modal-md modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="modalConfirmLabel" align="center" title="Participantes do {{$trabalho->titulo}}">
Projeto {{$trabalho->titulo}}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="color: rgb(182, 182, 182)">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
@foreach($trabalho->participantes as $participante)
<div class="row modal-header-submeta">
<div class="col-sm-8">
<p style="font-size: 22px">Discente: {{$participante->user->name}}</p>
</div>
<div class="col-sm-4" align="left" style="padding-left: 0px">
<button type="button" class="btn btn-primary" data-dismiss="modal" data-toggle="modal" data-target="#modalConfirm{{$participante->id}}" onclick="myFunction({{$trabalho->id}})">
@if($participante->tipoBolsa==null)
Não Definida
@elseif($participante->tipoBolsa == "Voluntario")
Voluntário
@else
{{$participante->tipoBolsa}}
@endif
</button>
</div>
</div>
<br>
@endforeach
</div>
</div>
</div>
</div>
@foreach($trabalho->participantes as $participante)
{{-- Janela de alocação de bolsa--}}
<div class="modal fade" id="modalConfirm{{$participante->id}}" tabindex="-1" role="dialog"
aria-labelledby="modalConfirmLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="modalConfirmLabel" align="center">
Confirmar alteração do tipo de bolsa ?</h4>
</div>
@if($participante->tipoBolsa!=null)
<div class="modal-body">
<h5 class="modal-title" id="modalConfirmLabel" align="center">
@if($participante->tipoBolsa=='Voluntario')
O discente {{$participante->user->name}} será definido como bolsista
@else
O discente {{$participante->user->name}} será definido como voluntário
@endif
</h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">
Não
</button>
<a type="button" href="{{ route('bolsa.alterar',['id'=>$participante->id, 'tipo'=>1]) }}" id="btnSubmit" class="btn btn-info">
Sim
</a>
</div>
@else
<div class="modal-body">
<div class="row">
<div class="col-6">
<a style="float: right;" type="button" href="{{ route('bolsa.alterar',['id'=>$participante->id, 'tipo'=>1]) }}" id="btnSubmit" class="btn btn-info">
Voluntário
</a>
</div>
<div class="col-6">
<a style="float: left;" type="button" href="{{ route('bolsa.alterar',['id'=>$participante->id, 'tipo'=>2]) }}" id="btnSubmit" class="btn btn-info">
Bolsista
</a>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">
Cancelar
</button>
</div>
@endif
</div>
</div>
</div>
@endforeach
@endforeach
@endsection @endsection
...@@ -99,5 +219,9 @@ ...@@ -99,5 +219,9 @@
} }
} }
} }
function myFunction(data){
document.getElementById('modalConfirmTrab'+data).modal('hide');
}
</script> </script>
@endsection @endsection
\ No newline at end of file
...@@ -210,7 +210,7 @@ Route::prefix('usuarios')->name('admin.')->group(function(){ ...@@ -210,7 +210,7 @@ Route::prefix('usuarios')->name('admin.')->group(function(){
Route::get('/analisarProjetos', 'AdministradorController@analisar' )->name('analisar'); Route::get('/analisarProjetos', 'AdministradorController@analisar' )->name('analisar');
Route::get('/analisarProposta', 'AdministradorController@analisarProposta' )->name('analisarProposta'); Route::get('/analisarProposta', 'AdministradorController@analisarProposta' )->name('analisarProposta');
Route::get('/showProjetos', 'AdministradorController@showProjetos' )->name('showProjetos'); Route::get('/showProjetos', 'AdministradorController@showProjetos' )->name('showProjetos');
Route::get('/showResultados', 'AdministradorController@showResultados' )->name('showResultados'); Route::get('/showResultados', 'AdministradorController@showResultados' )->name('showResultados')->middleware(['auth', 'verified']);
}); });
Route::prefix('naturezas')->group(function(){ Route::prefix('naturezas')->group(function(){
......
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