<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk" %>
<%@ taglib prefix="g" uri="http://www.jenia.org/jsf/foogle" %>

<html>
<%@include file="/paginas/comum/head.jsp" %>
<body>
<f:view>
<%@include file="/paginas/comum/cabecalho.jsp" %>

<h1>Tela de Cadastro</h1>

<h:form id="formAnotarEndereco">

	<h:panelGrid columns="2">
		<h:outputLabel value="Telefone:*" for="telefone"/>
		<h:inputText id="telefone" value="#{enderecoControlador.endereco.telefone}" style="width: 150px"
			maxlength="9"
			onkeyup="validar(this, /^\d{4}-\d{4}$/)" onkeydown="validar(this, /^\d{4}-\d{4}$/)" required="true">
			<t:validateRegExpr pattern="^\d{4}-\d{4}$" message="O telefone deve estar no formato ####-####"/>
		</h:inputText>
		
		<h:outputLabel value="Rua:*" for="rua"/>
		<h:inputText id="rua" value="#{enderecoControlador.endereco.rua}" required="true" style="width: 300px"/>
		
		<h:outputLabel value="Número:*" for="numero"/>
		<h:inputText id="numero" value="#{enderecoControlador.endereco.numero}" style="width: 100px" 
			onkeyup="numeros(this)" onkeydown="numeros(this)" required="true" maxlength="8"/>

		<h:outputLabel value="Complemento:" for="complemento"/>
		<h:inputText id="complemento" value="#{enderecoControlador.endereco.complemento}"/>
		
		<h:outputLabel value="Bairro:" for="bairro"/>
		<h:inputText id="bairro" value="#{enderecoControlador.endereco.bairro}"/>
		
		<h:outputLabel value="CEP:" for="cep"/>
		<h:inputText id="cep" value="#{enderecoControlador.endereco.cep}" style="width: 100px"
			maxlength="9"
			onkeyup="validar(this, /^\d{5}-\d{3}$/)" onkeydown="validar(this, /^\d{5}-\d{3}$/)" >
			<t:validateRegExpr pattern="^\d{5}-\d{3}$" message="O CEP deve estar no formato #####-###"/>
		</h:inputText>

		<h:outputLabel value="Selecione a Forma de Pagamento:" for="formaPagamento"/>
		<h:selectOneRadio id="formaPagamentoDinheiro">
			<f:selectItem id="formaDinheiro" itemLabel="Dinheiro" itemValue="1"/>
			<f:selectItem id="formaCheque" itemLabel="Cheque" itemValue="2"/>
		</h:selectOneRadio>

		<h:commandButton id="enviarEndereco" value="Enviar Endereço"
			action="#{enderecoControlador.mostraEndereco}"/>
		<h:panelGroup/>

<br><br><br>
		
		<g:mapSearchControl 
centerPoint="Universidade de São Paulo, São Paulo, Brazil" 
width="100%" 
locationTitle="AgilPizza!!" 
locationUrl="http://www.agilcoop.org.br" 
key="ABQIAAAAEVsVhhGgXKtGuArQqvBWWBTcnsdPWkK1jdcAgmCvaTCLZ3eJnhT0XzyasjGpWHGNLV2FQkJwrIfbCA" />  
		
	</h:panelGrid>
	
</h:form>


</f:view>
<%@include file="/paginas/comum/rodape.jsp" %>
</body>
</html>