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
fbeda595
Commit
fbeda595
authored
Oct 21, 2022
by
unknown
Browse files
Criação de rotas, view e controller da ODS
parent
1962909d
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/ObjetivoDeDesenvolvimentoSustentavelController.php
0 → 100644
View file @
fbeda595
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
Illuminate\Database\Eloquent\Model
;
use
App\ObjetivoDeDesenvolvimentoSustentavel
;
class
ObjetivoDeDesenvolvimentoSustentavelController
extends
Controller
{
public
function
create
()
{
return
view
(
'objetivoDeDesenvolvimentoSustentavel.create'
);
}
public
function
store
(
Request
$request
)
{
$validatedData
=
$request
->
validate
([
'nome'
=>
'required'
,
]);
$ODS
=
new
ObjetivoDeDesenvolvimentoSustentavel
();
$ODS
->
nome
=
$request
->
nome
;
$ODS
->
save
();
return
redirect
(
route
(
'grandearea.index'
)
)
->
with
([
'mensagem'
=>
'ODS cadastrado com sucesso'
]);
}
public
function
edit
(
$id
){
$ODS
=
ObjetivoDeDesenvolvimentoSustentavel
::
find
(
$id
);
return
view
(
'objetivoDeDesenvolvimentoSustentavel.editar'
)
->
with
([
'ods'
=>
$ODS
]);
}
public
function
update
(
Request
$request
,
$id
){
$ODS
=
ObjetivoDeDesenvolvimentoSustentavel
::
find
(
$id
);
$ODS
->
nome
=
$request
->
nome
;
$ODS
->
update
();
return
redirect
(
route
(
'grandearea.index'
)
)
->
with
([
'mensagem'
=>
'ODS editado com sucesso'
]);
}
public
function
destroy
(
$id
)
{
$ODS
=
ObjetivoDeDesenvolvimentoSustentavel
::
find
(
$id
);
$ODS
->
delete
();
return
redirect
(
route
(
'grandearea.index'
)
)
->
with
([
'mensagem'
=>
'ODS excluido com sucesso'
]);
}
}
app/Http/Controllers/TrabalhoController.php
View file @
fbeda595
...
@@ -53,6 +53,7 @@ use App\SolicitacaoParticipante;
...
@@ -53,6 +53,7 @@ use App\SolicitacaoParticipante;
use
App\Substituicao
;
use
App\Substituicao
;
use
Illuminate\Support\Facades\Notification
;
use
Illuminate\Support\Facades\Notification
;
use
App\Desligamento
;
use
App\Desligamento
;
use
App\ObjetivoDeDesenvolvimentoSustentavel
;
class
TrabalhoController
extends
Controller
class
TrabalhoController
extends
Controller
{
{
...
@@ -91,6 +92,7 @@ class TrabalhoController extends Controller
...
@@ -91,6 +92,7 @@ class TrabalhoController extends Controller
$edital
=
Evento
::
find
(
$id
);
$edital
=
Evento
::
find
(
$id
);
$grandeAreas
=
GrandeArea
::
orderBy
(
'nome'
)
->
get
();
$grandeAreas
=
GrandeArea
::
orderBy
(
'nome'
)
->
get
();
$areaTematicas
=
AreaTematica
::
orderBy
(
'nome'
)
->
get
();
$areaTematicas
=
AreaTematica
::
orderBy
(
'nome'
)
->
get
();
$ODS
=
ObjetivoDeDesenvolvimentoSustentavel
::
orderBy
(
'nome'
)
->
get
();
$funcaoParticipantes
=
FuncaoParticipantes
::
orderBy
(
'nome'
)
->
get
();
$funcaoParticipantes
=
FuncaoParticipantes
::
orderBy
(
'nome'
)
->
get
();
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
...
@@ -112,6 +114,7 @@ class TrabalhoController extends Controller
...
@@ -112,6 +114,7 @@ class TrabalhoController extends Controller
'enum_turno'
=>
Participante
::
ENUM_TURNO
,
'enum_turno'
=>
Participante
::
ENUM_TURNO
,
'estados'
=>
$this
->
estados
,
'estados'
=>
$this
->
estados
,
'areaTematicas'
=>
$areaTematicas
,
'areaTematicas'
=>
$areaTematicas
,
'ods'
=>
$ODS
,
]);
]);
}
}
...
@@ -1147,6 +1150,7 @@ class TrabalhoController extends Controller
...
@@ -1147,6 +1150,7 @@ class TrabalhoController extends Controller
$trabalho
->
modalidade
=
$request
->
modalidade
;
$trabalho
->
modalidade
=
$request
->
modalidade
;
$trabalho
->
save
();
$trabalho
->
save
();
$trabalho
->
ods
()
->
sync
(
$request
->
ods
);
DB
::
commit
();
DB
::
commit
();
if
(
!
$request
->
has
(
'rascunho'
))
{
if
(
!
$request
->
has
(
'rascunho'
))
{
//Notificações
//Notificações
...
...
resources/views/objetivoDeDesenvolvimentoSustentavel/create.blade.php
0 → 100644
View file @
fbeda595
@
extends
(
'layouts.app'
)
@
section
(
'content'
)
<
div
class
=
"container"
style
=
"margin-top: 50px; margin-bottom: 305px "
>
<
div
class
=
"row"
>
<
div
class
=
"col-sm-12"
>
<
h2
style
=
"color: rgb(0, 140, 255);"
>
{{
__
(
'Criar um novo ODS(Objetivo de Desenvolvimento Sustentável)'
)
}}
</
h2
>
</
div
>
</
div
>
<
div
class
=
"row"
>
<
form
method
=
"POST"
action
=
"{{ route('objetivoDeDenvolvimentoSustentavel.salvar')}}"
>
@
csrf
<
div
class
=
"col-sm-12"
>
<
label
for
=
"nome"
class
=
"col-form-label"
style
=
"color: rgb(0, 140, 255);"
>
{{
__
(
'Nome'
)
}}
<
span
style
=
"color: red;"
>
*</
span
></
label
>
<
input
id
=
"nome"
type
=
"text"
class
=
"form-control @error('nome') is-invalid @enderror"
name
=
"nome"
value
=
"{{ old('nome') }}"
required
autocomplete
=
"nome"
autofocus
>
@
error
(
'nome'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
<
button
type
=
"submit"
class
=
"btn btn-info"
style
=
"position:relative;top:10px;"
>
{{
__
(
'Salvar'
)
}}
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
@
endsection
\ No newline at end of file
resources/views/objetivoDeDesenvolvimentoSustentavel/editar.blade.php
0 → 100644
View file @
fbeda595
@
extends
(
'layouts.app'
)
@
section
(
'content'
)
<
div
class
=
"container"
style
=
"margin-top: 50px; margin-bottom: 305px "
>
<
div
class
=
"row"
>
<
div
class
=
"col-sm-12"
>
<
h2
style
=
"color: rgb(0, 140, 255);"
>
{{
__
(
'Editar um ODS(Objetivo de Desenvolvimento Sustentável)'
)
}}
</
h2
>
</
div
>
</
div
>
<
div
class
=
"row"
>
<
form
method
=
"POST"
action
=
"{{ route('objetivoDeDenvolvimentoSustentavel.atualizar', ['id' =>
$ods->id
])}}"
>
@
csrf
<
div
class
=
"col-sm-12"
>
<
label
for
=
"nome"
class
=
"col-form-label"
style
=
"color: rgb(0, 140, 255);"
>
{{
__
(
'Nome'
)
}}
<
span
style
=
"color: red;"
>
*</
span
></
label
>
<
input
id
=
"nome"
type
=
"text"
class
=
"form-control @error('nome') is-invalid @enderror"
name
=
"nome"
value
=
"{{
$ods->nome
}}"
required
autocomplete
=
"nome"
autofocus
>
@
error
(
'nome'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
<
button
type
=
"submit"
class
=
"btn btn-info"
style
=
"position:relative;top:10px;"
>
{{
__
(
'Salvar'
)
}}
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
@
endsection
\ No newline at end of file
routes/web.php
View file @
fbeda595
...
@@ -63,6 +63,14 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function () {
...
@@ -63,6 +63,14 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function () {
Route
::
get
(
'/nova'
,
'AreaTematicaController@create'
)
->
name
(
'criar'
)
->
middleware
(
'checkAdministrador'
);
Route
::
get
(
'/nova'
,
'AreaTematicaController@create'
)
->
name
(
'criar'
)
->
middleware
(
'checkAdministrador'
);
});
});
Route
::
prefix
(
'objetivoDeDenvolvimentoSustentavel'
)
->
name
(
'objetivoDeDenvolvimentoSustentavel.'
)
->
group
(
function
()
{
Route
::
get
(
'/editar/{id}'
,
'ObjetivoDeDesenvolvimentoSustentavelController@edit'
)
->
name
(
'edit'
)
->
middleware
(
'checkAdministrador'
);
Route
::
post
(
'/atualizar/{id}'
,
'ObjetivoDeDesenvolvimentoSustentavelController@update'
)
->
name
(
'atualizar'
)
->
middleware
(
'checkAdministrador'
);
Route
::
post
(
'/excluir/{id}'
,
'ObjetivoDeDesenvolvimentoSustentavelController@destroy'
)
->
name
(
'deletar'
)
->
middleware
(
'checkAdministrador'
);
Route
::
post
(
'/salvar'
,
'ObjetivoDeDesenvolvimentoSustentavelController@store'
)
->
name
(
'salvar'
)
->
middleware
(
'checkAdministrador'
);
Route
::
get
(
'/novo'
,
'ObjetivoDeDesenvolvimentoSustentavelController@create'
)
->
name
(
'criar'
)
->
middleware
(
'checkAdministrador'
);
});
//######### Rotas Administrador #################################
//######### Rotas Administrador #################################
Route
::
get
(
'/perfil-usuario'
,
'UserController@minhaConta'
)
->
name
(
'user.perfil'
)
->
middleware
([
'auth'
,
'verified'
]);
Route
::
get
(
'/perfil-usuario'
,
'UserController@minhaConta'
)
->
name
(
'user.perfil'
)
->
middleware
([
'auth'
,
'verified'
]);
...
...
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