diff --git a/app/Http/Controllers/EventoController.php b/app/Http/Controllers/EventoController.php index 76c89515d7f832a4519ea0fb90c45ee7288c8d04..330ce50c6ad595949acff4563cb528eec1ac161c 100755 --- a/app/Http/Controllers/EventoController.php +++ b/app/Http/Controllers/EventoController.php @@ -25,6 +25,7 @@ use Illuminate\Support\Facades\Log; use App\Endereco; use App\Mail\EventoCriado; use Illuminate\Support\Facades\Mail; +use Illuminate\Validation\Rule; class EventoController extends Controller @@ -137,6 +138,7 @@ class EventoController extends Controller 'pdfEdital' => [($request->pdfEditalPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf', 'max:2048'], 'inicioProjeto' => ['required', 'date'], 'fimProjeto' => ['required', 'date'], + 'nome_docExtra' => [Rule::requiredIf($request->check_docExtra != null), 'max:255'], //'modeloDocumento' => [], ]); } @@ -151,6 +153,7 @@ class EventoController extends Controller 'natureza' => ['required'], 'coordenador_id' => ['required'], 'numParticipantes' => ['required'], + 'nome_docExtra' => [Rule::requiredIf($request->check_docExtra != null),'max:255'], #---------------------------------------------- 'inicioSubmissao' => ['required', 'date', 'after:yesterday'], 'fimSubmissao' => ['required', 'date', 'after_or_equal:inicioSubmissao'], @@ -176,6 +179,9 @@ class EventoController extends Controller $evento['descricao'] = $request->descricao; $evento['tipo'] = $request->tipo; $evento['natureza_id'] = $request->natureza; + if($request->check_docExtra != null){ + $evento['nome_docExtra'] = $request->nome_docExtra; + } $evento['inicioSubmissao'] = $request->inicioSubmissao; $evento['fimSubmissao'] = $request->fimSubmissao; $evento['inicioRevisao'] = $request->inicioRevisao; @@ -193,6 +199,7 @@ class EventoController extends Controller $evento['numParticipantes'] = $request->numParticipantes; $evento['consu'] = $request->has('consu'); $evento['cotaDoutor'] = $request->has('cotaDoutor'); + $evento['obrigatoriedade_docExtra'] = $request->has('obrigatoriedade_docExtra'); $evento['anexosStatus'] = 'final'; $evento['inicioProjeto'] = $request->inicioProjeto; $evento['fimProjeto'] = $request->fimProjeto; @@ -455,6 +462,8 @@ class EventoController extends Controller 'inicioProjeto' => ['required', 'date'], 'fimProjeto' => ['required', 'date'], 'docTutorial' => ['file', 'mimes:zip,doc,docx,pdf', 'max:2048'], + 'nome_docExtra' => [Rule::requiredIf($request->check_docExtra != null), 'max:255'], + ]); } @@ -482,6 +491,7 @@ class EventoController extends Controller 'inicioProjeto' => ['required', 'date', 'after:resultado_final'], 'fimProjeto' => ['required', 'date', 'after:inicioProjeto'], 'docTutorial' => ['file', 'mimes:zip,doc,docx,pdf', 'max:2048'], + 'nome_docExtra' => [Rule::requiredIf($request->check_docExtra != null) , 'max:255'], ]); $evento->nome = $request->nome; @@ -489,6 +499,11 @@ class EventoController extends Controller $evento->tipo = $request->tipo; $evento->natureza_id = $request->natureza; $evento->numParticipantes = $request->numParticipantes; + if($request->check_docExtra != null){ + $evento->nome_docExtra = $request->nome_docExtra; + }else{ + $evento->nome_docExtra = null; + } $evento->inicioSubmissao = $request->inicioSubmissao; $evento->fimSubmissao = $request->fimSubmissao; $evento->inicioRevisao = $request->inicioRevisao; @@ -504,6 +519,7 @@ class EventoController extends Controller $evento->coordenadorId = $request->coordenador_id; $evento->consu = $request->has('consu'); $evento->cotaDoutor = $request->has('cotaDoutor'); + $evento->obrigatoriedade_docExtra = $request->has('obrigatoriedade_docExtra'); $evento->inicioProjeto = $request->inicioProjeto; $evento->fimProjeto = $request->fimProjeto; if($request->pdfEdital != null){ diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index 3708e196d72ffc9d878575ca4e29ab9fa2b42643..6570298d73cb3ea36b9ebdc1cba8278062433c81 100755 --- a/app/Http/Controllers/TrabalhoController.php +++ b/app/Http/Controllers/TrabalhoController.php @@ -309,6 +309,15 @@ class TrabalhoController extends Controller } $trabalho->anexoGrupoPesquisa = Storage::putFileAs($pasta, $request->anexoGrupoPesquisa, "Grupo_de_pesquisa." . $request->file('anexoGrupoPesquisa')->extension()); } + + //Anexo documentro extra + if (isset($request->anexo_docExtra)) { + if (Storage::disk()->exists($trabalho->anexo_docExtra)) { + Storage::delete($trabalho->anexo_docExtra); + } + $trabalho->anexo_docExtra = Storage::putFileAs($pasta, $request->anexo_docExtra, "Documento_Extra." . $request->file('anexo_docExtra')->extension()); + } + $trabalho->save(); return $trabalho; } @@ -351,6 +360,11 @@ class TrabalhoController extends Controller $trabalho->anexoGrupoPesquisa = Storage::putFileAs($pasta, $request->anexoGrupoPesquisa, "Grupo_de_pesquisa." . $request->file('anexoGrupoPesquisa')->extension()); } + // Anexo documento extra + if (isset($request->anexo_docExtra)) { + $trabalho->anexo_docExtra = Storage::putFileAs($pasta, $request->anexo_docExtra, "Documento_Extra." . $request->file('anexo_docExtra')->extension()); + } + return $trabalho; } @@ -765,6 +779,16 @@ class TrabalhoController extends Controller return abort(404); } + public function baixarAnexoDocExtra($id) + { + $projeto = Trabalho::find($id); + if (Storage::disk()->exists($projeto->anexo_docExtra)) { + ob_end_clean(); + return Storage::download($projeto->anexo_docExtra); + } + return abort(404); + } + public function baixarAnexoTemp($eventoId, $nomeAnexo) { $proponente = Proponente::where('user_id', Auth::user()->id)->first(); @@ -817,13 +841,13 @@ class TrabalhoController extends Controller if($evento->tipo=="PIBEX"){ $trabalho->update($request->except([ - 'anexoProjeto', 'anexoDecisaoCONSU','modalidade' + 'anexoProjeto', 'anexoDecisaoCONSU','modalidade','anexo_docExtra' ])); }else{ $trabalho->update($request->except([ 'anexoProjeto', 'anexoDecisaoCONSU', 'anexoPlanilhaPontuacao', 'anexoLattesCoordenador', 'anexoGrupoPesquisa', 'anexoAutorizacaoComiteEtica', - 'justificativaAutorizacaoEtica','modalidade' + 'justificativaAutorizacaoEtica','modalidade','anexo_docExtra' ])); } @@ -998,14 +1022,14 @@ class TrabalhoController extends Controller if($evento->tipo=="PIBEX"){ $trabalho = Auth::user()->proponentes->trabalhos() ->create($request->except([ - 'anexoProjeto', 'anexoDecisaoCONSU','modalidade' + 'anexoProjeto', 'anexoDecisaoCONSU','modalidade','anexo_docExtra' ])); }else{ $trabalho = Auth::user()->proponentes->trabalhos() ->create($request->except([ 'anexoProjeto', 'anexoDecisaoCONSU', 'anexoPlanilhaPontuacao', 'anexoLattesCoordenador', 'anexoGrupoPesquisa', 'anexoAutorizacaoComiteEtica', - 'justificativaAutorizacaoEtica','modalidade' + 'justificativaAutorizacaoEtica','modalidade','anexo_docExtra' ])); } diff --git a/app/Http/Requests/StoreTrabalho.php b/app/Http/Requests/StoreTrabalho.php index 14e510ddfa11c9d82f20c0fdf7d6062386073860..ee5f049f6a23c88cc0d95dce393b2957c73f3d66 100755 --- a/app/Http/Requests/StoreTrabalho.php +++ b/app/Http/Requests/StoreTrabalho.php @@ -68,6 +68,9 @@ class StoreTrabalho extends FormRequest $rules = []; return $rules; }else{ + if($evento->nome_docExtra != null ){ + $rules['anexo_docExtra'] = [Rule::requiredIf($evento->obrigatoriedade_docExtra == true),'file', 'mimes:zip,doc,docx,pdf', 'max:2048']; + } if($evento->tipo!="PIBEX"){ $rules['anexoPlanilhaPontuacao'] = ['required']; $rules['anexoLattesCoordenador'] = ['required', 'mimes:pdf']; @@ -77,6 +80,7 @@ class StoreTrabalho extends FormRequest $rules['pontuacaoPlanilha'] = ['required', 'string']; $rules['linkGrupoPesquisa'] = ['required', 'string']; } + $rules['editalId'] = ['required', 'string']; $rules['marcado.*'] = ['required']; $rules['titulo'] = ['required', 'string']; diff --git a/app/Http/Requests/UpdateTrabalho.php b/app/Http/Requests/UpdateTrabalho.php index 1af38bdf1f701cef4803598b2a2299503d6dd2d4..e152028cb180c06e2e3e0cc514e3d49557bb5b97 100755 --- a/app/Http/Requests/UpdateTrabalho.php +++ b/app/Http/Requests/UpdateTrabalho.php @@ -80,6 +80,9 @@ class UpdateTrabalho extends FormRequest $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['editalId'] = ['required', 'string']; $rules['marcado.*'] = ['required']; $rules['titulo'] = ['required', 'string']; diff --git a/database/migrations/2022_07_04_163438_add_doc_tutorial_to_eventos_table.php b/database/migrations/2022_07_04_163438_add_doc_tutorial_to_eventos_table.php index 49b6e7a4881ea1a70cef275f95049d896d7eb848..86e346a4d6b0eb4f4311b679a0ae35034ea7eff4 100644 --- a/database/migrations/2022_07_04_163438_add_doc_tutorial_to_eventos_table.php +++ b/database/migrations/2022_07_04_163438_add_doc_tutorial_to_eventos_table.php @@ -14,9 +14,7 @@ class AddDocTutorialToEventosTable extends Migration public function up() { Schema::table('eventos', function (Blueprint $table) { - Schema::table('eventos', function (Blueprint $table) { - $table->string('docTutorial')->nullable(); - }); + $table->string('docTutorial')->nullable(); }); } diff --git a/database/migrations/2022_07_12_055454_add_nome_doc_extra_to_eventos_table.php b/database/migrations/2022_07_12_055454_add_nome_doc_extra_to_eventos_table.php new file mode 100644 index 0000000000000000000000000000000000000000..73b6348e1b7ec5bac273eea3d354ac7e8f4646ce --- /dev/null +++ b/database/migrations/2022_07_12_055454_add_nome_doc_extra_to_eventos_table.php @@ -0,0 +1,32 @@ +string('nome_docExtra')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('eventos', function (Blueprint $table) { + $table->dropColumn('nome_docExtra'); + }); + } +} diff --git a/database/migrations/2022_07_12_055505_add_anexo_doc_extra_to_trabalhos_table.php b/database/migrations/2022_07_12_055505_add_anexo_doc_extra_to_trabalhos_table.php new file mode 100644 index 0000000000000000000000000000000000000000..6dafd3c6820acb548871590f2c2994ec233d1517 --- /dev/null +++ b/database/migrations/2022_07_12_055505_add_anexo_doc_extra_to_trabalhos_table.php @@ -0,0 +1,32 @@ +string('anexo_docExtra')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('trabalhos', function (Blueprint $table) { + $table->dropColumn('anexo_docExtra'); + }); + } +} diff --git a/database/migrations/2022_07_12_124026_add_obrigatoriedade_doc_extra_to_eventos.php b/database/migrations/2022_07_12_124026_add_obrigatoriedade_doc_extra_to_eventos.php new file mode 100644 index 0000000000000000000000000000000000000000..3c62eade60b06a208aeaa8d3bd92c700059d03d6 --- /dev/null +++ b/database/migrations/2022_07_12_124026_add_obrigatoriedade_doc_extra_to_eventos.php @@ -0,0 +1,32 @@ +boolean('obrigatoriedade_docExtra')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('eventos', function (Blueprint $table) { + $table->dropColumn('obrigatoriedade_docExtra'); + }); + } +} diff --git a/resources/views/administrador/analisarProposta.blade.php b/resources/views/administrador/analisarProposta.blade.php index 981fd50fe7980ebdab56b9d0ee6396a9f34f7fc3..ccd9c1f318da449d97b86f2fc7a1c0c99a10c809 100644 --- a/resources/views/administrador/analisarProposta.blade.php +++ b/resources/views/administrador/analisarProposta.blade.php @@ -456,10 +456,20 @@
- + +
+ @endif + @if($evento->nome_docExtra != null) + {{-- Documento Extra --}} +
+ + @if($trabalho->anexo_docExtra) + + @else + + + + @endif
@endif diff --git a/resources/views/avaliador/parecer.blade.php b/resources/views/avaliador/parecer.blade.php index 7885fdddf8dec438b921bb81321d3124ec4a6bfd..6386a8df37d089cd1d514d48c115089684da6d40 100755 --- a/resources/views/avaliador/parecer.blade.php +++ b/resources/views/avaliador/parecer.blade.php @@ -58,6 +58,19 @@ @endif @endforeach + + {{--Documento Extra--}} + @if($trabalho->evento->nome_docExtra != null) +
+ + @if($trabalho->anexo_docExtra != null) + + @else + + @endif +
+
+ @endif diff --git a/resources/views/evento/criarEvento.blade.php b/resources/views/evento/criarEvento.blade.php index fce3fe0ec0b24645ec1ba9ee988d91002cc50850..bcf022e88881940330a7274858d9f2b19bfa3e2e 100755 --- a/resources/views/evento/criarEvento.blade.php +++ b/resources/views/evento/criarEvento.blade.php @@ -14,7 +14,7 @@ {{-- nome | Participantes | Tipo--}} -
+
@@ -67,20 +67,28 @@ @enderror
-
- +
{{-- end nome | Participantes | Tipo--}} + - {{-- --}} +
+
+ + +
+ +
+ + @error('consu') {{ $message }} @enderror -
- - - +
+
+ + @error('cotaDoutor') @@ -88,7 +96,27 @@ @enderror
-
{{-- end nome | Participantes | Tipo--}} + {{--Nome do Documento Extra--}} + + + +
{{-- Descricao Edital --}}
@@ -506,6 +534,10 @@ var pdfFormAvalRelatorioPreenchido = document.getElementById('pdfFormAvalRelatorioPreenchido'); pdfFormAvalRelatorioPreenchido.value = "sim"; } + if(file.id === "docTutorial"){ + var docTutorialPreenchido = document.getElementById('docTutorialPreenchido'); + docTutorialPreenchido.value = "sim"; + } } $("input[type='file']").on("change", function () { @@ -535,5 +567,20 @@ $("#modalCoord").modal('hide'); } + + function showDocumentoExtra(){ + var nome_docExtra = document.getElementById('nome_docExtra'); + var check_docExtra = document.getElementById("check_docExtra"); + var obrigatoriedade_docExtra = document.getElementById('obrigatoriedade_docExtra'); + if(check_docExtra.checked == true){ + nome_docExtra.parentElement.style.display = ''; + obrigatoriedade_docExtra.parentElement.style.display = ''; + }else{ + nome_docExtra.parentElement.style.display = 'none'; + obrigatoriedade_docExtra.parentElement.style.display = 'none'; + } + } + + window.onload = showDocumentoExtra(); @endsection \ No newline at end of file diff --git a/resources/views/evento/editarEvento.blade.php b/resources/views/evento/editarEvento.blade.php index f83a8983ade29eb11969267a5228051bce0a605c..4fd8dd914ff89045118d8ff5c3960c0fadba54e7 100755 --- a/resources/views/evento/editarEvento.blade.php +++ b/resources/views/evento/editarEvento.blade.php @@ -14,7 +14,7 @@
{{-- nome | Tipo--}} -
+
{{--Nome do evento--}} @@ -71,19 +71,27 @@ @enderror
-
- +
{{-- end nome | Participantes | Tipo--}} + +
+ +
+ + nome_docExtra != null ) checked @endif {{ old('check_docExtra') ? 'checked' : ''}}> +
- {{-- --}} +
+ + consu) checked @endif name="consu" id="consu"> @error('consu') {{ $message }} @enderror +
-
- +
cotaDoutor) checked @endif name="cotaDoutor" id="cotaDoutor"> @@ -93,7 +101,28 @@ @enderror
-
{{-- end nome | Participantes | Tipo--}} + + {{--Nome do Documento Extra--}} + + + +
{{-- Descricao Evento --}}
@@ -477,5 +506,20 @@ $("#modalCoord").modal('hide'); } + + function showDocumentoExtra(){ + var nome_docExtra = document.getElementById('nome_docExtra'); + var check_docExtra = document.getElementById("check_docExtra"); + var obrigatoriedade_docExtra = document.getElementById('obrigatoriedade_docExtra'); + if(check_docExtra.checked == true){ + nome_docExtra.parentElement.style.display = ''; + obrigatoriedade_docExtra.parentElement.style.display = ''; + }else{ + nome_docExtra.parentElement.style.display = 'none'; + obrigatoriedade_docExtra.parentElement.style.display = 'none'; + } + } + + window.onload = showDocumentoExtra(); @endsection \ No newline at end of file diff --git a/resources/views/evento/formulario/anexos.blade.php b/resources/views/evento/formulario/anexos.blade.php index 48123b66ade21131420d79f9039ca75f43019eaf..1024df19ca87e64f207592756c315641ba982835 100755 --- a/resources/views/evento/formulario/anexos.blade.php +++ b/resources/views/evento/formulario/anexos.blade.php @@ -115,6 +115,17 @@
@endif + @if($edital->nome_docExtra != null) +
+ + obrigatoriedade_docExtra == true) required @endif/> + @error('anexo_docExtra') + + {{ $message }} + + @enderror +
+ @endif diff --git a/resources/views/projeto/editaFormulario/anexos.blade.php b/resources/views/projeto/editaFormulario/anexos.blade.php index 6f31fa28fcd0f16f99c872416ed011a96858b13c..8cbb63a3b731e5229aeecdd42c894388997b9652 100755 --- a/resources/views/projeto/editaFormulario/anexos.blade.php +++ b/resources/views/projeto/editaFormulario/anexos.blade.php @@ -159,6 +159,22 @@ @endif + @if($edital->nome_docExtra != null) +
+ + @if($projeto->anexo_docExtra != null) + + @else + + @endif + obrigatoriedade_docExtra == true) required @endif/> + @error('anexo_docExtra') + + {{ $message }} + + @enderror +
+ @endif diff --git a/resources/views/projeto/editaFormulario/participantes.blade.php b/resources/views/projeto/editaFormulario/participantes.blade.php index 4cefe7b682a3fb46dba27eb5e8a51a38a6c7a6c1..9784849a3153f7cd270b923f0184d5c6166ef3a4 100644 --- a/resources/views/projeto/editaFormulario/participantes.blade.php +++ b/resources/views/projeto/editaFormulario/participantes.blade.php @@ -321,7 +321,7 @@ diff --git a/resources/views/projeto/formularioVisualizar/anexos2.blade.php b/resources/views/projeto/formularioVisualizar/anexos2.blade.php index 60e16e93cc1e7185dbb400faf0717cdbe9eefcdb..24fed1fb00310d35c2a2152440345d0c83bcb26c 100644 --- a/resources/views/projeto/formularioVisualizar/anexos2.blade.php +++ b/resources/views/projeto/formularioVisualizar/anexos2.blade.php @@ -68,6 +68,20 @@ @endif + @if($edital->nome_docExtra != null) + {{-- Documento Extra --}} +
+ + @if($projeto->anexo_docExtra != null) + + @else + + + + @endif +
+ @endif + diff --git a/routes/web.php b/routes/web.php index 2811d1e384716b9e8c7d77ceb734e9a7bc12b37b..f3aa22a2208cd23d373eb4bfa0b7bc4c686ce4e7 100755 --- a/routes/web.php +++ b/routes/web.php @@ -209,6 +209,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){ Route::get('/baixar/anexo-temp/{eventoId}/{nomeAnexo}', 'TrabalhoController@baixarAnexoTemp')->name('baixar.anexo.temp'); Route::get('/baixar/evento-temp/{nomeAnexo}', 'TrabalhoController@baixarEventoTemp' )->name('baixar.evento.temp'); Route::get('/baixar/documentosParticipante', 'ParticipanteController@baixarDocumento' )->name('baixar.documentosParticipante'); + Route::get('/baixar/anexoDocExtra/{id}', 'TrabalhoController@baixarAnexoDocExtra' )->name('baixar.anexo.docExtra'); }); Route::get('/baixar/edital/{id}', 'EventoController@baixarEdital' )->name('baixar.edital'); @@ -239,8 +240,8 @@ Route::prefix('usuarios')->name('admin.')->group(function(){ Route::get('/visualizarParecer', 'AdministradorController@visualizarParecer')->name('visualizarParecer'); Route::get('/visualizarParecerInterno', 'AdministradorController@visualizarParecerInterno')->name('visualizarParecerInterno'); Route::get('/pareceresProjetos', 'AdministradorController@pareceres' )->name('pareceres'); - Route::get('/analisarProjetos/{column?}', 'AdministradorController@analisar' )->name('analisar'); - Route::get('/analisarProposta', 'AdministradorController@analisarProposta' )->name('analisarProposta'); + Route::get('/analisarProjetos/{column?}', 'AdministradorController@analisar' )->name('analisar')->middleware('checkRoles:coordenador,administrador'); + Route::get('/analisarProposta', 'AdministradorController@analisarProposta' )->name('analisarProposta')->middleware('checkRoles:coordenador,administrador'); Route::get('/showProjetos', 'AdministradorController@showProjetos' )->name('showProjetos'); Route::get('/showResultados', 'AdministradorController@showResultados' )->name('showResultados')->middleware(['auth', 'verified']); });