Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PET Computação
nutricao
Commits
7155ab73
Commit
7155ab73
authored
Mar 19, 2017
by
mc16
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
função de adicionar o tipo de preparação no cardápio
parent
d0882a3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
6 deletions
+34
-6
prototipo.html
prototipo.html
+34
-6
No files found.
prototipo.html
View file @
7155ab73
...
...
@@ -84,8 +84,8 @@ class NecessidadesNutr{
}
class
TipoCardapio
{
//
getConjunto(){return this._conjunto;}
//
setConjunto(_conjunto){this._conjunto=_conjunto;}
getConjunto
(){
return
this
.
_conjunto
;}
setConjunto
(
_conjunto
){
this
.
_conjunto
=
_conjunto
;}
getPrecoRef
(){
return
this
.
_precoRef
}
setPrecoRef
(
_precoRef
){
this
.
_precoRef
=
_precoRef
;}
...
...
@@ -93,8 +93,9 @@ class TipoCardapio{
getPrecoTotal
(){
return
this
.
_precoTotal
}
setPrecoTotal
(
_precoTotal
){
this
.
_precoTotal
=
_precoTotal
;}
constructor
(
precoRef
,
precoTotal
)
constructor
(
conjunto
,
precoRef
,
precoTotal
)
{
this
.
setConjunto
(
conjunto
);
this
.
setPrecoRef
(
precoRef
);
this
.
setPrecoTotal
(
precoTotal
);
}
...
...
@@ -189,6 +190,7 @@ function atualizaEmpresas(){
<input
type=
hidden
id=
"cardapioEmpresa_id"
>
<tr><td>
Preço refeição:
</td><td><input
type=
text
id=
"cardapioEmpresa_precoInd"
></td></tr>
<tr><td>
Preço total:
</td><td><input
type=
text
id=
"cardapioEmpresa_precoTotal"
></td></tr>
<tr><td
id=
"checkBoxesCardapios"
></td></tr>
<tr><td
colspan=
2
><center><button
id=
"editaCardapioEmpresa"
>
Salvar
</button>
<button
class=
"cancelaEditaEmpresa"
>
Cancelar
</button></center></td>
</tr>
</table>
</div>
...
...
@@ -281,11 +283,26 @@ function alertCardapioEmpresa(e){
$
(
"
#cardapioEmpresa_id
"
).
val
(
e
);
if
(
dados
.
getTiposCardapios
())
{
console
.
log
(
dados
.
getTiposCardapios
().
getPrecoRef
());
console
.
log
(
dados
.
getTiposCardapios
().
getPrecoTotal
());
$
(
"
#cardapioEmpresa_precoInd
"
).
val
(
dados
.
getTiposCardapios
().
getPrecoRef
());
$
(
"
#cardapioEmpresa_precoTotal
"
).
val
(
dados
.
getTiposCardapios
().
getPrecoTotal
());
}
htmlCheckBoxes
=
"
<ul>
"
;
conjuntos
=
[];
if
(
dados
.
getTiposCardapios
())
{
conjuntos
=
dados
.
getTiposCardapios
().
getConjunto
()
}
for
(
var
element
in
tiposDePreparo
){
if
(
conjuntos
[
element
])
{
htmlCheckBoxes
+=
"
<li> <input checked name=preparacao type=checkbox>
"
+
conjuntos
[
element
]
+
"
</li><br>
"
}
else
{
htmlCheckBoxes
+=
"
<li> <input name=preparacao type=checkbox>
"
+
tiposDePreparo
[
element
]
+
"
</li><br>
"
}
}
$
(
"
#checkBoxesCardapios
"
).
html
(
htmlCheckBoxes
+
"
</ul>
"
);
}
$
(
"
#editaDadosEmpresa
"
).
click
(
function
(){
...
...
@@ -324,7 +341,18 @@ $("#editaPublicoEmpresa").click( function(){
$
(
"
#editaCardapioEmpresa
"
).
click
(
function
(){
dados
=
ListaEmpresas
[
$
(
"
#cardapioEmpresa_id
"
).
val
()
];
dados
.
setTiposCardapios
(
new
TipoCardapio
(
$
(
"
#cardapioEmpresa_precoInd
"
).
val
(),
$
(
"
#cardapioEmpresa_precoTotal
"
).
val
())
);
tabelaPreparacao
=
[]
checkBox
=
document
.
getElementsByName
(
"
preparacao
"
);
for
(
var
i
=
0
;
i
<
checkBox
.
length
;
i
++
){
if
(
checkBox
[
i
].
checked
)
{
tabelaPreparacao
.
push
(
tiposDePreparo
[
i
]);
//ou tabelas[element]
}
else
{
tabelaPreparacao
.
push
(
0
);
}
}
dados
.
setTiposCardapios
(
new
TipoCardapio
(
tabelaPreparacao
,
$
(
"
#cardapioEmpresa_precoInd
"
).
val
(),
$
(
"
#cardapioEmpresa_precoTotal
"
).
val
())
);
atualizaEmpresas
();
$
(
"
.ui-button
"
).
click
();
});
...
...
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