From c8c7e19993d81e5c9f191dbc53627b222588e5be Mon Sep 17 00:00:00 2001 From: mc16 <mc16> Date: Thu, 16 Mar 2017 09:06:34 -0300 Subject: [PATCH] Janelinha com jQuery --- prototipo.html | 72 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/prototipo.html b/prototipo.html index 0880cd2..4fdb80c 100644 --- a/prototipo.html +++ b/prototipo.html @@ -5,11 +5,13 @@ <style> td{outline-style:solid; outline-width : 2px; - } center{padding:2px;} </style> +<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> +<script src="http://code.jquery.com/jquery-1.9.1.js"></script> +<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script language="JavaScript"> @@ -48,14 +50,18 @@ class MediaRef{ getJanta(){ return this._janta} setJanta(_janta) {this._janta = _janta;} + + constructor(cafe,almoco,janta){ + this.setCafe(cafe); + this.setAlmoco(almoco); + this.setJanta(janta); + } } class NecessidadesNutr{ - - getPat(){ return this._pat} setPat(_pat) {this._pat = _pat;} @@ -71,6 +77,14 @@ class NecessidadesNutr{ getIdades(){ return this._idades} setIdades(_idades) {this._idades = _idades;} + constructor(pat,pnae,dris,outros,idades){ + this.setPat(pat); + this.setPnae(pnae); + this.setDris(dris); + this.setOutros(outros); + this.setIdades(idades); + } + } @@ -92,7 +106,7 @@ class Empresa{ getMediaRef(){ return this._mediaRef} setMediaRef(_mediaRef) {this._mediaRef = _mediaRef;} - + getNecessidadesNutr(){ return this._necessidadesNutr} setNecessidadesNutr(_necessidadesNutr) {this._necessidadesNutr = _necessidadesNutr;} @@ -119,34 +133,65 @@ function cadastraEmpresa(){ atualizaEmpresas(); } + function alertDadosEmpresa(e){ dados = ListaEmpresas[e].getDados(); - alert(dados.getNome()+"\n"+dados.getCNPJ()+"\n"+dados.getResponsavel()+"\n"+dados.getTelefone()) + //alert(dados.getNome()+"\n"+dados.getCNPJ()+"\n"+dados.getResponsavel()+"\n"+dados.getTelefone()) + $(function (dados) { + $("#dadosEmpresa").dialog(); + }); +} +function alertMediaRef(e){ + dados = ListaEmpresas[e].getMediaRef(); + $(function (dados) { + $("#dadosMediaRef").dialog(); + }); } + function atualizaEmpresas(){ document.getElementById("tbody").innerHTML = ""; var str; - + for(var empresa in ListaEmpresas){ - str = "<tr>" + str = "<tr>"; str += "<td>"+ListaEmpresas[empresa].getDados().getNome()+"</td>"; str += "<td></td>"; str += "<td></td>"; // str += "<td></td>"; str += "<td><button onClick=alertDadosEmpresa("+empresa+");> Ver mais dados </button></td>"; - + str += "<td><button onClick=alertMediaRef("+empresa+");> Media Refeições </button></td>"; + + document.getElementById("tbody").innerHTML+=str+"</tr>"; } } -throw 1 </script> </head> </body> + + +<div id="dadosEmpresa" title="Dados da empresa" style="display:none"> + <table> + <tr> + <td><input type=text id="nomeEmpresaDialog"></td> + </tr> + </table> +</div> + + +<div id="dadosMediaRef" title="Média de refeições" style="display:none"> + <table> + <tr> + <td></td> + </tr> + </table> +</div> + <table><tr> <td><input type=text id="nomeEmpresa" placeholder="Nome"></td> <td><input type=text id="cnpj" placeholder="CNPJ"></td> @@ -157,15 +202,16 @@ throw 1 <table> <thead> - <tr> - <td> Dados da empresa </td> - <td> Publico alvo/clientes</td> + <tr> + <td> Dados da empresa </td> + <td> Publico alvo/clientes</td> <td> Características do cardápio</td> <td>Ações</td> + <td>Média</td> </tr> </thead> <tbody id ="tbody"> - + </tbody> </table> </body> -- GitLab