Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
submeta
Commits
81be6383
Commit
81be6383
authored
Jun 19, 2020
by
alinetenorio
Browse files
povoando form com dados do rascunho
parent
95dd4f97
Changes
3
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/TrabalhoController.php
View file @
81be6383
...
...
@@ -50,11 +50,16 @@ class TrabalhoController extends Controller
return
view
(
'proponente.cadastro'
)
->
with
([
'mensagem'
=>
'Você não possui perfil de Proponente, para submeter algum projeto preencha o formulário.'
]);;
}
$rascunho
=
Trabalho
::
where
(
'proponente_id'
,
$proponente
->
id
)
->
where
(
'evento_id'
,
$edital
->
id
)
->
where
(
'status'
,
'Rascunho'
)
->
orderByDesc
(
'updated_at'
)
->
first
();
//dd($rascunho);
return
view
(
'evento.submeterTrabalho'
,[
'edital'
=>
$edital
,
'grandeAreas'
=>
$grandeAreas
,
'funcaoParticipantes'
=>
$funcaoParticipantes
'funcaoParticipantes'
=>
$funcaoParticipantes
,
'rascunho'
=>
$rascunho
]);
}
...
...
@@ -94,7 +99,7 @@ class TrabalhoController extends Controller
}
}
//--Salvando os
anex
os da submissão temporariamente
//--Salvando os
dad
os da submissão temporariamente
$trabalho
=
$this
->
armazenarInfoTemp
(
$request
,
$proponente
);
//O anexo de Decisão do CONSU dependo do tipo de edital
...
...
@@ -267,83 +272,31 @@ class TrabalhoController extends Controller
}
public
function
storeParcial
(
Request
$request
){
// dd($request->all());
$mytime
=
Carbon
::
now
(
'America/Recife'
);
$mytime
=
$mytime
->
toDateString
();
$evento
=
Evento
::
find
(
$request
->
editalId
);
$coordenador
=
CoordenadorComissao
::
find
(
$evento
->
coordenadorId
);
//Relaciona o projeto criado com o proponente que criou o projeto
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
$trabalho
=
"trabalho"
;
//--Salvando os anexos da submissão temporariamente
$this
->
armazenarAnexosTemp
(
$request
,
Auth
::
user
()
->
id
);
$trabalho
=
Trabalho
::
create
([
'titulo'
=>
$request
->
nomeProjeto
!=
null
?
$request
->
nomeProjeto
:
""
,
'coordenador_id'
=>
$coordenador
->
id
!=
null
?
$request
->
coordenador
->
id
:
""
,
'grande_area_id'
=>
$request
->
grandeArea
!=
null
?
$request
->
grandeArea
:
""
,
'area_id'
=>
$request
->
area
!=
null
?
$request
->
area
:
""
,
'sub_area_id'
=>
$request
->
subArea
!=
null
?
$request
->
subArea
:
""
,
'pontuacaoPlanilha'
=>
$request
->
pontuacaoPlanilha
!=
null
?
$request
->
pontuacaoPlanilha
:
""
,
'linkGrupoPesquisa'
=>
$request
->
linkGrupo
!=
null
?
$request
->
linkGrupo
:
""
,
'linkLattesEstudante'
=>
$request
->
linkLattesEstudante
!=
null
?
$request
->
linkLattesEstudante
:
""
,
'data'
=>
$mytime
,
'evento_id'
=>
$request
->
editalId
!=
null
?
$request
->
editalId
:
""
,
'status'
=>
'Rascunho'
,
'proponente_id'
=>
$proponente
->
id
!=
null
?
$request
->
nomeProjeto
:
""
,
//Anexos
'anexoCONSU'
=>
$request
->
anexoCONSU
!=
null
?
$request
->
anexoCONSU
:
""
,
'anexoProjeto'
=>
$request
->
anexoProjeto
!=
null
?
$request
->
anexoProjeto
:
""
,
'anexoAutorizacaoComiteEtica'
=>
$request
->
anexoComiteEtica
!=
null
?
$request
->
anexoComiteEtica
:
""
,
'justificativaAutorizacaoEtica'
=>
$request
->
justificativaAutorizacaoEtica
!=
null
?
$request
->
justificativaAutorizacaoEtica
:
""
,
'anexoLattesCoordenador'
=>
$request
->
anexoLattesCoordenador
!=
null
?
$request
->
anexoLattesCoordenador
:
""
,
'anexoPlanilhaPontuacao'
=>
$request
->
anexoPlanilha
!=
null
?
$request
->
anexoPlanilha
:
""
,
]);
// Anexo Projeto
if
(
(
!
isset
(
$request
->
anexoProjeto
)
&&
$request
->
anexoProjetoPreenchido
==
'sim'
)
||
isset
(
$request
->
anexoProjeto
)){
Storage
::
putFileAs
(
$anexosTemp
->
anexoProjeto
,
$pasta
.
'/Projeto.pdf'
);
$trabalho
->
anexoProjeto
=
$pasta
.
'/Projeto.pdf'
;
}
//Anexo Decisão CONSU
if
(
$evento
->
tipo
==
'PIBIC'
||
$evento
->
tipo
==
'PIBIC-EM'
)
{
if
(
(
!
isset
(
$request
->
anexoCONSU
)
&&
$request
->
anexoConsuPreenchido
==
'sim'
)
||
isset
(
$request
->
anexoCONSU
)){
Storage
::
putFileAs
(
$anexosTemp
->
anexoDecisaoCONSU
,
$pasta
.
'/CONSU.pdf'
);
$trabalho
->
anexoDecisaoCONSU
=
$pasta
.
'/CONSU.pdf'
;
}
}
//Autorização ou Justificativa
if
(
(
!
isset
(
$request
->
anexoComiteEtica
)
&&
$request
->
anexoComitePreenchido
==
'sim'
)
||
isset
(
$request
->
anexoComiteEtica
)){
Storage
::
putFileAs
(
$anexosTemp
->
anexoAutorizacaoComiteEtica
,
$pasta
.
'/Comite_de_etica.pdf'
);
$trabalho
->
anexoAutorizacaoComiteEtica
=
$pasta
.
'/Comite_de_etica.pdf'
;
}
elseif
(
(
!
isset
(
$request
->
justificativaAutorizacaoEtica
)
&&
$request
->
anexoJustificativaPreenchido
==
'sim'
)
||
isset
(
$request
->
justificativaAutorizacaoEtica
)){
Storage
::
putFileAs
(
$anexosTemp
->
justificativaAutorizacaoEtica
,
$pasta
.
'/Justificativa.pdf'
);
$trabalho
->
justificativaAutorizacaoEtica
=
$pasta
.
'/Justificativa.pdf'
;
$trabalho
=
"trabalho"
;
if
(
$evento
->
inicioSubmissao
>
$mytime
){
if
(
$mytime
>=
$evento
->
fimSubmissao
){
return
redirect
()
->
route
(
'home'
);
}
//Anexo Lattes
if
(
(
!
isset
(
$request
->
anexoLattesCoordenador
)
&&
$request
->
anexoLattesPreenchido
==
'sim'
)
||
isset
(
$request
->
anexoLattesCoordenador
)){
Storage
::
putFileAs
(
$anexosTemp
->
anexoLattesCoordenador
,
$pasta
.
'/Latter_Coordenador.pdf'
);
$trabalho
->
anexoLattesCoordenador
=
$pasta
.
'/Latter_Coordenador.pdf'
;
}
//Anexo Planilha
if
(
(
!
isset
(
$request
->
anexoPlanilha
)
&&
$request
->
anexoPlanilhaPreenchido
==
'sim'
)
||
isset
(
$request
->
anexoPlanilha
)){
Storage
::
putFileAs
(
$anexosTemp
->
anexoPlanilhaPontuacao
,
$pasta
.
'/Planilha.pdf'
);
$trabalho
->
anexoPlanilhaPontuacao
=
$pasta
.
'/Planilha.pdf'
;
}
//--Salvando os dados da submissão temporariamente
$this
->
armazenarInfoTemp
(
$request
,
$proponente
);
return
redirect
()
->
route
(
'projetos.edital'
,[
'id'
=>
$request
->
editalId
]);
}
//Armazena temporariamente
anex
os da submissão, no banco de dados e no storage
//Armazena temporariamente
dad
os da submissão, no banco de dados e no storage
public
function
armazenarInfoTemp
(
Request
$request
,
$proponente
){
//---
Anex
os do Projeto
//---
Dad
os do Projeto
$trabalho
=
Trabalho
::
where
(
'proponente_id'
,
$proponente
->
id
)
->
where
(
'evento_id'
,
$request
->
editalId
)
->
where
(
'status'
,
'Rascunho'
)
->
orderByDesc
(
'updated_at'
)
->
first
();
// dd($trabalho);
...
...
@@ -963,11 +916,12 @@ class TrabalhoController extends Controller
}
public
function
baixarAnexoTemp
(
$eventoId
,
$nomeAnexo
)
{
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
$
anexosTemp
=
AnexosTemp
::
where
(
'evento
I
d'
,
$eventoId
)
->
where
(
'
proponenteId'
,
Auth
::
user
()
->
id
)
$
trabalho
=
Trabalho
::
where
(
'proponente_id'
,
$proponente
->
id
)
->
where
(
'evento
_i
d'
,
$eventoId
)
->
where
(
'
status'
,
'Rascunho'
)
->
orderByDesc
(
'updated_at'
)
->
first
();
return
Storage
::
download
(
$
anexosTemp
->
$nomeAnexo
);
return
Storage
::
download
(
$
trabalho
->
$nomeAnexo
);
}
public
function
baixarEventoTemp
(
$nomeAnexo
){
...
...
resources/views/evento/submeterTrabalho.blade.php
View file @
81be6383
...
...
@@ -16,7 +16,7 @@
<
div
class
=
"row justify-content-center"
>
<
div
class
=
"col-sm-12"
>
<
label
for
=
"nomeProjeto"
class
=
"col-form-label"
>
{{
__
(
'Nome do Projeto*:'
)
}}
</
label
>
<
input
id
=
"nomeProjeto"
type
=
"text"
class
=
"form-control @error('nomeProjeto') is-invalid @enderror"
name
=
"nomeProjeto"
value
=
"{{ old('nomeProjeto')
}}"
required
autocomplete
=
"nomeProjeto"
autofocus
>
<
input
id
=
"nomeProjeto"
type
=
"text"
class
=
"form-control @error('nomeProjeto') is-invalid @enderror"
name
=
"nomeProjeto"
value
=
"{{ old('nomeProjeto')
!== null ? old('nomeProjeto') : (isset(
$rascunho
) ?
$rascunho->titulo
: '')}}"
autocomplete
=
"nomeProjeto"
autofocus
>
@
error
(
'nomeProjeto'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
...
...
@@ -33,7 +33,8 @@
<
select
class
=
"form-control @error('grandeArea') is-invalid @enderror"
id
=
"grandeArea"
name
=
"grandeArea"
onchange
=
"areas()"
>
<
option
value
=
""
disabled
selected
hidden
>--
Grande
Área
--</
option
>
@
foreach
(
$grandeAreas
as
$grandeArea
)
<
option
@
if
(
old
(
'grandeArea'
)
==
$grandeArea
->
id
)
selected
@
endif
value
=
"
{
{$grandeArea->id}}">{{$grandeArea->nome}
}
</option>
<
option
@
if
(
old
(
'grandeArea'
)
!==
null
?
old
(
'grandeArea'
)
:
(
isset
(
$rascunho
)
?
$rascunho
->
grande_area_id
:
''
)
==
$grandeArea
->
id
)
selected
@
endif
value
=
"
{
{$grandeArea->id}}">{{$grandeArea->nome}
}
</option>
@endforeach
</select>
...
...
@@ -49,7 +50,8 @@
<select class="
form
-
control
@
error
(
'area'
)
is
-
invalid
@
enderror
" id="
area
" name="
area
" onchange="
subareas
()
">
<option value="" disabled selected hidden>-- Área --</option>
{{-- @foreach(
$areas
as
$area
)
<option @if(old('area')==
$area->id
) selected @endif value="
{{
$area
->
id
}}
">
{
{$area->nome}
}
</option>
<option @if(old('area') !== null ? old('area') : (isset(
$rascunho
) ?
$rascunho->area_id
: '')
==
$area->id
) selected @endif value="
{{
$area
->
id
}}
">
{
{$area->nome}
}
</option>
@endforeach --}}
</select>
...
...
@@ -65,7 +67,8 @@
<select class="
form
-
control
@
error
(
'subArea'
)
is
-
invalid
@
enderror
" id="
subArea
" name="
subArea
">
<option value="" disabled selected hidden>-- Sub Área --</option>
{{-- @foreach(
$subAreas
as
$subArea
)
<option @if(old('subArea')==
$subArea->id
) selected @endif value="
{{
$subArea
->
id
}}
">
{
{$subArea->nome}
}
</option>
<option @if(old('subArea') !== null ? old('subArea') : (isset(
$rascunho
) ?
$rascunho->sub_area_id
: '')
==
$subArea->id
) selected @endif value="
{{
$subArea
->
id
}}
">
{
{$subArea->nome}
}
</option>
@endforeach --}}
</select>
...
...
@@ -104,7 +107,8 @@
</div>
<div class="
col
-
sm
-
6
">
<label for="
pontuacaoPlanilha
" class="
col
-
form
-
label
">{{ __('Pontuação da Planilha de Pontuação*:') }}</label>
<input class="
form
-
control
@
error
(
'pontuacaoPlanilha'
)
is
-
invalid
@
enderror
" type="
text
" name="
pontuacaoPlanilha
" value="
{{
old
(
'pontuacaoPlanilha'
)}}
">
<input class="
form
-
control
@
error
(
'pontuacaoPlanilha'
)
is
-
invalid
@
enderror
" type="
text
" name="
pontuacaoPlanilha
"
value="
{{
old
(
'pontuacaoPlanilha'
)
!==
null
?
old
(
'pontuacaoPlanilha'
)
:
(
isset
(
$rascunho
)
?
$rascunho
->
pontuacaoPlanilha
:
''
)}}
">
@error('pontuacaoPlanilha')
<span class="
invalid
-
feedback
" role="
alert
" style="
overflow
:
visible
;
display
:
block
">
...
...
@@ -114,7 +118,8 @@
</div>
<div class="
col
-
sm
-
6
">
<label for="
linkGrupo
" class="
col
-
form
-
label
">{{ __('Link do grupo de pesquisa*:') }}</label>
<input class="
form
-
control
@
error
(
'linkGrupo'
)
is
-
invalid
@
enderror
" type="
text
" name="
linkGrupo
" value="
{{
old
(
'linkGrupo'
)}}
">
<input class="
form
-
control
@
error
(
'linkGrupo'
)
is
-
invalid
@
enderror
" type="
text
" name="
linkGrupo
"
value="
{{
old
(
'linkGrupo'
)
!==
null
?
old
(
'linkGrupo'
)
:
(
isset
(
$rascunho
)
?
$rascunho
->
linkGrupoPesquisa
:
''
)}}
">
@error('linkGrupo')
<span class="
invalid
-
feedback
" role="
alert
" style="
overflow
:
visible
;
display
:
block
">
...
...
@@ -133,7 +138,7 @@
{{-- Arquivo --}}
<div class="
col
-
sm
-
6
">
<label for="
anexoProjeto
" class="
col
-
form
-
label
">{{ __('Anexo Projeto*:') }}</label>
@if(old('anexoProjetoPreenchido') != null)
@if(old('anexoProjetoPreenchido') != null
|| (isset(
$rascunho
) &&
$rascunho->anexoProjeto
!= "")
)
<a id="
anexoProjetoTemp
" href="
{{
route
(
'baixar.anexo.temp'
,
[
'eventoId'
=>
$edital
->
id
,
'nomeAnexo'
=>
'anexoProjeto'
])}}
">Arquivo atual</a>
@endif
...
...
@@ -154,7 +159,7 @@
<div class="
col
-
sm
-
6
">
<label for="
anexoLattesCoordenador
" class="
col
-
form
-
label
">{{ __('Anexo do Lattes do Coordenador*:') }}</label>
@if(old('anexoLattesPreenchido') != null)
@if(old('anexoLattesPreenchido') != null
|| (isset(
$rascunho
) &&
$rascunho->anexoLattesCoordenador
!= "")
)
<a id="
anexoLattesTemp
" href="
{{
route
(
'baixar.anexo.temp'
,
[
'eventoId'
=>
$edital
->
id
,
'nomeAnexo'
=>
'anexoLattesCoordenador'
])}}
">Arquivo atual</a>
@endif
...
...
@@ -186,7 +191,7 @@
</span>
@enderror
<br/>
@if(old('anexoComitePreenchido') != null)
@if(old('anexoComitePreenchido') != null
|| (isset(
$rascunho
) &&
$rascunho->anexoAutorizacaoComiteEtica
!= "" &&
$rascunho->anexoAutorizacaoComiteEtica
!= null)
)
<a id="
anexoComiteTemp
" href="
{{
route
(
'baixar.anexo.temp'
,
[
'eventoId'
=>
$edital
->
id
,
'nomeAnexo'
=>
'anexoAutorizacaoComiteEtica'
])}}
">Arquivo atual</a>
@endif
...
...
@@ -207,7 +212,7 @@
<div class="
col
-
sm
-
6
mt
-
3
">
<label for="
anexoPlanilha
" class="
col
-
form
-
label
">{{ __('Anexo do Planilha de Pontuação*:') }}</label>
@if(old('anexoPlanilhaPreenchido') != null)
@if(old('anexoPlanilhaPreenchido') != null
|| (isset(
$rascunho
) &&
$rascunho->anexoPlanilhaPontuacao
!= "")
)
<a id="
anexoPlanilhaTemp
" href="
{{
route
(
'baixar.anexo.temp'
,
[
'eventoId'
=>
$edital
->
id
,
'nomeAnexo'
=>
'anexoPlanilhaPontuacao'
])}}
">Arquivo atual</a>
@endif
...
...
@@ -228,7 +233,7 @@
<div class="
col
-
sm
-
6
">
<label for="
nomeTrabalho
" class="
col
-
form
-
label
">{{ __('Justificativa*:') }}</label>
@if(old('anexoJustificativaPreenchido') != null)
@if(old('anexoJustificativaPreenchido') != null
|| (isset(
$rascunho
) &&
$rascunho->justificativaAutorizacaoEtica
!= "" &&
$rascunho->justificativaAutorizacaoEtica
!= null)
)
<a id="
anexoJustificativaTemp
" href="
{{
route
(
'baixar.anexo.temp'
,
[
'eventoId'
=>
$edital
->
id
,
'nomeAnexo'
=>
'justificativaAutorizacaoEtica'
])}}
">Arquivo atual</a>
@endif
...
...
@@ -252,7 +257,7 @@
{{-- Decisão do CONSU --}}
<div class="
col
-
sm
-
6
">
<label for="
anexoCONSU
" class="
col
-
form
-
label
">{{ __('Decisão do CONSU*:') }}</label>
@if(old('anexoConsuPreenchido') != null)
@if(old('anexoConsuPreenchido') != null
|| (isset(
$rascunho
) &&
$rascunho->anexoDecisaoCONSU
!= "" &&
$rascunho->anexoDecisaoCONSU
!= null)
)
<a id="
anexoConsuTemp
" href="
{{
route
(
'baixar.anexo.temp'
,
[
'eventoId'
=>
$edital
->
id
,
'nomeAnexo'
=>
'anexoDecisaoCONSU'
])}}
">Arquivo atual</a>
@endif
...
...
@@ -296,7 +301,7 @@
<div class="
row
">
<div class="
col
-
sm
-
5
">
<label>Nome Completo*</label>
<input type="
text
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'nomeParticipante'
)
is
-
invalid
@
enderror
" name="
nomeParticipante
[]
" placeholder="
Nome
"
required
value="
{{
old
(
'nomeParticipante.'
.
$i
)}}
">
<input type="
text
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'nomeParticipante'
)
is
-
invalid
@
enderror
" name="
nomeParticipante
[]
" placeholder="
Nome
" value="
{{
old
(
'nomeParticipante.'
.
$i
)}}
">
@error('nomeParticipante')
<span class="
invalid
-
feedback
" role="
alert
" style="
overflow
:
visible
;
display
:
block
">
<strong>{{
$message
}}</strong>
...
...
@@ -305,7 +310,7 @@
</div>
<div class="
col
-
sm
-
4
">
<label>E-mail*</label>
<input type="
email
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'emailParticipante'
)
is
-
invalid
@
enderror
" name="
emailParticipante
[]
" placeholder="
email
"
required
value="
{{
old
(
'emailParticipante.'
.
$i
)}}
">
<input type="
email
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'emailParticipante'
)
is
-
invalid
@
enderror
" name="
emailParticipante
[]
" placeholder="
email
" value="
{{
old
(
'emailParticipante.'
.
$i
)}}
">
@error('emailParticipante')
<span class="
invalid
-
feedback
" role="
alert
" style="
overflow
:
visible
;
display
:
block
">
<strong>{{
$message
}}</strong>
...
...
@@ -549,7 +554,7 @@
"<div class="
+
"row"
+
">"
+
"<div class="
+
"col-sm-5"
+
">"
+
"<label>Nome Completo*</label>"
+
"<input"
+
" type="
+
'text'
+
" style="
+
"margin-bottom:10px"
+
" class="
+
'form-control'
+
" @error('nomeParticipante') is-invalid @enderror"
+
"name="
+
'nomeParticipante[]'
+
" placeholder="
+
"Nome"
+
"
required
>"
+
"<input"
+
" type="
+
'text'
+
" style="
+
"margin-bottom:10px"
+
" class="
+
'form-control'
+
" @error('nomeParticipante') is-invalid @enderror"
+
"name="
+
'nomeParticipante[]'
+
" placeholder="
+
"Nome"
+
">"
+
"@error('nomeParticipante')"
+
"<span class='invalid-feedback'"
+
"role='alert'"
+
"style='overflow: visible; display:block'>"
+
"<strong>{{
$message
}}</strong>"
+
...
...
@@ -558,7 +563,7 @@
"</div>"
+
"<div class="
+
"col-sm-4"
+
">"
+
"<label>E-mail*</label>"
+
"<input type='email'"
+
"style='margin-bottom:10px'"
+
"class="
+
"form-control @error('emailParticipante') is-invalid @enderror"
+
"name='emailParticipante[]'"
+
"placeholder='email'
required
>"
+
"<input type='email'"
+
"style='margin-bottom:10px'"
+
"class="
+
"form-control @error('emailParticipante') is-invalid @enderror"
+
"name='emailParticipante[]'"
+
"placeholder='email' >"
+
"@error('emailParticipante')"
+
"<span class='invalid-feedback'"
+
"role='alert'"
+
"style='overflow: visible; display:block'>"
+
"<strong>{{
$message
}}</strong>"
+
...
...
resources/views/projeto/index.blade.php
View file @
81be6383
...
...
@@ -31,6 +31,7 @@
</
thead
>
<
tbody
>
@
foreach
(
$projetos
as
$projeto
)
@
if
(
$projeto
->
status
!=
'Rascunho'
)
<
tr
>
<
td
>
{{
$projeto
->
titulo
}}
...
...
@@ -69,6 +70,7 @@
</
div
>
</
td
>
</
tr
>
@
endif
@
endforeach
</
tbody
>
</
table
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment