Unverified Commit 5e9bef09 authored by Yuri Resende's avatar Yuri Resende Committed by GitHub
Browse files

Merge pull request #11 from yuriresendematias/main

Implementando os relatórios
parents ae0021c6 7d486e98
...@@ -609,10 +609,65 @@ class PadController extends Controller ...@@ -609,10 +609,65 @@ class PadController extends Controller
return $ch; return $ch;
} }
public function relatorio($id){ public function relatorio($id){
$menu = MenuItemsAvaliador::REPORT; $user = Auth::user();
$pad = Pad::find($id); $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);
$professor->ch_ensino = $this->get_carga_horaria($avaliacoes['ensino']->get());
$professor->ch_pesquisa = $this->get_carga_horaria($avaliacoes['pesquisa']->get());
$professor->ch_extensao = $this->get_carga_horaria($avaliacoes['extensao']->get());
$professor->ch_gestao = $this->get_carga_horaria($avaliacoes['gestao']->get());
if( $professor->ch_ensino > 0 ||
$professor->ch_pesquisa > 0 ||
$professor->ch_extensao > 0 ||
$professor->ch_gestao > 0){
$professor->status = "Enviado";
}
}
return view('pad.relatorio.relatorio', [
'pad' => $pad,
'index_menu' => $index_menu,
'professores' => $professores]);
}
private function get_carga_horaria($avaliacoes){
$ch = 0;
foreach ($avaliacoes as $avaliacao){
$ch += $avaliacao->tarefa->ch_semanal;
}
return $ch;
} }
} }
...@@ -11,44 +11,97 @@ ...@@ -11,44 +11,97 @@
@endsection @endsection
@section('title', 'Relatórios') @section('title', 'Relatórios')
@section('body') @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"> <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3">
<h1 class="h2">Relatórios</h1> <h3>
</div> <i class="bi bi-exclamation-octagon-fill"></i>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3"> Relatório pad {{$pad->nome}}
<h3> </h3>
<i class="bi bi-exclamation-octagon-fill"></i> </div>
Relatório pad {{$pad->nome}} <div class="card d-flex">
</h3> <div class="card-head d-flex justify-content-center" style="background-color:#dfdfdf; padding-top:10px;">
</div> <h6 class="card-title" style="font-weight:bold;">PROFESSORES QUE NÃO ENVIARAM O PAD</h6>
</div>
<table class="table"> <div class="card-body">
<table class="table table-hover table-striped table-striped table-sm">
<thead> <thead>
<tr>
<th scope='col'></th>
<th scope='col'>Professor</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'>Curso</th>
<th scope='col'>Campus</th>
</tr>
</thead> </thead>
<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>
<td></td> <div class="card d-flex" style='margin-top:20px;'>
<td></td> <div class="card-head d-flex justify-content-center" style="background-color:#dfdfdf; padding-top:10px;">
<td></td> <h6 class="card-title" style="font-weight:bold;">RELAÇÃO DOS PROFESSORES QUE ENVIARAM O PAD</h6>
<td></td> </div>
<td></td> <div class="card-body">
<td></td>
<table class="table table-hover table-striped table-striped table-sm">
<thead>
<tr>
<th scope='col'></th>
<th scope='col'>Professor</th>
<th scope='col'>CH Ensino</th>
<th scope='col'>CH Pesquisa</th>
<th scope='col'>CH Extensão</th>
<th scope='col'>CH Gestão</th>
<th scope='col'>Campus</th>
</tr>
</thead>
<tbody> <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->ch_ensino}}</td>
<td>{{$professor->ch_pesquisa}}</td>
<td>{{$professor->ch_extensao}}</td>
<td>{{$professor->ch_gestao}}</td>
<td>{{$professor->campus}}</td>
</tr>
@php $index += 1 @endphp
@endif
@endforeach
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
@endsection @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