Skip to content
Snippets Groups Projects
Commit e5d112dd authored by mmc16's avatar mmc16
Browse files

Prototipo com insercoes de dados da empresa

parents
Branches
No related tags found
No related merge requests found
<html>
<head>
<meta charset="utf-8">
<style>
td{outline-style:solid; outline-width : 2px;
}
center{padding:2px;}
</style>
<script language="JavaScript">
tiposDePreparo = ["Salada1","Salada2","Prato principal","Acompanhamento","Bebida","Sobremesa"];
class DadosEmpresa
{
getCNPJ(){ return this._cnpj}
setCNPJ(_cnpj) {this._cnpj = _cnpj;}
getNome(){ return this._nome}
setNome(_nome) {this._nome = _nome;}
getTelefone(){ return this._telefone}
setTelefone(_telefone) {this._telefone = _telefone;}
getResponsavel(){ return this._responsavel}
setResponsavel(_responsavel) {this._responsavel = _responsavel;}
constructor(nome,cnpj,telefone,responsavel){
this.setCNPJ(cnpj);
this.setNome(nome);
this.setTelefone(telefone);
this.setResponsavel(responsavel);
}
}
class MediaRef{
getCafe(){ return this._cafe}
setCafe(_responsavel) {this._cafe = _cafe;}
getAlmoco(){ return this._almoco}
setAlmoco(_almoco) {this._almoco = _almoco;}
getJanta(){ return this._janta}
setJanta(_janta) {this._janta = _janta;}
}
class NecessidadesNutr{
getPat(){ return this._pat}
setPat(_pat) {this._pat = _pat;}
getPnae(){ return this._pnae}
setPnae(_pnae) {this._pnae = _pnae;}
getDris(){ return this._dris}
setDris(_dris) {this._dris = _dris;}
getOutros(){ return this._outros}
setOutros(_outros) {this._outros = _outros;}
getIdades(){ return this._idades}
setIdades(_idades) {this._idades = _idades;}
}
class TipoCardapio{
getConjunto(){return this._conjunto;}
setConjunto(_conjunto){this._conjunto=_conjunto;}
getPrecoRef(){return this._precoRef}
setPrecoRef(_precoRef){this._precoRef = this._precoRef}
getPrecoTotal(){return this._precoTotal}
setPrecoTotal(_precoTotal){this._precoTotal = this._precoTotal}
}
class Empresa{
getDados(){ return this._dados}
setDados(_cnpj) {this._dados = _cnpj;}
getMediaRef(){ return this._mediaRef}
setMediaRef(_mediaRef) {this._mediaRef = _mediaRef;}
getNecessidadesNutr(){ return this._necessidadesNutr}
setNecessidadesNutr(_necessidadesNutr) {this._necessidadesNutr = _necessidadesNutr;}
getTiposCardapios(){return this._tiposCardapios;}
setTiposCardapios(_tiposCardapios){this._tiposCardapios = _tiposCardapios;}
constructor(nome,cnpj,telefone,responsavel){
this.setDados(new DadosEmpresa(nome,cnpj,telefone,responsavel))
}
}
ListaEmpresas = []
function cadastraEmpresa(){
ListaEmpresas.push(
new Empresa(
document.getElementById("nomeEmpresa").value,
document.getElementById("cnpj").value,
document.getElementById("telefone").value,
document.getElementById("responsavel").value
)
);
atualizaEmpresas();
}
function alertDadosEmpresa(e){
dados = ListaEmpresas[e].getDados();
alert(dados.getNome()+"\n"+dados.getCNPJ()+"\n"+dados.getResponsavel()+"\n"+dados.getTelefone())
}
function atualizaEmpresas(){
document.getElementById("tbody").innerHTML = "";
var str;
for(var empresa in ListaEmpresas){
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>";
document.getElementById("tbody").innerHTML+=str+"</tr>";
}
}
throw 1
</script>
</head>
</body>
<table><tr>
<td><input type=text id="nomeEmpresa" placeholder="Nome"></td>
<td><input type=text id="cnpj" placeholder="CNPJ"></td>
<td><input type=text id="telefone" placeholder="Telefone"></td>
<td><input type=text id="responsavel" placeholder="Responsável"></td>
<td><button onClick=cadastraEmpresa();>Cadastrar Empresa</button></td>
</tr></table>
<table>
<thead>
<tr>
<td> Dados da empresa </td>
<td> Publico alvo/clientes</td>
<td> Características do cardápio</td>
<td>Ações</td>
</tr>
</thead>
<tbody id ="tbody">
</tbody>
</table>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment