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
907cb7b8
Commit
907cb7b8
authored
Aug 12, 2024
by
Gabriel Alves
Browse files
Ajuste listar metas funcional
parent
77bcd053
Changes
6
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/EventoController.php
View file @
907cb7b8
...
...
@@ -773,22 +773,6 @@ class EventoController extends Controller
return
response
()
->
download
(
$path
);
}
public
function
getMetas
(
$odsId
)
{
{
try
{
$ods
=
ObjetivoDeDesenvolvimentoSustentavel
::
with
(
'metas'
)
->
findOrFail
(
$odsId
);
$response
=
[
'ods'
=>
$ods
->
nome
,
'metas'
=>
$ods
->
metas
,
];
return
response
()
->
json
(
$response
);
}
catch
(
\
Exception
$e
)
{
return
response
()
->
json
([
'error'
=>
'Erro ao carregar as metas'
],
500
);
}
}
}
// public function baixarModelos($id) {
// $evento = Evento::find($id);
...
...
app/Http/Controllers/TrabalhoController.php
View file @
907cb7b8
...
...
@@ -97,7 +97,7 @@ class TrabalhoController extends Controller
$edital
=
Evento
::
find
(
$id
);
$grandeAreas
=
GrandeArea
::
orderBy
(
'nome'
)
->
get
();
$areaTematicas
=
AreaTematica
::
orderBy
(
'nome'
)
->
get
();
$ODS
=
ObjetivoDeDesenvolvimentoSustentavel
::
orderBy
(
'nome
'
)
->
get
();
$ODS
=
ObjetivoDeDesenvolvimentoSustentavel
::
with
(
'metas
'
)
->
get
();
$funcaoParticipantes
=
FuncaoParticipantes
::
orderBy
(
'nome'
)
->
get
();
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
...
...
@@ -108,7 +108,6 @@ class TrabalhoController extends Controller
$rascunho
=
Trabalho
::
where
(
'proponente_id'
,
$proponente
->
id
)
->
where
(
'evento_id'
,
$edital
->
id
)
->
where
(
'status'
,
'Rascunho'
)
->
orderByDesc
(
'updated_at'
)
->
first
();
// dd($estados);
return
view
(
'evento.submeterTrabalho'
,[
// return view('evento.backupForm',[
...
...
@@ -2247,4 +2246,23 @@ class TrabalhoController extends Controller
return
redirect
()
->
back
()
->
with
([
'sucesso'
=>
'Proposta avaliada com sucesso'
]);
}
public
function
getMetas
(
$odsId
)
{
{
try
{
$ods
=
ObjetivoDeDesenvolvimentoSustentavel
::
with
(
'metas'
)
->
findOrFail
(
$odsId
);
$response
=
[
'ods'
=>
$ods
->
nome
,
'metas'
=>
$ods
->
metas
,
];
return
response
()
->
json
(
$response
);
}
catch
(
\
Exception
$e
)
{
return
response
()
->
json
([
'error'
=>
'Erro ao carregar as metas'
],
500
);
}
}
}
}
\ No newline at end of file
app/MetaObjetivoDeDesenvolvimentoSustentavel.php
0 → 100644
View file @
907cb7b8
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
MetaObjetivoDeDesenvolvimentoSustentavel
extends
Model
{
protected
$fillable
=
[
'nome'
,
];
public
function
metas
(){
return
$this
->
belongsToMany
(
'objetivo_de_desenvolvimento_sustentavels'
,
'objetivo_de_desenvolvimento_sustentavel_trabalhos'
,
'objetivo_de_desenvolvimento_sustentavel_id'
);
}
}
composer.lock
View file @
907cb7b8
...
...
@@ -2258,16 +2258,16 @@
},
{
"name": "phpoption/phpoption",
"version": "1.9.
2
",
"version": "1.9.
3
",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
"reference": "
80735db690fe4fc5c76dfa7f9b770634285fa820
"
"reference": "
e3fac8b24f56113f7cb96af14958c0dd16330f54
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/
80735db690fe4fc5c76dfa7f9b770634285fa820
",
"reference": "
80735db690fe4fc5c76dfa7f9b770634285fa820
",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/
e3fac8b24f56113f7cb96af14958c0dd16330f54
",
"reference": "
e3fac8b24f56113f7cb96af14958c0dd16330f54
",
"shasum": ""
},
"require": {
...
...
@@ -2275,13 +2275,13 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.3
4
|| ^9.6.
13
|| ^10.
4
.2"
"phpunit/phpunit": "^8.5.3
9
|| ^9.6.
20
|| ^10.
5
.2
8
"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command":
tru
e
"forward-command":
fals
e
},
"branch-alias": {
"dev-master": "1.9-dev"
...
...
@@ -2317,7 +2317,7 @@
],
"support": {
"issues": "https://github.com/schmittjoh/php-option/issues",
"source": "https://github.com/schmittjoh/php-option/tree/1.9.
2
"
"source": "https://github.com/schmittjoh/php-option/tree/1.9.
3
"
},
"funding": [
{
...
...
@@ -2329,7 +2329,7 @@
"type": "tidelift"
}
],
"time": "202
3-11-12T21:59:55
+00:00"
"time": "202
4-07-20T21:41:07
+00:00"
},
{
"name": "psr/clock",
...
...
resources/views/evento/submeterTrabalho.blade.php
View file @
907cb7b8
...
...
@@ -810,7 +810,6 @@
$
(
'
.form-check-input
'
).
change
(
function
(){
selectedOds
=
[];
$
(
'
#metas-container
'
).
empty
();
$
(
'
.form-check-input:checked
'
).
each
(
function
(){
selectedOds
.
push
(
$
(
this
).
val
());
});
...
...
@@ -823,7 +822,7 @@
selectedOds
.
forEach
(
function
(
odsId
){
$
.
ajax
({
url
:
'
metas/
'
+
odsId
,
url
:
'
/
metas/
'
+
odsId
,
method
:
'
GET
'
,
success
:
function
(
response
){
var
metaOptions
=
'
<hr><div class="col-12"><div class="row subtitulo"><div class="col-sm-12"><p>Metas para
'
+
response
.
ods
+
'
</p></div></div></div></div>
'
+
'
<div class="form-group">
'
;
...
...
routes/web.php
View file @
907cb7b8
...
...
@@ -155,6 +155,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function () {
//######### Trabalho ########################################
Route
::
get
(
'/trabalho/submeter/{id}'
,
'TrabalhoController@index'
)
->
name
(
'trabalho.index'
);
Route
::
get
(
'/metas/{odsId}'
,
'TrabalhoController@getMetas'
)
->
name
(
'getMetas'
);
// Route::get( '/trabalho/visualizar/{id}','TrabalhoController@show' )->name('trabalho.show');
Route
::
post
(
'/trabalho/novaVersao'
,
'TrabalhoController@novaVersao'
)
->
name
(
'trabalho.novaVersao'
);
Route
::
post
(
'/trabalho/criar'
,
'TrabalhoController@salvar'
)
->
name
(
'trabalho.store'
);
...
...
@@ -336,7 +337,6 @@ Route::prefix('evento')->name('evento.')->group(function () {
Route
::
post
(
'/editar/{id}'
,
'EventoController@update'
)
->
name
(
'update'
)
->
middleware
(
'checkRoles:coordenador,administrador'
);
Route
::
post
(
'/setResumo'
,
'EventoController@setResumo'
)
->
name
(
'setResumo'
)
->
middleware
(
'checkAdministrador'
);
Route
::
post
(
'/setFoto'
,
'EventoController@setFotoEvento'
)
->
name
(
'setFotoEvento'
)
->
middleware
(
'checkAdministrador'
);
Route
::
get
(
'/metas/{odsId}'
,
'EventoController@getMetas'
)
->
name
(
'getMetas'
)
->
middleware
(
'checkAdministrador'
);;
});
//########## Rotas de administrador responsavel (Reitor ou pro-reitor)########
...
...
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