Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
49631667
Commit
49631667
authored
8 months ago
by
carlvercosaa
Browse files
Options
Download
Plain Diff
resolvendo conflito
parents
792158cc
c5e8edf7
carl-branch
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
resources/views/evento/criarEvento.blade.php
+1
-1
resources/views/evento/criarEvento.blade.php
resources/views/evento/submeterTrabalho.blade.php
+66
-44
resources/views/evento/submeterTrabalho.blade.php
with
67 additions
and
45 deletions
+67
-45
resources/views/evento/criarEvento.blade.php
View file @
49631667
...
...
@@ -62,7 +62,7 @@
<
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
>
...
...
This diff is collapsed.
Click to expand it.
resources/views/evento/submeterTrabalho.blade.php
View file @
49631667
...
...
@@ -814,56 +814,78 @@
},
5000
);
}
// Form dinâmico da ODS
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
()
{
var
selectedOds
=
[];
$
(
'
.form-check-input
'
).
change
(
function
(){
$
(
'
.form-check-input
'
).
change
(
function
()
{
selectedOds
=
[];
$
(
'
#metas-container
'
).
empty
();
$
(
'
.form-check-input:checked
'
).
each
(
function
(){
$
(
'
.form-check-input:checked
'
).
each
(
function
()
{
selectedOds
.
push
(
$
(
this
).
val
());
});
if
(
selectedOds
.
length
>
quantidadeOds
){
showAlert
(
'
#notificacao-erro
'
,
`Você atingiu o limite m
a
ximo de ODS
\
's selecionadas(
${
quantidadeOds
}
)`
)
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
.
pop
()
;
}
selectedOds
.
forEach
(
function
(
odsId
){
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>
'
+
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>
'
metaOptions
+=
'
</div>
'
;
$
(
'
#metas-container
'
).
append
(
metaOptions
);
},
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
){
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
()
{
totalSelectedMetas
=
$
(
'
.meta-checkbox:checked
'
).
length
;
$
(
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
>
5
)
{
showAlert
(
'
#notificacao-erro
'
,
'
Você atingiu o limite m
a
ximo de metas selecionadas
(5)
'
)
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
);
return
;
}
});
});
</script>
@endsection
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help