Skip to content
Snippets Groups Projects
Commit 9b34cd7b authored by mc16's avatar mc16
Browse files

Quase editando

parent 27302ee2
No related branches found
No related tags found
No related merge requests found
...@@ -197,6 +197,16 @@ function atualizaEmpresas(){ ...@@ -197,6 +197,16 @@ function atualizaEmpresas(){
</table> </table>
</div> </div>
<div id="conjuntoEmpresa" title="Cardápio empresa" style="display:none">
<table>
<input type=hidden id="dadosEmpresa_id">
<input type=hidden id="conjuntoEmpresa_id">
<tr><td>Nome: </td> <td><input type=text id="conjuntoEmpresa_nome"></td></tr>
<tr><td id="checkBoxesConjunto"></td></tr>
<tr><td colspan=2><center><button id="editaConjuntoEmpresa">Salvar</button> <button class="cancelaEditaEmpresa">Cancelar</button></center></td> </tr>
</table>
</div>
<div id="cardapioEmpresa" title="Cardapio da empresa" style="display:none"> <div id="cardapioEmpresa" title="Cardapio da empresa" style="display:none">
<table> <table>
<input type=hidden id="cardapioEmpresa_id"> <input type=hidden id="cardapioEmpresa_id">
...@@ -331,14 +341,17 @@ function alertCardapioEmpresa(e){ ...@@ -331,14 +341,17 @@ function alertCardapioEmpresa(e){
$("#cardapioEmpresa_precoTotal").val(dados.getTiposCardapios().getPrecoTotal()); $("#cardapioEmpresa_precoTotal").val(dados.getTiposCardapios().getPrecoTotal());
tabs = dados.getConjunto() tabs = dados.getConjunto()
colunas=""; colunas="";
for(var e in tabs) for(var object in tabs)
{ {
colunas += "<tr><td>"+tabs[e].getNome()+"</td><td>" colunas += "<tr><td>"+tabs[object].getNome()+"</td><td>"
aux = tabs[e].getCombinacao(); aux = tabs[object].getCombinacao();
for(var element in aux) for(var element in aux)
{ {
colunas+=aux[element] + " " colunas+=aux[element] + " "
} }
conjuntos=[];
colunas+="</td><td><button onClick=alertConjuntoEmpresa("+object+");>Editar</button></td>"
colunas+= "</td></tr>" colunas+= "</td></tr>"
} }
...@@ -347,6 +360,51 @@ function alertCardapioEmpresa(e){ ...@@ -347,6 +360,51 @@ function alertCardapioEmpresa(e){
document.getElementById("tcardapio").innerHTML += colunas; document.getElementById("tcardapio").innerHTML += colunas;
} }
function alertConjuntoEmpresa(object){
/*console.log(object);
dados = ListaEmpresas[object[0]];
conjuntos = dados.getConjunto()
e = object[1];
for(var element in conjuntos)
{
if(element == e)
{
conjunto = conjuntos[element];
}
}
$("#conjuntoEmpresa").dialog();
$("#dadosEmpresa_id").val(e);
$("#conjuntoEmpresa_id").val(object);
$("#conjuntoEmpresa_nome").val( conjunto.getNome() );
htmlCheckBoxes = "<ul>";
igual =0;
tabs = conjunto.getCombinacao();
for(var element in tiposDePreparo)
{
for (var e in tabs)
{
if(tabs[e] == tiposDePreparo[element])
{
igual = 1;
}
}
if(igual)
{
htmlCheckBoxes+="<li> <input checked id = "+tiposDePreparo[element]+ " type=checkbox>"+tiposDePreparo[element]+" </li><br>"
}
else
{
htmlCheckBoxes+="<li> <input id = "+tiposDePreparo[element]+ " type=checkbox>"+tiposDePreparo[element]+" </li><br>"
}
igual =0;
}
$("#checkBoxesConjunto").html(htmlCheckBoxes+"</ul>");*/
}
$("#adicionaCardapioEmpresa").click(function(){ $("#adicionaCardapioEmpresa").click(function(){
var colunas = "<tr><td> <input type=text id = nomeCardapio></td><td>"; var colunas = "<tr><td> <input type=text id = nomeCardapio></td><td>";
for(var element in tiposDePreparo) for(var element in tiposDePreparo)
...@@ -367,6 +425,33 @@ $("#editaDadosEmpresa").click( function(){ ...@@ -367,6 +425,33 @@ $("#editaDadosEmpresa").click( function(){
$(".ui-button").click(); $(".ui-button").click();
}); });
$("#editaConjuntoEmpresa").click( function(){
dados = ListaEmpresas[ $("#dadosEmpresa_id").val() ].getDados();
conjuntos = dados.getConjunto()
for(var element in conjuntos)
{
if(element == e)
{
conjunto = conjuntos[element];
}
}
conjunto.setNome($("#conjuntoEmpresa_nome").val());
tabelaPreparacao=[]
for(var element in tiposDePreparo)
{
checkBox = document.getElementById( tiposDePreparo[element]);
if(checkBox.checked)
{
tabelaPreparacao.push(tiposDePreparo[element]);
}
}
conjunto.setCombinacao(tabelaPreparacao);
atualizaEmpresas();
$(".ui-button").click();
});
$("#editaPublicoEmpresa").click( function(){ $("#editaPublicoEmpresa").click( function(){
dados = ListaEmpresas[ $("#publicoEmpresa_id").val() ]; dados = ListaEmpresas[ $("#publicoEmpresa_id").val() ];
dados.setMediaRef( new MediaRef( dados.setMediaRef( new MediaRef(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment