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
67245ec5
Commit
67245ec5
authored
Feb 03, 2023
by
Yuri Resende
Browse files
Permitir que o avaliador selecione suas áreas temáticas no seu perfil
parent
df50a554
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/UserController.php
View file @
67245ec5
...
@@ -20,6 +20,7 @@ use Illuminate\Validation\Rule;
...
@@ -20,6 +20,7 @@ use Illuminate\Validation\Rule;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Log
;
use
App\Curso
;
use
App\Curso
;
use
App\AreaTematica
;
class
UserController
extends
Controller
class
UserController
extends
Controller
{
{
...
@@ -107,7 +108,6 @@ class UserController extends Controller
...
@@ -107,7 +108,6 @@ class UserController extends Controller
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
->
user_id
=
$user
->
id
;
$avaliador
->
user_id
=
$user
->
id
;
//$avaliador->area_id = $request->area;
//$avaliador->area_id = $request->area;
$avaliador
->
naturezas
()
->
sync
(
$request
->
natureza
);
$avaliador
->
naturezas
()
->
sync
(
$request
->
natureza
);
$avaliador
->
update
();
$avaliador
->
update
();
...
@@ -122,7 +122,8 @@ class UserController extends Controller
...
@@ -122,7 +122,8 @@ class UserController extends Controller
case
"avaliador"
:
case
"avaliador"
:
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
->
user_id
=
$user
->
id
;
$avaliador
->
user_id
=
$user
->
id
;
$avaliador
->
area_id
=
$request
->
area
;
//$avaliador->area_id = $request->area;
$avaliador
->
areaTematicas
()
->
sync
(
$request
->
area
);
if
(
$user
->
usuarioTemp
==
true
)
{
if
(
$user
->
usuarioTemp
==
true
)
{
$user
->
usuarioTemp
=
false
;
$user
->
usuarioTemp
=
false
;
}
}
...
@@ -216,6 +217,8 @@ class UserController extends Controller
...
@@ -216,6 +217,8 @@ class UserController extends Controller
$naturezas
=
Natureza
::
orderBy
(
'nome'
)
->
get
();
$naturezas
=
Natureza
::
orderBy
(
'nome'
)
->
get
();
$cursos
=
Curso
::
orderBy
(
'nome'
)
->
get
();
$cursos
=
Curso
::
orderBy
(
'nome'
)
->
get
();
$areaTematica
=
AreaTematica
::
orderBy
(
'nome'
)
->
get
();
return
view
(
'user.perfilUser'
)
->
with
([
'user'
=>
$user
,
return
view
(
'user.perfilUser'
)
->
with
([
'user'
=>
$user
,
'adminResp'
=>
$adminResp
,
'adminResp'
=>
$adminResp
,
...
@@ -223,6 +226,7 @@ class UserController extends Controller
...
@@ -223,6 +226,7 @@ class UserController extends Controller
'proponente'
=>
$proponente
,
'proponente'
=>
$proponente
,
'participante'
=>
$participante
,
'participante'
=>
$participante
,
'cursos'
=>
$cursos
,
'cursos'
=>
$cursos
,
'naturezas'
=>
$naturezas
]);
'naturezas'
=>
$naturezas
,
'areaTematica'
=>
$areaTematica
]);
}
}
}
}
resources/views/user/perfilUser.blade.php
View file @
67245ec5
@
extends
(
'layouts.app'
)
@
extends
(
'layouts.app'
)
@
section
(
'styles'
)
<
link
rel
=
"stylesheet"
href
=
"https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css"
integrity
=
"sha512-nMNlpuaDPrqlEls3IX/Q56H36qvBASwb3ipuo3MxeWbsQB1881ox0cRv7UPTgBlriqoynt35KjEwgGUeUXIPnw=="
crossorigin
=
"anonymous"
referrerpolicy
=
"no-referrer"
/>
@
endsection
@
section
(
'content'
)
@
section
(
'content'
)
<
div
class
=
"container"
style
=
"margin-top: 3rem;"
>
<
div
class
=
"container"
style
=
"margin-top: 3rem;"
>
...
@@ -122,29 +126,12 @@
...
@@ -122,29 +126,12 @@
</
div
>
</
div
>
@
if
(
Auth
()
->
user
()
->
tipo
==
'avaliador'
)
@
if
(
Auth
()
->
user
()
->
tipo
==
'avaliador'
)
<
div
class
=
"col-md-6"
>
<
div
class
=
"col-md-6"
>
<
label
for
=
"area"
class
=
"col-form-label"
>
{{
__
(
'Área:'
)
}}
</
label
>
<
label
for
=
"area"
class
=
"col-form-label"
>
{{
__
(
'Área temática:'
)
}}
</
label
>
<
select
style
=
"display: inline"
class
=
"form-control @error('area') is-invalid @enderror"
name
=
"area"
id
=
"area"
>
<
select
style
=
"display: inline"
class
=
"form-control @error('area') is-invalid @enderror"
name
=
"area[]"
id
=
"area"
multiple
=
"multiple"
>
@
if
(
Auth
()
->
user
()
->
avaliadors
->
area_id
==
null
)
@
foreach
(
$areaTematica
as
$area
)
<
option
value
=
""
selected
>
Indefinida
</
option
>
<
option
value
=
"{{
$area->id
}}"
id
=
"area
{
{$area->id}
}
"
@
if
((
empty
(
old
(
'area'
))
&&
$avaliador
->
areaTematicas
->
contains
(
$area
->
id
))
||
(
!
empty
(
old
(
'area'
))
&&
in_array
(
$area
->
id
,
old
(
'area'
))))
selected
@
endif
>
{{
$area
->
nome
}}
</
option
>
@
foreach
(
App\Area
::
all
()
as
$area
)
@
if
(
Auth
()
->
user
()
->
avaliadors
->
area_id
==
$area
->
id
)
<
option
value
=
"{{
$area->id
}}"
selected
>
{{
$area
->
nome
}}
</
option
>
@
else
<
option
value
=
"{{
$area->id
}}"
>
{{
$area
->
nome
}}
</
option
>
@
endif
@
endforeach
@
endforeach
@
else
@
foreach
(
App\Area
::
all
()
as
$area
)
@
if
(
Auth
()
->
user
()
->
avaliadors
->
area_id
==
$area
->
id
)
<
option
value
=
"{{
$area->id
}}"
selected
>
{{
$area
->
nome
}}
</
option
>
@
else
<
option
value
=
"{{
$area->id
}}"
>
{{
$area
->
nome
}}
</
option
>
@
endif
@
endforeach
@
endif
</
select
>
</
select
>
@
error
(
'area'
)
@
error
(
'area'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
<
strong
>
{{
$message
}}
</
strong
>
...
@@ -804,6 +791,14 @@
...
@@ -804,6 +791,14 @@
@
endsection
@
endsection
@
section
(
'javascript'
)
@
section
(
'javascript'
)
<
script
src
=
"https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"
integrity
=
"sha512-2ImtlRlf2VVmiGZsjm9bEyhjGW4dU7B6TNwh/hx/iSByxNENtj3WVE6o/9Lj4TJeVXPi4bnOIMXFIJJAeufa0A=="
crossorigin
=
"anonymous"
referrerpolicy
=
"no-referrer"
></
script
>
<
script
type
=
"text/javascript"
>
$
(
"#area"
)
.
select2
({
placeholder
:
'Selecione as áreas temáticas'
,
allowClear
:
true
});
</
script
>
<
script
type
=
"text/javascript"
>
<
script
type
=
"text/javascript"
>
//var emailInput = document.getElementById('email');
//var emailInput = document.getElementById('email');
//emailInput.disabled = true;
//emailInput.disabled = true;
...
...
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