Unverified Commit a3bbb875 authored by José Rômulo's avatar José Rômulo Committed by GitHub
Browse files

Merge pull request #174 from J-Romulo/master

Adicionando documentos complementares para substituição de participante
parents 23deecef 552d76b6
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Evento; use App\Evento;
use App\Trabalho; use App\Trabalho;
...@@ -75,4 +76,13 @@ class ParticipanteController extends Controller ...@@ -75,4 +76,13 @@ class ParticipanteController extends Controller
$funcao->delete(); $funcao->delete();
return redirect()->back()->with(['mensagem' => 'Função de participante deletada com sucesso!']); return redirect()->back()->with(['mensagem' => 'Função de participante deletada com sucesso!']);
} }
public function baixarDocumento(Request $request) {
if (Storage::disk()->exists($request->pathDocumento)) {
ob_end_clean();
return Storage::download($request->pathDocumento);
}
return abort(404);
}
} }
...@@ -1465,6 +1465,11 @@ class TrabalhoController extends Controller ...@@ -1465,6 +1465,11 @@ class TrabalhoController extends Controller
$participante = Participante::create($data); $participante = Participante::create($data);
} }
$pasta = 'participantes/' . $participante->id;
$participante->anexoTermoCompromisso = Storage::putFileAs($pasta, $request->anexoTermoCompromisso, "Termo_de_Compromisso.pdf");
$participante->anexoComprovanteMatricula = Storage::putFileAs($pasta, $request->anexoComprovanteMatricula, "Comprovante_de_Matricula.pdf");
$participante->anexoLattes = Storage::putFileAs($pasta, $request->anexoCurriculoLattes, "Curriculo_Lattes.pdf");
$user->participantes()->save($participante); $user->participantes()->save($participante);
//$trabalho->participantes()->save($participante); //$trabalho->participantes()->save($participante);
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterTableParticipantes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('participantes', function (Blueprint $table) {
$table->string('anexoTermoCompromisso')->nullable();
$table->string('anexoComprovanteMatricula')->nullable();
$table->string('anexoLattes')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('participantes', function (Blueprint $table) {
$table->dropColumn('anexoTermoCompromisso');
$table->dropColumn('anexoComprovanteMatricula');
$table->dropColumn('anexoLattes');
});
}
}
...@@ -269,6 +269,18 @@ ...@@ -269,6 +269,18 @@
$("#caracsRestantes"+idInput).html("Caracteres restantes: " + (maxlength - this.value.length)); $("#caracsRestantes"+idInput).html("Caracteres restantes: " + (maxlength - this.value.length));
} }
}); });
$("input[type='file']").on("change", function () {
if(this.files[0].type.split('/')[1] == "pdf") {
if(this.files[0].size > 20000000){
alert("O arquivo possui o tamanho superior a 2MB!");
$(this).val('');
}
}else{
alert("O arquivo não é de tipo PDF!");
$(this).val('');
}
});
}); });
function manterPlano(checkBox){ function manterPlano(checkBox){
...@@ -305,6 +317,7 @@ ...@@ -305,6 +317,7 @@
inputsForm.push(document.getElementById('rg'+idParticipante)); inputsForm.push(document.getElementById('rg'+idParticipante));
inputsForm.push(document.getElementById('cep'+idParticipante)); inputsForm.push(document.getElementById('cep'+idParticipante));
inputsForm.push(document.getElementById('celular'+idParticipante)); inputsForm.push(document.getElementById('celular'+idParticipante));
inputsForm.push(document.getElementById('linkLattes'+idParticipante));
inputsForm.push(document.getElementById('estado'+idParticipante)); inputsForm.push(document.getElementById('estado'+idParticipante));
inputsForm.push(document.getElementById('cidade'+idParticipante)); inputsForm.push(document.getElementById('cidade'+idParticipante));
inputsForm.push(document.getElementById('bairro'+idParticipante)); inputsForm.push(document.getElementById('bairro'+idParticipante));
...@@ -330,6 +343,9 @@ ...@@ -330,6 +343,9 @@
inputsForm.push(document.getElementById('ordem'+idParticipante)); inputsForm.push(document.getElementById('ordem'+idParticipante));
inputsForm.push(document.getElementById('media'+idParticipante)); inputsForm.push(document.getElementById('media'+idParticipante));
inputsForm.push(document.getElementById('anexoTermoCompromisso'+idParticipante));
inputsForm.push(document.getElementById('anexoComprovanteMatricula'+idParticipante));
if(checkboxInput.checked){ if(checkboxInput.checked){
inputsForm.forEach(function(item,indice,array){ inputsForm.forEach(function(item,indice,array){
item.setAttribute('disabled', 'disabled'); item.setAttribute('disabled', 'disabled');
......
...@@ -497,7 +497,42 @@ ...@@ -497,7 +497,42 @@
@endcomponent @endcomponent
</div> </div>
<div class="col-12 mb-3"> <div class="col-md-12">
<h5>Documentação Complementar</h5>
</div>
<div class="col-6">
@component('componentes.input', ['label' => 'Termo de Compromisso (.pdf)'])
<input type="file" class="input-group-text" value="" name="anexoTermoCompromisso" accept=".pdf" placeholder="Anexo do Termo de Compromisso" id="anexoTermoCompromisso{{$participante->id}}" required />
@error('anexoTermoCompromisso')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
@endcomponent
</div>
<div class="col-6">
@component('componentes.input', ['label' => 'Comprovante de Matrícula (.pdf)'])
<input type="file" class="input-group-text" value="" name="anexoComprovanteMatricula" accept=".pdf" placeholder="Anexo do Comprovante de Matrícula" id="anexoComprovanteMatricula{{$participante->id}}" required />
@error('anexoComprovanteMatrícula')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
@endcomponent
</div>
<div class="col-6">
@component('componentes.input', ['label' => 'Currículo Lattes (.pdf)'])
<input type="file" class="input-group-text" value="" name="anexoCurriculoLattes" accept=".pdf" placeholder="Anexo do Currículo Lattes" id="anexoCurriculoLattes{{$participante->id}}" required />
@error('anexoCurriculoLattes')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
@endcomponent
</div>
<div class="col-12 mb-3 mt-3">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" value="check" id="{{$participante->id}}" name="manterPlanoCheck" onchange="manterPlano(this)"> <input class="form-check-input" type="checkbox" value="check" id="{{$participante->id}}" name="manterPlanoCheck" onchange="manterPlano(this)">
<label class="form-check-label" for="{{$participante->id}}"> <label class="form-check-label" for="{{$participante->id}}">
...@@ -530,15 +565,10 @@ ...@@ -530,15 +565,10 @@
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
@error('anexoPlanoTrabalho')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
@endcomponent @endcomponent
</div> </div>
<div class="col-12"> <div class="col-12 mt-4">
<button type="submit" class="btn btn-success" id="idButtonSubmitParticipante">Salvar</button> <button type="submit" class="btn btn-success" id="idButtonSubmitParticipante">Salvar</button>
</div> </div>
......
...@@ -175,8 +175,16 @@ ...@@ -175,8 +175,16 @@
</div> </div>
</div> </div>
@else @else
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-md-12 mt-3"> <div class="col-md-12 mt-3">
...@@ -332,6 +340,61 @@ ...@@ -332,6 +340,61 @@
@endcomponent @endcomponent
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-12">
<h5>Documentos Complementares</h5>
</div>
</div>
<div class="row">
<div class="col-5">
@component('componentes.input', ['label' => 'Termo de Compromisso (.pdf)'])
@endcomponent
</div>
@if($subs->participanteSubstituto->anexoTermoCompromisso)
<div class="col-1">
<a href="{{ route('baixar.documentosParticipante', ['pathDocumento' => $subs->participanteSubstituto->anexoTermoCompromisso]) }}"><i class="fas fa-file-pdf fa-2x"></i></a>
</div>
@else
<div class="col-1 text-danger">
<p><i class="fas fa-times-circle fa-2x"></i></p>
</div>
@endif
<div class="col-5">
@component('componentes.input', ['label' => 'Comprovante de Matrícula (.pdf)'])
@endcomponent
</div>
@if($subs->participanteSubstituto->anexoComprovanteMatricula)
<div class="col-1">
<a href="{{ route('baixar.documentosParticipante', ['pathDocumento' => $subs->participanteSubstituto->anexoComprovanteMatricula]) }}"><i class="fas fa-file-pdf fa-2x"></i></a>
</div>
@else
<div class="col-1 text-danger">
<p><i class="fas fa-times-circle fa-2x"></i></p>
</div>
@endif
</div>
<div class="row">
<div class="col-5">
@component('componentes.input', ['label' => 'Curriculo Lattes (.pdf)'])
@endcomponent
</div>
@if($subs->participanteSubstituto->anexoLattes)
<div class="col-1">
<a href="{{ route('baixar.documentosParticipante', ['pathDocumento' => $subs->participanteSubstituto->anexoLattes]) }}"><i class="fas fa-file-pdf fa-2x"></i></a>
</div>
@else
<div class="col-1 text-danger">
<p><i class="fas fa-times-circle fa-2x"></i></p>
</div>
@endif
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h5>Plano de trabalho</h5> <h5>Plano de trabalho</h5>
......
...@@ -69,11 +69,7 @@ ...@@ -69,11 +69,7 @@
@if(!is_null(Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == true ) @if(!is_null(Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == true )
<a href="{{ route('avaliador.visualizarTrabalho', ['evento_id' => $evento->id]) }}" class="dropdown-item"> <a href="{{ route('avaliador.visualizarTrabalho', ['evento_id' => $evento->id]) }}" class="dropdown-item">
<img src="{{asset('img/icons/eye-regular.svg')}}" class="icon-card" alt=""> <img src="{{asset('img/icons/eye-regular.svg')}}" class="icon-card" alt="">
Projetos para avaliar Avaliar Propostas
</a>
<a href="{{ route('avaliador.listarPlanos', ['evento_id' => $evento->id]) }}" class="dropdown-item">
<img src="{{asset('img/icons/eye-regular.svg')}}" class="icon-card" alt="">
Planos para avaliar
</a> </a>
@elseif(!is_null(Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == false) @elseif(!is_null(Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite) && Auth::user()->avaliadors->eventos->where('id', $evento->id)->first()->pivot->convite == false)
<button disabled="disabled" class="dropdown-item"> <button disabled="disabled" class="dropdown-item">
......
...@@ -156,6 +156,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){ ...@@ -156,6 +156,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){
Route::get('/baixar/anexoGrupoPesquisa/{id}', 'TrabalhoController@baixarAnexoGrupoPesquisa' )->name('baixar.anexoGrupoPesquisa'); Route::get('/baixar/anexoGrupoPesquisa/{id}', 'TrabalhoController@baixarAnexoGrupoPesquisa' )->name('baixar.anexoGrupoPesquisa');
Route::get('/baixar/anexo-temp/{eventoId}/{nomeAnexo}', 'TrabalhoController@baixarAnexoTemp')->name('baixar.anexo.temp'); 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/evento-temp/{nomeAnexo}', 'TrabalhoController@baixarEventoTemp' )->name('baixar.evento.temp');
Route::get('/baixar/documentosParticipante', 'ParticipanteController@baixarDocumento' )->name('baixar.documentosParticipante');
}); });
Route::get('/baixar/edital/{id}', 'EventoController@baixarEdital' )->name('baixar.edital'); Route::get('/baixar/edital/{id}', 'EventoController@baixarEdital' )->name('baixar.edital');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment