diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index 18abebdd84e5c1dbf7e00ae504c2f9180662c97d..d4f83499071b0a2ca7721436aff311d82d4bca21 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 50441fb0b66d1167c2a89b26b0eebf2a06a95256..093006b1da49859c04a869657789dfe1edf96a6e 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 51dc0a9ec77f0d89bd9f90bce4cc4a167cd393b6..17faf98bc58e5ed2b5df6942597f65f5ea5f969b 100644 --- a/resources/views/participante/projetos.blade.php +++ b/resources/views/participante/projetos.blade.php @@ -47,7 +47,7 @@