Unverified Commit edb8bac8 authored by GuilhermeGz's avatar GuilhermeGz Committed by GitHub
Browse files

Merge pull request #224 from GuilhermeGz/master

Atualização da semana 
parents bf9c24ab a3cd5ff7
...@@ -19,7 +19,7 @@ class Avaliador extends Model ...@@ -19,7 +19,7 @@ class Avaliador extends Model
return $this->belongsTo('App\User'); return $this->belongsTo('App\User');
} }
public function trabalhos(){ public function trabalhos(){
return $this->belongsToMany('App\Trabalho')->withPivot('status', 'AnexoParecer', 'parecer', 'recomendacao', 'created_at','pontuacao'); return $this->belongsToMany('App\Trabalho')->withPivot('status', 'AnexoParecer', 'parecer', 'recomendacao', 'created_at','pontuacao','acesso');
} }
public function planoTrabalhos(){ public function planoTrabalhos(){
return $this->belongsToMany('App\Arquivo', 'avaliadors_plano_trabalho')->withPivot('status', 'AnexoParecer', 'parecer', 'recomendacao', 'created_at'); return $this->belongsToMany('App\Arquivo', 'avaliadors_plano_trabalho')->withPivot('status', 'AnexoParecer', 'parecer', 'recomendacao', 'created_at');
......
...@@ -57,7 +57,7 @@ class AdministradorController extends Controller ...@@ -57,7 +57,7 @@ class AdministradorController extends Controller
public function editais(){ public function editais(){
//$admin = Administrador::with('user')->where('user_id', Auth()->user()->id)->first(); //$admin = Administrador::with('user')->where('user_id', Auth()->user()->id)->first();
//$eventos = Evento::where('coordenadorId',$admin->id )->get(); //$eventos = Evento::where('coordenadorId',$admin->id )->get();
$eventos = Evento::all()->sortBy('nome'); $eventos = Evento::all()->sortByDesc('created_at');
return view('administrador.editais', ['eventos'=> $eventos]); return view('administrador.editais', ['eventos'=> $eventos]);
} }
...@@ -393,7 +393,7 @@ class AdministradorController extends Controller ...@@ -393,7 +393,7 @@ class AdministradorController extends Controller
$validated = $request->validate([ $validated = $request->validate([
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'tipo' => ['required'], 'tipo' => ['required'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'email' => ['required', 'string', 'email', 'max:255'],
'instituicao' => ['required_if:instituicaoSelect,Outra', 'max:255'], 'instituicao' => ['required_if:instituicaoSelect,Outra', 'max:255'],
'instituicaoSelect' => ['required_without:instituicao'], 'instituicaoSelect' => ['required_without:instituicao'],
'celular' => ($request['celular']!=null ? 'required|string|telefone' : 'nullable'), 'celular' => ($request['celular']!=null ? 'required|string|telefone' : 'nullable'),
...@@ -611,9 +611,25 @@ class AdministradorController extends Controller ...@@ -611,9 +611,25 @@ class AdministradorController extends Controller
} }
public function removerProjAval(Request $request){ public function removerProjAval(Request $request){
//Acesso 1 = Ad Hoc, 2 - Interno, 3 - Interno e Ad Hoc
$aval = Avaliador::where('id', $request->avaliador_id)->first(); $aval = Avaliador::where('id', $request->avaliador_id)->first();
$trabalho = Trabalho::where('id', $request->trabalho_id)->first(); $trabalho = Trabalho::where('id', $request->trabalho_id)->first();
if($request->flag == 0){
if($aval->tipo == "Interno" && $aval->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 3){
$aval->trabalhos()
->updateExistingPivot($trabalho->id,['acesso'=>2]);
}else{
$aval->trabalhos()->detach($trabalho); $aval->trabalhos()->detach($trabalho);
}
}else{
if($aval->tipo == "Interno" && $aval->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 3){
$aval->trabalhos()
->updateExistingPivot($trabalho->id,['acesso'=>1]);
}else{
$aval->trabalhos()->detach($trabalho);
}
}
if($trabalho->status === 'avaliado'){ if($trabalho->status === 'avaliado'){
$trabalho->status = 'submetido'; $trabalho->status = 'submetido';
...@@ -642,26 +658,48 @@ class AdministradorController extends Controller ...@@ -642,26 +658,48 @@ class AdministradorController extends Controller
$trabalho = Trabalho::where('id', $request->trabalho_id)->first(); $trabalho = Trabalho::where('id', $request->trabalho_id)->first();
$evento = Evento::where('id', $request->evento_id)->first(); $evento = Evento::where('id', $request->evento_id)->first();
if($request->avaliadores_internos_id == null){ if($request->avaliadores_internos_id != null){
$avaliadoresInternos = []; foreach ($request->avaliadores_internos_id as $avaliador) {
$aval = Avaliador::find($avaliador);
if($aval->trabalhos()->where("trabalho_id",$trabalho->id)->first() != null){
$aval->trabalhos()
->updateExistingPivot($trabalho->id,['acesso'=>3]);
}else{ }else{
$avaliadoresInternos = $request->avaliadores_internos_id; $trabalho->avaliadors()->attach($aval,['acesso'=>2]);
$evento->avaliadors()->syncWithoutDetaching($aval);
}
} }
}
if($request->avaliadores_externos_id != null){
foreach ($request->avaliadores_externos_id as $avaliador) {
if($request->avaliadores_externos_id == null){ $aval = Avaliador::find($avaliador);
$avaliadoresExternos = []; if(Avaliador::where('id',$avaliador)->where('tipo',"Interno")->count()>0){
if($aval->trabalhos()->where("trabalho_id",$trabalho->id)->first() != null){
$aval->trabalhos()
->updateExistingPivot($trabalho->id,['acesso'=>3]);
}else{
$trabalho->avaliadors()->attach($aval,['acesso'=>1]);
$evento->avaliadors()->syncWithoutDetaching($aval);
}
}else{ }else{
$avaliadoresExternos = $request->avaliadores_externos_id; $trabalho->avaliadors()->attach($aval,['acesso'=>1]);
$evento->avaliadors()->syncWithoutDetaching($aval);
} }
$idsAvaliadores = array_merge($avaliadoresInternos, $avaliadoresExternos); }
if($idsAvaliadores == null){ }
if($request->avaliadores_externos_id == null & $request->avaliadores_internos_id == null ){
redirect()->back()->with(['error' => 'Selecione ao menos um avaliador.', 'trabalho' => $trabalho->id]); redirect()->back()->with(['error' => 'Selecione ao menos um avaliador.', 'trabalho' => $trabalho->id]);
} }
$avaliadores = Avaliador::whereIn('id', $idsAvaliadores)->get();
$trabalho->avaliadors()->attach($avaliadores); $avaliadores = Avaliador::whereIn('id', (array)$request->avaliadores_externos_id)
$evento->avaliadors()->syncWithoutDetaching($avaliadores); ->orWhereIn('id', (array)$request->avaliadores_internos_id)->get();
$trabalho->save(); $trabalho->save();
foreach ($avaliadores as $avaliador){ foreach ($avaliadores as $avaliador){
$userTemp = User::find($avaliador->user->id); $userTemp = User::find($avaliador->user->id);
......
...@@ -71,11 +71,22 @@ class AvaliadorController extends Controller ...@@ -71,11 +71,22 @@ class AvaliadorController extends Controller
$user = User::find(Auth::user()->id); $user = User::find(Auth::user()->id);
$evento = Evento::where('id', $request->evento_id)->first(); $evento = Evento::where('id', $request->evento_id)->first();
$trabalhos = $user->avaliadors->where('user_id',$user->id)->first()->trabalhos->where('evento_id', $request->evento_id); //$trabalhos = $user->avaliadors->where('user_id',$user->id)->first()->trabalhos->where('evento_id', $request->evento_id);
$trabalhosEx = [];
$trabalhosIn = [];
$aval = $user->avaliadors->where('user_id',$user->id)->first();
foreach ($aval->trabalhos->where('evento_id',$evento->id) as $trab){
if($aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 2 || $aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 3 ){
array_push($trabalhosIn,$aval->trabalhos()->where("trabalho_id",$trab->id)->first());
}
if ($aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 1 || $aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 3){
array_push($trabalhosEx,$aval->trabalhos()->where("trabalho_id",$trab->id)->first());
}
}
//dd(); //dd();
return view('avaliador.listarTrabalhos', ['trabalhos'=>$trabalhos, 'evento'=>$evento]); return view('avaliador.listarTrabalhos', ['trabalhosEx'=>$trabalhosEx,'trabalhosIn'=>$trabalhosIn, 'evento'=>$evento]);
} }
...@@ -121,7 +132,18 @@ class AvaliadorController extends Controller ...@@ -121,7 +132,18 @@ class AvaliadorController extends Controller
public function enviarParecerInterno(Request $request){ public function enviarParecerInterno(Request $request){
$user = User::find(Auth::user()->id); $user = User::find(Auth::user()->id);
$evento = Evento::where('id', $request->evento_id)->first(); $evento = Evento::where('id', $request->evento_id)->first();
$trabalhos = $user->avaliadors->where('user_id',$user->id)->first()->trabalhos->where('evento_id', $request->evento_id); //$trabalhos = $user->avaliadors->where('user_id',$user->id)->first()->trabalhos->where('evento_id', $request->evento_id);
$trabalhosEx = [];
$trabalhosIn = [];
$aval = $user->avaliadors->where('user_id',$user->id)->first();
foreach ($aval->trabalhos->where('evento_id',$evento->id) as $trab){
if($aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 2 || $aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 3 ){
array_push($trabalhosIn,$aval->trabalhos()->where("trabalho_id",$trab->id)->first());
}
if ($aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 1 || $aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 3){
array_push($trabalhosEx,$aval->trabalhos()->where("trabalho_id",$trab->id)->first());
}
}
$avaliador = $user->avaliadors->where('user_id',$user->id)->first(); $avaliador = $user->avaliadors->where('user_id',$user->id)->first();
$trabalho = $avaliador->trabalhos->find($request->trabalho_id); $trabalho = $avaliador->trabalhos->find($request->trabalho_id);
$parecerInterno = ParecerInterno::where([['avaliador_id',$avaliador->id],['trabalho_id',$trabalho->id]])->first(); $parecerInterno = ParecerInterno::where([['avaliador_id',$avaliador->id],['trabalho_id',$trabalho->id]])->first();
...@@ -168,7 +190,7 @@ class AvaliadorController extends Controller ...@@ -168,7 +190,7 @@ class AvaliadorController extends Controller
$parecerInterno->update(); $parecerInterno->update();
} }
return view('avaliador.listarTrabalhos', ['trabalhos'=>$trabalhos, 'evento'=>$evento]); return view('avaliador.listarTrabalhos', ['trabalhosEx'=>$trabalhosEx,'trabalhosIn'=>$trabalhosIn, 'evento'=>$evento]);
} }
public function parecerPlano(Request $request){ public function parecerPlano(Request $request){
...@@ -188,7 +210,18 @@ class AvaliadorController extends Controller ...@@ -188,7 +210,18 @@ class AvaliadorController extends Controller
$evento = Evento::find($request->evento_id); $evento = Evento::find($request->evento_id);
$trabalhos = $user->avaliadors->where('user_id',$user->id)->first()->trabalhos->where('evento_id', $request->evento_id); //$trabalhos = $user->avaliadors->where('user_id',$user->id)->first()->trabalhos->where('evento_id', $request->evento_id);
$trabalhosEx = [];
$trabalhosIn = [];
$aval = $user->avaliadors->where('user_id',$user->id)->first();
foreach ($aval->trabalhos->where('evento_id',$evento->id) as $trab){
if($aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 2 || $aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 3 ){
array_push($trabalhosIn,$aval->trabalhos()->where("trabalho_id",$trab->id)->first());
}
if ($aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 1 || $aval->trabalhos()->where("trabalho_id",$trab->id)->first()->pivot->acesso == 3){
array_push($trabalhosEx,$aval->trabalhos()->where("trabalho_id",$trab->id)->first());
}
}
$avaliador = $user->avaliadors->where('user_id',$user->id)->first(); $avaliador = $user->avaliadors->where('user_id',$user->id)->first();
$trabalho = $avaliador->trabalhos->find($request->trabalho_id); $trabalho = $avaliador->trabalhos->find($request->trabalho_id);
$trabalho->status = 'avaliado'; $trabalho->status = 'avaliado';
...@@ -221,7 +254,7 @@ class AvaliadorController extends Controller ...@@ -221,7 +254,7 @@ class AvaliadorController extends Controller
// dd($trabalho); // dd($trabalho);
return view('avaliador.listarTrabalhos', ['trabalhos'=>$trabalhos, 'evento'=>$evento ]); return view('avaliador.listarTrabalhos', ['trabalhosEx'=>$trabalhosEx,'trabalhosIn'=>$trabalhosIn, 'evento'=>$evento ]);
} }
public function conviteResposta(Request $request){ public function conviteResposta(Request $request){
//dd($request->all()); //dd($request->all());
......
...@@ -30,7 +30,7 @@ class CoordenadorComissaoController extends Controller ...@@ -30,7 +30,7 @@ class CoordenadorComissaoController extends Controller
public function editais(){ public function editais(){
$coordenador = CoordenadorComissao::with('user')->where('user_id', Auth()->user()->id)->first(); $coordenador = CoordenadorComissao::with('user')->where('user_id', Auth()->user()->id)->first();
$eventos = Evento::where('coordenadorId',$coordenador->id )->get(); $eventos = Evento::where('coordenadorId',$coordenador->id )->orderBy('created_at','DESC')->get();
//dd($eventos); //dd($eventos);
return view('coordenadorComissao.editais', ['eventos'=> $eventos]); return view('coordenadorComissao.editais', ['eventos'=> $eventos]);
......
...@@ -128,7 +128,7 @@ class EventoController extends Controller ...@@ -128,7 +128,7 @@ class EventoController extends Controller
'dt_fimRelatorioParcial' => ['required', 'date'], 'dt_fimRelatorioParcial' => ['required', 'date'],
'dt_inicioRelatorioFinal' => ['required', 'date'], 'dt_inicioRelatorioFinal' => ['required', 'date'],
'dt_fimRelatorioFinal' => ['required', 'date'], 'dt_fimRelatorioFinal' => ['required', 'date'],
'pdfFormAvalExterno' => [($request->pdfFormAvalExternoPreenchido!=='sim'?'required':''), 'file','mimes:pdf,doc,docx,xlsx,xls,csv', 'max:2048'], 'pdfFormAvalExterno' => [($request->pdfFormAvalExternoPreenchido!=='sim'?'required':''), 'file','mimes:pdf,doc,docx,xlsx,xls,csv,zip', 'max:2048'],
'pdfEdital' => [($request->pdfEditalPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf', 'max:2048'], 'pdfEdital' => [($request->pdfEditalPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf', 'max:2048'],
'inicioProjeto' => ['required', 'date'], 'inicioProjeto' => ['required', 'date'],
'fimProjeto' => ['required', 'date'], 'fimProjeto' => ['required', 'date'],
...@@ -159,7 +159,7 @@ class EventoController extends Controller ...@@ -159,7 +159,7 @@ class EventoController extends Controller
'dt_fimRelatorioParcial' => ['required', 'date', 'after_or_equal:dt_inicioRelatorioParcial'], 'dt_fimRelatorioParcial' => ['required', 'date', 'after_or_equal:dt_inicioRelatorioParcial'],
'dt_inicioRelatorioFinal' => ['required', 'date', 'after:dt_fimRelatorioParcial'], 'dt_inicioRelatorioFinal' => ['required', 'date', 'after:dt_fimRelatorioParcial'],
'dt_fimRelatorioFinal' => ['required', 'date', 'after_or_equal:dt_inicioRelatorioFinal'], 'dt_fimRelatorioFinal' => ['required', 'date', 'after_or_equal:dt_inicioRelatorioFinal'],
'pdfFormAvalExterno' => [($request->pdfFormAvalExternoPreenchido!=='sim'?'required':''), 'file','mimes:pdf,doc,docx,xlsx,xls,csv', 'max:2048'], 'pdfFormAvalExterno' => [($request->pdfFormAvalExternoPreenchido!=='sim'?'required':''), 'file','mimes:pdf,doc,docx,xlsx,xls,csv,zip', 'max:2048'],
'pdfEdital' => [($request->pdfEditalPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf', 'max:2048'], 'pdfEdital' => [($request->pdfEditalPreenchido!=='sim'?'required':''), 'file', 'mimes:pdf', 'max:2048'],
'inicioProjeto' => ['required', 'date', 'after:yesterday'], 'inicioProjeto' => ['required', 'date', 'after:yesterday'],
'fimProjeto' => ['required', 'date', 'after_or_equal:fimSubmissao'], 'fimProjeto' => ['required', 'date', 'after_or_equal:fimSubmissao'],
...@@ -430,7 +430,7 @@ class EventoController extends Controller ...@@ -430,7 +430,7 @@ class EventoController extends Controller
'dt_fimRelatorioFinal' => ['required', 'date'], 'dt_fimRelatorioFinal' => ['required', 'date'],
'pdfEdital' => ['file', 'mimes:pdf', 'max:2048'], 'pdfEdital' => ['file', 'mimes:pdf', 'max:2048'],
'modeloDocumento' => ['file', 'mimes:zip,doc,docx,odt,pdf', 'max:2048'], 'modeloDocumento' => ['file', 'mimes:zip,doc,docx,odt,pdf', 'max:2048'],
'pdfFormAvalExterno' => ['file','mimes:pdf,doc,docx,xlsx,xls,csv', 'max:2048'], 'pdfFormAvalExterno' => ['file','mimes:pdf,doc,docx,xlsx,xls,csv,zip', 'max:2048'],
'pdfFormAvalRelatorio' => ['file', 'mimes:pdf', 'max:2048'], 'pdfFormAvalRelatorio' => ['file', 'mimes:pdf', 'max:2048'],
'inicioProjeto' => ['required', 'date'], 'inicioProjeto' => ['required', 'date'],
'fimProjeto' => ['required', 'date'], 'fimProjeto' => ['required', 'date'],
...@@ -456,7 +456,7 @@ class EventoController extends Controller ...@@ -456,7 +456,7 @@ class EventoController extends Controller
'dt_inicioRelatorioFinal' => ['required', 'date', 'after:dt_fimRelatorioParcial'], 'dt_inicioRelatorioFinal' => ['required', 'date', 'after:dt_fimRelatorioParcial'],
'dt_fimRelatorioFinal' => ['required', 'date', 'after_or_equal:dt_inicioRelatorioFinal'], 'dt_fimRelatorioFinal' => ['required', 'date', 'after_or_equal:dt_inicioRelatorioFinal'],
'modeloDocumento' => ['file', 'mimes:zip,doc,docx,odt,pdf', 'max:2048'], 'modeloDocumento' => ['file', 'mimes:zip,doc,docx,odt,pdf', 'max:2048'],
'pdfFormAvalExterno' => ['file', 'mimes:pdf,doc,docx,xlsx,xls,csv', 'max:2048'], 'pdfFormAvalExterno' => ['file', 'mimes:pdf,doc,docx,xlsx,xls,csv,zip', 'max:2048'],
'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'],
......
...@@ -30,7 +30,7 @@ class HomeController extends Controller ...@@ -30,7 +30,7 @@ class HomeController extends Controller
$eventos = \App\Evento::all(); $eventos = \App\Evento::all();
if(Auth::user()->administradors != null){ if(Auth::user()->administradors != null){
$eventos = Evento::orderBy('nome')->get(); $eventos = Evento::orderBy('created_at','DESC')->get();
return view('administrador.editais')->with(['eventos' => $eventos]); return view('administrador.editais')->with(['eventos' => $eventos]);
} }
......
...@@ -362,6 +362,7 @@ class TrabalhoController extends Controller ...@@ -362,6 +362,7 @@ class TrabalhoController extends Controller
$grandeAreas = GrandeArea::all(); $grandeAreas = GrandeArea::all();
$areas = Area::all(); $areas = Area::all();
$subareas = Subarea::all(); $subareas = Subarea::all();
$areasTematicas = AreaTematica::all();
$funcaoParticipantes = FuncaoParticipantes::all(); $funcaoParticipantes = FuncaoParticipantes::all();
$participantes = $projeto->participantes; $participantes = $projeto->participantes;
$participantesUsersIds = Participante::where('trabalho_id', $id)->select('user_id')->get(); $participantesUsersIds = Participante::where('trabalho_id', $id)->select('user_id')->get();
...@@ -379,6 +380,7 @@ class TrabalhoController extends Controller ...@@ -379,6 +380,7 @@ class TrabalhoController extends Controller
'estados' => $this->estados, 'estados' => $this->estados,
'visualizar' => true, 'visualizar' => true,
'enum_turno' => Participante::ENUM_TURNO, 'enum_turno' => Participante::ENUM_TURNO,
'areasTematicas' => $areasTematicas,
]); ]);
} }
......
...@@ -19,6 +19,7 @@ class ParecerInterno extends Model ...@@ -19,6 +19,7 @@ class ParecerInterno extends Model
'statusJustificativaAutorizacaoEtica', 'statusJustificativaAutorizacaoEtica',
'statusParecer', 'statusParecer',
'statusPlanoTrabalho', 'statusPlanoTrabalho',
'comentario',
'trabalho_id', 'trabalho_id',
'avaliador_id', 'avaliador_id',
......
...@@ -102,7 +102,7 @@ class Trabalho extends Model ...@@ -102,7 +102,7 @@ class Trabalho extends Model
return $this->belongsTo('App\CoordenadorComissao'); return $this->belongsTo('App\CoordenadorComissao');
} }
public function avaliadors(){ public function avaliadors(){
return $this->belongsToMany('App\Avaliador')->withPivot('status', 'AnexoParecer', 'parecer', 'recomendacao', 'created_at','pontuacao'); return $this->belongsToMany('App\Avaliador')->withPivot('status', 'AnexoParecer', 'parecer', 'recomendacao', 'created_at','pontuacao','acesso');
} }
public function substituicaos(){ public function substituicaos(){
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAcessoToAvaliadorsTrabalhosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('avaliador_trabalho', function (Blueprint $table) {
$table->string('acesso')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('avaliador_trabalho', function (Blueprint $table) {
$table->dropColumn('acesso');
});
}
}
...@@ -834,6 +834,15 @@ ...@@ -834,6 +834,15 @@
<select name="avaliadores_internos_id[]" multiple <select name="avaliadores_internos_id[]" multiple
class="form-control" id="exampleFormControlSelect2" class="form-control" id="exampleFormControlSelect2"
style="height: 200px;font-size: 15px"> style="height: 200px;font-size: 15px">
@foreach ($trabalho->avaliadors as $avaliador)
@if($avaliador->tipo == "Interno" && $avaliador->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 1)
<option value="{{ $avaliador->id }}">{{ $avaliador->user->name }}
> {{$avaliador->user->instituicao ?? 'Instituição Indefinida'}}
> {{$avaliador->area->nome ?? 'Indefinida'}}
> {{$avaliador->user->email}}</option>
@endif
@endforeach
@foreach ($trabalho->aval as $avaliador) @foreach ($trabalho->aval as $avaliador)
@if($avaliador->tipo == "Interno") @if($avaliador->tipo == "Interno")
<option value="{{ $avaliador->id }}"> {{ $avaliador->user->name }} <option value="{{ $avaliador->id }}"> {{ $avaliador->user->name }}
...@@ -846,7 +855,7 @@ ...@@ -846,7 +855,7 @@
<div class="col-md-6"> <div class="col-md-6">
<label style="font-weight: bold;font-size: 18px">Externos</label> <label style="font-weight: bold;font-size: 18px"><i>Ad Hoc</i></label>
</div> </div>
<input type="hidden" id="trab" value="{{$trabalho->id}}"> <input type="hidden" id="trab" value="{{$trabalho->id}}">
...@@ -855,13 +864,19 @@ ...@@ -855,13 +864,19 @@
<select name="avaliadores_externos_id[]" multiple <select name="avaliadores_externos_id[]" multiple
class="form-control" id="exampleFormControlSelect3" class="form-control" id="exampleFormControlSelect3"
style="height: 200px;font-size:15px"> style="height: 200px;font-size:15px">
@foreach ($trabalho->avaliadors as $avaliador)
@if($avaliador->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 2)
<option value="{{ $avaliador->id }}">{{ $avaliador->user->name }}
> {{$avaliador->user->instituicao ?? 'Instituição Indefinida'}}
> {{$avaliador->area->nome ?? 'Indefinida'}}
> {{$avaliador->user->email}}</option>
@endif
@endforeach
@foreach ($trabalho->aval as $avaliador) @foreach ($trabalho->aval as $avaliador)
@if($avaliador->tipo == "Externo")
<option value="{{ $avaliador->id }}"> {{ $avaliador->user->name }} <option value="{{ $avaliador->id }}"> {{ $avaliador->user->name }}
> {{$avaliador->user->instituicao ?? 'Instituição Indefinida'}} > {{$avaliador->user->instituicao ?? 'Instituição Indefinida'}}
> {{$avaliador->area->nome ?? 'Indefinida'}} > {{$avaliador->area->nome ?? 'Indefinida'}}
> {{$avaliador->user->email}}</option> > {{$avaliador->user->email}}</option>
@endif
@endforeach @endforeach
</select> </select>
...@@ -892,7 +907,7 @@ ...@@ -892,7 +907,7 @@
</div> </div>
<div class="row justify-content-start" style="alignment: center"> <div class="row justify-content-start" style="alignment: center">
@foreach($trabalho->avaliadors as $avaliador) @foreach($trabalho->avaliadors as $avaliador)
@if($avaliador->tipo == 'Interno') @if($avaliador->tipo == 'Interno' && ($avaliador->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 2 || $avaliador->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 3))
<div class="col-sm-1"> <div class="col-sm-1">
<img src="{{asset('img/icons/usuario.svg')}}" style="width:60px" alt=""> <img src="{{asset('img/icons/usuario.svg')}}" style="width:60px" alt="">
</div> </div>
...@@ -905,7 +920,7 @@ ...@@ -905,7 +920,7 @@
href="{{ route('admin.visualizarParecerInterno', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}">Avaliado</a> @endif href="{{ route('admin.visualizarParecerInterno', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}">Avaliado</a> @endif
</h9> </h9>
<br> <br>
<a href="{{ route('admin.removerProjAval', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}" > <a href="{{ route('admin.removerProjAval', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id,'flag'=>1]) }}" >
Remover Remover
</a> </a>
<br> <br>
...@@ -920,31 +935,24 @@ ...@@ -920,31 +935,24 @@
<!--Comissão Externa--> <!--Comissão Externa-->
<div class="row justify-content-start" style="alignment: center"> <div class="row justify-content-start" style="alignment: center">
<div class="col-md-11"><h6 style="color: #234B8B; font-weight: bold">Avaliadores - <div class="col-md-11"><h6 style="color: #234B8B; font-weight: bold">Avaliadores -
Externos</h6></div> <i>Ad Hoc</i></h6></div>
</div> </div>
<div class="row justify-content-start" style="alignment: center"> <div class="row justify-content-start" style="alignment: center">
@foreach($trabalho->avaliadors as $avaliador) @foreach($trabalho->avaliadors as $avaliador)
@if($avaliador->tipo == 'Externo' || $avaliador->tipo == null) @if(($avaliador->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 1 || $avaliador->trabalhos()->where("trabalho_id",$trabalho->id)->first()->pivot->acesso == 3) )
<div class="col-sm-1"> <div class="col-sm-1">
<img src="{{asset('img/icons/usuario.svg')}}" style="width:60px" alt=""> <img src="{{asset('img/icons/usuario.svg')}}" style="width:60px" alt="">
</div> </div>
<div class="col-sm-5"> <div class="col-sm-5">
<h5>{{$avaliador->user->name}}</h5> <h5>{{$avaliador->user->name}}</h5>
@if($avaliador->tipo == 'Externo' || $avaliador->tipo == null)
<h9>@if($avaliador->trabalhos->where('id', $trabalho->id)->first()->pivot->parecer == null) <h9>@if($avaliador->trabalhos->where('id', $trabalho->id)->first()->pivot->status == false)
Pendente @else <a Pendente @else <a
href="{{ route('admin.visualizarParecer', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}">Avaliado</a> @endif href="{{ route('admin.visualizarParecer', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}">Avaliado</a> @endif
</h9> </h9>
@else
@php
$parecerInterno = App\ParecerInterno::where([['avaliador_id',$avaliador->id],['trabalho_id',$trabalho->id]])->first();
@endphp
<h9>@if($parecerInterno == null) Pendente @else <a
href="{{ route('admin.visualizarParecerInterno', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}">Avaliado</a> @endif
</h9>
@endif
<br> <br>
<a href="{{ route('admin.removerProjAval', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id]) }}" > <a href="{{ route('admin.removerProjAval', ['trabalho_id' => $trabalho->id, 'avaliador_id' => $avaliador->id,'flag'=>0]) }}" >
Remover Remover
</a> </a>
<br> <br>
......
...@@ -282,7 +282,7 @@ ...@@ -282,7 +282,7 @@
<div class="row justify-content-center" style="margin: 20px 0 20px 0"> <div class="row justify-content-center" style="margin: 20px 0 20px 0">
<div class="col-md-6" style="padding-left:0"> <div class="col-md-6" style="padding-left:0">
<a class="btn btn-secondary botao-form" href="/" style="width:100%">Cancelar</a> <a class="btn btn-secondary botao-form" href="{{ route('admin.usuarios') }}" style="width:100%">Cancelar</a>
</div> </div>
<div class="col-md-6" style="padding-right:0"> <div class="col-md-6" style="padding-right:0">
<button type="submit" class="btn btn-primary botao-form" style="width:100%"> <button type="submit" class="btn btn-primary botao-form" style="width:100%">
...@@ -446,7 +446,7 @@ ...@@ -446,7 +446,7 @@
<div class="row justify-content-center" style="margin: 20px 0 20px 0"> <div class="row justify-content-center" style="margin: 20px 0 20px 0">
<div class="col-md-6" style="padding-left:0"> <div class="col-md-6" style="padding-left:0">
<a class="btn btn-secondary botao-form" href="/" style="width:100%">Cancelar</a> <a class="btn btn-secondary botao-form" href="{{ route('admin.usuarios') }}" style="width:100%">Cancelar</a>
</div> </div>
<div class="col-md-6" style="padding-right:0"> <div class="col-md-6" style="padding-right:0">
<button type="submit" class="btn btn-primary botao-form" style="width:100%"> <button type="submit" class="btn btn-primary botao-form" style="width:100%">
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div class="row justify-content-center" style="margin-top: 2rem;"> <div class="row justify-content-center" style="margin-top: 2rem;">
<div class="col-md-12 form-group" style="text-align: center"> <div class="col-md-12 form-group" style="text-align: center">
<h5 style="color: #1492E6; margin-top:0.5rem; font-size:25px">Página inicial</h5> <h5 style="color: #1492E6; margin-top:0.5rem; font-size:25px">Página inicial</h5>
<h5 style="color: #909090; margin-top:0.7rem; font-size:22px; font-weight:normal">Avaliador {{Auth::user()->avaliadors->tipo}}</h5> <h5 style="color: #909090; margin-top:0.7rem; font-size:22px; font-weight:normal">Avaliador @if(Auth::user()->avaliadors->tipo == "Externo") <i>Ad Hoc</i>@else Interno @endif</h5>
</div> </div>
<div class="" style="text-align: center"> <div class="" style="text-align: center">
<div class="form-group imagem_shadow" style="border-radius: 12px; padding:14px; height:200px; width:190px; margin:15px"> <div class="form-group imagem_shadow" style="border-radius: 12px; padding:14px; height:200px; width:190px; margin:15px">
......
...@@ -22,14 +22,17 @@ ...@@ -22,14 +22,17 @@
<div class="row justify-content-center" style="margin-top: 3rem;"> <div class="row justify-content-center" style="margin-top: 3rem;">
<div class="col-md-11" style="margin-bottom: -3rem"> <div class="col-md-11" style="margin-bottom: -3rem">
<div class="card card_conteudo shadow bg-white" style="border-radius:12px; border-width:0px;"> <div class="card card_conteudo shadow bg-white" style="border-radius:12px; border-width:0px;">
@if($trabalhosIn != null)
<div class="card-header" style="border-top-left-radius: 12px; border-top-right-radius: 12px; background-color: #fff"> <div class="card-header" style="border-top-left-radius: 12px; border-top-right-radius: 12px; background-color: #fff">
<div class="d-flex justify-content-between align-items-center" style="margin-top: 9px; margin-bottom:-1rem"> <div class="d-flex justify-content-between align-items-center" style="margin-top: 9px; margin-bottom:-1rem">
<div class="bottomVoltar" style="margin-top: -20px"> <div class="bottomVoltar" style="margin-top: -20px">
<a href="javascript:history.back()" class="btn btn-secondary" style=""><img src="{{asset('img/icons/logo_esquerda.png')}}" alt="" width="15px"></a> <a href="javascript:history.back()" class="btn btn-secondary" style=""><img src="{{asset('img/icons/logo_esquerda.png')}}" alt="" width="15px"></a>
</div> </div>
<div class="form-group"> <div class="form-group">
<h5 class="card-title mb-0" style="font-size:25px; font-family:Arial, Helvetica, sans-serif; color:#1492E6">Trabalhos do Edital: {{ $evento->nome }}</h5> <h5 class="card-title mb-0" style="font-size:25px; font-family:Arial, Helvetica, sans-serif; color:#1492E6">Avaliação Interna do Edital: {{ $evento->nome }}</h5>
</div> </div>
<div style="margin-top: -2rem"> <div style="margin-top: -2rem">
<div class="form-group"> <div class="form-group">
<div style="margin-top:30px;"> <div style="margin-top:30px;">
...@@ -39,8 +42,10 @@ ...@@ -39,8 +42,10 @@
</div> </div>
</div> </div>
</div> </div>
@endif
@if($trabalhosIn != null)
<div class="card-body" > <div class="card-body" >
<table class="table table-bordered table-hover" style="display: block; white-space: nowrap; border-radius:10px; margin-bottom:0px"> <table class="table table-bordered table-hover" style="display: block; white-space: nowrap; border-radius:10px; margin-bottom:0px">
<thead> <thead>
...@@ -59,7 +64,7 @@ ...@@ -59,7 +64,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach ($trabalhos as $trabalho) @foreach ($trabalhosIn as $trabalho)
<tr> <tr>
<td style="max-width:100px; overflow-x:hidden; text-overflow:ellipsis">{{ $trabalho->titulo }}</td> <td style="max-width:100px; overflow-x:hidden; text-overflow:ellipsis">{{ $trabalho->titulo }}</td>
<td style="text-align: center">{{ $trabalho->created_at->format('d/m/Y') }}</td> <td style="text-align: center">{{ $trabalho->created_at->format('d/m/Y') }}</td>
...@@ -132,6 +137,78 @@ ...@@ -132,6 +137,78 @@
</tbody> </tbody>
</table> </table>
</div> </div>
@endif
@if($trabalhosEx != null)
<div class="form-group mb-0" style="margin-left: 20px;margin-top: 20px;">
<h5 class="card-title mb-0" style="font-size:25px; font-family:Arial, Helvetica, sans-serif; color:#1492E6">Avaliação <i>Ad Hoc</i> do Edital: {{ $evento->nome }}</h5>
</div>
<hr class="mb-0">
<div class="card-body" >
<table class="table table-bordered table-hover" style="display: block; white-space: nowrap; border-radius:10px; margin-bottom:0px">
<thead>
<tr>
<th scope="col" style="width:100%">Nome do Projeto</th>
<th scope="col">Data de Criação</th>
<th scope="col">Projeto</th>
<th scope="col">Plano de Trabalho</th>
<th scope="col">Parecer Externo</th>
</tr>
</thead>
<tbody>
@foreach ($trabalhosEx as $trabalho)
<tr>
<td style="max-width:100px; overflow-x:hidden; text-overflow:ellipsis">{{ $trabalho->titulo }}</td>
<td style="text-align: center">{{ $trabalho->created_at->format('d/m/Y') }}</td>
<td style="text-align: center">
{{-- --}}
<a href="{{route('download', ['file' => $trabalho->anexoProjeto])}}" target="_new" style="font-size: 20px; color: #114048ff;" class="btn btn-light">
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:15px">
</a>
</td>
<td style="text-align: center">
@foreach( $trabalho->participantes as $participante)
@php
if( App\Arquivo::where('participanteId', $participante->id)->first() != null){
$planoTrabalho = App\Arquivo::where('participanteId', $participante->id)->first()->nome;
}else{
$planoTrabalho = null;
}
@endphp
@if ($planoTrabalho != null)
<a href="{{route('download', ['file' => $planoTrabalho])}}" target="_new" style="font-size: 20px; color: #114048ff;" class="btn btn-light">
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:15px">
</a>
@else
Não planos de trabalho.
@endif
@endforeach
</td>
<td>
<div class="row justify-content-center">
<form action="{{ route('avaliador.parecer', ['evento' => $evento]) }}" method="POST">
@csrf
<input type="hidden" name="trabalho_id" value="{{ $trabalho->id }}" >
@if($trabalho->pivot->AnexoParecer == null)
<button type="submit" class="btn btn-primary mr-2 ml-2" >
Parecer
</button>
@else
<button type="submit" class="btn btn-secondary mr-2 ml-2" >
Enviado
</button>
@endif
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div> </div>
</div> </div>
</div> </div>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<!--Proponente Dados--> <!--Proponente Dados-->
<div class="col-md-10" style="margin-top:4rem;padding: 0px"> <div class="col-md-10" style="margin-top:4rem;padding: 0px">
@component('projeto.formularioVisualizar.proponente2', ['projeto' => $trabalho]) @component('projeto.formularioVisualizar.proponente2', ['edital' => $trabalho->evento, 'projeto' => $trabalho])
@endcomponent @endcomponent
</div> </div>
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
</div> </div>
<br> <br>
{{-- Autorização Especial --}} {{-- Autorização Especial --}}
@if($trabalho->evento->natureza_id != 3)
<div class="col-sm-12"> <div class="col-sm-12">
<label for="nomeTrabalho" class="col-form-label font-tam" style="font-weight: bold">{{ __('Autorização Especial: ') }}</label> <label for="nomeTrabalho" class="col-form-label font-tam" style="font-weight: bold">{{ __('Autorização Especial: ') }}</label>
@if($trabalho->anexoAutorizacaoComiteEtica != null) @if($trabalho->anexoAutorizacaoComiteEtica != null)
...@@ -38,6 +39,7 @@ ...@@ -38,6 +39,7 @@
@endif @endif
</div> </div>
<br> <br>
@endif
{{-- Anexo(s) do Plano(s) de Trabalho --}} {{-- Anexo(s) do Plano(s) de Trabalho --}}
@foreach( $trabalho->participantes as $participante) @foreach( $trabalho->participantes as $participante)
@php @php
...@@ -71,9 +73,8 @@ ...@@ -71,9 +73,8 @@
<input type="hidden" name="trabalho_id" value="{{ $trabalho->id }}" > <input type="hidden" name="trabalho_id" value="{{ $trabalho->id }}" >
<input type="hidden" name="evento_id" value="{{ $evento->id }}" > <input type="hidden" name="evento_id" value="{{ $evento->id }}" >
<div class="form-group"> <div class="form-group">
@component('componentes.input', ['label' => 'Parecer']) <label style="font-weight: bold">Parecer</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" name="textParecer" placeholder="Digite aqui o seu parecer" required>{{ $trabalho->pivot->parecer }}</textarea> <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" name="textParecer" placeholder="Digite aqui o seu parecer" >{{ $trabalho->pivot->parecer }}</textarea>
@endcomponent
</div> </div>
@if($evento->tipo == "PIBEX") @if($evento->tipo == "PIBEX")
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</div> </div>
<div class="col-md-10" style="padding: 0px" <div class="col-md-10" style="padding: 0px"
@component('projeto.formularioVisualizar.proponente2', ['projeto' => $trabalho]) @component('projeto.formularioVisualizar.proponente2', ['edital' => $trabalho->evento, 'projeto' => $trabalho])
@endcomponent @endcomponent
</div> </div>
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<div class="col-sm-12"> <div class="col-sm-12">
<div class="form-group"> <div class="form-group">
<label for="exampleFormControlTextarea1">Descrição*:</label> <label for="exampleFormControlTextarea1">Descrição*:</label>
<textarea class="form-control @error('descricao') is-invalid @enderror" required autocomplete="descricao" autofocus id="descricao" name="descricao" rows="3">{{ old('descricao') }}</textarea> <textarea class="form-control @error('descricao') is-invalid @enderror" required autocomplete="descricao" autofocus id="descricao" name="descricao" rows="6">{{ old('descricao') }}</textarea>
@error('descricao') @error('descricao')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
...@@ -421,12 +421,12 @@ ...@@ -421,12 +421,12 @@
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label for="pdfFormAvalExterno">Formulário de avaliação externa:</label> <label for="pdfFormAvalExterno">Formulário para avaliador <i>ad hoc</i>:</label>
@if(old('pdfFormAvalExternoPreenchido') != null) @if(old('pdfFormAvalExternoPreenchido') != null)
<a id="pdfFormAvalExternoTemp" href="{{ route('baixar.evento.temp', ['nomeAnexo' => 'formAvaliacaoExterno' ])}}">Arquivo atual</a> <a id="pdfFormAvalExternoTemp" href="{{ route('baixar.evento.temp', ['nomeAnexo' => 'formAvaliacaoExterno' ])}}">Arquivo atual</a>
@endif @endif
<input type="hidden" id="pdfFormAvalExternoPreenchido" name="pdfFormAvalExternoPreenchido" value="{{ old('pdfFormAvalExternoPreenchido') }}" > <input type="hidden" id="pdfFormAvalExternoPreenchido" name="pdfFormAvalExternoPreenchido" value="{{ old('pdfFormAvalExternoPreenchido') }}" >
<input type="file" accept=".pdf,.doc,.docx,.xlsx, .xls, .csv" class="form-control-file @error('pdfFormAvalExterno') is-invalid @enderror" name="pdfFormAvalExterno" value="{{ old('pdfFormAvalExterno') }}" id="pdfFormAvalExterno" onchange="exibirAnexoTemp(this)"> <input type="file" accept=".pdf,.doc,.docx,.xlsx,.xls,.csv,.zip" class="form-control-file @error('pdfFormAvalExterno') is-invalid @enderror" name="pdfFormAvalExterno" value="{{ old('pdfFormAvalExterno') }}" id="pdfFormAvalExterno" onchange="exibirAnexoTemp(this)">
<small>O arquivo selecionado deve ter até 2mb.</small> <small>O arquivo selecionado deve ter até 2mb.</small>
@error('pdfFormAvalExterno') @error('pdfFormAvalExterno')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
......
...@@ -401,11 +401,11 @@ ...@@ -401,11 +401,11 @@
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label for="pdfEdital">Formulário de avaliação externa:</label> <label for="pdfEdital">Formulário para avaliador <i>ad hoc</i>:</label>
<a href="{{route('download', ['file' => $evento->formAvaliacaoExterno])}}" target="_new" style="font-size: 20px; color: #114048ff;" > <a href="{{route('download', ['file' => $evento->formAvaliacaoExterno])}}" target="_new" style="font-size: 20px; color: #114048ff;" >
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:20px"> <img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:20px">
</a> </a>
<input type="file" accept=".pdf,.doc,.docx,.xlsx, .xls, .csv" class="form-control-file @error('pdfFormAvalExterno') is-invalid @enderror" name="pdfFormAvalExterno" value="{{ old('pdfFormAvalExterno') }}" id="pdfFormAvalExterno"> <input type="file" accept=".pdf,.doc,.docx,.xlsx,.xls,.csv,.zip" class="form-control-file @error('pdfFormAvalExterno') is-invalid @enderror" name="pdfFormAvalExterno" value="{{ old('pdfFormAvalExterno') }}" id="pdfFormAvalExterno">
<small>O arquivo selecionado deve ter até 2mb.</small> <small>O arquivo selecionado deve ter até 2mb.</small>
@error('pdfFormAvalExterno') @error('pdfFormAvalExterno')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
......
...@@ -124,76 +124,69 @@ ...@@ -124,76 +124,69 @@
<div class="col-md-12"><h5>Endereço</h5></div> <div class="col-md-12"><h5>Endereço</h5></div>
<div class="col-6"> <div class="col-6">
@component('componentes.input', ['label' => 'CEP']) @component('componentes.input', ['label' => 'CEP'])
<input type="text" class="form-control cep" value="{{old('cep')[$i] ?? "" }}" name="cep[{{$i}}]" placeholder="CEP" /> <input name="cep[{{$i}}]" type="text" id="cep{{$i}}"
value="{{ old('cep')[$i] ?? ''}}" class="form-control cep"
onblur="pesquisacep(this.value, {{$i}})" />
@error('cep.'.$i) @error('cep.'.$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></span>
<strong>{{ $message }}</strong>
</span>
@enderror @enderror
@endcomponent @endcomponent
</div> </div>
<div class="col-6"> <div class="col-6">
@component('componentes.select', ['label' => 'Estado']) @component('componentes.input', ['label' => 'Estado'])
<select name="uf[{{$i}}]" id="estado" class="form-control" style="visibility: visible" > <input name="uf[{{$i}}]" type="text" class="form-control"
<option value="" selected>-- Selecione uma opção --</option> value="{{ old('uf')[$i] ?? '' }}" id="uf{{$i}}" />
@foreach ($estados as $sigla => $nome)
<option @if(old('uf')[$i] ?? "" == $sigla ) selected @endif value="{{ $sigla }}">{{ $nome }}</option>
@endforeach
</select>
@error('uf.'.$i) @error('uf.'.$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></span>
<strong>{{ $message }}</strong>
</span>
@enderror @enderror
@endcomponent @endcomponent
</div> </div>
<div class="col-6"> <div class="col-6">
@component('componentes.input', ['label' => 'Cidade']) @component('componentes.input', ['label' => 'Cidade'])
<input type="text" class="form-control" value="{{old('cidade')[$i] ?? "" }}" name="cidade[{{$i}}]" placeholder="Cidade" maxlength="50" id="cidade{{$i}}" /> <input name="cidade[{{$i}}]" type="text" id="cidade{{$i}}" class="form-control"
<span style="color: red; font-size: 12px" id="caracsRestantescidade{{$i}}"> value="{{ old('cidade')[$i] ?? '' }}" />
</span>
@error('cidade.'.$i) @error('cidade.'.$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></span>
<strong>{{ $message }}</strong>
</span>
@enderror @enderror
@endcomponent @endcomponent
</div> </div>
<div class="col-6"> <div class="col-6">
@component('componentes.input', ['label' => 'Bairro']) @component('componentes.input', ['label' => 'Bairro'])
<input type="text" class="form-control" value="{{old('bairro')[$i] ?? "" }}" name="bairro[{{$i}}]" placeholder="Bairro" maxlength="50" id="bairro{{$i}}" /> <input name="bairro[{{$i}}]" type="text" id="bairro{{$i}}" class="form-control"
<span style="color: red; font-size: 12px" id="caracsRestantesbairro{{$i}}"> value="{{ old('bairro')[$i] ?? '' }}" />
</span>
@error('bairro.'.$i) @error('bairro.'.$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></span>
<strong>{{ $message }}</strong>
</span>
@enderror @enderror
@endcomponent @endcomponent
</div> </div>
<div class="col-6"> <div class="col-6">
@component('componentes.input', ['label' => 'Rua']) @component('componentes.input', ['label' => 'Rua'])
<input type="text" class="form-control" value="{{old('rua')[$i] ?? "" }}" name="rua[{{$i}}]" placeholder="Rua" maxlength="100" id="rua{{$i}}" /> <input name="rua[{{$i}}]" type="text" id="rua{{$i}}" class="form-control"
<span style="color: red; font-size: 12px" id="caracsRestantesrua{{$i}}"> value="{{ old('rua')[$i] ?? '' }}" />
</span>
@error('rua.'.$i) @error('rua.'.$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></span>
<strong>{{ $message }}</strong>
</span>
@enderror @enderror
@endcomponent @endcomponent
</div> </div>
<div class="col-6"> <div class="col-6">
@component('componentes.input', ['label' => 'Número']) @component('componentes.input', ['label' => 'Número'])
<input type="text" class="form-control" value="{{old('numero')[$i] ?? "" }}" name="numero[{{$i}}]" placeholder="Número" /> <input name="numero[{{$i}}]" type="text" class="form-control"
value="{{ old('numero')[$i] ?? '' }}" />
@error('numero.'.$i) @error('numero.'.$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></span>
<strong>{{ $message }}</strong>
</span>
@enderror @enderror
@endcomponent @endcomponent
</div> </div>
<div class="col-12"> <div class="col-12">
<div class="form-group"> <div class="form-group">
<label class=" control-label" for="firstname">Complemento</label> <label class=" control-label" for="firstname">Complemento</label>
...@@ -402,4 +395,78 @@ ...@@ -402,4 +395,78 @@
</script> </script>
<!--X Participantes X--> <!-- Adicionando Javascript -->
<script>
function limpa_formulário_cep(id) {
//Limpa valores do formulário de cep.
document.getElementById(`rua${id}`).value=("");
document.getElementById(`bairro${id}`).value=("");
document.getElementById(`cidade${id}`).value=("");
document.getElementById(`uf${id}`).value=("");
//document.getElementById('ibge').value=("");
}
let cont = 0; //Esse cont representa a adição de cada aluno
function meu_callback(conteudo) {
if (!("erro" in conteudo)) {
//Atualiza os campos com os valores.
document.getElementById(`rua${cont}`).value=(conteudo.logradouro);
document.getElementById(`bairro${cont}`).value=(conteudo.bairro);
document.getElementById(`cidade${cont}`).value=(conteudo.localidade);
document.getElementById(`uf${cont}`).value=(conteudo.uf);
//document.getElementById('ibge').value=(conteudo.ibge);
} //end if.
else {
//CEP não Encontrado.
limpa_formulário_cep(cont);
alert("CEP não encontrado.");
}
}
function pesquisacep(valor, id) {
//Nova variável "cep" somente com dígitos.
var cep = valor.replace(/\D/g, '');
//Verifica se campo cep possui valor informado.
if (cep != "") {
//Expressão regular para validar o CEP.
var validacep = /^[0-9]{8}$/;
//Valida o formato do CEP.
if(validacep.test(cep)) {
//Preenche os campos com "..." enquanto consulta webservice.
document.getElementById(`rua${id}`).value="...";
document.getElementById(`bairro${id}`).value="...";
document.getElementById(`cidade${id}`).value="...";
document.getElementById(`uf${id}`).value="...";
//document.getElementById('ibge').value="...";
//Cria um elemento javascript.
var script = document.createElement('script');
//Sincroniza com o callback.
cont = id
script.src = 'https://viacep.com.br/ws/'+ cep + '/json/?callback=meu_callback';
//Insere script no documento e carrega o conteúdo.
document.body.appendChild(script);
} //end if.
else {
//cep é inválido.
limpa_formulário_cep(id);
alert("Formato de CEP inválido.");
}
} //end if.
else {
//cep sem valor, limpa formulário.
limpa_formulário_cep(id);
}
};
</script>
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
<div class="col-md-12" style="margin-top: 5px"> <div class="col-md-12" style="margin-top: 5px">
<div><h5 class="card-title mb-0" style="font-size:20px; font-family:Arial, Helvetica, sans-serif; color:#1492E6;">Descrição</h5></div> <div><h5 class="card-title mb-0" style="font-size:20px; font-family:Arial, Helvetica, sans-serif; color:#1492E6;">Descrição</h5></div>
<pre wrap>
<div style="margin-top: 10px"><h5 style="font-size: 16px; font-weight:normal; text-align:justify; font-family:Arial, Helvetica, sans-serif">{{$evento->descricao}}</h5></div> <div style="margin-top: 10px"><h5 style="font-size: 16px; font-weight:normal; text-align:justify; font-family:Arial, Helvetica, sans-serif">{{$evento->descricao}}</h5></div>
</pre>
</div> </div>
</div> </div>
</div> </div>
......
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