From 0f2ddd9b647d3262b8253434d01f82248dc74033 Mon Sep 17 00:00:00 2001 From: alinetenorio <aline.tenorio96@gmail.com> Date: Thu, 11 Jun 2020 17:11:30 -0300 Subject: [PATCH] tela de visualizar projetos --- app/Http/Controllers/TrabalhoController.php | 38 ++- resources/lang/en/validation.php | 2 +- .../views/participante/projetos.blade.php | 2 +- resources/views/projeto/visualizar.blade.php | 316 ++++++++++++++++++ routes/web.php | 2 + 5 files changed, 356 insertions(+), 4 deletions(-) create mode 100644 resources/views/projeto/visualizar.blade.php diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index 18abebd..d4f8349 100644 --- a/app/Http/Controllers/TrabalhoController.php +++ b/app/Http/Controllers/TrabalhoController.php @@ -105,7 +105,9 @@ class TrabalhoController extends Controller 'nomePlanoTrabalho.*' => ['required', 'string'], 'anexoProjeto' => ['required', 'file', 'mimes:pdf', 'max:2000000'], 'anexoCONSU' => ['required', 'file', 'mimes:pdf', 'max:2000000'], - 'anexoComiteEtica' => ['required', 'file', 'mimes:pdf', 'max:2000000'], + 'botao' => ['required'], + 'anexoComiteEtica' => ['required_without:justificativaAutorizacaoEtica', 'file', 'mimes:pdf', 'max:2000000'], + 'justificativaAutorizacaoEtica' => ['required_without:anexoComiteEtica', 'file', 'mimes:pdf', 'max:2000000'], 'anexoLatterCoordenador' => ['required', 'file', 'mimes:pdf', 'max:2000000'], 'anexoPlanilha' => ['required', 'file', 'mimes:pdf', 'max:2000000'], 'anexoPlanoTrabalho.*' => ['required', 'file', 'mimes:pdf', 'max:2000000'], @@ -228,6 +230,7 @@ class TrabalhoController extends Controller Storage::putFileAs($path, $file, $nome); $arquivo = new Arquivo(); + $arquivo->titulo = $request->nomePlanoTrabalho[$key]; $arquivo->nome = $path . $nome; $arquivo->trabalhoId = $trabalho->id; $arquivo->data = $mytime; @@ -270,9 +273,33 @@ 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); + //dd($projeto); + $grandeArea = GrandeArea::where('id', $projeto->grande_area_id)->select('nome')->first(); + //dd($grandeArea->nome); + $area = Area::where('id', $projeto->area_id)->select('nome')->first(); + $subarea = Subarea::where('id', $projeto->sub_area_id)->select('nome')->first(); + $proponente = Proponente::find($projeto->proponente_id); + $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, + 'grandeArea' => $grandeArea, + 'area' => $area, + 'subArea' => $subarea, + 'proponente' => $proponente, + 'edital' => $edital, + 'users' => $users, + 'funcaoParticipantes' => $funcaoParticipantes, + 'participantes' => $participantes, + 'arquivos' => $arquivos,]); } /** @@ -439,6 +466,7 @@ class TrabalhoController extends Controller Storage::putFileAs($path, $file, $nome); $arquivo = new Arquivo(); + $arquivo->titulo = $request->nomePlanoTrabalho[$key]; $arquivo->nome = $path . $nome; $arquivo->trabalhoId = $trabalho->id; $arquivo->data = $mytime; @@ -471,6 +499,7 @@ class TrabalhoController extends Controller Storage::putFileAs($path, $file, $nome); $arquivo = new Arquivo(); + $arquivo->titulo = $request->nomePlanoTrabalho[$key]; $arquivo->nome = $path . $nome; $arquivo->trabalhoId = $trabalho->id; $arquivo->data = $mytime; @@ -676,4 +705,9 @@ class TrabalhoController extends Controller $projeto = Trabalho::find($id); return Storage::download($projeto->anexoPlanilhaPontuacao); } + + public function baixarAnexoJustificativa($id) { + $projeto = Trabalho::find($id); + return Storage::download($projeto->justificativaAutorizacaoEtica); + } } diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 50441fb..093006b 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -61,7 +61,7 @@ return [ 'required_unless' => 'O :attribute é necessário a menos que :other esteja em :values.', 'required_with' => 'O campo é obrigatório.', 'required_with_all' => 'O campo :attribute é obrigatório quando :values estão presentes.', - 'required_without' => 'O campo :attribute é obrigatório quando :values não está presente.', + 'required_without' => 'O campo é obrigatório.', 'required_without_all' => 'O campo :attribute é obrigatório quando nenhum destes estão presentes: :values.', 'same' => ':Attribute e :other devem ser iguais.', 'size' => [ diff --git a/resources/views/participante/projetos.blade.php b/resources/views/participante/projetos.blade.php index 51dc0a9..17faf98 100644 --- a/resources/views/participante/projetos.blade.php +++ b/resources/views/participante/projetos.blade.php @@ -47,7 +47,7 @@ <img src="{{asset('img/icons/ellipsis-v-solid.svg')}}" style="width:8px"> </a> <div class="dropdown-menu"> - <a href="{{ route('trabalho.editar', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center;"> + <a href="{{ route('trabalho.show', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center;"> Visualizar projeto </a> @if($projeto->status == 'Submetido') diff --git a/resources/views/projeto/visualizar.blade.php b/resources/views/projeto/visualizar.blade.php new file mode 100644 index 0000000..236d557 --- /dev/null +++ b/resources/views/projeto/visualizar.blade.php @@ -0,0 +1,316 @@ +@extends('layouts.app') + +@section('content') +<div class="container content"> + + <div class="row justify-content-center"> + <div class="col-sm-12"> + <div class="card" style="margin-top:50px"> + <div class="card-body"> + <h5 class="card-title">Visualizar Projeto</h5> + <p class="card-text"> + <input type="hidden" name="editalId" value="{{ $edital->id }}"> + + {{-- Nome do Projeto --}} + <div class="row justify-content-center"> + <div class="col-sm-12"> + <label for="nomeTrabalho" class="col-form-label">{{ __('Nome do Projeto:') }}</label> + <span id="nomeTrabalho" type="text" class="form-control @error('nomeTrabalho') is-invalid @enderror" name="nomeProjeto" value="{{ old('nomeTrabalho') }}" required autocomplete="nomeTrabalho" autofocus> + {{ $projeto->titulo }} </span> + + @error('nomeTrabalho') + <span class="invalid-feedback" role="alert"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + + {{-- Grande Area --}} + <div class="row justify-content-center"> + <div class="col-sm-4"> + <label for="grandeArea" class="col-form-label">{{ __('Grande Ãrea:') }}</label> + <span class="form-control @error('grandeArea') is-invalid @enderror" id="grandeArea" name="grandeArea"> + {{$grandeArea->nome}}</span> + @error('grandeArea') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + <div class="col-sm-4"> + <label for="area" class="col-form-label">{{ __('Ãrea:') }}</label> + <span class="form-control @error('area') is-invalid @enderror" id="area" name="area"> + {{$area->nome}}</span> + @error('area') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + <div class="col-sm-4"> + <label for="subArea" class="col-form-label">{{ __('Sub Ãrea:') }}</label> + <span class="form-control @error('subArea') is-invalid @enderror" id="subArea" name="subArea"> + {{$subArea->nome}}</span> + + @error('subArea') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + </div> + + + <hr> + <h3>Coordenador</h3> + + {{-- Coordenador --}} + <div class="row justify-content-center"> + + <div class="col-sm-6"> + <label for="nomeCoordenador" class="col-form-label">{{ __('Coordenador:') }}</label> + <span class="form-control" type="text" id="nomeCoordenador" name="nomeCoordenador" disabled="disabled" value="{{ Auth()->user()->name }}"> + {{ $proponente->user->name }}</span> + </div> + <div class="col-sm-6"> + <label for="nomeTrabalho" class="col-form-label">Link Lattes do Proponente</label> + <span class="form-control @error('linkLattesEstudante') is-invalid @enderror" type="text" name="linkLattesEstudante"> + @if($proponente->linkLattes != null) + {{ $proponente->linkLattes }} + @endif + </span> + + @error('linkLattesEstudante') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + <div class="col-sm-6"> + <label for="nomeTrabalho" class="col-form-label">{{ __('Pontuação da Planilha de Pontuação :') }}</label> + <span class="form-control @error('pontuacaoPlanilha') is-invalid @enderror" type="text" name="pontuacaoPlanilha"> + {{$projeto->pontuacaoPlanilha}}</span> + @error('pontuacaoPlanilha') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + <div class="col-sm-6"> + <label for="nomeTrabalho" class="col-form-label">{{ __('Link do grupo de pesquisa:') }}</label> + <span class="form-control @error('linkGrupo') is-invalid @enderror" type="text" name="linkGrupo"> + {{ $projeto->linkGrupoPesquisa }}</span> + @error('linkGrupo') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + + </div> + + <hr> + <h3>Anexos</h3> + + {{-- Anexo do Projeto --}} + <div class="row justify-content-center"> + {{-- Arquivo --}} + <div class="col-sm-6"> + <label for="anexoProjeto" class="col-form-label">{{ __('Anexo Projeto: ') }}</label> <a href="{{ route('baixar.anexo.projeto', ['id' => $projeto->id])}}">Arquivo atual</a> + + + @error('anexoProjeto') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + + <div class="col-sm-6"> + <label for="anexoLatterCoordenador" class="col-form-label">{{ __('Anexo do Lattes do Coordenador: ') }}</label><a href="{{ route('baixar.anexo.lattes', ['id' => $projeto->id]) }}"> Arquivo atual</a> + + + @error('anexoLatterCoordenador') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + + + + + + <div class="col-sm-6"> + <label for="nomeTrabalho" class="col-form-label">{{ __('Autorização do Comitê de Ética: ') }}</label> + @if($projeto->anexoAutorizacaoComiteEtica != null) + <a href="{{ route('baixar.anexo.comite', ['id' => $projeto->id]) }}"> Arquivo atual</a> + @else + - + @endif + + <br> + + @error('anexoComiteEtica') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + + <div class="col-sm-6 mt-3"> + <label for="anexoPlanilha" class="col-form-label">{{ __('Anexo do Planilha de Pontuação: ') }}</label><a href="{{ route('baixar.anexo.planilha', ['id' => $projeto->id]) }}"> Arquivo atual</a> + + + @error('anexoPlanilha') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + + <div class="col-sm-6"> + <label for="nomeTrabalho" class="col-form-label">{{ __('Justificativa: ') }}</label> + @if($projeto->justificativaAutorizacaoEtica != null) + <a href="{{ route('baixar.anexo.justificativa', ['id' => $projeto->id]) }}"> Arquivo atual</a> + @else + - + @endif + + @error('justificativaAutorizacaoEtica') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + + @if($edital->tipo == 'PIBIC' || $edital->tipo == 'PIBIC-EM') + {{-- Decisão do CONSU --}} + <div class="col-sm-6"> + <label for="anexoCONSU" class="col-form-label">{{ __('Decisão do CONSU: ') }}</label><a href="{{ route('baixar.anexo.consu', ['id' => $projeto->id]) }}"> Arquivo atual</a> + + + @error('anexoCONSU') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + @endif + + </div> + + <hr> + <h4>Participantes</h4> + + {{-- Participantes --}} + <div class="row" style="margin-top:20px"> + <div class="col-sm-12"> + <div id="participantes"> + @foreach($participantes as $participante) + @foreach($users as $user) + @if($participante->user_id === $user->id) + <div id="novoParticipante"> + <br> + <h5>Dados do participante</h5> + <div class="row"> + <div class="col-sm-5"> + <label>Nome Completo</label> + <span type="text" style="margin-bottom:10px" class="form-control @error('nomeParticipante') is-invalid @enderror" name="nomeParticipante[]" placeholder="Nome" required> + {{ $user->name }}</span> + @error('nomeParticipante') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + <div class="col-sm-4"> + <label>E-mail</label> + <span type="email" style="margin-bottom:10px" class="form-control @error('emailParticipante') is-invalid @enderror" name="emailParticipante[]" placeholder="email" required> + {{ $user->email }}</span> + @error('emailParticipante') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + <div class="col-sm-3"> + <label>Função:</label> + <select disabled class="form-control @error('funcaoParticipante') is-invalid @enderror" name="funcaoParticipante[]" id="funcaoParticipante"> + <option value="" disabled selected hidden>-- Função --</option> + @foreach($funcaoParticipantes as $funcaoParticipante) + @if($funcaoParticipante->id === $participante->funcao_participante_id) + <option value="{{$funcaoParticipante->id}}" selected>{{$funcaoParticipante->nome}}</option> + @else + <option value="{{$funcaoParticipante->id}}">{{$funcaoParticipante->nome}}</option> + @endif + @endforeach + + @error('funcaoParticipante') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </select> + </div> + </div> + <h5>Dados do plano de trabalho</h5> + @foreach ($arquivos as $arquivo) + @if($arquivo->participanteId === $participante->id) + <a href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}">Plano de trabalho atual</a> + @endif + @endforeach + <div class="row"> + <div class="col-sm-12"> + <div id="planoTrabalho"> + <div class="row"> + <div class="col-sm-4"> + <label>Titulo </label> + <span type="text" style="margin-bottom:10px" class="form-control @error('nomePlanoTrabalho') is-invalid @enderror" name="nomePlanoTrabalho[]" placeholder="Nome"> + {{$arquivo->titulo}} + </span> + + @error('nomePlanoTrabalho') + <span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> + <strong>{{ $message }}</strong> + </span> + @enderror + </div> + {{-- Arquivo --}} + <div class="col-sm-7"> + <label for="nomeTrabalho">Anexo</label> + + </div> + </div> + </div> + </div> + </div> + </div> + @endif + @endforeach + @endforeach + </div> + <a href="#" class="btn btn-primary" id="addCoautor" style="width:100%;margin-top:10px">Participantes +</a> + </div> + </div> + + </p> + <div class="row justify-content-center"> + <div class="col-md-6"> + <a href="{{route('evento.visualizar',['id'=>$edital->id])}}" class="btn btn-secondary" style="width:100%">Cancelar</a> + </div> + <div class="col-md-6"> + <button type="submit" class="btn btn-primary" style="width:100%"> + {{ __('Enviar') }} + </button> + </div> + </div> + + </div> + </div> + </div> + </div> + +</div> +@endsection diff --git a/routes/web.php b/routes/web.php index 4f54ceb..a293673 100644 --- a/routes/web.php +++ b/routes/web.php @@ -89,6 +89,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){ //######### Trabalho ######################################## Route::get( '/trabalho/submeter/{id}', 'TrabalhoController@index' )->name('trabalho.index'); + Route::get( '/trabalho/visualizar/{id}','TrabalhoController@show' )->name('trabalho.show'); 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'); @@ -113,6 +114,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){ Route::get('/baixar/anexo-projeto/{id}', 'TrabalhoController@baixarAnexoProjeto' )->name('baixar.anexo.projeto'); Route::get('/baixar/anexo-consu/{id}', 'TrabalhoController@baixarAnexoConsu' )->name('baixar.anexo.consu'); Route::get('/baixar/anexo-comite/{id}', 'TrabalhoController@baixarAnexoComite' )->name('baixar.anexo.comite'); + Route::get('/baixar/anexo-justificativa/{id}', 'TrabalhoController@baixarAnexoJustificativa' )->name('baixar.anexo.justificativa'); Route::get('/baixar/anexo-lattes/{id}', 'TrabalhoController@baixarAnexoLattes' )->name('baixar.anexo.lattes'); Route::get('/baixar/anexo-planilha/{id}','TrabalhoController@baixarAnexoPlanilha' )->name('baixar.anexo.planilha'); Route::get('/baixar/plano-de-trabalho/{id}', 'ArquivoController@baixarPlano' )->name('baixar.plano'); -- GitLab