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
59118628
Commit
59118628
authored
Jun 06, 2020
by
alinetenorio
Browse files
Cadastro de participante/proponente
parent
93cc9e74
Changes
2
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/Auth/RegisterController.php
View file @
59118628
...
@@ -10,7 +10,8 @@ use Illuminate\Support\Facades\Validator;
...
@@ -10,7 +10,8 @@ use Illuminate\Support\Facades\Validator;
use
App\User
;
use
App\User
;
use
App\Participante
;
use
App\Participante
;
use
App\Endereco
;
use
App\Proponente
;
use
App\GrandeArea
;
class
RegisterController
extends
Controller
class
RegisterController
extends
Controller
{
{
...
@@ -62,6 +63,18 @@ class RegisterController extends Controller
...
@@ -62,6 +63,18 @@ class RegisterController extends Controller
'cpf'
=>
[
'required'
,
'cpf'
],
'cpf'
=>
[
'required'
,
'cpf'
],
'celular'
=>
[
'required'
,
'string'
],
'celular'
=>
[
'required'
,
'string'
],
'instituicao'
=>
[
'required'
,
'string'
,
'max:255'
],
'instituicao'
=>
[
'required'
,
'string'
,
'max:255'
],
'cargo'
=>
[
'required'
],
'vinculo'
=>
[
'required'
],
'titulacaoMaxima'
=>
[
'required_with:anoTitulacao,areaFormacao,grandeArea,area,subarea,bolsistaProdutividade,linkLattes'
],
'anoTitulacao'
=>
[
'required_with:titulacaoMaxima,areaFormacao,grandeArea,area,subarea,bolsistaProdutividade,linkLattes'
],
'areaFormacao'
=>
[
'required_with:titulacaoMaxima,anoTitulacao,grandeArea,area,subarea,bolsistaProdutividade,linkLattes'
],
'grandeArea'
=>
[
'required_with:titulacaoMaxima,anoTitulacao,areaFormacao,area,subarea,bolsistaProdutividade,linkLattes'
],
'area'
=>
[
'required_with:titulacaoMaxima,anoTitulacao,areaFormacao,grandeArea,subarea,bolsistaProdutividade,linkLattes'
],
'subarea'
=>
[
'required_with:titulacaoMaxima,anoTitulacao,areaFormacao,grandeArea,area,bolsistaProdutividade,linkLattes'
],
'bolsistaProdutividade'
=>
[
'required_with:titulacaoMaxima,anoTitulacao,areaFormacao,grandeArea,area,subarea,linkLattes'
],
'linkLattes'
=>
[
'required_with:titulacaoMaxima,anoTitulacao,areaFormacao,grandeArea,area,subarea,bolsistaProdutividade'
],
]);
]);
}
}
...
@@ -73,7 +86,7 @@ class RegisterController extends Controller
...
@@ -73,7 +86,7 @@ class RegisterController extends Controller
*/
*/
protected
function
create
(
array
$data
)
protected
function
create
(
array
$data
)
{
{
//dd($data);
$user
=
new
User
();
$user
=
new
User
();
$user
->
name
=
$data
[
'name'
];
$user
->
name
=
$data
[
'name'
];
$user
->
email
=
$data
[
'email'
];
$user
->
email
=
$data
[
'email'
];
...
@@ -81,13 +94,40 @@ class RegisterController extends Controller
...
@@ -81,13 +94,40 @@ class RegisterController extends Controller
$user
->
cpf
=
$data
[
'cpf'
];
$user
->
cpf
=
$data
[
'cpf'
];
$user
->
celular
=
$data
[
'celular'
];
$user
->
celular
=
$data
[
'celular'
];
$user
->
instituicao
=
$data
[
'instituicao'
];
$user
->
instituicao
=
$data
[
'instituicao'
];
$user
->
tipo
=
'participante'
;
if
(
$data
[
'cargo'
]
===
"Estudante"
&&
$data
[
'vinculo'
]
!==
"Pós-doutorando"
){
$user
->
tipo
=
'participante'
;
$user
->
save
();
$user
->
save
();
$participante
=
new
Participante
();
$participante
=
new
Participante
();
$user
->
participantes
()
->
save
(
$participante
);
$user
->
participantes
()
->
save
(
$participante
);
}
else
{
$user
->
tipo
=
'proponente'
;
$user
->
save
();
$proponente
=
new
Proponente
();
$proponente
->
SIAPE
=
$data
[
'SIAPE'
];
$proponente
->
cargo
=
$data
[
'cargo'
];
$proponente
->
vinculo
=
$data
[
'vinculo'
];
$proponente
->
titulacaoMaxima
=
$data
[
'titulacaoMaxima'
];
$proponente
->
anoTitulacao
=
$data
[
'anoTitulacao'
];
$proponente
->
areaFormacao
=
$data
[
'areaFormacao'
];
$proponente
->
grandeArea
=
$data
[
'grandeArea'
];
$proponente
->
area
=
$data
[
'area'
];
$proponente
->
subArea
=
$data
[
'subarea'
];
$proponente
->
bolsistaProdutividade
=
$data
[
'bolsistaProdutividade'
];
$proponente
->
nivel
=
$data
[
'nivel'
];
$proponente
->
linkLattes
=
$data
[
'linkLattes'
];
$user
->
proponentes
()
->
save
(
$proponente
);
}
return
$user
;
return
$user
;
}
}
public
function
showRegistrationForm
(){
$grandesAreas
=
GrandeArea
::
orderBy
(
'nome'
)
->
get
();
return
view
(
'auth.register'
)
->
with
([
'grandeAreas'
=>
$grandesAreas
]);
}
}
}
resources/views/auth/register.blade.php
View file @
59118628
...
@@ -61,6 +61,7 @@
...
@@ -61,6 +61,7 @@
</
span
>
</
span
>
@
enderror
@
enderror
</
div
>
</
div
>
</
div
>
</
div
>
{{
--
Email
|
Senha
|
Confirmar
Senha
--
}}
{{
--
Email
|
Senha
|
Confirmar
Senha
--
}}
...
@@ -92,6 +93,156 @@
...
@@ -92,6 +93,156 @@
<
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"
name
=
"password_confirmation"
required
autocomplete
=
"new-password"
>
<
input
id
=
"password-confirm"
type
=
"password"
class
=
"form-control"
name
=
"password_confirmation"
required
autocomplete
=
"new-password"
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"form-group row"
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"cargo"
class
=
"col-form-label"
>
{{
__
(
'Cargo'
)
}}
</
label
>
<
select
id
=
"cargo"
name
=
"cargo"
class
=
"form-control"
onchange
=
"mudar()"
>
<
option
@
if
(
old
(
'cargo'
)
==
'Professor'
)
selected
@
endif
value
=
"Professor"
>
Professor
</
option
>
<
option
@
if
(
old
(
'cargo'
)
==
'Técnico'
)
selected
@
endif
value
=
"Técnico"
>
Técnico
</
option
>
<
option
@
if
(
old
(
'cargo'
)
==
'Estudante'
)
selected
@
endif
value
=
"Estudante"
>
Estudante
</
option
>
</
select
>
@
error
(
'cargo'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"vinculo"
class
=
"col-form-label"
>
{{
__
(
'Vinculo'
)
}}
</
label
>
<
select
name
=
"vinculo"
id
=
"vinculo"
class
=
"form-control"
onchange
=
"mudar()"
>
<
option
@
if
(
old
(
'cargo'
)
==
'Servidor na ativa'
)
selected
@
endif
value
=
"Servidor na ativa"
>
Servidor
na
ativa
</
option
>
<
option
@
if
(
old
(
'cargo'
)
==
'Servidor aposentado'
)
selected
@
endif
value
=
"Servidor aposentado"
>
Servidor
aposentado
</
option
>
<
option
@
if
(
old
(
'cargo'
)
==
'Professor visitante'
)
selected
@
endif
value
=
"Professor visitante"
>
Professor
visitante
</
option
>
<
option
@
if
(
old
(
'cargo'
)
==
'Pós-doutorando'
)
selected
@
endif
value
=
"Pós-doutorando"
>
Pós
-
doutorando
</
option
>
<
option
@
if
(
old
(
'cargo'
)
==
'Outro'
)
selected
@
endif
value
=
"Outro"
>
Outro
</
option
>
</
select
>
</
div
>
<
div
class
=
"col-md-4"
style
=
"display: none;"
id
=
"divOutro"
>
<
label
for
=
"outro"
class
=
"col-form-label"
>
{{
__
(
'Qual?'
)
}}
</
label
>
<
input
id
=
"outro"
type
=
"text"
class
=
"form-control @error('outro') is-invalid @enderror"
name
=
"outro"
>
</
div
>
</
div
>
<
div
id
=
"proponente"
style
=
"display: block;"
>
<
div
class
=
"form-group row"
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"SIAPE"
class
=
"col-form-label"
>
{{
__
(
'SIAPE'
)
}}
</
label
>
<
input
id
=
"SIAPE"
type
=
"text"
class
=
"form-control @error('SIAPE') is-invalid @enderror"
name
=
"SIAPE"
value
=
"{{ old('SIAPE') }}"
autocomplete
=
"nome"
>
@
error
(
'SIAPE'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"titulacaoMaxima"
class
=
"col-form-label"
>
{{
__
(
'Titulação Maxima'
)
}}
</
label
>
<
input
id
=
"titulacaoMaxima"
type
=
"text"
class
=
"form-control @error('titulacaoMaxima') is-invalid @enderror"
name
=
"titulacaoMaxima"
value
=
"{{ old('titulacaoMaxima') }}"
autocomplete
=
"nome"
>
@
error
(
'titulacaoMaxima'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"anoTitulacao"
class
=
"col-form-label"
>
{{
__
(
'Ano da Titulação'
)
}}
</
label
>
<
input
id
=
"anoTitulacao"
type
=
"text"
class
=
"form-control @error('anoTitulacao') is-invalid @enderror"
name
=
"anoTitulacao"
value
=
"{{ old('anoTitulacao') }}"
autocomplete
=
"nome"
>
@
error
(
'anoTitulacao'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
</
div
>
<
div
class
=
"form-group row"
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"areaFormacao"
class
=
"col-form-label"
>
{{
__
(
'Area de Formação'
)
}}
</
label
>
<
input
id
=
"areaFormacao"
type
=
"text"
class
=
"form-control @error('areaFormacao') is-invalid @enderror"
name
=
"areaFormacao"
value
=
"{{ old('areaFormacao') }}"
autocomplete
=
"nome"
>
@
error
(
'areaFormacao'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
</
div
>
<
div
class
=
"col-md-4"
>
<
label
for
=
"grandeArea"
class
=
"col-form-label"
>
{{
__
(
'Grande Área'
)
}}
</
label
>
<
select
name
=
"grandeArea"
id
=
""
class
=
"form-control"
>
@
foreach
(
$grandeAreas
as
$area
)
<
option
@
if
(
old
(
'grandeArea'
)
==
$area
->
nome
)
selected
@
endif
value
=
"
{
{$area->nome}}">{{$area->nome}
}
</option>
@endforeach
</select>
</div>
<div class="
col
-
md
-
4
">
<label for="
area
" class="
col
-
form
-
label
">{{ __('Área') }}</label>
<input id="
area
" type="
text
" class="
form
-
control
@
error
(
'area'
)
is
-
invalid
@
enderror
" name="
area
" value="
{{
old
(
'area'
)
}}
">
@error('area')
<span class="
invalid
-
feedback
" role="
alert
">
<strong>{{
$message
}}</strong>
</span>
@enderror
</div>
</div>
<div class="
form
-
group
row
">
<div class="
col
-
md
-
4
">
<label for="
subarea
" class="
col
-
form
-
label
">{{ __('Subárea') }}</label>
<input id="
subarea
" type="
text
" class="
form
-
control
@
error
(
'subarea'
)
is
-
invalid
@
enderror
" name="
subarea
" value="
{{
old
(
'subarea'
)
}}
">
@error('subarea')
<span class="
invalid
-
feedback
" role="
alert
">
<strong>{{
$message
}}</strong>
</span>
@enderror
</div>
<div class="
col
-
md
-
4
">
<label for="
linkLattes
" class="
col
-
form
-
label
">{{ __('Link do curriculum lattes') }}</label>
<input id="
linkLattes
" type="
text
" class="
form
-
control
@
error
(
'linkLattes'
)
is
-
invalid
@
enderror
" name="
linkLattes
" value="
{{
old
(
'linkLattes'
)
}}
" autocomplete="
nome
">
@error('linkLattes')
<span class="
invalid
-
feedback
" role="
alert
">
<strong>{{
$message
}}</strong>
</span>
@enderror
</div>
<div class="
col
-
md
-
3
">
<label for="
bolsistaProdutividade
" class="
col
-
form
-
label
">{{ __('Bolsista de Produtividade') }}</label><br>
<select name="
bolsistaProdutividade
" id="
bolsistaProdutividade
" class="
form
-
control
" onchange="
mudarNivel
()
">
<option value="
sim
">Sim</option>
<option value="
nao
">Não</option>
</select>
</div>
<div class="
col
-
md
-
1
" id="
nivelInput
" style="
display
:
block
;
">
<label for="
nivel
" class="
col
-
form
-
label
">{{ __('Nivel') }}</label>
<select name="
nivel
" id="
nivel
" class="
form
-
control
">
<option value="
2
">2</option>
<option value="
1
D
">1D</option>
<option value="
1
B
">1B</option>
<option value="
1
C
">1C</option>
<option value="
1
A
">1A</option>
</select>
</div>
</div>
</div>
</div>
<div class="
row
justify
-
content
-
center
" style="
margin
:
20
px
0
20
px
0
">
<div class="
row
justify
-
content
-
center
" style="
margin
:
20
px
0
20
px
0
">
...
@@ -111,10 +262,10 @@
...
@@ -111,10 +262,10 @@
@endsection
@endsection
@section('javascript')
@section('javascript')
<
script
type
=
"text/javascript"
>
<script type="
text
/
javascript
">
$
(
document
)
.
ready
(
function
(
$
){
$(document).ready(function($)
{
$('#cpf').mask('000.000.000-00');
$('#cpf').mask('000.000.000-00');
var
SPMaskBehavior
=
function
(
val
)
{
var SPMaskBehavior = function(val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
},
},
spOptions = {
spOptions = {
...
@@ -125,5 +276,42 @@
...
@@ -125,5 +276,42 @@
$('#celular').mask(SPMaskBehavior, spOptions);
$('#celular').mask(SPMaskBehavior, spOptions);
});
});
</
script
>
function mudar() {
var divProponente = document.getElementById('proponente');
var comboBoxCargo = document.getElementById('cargo');
var comboBoxVinculo = document.getElementById('vinculo');
if (comboBoxCargo.value === "
Estudante
" && comboBoxVinculo.value !== "
Pós
-
doutorando
") {
divProponente.style.display = "
none
";
} else {
divProponente.style.display = "
block
";
}
outroVinculo();
}
function outroVinculo(){
var comboBoxVinculo = document.getElementById('vinculo');
var divOutro = document.getElementById('divOutro');
if(comboBoxVinculo.value === "
Outro
"){
divOutro.style.display = "
block
";
}else{
divOutro.style.display = "
none
";
}
}
function mudarNivel(){
var bolsista = document.getElementById('bolsistaProdutividade');
var nivel = document.getElementById('nivelInput');
if(bolsista.value === "
sim
"){
nivel.style.display = "
block
";
}else{
nivel.style.display = "
none
";
}
console.log("
a
");
}
</script>
@endsection
@endsection
\ No newline at end of file
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