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
9aa0f1cd
Commit
9aa0f1cd
authored
Aug 20, 2024
by
Gabriel Alves
Browse files
Notificacao bootstrap adicionada
parent
8a3746fe
Changes
1
Show whitespace changes
Inline
Side-by-side
resources/views/evento/submeterTrabalho.blade.php
View file @
9aa0f1cd
...
...
@@ -12,7 +12,9 @@
<
div
class
=
"container"
>
<
div
class
=
"row justify-content-center"
style
=
"margin-top: 35px"
>
<
div
class
=
"alert alert-danger"
id
=
"notificacao-erro"
style
=
"display: none;"
role
=
"alert"
>
não
pode
selecionar
mais
de
3
ods
</
div
>
@
include
(
'evento.formulario.projeto'
)
...
...
@@ -803,8 +805,15 @@
}
}
function
showAlert
(
$id
,
$mensagem
){
$
(
'
#notificacao-erro
'
).
html
(
$mensagem
)
$
(
$id
).
fadeIn
();
$
(
$id
)[
0
].
scrollIntoView
({
behavior
:
'
smooth
'
});
setTimeout
(
function
()
{
$
(
$id
).
fadeOut
();
},
5000
);
}
// Form dinâmico da ODS
$
(
document
).
ready
(
function
(){
var
selectedOds
=
[];
$
(
'
.form-check-input
'
).
change
(
function
(){
...
...
@@ -815,7 +824,7 @@
});
if
(
selectedOds
.
length
>
3
){
a
lert
(
'
Você só pode
seleciona
r até
3 ODS
.
'
)
;
showA
lert
(
'
#notificacao-erro
'
,
'
Você atingiu o limite maximo de ODS
seleciona
das(
3 ODS
)
'
)
$
(
this
).
prop
(
'
checked
'
,
false
);
selectedOds
.
pop
()
}
...
...
@@ -845,24 +854,16 @@
});
$
(
document
).
on
(
'
change
'
,
'
.form-check-input
'
,
function
(){
var
metaCheckboxes
=
$
(
'
input[name^="metas"]
'
);
var
selectedMetas
=
{};
$
(
document
).
on
(
'
change
'
,
'
.meta-checkbox
'
,
function
()
{
totalSelectedMetas
=
$
(
'
.meta-checkbox:checked
'
).
length
;
metaCheckboxes
.
each
(
function
(){
var
odsId
=
$
(
this
).
attr
(
'
name
'
).
match
(
/metas
\[(\d
+
)\]
/
)[
1
];
if
(
!
selectedMetas
[
odsId
])
selectedMetas
[
odsId
]
=
[];
if
(
$
(
this
).
prop
(
'
checked
'
))
selectedMetas
[
odsId
].
push
(
$
(
this
).
val
());
});
for
(
var
odsId
in
selectedMetas
){
if
(
selectedMetas
[
odsId
].
length
>
3
){
alert
(
'
Você só pode selecionar até 3 metas por ODS.
'
);
if
(
totalSelectedMetas
>
3
)
{
showAlert
(
'
#notificacao-erro
'
,
'
Você atingiu o limite maximo de metas selecionadas(3 metas)
'
)
$
(
this
).
prop
(
'
checked
'
,
false
);
return
;
}
}
});
});
});
</script>
@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