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
34f2a26d
Commit
34f2a26d
authored
Jun 08, 2020
by
carlos
Browse files
atualizando
parent
7b97025b
Changes
4
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/TrabalhoController.php
View file @
34f2a26d
...
...
@@ -79,7 +79,7 @@ class TrabalhoController extends Controller
//Relaciona o projeto criado com o proponente que criou o projeto
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
//$trabalho->proponentes()->save($proponente);
//dd($coordenador);
//dd($coordenador
->id
);
$trabalho
=
"trabalho"
;
if
(
$evento
->
inicioSubmissao
>
$mytime
){
if
(
$mytime
>=
$evento
->
fimSubmissao
){
...
...
@@ -287,6 +287,8 @@ class TrabalhoController extends Controller
$subareas
=
Subarea
::
all
();
$funcaoParticipantes
=
FuncaoParticipantes
::
all
();
$participantes
=
Participante
::
where
(
'trabalho_id'
,
$id
)
->
get
();
$participantesUsersIds
=
Participante
::
where
(
'trabalho_id'
,
$id
)
->
select
(
'user_id'
)
->
get
();
$users
=
User
::
whereIn
(
'id'
,
$participantesUsersIds
)
->
get
();
$arquivos
=
Arquivo
::
where
(
'trabalhoId'
,
$id
)
->
get
();
return
view
(
'projeto.editar'
)
->
with
([
'projeto'
=>
$projeto
,
...
...
@@ -294,6 +296,7 @@ class TrabalhoController extends Controller
'areas'
=>
$areas
,
'subAreas'
=>
$subareas
,
'edital'
=>
$edital
,
'users'
=>
$users
,
'funcaoParticipantes'
=>
$funcaoParticipantes
,
'participantes'
=>
$participantes
,
'arquivos'
=>
$arquivos
,]);
...
...
@@ -401,10 +404,11 @@ class TrabalhoController extends Controller
$trabalho
->
update
();
// criando novos participantes que podem ter sido adicionados
$participantes
=
Participante
::
where
(
'trabalho_id'
,
$trabalho
->
id
)
->
get
();
$participantesUsersIds
=
Participante
::
where
(
'trabalho_id'
,
'='
,
$trabalho
->
id
)
->
select
(
'user_id'
)
->
get
();
$users
=
User
::
whereIn
(
'id'
,
$participantesUsersIds
)
->
get
();
$emailParticipantes
=
[];
foreach
(
$
participantes
as
$participante
)
{
array_push
(
$emailParticipantes
,
$
participante
->
user
->
email
);
foreach
(
$
users
as
$user
)
{
array_push
(
$emailParticipantes
,
$user
->
email
);
}
foreach
(
$request
->
emailParticipante
as
$key
=>
$value
)
{
...
...
@@ -443,7 +447,7 @@ class TrabalhoController extends Controller
//atualizando os participantes que já estão no projeto e planos de trabalho se enviados
if
(
in_array
(
$request
->
emailParticipante
[
$key
],
$emailParticipantes
,
false
))
{
$user
=
User
::
where
(
'email'
,
$request
->
emailParticipante
[
$key
])
->
first
();
$participante
::
where
([[
'user_id'
,
'='
,
$user
->
id
],
[
'trabalho_id'
,
'='
,
$trabalho
->
id
]]);
$participante
=
Participante
::
where
([[
'user_id'
,
'='
,
$user
->
id
],
[
'trabalho_id'
,
'='
,
$trabalho
->
id
]])
->
first
()
;
$user
->
name
=
$request
->
nomeParticipante
[
$key
];
$user
->
update
();
...
...
@@ -451,34 +455,37 @@ class TrabalhoController extends Controller
$participante
->
funcao_participante_id
=
$request
->
funcaoParticipante
[
$key
];
$participante
->
update
();
//
//atualizando planos de trabalho
incompleto
// dd($request);
//
if (!(is_null($request->anexoPlanoTrabalho[
1
]))) {
//
$arquivo = Arquivo::where('participanteId', $participante->id)->first();
//
Storage::delete($arquivo->nome);
//
$arquivo->delete();
//atualizando planos de trabalho
if
(
array_key_exists
(
$key
,
$request
->
anexoPlanoTrabalho
))
{
if
(
!
(
is_null
(
$request
->
anexoPlanoTrabalho
[
$key
])))
{
$arquivo
=
Arquivo
::
where
(
'participanteId'
,
$participante
->
id
)
->
first
();
Storage
::
delete
(
$arquivo
->
nome
);
$arquivo
->
delete
();
//
$path = 'trabalhos/' . $request->editalId . '/' . $trabalho->id .'/';
//
$nome = $request->nomePlanoTrabalho[$key] .".pdf";
//
$file = $request->anexoPlanoTrabalho[$key];
//
Storage::putFileAs($path, $file, $nome);
$path
=
'trabalhos/'
.
$request
->
editalId
.
'/'
.
$trabalho
->
id
.
'/'
;
$nome
=
$request
->
nomePlanoTrabalho
[
$key
]
.
".pdf"
;
$file
=
$request
->
anexoPlanoTrabalho
[
$key
];
Storage
::
putFileAs
(
$path
,
$file
,
$nome
);
// $arquivo = new Arquivo();
// $arquivo->nome = $path . $nome;
// $arquivo->trabalhoId = $trabalho->id;
// $arquivo->data = $mytime;
// $arquivo->participanteId = $participante->id;
// $arquivo->versaoFinal = true;
// $arquivo->save();
// }
$arquivo
=
new
Arquivo
();
$arquivo
->
nome
=
$path
.
$nome
;
$arquivo
->
trabalhoId
=
$trabalho
->
id
;
$arquivo
->
data
=
$mytime
;
$arquivo
->
participanteId
=
$participante
->
id
;
$arquivo
->
versaoFinal
=
true
;
$arquivo
->
save
();
}
}
}
}
// Atualizando possiveis usuários removidos
$participantes
=
Participante
::
where
(
'trabalho_id'
,
$trabalho
->
id
)
->
get
();
$participantesUsersIds
=
Participante
::
where
(
'trabalho_id'
,
'='
,
$trabalho
->
id
)
->
select
(
'user_id'
)
->
get
();
$users
=
User
::
whereIn
(
'id'
,
$participantesUsersIds
)
->
get
();
foreach
(
$participantes
as
$participante
)
{
if
(
!
(
in_array
(
$participante
->
user
->
email
,
$request
->
emailParticipante
,
false
)))
{
foreach
(
$users
as
$user
)
{
if
(
!
(
in_array
(
$user
->
email
,
$request
->
emailParticipante
,
false
)))
{
$participante
=
Participante
::
where
([[
'user_id'
,
'='
,
$user
->
id
],
[
'trabalho_id'
,
'='
,
$trabalho
->
id
]])
->
first
();
$arquivo
=
Arquivo
::
where
(
'participanteId'
,
$participante
->
id
);
Storage
::
delete
(
$arquivo
->
nome
);
$arquivo
->
delete
();
...
...
composer.lock
View file @
34f2a26d
...
...
@@ -1215,16 +1215,16 @@
},
{
"name": "opis/closure",
"version": "3.5.
3
",
"version": "3.5.
4
",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "
cac47092144043d5d676e2e7cf8d0d2f83fc89ca
"
"reference": "
1d0deef692f66dae5d70663caee2867d0971306b
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/
cac47092144043d5d676e2e7cf8d0d2f83fc89ca
",
"reference": "
cac47092144043d5d676e2e7cf8d0d2f83fc89ca
",
"url": "https://api.github.com/repos/opis/closure/zipball/
1d0deef692f66dae5d70663caee2867d0971306b
",
"reference": "
1d0deef692f66dae5d70663caee2867d0971306b
",
"shasum": ""
},
"require": {
...
...
@@ -1272,7 +1272,7 @@
"serialization",
"serialize"
],
"time": "2020-0
5-25T09:32:45
+00:00"
"time": "2020-0
6-07T11:41:29
+00:00"
},
{
"name": "paragonie/random_compat",
...
...
@@ -1321,16 +1321,16 @@
},
{
"name": "phpoption/phpoption",
"version": "1.7.
3
",
"version": "1.7.
4
",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
"reference": "
4acfd6a4b33a509d8c88f50e5222f734b6aeebae
"
"reference": "
b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/
4acfd6a4b33a509d8c88f50e5222f734b6aeebae
",
"reference": "
4acfd6a4b33a509d8c88f50e5222f734b6aeebae
",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/
b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3
",
"reference": "
b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3
",
"shasum": ""
},
"require": {
...
...
@@ -1372,7 +1372,7 @@
"php",
"type"
],
"time": "2020-0
3-21T18:07:53
+00:00"
"time": "2020-0
6-07T10:40:07
+00:00"
},
{
"name": "psr/container",
...
...
@@ -3316,27 +3316,27 @@
},
{
"name": "vlucas/phpdotenv",
"version": "v3.6.
5
",
"version": "v3.6.
6
",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "
8b64814b356b96a90d2bc942b152c80d8888b8d4
"
"reference": "
4669484ccbc38fe7c4e0c50456778f2010566aad
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/
8b64814b356b96a90d2bc942b152c80d8888b8d4
",
"reference": "
8b64814b356b96a90d2bc942b152c80d8888b8d4
",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/
4669484ccbc38fe7c4e0c50456778f2010566aad
",
"reference": "
4669484ccbc38fe7c4e0c50456778f2010566aad
",
"shasum": ""
},
"require": {
"php": "^5.4 || ^7.0 || ^8.0",
"phpoption/phpoption": "^1.5",
"symfony/polyfill-ctype": "^1.
9
"
"phpoption/phpoption": "^1.5
.2
",
"symfony/polyfill-ctype": "^1.
16
"
},
"require-dev": {
"ext-filter": "*",
"ext-pcre": "*",
"phpunit/phpunit": "^4.8.35 || ^5.
0
|| ^6.
0
|| ^7.0"
"phpunit/phpunit": "^4.8.35 || ^5.
7.27
|| ^6.
5.6
|| ^7.0"
},
"suggest": {
"ext-filter": "Required to use the boolean validator.",
...
...
@@ -3375,7 +3375,7 @@
"env",
"environment"
],
"time": "2020-0
5-23T09:42:03
+00:00"
"time": "2020-0
6-02T14:08:54
+00:00"
}
],
"packages-dev": [
...
...
resources/views/administrador/index.blade.php
View file @
34f2a26d
...
...
@@ -27,6 +27,17 @@
</
div
>
</
a
>
</
div
>
<
div
class
=
"col-sm-3 d-flex justify-content-center"
>
<
a
href
=
"{{ route('grandearea.index') }}"
style
=
"text-decoration:none; color: inherit;"
>
<
div
class
=
"card text-center "
style
=
"border-radius: 30px; width: 13rem;height: 15rem;"
>
<
div
class
=
"card-body d-flex justify-content-center"
>
<
h2
style
=
"padding-top:15px"
>
Áreas
</
h2
>
</
div
>
</
div
>
</
a
>
</
div
>
<
div
class
=
"col-sm-3 d-flex justify-content-center"
>
<
a
href
=
"{{ route('admin.usuarios') }}"
style
=
"text-decoration:none; color: inherit;"
>
<
div
class
=
"card text-center "
style
=
"border-radius: 30px; width: 13rem;height: 15rem;"
>
...
...
resources/views/projeto/editar.blade.php
View file @
34f2a26d
...
...
@@ -273,13 +273,15 @@
<div class="
col
-
sm
-
12
">
<div id="
participantes
">
@foreach(
$participantes
as
$participante
)
@foreach(
$users
as
$user
)
@if(
$participante->user_id
===
$user->id
)
<div id="
novoParticipante
">
<br>
<h5>Dados do participante</h5>
<div class="
row
">
<div class="
col
-
sm
-
5
">
<label>Nome Completo</label>
<input value="
{{
$
participante
->
user
->
name
}}
" type="
text
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'nomeParticipante'
)
is
-
invalid
@
enderror
" name="
nomeParticipante
[]
" placeholder="
Nome
" required>
<input value="
{{
$user
->
name
}}
" type="
text
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'nomeParticipante'
)
is
-
invalid
@
enderror
" name="
nomeParticipante
[]
" placeholder="
Nome
" required>
@error('nomeParticipante')
<span class="
invalid
-
feedback
" role="
alert
" style="
overflow
:
visible
;
display
:
block
">
<strong>{{
$message
}}</strong>
...
...
@@ -288,7 +290,7 @@
</div>
<div class="
col
-
sm
-
4
">
<label>E-mail</label>
<input value="
{{
$
participante
->
user
->
email
}}
" type="
email
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'emailParticipante'
)
is
-
invalid
@
enderror
" name="
emailParticipante
[]
" placeholder="
email
" required>
<input value="
{{
$user
->
email
}}
" type="
email
" style="
margin
-
bottom
:
10
px
" class="
form
-
control
@
error
(
'emailParticipante'
)
is
-
invalid
@
enderror
" name="
emailParticipante
[]
" placeholder="
email
" required>
@error('emailParticipante')
<span class="
invalid
-
feedback
" role="
alert
" style="
overflow
:
visible
;
display
:
block
">
<strong>{{
$message
}}</strong>
...
...
@@ -363,6 +365,8 @@
</div>
</div>
</div>
@endif
@endforeach
@endforeach
</div>
<a href="
#" class="btn btn-primary" id="addCoautor" style="width:100%;margin-top:10px">Participantes +</a>
...
...
@@ -419,7 +423,7 @@
addModalidade
(
$
(
this
)
.
val
());
});
$
(
document
)
.
on
(
'click'
,
'.delete'
,
function
()
{
if
(
qtdParticipantes
>
2
)
{
if
(
qtdParticipantes
>
1
)
{
qtdParticipantes
--
;
$
(
this
)
.
closest
(
'#novoParticipante'
)
.
remove
();
return
false
;
...
...
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