diff --git a/prototipo.html b/prototipo.html index 10e39f4a2c18d40d236b45754ff3aa4e624b6255..ea688dccd4f7183b3aace1f5d052b60655b269b1 100644 --- a/prototipo.html +++ b/prototipo.html @@ -87,9 +87,6 @@ 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;} @@ -101,7 +98,6 @@ class TipoCardapio{ this.setConjunto(conjunto); this.setPrecoRef(precoRef); this.setPrecoTotal(precoTotal); - this.setNome(nome); } } @@ -150,7 +146,7 @@ function atualizaEmpresas(){ var str; for(var empresa in ListaEmpresas){ - str = "<tr>"; + str = "<tr>"; str += "<td>"+ListaEmpresas[empresa].getDados().getNome()+"</td>"; str += "<td> <button onClick=alertPublicoEmpresa("+empresa+");>Ver mais dados</button></td>"; str += "<td> <button onClick=alertCardapioEmpresa("+empresa+");>Ver mais dados</button></td>"; @@ -195,7 +191,19 @@ function atualizaEmpresas(){ <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 colspan=2><center><button id="adicionaCardapioEmpresa">Adicionar Cardápio</button> </center></td> </tr> - <tr><td colspan=2 id="checkBoxesCardapios"></td></tr> + <table> + + <thead> + <tr> + <td> Nome </td> + <td> Ingredientes</td> + <td> Ações </td> + </tr> + </thead> + <tbody id ="tcardapio"> + + </tbody> + </table> <tr><td colspan=2><center><button id="editaCardapioEmpresa">Salvar</button> <button class="cancelaEditaEmpresa">Cancelar</button></center></td> </tr> </table> </div> @@ -309,33 +317,36 @@ function alertCardapioEmpresa(e){ $("#cardapioEmpresa_precoInd").val(dados.getTiposCardapios().getPrecoRef()); $("#cardapioEmpresa_precoTotal").val(dados.getTiposCardapios().getPrecoTotal()); } - htmlCheckBoxes = "<tr><td>"; + document.getElementById("tcardapio").innerHTML = ""; + var colunas="<td><td>"; if(dados.getTiposCardapios()) { tabs = dados.getTiposCardapios().getConjunto() for(var e in tabs) { aux = tabs[e] + colunas += "<tr><td></td><td>" for(var element in aux) { - htmlCheckBoxes+="<input id = \""+aux[element]+ "\" checked type=checkbox>"+aux[element]+" </li>" + colunas+=aux[element] + " " } - htmlCheckBoxes+= "<tr><td>" + colunas+= "</td></tr>" } } - $("#checkBoxesCardapios").html(htmlCheckBoxes); + document.getElementById("tcardapio").innerHTML += colunas; } + $("#adicionaCardapioEmpresa").click(function(){ numero+=1; - htmlCheckBoxes+= "<tr><td>" + var colunas = "<tr><td> <input type=text id = nomeCardapio></td><td>"; for(var element in tiposDePreparo) { - htmlCheckBoxes+="<input id = \""+tiposDePreparo[element]+numero+ "\"type=checkbox>"+tiposDePreparo[element]+"" + colunas+="<input id = \""+tiposDePreparo[element]+numero+ "\"type=checkbox>"+tiposDePreparo[element]+"" } - htmlCheckBoxes+= "<tr><td>" - $("#checkBoxesCardapios").html(htmlCheckBoxes+"</ul>"); + colunas += "</td></tr>" + document.getElementById("tcardapio").innerHTML += colunas; }); $("#editaDadosEmpresa").click( function(){