Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nutricao
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PET Computação
nutricao
Commits
edf9ceaf
Commit
edf9ceaf
authored
8 years ago
by
Stephanie Briere Americo
Browse files
Options
Downloads
Patches
Plain Diff
Adicionar mais de uma faixa etária
parent
c9189a10
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.js
+48
-27
48 additions, 27 deletions
main.js
prototipo.html
+2
-2
2 additions, 2 deletions
prototipo.html
with
50 additions
and
29 deletions
main.js
+
48
−
27
View file @
edf9ceaf
...
...
@@ -71,7 +71,6 @@ function alertPublicoEmpresa(e){
if
(
dados
.
getNecessidadesNutr
())
{
tabs
=
dados
.
getNecessidadesNutr
().
getTabelas
()
for
(
var
element
in
tabelas
)
{
for
(
var
e
in
tabs
)
...
...
@@ -92,29 +91,32 @@ function alertPublicoEmpresa(e){
}
igual
=
0
;
}
}
else
{
for
(
var
element
in
tabelas
)
{
htmlCheckBoxes
+=
"
<li> <input id=
"
+
tabelas
[
element
]
+
"
type=checkbox>
"
+
tabelas
[
element
]
+
"
</li><br>
"
}
}
$
(
"
#checkBoxes
"
).
html
(
htmlCheckBoxes
+
"
</ul>
"
);
if
(
dados
.
getNecessidadesNutr
()){
colunas
=
""
;
vetor
=
[]
vetor
=
dados
.
getNecessidadesNutr
().
getIdades
()
console
.
log
(
vetor
)
for
(
var
object
in
vetor
)
{
console
.
log
(
object
)
colunas
+=
"
<tr><td><input type = text></input></td></tr>
"
faixaIdade
=
vetor
[
object
]
console
.
log
(
faixaIdade
[
0
],
faixaIdade
[
1
])
colunas
+=
"
<tr><td><input type = text id=idadeMinima
"
+
object
+
"
></input></td>
"
colunas
+=
"
<td><input type=text id=idadeMaxima
"
+
object
+
"
></input></td></tr>
"
}
document
.
getElementById
(
"
tidades
"
).
innerHTML
+=
colunas
;
}
else
{
for
(
var
element
in
tabelas
)
{
htmlCheckBoxes
+=
"
<li> <input id=
"
+
tabelas
[
element
]
+
"
type=checkbox>
"
+
tabelas
[
element
]
+
"
</li><br>
"
}
}
$
(
"
#checkBoxes
"
).
html
(
htmlCheckBoxes
+
"
</ul>
"
);
}
function
alertCardapioEmpresa
(
e
){
dados
=
ListaEmpresas
[
e
];
...
...
@@ -198,9 +200,29 @@ $("#adicionaCardapioEmpresa").click(function(){
});
$
(
"
#adicionaIdadesEmpresa
"
).
click
(
function
(){
var
colunas
=
"
<tr><td> <input type=text id = idadeCardapio></td><td style=
\"
width:auto;
\"
>
"
;
colunas
+=
"
</td></tr>
"
numFaixas
=
$
(
"
#tidades
"
).
children
().
length
;
backupValues
=
[];
numFaixas
=
$
(
"
#tidades
"
).
children
().
length
;
for
(
var
i
=
0
;
i
<
numFaixas
;
i
++
){
valor
=
[];
valor
.
push
(
document
.
getElementById
(
"
idadeMinima
"
+
i
).
value
);
valor
.
push
(
document
.
getElementById
(
"
idadeMaxima
"
+
i
).
value
);
backupValues
.
push
(
valor
);
}
var
colunas
=
"
<tr><td> <input type=text id = idadeMinima
"
+
numFaixas
+
"
></td><td><input type= text id = idadeMaxima
"
+
numFaixas
+
"
>
"
;
colunas
+=
"
</td></tr>
"
;
console
.
log
(
colunas
)
document
.
getElementById
(
"
tidades
"
).
innerHTML
+=
colunas
;
for
(
var
i
=
0
;
i
<
numFaixas
;
i
++
){
document
.
getElementById
(
"
idadeMinima
"
+
i
).
value
=
backupValues
[
i
][
0
];
document
.
getElementById
(
"
idadeMaxima
"
+
i
).
value
=
backupValues
[
i
][
1
];
}
});
$
(
"
#editaDadosEmpresa
"
).
click
(
function
(){
...
...
@@ -250,17 +272,16 @@ $("#editaPublicoEmpresa").click( function(){
tabelasDados
.
push
(
tabelas
[
element
]);
}
}
idades
=
[]
if
(
dados
.
getNecessidadesNutr
())
{
idades
=
dados
.
getNecessidadesNutr
().
getIdades
()
}
idades
.
push
(
$
(
"
#idadeCardapio
"
).
val
());
console
.
log
(
$
(
"
#idadeCardapio
"
).
val
())
console
.
log
(
idades
);
dados
.
setNecessidadesNutr
(
new
NecessidadesNutr
(
tabelasDados
,
idades
)
);
idades
=
[]
numFaixas
=
$
(
"
#tidades
"
).
children
().
length
;
console
.
log
(
numFaixas
);
for
(
var
i
=
0
;
i
<
numFaixas
;
i
++
){
console
.
log
(
document
.
getElementById
(
"
idadeMinima
"
+
i
).
value
);
console
.
log
(
document
.
getElementById
(
"
idadeMaxima
"
+
i
).
value
);
}
//dados.setNecessidadesNutr( new NecessidadesNutr(tabelasDados,idades) );
atualizaEmpresas
();
$
(
"
.ui-button
"
).
click
();
});
...
...
This diff is collapsed.
Click to expand it.
prototipo.html
+
2
−
2
View file @
edf9ceaf
...
...
@@ -59,8 +59,8 @@
<thead>
<tr>
<td>
Faixa de idade
</td>
<td>
Ações
</td>
<td>
Idade minima
</td>
<td>
Idade máxima
</td>
</tr>
</thead>
<tbody
id =
"tidades"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment