diff --git a/resources/views/evento/submeterTrabalho.blade.php b/resources/views/evento/submeterTrabalho.blade.php
index ca254f74b1abe403522a63c86eaa5521aaaf6dd2..d39f3bfcaa8d9d26fa406f51677f12cd4e2fd876 100644
--- a/resources/views/evento/submeterTrabalho.blade.php
+++ b/resources/views/evento/submeterTrabalho.blade.php
@@ -411,12 +411,14 @@
-
- @error('cpf1')
-
- {{ $message }}
+
+
+
+ CPF inválido
+
+
+ CPF válido!
- @enderror
@@ -663,12 +665,14 @@
-
- @error('cpf2')
-
- {{ $message }}
+
+
+
+ CPF inválido
+
+
+ CPF válido!
- @enderror
@@ -915,12 +919,14 @@
-
- @error('cpf3')
-
- {{ $message }}
+
+
+
+ CPF inválido
+
+
+ CPF válido!
- @enderror
@@ -1197,6 +1203,28 @@
+
+
+
+
+
+
+ Existe um CPF inválido em um dos participantes por favor corrija para continuar.
+
+ {{-- --}}
+
+
+
+
+
@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;
+ }
@endsection
diff --git a/resources/views/proponente/projetosEdital.blade.php b/resources/views/proponente/projetosEdital.blade.php
index e28d0768d376d6e47e75a102800d7f0477a1abbb..641bf45f6a2ce0b7acf455f06162fad9df1bcf88 100644
--- a/resources/views/proponente/projetosEdital.blade.php
+++ b/resources/views/proponente/projetosEdital.blade.php
@@ -129,7 +129,11 @@
Nenhum projeto submetido!
@endif