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
49631667
Commit
49631667
authored
Sep 19, 2024
by
carlvercosaa
Browse files
resolvendo conflito
parents
792158cc
c5e8edf7
Changes
2
Hide whitespace changes
Inline
Side-by-side
resources/views/evento/criarEvento.blade.php
View file @
49631667
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
<
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
>
<
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
>
<
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
>
<
option
value
=
"{{
$i
}}"
@
if
(
old
(
'quantidade_ods'
)
==
$i
)
selected
@
endif
>
{{
$i
}}
</
option
>
@
endfor
@
endfor
</
select
>
</
select
>
...
...
resources/views/evento/submeterTrabalho.blade.php
View file @
49631667
...
@@ -814,56 +814,78 @@
...
@@ -814,56 +814,78 @@
},
5000
);
},
5000
);
}
}
// Form dinâmico da ODS
// Form dinâmico da ODS
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
()
{
var
selectedOds
=
[];
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
()
{
if
(
selectedOds
.
length
>
quantidadeOds
)
{
totalSelectedMetas
=
$
(
'
.meta-checkbox:checked
'
).
length
;
showAlert
(
'
#notificacao-erro
'
,
`Você atingiu o limite máximo de ODS's selecionadas (
${
quantidadeOds
}
)`
);
$
(
this
).
prop
(
'
checked
'
,
false
);
if
(
totalSelectedMetas
>
5
)
{
selectedOds
.
pop
();
showAlert
(
'
#notificacao-erro
'
,
'
Você atingiu o limite maximo de metas selecionadas(5)
'
)
$
(
this
).
prop
(
'
checked
'
,
false
);
return
;
}
}
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>
</script>
@endsection
@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