Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
nutricao
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PET Computação
nutricao
Commits
4776d4e6
Commit
4776d4e6
authored
Mar 23, 2017
by
mc16
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Opção de adicionar mais de um cardapio
parent
7155ab73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
62 deletions
+101
-62
prototipo.html
prototipo.html
+101
-62
No files found.
prototipo.html
View file @
4776d4e6
...
...
@@ -19,7 +19,7 @@
<script
language=
"JavaScript"
>
tiposDePreparo
=
[
"
Salada1
"
,
"
Salada2
"
,
"
Prato
p
rincipal
"
,
"
Acompanhamento
"
,
"
Bebida
"
,
"
Sobremesa
"
];
tiposDePreparo
=
[
"
Salada1
"
,
"
Salada2
"
,
"
Prato
P
rincipal
"
,
"
Acompanhamento
"
,
"
Bebida
"
,
"
Sobremesa
"
];
tabelas
=
[
"
PNAE
"
,
"
PAT
"
,
"
DRIs
"
];
...
...
@@ -87,38 +87,42 @@ class TipoCardapio{
getConjunto
(){
return
this
.
_conjunto
;}
setConjunto
(
_conjunto
){
this
.
_conjunto
=
_conjunto
;}
getNome
(){
return
this
.
_nome
;}
setNome
(
_nome
){
this
.
_nome
=
_nome
;}
getPrecoRef
(){
return
this
.
_precoRef
}
setPrecoRef
(
_precoRef
){
this
.
_precoRef
=
_precoRef
;}
getPrecoTotal
(){
return
this
.
_precoTotal
}
setPrecoTotal
(
_precoTotal
){
this
.
_precoTotal
=
_precoTotal
;}
constructor
(
conjunto
,
precoRef
,
precoTotal
)
constructor
(
conjunto
,
precoRef
,
precoTotal
,
nome
)
{
this
.
setConjunto
(
conjunto
);
this
.
setPrecoRef
(
precoRef
);
this
.
setPrecoTotal
(
precoTotal
);
this
.
setNome
(
nome
);
}
}
class
Empresa
{
getDados
(){
return
this
.
_dados
}
setDados
(
_cnpj
)
{
this
.
_dados
=
_cnpj
;}
getDados
(){
return
this
.
_dados
}
setDados
(
_cnpj
)
{
this
.
_dados
=
_cnpj
;}
getMediaRef
(){
return
this
.
_mediaRef
}
setMediaRef
(
_mediaRef
)
{
this
.
_mediaRef
=
_mediaRef
;}
getMediaRef
(){
return
this
.
_mediaRef
}
setMediaRef
(
_mediaRef
)
{
this
.
_mediaRef
=
_mediaRef
;}
getNecessidadesNutr
(){
return
this
.
_necessidadesNutr
}
setNecessidadesNutr
(
_necessidadesNutr
)
{
this
.
_necessidadesNutr
=
_necessidadesNutr
;}
getNecessidadesNutr
(){
return
this
.
_necessidadesNutr
}
setNecessidadesNutr
(
_necessidadesNutr
)
{
this
.
_necessidadesNutr
=
_necessidadesNutr
;}
getTiposCardapios
(){
return
this
.
_tiposCardapios
;}
setTiposCardapios
(
_tiposCardapios
){
this
.
_tiposCardapios
=
_tiposCardapios
;}
getTiposCardapios
(){
return
this
.
_tiposCardapios
;}
setTiposCardapios
(
_tiposCardapios
){
this
.
_tiposCardapios
=
_tiposCardapios
;}
constructor
(
nome
,
cnpj
,
telefone
,
responsavel
){
this
.
setDados
(
new
DadosEmpresa
(
nome
,
cnpj
,
telefone
,
responsavel
))
}
constructor
(
nome
,
cnpj
,
telefone
,
responsavel
){
this
.
setDados
(
new
DadosEmpresa
(
nome
,
cnpj
,
telefone
,
responsavel
))
}
}
ListaEmpresas
=
[]
...
...
@@ -190,7 +194,8 @@ 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=
"adicionaCardapioEmpresa"
>
Adicionar Cardápio
</button>
</center></td>
</tr>
<tr><td
colspan=
2
id=
"checkBoxesCardapios"
></td></tr>
<tr><td
colspan=
2
><center><button
id=
"editaCardapioEmpresa"
>
Salvar
</button>
<button
class=
"cancelaEditaEmpresa"
>
Cancelar
</button></center></td>
</tr>
</table>
</div>
...
...
@@ -231,7 +236,6 @@ $(".cancelaEditaEmpresa").click( function(){
function
alertDadosEmpresa
(
e
){
dados
=
ListaEmpresas
[
e
].
getDados
();
//alert(dados.getNome()+"\n"+dados.getCNPJ()+"\n"+dados.getResponsavel()+"\n"+dados.getTelefone())
$
(
"
#dadosEmpresa
"
).
dialog
();
$
(
"
#dadosEmpresa_id
"
).
val
(
e
);
$
(
"
#dadosEmpresa_nome
"
).
val
(
dados
.
getNome
());
...
...
@@ -259,25 +263,44 @@ function alertPublicoEmpresa(e){
}
htmlCheckBoxes
=
"
<ul>
"
;
tabs
=
[]
;
igual
=
0
;
if
(
dados
.
getNecessidadesNutr
())
{
tabs
=
dados
.
getNecessidadesNutr
().
getTabelas
()
for
(
var
element
in
tabelas
)
{
for
(
var
e
in
tabs
)
{
if
(
tabs
[
e
]
==
tabelas
[
element
])
{
igual
=
1
;
}
}
if
(
igual
)
{
htmlCheckBoxes
+=
"
<li> <input checked id =
"
+
tabelas
[
element
]
+
"
type=checkbox>
"
+
tabelas
[
element
]
+
"
</li><br>
"
}
else
{
htmlCheckBoxes
+=
"
<li> <input id =
"
+
tabelas
[
element
]
+
"
type=checkbox>
"
+
tabelas
[
element
]
+
"
</li><br>
"
}
igual
=
0
;
}
}
for
(
var
element
in
tabelas
){
if
(
tabs
[
element
])
{
htmlCheckBoxes
+=
"
<li> <input checked name=item type=checkbox>
"
+
tabs
[
element
]
+
"
</li><br>
"
}
else
{
htmlCheckBoxes
+=
"
<li> <input name=item type=checkbox>
"
+
tabelas
[
element
]
+
"
</li><br>
"
}
}
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
){
numero
=
0
;
dados
=
ListaEmpresas
[
e
];
$
(
"
#cardapioEmpresa
"
).
dialog
();
$
(
"
#cardapioEmpresa_id
"
).
val
(
e
);
...
...
@@ -286,25 +309,35 @@ function alertCardapioEmpresa(e){
$
(
"
#cardapioEmpresa_precoInd
"
).
val
(
dados
.
getTiposCardapios
().
getPrecoRef
());
$
(
"
#cardapioEmpresa_precoTotal
"
).
val
(
dados
.
getTiposCardapios
().
getPrecoTotal
());
}
htmlCheckBoxes
=
"
<ul>
"
;
conjuntos
=
[];
htmlCheckBoxes
=
"
<tr><td>
"
;
if
(
dados
.
getTiposCardapios
())
{
tabs
=
dados
.
getTiposCardapios
().
getConjunto
()
for
(
var
e
in
tabs
)
{
aux
=
tabs
[
e
]
for
(
var
element
in
aux
)
{
htmlCheckBoxes
+=
"
<input id =
\"
"
+
aux
[
element
]
+
"
\"
checked type=checkbox>
"
+
aux
[
element
]
+
"
</li>
"
}
htmlCheckBoxes
+=
"
<tr><td>
"
}
}
$
(
"
#checkBoxesCardapios
"
).
html
(
htmlCheckBoxes
);
}
$
(
"
#adicionaCardapioEmpresa
"
).
click
(
function
(){
numero
+=
1
;
htmlCheckBoxes
+=
"
<tr><td>
"
for
(
var
element
in
tiposDePreparo
)
{
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>
"
}
htmlCheckBoxes
+=
"
<input id =
\"
"
+
tiposDePreparo
[
element
]
+
numero
+
"
\"
type=checkbox>
"
+
tiposDePreparo
[
element
]
+
""
}
htmlCheckBoxes
+=
"
<tr><td>
"
$
(
"
#checkBoxesCardapios
"
).
html
(
htmlCheckBoxes
+
"
</ul>
"
);
}
});
$
(
"
#editaDadosEmpresa
"
).
click
(
function
(){
dados
=
ListaEmpresas
[
$
(
"
#dadosEmpresa_id
"
).
val
()
].
getDados
();
dados
.
setNome
(
$
(
"
#dadosEmpresa_nome
"
).
val
());
...
...
@@ -323,36 +356,42 @@ $("#editaPublicoEmpresa").click( function(){
$
(
"
#publicoEmpresa_janta
"
).
val
()
));
tabelasDados
=
[]
checkBox
=
document
.
getElementsByName
(
"
item
"
);
for
(
var
i
=
0
;
i
<
checkBox
.
length
;
i
++
){
if
(
checkBox
[
i
].
checked
)
{
tabelasDados
.
push
(
tabelas
[
i
]);
//ou tabelas[element]
}
else
{
tabelasDados
.
push
(
0
);
}
for
(
var
element
in
tabelas
)
{
checkBox
=
document
.
getElementById
(
tabelas
[
element
]
);
if
(
checkBox
.
checked
)
{
tabelasDados
.
push
(
tabelas
[
element
]);
}
}
dados
.
setNecessidadesNutr
(
new
NecessidadesNutr
(
tabelasDados
,
$
(
"
#publicoEmpresa_idades
"
).
val
())
);
atualizaEmpresas
();
atualizaEmpresas
();
$
(
"
.ui-button
"
).
click
();
});
$
(
"
#editaCardapioEmpresa
"
).
click
(
function
(){
dados
=
ListaEmpresas
[
$
(
"
#cardapioEmpresa_id
"
).
val
()
];
dados
=
ListaEmpresas
[
$
(
"
#cardapioEmpresa_id
"
).
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
);
}
for
(
var
element
in
tiposDePreparo
)
{
checkBox
=
document
.
getElementById
(
tiposDePreparo
[
element
]
+
numero
);
if
(
checkBox
.
checked
)
{
tabelaPreparacao
.
push
(
tiposDePreparo
[
element
]);
}
}
dados
.
setTiposCardapios
(
new
TipoCardapio
(
tabelaPreparacao
,
$
(
"
#cardapioEmpresa_precoInd
"
).
val
(),
$
(
"
#cardapioEmpresa_precoTotal
"
).
val
())
);
tabela
=
[]
if
(
dados
.
getTiposCardapios
())
{
tabela
=
dados
.
getTiposCardapios
().
getConjunto
()
tabela
.
push
(
tabelaPreparacao
);
dados
.
setTiposCardapios
(
new
TipoCardapio
(
tabela
,
$
(
"
#cardapioEmpresa_precoInd
"
).
val
(),
$
(
"
#cardapioEmpresa_precoTotal
"
).
val
())
);
}
else
{
tabela
.
push
(
tabelaPreparacao
)
dados
.
setTiposCardapios
(
new
TipoCardapio
(
tabela
,
$
(
"
#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