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
737ab459
Commit
737ab459
authored
Jun 15, 2020
by
alinetenorio
Browse files
setando opção inicial em select boxes
parent
7f1b00b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
resources/lang/pt-BR/validation.php
View file @
737ab459
...
...
@@ -57,12 +57,12 @@ return [
'not_in'
=>
'O :attribute selecionado é inválido.'
,
'numeric'
=>
':Attribute deve ser um número.'
,
'regex'
=>
'O formato de :attribute é inválido.'
,
'required'
=>
'O campo
:attribute
é obrigatório.'
,
'required_if'
=>
'O campo
:attribute
é obrigatório
quando :other é :value
.'
,
'required'
=>
'O campo é obrigatório.'
,
'required_if'
=>
'O campo é obrigatório.'
,
'required_unless'
=>
'O :attribute é necessário a menos que :other esteja em :values.'
,
'required_with'
=>
'O campo
:attribute
é obrigatório
quando :values está presente
.'
,
'required_with'
=>
'O campo é obrigatório.'
,
'required_with_all'
=>
'O campo :attribute é obrigatório quando :values estão presentes.'
,
'required_without'
=>
'O campo
:attribute
é obrigatório
quando :values não está presente
.'
,
'required_without'
=>
'O campo é obrigatório.'
,
'required_without_all'
=>
'O campo :attribute é obrigatório quando nenhum destes estão presentes: :values.'
,
'same'
=>
':Attribute e :other devem ser iguais.'
,
'size'
=>
[
...
...
resources/views/evento/submeterTrabalho.blade.php
View file @
737ab459
...
...
@@ -30,7 +30,7 @@
<
div
class
=
"row justify-content-center"
>
<
div
class
=
"col-sm-4"
>
<
label
for
=
"grandeArea"
class
=
"col-form-label"
>
{{
__
(
'Grande Área*:'
)
}}
</
label
>
<
select
class
=
"form-control @error('grandeArea') is-invalid @enderror"
id
=
"grandeArea"
name
=
"grandeArea"
onchange
=
"areas()"
onload
=
"areas()"
>
<
select
class
=
"form-control @error('grandeArea') is-invalid @enderror"
id
=
"grandeArea"
name
=
"grandeArea"
onchange
=
"areas()"
>
<
option
value
=
""
disabled
selected
hidden
>--
Grande
Área
--</
option
>
@
foreach
(
$grandeAreas
as
$grandeArea
)
<
option
@
if
(
old
(
'grandeArea'
)
==
$grandeArea
->
id
)
selected
@
endif
value
=
"
{
{$grandeArea->id}}">{{$grandeArea->nome}
}
</option>
...
...
@@ -45,8 +45,8 @@
</div>
<div class="
col
-
sm
-
4
">
<label for="
area
" class="
col
-
form
-
label
">{{ __('Área*:') }}</label>
<
select class="
form
-
control
@
error
(
'area'
)
is
-
invalid
@
enderror
" id="
a
rea
"
name="
area
" onchange="
subareas
()
"
>
<input type="
hidden
" id="
oldA
rea
"
value="
{{
old
(
'area'
)
}}
"></input>
<
input type="
hidden
" id="
oldA
rea
"
value="
{{
old
(
'area'
)
}}
"></input
>
<select class="
form
-
control
@
error
(
'area'
)
is
-
invalid
@
enderror
" id="
a
rea
"
name="
area
" onchange="
subareas
()
">
<option value="" disabled selected hidden>-- Área --</option>
{{-- @foreach(
$areas
as
$area
)
<option @if(old('area')==
$area->id
) selected @endif value="
{{
$area
->
id
}}
">
{
{$area->nome}
}
</option>
...
...
@@ -61,8 +61,8 @@
</div>
<div class="
col
-
sm
-
4
">
<label for="
subArea
" class="
col
-
form
-
label
">{{ __('Sub Área*:') }}</label>
<
select class="
form
-
control
@
error
(
'subArea'
)
is
-
invalid
@
enderror
" id="
s
ubArea
"
name="
subArea
"
>
<input type="
hidden
" id="
oldS
ubArea
"
value="
{{
old
(
'subArea'
)
}}
"></input>
<
input type="
hidden
" id="
oldS
ubArea
"
value="
{{
old
(
'subArea'
)
}}
"></input
>
<select class="
form
-
control
@
error
(
'subArea'
)
is
-
invalid
@
enderror
" id="
s
ubArea
"
name="
subArea
">
<option value="" disabled selected hidden>-- Sub Área --</option>
{{-- @foreach(
$subAreas
as
$subArea
)
<option @if(old('subArea')==
$subArea->id
) selected @endif value="
{{
$subArea
->
id
}}
">
{
{$subArea->nome}
}
</option>
...
...
@@ -582,28 +582,26 @@
// "</div>";
// }
function
areas
()
{
console
.
log
(
'aqui D'
);
function
areas
()
{
var
grandeArea
=
$
(
'#grandeArea'
)
.
val
();
$
.
getJSON
(
"{{ config('app.url') }}/naturezas/areas/"
+
grandeArea
,
function
(
dados
)
{
if
(
dados
.
length
>
0
)
{
console
.
log
(
'aqui A'
);
var
option
=
'<option>-- Área --</option>'
;
if
(
dados
.
length
>
0
)
{
if
(
$
(
'#oldArea'
)
.
val
()
==
null
||
$
(
'#oldArea'
)
.
val
()
==
""
){
var
option
=
'<option selected disabled>-- Área --</option>'
;
}
$
.
each
(
dados
,
function
(
i
,
obj
)
{
if
(
$
(
'#oldArea'
)
.
val
()
!=
null
&&
$
(
'#oldArea'
)
.
val
()
==
obj
.
id
){
console
.
log
(
'aqui B'
);
if
(
$
(
'#oldArea'
)
.
val
()
!=
null
&&
$
(
'#oldArea'
)
.
val
()
==
obj
.
id
){
option
+=
'<option selected value="'
+
obj
.
id
+
'">'
+
obj
.
nome
+
'</option>'
;
}
else
{
option
+=
'<option value="'
+
obj
.
id
+
'">'
+
obj
.
nome
+
'</option>'
;
}
})
}
else
{
console
.
log
(
'aqui C'
);
var
option
=
"<option>-- Área --</option>"
;
}
else
{
var
option
=
"<option selected disabled>-- Área --</option>"
;
}
$
(
'#area'
)
.
html
(
option
)
.
show
();
//
subareas();
subareas
();
})
}
...
...
@@ -612,10 +610,10 @@
$
.
getJSON
(
"{{ config('app.url') }}/naturezas/subarea/"
+
area
,
function
(
dados
)
{
if
(
dados
.
length
>
0
)
{
var
option
=
'<option>--
Sub
Á
rea
--</option>'
;
$
.
each
(
dados
,
function
(
i
,
obj
)
{
console
.
log
(
$
(
'#oldSubArea'
)
.
val
());
console
.
log
(
obj
.
id
);
if
(
$
(
'#oldSubArea'
)
.
val
()
==
null
||
$
(
'#old
Sub
A
rea
'
)
.
val
()
==
""
){
var
option
=
'<option selected disabled>-- Sub Área --</option>'
;
}
$
.
each
(
dados
,
function
(
i
,
obj
)
{
if
(
$
(
'#oldSubArea'
)
.
val
()
!=
null
&&
$
(
'#oldSubArea'
)
.
val
()
==
obj
.
id
){
option
+=
'<option selected value="'
+
obj
.
id
+
'">'
+
obj
.
nome
+
'</option>'
;
}
else
{
...
...
@@ -623,7 +621,7 @@
}
})
}
else
{
var
option
=
"<option>-- Sub Área --</option>"
;
var
option
=
"<option
selected disabled
>-- Sub Área --</option>"
;
}
$
(
'#subArea'
)
.
html
(
option
)
.
show
();
})
...
...
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