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
c5e8edf7
Commit
c5e8edf7
authored
Sep 19, 2024
by
Gabriel Alves
Browse files
ajuste parametrizacao aumentado para 17 e quantidade de metas relativo a card
parent
58464758
Changes
2
Hide whitespace changes
Inline
Side-by-side
resources/views/evento/criarEvento.blade.php
View file @
c5e8edf7
...
...
@@ -59,14 +59,14 @@
@
enderror
</
div
>
{{
--
<
div
class
=
"col-sm-2"
>
<
div
class
=
"col-sm-2"
>
<
label
for
=
"quantidade_ods"
class
=
"col-form-label"
>
{{
__
(
'Quantidade de ODS\'s:'
)
}}
<
span
style
=
"color:red; font-weight:bold;"
>*</
span
></
label
>
<
select
id
=
"quantidade_ods"
class
=
"form-control"
name
=
"quantidade_ods"
required
>
@
for
(
$i
=
1
;
$i
<=
5
;
$i
++
)
@
for
(
$i
=
1
;
$i
<=
17
;
$i
++
)
<
option
value
=
"{{
$i
}}"
@
if
(
old
(
'quantidade_ods'
)
==
$i
)
selected
@
endif
>
{{
$i
}}
</
option
>
@
endfor
</
select
>
</
div
>
--
}}
</
div
>
<
div
class
=
"col-sm-3"
>
<
label
for
=
"natureza"
class
=
"col-form-label"
>
{{
__
(
'Natureza:'
)
}}
<
span
style
=
"color:red; font-weight:bold;"
>*</
span
></
label
>
...
...
resources/views/evento/submeterTrabalho.blade.php
View file @
c5e8edf7
...
...
@@ -814,56 +814,78 @@
},
5000
);
}
// Form dinâmico da ODS
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
()
{
var
selectedOds
=
[];
$
(
'
.form-check-input
'
).
change
(
function
(){
selectedOds
=
[];
$
(
'
#metas-container
'
).
empty
();
$
(
'
.form-check-input:checked
'
).
each
(
function
(){
selectedOds
.
push
(
$
(
this
).
val
());
});
if
(
selectedOds
.
length
>
quantidadeOds
){
showAlert
(
'
#notificacao-erro
'
,
`Você atingiu o limite maximo de ODS\'s selecionadas(
${
quantidadeOds
}
)`
)
$
(
this
).
prop
(
'
checked
'
,
false
);
selectedOds
.
pop
()
}
selectedOds
.
forEach
(
function
(
odsId
){
$
.
ajax
({
url
:
'
/metas/
'
+
odsId
,
method
:
'
GET
'
,
success
:
function
(
response
){
var
metaOptions
=
'
<hr><div class="col-12"><div class="row subtitulo"><div class="col-sm-12"><p>Metas para
'
+
response
.
ods
+
'
</p></div></div></div></div>
'
+
'
<div class="form-group">
'
;
response
.
metas
.
forEach
(
function
(
meta
){
metaOptions
+=
'
<div class=" card form-check meta-item" style="margin-bottom : 1 rem "><div class="card-body">
'
+
'
<input type="checkbox" name="metas[
'
+
odsId
+
'
][]" value="
'
+
meta
.
id
+
'
" class="form-check-input meta-checkbox" id="meta
'
+
meta
.
id
+
'
">
'
+
'
<label class="form-check-label" for="meta
'
+
meta
.
id
+
'
">
'
+
meta
.
nome
+
'
</label>
'
+
'
<p class="form-text text-muted">
'
+
meta
.
descricao
+
'
</p>
'
+
'
</div></div>
'
;
});
metaOptions
+=
'
</div>
'
$
(
'
#metas-container
'
).
append
(
metaOptions
);
},
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
){
console
.
error
(
'
Erro ao carregar as metas:
'
,
textStatus
,
errorThrown
);
alert
(
'
Erro ao carregar as metas.
'
);
}
});
});
$
(
'
.form-check-input
'
).
change
(
function
()
{
selectedOds
=
[];
$
(
'
#metas-container
'
).
empty
();
$
(
'
.form-check-input:checked
'
).
each
(
function
()
{
selectedOds
.
push
(
$
(
this
).
val
());
});
$
(
document
).
on
(
'
change
'
,
'
.meta-checkbox
'
,
function
()
{
totalSelectedMetas
=
$
(
'
.meta-checkbox:checked
'
).
length
;
if
(
totalSelectedMetas
>
5
)
{
showAlert
(
'
#notificacao-erro
'
,
'
Você atingiu o limite maximo de metas selecionadas(5)
'
)
$
(
this
).
prop
(
'
checked
'
,
false
);
return
;
if
(
selectedOds
.
length
>
quantidadeOds
)
{
showAlert
(
'
#notificacao-erro
'
,
`Você atingiu o limite máximo de ODS's selecionadas (
${
quantidadeOds
}
)`
);
$
(
this
).
prop
(
'
checked
'
,
false
);
selectedOds
.
pop
();
}
selectedOds
.
forEach
(
function
(
odsId
)
{
$
.
ajax
({
url
:
'
/metas/
'
+
odsId
,
method
:
'
GET
'
,
success
:
function
(
response
)
{
var
metaOptions
=
'
<hr><div class="col-12"><div class="row subtitulo"><div class="col-sm-12"><p>Metas para
'
+
response
.
ods
+
'
</p></div></div></div>
'
+
'
<div class="form-group" data-ods-id="
'
+
odsId
+
'
">
'
;
response
.
metas
.
forEach
(
function
(
meta
)
{
metaOptions
+=
'
<div class=" card form-check meta-item" style="margin-bottom : 1rem;"><div class="card-body">
'
+
'
<input type="checkbox" name="metas[
'
+
odsId
+
'
][]" value="
'
+
meta
.
id
+
'
" class="form-check-input meta-checkbox" data-ods-id="
'
+
odsId
+
'
" id="meta
'
+
meta
.
id
+
'
">
'
+
'
<label class="form-check-label" for="meta
'
+
meta
.
id
+
'
">
'
+
meta
.
nome
+
'
</label>
'
+
'
<p class="form-text text-muted">
'
+
meta
.
descricao
+
'
</p>
'
+
'
</div></div>
'
;
});
metaOptions
+=
'
</div>
'
;
$
(
'
#metas-container
'
).
append
(
metaOptions
);
},
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
console
.
error
(
'
Erro ao carregar as metas:
'
,
textStatus
,
errorThrown
);
alert
(
'
Erro ao carregar as metas.
'
);
},
});
});
});
$
(
document
).
on
(
'
change
'
,
'
.meta-checkbox
'
,
function
()
{
// Get the odsId from the checkbox
var
odsId
=
$
(
this
).
data
(
'
ods-id
'
);
// Count the number of selected checkboxes within the same group (odsId)
var
totalSelectedMetas
=
$
(
'
.meta-checkbox[data-ods-id="
'
+
odsId
+
'
"]:checked
'
).
length
;
if
(
totalSelectedMetas
>
3
)
{
// Change the limit here if needed
showAlert
(
'
#notificacao-erro
'
,
'
Você atingiu o limite máximo de metas selecionadas (3) para este grupo
'
);
$
(
this
).
prop
(
'
checked
'
,
false
);
}
});
});
</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