From 8e9f859bcdfab7c0e03f1c70ea14af441113565d Mon Sep 17 00:00:00 2001 From: carlos Date: Thu, 11 Jun 2020 17:37:46 -0300 Subject: [PATCH] visualizar projeto --- app/Http/Controllers/ArquivoController.php | 6 +- app/Http/Controllers/TrabalhoController.php | 52 +++- .../views/evento/submeterTrabalho.blade.php | 4 + resources/views/projeto/editar.blade.php | 64 +++-- resources/views/projeto/index.blade.php | 6 +- resources/views/projeto/visualizar.blade.php | 254 ++++++++++++++++++ routes/web.php | 3 +- 7 files changed, 361 insertions(+), 28 deletions(-) create mode 100644 resources/views/projeto/visualizar.blade.php diff --git a/app/Http/Controllers/ArquivoController.php b/app/Http/Controllers/ArquivoController.php index 8ae0911..fa9d6b8 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 d7cdb33..001d606 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 8e7a931..36a0b6a 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 c10a3c6..21dfb70 100644 --- a/resources/views/projeto/editar.blade.php +++ b/resources/views/projeto/editar.blade.php @@ -31,7 +31,7 @@
- @foreach($grandeAreas as $grandeArea) @if($grandeArea->id === $projeto->grande_area_id) @@ -50,7 +50,7 @@
- @foreach($areas as $area) @if($area->id === $projeto->area_id) @@ -418,10 +418,10 @@ }); // Exibir modalidade de acordo com a área - $("#area").change(function() { - console.log($(this).val()); - addModalidade($(this).val()); - }); + // $("#area").change(function() { + // console.log($(this).val()); + // addModalidade($(this).val()); + // }); $(document).on('click', '.delete', function() { if (qtdParticipantes > 1) { qtdParticipantes--; @@ -457,16 +457,16 @@ }); // Remover Coautor - function addModalidade(areaId) { - console.log(modalidades) - $("#modalidade").empty(); - for (let i = 0; i < modalidades.length; i++) { - if (modalidades[i].areaId == areaId) { - console.log(modalidades[i]); - $("#modalidade").append("") - } - } - } + // function addModalidade(areaId) { + // console.log(modalidades) + // $("#modalidade").empty(); + // for (let i = 0; i < modalidades.length; i++) { + // if (modalidades[i].areaId == areaId) { + // console.log(modalidades[i]); + // $("#modalidade").append("") + // } + // } + // } function montarLinhaInput() { @@ -577,5 +577,37 @@ // "
"+ // "
"; // } + + function areas() { + var grandeArea = $('#grandeArea').val(); + $.getJSON("{{ config('app.url') }}/naturezas/areas/" + grandeArea, + function (dados){ + if (dados.length > 0){ + var option = ""; + $.each(dados, function(i, obj){ + option += ''; + }) + } else { + var option = ""; + } + $('#area').html(option).show(); + }) + } + + function subareas() { + var area = $('#area').val(); + $.getJSON("{{ config('app.url') }}/naturezas/subarea/" + area, + function (dados){ + if (dados.length > 0){ + var option = ""; + $.each(dados, function(i, obj){ + option += ''; + }) + } else { + var option = ""; + } + $('#subArea').html(option).show(); + }) + } @endsection \ No newline at end of file diff --git a/resources/views/projeto/index.blade.php b/resources/views/projeto/index.blade.php index 18a4e60..bdc7e6b 100644 --- a/resources/views/projeto/index.blade.php +++ b/resources/views/projeto/index.blade.php @@ -50,9 +50,9 @@ Editar projeto - {{-- - Adicionar participantes - --}} + + Visualizar projeto + Recorrer diff --git a/resources/views/projeto/visualizar.blade.php b/resources/views/projeto/visualizar.blade.php new file mode 100644 index 0000000..17d7a7d --- /dev/null +++ b/resources/views/projeto/visualizar.blade.php @@ -0,0 +1,254 @@ +@extends('layouts.app') + +@section('content') +
+ +
+
+
+
+

Dados do Projeto

+

+ + + {{-- Nome do Projeto --}} +

+
+ + + + @error('nomeTrabalho') + + {{ $message }} + + @enderror +
+
+ + {{-- Grande Area --}} +
+
+ + + + @error('grandeArea') + + {{ $message }} + + @enderror +
+
+ + + + @error('area') + + {{ $message }} + + @enderror +
+
+ + + + @error('subArea') + + {{ $message }} + + @enderror +
+
+ + + + + + + + + +
+

Coordenador

+ + {{-- Coordenador --}} +
+ +
+ + +
+
+ + user()->proponentes->linkLattes != null) + value="{{ Auth()->user()->proponentes->linkLattes }}" + @else + value="" + @endif disabled> + + @error('linkLattesEstudante') + + {{ $message }} + + @enderror +
+
+ + + + @error('pontuacaoPlanilha') + + {{ $message }} + + @enderror +
+
+ + + + @error('linkGrupo') + + {{ $message }} + + @enderror +
+ +
+ +
+

Anexos

+ + {{-- Anexo do Projeto --}} +
+ {{-- Arquivo --}} + +
+ +
+ +

Participantes

+ + {{-- Participantes --}} +
+
+
+ @foreach($participantes as $participante) + @foreach($users as $user) + @if($participante->user_id === $user->id) +
+
+
+
+ + + @error('nomeParticipante') + + {{ $message }} + + @enderror +
+
+ + + @error('emailParticipante') + + {{ $message }} + + @enderror +
+
+ + +
+
+ @foreach ($arquivos as $arquivo) + @if($arquivo->participanteId === $participante->id) + Plano de trabalho atual + @endif + @endforeach +
+ @endif + @endforeach + @endforeach +
+ +
+
+ +

+
+
+
+
+ +
+@endsection + +@section('javascript') + +@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 5e611cd..44d594d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -91,9 +91,10 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){ Route::post( '/trabalho/novaVersao', 'TrabalhoController@novaVersao' )->name('trabalho.novaVersao'); Route::post( '/trabalho/criar', 'TrabalhoController@store' )->name('trabalho.store'); Route::get( '/edital/{id}/projetos', 'TrabalhoController@projetosDoEdital' )->name('projetos.edital'); + Route::get( '/projeto/{id}/visualizar', 'TrabalhoController@show' )->name('trabalho.show'); Route::get( '/projeto/{id}/editar', 'TrabalhoController@edit' )->name('trabalho.editar'); Route::post( '/projeto/{id}/atualizar', 'TrabalhoController@update' )->name('trabalho.update'); - Route::get( '/projeto/{id}/excluir', 'TrabalhoController@destroy' )->name('trabalho.destroy'); + Route::get( '/projeto/{id}/excluir', 'TrabalhoController@destroy' )->name('trabalho.destroy'); //######### Atribuição ####################################### Route::get( '/atribuir', 'AtribuicaoController@distribuicaoAutomatica' )->name('distribuicao'); -- GitLab