diff --git a/.env.example b/.env.example index d845418308119086677d18333d96bfaac593085c..58f034607f0cd3bacbbd4f3a52f4cf6f612d0dc8 100755 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -PP_NAME=Laravel +APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=true diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index 2383e191720af79b9a54e8c5d3a66038bd38d09f..7256a2f6d598f99fb28c18ab763456956aaf6176 100755 --- a/app/Http/Controllers/TrabalhoController.php +++ b/app/Http/Controllers/TrabalhoController.php @@ -381,6 +381,9 @@ class TrabalhoController extends Controller // return back()->withErrors(['Proposta não encontrada!']); // } $projeto = Trabalho::find($id); + if(Auth::user()->id != $projeto->proponente->user->id){ + return redirect()->back(); + } $edital = Evento::find($projeto->evento_id); $grandeAreas = GrandeArea::all(); $areas = Area::all(); @@ -433,8 +436,13 @@ class TrabalhoController extends Controller public function edit($id) { - $proponente = Proponente::where('user_id', Auth::user()->id)->first(); - $projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first(); + if(Auth::user()->tipo=='administrador'){ + $projeto = Trabalho::find($id); + }else{ + $projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first(); + } + + $proponente = Proponente::where('user_id', $projeto->proponente->user_id)->first(); if (!$projeto) { return back()->withErrors(['Proposta não encontrada!']); } @@ -832,7 +840,8 @@ class TrabalhoController extends Controller $request->merge([ 'coordenador_id' => $evento->coordenadorComissao->id ]); - $trabalho = Auth::user()->proponentes->trabalhos()->where('id', $id)->first(); + + $trabalho = Trabalho::find($id); DB::beginTransaction(); if (!$trabalho) { @@ -878,7 +887,6 @@ class TrabalhoController extends Controller if ($request->has('marcado')) { foreach ($request->marcado as $key => $part) { $part = intval($part); - $passwordTemporario = Str::random(8); $data['name'] = $request->name[$part]; $data['email'] = $request->email[$part]; @@ -937,8 +945,13 @@ class TrabalhoController extends Controller } else { // $user = $participante->user; $user->update($data); - $endereco = $user->endereco; - $endereco->update($data); + if( $user->endereco == null){ + $endereco = Endereco::create($data); + $endereco->user()->save($user); + }else{ + $endereco = $user->endereco; + $endereco->update($data); + } $participante = $user->participantes->where('trabalho_id', $trabalho->id)->where('id', $request->participante_id[$part])->first(); // dd($participante); if ($participante == null) { @@ -987,10 +1000,15 @@ class TrabalhoController extends Controller } } + DB::commit(); + + if(Auth::user()->tipo == 'administrador'){ + return redirect(route('admin.analisarProposta',['id'=>$trabalho->id])); + } + if (!$request->has('rascunho')) { - // SubmissaoNotification.php - Notification::send(Auth::user(), new SubmissaoNotification($id,$trabalho->titulo)); + Notification::send($trabalho->proponente->user, new SubmissaoNotification($id,$trabalho->titulo)); } return redirect(route('proponente.projetos'))->with(['mensagem' => 'Proposta atualizada!']); diff --git a/app/Http/Requests/UpdateTrabalho.php b/app/Http/Requests/UpdateTrabalho.php index e152028cb180c06e2e3e0cc514e3d49557bb5b97..cfa191d2a6bf3b6814dea96338a97ec522f41334 100755 --- a/app/Http/Requests/UpdateTrabalho.php +++ b/app/Http/Requests/UpdateTrabalho.php @@ -72,16 +72,16 @@ class UpdateTrabalho extends FormRequest //$rules = []; if($evento->tipo!="PIBEX"){ - $rules['anexoPlanilhaPontuacao'] = ['required']; - $rules['anexoLattesCoordenador'] = ['required', 'mimes:pdf']; - $rules['anexoGrupoPesquisa'] = ['required', 'mimes:pdf']; - $rules['anexoAutorizacaoComiteEtica'] = [Rule::requiredIf($this->justificativaAutorizacaoEtica == null)]; - $rules['justificativaAutorizacaoEtica']= [Rule::requiredIf($this->anexoAutorizacaoComiteEtica == null)]; + $rules['anexoPlanilhaPontuacao'] = [Rule::requiredIf($projeto->anexoPlanilhaPontuacao == null)]; + $rules['anexoLattesCoordenador'] = [Rule::requiredIf($projeto->anexoLattesCoordenador == null), 'mimes:pdf']; + $rules['anexoGrupoPesquisa'] = [Rule::requiredIf($projeto->anexoGrupoPesquisa == null), 'mimes:pdf']; + $rules['anexoAutorizacaoComiteEtica'] = [Rule::requiredIf($this->justificativaAutorizacaoEtica == null && $projeto->anexoAutorizacaoComiteEtica == null)]; + $rules['justificativaAutorizacaoEtica']= [Rule::requiredIf($this->anexoAutorizacaoComiteEtica == null && $projeto->anexoAutorizacaoComiteEtica == null)]; $rules['pontuacaoPlanilha'] = ['required', 'string']; $rules['linkGrupoPesquisa'] = ['required', 'string']; } if($evento->nome_docExtra != null){ - $rules['anexo_docExtra'] = [Rule::requiredIf($evento->obrigatoriedade_docExtra == true),'file', 'mimes:zip,doc,docx,pdf', 'max:2048']; + $rules['anexo_docExtra'] = [Rule::requiredIf($evento->obrigatoriedade_docExtra == true && $evento->obrigatoriedade_docExtra == null),'file', 'mimes:zip,doc,docx,pdf', 'max:2048']; } $rules['editalId'] = ['required', 'string']; $rules['marcado.*'] = ['required']; @@ -92,8 +92,8 @@ class UpdateTrabalho extends FormRequest $rules['linkLattesEstudante'] = ['required', 'string']; - $rules['anexoProjeto'] = ['required', 'mimes:pdf']; - $rules['anexoDecisaoCONSU'] = [Rule::requiredIf($evento->consu), 'mimes:pdf']; + $rules['anexoProjeto'] = [Rule::requiredIf($projeto->anexoProjeto == null), 'mimes:pdf']; + $rules['anexoDecisaoCONSU'] = [Rule::requiredIf($evento->consu && $projeto->anexoDecisaoCONSU == null), 'mimes:pdf']; return $rules; } diff --git a/resources/views/administrador/analisarProposta.blade.php b/resources/views/administrador/analisarProposta.blade.php index ccd9c1f318da449d97b86f2fc7a1c0c99a10c809..44d795382673a67a15593656092bad0bcf35d48b 100644 --- a/resources/views/administrador/analisarProposta.blade.php +++ b/resources/views/administrador/analisarProposta.blade.php @@ -44,7 +44,14 @@
-
{{$trabalho->titulo}}
+
+
{{$trabalho->titulo}} + + + +
+
+
{{$evento->nome}}
diff --git a/resources/views/evento/formulario/anexos.blade.php b/resources/views/evento/formulario/anexos.blade.php index 1024df19ca87e64f207592756c315641ba982835..7abed30e8e19f1fc6636d8d50f54f6a613340504 100755 --- a/resources/views/evento/formulario/anexos.blade.php +++ b/resources/views/evento/formulario/anexos.blade.php @@ -118,7 +118,7 @@ @if($edital->nome_docExtra != null)
- obrigatoriedade_docExtra == true) required @endif/> + @error('anexo_docExtra') {{ $message }} diff --git a/resources/views/projeto/editaFormulario/anexos.blade.php b/resources/views/projeto/editaFormulario/anexos.blade.php index 8cbb63a3b731e5229aeecdd42c894388997b9652..1255c18013ad6b329108b8e8a82584f4fbd36221 100755 --- a/resources/views/projeto/editaFormulario/anexos.blade.php +++ b/resources/views/projeto/editaFormulario/anexos.blade.php @@ -167,7 +167,7 @@ @else @endif - obrigatoriedade_docExtra == true) required @endif/> + @error('anexo_docExtra') {{ $message }} diff --git a/resources/views/projeto/editaFormulario/finalizar.blade.php b/resources/views/projeto/editaFormulario/finalizar.blade.php index b85b67c0365e0b89bac5a812179b2a04669f9cba..d4a09981cbfd7eea28a2feee16580a92761f2f55 100755 --- a/resources/views/projeto/editaFormulario/finalizar.blade.php +++ b/resources/views/projeto/editaFormulario/finalizar.blade.php @@ -10,7 +10,9 @@
* Campos obrigatórios
- + @if(Auth::user()->tipo != 'administrador') + + @endif
@if($errors->any()) diff --git a/resources/views/projeto/editaFormulario/participantes.blade.php b/resources/views/projeto/editaFormulario/participantes.blade.php index 2fb98b21cbceed24eee10fe9664428159f5e7cb9..8a655b58beabac661577ffb9eda16091dad072a1 100644 --- a/resources/views/projeto/editaFormulario/participantes.blade.php +++ b/resources/views/projeto/editaFormulario/participantes.blade.php @@ -219,8 +219,8 @@ @component('componentes.input', ['label' => 'Instituição de Ensino']) @error('instituicao.'.$i) @@ -243,14 +243,14 @@ @component('componentes.input', ['label' => 'Curso']) @error('curso.'.$i) @@ -274,7 +274,7 @@ @error('turno.'.$i) @@ -292,7 +292,7 @@ @error('total_periodos.'.$i) @@ -321,10 +321,8 @@ @error('ordem_prioridade.'.$i) diff --git a/resources/views/projeto/editaFormulario/proponente.blade.php b/resources/views/projeto/editaFormulario/proponente.blade.php index f044e0db473a61325d3a97d58a68ccd49b96e3cc..b34e14a5b1541b8636f76a1a28ae46a087e1e73f 100755 --- a/resources/views/projeto/editaFormulario/proponente.blade.php +++ b/resources/views/projeto/editaFormulario/proponente.blade.php @@ -12,7 +12,7 @@
- + tipo=='administrador') value="{{ $projeto->proponente->user->name }}" @else value="{{ Auth()->user()->name }}" @endif >
@@ -23,11 +23,16 @@
user()->proponentes != null && Auth()->user()->proponentes->linkLattes != null) - value="{{ Auth()->user()->proponentes->linkLattes }}" + @if(Auth::user()->tipo=='administrador') + value="{{ $projeto->proponente->linkLattes }}" @else - value="" - @endif > + @if(Auth()->user()->proponentes != null && Auth()->user()->proponentes->linkLattes != null) + value="{{ Auth()->user()->proponentes->linkLattes }}" + @else + value="" + @endif + @endif + > @error('linkLattesEstudante') {{ $message }} diff --git a/resources/views/projeto/editar.blade.php b/resources/views/projeto/editar.blade.php index 1d43560a29a94e5f2f662a796dc7d4d27d1e0205..39916bf9f0770af6983d97462e648aa4f64acecc 100755 --- a/resources/views/projeto/editar.blade.php +++ b/resources/views/projeto/editar.blade.php @@ -39,7 +39,7 @@ @include('projeto.editaFormulario.anexos') @include('projeto.editaFormulario.finalizar') - +
diff --git a/resources/views/vendor/notifications/email.blade.php b/resources/views/vendor/notifications/email.blade.php index a0dcf408be9f1e45ec2bd1f855a93a7dbb4de864..5d0f57a139107ddfffd6b8c5f7deab2451aaf7f7 100755 --- a/resources/views/vendor/notifications/email.blade.php +++ b/resources/views/vendor/notifications/email.blade.php @@ -45,7 +45,6 @@ @else
@lang('Atenciosamente'),
{{--{{ config('app.name') }}

--}} -Seção de Editais e Apoios a Projetos - PREC/UFAPE
Universidade Federal do Agreste de Pernambuco
@endif