"app/git@sites.upe.br:walter.felipe/submeta.git" did not exist on "ed01364a3994dd7ab2b91f0eec40fbd035bbe7c3"
Commit 25830059 authored by Edgarvital's avatar Edgarvital
Browse files

Correção da issue: Ao submeter uma proposta com um integrante bolsista, o...

Correção da issue: Ao submeter uma proposta com um integrante bolsista, o sistema está permitindo que a submissão seja enviada sem o anexo / titulo do plano de trabalho
parent 285607a1
...@@ -22,7 +22,7 @@ class StoreTrabalho extends FormRequest ...@@ -22,7 +22,7 @@ class StoreTrabalho extends FormRequest
protected function prepareForValidation() protected function prepareForValidation()
{ {
$func = function($value) { $func = function ($value) {
return ['cpf' => $value]; return ['cpf' => $value];
}; };
$this->merge([ $this->merge([
...@@ -38,101 +38,99 @@ class StoreTrabalho extends FormRequest ...@@ -38,101 +38,99 @@ class StoreTrabalho extends FormRequest
*/ */
public function rules() public function rules()
{ {
// dd($this->all()); //dd($this->all());
$evento = Evento::find($this->editalId); $evento = Evento::find($this->editalId);
$rules = []; $rules = [];
if ($this->has('marcado')) {
if($this->has('marcado')){
$rules['cpfs.*.cpf'] = ['distinct', 'nullable']; $rules['cpfs.*.cpf'] = ['distinct', 'nullable'];
foreach ($this->get('marcado') as $key => $value) { foreach ($this->get('marcado') as $key => $value) {
if( intval($value) == $key){
if (intval($value) == $key) {
//user //user
$rules['name.'.$value] = ['required', 'string']; $rules['name.' . $value] = ['required', 'string'];
$rules['email.'.$value] = ['required', 'string']; $rules['email.' . $value] = ['required', 'string'];
$rules['instituicao.'.$value] = ['required', 'string']; $rules['instituicao.' . $value] = ['required', 'string'];
$rules['cpf.'.$value] = ['required', 'string']; $rules['cpf.' . $value] = ['required', 'string'];
$rules['celular.'.$value] = ['required', 'string']; $rules['celular.' . $value] = ['required', 'string'];
if ($this->estudante[$value] == true) {
if($this->estudante[$value] === true){
//endereco //endereco
$rules['rua.'.$value] = ['required', 'string']; $rules['rua.' . $value] = ['required', 'string'];
$rules['numero.'.$value] = ['required', 'string']; $rules['numero.' . $value] = ['required', 'string'];
$rules['bairro.'.$value] = ['required', 'string']; $rules['bairro.' . $value] = ['required', 'string'];
$rules['cidade.'.$value] = ['required', 'string']; $rules['cidade.' . $value] = ['required', 'string'];
$rules['uf.'.$value] = ['required', 'string']; $rules['uf.' . $value] = ['required', 'string'];
$rules['cep.'.$value] = ['required', 'string']; $rules['cep.' . $value] = ['required', 'string'];
//participante //participante
$rules['rg.'.$value] = ['required', 'string']; $rules['rg.' . $value] = ['required', 'string'];
$rules['data_de_nascimento.'.$value] = ['required', 'string']; $rules['data_de_nascimento.' . $value] = ['required', 'string'];
$rules['curso.'.$value] = ['required', 'string']; $rules['curso.' . $value] = ['required', 'string'];
//participantes da pesquisa //participantes da pesquisa
if($evento->natureza_id != 3){ if ($evento->natureza_id != 3) {
$rules['turno.'.$value] = ['required', 'string']; $rules['turno.' . $value] = ['required', 'string'];
$rules['ordem_prioridade.'.$value] = ['required', 'string']; $rules['ordem_prioridade.' . $value] = ['required', 'string'];
$rules['periodo_atual.'.$value] = ['required', 'string']; $rules['periodo_atual.' . $value] = ['required', 'string'];
$rules['total_periodos.'.$value] = ['required', 'string']; $rules['total_periodos.' . $value] = ['required', 'string'];
$rules['media_do_curso.' . $value] = ['required', 'string']; $rules['media_do_curso.' . $value] = ['required', 'string'];
} }
if($evento->tipo != "CONTINUO" && ($this->funcaoParticipante[$value] == "Voluntário" || $this->funcaoParticipante[$value] == "Bolsista")){ if ($this->funcaoParticipante[$value] == "Voluntário" || $this->funcaoParticipante[$value] == "Bolsista") {
$rules['anexoPlanoTrabalho.'.$value] = ['required']; $rules['anexoPlanoTrabalho.' . $value] = ['required'];
$rules['nomePlanoTrabalho.'.$value] = ['required', 'string']; $rules['nomePlanoTrabalho.' . $value] = ['required', 'string'];
} }
} }
// if($evento->tipo != "PIBEX") { // if($evento->tipo != "PIBEX") {
// $rules['media_do_curso.' . $value] = ['required', 'string']; // $rules['media_do_curso.' . $value] = ['required', 'string'];
// } // }
} }
} }
} else if ($evento->tipo != "CONTINUO") {
} else if($evento->tipo != "CONTINUO" ){
$rules['anexoPlanoTrabalho'] = ['required']; $rules['anexoPlanoTrabalho'] = ['required'];
$rules['nomePlanoTrabalho'] = ['required', 'string']; $rules['nomePlanoTrabalho'] = ['required', 'string'];
} }
if($this->has('rascunho')) { if ($this->has('rascunho')) {
$rules = []; $rules = [];
return $rules; return $rules;
} else { } else {
//anexos //anexos
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), 'file', 'mimes:zip,doc,docx,pdf', 'max:2048'];
} }
if($evento->tipo!="PIBEX" && $evento->tipo!="CONTINUO"){ if ($evento->tipo != "PIBEX" && $evento->tipo != "CONTINUO") {
//dd($this->preenchimentoFormFlag); //dd($this->preenchimentoFormFlag);
$rules['anexoPlanilhaPontuacao'] = ['required']; $rules['anexoPlanilhaPontuacao'] = ['required'];
$rules['anexoLattesCoordenador'] = ['required', 'mimes:pdf']; $rules['anexoLattesCoordenador'] = ['required', 'mimes:pdf'];
$rules['anexoGrupoPesquisa'] = ['required', 'mimes:pdf']; $rules['anexoGrupoPesquisa'] = ['required', 'mimes:pdf'];
$rules['anexoAutorizacaoComiteEtica'] = [Rule::requiredIf($this->autorizacaoFlag == 'sim')]; $rules['anexoAutorizacaoComiteEtica'] = [Rule::requiredIf($this->autorizacaoFlag == 'sim')];
$rules['justificativaAutorizacaoEtica']= [Rule::requiredIf($this->autorizacaoFlag == 'nao')]; $rules['justificativaAutorizacaoEtica'] = [Rule::requiredIf($this->autorizacaoFlag == 'nao')];
$rules['pontuacaoPlanilha'] = ['required', 'string']; $rules['pontuacaoPlanilha'] = ['required', 'string'];
$rules['linkGrupoPesquisa'] = ['required', 'string']; $rules['linkGrupoPesquisa'] = ['required', 'string'];
$rules['preenchimentoFormFlag'] = [Rule::in(['sim']), 'required']; $rules['preenchimentoFormFlag'] = [Rule::in(['sim']), 'required'];
$rules['anexo_acao_afirmativa'] = [Rule::requiredIf($this->radioAcoesAfirmativas == 'sim')]; $rules['anexo_acao_afirmativa'] = [Rule::requiredIf($this->radioAcoesAfirmativas == 'sim')];
} }
$rules['editalId'] = ['required', 'string']; $rules['editalId'] = ['required', 'string'];
$rules['marcado.*'] = ['required']; $rules['marcado.*'] = ['required'];
$rules['titulo'] = ['required', 'string']; $rules['titulo'] = ['required', 'string'];
$rules['grande_area_id'] = [Rule::requiredIf($evento->natureza_id != 3), 'string']; $rules['grande_area_id'] = [Rule::requiredIf($evento->natureza_id != 3), 'string'];
$rules['area_id'] = [Rule::requiredIf($evento->natureza_id != 3), 'string']; $rules['area_id'] = [Rule::requiredIf($evento->natureza_id != 3), 'string'];
if($evento->natureza_id == 3){ if ($evento->natureza_id == 3) {
$rules['area_tematica_id'] = ['required', 'string']; $rules['area_tematica_id'] = ['required', 'string'];
$rules['ods'] = ['required']; $rules['ods'] = ['required'];
} }
$rules['linkLattesEstudante'] = ['required', 'string']; $rules['linkLattesEstudante'] = ['required', 'string'];
if($evento->tipo!="CONTINUO"){ if ($evento->tipo != "CONTINUO") {
$rules['anexoDecisaoCONSU'] = [Rule::requiredIf($evento->consu), 'mimes:pdf']; $rules['anexoDecisaoCONSU'] = [Rule::requiredIf($evento->consu), 'mimes:pdf'];
$rules['anexoProjeto'] = ['required', 'mimes:pdf']; $rules['anexoProjeto'] = ['required', 'mimes:pdf'];
} else { } else {
...@@ -142,42 +140,42 @@ class StoreTrabalho extends FormRequest ...@@ -142,42 +140,42 @@ class StoreTrabalho extends FormRequest
return $rules; return $rules;
} }
} }
public function messages() public function messages()
{ {
return [ return [
'titulo.required' => 'O :attribute é obrigatório', 'titulo.required' => 'O :attribute é obrigatório',
'marcado.*.required' => 'Por favor selcione algum participante, é obrigatório', 'marcado.*.required' => 'Por favor selcione algum participante, é obrigatório',
'grande_area_id.required' => 'O campo grande área é obrigatório', 'grande_area_id.required' => 'O campo grande área é obrigatório',
'anexoPlanoTrabalho.*.required' => 'O :attribute é obrigatório', 'anexoPlanoTrabalho.*.required' => 'O :attribute é obrigatório',
'anexoProjeto.required' => 'O :attribute é obrigatório', 'anexoProjeto.required' => 'O :attribute é obrigatório',
'cpf.*.required' => 'O cpf é obrigatório', 'cpf.*.required' => 'O cpf é obrigatório',
'cpfs.*.cpf.distinct' => 'O integrante com CPF :input não pode ser adicionado mais de uma vez', 'cpfs.*.cpf.distinct' => 'O integrante com CPF :input não pode ser adicionado mais de uma vez',
'name.*.required' => 'O :attribute é obrigatório', 'name.*.required' => 'O :attribute é obrigatório',
'email.*.required' => 'O :attribute é obrigatório', 'email.*.required' => 'O :attribute é obrigatório',
'instituicao.*.required' => 'O :attribute é obrigatório', 'instituicao.*.required' => 'O :attribute é obrigatório',
'emailParticipante.*.required' => 'O :attribute é obrigatório', 'emailParticipante.*.required' => 'O :attribute é obrigatório',
'celular.*.required' => 'O :attribute é obrigatório', 'celular.*.required' => 'O :attribute é obrigatório',
'rua.*.required' => 'O :attribute é obrigatório', 'rua.*.required' => 'O :attribute é obrigatório',
'numero.*.required' => 'O :attribute é obrigatório', 'numero.*.required' => 'O :attribute é obrigatório',
'bairro.*.required' => 'O :attribute é obrigatório', 'bairro.*.required' => 'O :attribute é obrigatório',
'cidade.*.required' => 'O :attribute é obrigatório', 'cidade.*.required' => 'O :attribute é obrigatório',
'uf.*.required' => 'O :attribute é obrigatório', 'uf.*.required' => 'O :attribute é obrigatório',
'cep.*.required' => 'O :attribute é obrigatório', 'cep.*.required' => 'O :attribute é obrigatório',
'complemento.*.required' => 'O :attribute é obrigatório', 'complemento.*.required' => 'O :attribute é obrigatório',
'rg.*.required' => 'O :attribute é obrigatório', 'rg.*.required' => 'O :attribute é obrigatório',
'data_de_nascimento.*.required' => 'O :attribute é obrigatório', 'data_de_nascimento.*.required' => 'O :attribute é obrigatório',
'curso.*.required' => 'O :attribute é obrigatório', 'curso.*.required' => 'O :attribute é obrigatório',
'turno.*.required' => 'O :attribute é obrigatório', 'turno.*.required' => 'O :attribute é obrigatório',
'ordem_prioridade.*.required' => 'O :attribute é obrigatório', 'ordem_prioridade.*.required' => 'O :attribute é obrigatório',
'periodo_atual.*.required' => 'O :attribute é obrigatório', 'periodo_atual.*.required' => 'O :attribute é obrigatório',
'total_periodos.*.required' => 'O :attribute é obrigatório', 'total_periodos.*.required' => 'O :attribute é obrigatório',
'media_do_curso.*.required' => 'O :attribute é obrigatório', 'media_do_curso.*.required' => 'O :attribute é obrigatório',
'anexoPlanoTrabalho.*.required' => 'O :attribute é obrigatório', 'anexoPlanoTrabalho.*.required' => 'O :attribute é obrigatório',
'nomePlanoTrabalho.*.required' => 'O :attribute é obrigatório', 'nomePlanoTrabalho.*.required' => 'O :attribute é obrigatório',
'area_id' => "area id", 'area_id' => "area id",
'area_tematica_id' => 'area tematica id', 'area_tematica_id' => 'area tematica id',
'ods.*' => 'Deve ser selecionada pelo menos uma ODS', 'ods.*' => 'Deve ser selecionada pelo menos uma ODS',
......
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