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
ddc99159
Commit
ddc99159
authored
Dec 21, 2022
by
Lucas Henrique
Browse files
Criando filtro para evitar prioridades duplicadas
parent
c584f2c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
resources/views/evento/criarEvento.blade.php
View file @
ddc99159
...
@@ -469,7 +469,7 @@
...
@@ -469,7 +469,7 @@
<
td
>
<
td
>
<
select
name
=
"addMoreInputFields[prioridade][0]"
class
=
"form-control prioridade"
>
<
select
name
=
"addMoreInputFields[prioridade][0]"
class
=
"form-control prioridade"
>
<
option
value
=
""
selected
>--
ORDEM
--</
option
>
<
option
value
=
""
selected
>--
ORDEM
--</
option
>
<
option
value
=
"1"
>
1
</
option
>
<
option
value
=
"1"
class
=
"ordem_option"
>
1
</
option
>
</
select
>
</
select
>
</
td
>
</
td
>
<
td
><
button
type
=
"button"
name
=
"add"
id
=
"dynamic-ar"
class
=
"btn btn-outline-primary"
>
Adicionar
</
button
></
td
>
<
td
><
button
type
=
"button"
name
=
"add"
id
=
"dynamic-ar"
class
=
"btn btn-outline-primary"
>
Adicionar
</
button
></
td
>
...
@@ -544,7 +544,7 @@
...
@@ -544,7 +544,7 @@
<
a
class
=
"btn btn-secondary botao-form"
href
=
"{{ route('admin.editais') }}"
style
=
"width:100%"
>
Cancelar
</
a
>
<
a
class
=
"btn btn-secondary botao-form"
href
=
"{{ route('admin.editais') }}"
style
=
"width:100%"
>
Cancelar
</
a
>
</
div
>
</
div
>
<
div
class
=
"col-md-6"
style
=
"padding-right:0"
>
<
div
class
=
"col-md-6"
style
=
"padding-right:0"
>
<
button
type
=
"submit"
class
=
"btn btn-primary botao-form"
style
=
"width:100%"
>
<
button
type
=
"submit"
class
=
"btn btn-primary botao-form"
id
=
"idButtonSubmitEvento"
style
=
"width:100%"
>
{{
__
(
'Criar Edital'
)
}}
{{
__
(
'Criar Edital'
)
}}
</
button
>
</
button
>
</
div
>
</
div
>
...
@@ -559,28 +559,71 @@
...
@@ -559,28 +559,71 @@
<
script
type
=
"text/javascript"
>
<
script
type
=
"text/javascript"
>
var
i
=
0
;
var
i
=
0
;
var
numCampos
=
1
;
var
numCampos
=
1
;
var
currentOptions
=
{
'0'
:
''
}
// Adiciona campo de avaliação
$
(
"#dynamic-ar"
)
.
click
(
function
()
{
$
(
"#dynamic-ar"
)
.
click
(
function
()
{
++
i
;
++
i
;
++
numCampos
;
++
numCampos
;
$
(
"#dynamicAddRemove"
)
.
append
(
$
(
"#dynamicAddRemove"
)
.
append
(
'<tr><td><input type="text" name="inputField[nome]['
+
i
+
']" class="form-control nome"/></td><td><input type="text" name="inputField[descricao]['
+
i
+
']" class="form-control descricao" /></td><td><input type="number" min=1 step="1" name="inputField[nota_maxima]['
+
i
+
']" class="form-control nota_maxima" /></td><td><select name="addMoreInputFields[prioridade]['
+
i
+
']" class="form-control prioridade"><option value="" selected>-- ORDEM --</option><option value="1">1</option></select></td><td><button type="button" class="btn btn-outline-danger remove-input-field">Remover</button></td></tr>'
);
'<tr><td><input type="text" name="inputField[nome]['
+
i
+
']" class="form-control nome"/></td><td><input type="text" name="inputField[descricao]['
+
i
+
']" class="form-control descricao" /></td><td><input type="number" min=1 step="1" name="inputField[nota_maxima]['
+
i
+
']" class="form-control nota_maxima" /></td><td><select name="addMoreInputFields[prioridade]['
+
i
+
']" class="form-control prioridade"><option value="" selected>-- ORDEM --</option><option value="1"
class="ordem_option"
>1</option></select></td><td><button type="button" class="btn btn-outline-danger remove-input-field"
name="removeButton['
+
i
+
']"
>Remover</button></td></tr>'
);
$
(
".prioridade"
)
.
children
()
.
remove
(
".dynamic"
)
$
(
".prioridade"
)
.
children
()
.
remove
(
".dynamic"
)
// Exibe opções caso estejam ocultas
$
(
'.ordem_option'
)
.
show
();
$
(
".prioridade"
)
.
each
(
function
()
{
$
(
".prioridade"
)
.
each
(
function
()
{
// Resetando os valores selecionados
$
(
this
)
.
val
(
""
)
.
change
();
selectId
=
$
(
this
)
.
attr
(
'name'
)
.
replace
(
/
\
D
/
g
,
""
)
.
toString
();
currentOptions
[
selectId
]
=
''
;
for
(
let
x
=
2
;
x
<=
numCampos
;
x
++
)
{
for
(
let
x
=
2
;
x
<=
numCampos
;
x
++
)
{
$
(
this
)
.
append
(
'<option value="'
+
x
+
'" class="dynamic">'
+
x
+
'</option>'
)
$
(
this
)
.
append
(
'<option value="'
+
x
+
'" class="ordem_option dynamic">'
+
x
+
'</option>'
)
}
}
})
})
console
.
log
(
)
//
console.log(
currentOptions);
});
});
// Exclui campo de avaliação
$
(
document
)
.
on
(
'click'
,
'.remove-input-field'
,
function
()
{
$
(
document
)
.
on
(
'click'
,
'.remove-input-field'
,
function
()
{
$
(
this
)
.
parents
(
'tr'
)
.
remove
();
$
(
this
)
.
parents
(
'tr'
)
.
remove
();
selectId
=
$
(
this
)
.
attr
(
'name'
)
.
replace
(
/
\
D
/
g
,
""
)
.
toString
();
currentOption
=
currentOptions
[
selectId
];
$
(
'.ordem_option[value|="'
+
currentOption
+
'"]'
)
.
show
();
delete
currentOptions
[
selectId
];
$
(
'.dynamic[value|="'
+
numCampos
+
'"]'
)
.
remove
();
$
(
'.dynamic[value|="'
+
numCampos
+
'"]'
)
.
remove
();
--
numCampos
;
--
numCampos
;
});
$
(
"#dynamicAddRemove"
)
.
on
(
'change'
,
'.prioridade'
,
function
()
{
selectId
=
$
(
this
)
.
attr
(
'name'
)
.
replace
(
/
\
D
/
g
,
""
)
.
toString
();
newOption
=
$
(
this
)
.
val
();
currentOption
=
currentOptions
[
selectId
];
$
(
'.ordem_option[value|="'
+
currentOption
+
'"]'
)
.
show
();
$
(
'.ordem_option[value|="'
+
newOption
+
'"]'
)
.
hide
();
currentOptions
[
selectId
]
=
newOption
;
});
});
// Tipo de avaliação
function
displayTipoAvaliacao
(
valor
){
function
displayTipoAvaliacao
(
valor
){
if
(
valor
==
"form"
){
if
(
valor
==
"form"
){
document
.
getElementById
(
"radioForm"
)
.
checked
=
true
;
document
.
getElementById
(
"radioForm"
)
.
checked
=
true
;
...
...
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