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
aeb384b6
Commit
aeb384b6
authored
Jul 16, 2020
by
carlos
Browse files
atualizando criar user
parent
23076444
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/AdministradorController.php
View file @
aeb384b6
...
@@ -76,7 +76,17 @@ class AdministradorController extends Controller
...
@@ -76,7 +76,17 @@ class AdministradorController extends Controller
}
}
public
function
create
()
{
public
function
create
()
{
return
view
(
'administrador.novo_user'
);
$editais
=
Evento
::
all
();
$projetos
=
Trabalho
::
all
();
$funcaoParticipantes
=
FuncaoParticipantes
::
all
();
$areas
=
Area
::
all
();
return
view
(
'administrador.novo_user'
)
->
with
([
'editais'
=>
$editais
,
'funcaoParticipantes'
=>
$funcaoParticipantes
,
'areas'
=>
$areas
,
'projetos'
=>
$projetos
,
]);
}
}
public
function
salvar
(
Request
$request
)
{
public
function
salvar
(
Request
$request
)
{
...
@@ -92,6 +102,32 @@ class AdministradorController extends Controller
...
@@ -92,6 +102,32 @@ class AdministradorController extends Controller
'senha'
=>
[
'required'
,
'string'
,
'min:8'
,
'confirmed'
],
'senha'
=>
[
'required'
,
'string'
,
'min:8'
,
'confirmed'
],
'cpf'
=>
[
'required'
,
'cpf'
,
'unique:users'
],
'cpf'
=>
[
'required'
,
'cpf'
,
'unique:users'
],
]);
]);
}
else
if
(
$request
->
tipo
==
"participante"
)
{
$validated
=
$request
->
validate
([
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
'tipo'
=>
[
'required'
],
'email'
=>
[
'required'
,
'string'
,
'email'
,
'max:255'
,
'unique:users'
],
'senha'
=>
[
'required'
,
'string'
,
'min:8'
,
'confirmed'
],
'instituicao'
=>
[
'required_if:instituicaoSelect,Outra'
,
'max:255'
],
'instituicaoSelect'
=>
[
'required_without:instituicao'
],
'celular'
=>
[
'required'
,
'string'
,
'telefone'
],
'cpf'
=>
[
'required'
,
'cpf'
,
'unique:users'
],
'edital'
=>
'required'
,
'projeto'
=>
'required'
,
'funcaoParticipante'
=>
'required'
,
]);
}
else
if
(
$request
->
tipo
===
"avaliador"
)
{
$validated
=
$request
->
validate
([
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
'tipo'
=>
[
'required'
],
'email'
=>
[
'required'
,
'string'
,
'email'
,
'max:255'
,
'unique:users'
],
'senha'
=>
[
'required'
,
'string'
,
'min:8'
,
'confirmed'
],
'instituicao'
=>
[
'required_if:instituicaoSelect,Outra'
,
'max:255'
],
'instituicaoSelect'
=>
[
'required_without:instituicao'
],
'celular'
=>
[
'required'
,
'string'
,
'telefone'
],
'cpf'
=>
[
'required'
,
'cpf'
,
'unique:users'
],
'area'
=>
'required'
,
]);
}
else
{
}
else
{
$validated
=
$request
->
validate
([
$validated
=
$request
->
validate
([
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
...
@@ -152,6 +188,7 @@ class AdministradorController extends Controller
...
@@ -152,6 +188,7 @@ class AdministradorController extends Controller
case
"avaliador"
:
case
"avaliador"
:
$avaliador
=
new
Avaliador
();
$avaliador
=
new
Avaliador
();
$avaliador
->
user_id
=
$user
->
id
;
$avaliador
->
user_id
=
$user
->
id
;
$avaliador
->
area_id
=
$request
->
area
;
$avaliador
->
save
();
$avaliador
->
save
();
break
;
break
;
case
"proponente"
:
case
"proponente"
:
...
@@ -182,6 +219,8 @@ class AdministradorController extends Controller
...
@@ -182,6 +219,8 @@ class AdministradorController extends Controller
case
"participante"
:
case
"participante"
:
$participante
=
new
Participante
();
$participante
=
new
Participante
();
$participante
->
user_id
=
$user
->
id
;
$participante
->
user_id
=
$user
->
id
;
$participante
->
trabalho_id
=
$request
->
projeto
;
$participante
->
funcao_participante_id
=
$request
->
funcaoParticipante
;
$participante
->
save
();
$participante
->
save
();
break
;
break
;
}
}
...
...
resources/views/administrador/editar_user.blade.php
View file @
aeb384b6
...
@@ -177,6 +177,7 @@
...
@@ -177,6 +177,7 @@
<
div
id
=
"divAreas"
class
=
"col-md-3"
@
if
(
$avaliador
!=
null
)
style
=
"display: block; border: none;"
@
else
style
=
"display: none; border: none;"
@
endif
>
<
div
id
=
"divAreas"
class
=
"col-md-3"
@
if
(
$avaliador
!=
null
)
style
=
"display: block; border: none;"
@
else
style
=
"display: none; border: none;"
@
endif
>
<
label
for
=
"area"
class
=
"col-form-label"
>
{{
__
(
'Área*'
)
}}
</
label
>
<
label
for
=
"area"
class
=
"col-form-label"
>
{{
__
(
'Área*'
)
}}
</
label
>
<
select
id
=
"area"
name
=
"area"
class
=
"form-control @error('area') is-invalid @enderror"
onchange
=
""
>
<
select
id
=
"area"
name
=
"area"
class
=
"form-control @error('area') is-invalid @enderror"
onchange
=
""
>
<
option
disabled
selected
hidden
value
=
""
>--
Área
--</
option
>
@
if
(
old
(
'area'
)
!=
null
)
@
if
(
old
(
'area'
)
!=
null
)
@
foreach
(
$areas
as
$area
)
@
foreach
(
$areas
as
$area
)
<
option
@
if
(
old
(
'area'
)
==
$area
->
id
)
selected
@
endif
value
=
"{{
$area->id
}}"
>
{{
$area
->
nome
}}
</
option
>
<
option
@
if
(
old
(
'area'
)
==
$area
->
id
)
selected
@
endif
value
=
"{{
$area->id
}}"
>
{{
$area
->
nome
}}
</
option
>
...
...
resources/views/administrador/novo_user.blade.php
View file @
aeb384b6
...
@@ -114,11 +114,95 @@
...
@@ -114,11 +114,95 @@
<
div
class
=
"col-md-4"
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"password-confirm"
class
=
"col-form-label"
>
{{
__
(
'Confirme a Senha*'
)
}}
</
label
>
<
label
for
=
"password-confirm"
class
=
"col-form-label"
>
{{
__
(
'Confirme a Senha*'
)
}}
</
label
>
<
input
id
=
"password-confirm"
type
=
"password"
class
=
"form-control @error('senha_confirm') is-invalid @enderror"
name
=
"senha_confirm"
required
autocomplete
=
"new-password"
>
<
input
id
=
"password-confirm"
type
=
"password"
class
=
"form-control @error('senha_confirm
ation
') is-invalid @enderror"
name
=
"senha_confirm
ation
"
required
autocomplete
=
"new-password"
>
</
div
>
</
div
>
<
div
id
=
"divEditais"
class
=
"col-md-3"
@
if
(
old
(
'edital'
)
!=
null
)
style
=
"display: block; border: none;"
@
else
style
=
"display: none; border: none;"
@
endif
>
<
label
for
=
"edital"
class
=
"col-form-label"
>
{{
__
(
'Edital*'
)
}}
</
label
>
<
select
id
=
"edital"
name
=
"edital"
class
=
"form-control @error('edital') is-invalid @enderror"
onchange
=
"projetosTeste()"
>
<
option
value
=
""
disabled
selected
hidden
>--
Edital
--</
option
>
@
if
(
old
(
'edital'
)
!=
null
)
@
foreach
(
$editais
as
$edital
)
<
option
@
if
(
old
(
'edital'
)
==
$edital
->
id
)
selected
@
endif
value
=
"{{
$edital->id
}}"
>
{{
$edital
->
nome
}}
</
option
>
@
endforeach
@
else
@
foreach
(
$editais
as
$edital
)
<
option
value
=
"{{
$edital->id
}}"
>
{{
$edital
->
nome
}}
</
option
>
@
endforeach
@
endif
</
select
>
@
error
(
'edital'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
<
div
id
=
"divProjetos"
class
=
"col-md-3"
@
if
(
old
(
'projeto'
)
!=
null
)
style
=
"display: block; border: none;"
@
else
style
=
"display: none; border: none;"
@
endif
>
<
label
for
=
"projeto"
class
=
"col-form-label"
>
{{
__
(
'Projeto*'
)
}}
</
label
>
<
select
id
=
"projeto"
name
=
"projeto"
class
=
"form-control @error('projeto') is-invalid @enderror"
onchange
=
""
>
@
if
(
old
(
'projeto'
)
!=
null
)
@
foreach
(
$projetos
as
$projeto
)
<
option
@
if
(
old
(
'projeto'
)
==
$projeto
->
id
)
selected
@
endif
value
=
"{{
$projeto->id
}}"
>
{{
$projeto
->
titulo
}}
</
option
>
@
endforeach
@
else
<
option
value
=
""
disabled
selected
>--
Projeto
--</
option
>
@
endif
</
select
>
@
error
(
'projeto'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
<
div
id
=
"divAreas"
class
=
"col-md-3"
@
if
(
old
(
'area'
)
!=
null
)
style
=
"display: block; border: none;"
@
else
style
=
"display: none; border: none;"
@
endif
>
<
label
for
=
"area"
class
=
"col-form-label"
>
{{
__
(
'Área*'
)
}}
</
label
>
<
select
id
=
"area"
name
=
"area"
class
=
"form-control @error('area') is-invalid @enderror"
onchange
=
""
>
<
option
value
=
""
>--
Área
--</
option
>
@
if
(
old
(
'area'
)
!=
null
)
@
foreach
(
$areas
as
$area
)
<
option
@
if
(
old
(
'area'
)
==
$area
->
id
)
selected
@
endif
value
=
"{{
$area->id
}}"
>
{{
$area
->
nome
}}
</
option
>
@
endforeach
@
else
@
foreach
(
$areas
as
$area
)
<
option
value
=
"{{
$area->id
}}"
>
{{
$area
->
nome
}}
</
option
>
@
endforeach
@
endif
</
select
>
@
error
(
'area'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
<
div
id
=
"divFuncaoParticipante"
class
=
"col-md-3"
@
if
(
old
(
'funcaoParticipante'
)
!=
null
)
style
=
"display: block; border: none;"
@
else
style
=
"display: none; border: none;"
@
endif
>
<
label
for
=
"funcaoParticipante"
class
=
"col-form-label"
>
{{
__
(
'Função de participante*'
)
}}
</
label
>
<
select
id
=
"funcaoParticipante"
name
=
"funcaoParticipante"
class
=
"form-control @error('funcaoParticipante') is-invalid @enderror"
onchange
=
""
>
<
option
value
=
""
disabled
selected
hidden
>--
Função
de
Participante
--</
option
>
@
if
(
old
(
'funcaoParticipante'
)
!=
null
)
@
foreach
(
$funcaoParticipantes
as
$funcaoParticipante
)
<
option
@
if
(
old
(
'funcaoParticipante'
)
==
$funcaoParticipante
->
id
)
selected
@
endif
value
=
"{{
$funcaoParticipante->id
}}"
>
{{
$funcaoParticipante
->
nome
}}
</
option
>
@
endforeach
@
else
@
foreach
(
$funcaoParticipantes
as
$funcaoParticipante
)
<
option
value
=
"{{
$funcaoParticipante->id
}}"
>
{{
$funcaoParticipante
->
nome
}}
</
option
>
@
endforeach
@
endif
</
select
>
@
error
(
'funcaoParticipante'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
</
div
>
</
div
>
<
div
id
=
"proponente"
style
=
"display: none;"
>
<
div
id
=
"proponente"
@
if
(
old
(
'tipo'
)
==
"proponente"
)
style
=
"display: block;"
@
else
style
=
"display: none;"
@
endif
>
<
div
>
<
div
>
<
h4
>
Dados
do
proponente
</
h4
>
<
h4
>
Dados
do
proponente
</
h4
>
...
@@ -304,11 +388,35 @@
...
@@ -304,11 +388,35 @@
function
mudar
()
{
function
mudar
()
{
var
divProponente
=
document
.
getElementById
(
'proponente'
);
var
divProponente
=
document
.
getElementById
(
'proponente'
);
var
comboBoxTipo
=
document
.
getElementById
(
'tipo'
);
var
comboBoxTipo
=
document
.
getElementById
(
'tipo'
);
var
comboBoxEditais
=
document
.
getElementById
(
'divEditais'
);
var
comboBoxProjetos
=
document
.
getElementById
(
'divProjetos'
);
var
comboBoxFuncaoParticipante
=
document
.
getElementById
(
'divFuncaoParticipante'
);
var
comboBoxAreas
=
document
.
getElementById
(
'divAreas'
);
if
(
comboBoxTipo
.
value
==
"proponente"
)
{
if
(
comboBoxTipo
.
value
==
"proponente"
)
{
divProponente
.
style
.
display
=
"inline"
;
divProponente
.
style
.
display
=
"block"
;
comboBoxEditais
.
style
.
display
=
"none"
;
comboBoxProjetos
.
style
.
display
=
"none"
;
comboBoxFuncaoParticipante
.
style
.
display
=
"none"
;
comboBoxAreas
.
style
.
display
=
"none"
;
}
else
if
(
comboBoxTipo
.
value
==
"participante"
)
{
comboBoxEditais
.
style
.
display
=
"block"
;
comboBoxProjetos
.
style
.
display
=
"block"
;
divProponente
.
style
.
display
=
"none"
;
comboBoxFuncaoParticipante
.
style
.
display
=
"block"
;
comboBoxAreas
.
style
.
display
=
"none"
;
}
else
if
(
comboBoxTipo
.
value
==
"avaliador"
)
{
divProponente
.
style
.
display
=
"none"
;
comboBoxEditais
.
style
.
display
=
"none"
;
comboBoxProjetos
.
style
.
display
=
"none"
;
comboBoxFuncaoParticipante
.
style
.
display
=
"none"
;
comboBoxAreas
.
style
.
display
=
"block"
;
}
else
{
}
else
{
divProponente
.
style
.
display
=
"none"
;
divProponente
.
style
.
display
=
"none"
;
comboBoxEditais
.
style
.
display
=
"none"
;
comboBoxProjetos
.
style
.
display
=
"none"
;
comboBoxFuncaoParticipante
.
style
.
display
=
"none"
;
comboBoxAreas
.
style
.
display
=
"none"
;
}
}
}
}
...
@@ -351,6 +459,41 @@
...
@@ -351,6 +459,41 @@
instituicao
.
parentElement
.
style
.
display
=
'none'
;
instituicao
.
parentElement
.
style
.
display
=
'none'
;
}
}
}
}
function
projetosTeste
()
{
var
edital
=
$
(
'#edital'
)
.
val
();
$
.
ajax
({
type
:
'POST'
,
url
:
'{{ route('
trabalho
.
consulta
') }}'
,
data
:
'id='
+
edital
,
headers
:
{
'X-CSRF-TOKEN'
:
$
(
'meta[name="csrf-token"]'
)
.
attr
(
'content'
)
},
success
:
(
dados
)
=>
{
console
.
log
(
dados
);
if
(
dados
.
length
>
0
)
{
if
(
$
(
'#projeto'
)
.
val
()
==
null
||
$
(
'#projeto'
)
.
val
()
==
""
){
var
option
=
'<option selected disabled>-- Projeto --</option>'
;
}
$
.
each
(
dados
,
function
(
i
,
obj
)
{
if
(
$
(
'#projeto'
)
.
val
()
!=
null
&&
$
(
'#projeto'
)
.
val
()
==
obj
.
id
){
option
+=
'<option selected value="'
+
obj
.
id
+
'">'
+
obj
.
titulo
+
'</option>'
;
}
else
{
option
+=
'<option value="'
+
obj
.
id
+
'">'
+
obj
.
titulo
+
'</option>'
;
}
})
}
else
{
var
option
=
"<option selected disabled>-- Projeto --</option>"
;
}
$
(
'#projeto'
)
.
html
(
option
)
.
show
();
},
error
:
(
data
)
=>
{
console
.
log
(
data
);
}
})
}
window
.
onload
=
showInstituicao
();
window
.
onload
=
showInstituicao
();
</
script
>
</
script
>
@
endsection
@
endsection
\ No newline at end of file
resources/views/administrador/usersAdmin.blade.php
View file @
aeb384b6
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
{{
$user
->
name
}}
{{
$user
->
name
}}
</
td
>
</
td
>
<
td
>
{{
$user
->
tipo
}}
</
td
>
<
td
>
{{
$user
->
tipo
}}
</
td
>
<
td
>
{{
$user
->
creaet
_at
}}
</
td
>
<
td
>
@
if
(
$user
->
updated_at
==
null
)
Criado
pelo
seed
@
else
{{
date
(
'd/m/Y - h:m:s'
,
strtotime
(
$user
->
updated
_at
))
}}
@
endif
</
td
>
<
td
>
<
td
>
<
div
class
=
"btn-group dropright dropdown-options"
>
<
div
class
=
"btn-group dropright dropdown-options"
>
<
a
id
=
"options"
class
=
"dropdown-toggle "
data
-
toggle
=
"dropdown"
aria
-
haspopup
=
"true"
aria
-
expanded
=
"false"
>
<
a
id
=
"options"
class
=
"dropdown-toggle "
data
-
toggle
=
"dropdown"
aria
-
haspopup
=
"true"
aria
-
expanded
=
"false"
>
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
{{
$user
->
name
}}
{{
$user
->
name
}}
</
td
>
</
td
>
<
td
>
{{
$user
->
tipo
}}
</
td
>
<
td
>
{{
$user
->
tipo
}}
</
td
>
<
td
>
{{
$user
->
creaet
_at
}}
</
td
>
<
td
>
@
if
(
$user
->
updated_at
==
null
)
Criado
pelo
seed
@
else
{{
date
(
'd/m/Y - h:m:s'
,
strtotime
(
$user
->
updated
_at
))
}}
@
endif
</
td
>
<
td
>
<
td
>
<
div
class
=
"btn-group dropright dropdown-options"
>
<
div
class
=
"btn-group dropright dropdown-options"
>
<
a
id
=
"options"
class
=
"dropdown-toggle "
data
-
toggle
=
"dropdown"
aria
-
haspopup
=
"true"
aria
-
expanded
=
"false"
>
<
a
id
=
"options"
class
=
"dropdown-toggle "
data
-
toggle
=
"dropdown"
aria
-
haspopup
=
"true"
aria
-
expanded
=
"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