diff --git a/app/Http/Controllers/ArquivoController.php b/app/Http/Controllers/ArquivoController.php index 8ae09117bc7df3e9112d104bdded5351e131007e..fa9d6b874931b5e716de0ab1251c69877a6303cd 100644 --- a/app/Http/Controllers/ArquivoController.php +++ b/app/Http/Controllers/ArquivoController.php @@ -86,6 +86,10 @@ class ArquivoController extends Controller public function baixarPlano($id) { $arquivo = Arquivo::find($id); - return Storage::download($arquivo->nome); + + if (Storage::disk()->exists($arquivo->nome)) { + return Storage::download($arquivo->nome); + } + return abort(404); } } diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index d7cdb3396668ab44daa5778d6560106c1f8ea38d..001d60657d0ba9ffe1e8f259a862557c90b047d2 100644 --- a/app/Http/Controllers/TrabalhoController.php +++ b/app/Http/Controllers/TrabalhoController.php @@ -266,9 +266,28 @@ class TrabalhoController extends Controller * @param \App\Trabalho $trabalho * @return \Illuminate\Http\Response */ - public function show(Trabalho $trabalho) + public function show($id) { - // + $projeto = Trabalho::find($id); + $edital = Evento::find($projeto->evento_id); + $grandeAreas = GrandeArea::orderBy('nome')->get(); + $areas = Area::orderBy('nome')->get(); + $subareas = Subarea::orderBy('nome')->get(); + $funcaoParticipantes = FuncaoParticipantes::all(); + $participantes = Participante::where('trabalho_id', $id)->get(); + $participantesUsersIds = Participante::where('trabalho_id', $id)->select('user_id')->get(); + $users = User::whereIn('id', $participantesUsersIds)->get(); + $arquivos = Arquivo::where('trabalhoId', $id)->get(); + + return view('projeto.visualizar')->with(['projeto' => $projeto, + 'grandeAreas' => $grandeAreas, + 'areas' => $areas, + 'subAreas' => $subareas, + 'edital' => $edital, + 'users' => $users, + 'funcaoParticipantes' => $funcaoParticipantes, + 'participantes' => $participantes, + 'arquivos' => $arquivos,]); } /** @@ -650,26 +669,45 @@ class TrabalhoController extends Controller public function baixarAnexoProjeto($id) { $projeto = Trabalho::find($id); - return Storage::download($projeto->anexoProjeto); + if (Storage::disk()->exists($projeto->anexoProjeto)) { + return Storage::download($projeto->anexoProjeto); + } + return abort(404); } public function baixarAnexoConsu($id) { $projeto = Trabalho::find($id); - return Storage::download($projeto->anexoDecisaoCONSU); + + if (Storage::disk()->exists($projeto->anexoDecisaoCONSU)) { + return Storage::download($projeto->anexoDecisaoCONSU); + } + return abort(404); } public function baixarAnexoComite($id) { $projeto = Trabalho::find($id); - return Storage::download($projeto->anexoAutorizacaoComiteEtica); + + if (Storage::disk()->exists($projeto->anexoAutorizacaoComiteEtica)) { + return Storage::download($projeto->anexoAutorizacaoComiteEtica); + } + return abort(404); } public function baixarAnexoLattes($id) { $projeto = Trabalho::find($id); - return Storage::download($projeto->anexoLattesCoordenador); + + if (Storage::disk()->exists($projeto->anexoLattesCoordenador)) { + return Storage::download($projeto->anexoLattesCoordenador); + } + return abort(404); } public function baixarAnexoPlanilha($id) { $projeto = Trabalho::find($id); - return Storage::download($projeto->anexoPlanilhaPontuacao); + + if (Storage::disk()->exists($projeto->anexoPlanilhaPontuacao)) { + return Storage::download($projeto->anexoPlanilhaPontuacao); + } + return abort(404); } } diff --git a/resources/views/evento/submeterTrabalho.blade.php b/resources/views/evento/submeterTrabalho.blade.php index 8e7a9316f3bdd38950748e280677ac25eb3db3fc..36a0b6a2aa7506cbf01eebb9e807d9a759033475 100644 --- a/resources/views/evento/submeterTrabalho.blade.php +++ b/resources/views/evento/submeterTrabalho.blade.php @@ -564,6 +564,8 @@ $.each(dados, function(i, obj){ option += ''; }) + } else { + var option = ""; } $('#area').html(option).show(); }) @@ -578,6 +580,8 @@ $.each(dados, function(i, obj){ option += ''; }) + } else { + var option = ""; } $('#subArea').html(option).show(); }) diff --git a/resources/views/projeto/editar.blade.php b/resources/views/projeto/editar.blade.php index c10a3c60dbf443c57689a50dfc3d7083f2151468..21dfb707b164c3b0a73435452defb817b20a57b7 100644 --- a/resources/views/projeto/editar.blade.php +++ b/resources/views/projeto/editar.blade.php @@ -31,7 +31,7 @@
+ + + {{-- Nome do Projeto --}} +