From 72073a4311a591c7028e793ef05dfaa63b9920aa Mon Sep 17 00:00:00 2001 From: mc16 <mc16> Date: Thu, 23 Mar 2017 10:46:51 -0300 Subject: [PATCH] =?UTF-8?q?Cadastro=20de=20mais=20de=20um=20card=C3=A1pio?= =?UTF-8?q?=20por=20empresa=20e=20princ=C3=ADpio=20de=20edi=C3=A7=C3=A3o?= =?UTF-8?q?=20dos=20existentes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prototipo.html | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/prototipo.html b/prototipo.html index 10e39f4..ea688dc 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(){ -- GitLab