Commit 41cbc4b1 authored by Guilherme Silva's avatar Guilherme Silva
Browse files

Criação de documentação complementar

parent 2baf40f2
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class DocumentacaoComplementar extends Model
{
protected $fillable = [
'termoCompromisso',
'comprovanteMatricula',
'linkLattes',
'pdfLattes',
'participante_id',
];
public function participante(){
return $this->belongsTo(Participante::class, 'participante_id', 'id');
}
}
<?php
namespace App\Http\Controllers;
use App\Arquivo;
use App\documentacaoComplementar;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
class DocumentacaoComplementarController extends Controller
{
public function criar(Request $request)
{
if($request->docId != null){
$docComp = DocumentacaoComplementar::find($request->docId);
}else{
$docComp = new DocumentacaoComplementar;
}
$pasta = 'docComplementar/' . Auth::user()->id;
$docComp->termoCompromisso = Storage::putFileAs($pasta, $request->termoCompromisso, "Termo De Compromisso.pdf");
$docComp->comprovanteMatricula = Storage::putFileAs($pasta, $request->comprovanteMatricula, "Comprovante De Matricula.pdf");
$docComp->pdfLattes = Storage::putFileAs($pasta, $request->pdfLattes, "Lattes.pdf");
$docComp->termoCompromisso = Storage::putFileAs($pasta, $request->termoCompromisso, "TermoDeCompromisso.pdf");
$docComp->participante_id = $request->partcipanteId;
$docComp->linkLattes = $request->linkLattes;
if($request->docId != null){
$docComp->update();
}else{
$docComp->save();
}
return redirect()->back()->with(['sucesso' => "Documentação complementar enviada com sucesso"]);
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDocumentacaoComplementarsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('documentacao_complementars', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('termoCompromisso');
$table->string('comprovanteMatricula');
$table->string('pdfLattes');
$table->string('linkLattes');
$table->integer('participante_id')->nullable();
$table->foreign('participante_id')->references('id')->on('participantes');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('documentacao_complementars');
}
}
@extends('layouts.app')
@section('content')
<div class="container">
@if (session('sucesso'))
<div class="alert alert-success" role="alert">
{{ session('sucesso') }}
</div>
@endif
<div class="row justify-content-center titulo-menu mb-0">
<h4>Documentos Complementares </h4>
</div>
<div class="card-body" style="width: 100% !important;margin: auto;">
<table class="table table-bordered table-hover" style="overflow-x: visible; white-space: nowrap; margin-bottom:0px">
<thead>
<tr>
<th scope="col" style="width:200px; text-align: center;">Edital</th>
<th scope="col" style="width:200px; text-align: center;">Projeto</th>
<th scope="col" style="width:200px; text-align: center;">Status Projeto</th>
<th scope="col" style="width:200px; text-align: center;">Discente</th>
<th scope="col" style="width:200px; text-align: center;">Documentação Complementar</th>
</tr>
</thead>
@foreach($trabalho->participantes as $participante)
<tbody>
<td style="text-align: center;" title="{{$trabalho->evento->nome}}">{{$trabalho->evento->nome}}</td>
<td style="text-align: center;" title="{{$trabalho->titulo}}">{{$trabalho->titulo}}</td>
<td style="text-align: center; text-transform: capitalize;" >{{$trabalho->status}}</td>
<td style="text-align: center;" title="{{$participante->user->name}}">{{$participante->user->name}}</td>
<td style="text-align: center;">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalConfirm{{$participante->id}}" @if($trabalho->status!="aprovado")disabled="disabled" @endif>
@if($participante->documentacaoComplementar==null)
Pendente
@else
Visualizar
@endif
</button>
</td>
</tbody>
<div class="modal fade" id="modalConfirm{{$participante->id}}" tabindex="-1" role="dialog"
aria-labelledby="modalConfirmLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="modalConfirmLabel" align="center">
Documentação Complementar</h4>
</div>
<form id="formDocComplementar" method="post" action="{{route('docComplementar.enviar')}}" enctype="multipart/form-data">
@csrf
<input type="hidden" value="{{$participante->id}}" name="partcipanteId">
<div class="row col-md-12">
<div class="col-md-6">
<label class="control-label ">Termo de Compromisso</label>
<br>
<input type="file" class="input-group-text" value="" name="termoCompromisso" accept=".pdf" id="termoCompromisso{{$participante->id}}" required
/>
@error('termoCompromisso')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
<br>
</div>
<div class="col-md-6">
<label class="control-label ">Comprovante de Matricula</label>
<br>
<input type="file" class="input-group-text" value="" name="comprovanteMatricula" accept=".pdf" id="comprovanteMatricula{{$participante->id}}" required/>
@error('comprovanteMatricula')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
<br>
</div>
<div class="col-md-6">
<label class="control-label ">PDF Lattes</label>
<br>
<input type="file" class="input-group-text" value="" name="pdfLattes" accept=".pdf" id="pdfLattes{{$participante->id}}"
required/>
@error('pdfLattes')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-md-6">
<label class="control-label ">Link Lattes</label>
<br>
<input type="text" class="input-group-text col-md-12" name="linkLattes" placeholder="Link Lattes" id="linkLattes{{$participante->id}}"
required/>
@error('linkLattes')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<br>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">
Cancelar
</button>
<button type="submit" href="" id="btnSubmit" class="btn btn-info">
Salvar
</button>
</div>
</form>
</div>
</div>
</div>
@endforeach
</table>
</div>
</div>
<style>
td {
max-width: 25ch;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
@endsection
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