Commit c5ba1744 authored by GuilhermeGz's avatar GuilhermeGz
Browse files

Adição de arquivo tutorial para avaliadores na criação/edição do edital

parent efc95cd6
...@@ -19,7 +19,7 @@ class Evento extends Model ...@@ -19,7 +19,7 @@ class Evento extends Model
'dt_inicioRelatorioParcial', 'dt_fimRelatorioParcial', 'dt_inicioRelatorioFinal', 'dt_fimRelatorioFinal', 'dt_inicioRelatorioParcial', 'dt_fimRelatorioParcial', 'dt_inicioRelatorioFinal', 'dt_fimRelatorioFinal',
'formAvaliacaoExterno', 'formAvaliacaoInterno', 'formAvaliacaoExterno', 'formAvaliacaoInterno',
'cotaDoutor', 'inicioProjeto', 'fimProjeto', 'cotaDoutor', 'inicioProjeto', 'fimProjeto',
'formAvaliacaoRelatorio' 'formAvaliacaoRelatorio', 'docTutorial'
]; ];
public function endereco(){ public function endereco(){
......
...@@ -94,6 +94,11 @@ class EventoController extends Controller ...@@ -94,6 +94,11 @@ class EventoController extends Controller
'modeloDocumento' => ['file', 'max:2048', new ExcelRule($request->file('modeloDocumento'))], 'modeloDocumento' => ['file', 'max:2048', new ExcelRule($request->file('modeloDocumento'))],
]); ]);
} }
if(isset($request->docTutorial)){
$request->validate([
'docTutorial' => ['file', 'max:2048', new ExcelRule($request->file('docTutorial'))],
]);
}
//--Salvando os anexos da submissão temporariamente //--Salvando os anexos da submissão temporariamente
$evento = $this->armazenarAnexosTemp($request); $evento = $this->armazenarAnexosTemp($request);
...@@ -245,6 +250,15 @@ class EventoController extends Controller ...@@ -245,6 +250,15 @@ class EventoController extends Controller
$evento->formAvaliacaoRelatorio = $path . $nome; $evento->formAvaliacaoRelatorio = $path . $nome;
} }
if(isset($request->docTutorial)){
$docTutorial = $request->docTutorial;
$extension = $docTutorial->extension();
$path = 'docTutorial/' . $evento->id . '/';
$nome = "documento tutorial" . "." . $extension;
Storage::putFileAs($path, $docTutorial, $nome);
$evento->docTutorial = $path . $nome;
}
$evento->update(); $evento->update();
...@@ -290,6 +304,12 @@ class EventoController extends Controller ...@@ -290,6 +304,12 @@ class EventoController extends Controller
$eventoTemp->formAvaliacaoRelatorio = Storage::putFileAs($pasta, $request->pdfFormAvalRelatorio, 'formulario de avaliação do relatorio.pdf'); $eventoTemp->formAvaliacaoRelatorio = Storage::putFileAs($pasta, $request->pdfFormAvalRelatorio, 'formulario de avaliação do relatorio.pdf');
} }
if(!(is_null($request->docTutorial)) ) {
$extension = $request->docTutorial->extension();
$pasta = 'docTutorial/' . $eventoTemp->id;
$nome = "documento tutorial" . "." . $extension;
$eventoTemp->docTutorial = Storage::putFileAs($pasta, $request->docTutorial, $nome);
}
$eventoTemp->update(); $eventoTemp->update();
...@@ -434,6 +454,7 @@ class EventoController extends Controller ...@@ -434,6 +454,7 @@ class EventoController extends Controller
'pdfFormAvalRelatorio' => ['file', 'mimes:pdf', 'max:2048'], 'pdfFormAvalRelatorio' => ['file', 'mimes:pdf', 'max:2048'],
'inicioProjeto' => ['required', 'date'], 'inicioProjeto' => ['required', 'date'],
'fimProjeto' => ['required', 'date'], 'fimProjeto' => ['required', 'date'],
'docTutorial' => ['file', 'mimes:zip,doc,docx,pdf', 'max:2048'],
]); ]);
} }
...@@ -460,6 +481,7 @@ class EventoController extends Controller ...@@ -460,6 +481,7 @@ class EventoController extends Controller
'pdfFormAvalRelatorio' => ['file', 'mimes:pdf', 'max:2048'], 'pdfFormAvalRelatorio' => ['file', 'mimes:pdf', 'max:2048'],
'inicioProjeto' => ['required', 'date', 'after:resultado_final'], 'inicioProjeto' => ['required', 'date', 'after:resultado_final'],
'fimProjeto' => ['required', 'date', 'after:inicioProjeto'], 'fimProjeto' => ['required', 'date', 'after:inicioProjeto'],
'docTutorial' => ['file', 'mimes:zip,doc,docx,pdf', 'max:2048'],
]); ]);
$evento->nome = $request->nome; $evento->nome = $request->nome;
...@@ -511,6 +533,15 @@ class EventoController extends Controller ...@@ -511,6 +533,15 @@ class EventoController extends Controller
$evento->formAvaliacaoExterno = $path . $nome; $evento->formAvaliacaoExterno = $path . $nome;
} }
if($request->docTutorial != null){
$docTutorial = $request->docTutorial;
$extension = $docTutorial->extension();
$path = 'docTutorial/' . $evento->id . '/';
$nome = "documento tutorial" . "." . $extension;
Storage::putFileAs($path, $docTutorial, $nome);
$evento->docTutorial = $path . $nome;
}
if(isset($request->pdfFormAvalRelatorio)){ if(isset($request->pdfFormAvalRelatorio)){
$pdfFormAvalRelatorio = $request->pdfFormAvalRelatorio; $pdfFormAvalRelatorio = $request->pdfFormAvalRelatorio;
$extension = $pdfFormAvalRelatorio->extension(); $extension = $pdfFormAvalRelatorio->extension();
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDocTutorialToEventosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('eventos', function (Blueprint $table) {
Schema::table('eventos', function (Blueprint $table) {
$table->string('docTutorial')->nullable();
});
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('eventos', function (Blueprint $table) {
$table->dropColumn('docTutorial');
});
}
}
...@@ -452,6 +452,22 @@ ...@@ -452,6 +452,22 @@
@enderror @enderror
</div> </div>
</div> </div>
<div class="col-sm-12">
<div class="form-group">
<label for="docTutorial">Documento auxiliar para Avaliador:</label>
@if(old('docTutorialPreenchido') != null)
<a id="docTutorialTemp" href="{{ route('baixar.evento.temp', ['nomeAnexo' => 'docTutorial' ])}}">Arquivo atual</a>
@endif
<input type="hidden" id="docTutorialPreenchido" name="docTutorialPreenchido" value="{{ old('docTutorialPreenchido') }}" >
<input type="file" accept=".pdf,.docx,.doc,.zip" class="form-control-file pdf @error('docTutorial') is-invalid @enderror" name="docTutorial" value="{{ old('docTutorial') }}" id="docTutorial" onchange="exibirAnexoTemp(this)">
<small>O arquivo selecionado deve ser de até 2mb.</small>
@error('docTutorial')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div> </div>
<div class="row justify-content-center" style="margin: 20px 0 20px 0"> <div class="row justify-content-center" style="margin: 20px 0 20px 0">
......
...@@ -429,6 +429,27 @@ ...@@ -429,6 +429,27 @@
@enderror @enderror
</div> </div>
</div> </div>
<div class="col-sm-12">
<div class="form-group">
<label for="pdfEdital">Documento auxiliar para Avaliador:</label>
@if($evento->docTutorial != null)
<a href="{{route('download', ['file' => $evento->docTutorial])}}" target="_new" style="font-size: 20px; color: #114048ff;" >
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:20px">
</a>
@else
<a>
<i class="fas fa-times-circle fa-2x" style="color:red; font-size:25px"></i>
</a>
@endif
<input type="file" class="form-control-file @error('docTutorial') is-invalid @enderror" name="docTutorial" value="{{ old('docTutorial') }}" id="docTutorial">
<small>O arquivo selecionado deve ser no formato PDF de até 2mb.</small>
@error('docTutorial')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div> </div>
<div class="row justify-content-center" style="margin: 20px 0 20px 0"> <div class="row justify-content-center" style="margin: 20px 0 20px 0">
......
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