Commit bb819dac authored by Yuri Resende's avatar Yuri Resende
Browse files

Adicionando a carga horária semanal na listagem de professores

parent 547b14c9
......@@ -326,10 +326,16 @@ class PadController extends Controller
$avaliacoes_extensao = $avaliacoes['extensao'];
$avaliacoes_gestao = $avaliacoes['gestao'];
if($avaliacoes_ensino->all() != null){
$professor->status = "Enviado";
if( $avaliacoes_ensino->all() != null ||
$avaliacoes_pesquisa->all() != null ||
$avaliacoes_extensao->all() != null ||
$avaliacoes_gestao->all() != null){
$professor->status = "Enviado";
}
$professor->ch = $this->get_carga_horaria_total($avaliacoes);
}
return view("pad.avaliacao.professores", compact('professores', 'pad', 'index_menu'));
......@@ -563,4 +569,39 @@ class PadController extends Controller
];
}
private function get_carga_horaria_total($avaliacoes)
{
$ch = 0;
$avaliacoes_ensino = $avaliacoes['ensino'];
$avaliacoes_pesquisa = $avaliacoes['pesquisa'];
$avaliacoes_extensao = $avaliacoes['extensao'];
$avaliacoes_gestao = $avaliacoes['gestao'];
foreach($avaliacoes_ensino->all() as $avaliacao){
foreach($avaliacao->tarefa()->get() as $tarefa){
$ch += $tarefa->ch_semanal;
}
}
foreach($avaliacoes_pesquisa->all() as $avaliacao){
foreach($avaliacao->tarefa()->get() as $tarefa){
$ch += $tarefa->ch_semanal;
}
}
foreach($avaliacoes_extensao->all() as $avaliacao){
foreach($avaliacao->tarefa()->get() as $tarefa){
$ch += $tarefa->ch_semanal;
}
}
foreach($avaliacoes_gestao->all() as $avaliacao){
foreach($avaliacao->tarefa()->get() as $tarefa){
$ch += $tarefa->ch_semanal;
}
}
return $ch;
}
}
......@@ -24,7 +24,7 @@
<tr>
<th scope="col">Professor</th>
<th scope="col">Status</th>
<th scope="col">CH</th>
<th scope="col">Opções</th>
</tr>
</thead>
......@@ -38,6 +38,7 @@
@else
<td style="color:green;">{{$professor->status}}</td>
@endif
<td>@if($professor->ch > 0) {{$professor->ch}}H @endif</td>
<td>
@include('components.buttons.btn-avaliar', [
......
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