Commit b82be112 authored by Gabriel-31415's avatar Gabriel-31415
Browse files

add separacao de editar no user admin

parent f22ae55f
...@@ -67,11 +67,10 @@ class AdministradorController extends Controller ...@@ -67,11 +67,10 @@ class AdministradorController extends Controller
public function showProjetos(Request $request){ public function showProjetos(Request $request){
$evento = Evento::where('id', $request->evento_id)->first(); $evento = Evento::where('id', $request->evento_id)->first();
$editais = Evento::with('trabalhos')->get();
$projetos = Trabalho::all(); $projetos = Trabalho::all();
return view('administrador.listaProjetos', compact('projetos', 'evento','editais'));
return view('administrador.listaProjetos')->with(['projetos' => $projetos, 'evento' => $evento]);
} }
public function visualizarParecer(Request $request){ public function visualizarParecer(Request $request){
......
...@@ -321,15 +321,16 @@ class TrabalhoController extends Controller ...@@ -321,15 +321,16 @@ class TrabalhoController extends Controller
public function show($id) public function show($id)
{ {
$projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first(); // $projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first();
if(Auth::user()->tipo == 'administrador'){ // if(Auth::user()->tipo == 'administrador'){
$projeto = Trabalho::find($id); // $projeto = Trabalho::find($id);
} // }
if(!$projeto){ // if(!$projeto){
// $projeto = Auth::user()->coordenadorComissao->trabalho()->where('id', $id)->first(); // // $projeto = Auth::user()->coordenadorComissao->trabalho()->where('id', $id)->first();
return back()->withErrors(['Proposta não encontrada!']); // return back()->withErrors(['Proposta não encontrada!']);
} // }
$projeto = Trabalho::find($id);
$edital = Evento::find($projeto->evento_id); $edital = Evento::find($projeto->evento_id);
$grandeAreas = GrandeArea::all(); $grandeAreas = GrandeArea::all();
$areas = Area::all(); $areas = Area::all();
......
...@@ -19,7 +19,23 @@ ...@@ -19,7 +19,23 @@
</div> </div>
@endif @endif
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@foreach ($editais as $edital)
<div class="accordion" id="accordionExample">
<div class="card">
<div class="card-header" id="headingOne">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapse{{ $edital->id }}" aria-expanded="true" aria-controls="collapse{{ $edital->id }}">
{{ $edital->nome }}
</button>
</h2>
</div>
<div id="collapse{{ $edital->id }}" class="collapse " aria-labelledby="headingOne" data-parent="#accordionExample">
<div class="card-body">
<table class="table table-bordered"> <table class="table table-bordered">
<thead> <thead>
<tr> <tr>
...@@ -32,7 +48,8 @@ ...@@ -32,7 +48,8 @@
</tr> </tr>
</thead> </thead>
<tbody id="eventos"> <tbody id="eventos">
@foreach ($projetos as $projeto)
@foreach ($edital->trabalhos as $projeto)
<tr> <tr>
<td> <td>
<a href="{{ route('trabalho.show',['id'=>$projeto->id]) }}" class="visualizarEvento"> <a href="{{ route('trabalho.show',['id'=>$projeto->id]) }}" class="visualizarEvento">
...@@ -52,6 +69,17 @@ ...@@ -52,6 +69,17 @@
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div>
</div>
</div>
</div>
@endforeach
</div>
<div class="col-md-12">
</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