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

Merge pull request #510 from GuilhermeGz/master

Atualizações da semana e ajustes de telas
parents 5a805a92 add6e3df
PP_NAME=Laravel APP_NAME=Laravel
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
......
...@@ -381,6 +381,9 @@ class TrabalhoController extends Controller ...@@ -381,6 +381,9 @@ class TrabalhoController extends Controller
// return back()->withErrors(['Proposta não encontrada!']); // return back()->withErrors(['Proposta não encontrada!']);
// } // }
$projeto = Trabalho::find($id); $projeto = Trabalho::find($id);
if(Auth::user()->id != $projeto->proponente->user->id){
return redirect()->back();
}
$edital = Evento::find($projeto->evento_id); $edital = Evento::find($projeto->evento_id);
$grandeAreas = GrandeArea::all(); $grandeAreas = GrandeArea::all();
$areas = Area::all(); $areas = Area::all();
...@@ -433,8 +436,13 @@ class TrabalhoController extends Controller ...@@ -433,8 +436,13 @@ class TrabalhoController extends Controller
public function edit($id) public function edit($id)
{ {
$proponente = Proponente::where('user_id', Auth::user()->id)->first(); if(Auth::user()->tipo=='administrador'){
$projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first(); $projeto = Trabalho::find($id);
}else{
$projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first();
}
$proponente = Proponente::where('user_id', $projeto->proponente->user_id)->first();
if (!$projeto) { if (!$projeto) {
return back()->withErrors(['Proposta não encontrada!']); return back()->withErrors(['Proposta não encontrada!']);
} }
...@@ -832,7 +840,8 @@ class TrabalhoController extends Controller ...@@ -832,7 +840,8 @@ class TrabalhoController extends Controller
$request->merge([ $request->merge([
'coordenador_id' => $evento->coordenadorComissao->id 'coordenador_id' => $evento->coordenadorComissao->id
]); ]);
$trabalho = Auth::user()->proponentes->trabalhos()->where('id', $id)->first();
$trabalho = Trabalho::find($id);
DB::beginTransaction(); DB::beginTransaction();
if (!$trabalho) { if (!$trabalho) {
...@@ -878,7 +887,6 @@ class TrabalhoController extends Controller ...@@ -878,7 +887,6 @@ class TrabalhoController extends Controller
if ($request->has('marcado')) { if ($request->has('marcado')) {
foreach ($request->marcado as $key => $part) { foreach ($request->marcado as $key => $part) {
$part = intval($part); $part = intval($part);
$passwordTemporario = Str::random(8); $passwordTemporario = Str::random(8);
$data['name'] = $request->name[$part]; $data['name'] = $request->name[$part];
$data['email'] = $request->email[$part]; $data['email'] = $request->email[$part];
...@@ -937,8 +945,13 @@ class TrabalhoController extends Controller ...@@ -937,8 +945,13 @@ class TrabalhoController extends Controller
} else { } else {
// $user = $participante->user; // $user = $participante->user;
$user->update($data); $user->update($data);
$endereco = $user->endereco; if( $user->endereco == null){
$endereco->update($data); $endereco = Endereco::create($data);
$endereco->user()->save($user);
}else{
$endereco = $user->endereco;
$endereco->update($data);
}
$participante = $user->participantes->where('trabalho_id', $trabalho->id)->where('id', $request->participante_id[$part])->first(); $participante = $user->participantes->where('trabalho_id', $trabalho->id)->where('id', $request->participante_id[$part])->first();
// dd($participante); // dd($participante);
if ($participante == null) { if ($participante == null) {
...@@ -987,10 +1000,15 @@ class TrabalhoController extends Controller ...@@ -987,10 +1000,15 @@ class TrabalhoController extends Controller
} }
} }
DB::commit(); DB::commit();
if(Auth::user()->tipo == 'administrador'){
return redirect(route('admin.analisarProposta',['id'=>$trabalho->id]));
}
if (!$request->has('rascunho')) { if (!$request->has('rascunho')) {
// SubmissaoNotification.php Notification::send($trabalho->proponente->user, new SubmissaoNotification($id,$trabalho->titulo));
Notification::send(Auth::user(), new SubmissaoNotification($id,$trabalho->titulo));
} }
return redirect(route('proponente.projetos'))->with(['mensagem' => 'Proposta atualizada!']); return redirect(route('proponente.projetos'))->with(['mensagem' => 'Proposta atualizada!']);
......
...@@ -72,16 +72,16 @@ class UpdateTrabalho extends FormRequest ...@@ -72,16 +72,16 @@ class UpdateTrabalho extends FormRequest
//$rules = []; //$rules = [];
if($evento->tipo!="PIBEX"){ if($evento->tipo!="PIBEX"){
$rules['anexoPlanilhaPontuacao'] = ['required']; $rules['anexoPlanilhaPontuacao'] = [Rule::requiredIf($projeto->anexoPlanilhaPontuacao == null)];
$rules['anexoLattesCoordenador'] = ['required', 'mimes:pdf']; $rules['anexoLattesCoordenador'] = [Rule::requiredIf($projeto->anexoLattesCoordenador == null), 'mimes:pdf'];
$rules['anexoGrupoPesquisa'] = ['required', 'mimes:pdf']; $rules['anexoGrupoPesquisa'] = [Rule::requiredIf($projeto->anexoGrupoPesquisa == null), 'mimes:pdf'];
$rules['anexoAutorizacaoComiteEtica'] = [Rule::requiredIf($this->justificativaAutorizacaoEtica == null)]; $rules['anexoAutorizacaoComiteEtica'] = [Rule::requiredIf($this->justificativaAutorizacaoEtica == null && $projeto->anexoAutorizacaoComiteEtica == null)];
$rules['justificativaAutorizacaoEtica']= [Rule::requiredIf($this->anexoAutorizacaoComiteEtica == null)]; $rules['justificativaAutorizacaoEtica']= [Rule::requiredIf($this->anexoAutorizacaoComiteEtica == null && $projeto->anexoAutorizacaoComiteEtica == null)];
$rules['pontuacaoPlanilha'] = ['required', 'string']; $rules['pontuacaoPlanilha'] = ['required', 'string'];
$rules['linkGrupoPesquisa'] = ['required', 'string']; $rules['linkGrupoPesquisa'] = ['required', 'string'];
} }
if($evento->nome_docExtra != null){ if($evento->nome_docExtra != null){
$rules['anexo_docExtra'] = [Rule::requiredIf($evento->obrigatoriedade_docExtra == true),'file', 'mimes:zip,doc,docx,pdf', 'max:2048']; $rules['anexo_docExtra'] = [Rule::requiredIf($evento->obrigatoriedade_docExtra == true && $evento->obrigatoriedade_docExtra == null),'file', 'mimes:zip,doc,docx,pdf', 'max:2048'];
} }
$rules['editalId'] = ['required', 'string']; $rules['editalId'] = ['required', 'string'];
$rules['marcado.*'] = ['required']; $rules['marcado.*'] = ['required'];
...@@ -92,8 +92,8 @@ class UpdateTrabalho extends FormRequest ...@@ -92,8 +92,8 @@ class UpdateTrabalho extends FormRequest
$rules['linkLattesEstudante'] = ['required', 'string']; $rules['linkLattesEstudante'] = ['required', 'string'];
$rules['anexoProjeto'] = ['required', 'mimes:pdf']; $rules['anexoProjeto'] = [Rule::requiredIf($projeto->anexoProjeto == null), 'mimes:pdf'];
$rules['anexoDecisaoCONSU'] = [Rule::requiredIf($evento->consu), 'mimes:pdf']; $rules['anexoDecisaoCONSU'] = [Rule::requiredIf($evento->consu && $projeto->anexoDecisaoCONSU == null), 'mimes:pdf'];
return $rules; return $rules;
} }
......
...@@ -44,7 +44,14 @@ ...@@ -44,7 +44,14 @@
<hr style="border-top: 1px solid#1492E6"> <hr style="border-top: 1px solid#1492E6">
</div> </div>
<div class="col-md-12"><h5 style="color: #1492E6;">{{$trabalho->titulo}}</h5></div> <div class="col-md-12">
<h5 style="color: #1492E6;">{{$trabalho->titulo}}
<a class="ml-2 mb-5" href="{{ route('trabalho.editar', ['id' => $trabalho->id]) }}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#234B8B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 14.66V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.34"></path><polygon points="18 2 22 6 12 16 8 16 8 12 18 2"></polygon></svg>
</a>
</h5>
</div>
<div class="col-md-12"><h6 <div class="col-md-12"><h6
style="color: #234B8B; margin-bottom:-0.4rem; font-weight: bold">{{$evento->nome}}</h6> style="color: #234B8B; margin-bottom:-0.4rem; font-weight: bold">{{$evento->nome}}</h6>
</div> </div>
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
@if($edital->nome_docExtra != null) @if($edital->nome_docExtra != null)
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label title="{{$edital->nome_docExtra}}" for="anexo_docExtra" class="col-form-label font-tam" style="font-weight: bold">{{$edital->nome_docExtra}}: @if($edital->obrigatoriedade_docExtra == true) <span style="color: red; font-weight:bold">*</span> @endif</label> <label title="{{$edital->nome_docExtra}}" for="anexo_docExtra" class="col-form-label font-tam" style="font-weight: bold">{{$edital->nome_docExtra}}: @if($edital->obrigatoriedade_docExtra == true) <span style="color: red; font-weight:bold">*</span> @endif</label>
<input type="file" class="input-group-text" name="anexo_docExtra" accept=".pdf,.docx,.doc,.zip " @if($edital->obrigatoriedade_docExtra == true) required @endif/> <input type="file" class="input-group-text" name="anexo_docExtra" accept=".pdf,.docx,.doc,.zip " />
@error('anexo_docExtra') @error('anexo_docExtra')
<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>
......
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
@else @else
<i class="fas fa-times-circle fa-2x"></i> <i class="fas fa-times-circle fa-2x"></i>
@endif @endif
<input type="file" class="input-group-text" name="anexo_docExtra" placeholder="{{$edital->nome_docExtra}}" accept=".pdf,.docx,.doc,.zip" @if($edital->obrigatoriedade_docExtra == true) required @endif/> <input type="file" class="input-group-text" name="anexo_docExtra" placeholder="{{$edital->nome_docExtra}}" accept=".pdf,.docx,.doc,.zip"/>
@error('anexo_docExtra') @error('anexo_docExtra')
<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>
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
<div class=" d-flex justify-content-between align-items-center" style="margin-top: 15px; margin-bottom:18px"> <div class=" d-flex justify-content-between align-items-center" style="margin-top: 15px; margin-bottom:18px">
<h6 style="font-weight: bold"><span style="color: red; font-weight:bold">*</span> Campos obrigatórios</h6> <h6 style="font-weight: bold"><span style="color: red; font-weight:bold">*</span> Campos obrigatórios</h6>
<button id="submeterFormProposta" type="submit" style="display: none;"></button> <button id="submeterFormProposta" type="submit" style="display: none;"></button>
<button type="submit" class="btn btn-primary " id="idButtonSubmitRascunho" >{{ __('Salvar como rascunho') }}</button> @if(Auth::user()->tipo != 'administrador')
<button type="submit" class="btn btn-primary " id="idButtonSubmitRascunho" >{{ __('Salvar como rascunho') }}</button>
@endif
<button type="submit" class="btn btn-success" id="idButtonSubmitProjeto" >{{ __('Submeter projeto') }}</button> <button type="submit" class="btn btn-success" id="idButtonSubmitProjeto" >{{ __('Submeter projeto') }}</button>
</div> </div>
@if($errors->any()) @if($errors->any())
......
...@@ -219,8 +219,8 @@ ...@@ -219,8 +219,8 @@
@component('componentes.input', ['label' => 'Instituição de Ensino']) @component('componentes.input', ['label' => 'Instituição de Ensino'])
<select style="display: inline" onchange="showInstituicao(this)" class="form-control" name="instituicao[{{$i}}]"> <select style="display: inline" onchange="showInstituicao(this)" class="form-control" name="instituicao[{{$i}}]">
<option value="" disabled selected hidden>-- Instituição --</option> <option value="" disabled selected hidden>-- Instituição --</option>
<option @if(old('instituicao')[$i] ?? ($participante->user->instituicao ?? "") == 'UFAPE' ) selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option> <option @if((old('instituicao')[$i] ?? ($participante->user->instituicao ?? "")) == 'UFAPE' ) selected @endif value="UFAPE">Universidade Federal do Agreste de Pernambuco - UFAPE</option>
<option @if(old('instituicao')[$i] ?? ($participante->user->instituicao ?? "") == 'Outra' ) selected @endif value="Outra" >Outra</option> <option @if((old('instituicao')[$i] ?? ($participante->user->instituicao ?? "")) == 'Outra' ) selected @endif value="Outra" >Outra</option>
</select> </select>
@error('instituicao.'.$i) @error('instituicao.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> <span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
...@@ -243,14 +243,14 @@ ...@@ -243,14 +243,14 @@
@component('componentes.input', ['label' => 'Curso']) @component('componentes.input', ['label' => 'Curso'])
<select style="display: inline" class="form-control" name="curso[{{$i}}]" onchange="showCurso(this)"> <select style="display: inline" class="form-control" name="curso[{{$i}}]" onchange="showCurso(this)">
<option value="" disabled selected hidden>-- Selecione uma opção--</option> <option value="" disabled selected hidden>-- Selecione uma opção--</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Bacharelado em Agronomia' ) selected @endif value="Bacharelado em Agronomia">Bacharelado em Agronomia</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Bacharelado em Agronomia' ) selected @endif value="Bacharelado em Agronomia">Bacharelado em Agronomia</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Bacharelado em Ciência da Computação' ) selected @endif value="Bacharelado em Ciência da Computação">Bacharelado em Ciência da Computação</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Bacharelado em Ciência da Computação' ) selected @endif value="Bacharelado em Ciência da Computação">Bacharelado em Ciência da Computação</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Bacharelado em Engenharia de Alimentos' ) selected @endif value="Bacharelado em Engenharia de Alimentos">Bacharelado em Engenharia de Alimentos</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Bacharelado em Engenharia de Alimentos' ) selected @endif value="Bacharelado em Engenharia de Alimentos">Bacharelado em Engenharia de Alimentos</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Bacharelado em Medicina Veterinária' ) selected @endif value="Bacharelado em Medicina Veterinária">Bacharelado em Medicina Veterinária</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Bacharelado em Medicina Veterinária' ) selected @endif value="Bacharelado em Medicina Veterinária">Bacharelado em Medicina Veterinária</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Bacharelado em Zootecnia' ) selected @endif value="Bacharelado em Zootecnia">Bacharelado em Zootecnia</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Bacharelado em Zootecnia' ) selected @endif value="Bacharelado em Zootecnia">Bacharelado em Zootecnia</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Licenciatura em Letras' ) selected @endif value="Licenciatura em Letras">Licenciatura em Letras</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Licenciatura em Letras' ) selected @endif value="Licenciatura em Letras">Licenciatura em Letras</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Licenciatura em Pedagogia' ) selected @endif value="Licenciatura em Pedagogia">Licenciatura em Pedagogia</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Licenciatura em Pedagogia' ) selected @endif value="Licenciatura em Pedagogia">Licenciatura em Pedagogia</option>
<option @if(old('curso')[$i] ?? ($participante->curso ?? "") == 'Outro' ) selected @endif value="Outro" >Outro</option> <option @if((old('curso')[$i] ?? ($participante->curso ?? "")) == 'Outro' ) selected @endif value="Outro" >Outro</option>
</select> </select>
@error('curso.'.$i) @error('curso.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> <span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
<select name="turno[{{$i}}]" class="form-control" > <select name="turno[{{$i}}]" class="form-control" >
<option value="" selected>-- Selecione uma opção --</option> <option value="" selected>-- Selecione uma opção --</option>
@foreach ($enum_turno as $key => $value) @foreach ($enum_turno as $key => $value)
<option @if(old('turno')[$i] ?? ($participante->turno ?? "") == $value ) selected @endif value="{{ $value }}">{{ $value }}</option> <option @if((old('turno')[$i] ?? ($participante->turno ?? "")) == $value ) selected @endif value="{{ $value }}">{{ $value }}</option>
@endforeach @endforeach
</select> </select>
@error('turno.'.$i) @error('turno.'.$i)
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
<select name="total_periodos[{{$i}}]" class="form-control" onchange="gerarPeriodo(this)" > <select name="total_periodos[{{$i}}]" class="form-control" onchange="gerarPeriodo(this)" >
<option value="" selected>-- Selecione uma opção --</option> <option value="" selected>-- Selecione uma opção --</option>
@foreach ($options as $key => $value) @foreach ($options as $key => $value)
<option @if(old('total_periodos')[$i] ?? ($participante->total_periodos ?? "") == $key ) selected @endif value="{{ $key }}">{{ $value }}</option> <option @if((old('total_periodos')[$i] ?? ($participante->total_periodos ?? "")) == $key ) selected @endif value="{{ $key }}">{{ $value }}</option>
@endforeach @endforeach
</select> </select>
@error('total_periodos.'.$i) @error('total_periodos.'.$i)
...@@ -321,10 +321,8 @@ ...@@ -321,10 +321,8 @@
<select name="ordem_prioridade[]" class="form-control" > <select name="ordem_prioridade[]" class="form-control" >
<option value="" selected>-- ORDEM --</option> <option value="" selected>-- ORDEM --</option>
@for($j = 1; $j <= $edital->numParticipantes; $j++) @for($j = 1; $j <= $edital->numParticipantes; $j++)
<option @if(old('total_periodos')[$i] ?? ($participante->ordem_prioridade ?? '') == $j ) selected @endif value="{{ $j }}">{{ $j }}</option> <option @if(old('total_periodos')[$i] ?? ($participante->ordem_prioridade ?? '') == $j ) selected @endif value="{{ $j }}">{{ $j }}</option>
@endfor @endfor
</select> </select>
@error('ordem_prioridade.'.$i) @error('ordem_prioridade.'.$i)
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block"> <span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<label for="nome" class="col-form-label font-tam" style="font-weight: bold">{{ __('Nome: ') }}</label> <label for="nome" class="col-form-label font-tam" style="font-weight: bold">{{ __('Nome: ') }}</label>
</div> </div>
<div class="col-md-11"> <div class="col-md-11">
<input class="form-control" type="text" id="nomeCompletoProponente1" name="nomeCoordenador" disabled="disabled" value="{{ Auth()->user()->name }}"> <input class="form-control" type="text" id="nomeCompletoProponente1" name="nomeCoordenador" disabled="disabled" @if(Auth::user()->tipo=='administrador') value="{{ $projeto->proponente->user->name }}" @else value="{{ Auth()->user()->name }}" @endif >
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
...@@ -23,11 +23,16 @@ ...@@ -23,11 +23,16 @@
<br> <br>
<input class="form-control @error('linkLattesEstudante') is-invalid @enderror" type="text" name="linkLattesEstudante" <input class="form-control @error('linkLattesEstudante') is-invalid @enderror" type="text" name="linkLattesEstudante"
readonly="readonly" readonly="readonly"
@if(Auth()->user()->proponentes != null && Auth()->user()->proponentes->linkLattes != null) @if(Auth::user()->tipo=='administrador')
value="{{ Auth()->user()->proponentes->linkLattes }}" value="{{ $projeto->proponente->linkLattes }}"
@else @else
value="" @if(Auth()->user()->proponentes != null && Auth()->user()->proponentes->linkLattes != null)
@endif > value="{{ Auth()->user()->proponentes->linkLattes }}"
@else
value=""
@endif
@endif
>
@error('linkLattesEstudante') @error('linkLattesEstudante')
<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>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
@include('projeto.editaFormulario.anexos') @include('projeto.editaFormulario.anexos')
@include('projeto.editaFormulario.finalizar') @include('projeto.editaFormulario.finalizar')
</div> </div>
</div> </div>
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
@else @else
<br>@lang('Atenciosamente'),<br> <br>@lang('Atenciosamente'),<br>
{{--{{ config('app.name') }}<br><br>--}} {{--{{ config('app.name') }}<br><br>--}}
Seção de Editais e Apoios a Projetos - PREC/UFAPE<br>
Universidade Federal do Agreste de Pernambuco<br> Universidade Federal do Agreste de Pernambuco<br>
@endif @endif
......
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