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
8431d5eb
"app/vscode:/vscode.git/clone" did not exist on "d6e8f1f867243f27b2a75d5d35b894847f346e90"
Unverified
Commit
8431d5eb
authored
May 31, 2021
by
carlos1270
Committed by
GitHub
May 31, 2021
Browse files
Merge pull request #92 from carlos1270/mod_lay_6
Validando o cpf
parents
7328ccbc
17f7cc6a
Changes
3
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/TrabalhoController.php
View file @
8431d5eb
...
...
@@ -1113,7 +1113,7 @@ class TrabalhoController extends Controller
$subject
=
"Participante de Projeto"
;
Mail
::
to
(
$request
->
emailParticipante
[
$key
])
->
send
(
new
EmailParaUsuarioNaoCadastrado
(
Auth
()
->
user
()
->
name
,
$projeto
->
titulo
,
'Participante'
,
$edital
->
nome
,
$passwordTemporario
,
$subject
));
//
Mail::to($request->emailParticipante[$key])->send(new EmailParaUsuarioNaoCadastrado(Auth()->user()->name, $projeto->titulo, 'Participante', $edital->nome, $passwordTemporario, $subject));
}
else
{
$participante
->
user_id
=
$userParticipante
->
id
;
...
...
@@ -1131,8 +1131,8 @@ class TrabalhoController extends Controller
$participante
->
save
();
$subject
=
"Participante de Projeto"
;
Mail
::
to
(
$request
->
emailParticipante
[
$key
])
->
send
(
new
SubmissaoTrabalho
(
$userParticipante
,
$subject
,
$edital
,
$projeto
));
//
Mail::to($request->emailParticipante[$key])
//
->send(new SubmissaoTrabalho($userParticipante, $subject, $edital, $projeto));
}
...
...
@@ -1276,7 +1276,7 @@ class TrabalhoController extends Controller
$subject
=
"Participante de Projeto"
;
Mail
::
to
(
$email
)
->
send
(
new
EmailParaUsuarioNaoCadastrado
(
Auth
()
->
user
()
->
name
,
$projeto
->
titulo
,
'Participante'
,
$edital
->
nome
,
$passwordTemporario
,
$subject
));
//
Mail::to($email)->send(new EmailParaUsuarioNaoCadastrado(Auth()->user()->name, $projeto->titulo, 'Participante', $edital->nome, $passwordTemporario, $subject));
}
else
{
$participante
->
user_id
=
$userParticipante
->
id
;
...
...
@@ -1294,8 +1294,8 @@ class TrabalhoController extends Controller
$participante
->
save
();
$subject
=
"Participante de Projeto"
;
Mail
::
to
(
$email
)
->
send
(
new
SubmissaoTrabalho
(
$userParticipante
,
$subject
,
$edital
,
$projeto
));
//
Mail::to($email)
//
->send(new SubmissaoTrabalho($userParticipante, $subject, $edital, $projeto));
}
...
...
resources/views/evento/submeterTrabalho.blade.php
View file @
8431d5eb
...
...
@@ -411,12 +411,14 @@
</
div
>
<
div
class
=
"form-group col-md-6"
>
<
label
for
=
"cpf1"
>
CPF
<
span
style
=
"color: red; font-weight:bold"
>*</
span
></
label
>
<
input
type
=
"text"
class
=
"form-control @error('cpf1') is-invalid @enderror"
id
=
"cpf1"
name
=
"cpf[]"
placeholder
=
"Digite o CPF do participante"
required
>
@
error
(
'cpf1'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
style
=
"overflow: visible; display:block"
>
<
strong
>
{{
$message
}}
</
strong
>
<
input
type
=
"text"
class
=
"form-control @error('cpf1') is-invalid @enderror cpf"
id
=
"cpf1"
name
=
"cpf[]"
placeholder
=
"Digite o CPF do participante"
required
>
<
span
id
=
"cpf-invalido-1"
class
=
"invalid-feedback cpf-invalido"
role
=
"alert"
style
=
"overflow: visible; display:none"
>
<
strong
>
CPF
inválido
</
strong
>
</
span
>
<
span
id
=
"cpf-valido-1"
class
=
"valid-feedback"
role
=
"alert"
style
=
"overflow: visible; display:none"
>
<
strong
>
CPF
válido
!</
strong
>
</
span
>
@
enderror
</
div
>
<
div
class
=
"form-group col-md-6"
>
<
label
for
=
"rg1"
>
RG
<
span
style
=
"color: red; font-weight:bold"
>*</
span
></
label
>
...
...
@@ -663,12 +665,14 @@
</
div
>
<
div
class
=
"form-group col-md-6"
>
<
label
for
=
"cpf2"
>
CPF
<
span
style
=
"color: red; font-weight:bold"
>*</
span
></
label
>
<
input
type
=
"text"
class
=
"form-control @error('cpf2') is-invalid @enderror"
id
=
"cpf2"
name
=
"cpf[]"
placeholder
=
"Digite o CPF do participante"
required
>
@
error
(
'cpf2'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
style
=
"overflow: visible; display:block"
>
<
strong
>
{{
$message
}}
</
strong
>
<
input
type
=
"text"
class
=
"form-control @error('cpf2') is-invalid @enderror cpf"
id
=
"cpf2"
name
=
"cpf[]"
placeholder
=
"Digite o CPF do participante"
required
>
<
span
id
=
"cpf-invalido-2"
class
=
"invalid-feedback cpf-invalido"
role
=
"alert"
style
=
"overflow: visible; display:none"
>
<
strong
>
CPF
inválido
</
strong
>
</
span
>
<
span
id
=
"cpf-valido-2"
class
=
"valid-feedback"
role
=
"alert"
style
=
"overflow: visible; display:none"
>
<
strong
>
CPF
válido
!</
strong
>
</
span
>
@
enderror
</
div
>
<
div
class
=
"form-group col-md-6"
>
<
label
for
=
"rg2"
>
RG
<
span
style
=
"color: red; font-weight:bold"
>*</
span
></
label
>
...
...
@@ -915,12 +919,14 @@
</
div
>
<
div
class
=
"form-group col-md-6"
>
<
label
for
=
"cpf3"
>
CPF
<
span
style
=
"color: red; font-weight:bold"
>*</
span
></
label
>
<
input
type
=
"text"
class
=
"form-control @error('cpf3') is-invalid @enderror"
id
=
"cpf3"
name
=
"cpf[]"
placeholder
=
"Digite o CPF do participante"
required
>
@
error
(
'cpf3'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
style
=
"overflow: visible; display:block"
>
<
strong
>
{{
$message
}}
</
strong
>
<
input
type
=
"text"
class
=
"form-control @error('cpf3') is-invalid @enderror cpf"
id
=
"cpf3"
name
=
"cpf[]"
placeholder
=
"Digite o CPF do participante"
required
>
<
span
id
=
"cpf-invalido-3"
class
=
"invalid-feedback cpf-invalido"
role
=
"alert"
style
=
"overflow: visible; display:none"
>
<
strong
>
CPF
inválido
</
strong
>
</
span
>
<
span
id
=
"cpf-valido-3"
class
=
"valid-feedback"
role
=
"alert"
style
=
"overflow: visible; display:none"
>
<
strong
>
CPF
válido
!</
strong
>
</
span
>
@
enderror
</
div
>
<
div
class
=
"form-group col-md-6"
>
<
label
for
=
"rg3"
>
RG
<
span
style
=
"color: red; font-weight:bold"
>*</
span
></
label
>
...
...
@@ -1197,6 +1203,28 @@
</
div
>
</
div
>
<!--
Modal
-->
<
div
class
=
"modal fade"
id
=
"modalCpfInvalido"
tabindex
=
"-1"
role
=
"dialog"
aria
-
labelledby
=
"exampleModalLabel2"
aria
-
hidden
=
"true"
>
<
div
class
=
"modal-dialog modal-dialog-centered"
role
=
"document"
>
<
div
class
=
"modal-content"
>
<
div
class
=
"modal-header"
style
=
"background-color: red;"
>
<
h5
class
=
"modal-title"
id
=
"exampleModalLabel2"
style
=
"font-size:20px; margin-top:7px; color:white; font-weight:bold; font-family: 'Roboto', sans-serif;"
>
Aviso
</
h5
>
<
button
type
=
"button"
class
=
"close"
data
-
dismiss
=
"modal"
aria
-
label
=
"Close"
>
<
span
aria
-
hidden
=
"true"
>&
times
;
</
span
>
</
button
>
</
div
>
<
div
class
=
"modal-body"
>
Existe
um
CPF
inválido
em
um
dos
participantes
por
favor
corrija
para
continuar
.
</
div
>
{{
--
<
div
class
=
"modal-footer"
>
{{
--
<
button
type
=
"button"
class
=
"btn btn-secondary"
></
button
>
{{
--
<
button
type
=
"button"
class
=
"btn btn-primary"
>
Certo
</
button
>
</
div
>
--
}}
</
div
>
</
div
>
</
div
>
</
div
>
@
endsection
@
section
(
'javascript'
)
...
...
@@ -1448,16 +1476,19 @@ function fecharModalenviarProjeto(){
function
enviarModalenviarProjeto
(){
if
(
numeroDeParticipantes
==
1
){
document
.
getElementById
(
"collapseParticipante1"
)
.
classList
.
add
(
"show"
);
document
.
getElementById
(
"clickSubmitForm"
)
.
click
();
}
else
if
(
numeroDeParticipantes
==
2
){
document
.
getElementById
(
"collapseParticipante1"
)
.
classList
.
add
(
"show"
);
document
.
getElementById
(
"collapseParticipante2"
)
.
classList
.
add
(
"show"
);
document
.
getElementById
(
"clickSubmitForm"
)
.
click
();
}
else
if
(
numeroDeParticipantes
==
3
){
document
.
getElementById
(
"collapseParticipante1"
)
.
classList
.
add
(
"show"
);
document
.
getElementById
(
"collapseParticipante2"
)
.
classList
.
add
(
"show"
);
document
.
getElementById
(
"collapseParticipante3"
)
.
classList
.
add
(
"show"
);
}
if
(
checarCpfs
())
{
document
.
getElementById
(
"clickSubmitForm"
)
.
click
();
}
else
{
$
(
"#modalCpfInvalido"
)
.
modal
(
'show'
);
}
}
/*
...
...
@@ -2029,5 +2060,84 @@ $(document).ready(()=>{
// }
// });
// });
$
(
document
)
.
ready
(
function
(){
$
(
".cpf"
)
.
change
(
function
(){
if
(
validarCPF
(
retirarFormatacao
(
this
.
value
)))
{
this
.
parentElement
.
children
[
2
]
.
style
.
display
=
"none"
;
this
.
parentElement
.
children
[
3
]
.
style
.
display
=
"block"
;
}
else
{
this
.
parentElement
.
children
[
2
]
.
style
.
display
=
"block"
;
this
.
parentElement
.
children
[
3
]
.
style
.
display
=
"none"
;
}
});
});
function
validarCPF
(
strCPF
)
{
var
soma
;
var
resto
;
soma
=
0
;
// Verifica se foi informado todos os digitos corretamente
if
(
strCPF
.
length
!=
11
)
{
return
false
;
}
// Verifica se foi informada uma sequência de digitos repetidos. Ex: 111.111.111-11
if
(
varificarDigitos
(
strCPF
))
{
return
false
;
}
// Faz o calculo para validar o CPF
for
(
var
t
=
9
;
t
<
11
;
t
++
)
{
for
(
var
d
=
0
,
c
=
0
;
c
<
t
;
c
++
)
{
d
+=
strCPF
[
c
]
*
((
t
+
1
)
-
c
);
}
d
=
((
10
*
d
)
%
11
)
%
10
;
if
(
strCPF
[
c
]
!=
d
)
{
return
false
;
}
}
return
true
;
}
function
retirarFormatacao
(
strCpf
)
{
resultado
=
""
;
for
(
var
i
=
0
;
i
<
strCpf
.
length
;
i
++
)
{
if
(
strCpf
[
i
]
!=
"."
&&
strCpf
[
i
]
!=
"-"
)
{
resultado
+=
strCpf
[
i
];
}
}
return
resultado
;
}
function
varificarDigitos
(
strCpf
)
{
var
cont
=
1
;
dig1
=
strCpf
[
0
];
for
(
var
i
=
1
;
i
<
strCpf
.
length
;
i
++
)
{
if
(
dig1
==
strCpf
[
i
])
{
cont
++
;
}
}
if
(
cont
==
strCpf
.
length
)
{
return
true
;
}
return
false
;
}
function
checarCpfs
()
{
var
validacoes
=
document
.
getElementsByClassName
(
"cpf-invalido"
);
var
count
=
validacoes
.
length
;
var
quant
=
0
;
for
(
var
i
=
0
;
i
<
validacoes
.
length
;
i
++
)
{
if
(
validacoes
[
i
]
.
style
.
display
==
"none"
)
{
quant
++
;
}
}
if
(
quant
==
count
)
{
return
true
;
}
return
false
;
}
</
script
>
@
endsection
resources/views/proponente/projetosEdital.blade.php
View file @
8431d5eb
...
...
@@ -129,7 +129,11 @@
<
h5
>
Nenhum
projeto
submetido
!</
h5
>
</
div
>
<
div
class
=
"col-md-12"
style
=
"text-align: center;"
>
@
if
(
$edital
->
inicioSubmissao
<=
$hoje
&&
$hoje
<=
$edital
->
fimSubmissao
)
<
a
href
=
"{{ route('trabalho.index', ['id' =>
$edital->id
] )}}"
>
Cliquei
aqui
para
submeter
um
projeto
.
</
a
>
@
else
<
a
href
=
"#"
>
O
periodo
de
submissão
foi
encerrado
.
</
a
>
@
endif
</
div
>
</
div
>
@
endif
...
...
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