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
ec18d6fc
Commit
ec18d6fc
authored
May 14, 2021
by
Carlos André
Browse files
alterando banco e controller para a submissão de um projeto
parent
742a6215
Changes
9
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/TrabalhoController.php
View file @
ec18d6fc
...
@@ -21,6 +21,7 @@ use App\FuncaoParticipantes;
...
@@ -21,6 +21,7 @@ use App\FuncaoParticipantes;
use
App\Participante
;
use
App\Participante
;
use
App\Avaliador
;
use
App\Avaliador
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
App\Endereco
;
use
Auth
;
use
Auth
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\File
;
use
Illuminate\Http\File
;
...
@@ -63,7 +64,7 @@ class TrabalhoController extends Controller
...
@@ -63,7 +64,7 @@ class TrabalhoController extends Controller
'grandeAreas'
=>
$grandeAreas
,
'grandeAreas'
=>
$grandeAreas
,
'funcaoParticipantes'
=>
$funcaoParticipantes
,
'funcaoParticipantes'
=>
$funcaoParticipantes
,
'rascunho'
=>
$rascunho
,
'rascunho'
=>
$rascunho
,
'enum_turno'
=>
OutrasInfo
Participante
::
ENUM_TURNO
'enum_turno'
=>
Participante
::
ENUM_TURNO
]);
]);
}
}
...
@@ -84,7 +85,7 @@ class TrabalhoController extends Controller
...
@@ -84,7 +85,7 @@ class TrabalhoController extends Controller
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
store
(
Request
$request
){
public
function
store
(
Request
$request
){
dd
(
$request
);
$mytime
=
Carbon
::
now
(
'America/Recife'
);
$mytime
=
Carbon
::
now
(
'America/Recife'
);
$mytime
=
$mytime
->
toDateString
();
$mytime
=
$mytime
->
toDateString
();
$evento
=
Evento
::
find
(
$request
->
editalId
);
$evento
=
Evento
::
find
(
$request
->
editalId
);
...
@@ -971,4 +972,157 @@ class TrabalhoController extends Controller
...
@@ -971,4 +972,157 @@ class TrabalhoController extends Controller
}
}
return
abort
(
404
);
return
abort
(
404
);
}
}
public
function
salvar
(
Request
$request
)
{
$edital
=
Evento
::
find
(
$request
->
editalId
);
$hoje
=
now
();
if
(
!
(
$edital
->
inicioSubmissao
<
$hoje
&&
$edital
->
fimSubmissao
>=
$hoje
))
{
return
redirect
()
->
route
(
'inicial'
)
->
with
([
'error'
=>
0
,
'mensagem'
=>
'As submissões para o edital '
.
$edital
->
titulo
.
' foram encerradas.'
]);
}
$projeto
=
$this
->
atribuirDados
(
$request
,
$edital
);
$projeto
->
save
();
// Salvando anexos no storage
$pasta
=
'trabalhos/'
.
$edital
->
id
.
'/'
.
$projeto
->
id
;
$projeto
=
$this
->
armazenarAnexosFinais
(
$request
,
$pasta
,
$projeto
,
$edital
);
$subject
=
"Submissão de Trabalho"
;
$proponente
=
Auth
()
->
user
();
Mail
::
to
(
$proponente
->
email
)
->
send
(
new
SubmissaoTrabalho
(
$proponente
,
$subject
,
$edital
,
$projeto
));
// Salvando participantes
$this
->
salvarParticipantes
(
$request
,
$edital
,
$projeto
);
dd
(
"foi"
);
}
public
function
atribuirDados
(
Request
$request
,
$edital
)
{
$projeto
=
new
Trabalho
();
$proponente
=
User
::
find
(
auth
()
->
user
()
->
id
)
->
proponentes
;
$hoje
=
now
();
$projeto
->
titulo
=
$request
->
nomeProjeto
;
$projeto
->
coordenador_id
=
$edital
->
coordenadorComissao
->
id
;
$projeto
->
grande_area_id
=
$request
->
grandeArea
;
$projeto
->
area_id
=
$request
->
area
;
$projeto
->
sub_area_id
=
$request
->
subArea
;
$projeto
->
pontuacaoPlanilha
=
$request
->
pontuacaoPlanilha
;
$projeto
->
linkGrupoPesquisa
=
$request
->
linkGrupo
;
$projeto
->
linkLattesEstudante
=
$request
->
linkLattesEstudante
;
$projeto
->
data
=
$hoje
;
$projeto
->
evento_id
=
$request
->
editalId
;
$projeto
->
status
=
'Submetido'
;
$projeto
->
proponente_id
=
$proponente
->
id
;
//Anexos
$projeto
->
anexoProjeto
=
$request
->
anexoProjeto
;
$projeto
->
anexoAutorizacaoComiteEtica
=
$request
->
anexoComiteEtica
;
$projeto
->
justificativaAutorizacaoEtica
=
$request
->
justificativaAutorizacaoEtica
;
$projeto
->
anexoLattesCoordenador
=
$request
->
anexoLattesCoordenador
;
$projeto
->
anexoPlanilhaPontuacao
=
$request
->
anexoPlanilha
;
if
(
$edital
->
tipo
==
'PIBIC'
||
$edital
->
tipo
==
'PIBIC-EM'
){
$projeto
->
anexoDecisaoCONSU
=
$request
->
anexoCONSU
;
}
return
$projeto
;
}
public
function
salvarParticipantes
(
Request
$request
,
$edital
,
$projeto
)
{
if
(
$request
->
emailParticipante
!=
null
)
{
foreach
(
$request
->
emailParticipante
as
$key
=>
$email
)
{
$userParticipante
=
User
::
where
(
'email'
,
$email
)
->
first
();
$participante
=
new
Participante
();
if
(
$userParticipante
==
null
){
$passwordTemporario
=
Str
::
random
(
8
);
$usuario
=
new
User
();
$usuario
->
email
=
$email
;
$usuario
->
password
=
bcrypt
(
$passwordTemporario
);
$usuario
->
usuarioTemp
=
false
;
$usuario
->
name
=
$request
->
nomeParticipante
[
$key
];
$usuario
->
tipo
=
'participante'
;
$usuario
->
instituicao
=
$request
->
universidade
[
$key
];
$usuario
->
cpf
=
$request
->
cpf
[
$key
];
$usuario
->
celular
=
$request
->
celular
[
$key
];
$endereco
=
new
Endereco
();
$endereco
->
rua
=
$request
->
rua
[
$key
];
$endereco
->
numero
=
$request
->
numero
[
$key
];
$endereco
->
bairro
=
$request
->
bairro
[
$key
];
$endereco
->
cidade
=
$request
->
cidade
[
$key
];
$endereco
->
uf
=
$request
->
uf
[
$key
];
$endereco
->
cep
=
$request
->
cep
[
$key
];
$endereco
->
complemento
=
$request
->
complemento
[
$key
];
$endereco
->
save
();
$usuario
->
enderecoId
=
$endereco
->
id
;
$usuario
->
save
();
$participante
->
user_id
=
$usuario
->
id
;
$participante
->
trabalho_id
=
$projeto
->
id
;
$participante
->
funcao_participante_id
=
$request
->
funcaoParticipante
[
$key
];
$participante
->
confirmacao_convite
=
true
;
$participante
->
rg
=
$request
->
rg
[
$key
];
$participante
->
data_de_nascimento
=
$request
->
data_de_nascimento
[
$key
];
$participante
->
curso
=
$request
->
curso
[
$key
];
$participante
->
turno
=
$request
->
turno
[
$key
];
$participante
->
ordem_prioridade
=
$request
->
ordem_prioridade
[
$key
];
$participante
->
periodo_atual
=
$request
->
periodo_cursado
[
$key
];
$participante
->
total_periodos
=
$request
->
total_periodos
[
$key
];
$participante
->
media_do_curso
=
$request
->
media_geral_curso
[
$key
];
$participante
->
save
();
$subject
=
"Participante de Projeto"
;
Mail
::
to
(
$email
)
->
send
(
new
EmailParaUsuarioNaoCadastrado
(
Auth
()
->
user
()
->
name
,
$projeto
->
titulo
,
'Participante'
,
$edital
->
nome
,
$passwordTemporario
,
$subject
));
}
else
{
$participante
->
user_id
=
$userParticipante
->
id
;
$participante
->
trabalho_id
=
$projeto
->
id
;
$participante
->
funcao_participante_id
=
$request
->
funcaoParticipante
[
$key
];
$participante
->
confirmacao_convite
=
true
;
$participante
->
rg
=
$request
->
rg
[
$key
];
$participante
->
data_de_nascimento
=
$request
->
data_de_nascimento
[
$key
];
$participante
->
curso
=
$request
->
curso
[
$key
];
$participante
->
turno
=
$request
->
turno
[
$key
];
$participante
->
ordem_prioridade
=
$request
->
ordem_prioridade
[
$key
];
$participante
->
periodo_atual
=
$request
->
periodo_cursado
[
$key
];
$participante
->
total_periodos
=
$request
->
total_periodos
[
$key
];
$participante
->
media_do_curso
=
$request
->
media_geral_curso
[
$key
];
$participante
->
save
();
$subject
=
"Participante de Projeto"
;
Mail
::
to
(
$email
)
->
send
(
new
SubmissaoTrabalho
(
$userParticipante
,
$subject
,
$edital
,
$projeto
));
}
if
(
$request
->
nomePlanoTrabalho
[
$key
]
!=
null
){
$usuario
=
User
::
where
(
'email'
,
$email
)
->
first
();
$participante
=
Participante
::
where
([[
'user_id'
,
'='
,
$usuario
->
id
],
[
'trabalho_id'
,
'='
,
$projeto
->
id
]])
->
first
();
$path
=
'trabalhos/'
.
$edital
->
id
.
'/'
.
$projeto
->
id
.
'/'
;
$nome
=
$request
->
nomePlanoTrabalho
[
$key
]
.
".pdf"
;
$file
=
$request
->
anexoPlanoTrabalho
[
$key
];
Storage
::
putFileAs
(
$path
,
$file
,
$nome
);
$agora
=
now
();
$arquivo
=
new
Arquivo
();
$arquivo
->
titulo
=
$request
->
nomePlanoTrabalho
[
$key
];
$arquivo
->
nome
=
$path
.
$nome
;
$arquivo
->
trabalhoId
=
$projeto
->
id
;
$arquivo
->
data
=
$agora
;
$arquivo
->
participanteId
=
$participante
->
id
;
$arquivo
->
versaoFinal
=
true
;
$arquivo
->
save
();
}
}
}
}
}
}
\ No newline at end of file
app/OutrasInfoParticipante.php
deleted
100644 → 0
View file @
742a6215
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
OutrasInfoParticipante
extends
Model
{
protected
$fillable
=
[
'name'
,
'user_id'
,
'trabalho_id'
,
'participante_id'
];
public
const
ENUM_TURNO
=
[
'Matutino'
,
'Vespertino'
,
'Noturno'
,
'Integral'
];
}
app/Participante.php
View file @
ec18d6fc
...
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
...
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class
Participante
extends
Model
class
Participante
extends
Model
{
{
use
SoftDeletes
;
use
SoftDeletes
;
public
const
ENUM_TURNO
=
[
'Matutino'
,
'Vespertino'
,
'Noturno'
,
'Integral'
];
protected
$fillable
=
[
'name'
,
'user_id'
,
'trabalho_id'
,
'participante_id'
];
protected
$fillable
=
[
'name'
,
'user_id'
,
'trabalho_id'
,
'participante_id'
];
...
...
database/migrations/2020_02_05_123217_create_enderecos_table.php
View file @
ec18d6fc
...
@@ -22,6 +22,7 @@ class CreateEnderecosTable extends Migration
...
@@ -22,6 +22,7 @@ class CreateEnderecosTable extends Migration
$table
->
string
(
'cidade'
);
$table
->
string
(
'cidade'
);
$table
->
string
(
'uf'
);
$table
->
string
(
'uf'
);
$table
->
string
(
'cep'
);
$table
->
string
(
'cep'
);
$table
->
string
(
'complemento'
)
->
nullable
(
true
);
});
});
}
}
...
...
database/migrations/2020_05_23_054945_create_participantes_table.php
View file @
ec18d6fc
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Support\Facades\Schema
;
use
App\Participante
;
class
CreateParticipantesTable
extends
Migration
class
CreateParticipantesTable
extends
Migration
{
{
...
@@ -15,11 +16,21 @@ class CreateParticipantesTable extends Migration
...
@@ -15,11 +16,21 @@ class CreateParticipantesTable extends Migration
{
{
Schema
::
create
(
'participantes'
,
function
(
Blueprint
$table
)
{
Schema
::
create
(
'participantes'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
bigIncrements
(
'id'
);
$table
->
boolean
(
'confirmacao_convite'
)
->
nullable
();
$table
->
boolean
(
'confirmacao_convite'
)
->
nullable
()
->
nullable
(
true
);
$table
->
string
(
"rg"
)
->
nullable
(
true
);
$table
->
date
(
"data_de_nascimento"
)
->
nullable
(
true
);
$table
->
string
(
"curso"
)
->
nullable
(
true
);
$table
->
enum
(
"turno"
,
Participante
::
ENUM_TURNO
)
->
nullable
(
true
);
$table
->
integer
(
"ordem_prioridade"
)
->
nullable
(
true
);
$table
->
string
(
"periodo_atual"
)
->
nullable
(
true
);
$table
->
string
(
"total_periodos"
)
->
nullable
(
true
);
$table
->
double
(
"media_do_curso"
,
3
,
2
)
->
nullable
(
true
);
$table
->
timestamps
();
$table
->
timestamps
();
$table
->
unsignedBigInteger
(
'user_id'
)
->
nullable
();
$table
->
unsignedBigInteger
(
'user_id'
)
->
nullable
();
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
$table
->
unsignedBigInteger
(
'trabalho_id'
)
->
nullable
();
$table
->
unsignedBigInteger
(
'trabalho_id'
)
->
nullable
();
$table
->
foreign
(
'trabalho_id'
)
->
references
(
'id'
)
->
on
(
'trabalhos'
);
$table
->
foreign
(
'trabalho_id'
)
->
references
(
'id'
)
->
on
(
'trabalhos'
);
...
...
database/migrations/2021_05_05_161225_create_outras_info_participantes_table.php
deleted
100644 → 0
View file @
742a6215
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
use
App\OutrasInfoParticipante
;
class
CreateOutrasInfoParticipantesTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'outras_info_participantes'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
"rg"
);
$table
->
date
(
"data_de_nascimento"
);
$table
->
string
(
"curso"
);
$table
->
enum
(
"turno"
,
OutrasInfoParticipante
::
ENUM_TURNO
)
->
nullable
(
true
);
$table
->
integer
(
"ordem_prioridade"
)
->
nullable
(
true
);
$table
->
string
(
"periodo_atual"
)
->
nullable
(
true
);
$table
->
string
(
"total_periodos"
)
->
nullable
(
true
);
$table
->
double
(
"media_do_curso"
,
3
,
2
)
->
nullable
(
true
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'outras_info_participantes'
);
}
}
database/migrations/2021_05_05_163601_add_column_participante.php
deleted
100644 → 0
View file @
742a6215
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddColumnParticipante
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'participantes'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'outras_info_participante_id'
)
->
nullable
(
true
);
$table
->
foreign
(
'outras_info_participante_id'
)
->
references
(
'id'
)
->
on
(
'outras_info_participantes'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
//
}
}
resources/views/coordenador/home.blade.php
View file @
ec18d6fc
...
@@ -14,7 +14,9 @@
...
@@ -14,7 +14,9 @@
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
@
php
$hoje
=
now
();
@
endphp
<
div
class
=
"row"
>
<
div
class
=
"row"
>
...
...
routes/web.php
View file @
ec18d6fc
...
@@ -97,7 +97,7 @@ Route::prefix('avaliador')->name('avaliador.')->group(function(){
...
@@ -97,7 +97,7 @@ Route::prefix('avaliador')->name('avaliador.')->group(function(){
Route
::
get
(
'/trabalho/submeter/{id}'
,
'TrabalhoController@index'
)
->
name
(
'trabalho.index'
);
Route
::
get
(
'/trabalho/submeter/{id}'
,
'TrabalhoController@index'
)
->
name
(
'trabalho.index'
);
Route
::
get
(
'/trabalho/visualizar/{id}'
,
'TrabalhoController@show'
)
->
name
(
'trabalho.show'
);
Route
::
get
(
'/trabalho/visualizar/{id}'
,
'TrabalhoController@show'
)
->
name
(
'trabalho.show'
);
Route
::
post
(
'/trabalho/novaVersao'
,
'TrabalhoController@novaVersao'
)
->
name
(
'trabalho.novaVersao'
);
Route
::
post
(
'/trabalho/novaVersao'
,
'TrabalhoController@novaVersao'
)
->
name
(
'trabalho.novaVersao'
);
Route
::
post
(
'/trabalho/criar'
,
'TrabalhoController@s
tore
'
)
->
name
(
'trabalho.store'
);
Route
::
post
(
'/trabalho/criar'
,
'TrabalhoController@s
alvar
'
)
->
name
(
'trabalho.store'
);
Route
::
post
(
'/trabalho/criarRascunho'
,
'TrabalhoController@storeParcial'
)
->
name
(
'trabalho.storeParcial'
);
Route
::
post
(
'/trabalho/criarRascunho'
,
'TrabalhoController@storeParcial'
)
->
name
(
'trabalho.storeParcial'
);
Route
::
get
(
'/edital/{id}/projetos'
,
'TrabalhoController@projetosDoEdital'
)
->
name
(
'projetos.edital'
);
Route
::
get
(
'/edital/{id}/projetos'
,
'TrabalhoController@projetosDoEdital'
)
->
name
(
'projetos.edital'
);
Route
::
get
(
'/projeto/{id}/visualizar'
,
'TrabalhoController@show'
)
->
name
(
'trabalho.show'
);
Route
::
get
(
'/projeto/{id}/visualizar'
,
'TrabalhoController@show'
)
->
name
(
'trabalho.show'
);
...
...
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