Commit 9345e016 authored by Yuri Resende's avatar Yuri Resende
Browse files

Relatório dos professores que não enviaram o PAD

parent 494580dc
......@@ -609,10 +609,54 @@ class PadController extends Controller
return $ch;
}
public function relatorio($id){
$menu = MenuItemsAvaliador::REPORT;
$user = Auth::user();
$pad = Pad::find($id);
return view('pad.relatorio.relatorio', ['pad' => $pad, 'index_menu' => $menu]);
$index_menu = MenuItemsAvaliador::REPORT;
$professores = User::join('user_pad', 'user_pad.user_id', '=', 'users.id')
->join('pad', 'user_pad.pad_id', '=', 'pad.id')
->where(function ($query) use ($user, $id) {
$query->where('pad.status', '=', Status::ATIVO);
$query->where('users.campus_id', '=', $user->campus_id);
$query->where('users.id', '!=', $user->id);
$query->where('pad.id', '=', $id);
})
->select('users.id', 'users.name', 'users.curso_id', 'users.campus_id')
->orderBy('name')
->get();
//Informando se o PAD foi enviado ou não
$avaliador_pad = AvaliadorPad::where(function ($query) use ($pad, $user) {
$query->where('user_id', '=', $user->id);
$query->where('pad_id', '=', $pad->id);
})->first();
foreach ($professores as $professor){
$professor->status = "Pendente";
$userPad = $professor->userPads()->where('pad_id', '=', $pad->id)->first();
$avaliacoes = $this->get_avaliacoes($userPad, $avaliador_pad);
$avaliacoes_ensino = $avaliacoes['ensino']->get();
$avaliacoes_pesquisa = $avaliacoes['pesquisa']->get();
$avaliacoes_extensao = $avaliacoes['extensao']->get();
$avaliacoes_gestao = $avaliacoes['gestao']->get();
if( $avaliacoes_ensino->all() != null ||
$avaliacoes_pesquisa->all() != null ||
$avaliacoes_extensao->all() != null ||
$avaliacoes_gestao->all() != null){
$professor->status = "Enviado";
}
}
// dd($professores[1]->status);
return view('pad.relatorio.relatorio', [
'pad' => $pad,
'index_menu' => $index_menu,
'professores' => $professores]);
}
}
......@@ -11,44 +11,53 @@
@endsection
@section('title', 'Relatórios')
@section('body')
<div class="tab-content">
<div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Relatórios</h1>
</div>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3">
<h3>
<i class="bi bi-exclamation-octagon-fill"></i>
Relatório pad {{$pad->nome}}
</h3>
</div>
<table class="table">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3">
<h3>
<i class="bi bi-exclamation-octagon-fill"></i>
Relatório pad {{$pad->nome}}
</h3>
</div>
<div class="card d-flex">
<div class="card-head d-flex justify-content-center" style="background-color:#dfdfdf; padding-top:10px;">
<h6 class="card-title" style="font-weight:bold;">PROFESSORES QUE NÃO ENVIARAM O PAD</h6>
</div>
<div class="card-body">
<table class="table table-hover table-striped table-striped">
<thead>
<tr>
<th scope='col'></th>
<th scope='col'>Professor</th>
<th scope='col'>Ch Ensino</th>
<th scope='col'>Ch Pesqiosa</th>
<th scope='col'>Ch Extensão</th>
<th scope='col'>Ch Gestão</th>
<th scope='col'>Curso</th>
<th scope='col'>Campus</th>
</tr>
</thead>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<tbody>
@php $index = 1; @endphp
@foreach($professores as $professor)
@if($professor->status == "Pendente")
<tr scope='row'>
<td>{{$index}}</td>
<td>{{$professor->name}}</td>
<td>{{$professor->curso}}</td>
<td>{{$professor->campus}}</td>
</tr>
@php $index += 1 @endphp
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection
\ No newline at end of file
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