Commit f0a74ad5 authored by José Rômulo's avatar José Rômulo
Browse files

Correção desatribuir avaliador

parent 0a213633
......@@ -450,6 +450,12 @@ class AdministradorController extends Controller
$aval = Avaliador::where('id', $request->avaliador_id)->first();
$trabalho = Trabalho::where('id', $request->trabalho_id)->first();
$aval->trabalhos()->detach($trabalho);
if($trabalho->status === 'avaliado'){
$trabalho->status = 'submetido';
$trabalho->save();
}
$aval->save();
return redirect()->back();
......
......@@ -49,52 +49,52 @@
</thead>
<tbody id="projetos">
@foreach ($trabalhos as $trabalho)
<tr>
<td>{{ $trabalho->titulo}}</td>
<td>{{ App\Area::find($trabalho->area_id)->nome}}</td>
<td>{{ $trabalho->proponente->user->name }}</td>
<td style="text-align:center">
<button type="button" class="btn btn-primary" value="{{ $trabalho->id }}" id="atribuir1" data-toggle="modal" data-target="#exampleModalCenter{{ $trabalho->id }}">
Atribuir
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter{{ $trabalho->id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content modal-submeta">
<div class="modal-header modal-header-submeta">
<h5 class="modal-title titulo-table" id="exampleModalLongTitle">Selecione o(s) avaliador(es)</h5>
<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">
<form action="{{ route('admin.atribuicao.projeto') }}" method="POST">
@csrf
<input type="hidden" name="trabalho_id" value="{{ $trabalho->id }}">
<input type="hidden" name="evento_id" value="{{ $evento->id }}">
<div class="form-group">
<label for="exampleFormControlSelect2">Selecione o(s) avaliador(es) para esse projeto</label>
<select name="avaliadores_id[]" multiple class="form-control" id="exampleFormControlSelect2">
@foreach ($trabalho->aval as $avaliador)
<option value="{{ $avaliador->id }}" > {{ $avaliador->user->name }} ({{$avaliador->area->nome ?? 'Indefinida'}}) </option>
@endforeach
</select>
<small id="emailHelp" class="form-text text-muted">Segure SHIFT do teclado para selecionar mais de um.</small>
</div>
<div>
<button type="submit" class="btn btn-info" style="width: 100%">Atribuir</button>
</div>
</form>
<tr>
<td style="max-width:100px; overflow-x:scroll; text-overflow:ellipsis">{{ $trabalho->titulo}}</td>
<td>{{ App\Area::find($trabalho->area_id)->nome}}</td>
<td>{{ $trabalho->proponente->user->name }}</td>
<td style="text-align:center">
<button type="button" class="btn btn-primary" value="{{ $trabalho->id }}" id="atribuir1" data-toggle="modal" data-target="#exampleModalCenter{{ $trabalho->id }}">
Atribuir
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter{{ $trabalho->id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content modal-submeta">
<div class="modal-header modal-header-submeta">
<h5 class="modal-title titulo-table" id="exampleModalLongTitle">Selecione o(s) avaliador(es)</h5>
<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">
<form action="{{ route('admin.atribuicao.projeto') }}" method="POST">
@csrf
<input type="hidden" name="trabalho_id" value="{{ $trabalho->id }}">
<input type="hidden" name="evento_id" value="{{ $evento->id }}">
<div class="form-group">
<label for="exampleFormControlSelect2">Selecione o(s) avaliador(es) para esse projeto</label>
<select name="avaliadores_id[]" multiple class="form-control" id="exampleFormControlSelect2">
@foreach ($trabalho->aval as $avaliador)
<option value="{{ $avaliador->id }}" > {{ $avaliador->user->name }} ({{$avaliador->area->nome ?? 'Indefinida'}}) </option>
@endforeach
</select>
<small id="emailHelp" class="form-text text-muted">Segure SHIFT do teclado para selecionar mais de um.</small>
</div>
<div>
<button type="submit" class="btn btn-info" style="width: 100%">Atribuir</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
</td>
</tr>
@endforeach
</tbody>
</table>
......@@ -127,7 +127,7 @@
<tr>
<td>{{ $avaliador->user->name }}</td>
<td>{{ $avaliador->user->email }}</td>
<td>{{ $trabalho->titulo }}</td>
<td style="max-width:100px; overflow-x:hidden; text-overflow:ellipsis">{{ $trabalho->titulo }}</td>
{{-- <td>{{ $contador }} / {{ $avaliador->trabalhos->where('evento_id', $evento->id)->count() }}</td> --}}
<td>@if($trabalho->pivot->parecer == null) Pendente @else Avaliado @endif</td>
<td>
......@@ -140,11 +140,11 @@
<a href="{{ route('admin.visualizarParecer', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}" class="dropdown-item text-center">
Vizualizar Parecer
</a>
@else
@endif
<a href="{{ route('admin.removerProjAval', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}" class="dropdown-item text-center">
Desatribuir Avaliador
</a>
@endif
</div>
</div>
</td>
......
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