Commit 47ad4d83 authored by Gabriel-31415's avatar Gabriel-31415
Browse files

validate participante

parent b83715ab
...@@ -32,6 +32,7 @@ use Illuminate\Support\Str; ...@@ -32,6 +32,7 @@ use Illuminate\Support\Str;
use App\Mail\SubmissaoTrabalho; use App\Mail\SubmissaoTrabalho;
use App\Mail\EventoCriado; use App\Mail\EventoCriado;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class TrabalhoController extends Controller class TrabalhoController extends Controller
{ {
...@@ -92,7 +93,7 @@ class TrabalhoController extends Controller ...@@ -92,7 +93,7 @@ class TrabalhoController extends Controller
// return view('proponente.cadastro'); // return view('proponente.cadastro');
// } // }
//$trabalho->proponentes()->save($proponente); //$trabalho->proponentes()->save($proponente);
//dd($proponente);
$trabalho = "trabalho"; $trabalho = "trabalho";
if($evento->inicioSubmissao > $mytime){ if($evento->inicioSubmissao > $mytime){
if($mytime >= $evento->fimSubmissao){ if($mytime >= $evento->fimSubmissao){
...@@ -117,6 +118,7 @@ class TrabalhoController extends Controller ...@@ -117,6 +118,7 @@ class TrabalhoController extends Controller
'linkLattesEstudante' => ['required', 'string', 'link_lattes'], 'linkLattesEstudante' => ['required', 'string', 'link_lattes'],
'nomeParticipante.*' => ['required', 'string'], 'nomeParticipante.*' => ['required', 'string'],
'emailParticipante.*' => ['required', 'string'], 'emailParticipante.*' => ['required', 'string'],
'funcaoParticipante' => ['required', 'array', 'size:'.$request->countParticipante],
'funcaoParticipante.*' => ['required', 'string'], 'funcaoParticipante.*' => ['required', 'string'],
'nomePlanoTrabalho.*' => ['nullable', 'string'], 'nomePlanoTrabalho.*' => ['nullable', 'string'],
//--Verificando se anexos já foram submetidos //--Verificando se anexos já foram submetidos
...@@ -129,7 +131,7 @@ class TrabalhoController extends Controller ...@@ -129,7 +131,7 @@ class TrabalhoController extends Controller
'anexoPlanilha' => [($request->anexoPlanilhaPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf,xls,xlsx', 'max:2048'], 'anexoPlanilha' => [($request->anexoPlanilhaPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf,xls,xlsx', 'max:2048'],
'anexoPlanoTrabalho.*' => ['nullable', 'file', 'mimes:pdf', 'max:2048'], 'anexoPlanoTrabalho.*' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
]); ]);
dd($request->all());
if(gettype($this->validarAnexosRascunho($request, $trabalho)) != 'integer'){ if(gettype($this->validarAnexosRascunho($request, $trabalho)) != 'integer'){
return $this->validarAnexosRascunho($request, $trabalho); return $this->validarAnexosRascunho($request, $trabalho);
} }
......
...@@ -7,6 +7,16 @@ ...@@ -7,6 +7,16 @@
<div class="card" style="margin-top:50px"> <div class="card" style="margin-top:50px">
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Enviar Projeto</h5> <h5 class="card-title">Enviar Projeto</h5>
@if($errors->any())
<div class="col-md-12" style="margin-top: 100px;">
<div class="alert alert-success">
<p>{{ $errors}}</p>
{{-- @foreach ($errors->all() as $key => $value)
<p>{{ $value}}</p>
@endforeach --}}
</div>
</div>
@endif
<p class="card-text"> <p class="card-text">
<form method="POST" name="formTrabalho" action="{{route('trabalho.store')}}" enctype="multipart/form-data"> <form method="POST" name="formTrabalho" action="{{route('trabalho.store')}}" enctype="multipart/form-data">
@csrf @csrf
...@@ -317,7 +327,7 @@ ...@@ -317,7 +327,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<label>Nome Completo*</label> <label>Nome Completo*</label>
<input type="text" style="margin-bottom:10px" class="form-control @error('nomeParticipante') is-invalid @enderror" name="nomeParticipante[]" placeholder="Nome" value="{{old('nomeParticipante.'.$i)}}"> <input type="text" style="margin-bottom:10px" class="form-control @error('nomeParticipante') is-invalid @enderror" name="nomeParticipante[]" placeholder="Nome" value="{{old('nomeParticipante.'.$i)}}">
@error('nomeParticipante') @error('nomeParticipante.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> <span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
...@@ -326,7 +336,7 @@ ...@@ -326,7 +336,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<label>E-mail*</label> <label>E-mail*</label>
<input type="email" style="margin-bottom:10px" class="form-control @error('emailParticipante') is-invalid @enderror" name="emailParticipante[]" placeholder="email" value="{{old('emailParticipante.'.$i)}}"> <input type="email" style="margin-bottom:10px" class="form-control @error('emailParticipante') is-invalid @enderror" name="emailParticipante[]" placeholder="email" value="{{old('emailParticipante.'.$i)}}">
@error('emailParticipante') @error('emailParticipante.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> <span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
...@@ -339,13 +349,12 @@ ...@@ -339,13 +349,12 @@
@foreach($funcaoParticipantes as $funcaoParticipante) @foreach($funcaoParticipantes as $funcaoParticipante)
<option @if(old('funcaoParticipante.'.$i)==$funcaoParticipante->id ) selected @endif value="{{$funcaoParticipante->id}}">{{$funcaoParticipante->nome}}</option> <option @if(old('funcaoParticipante.'.$i)==$funcaoParticipante->id ) selected @endif value="{{$funcaoParticipante->id}}">{{$funcaoParticipante->nome}}</option>
@endforeach @endforeach
</select>
@error('funcaoParticipante') @error('funcaoParticipante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> <span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@enderror @enderror
</select>
</div> </div>
</div> </div>
<h6 class="mb-1">Possui plano de trabalho?</h6> <h6 class="mb-1">Possui plano de trabalho?</h6>
...@@ -609,8 +618,8 @@ ...@@ -609,8 +618,8 @@
"@foreach($funcaoParticipantes as $funcaoParticipante)"+ "@foreach($funcaoParticipantes as $funcaoParticipante)"+
"<option value='{{$funcaoParticipante->id}}'>{{$funcaoParticipante->nome}}</option>"+ "<option value='{{$funcaoParticipante->id}}'>{{$funcaoParticipante->nome}}</option>"+
"@endforeach"+ "@endforeach"+
"@error('funcaoParticipante')" + "@error('funcaoParticipante'. $i)" +
"<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" + "<span class='invalid-feedback'" + " role='alert'" + " style='overflow: visible; display:block'>" +
"<strong>{{ $message }}</strong>" + "<strong>{{ $message }}</strong>" +
"</span>" + "</span>" +
"@enderror" + "@enderror" +
...@@ -663,39 +672,6 @@ ...@@ -663,39 +672,6 @@
"</div>"; "</div>";
} }
// function montarLinhaInputPlanoTrabalho(){
// return "<div class="+"row"+">"+
// "<div class="+"col-sm-4"+">"+
// "<label>Nome Completo</label>"+
// "<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+'form-control emailCoautor'+" name="+'nomePlanoTrabalho[]'+" placeholder="+"Nome"+" required>"+
// "</div>"+
// "<div class="+"col-sm-7" +">"+
// "<label for="+"nomeTrabalho"+">Anexo </label>"+
// "<div class="+"input-group"+">"+
// "<div class='input-group-prepend'>"+
// "<span class='input-group-text' id='inputGroupFileAddon01'>Selecione um arquivo:</span>"+
// "</div>"+
// "<div class='custom-file'>"+
// "<input type='file' class='custom-file-input' id='inputGroupFile01'"+
// "aria-describedby='inputGroupFileAddon01' name='anexoPlanoTrabalho[]'>"+
// "<label class='custom-file-label' id='custom-file-label' for='inputGroupFile01'>O arquivo deve ser no formato PDF de até 2mb.</label>"+
// "</div>"+
// "</div>"+
// "@error('arquivo')"+
// "<span class='invalid-feedback' role='alert' style='overflow: visible; display:block'>"+
// "<strong>{{ $message }}</strong>"+
// "</span>"+
// "@enderror"+
// "</div>"+
// "<div class="+"col-sm-1"+">"+
// "<a class="+"deletePlano"+">"+
// "<img src="+"/img/icons/user-times-solid.svg"+" style="+"width:25px;margin-top:35px"+">"+
// "</a>"+
// "</div>"+
// "</div>";
// }
function areas() { function areas() {
var grandeArea = $('#grandeArea').val(); var grandeArea = $('#grandeArea').val();
......
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