diff --git a/app/Http/Controllers/AdministradorController.php b/app/Http/Controllers/AdministradorController.php index 489da7e916d3e39921578b92c67180e5d39302d9..7fcb830bc81413ab977fcd38e1d5b17d2dedd6b0 100644 --- a/app/Http/Controllers/AdministradorController.php +++ b/app/Http/Controllers/AdministradorController.php @@ -67,11 +67,10 @@ class AdministradorController extends Controller public function showProjetos(Request $request){ $evento = Evento::where('id', $request->evento_id)->first(); + $editais = Evento::with('trabalhos')->get(); $projetos = Trabalho::all(); - - - return view('administrador.listaProjetos')->with(['projetos' => $projetos, 'evento' => $evento]); + return view('administrador.listaProjetos', compact('projetos', 'evento','editais')); } public function visualizarParecer(Request $request){ diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index e86b8b8e33247dc5eb5105e8d4150547456035b6..8febf68daa7d90e8317c04709a39df300080d4bf 100644 --- a/app/Http/Controllers/TrabalhoController.php +++ b/app/Http/Controllers/TrabalhoController.php @@ -321,15 +321,16 @@ class TrabalhoController extends Controller public function show($id) { - $projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first(); - if(Auth::user()->tipo == 'administrador'){ - $projeto = Trabalho::find($id); - } - if(!$projeto){ - // $projeto = Auth::user()->coordenadorComissao->trabalho()->where('id', $id)->first(); + // $projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first(); + // if(Auth::user()->tipo == 'administrador'){ + // $projeto = Trabalho::find($id); + // } + // if(!$projeto){ + // // $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); $grandeAreas = GrandeArea::all(); $areas = Area::all(); diff --git a/resources/views/administrador/listaProjetos.blade.php b/resources/views/administrador/listaProjetos.blade.php index 1c7724da2c23baed494fc49d35b0b50862e26032..1c0309fc00f15482f174436e3127ac9f9cb752ad 100644 --- a/resources/views/administrador/listaProjetos.blade.php +++ b/resources/views/administrador/listaProjetos.blade.php @@ -19,39 +19,67 @@ </div> @endif <div class="row"> + + <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"> + <thead> + <tr> + <th scope="col">Nome da Proposta</th> + <th scope="col">Autor</th> + <th scope="col">Email</th> + <th scope="col">Data de Criação</th> + <th scope="col">Status</th> + <th scope="col">Opção</th> + </tr> + </thead> + <tbody id="eventos"> + + @foreach ($edital->trabalhos as $projeto) + <tr> + <td> + <a href="{{ route('trabalho.show',['id'=>$projeto->id]) }}" class="visualizarEvento"> + {{ $projeto->titulo }} + </a> + </td> + <td>{{ $projeto->proponente->user->name }}</td> + <td>{{ $projeto->proponente->user->email }}</td> + <td>{{ date('d/m/Y', strtotime($projeto->created_at)) }}</td> + + <td>{{ $projeto->status }}</td> + <td> + + </td> + </tr> + + @endforeach + </tbody> + </table> + + </div> + </div> + </div> + + </div> + @endforeach + </div> + <div class="col-md-12"> - <table class="table table-bordered"> - <thead> - <tr> - <th scope="col">Nome da Proposta</th> - <th scope="col">Autor</th> - <th scope="col">Email</th> - <th scope="col">Data de Criação</th> - <th scope="col">Status</th> - <th scope="col">Opção</th> - </tr> - </thead> - <tbody id="eventos"> - @foreach ($projetos as $projeto) - <tr> - <td> - <a href="{{ route('trabalho.show',['id'=>$projeto->id]) }}" class="visualizarEvento"> - {{ $projeto->titulo }} - </a> - </td> - <td>{{ $projeto->proponente->user->name }}</td> - <td>{{ $projeto->proponente->user->email }}</td> - <td>{{ date('d/m/Y', strtotime($projeto->created_at)) }}</td> - - <td>{{ $projeto->status }}</td> - <td> - - </td> - </tr> - - @endforeach - </tbody> - </table> + </div> </div> @endsection \ No newline at end of file