<%@ 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" %>

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


<h:form id="formAnotarEndereco">

   <br/>    
       <h2>Dados do Cliente</h2>
   <br/>

	<h:panelGrid columns="2">
	
		<h:outputLabel value="*Nome:" for="nome"/>
		<h:inputText id="nome" value="#{enderecoControlador.nome}" required="true" style="width: 300px"/>
		
		<h:outputLabel value="*Telefone:" for="telefone"/>
		<h:inputText id="telefone" value="#{enderecoControlador.telefone}" required="true" style="width: 300px"
			maxlength="9" 
			onkeyup="validar(this, /^\d{4}-\d{4}$/)" onkeydown="validar(this, /^\d{4}-\d{4}$/)" >
			<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.rua}" required="true" style="width: 300px"/>
		
		<h:outputLabel value="*Número:" for="numero"/>
		<h:inputText id="numero" value="#{enderecoControlador.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.complemento}"/>
		
		<h:outputLabel value=" Ponto de referência:" for="referencia"/>
		<h:inputText id="referencia" value="#{enderecoControlador.referencia}"/>
		
		<h:outputLabel value=" Bairro:" for="bairro"/>
		<h:inputText id="bairro" value="#{enderecoControlador.bairro}"/>
		
		<h:outputLabel value=" CEP:" for="cep"/>
		<h:inputText id="cep" value="#{enderecoControlador.cep}" style="width: 100px"
			maxlength="10"
			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="*Forma de pagamento:" for="pagamento"/>
	
		<h:selectOneMenu id="pagamento" value="#{enderecoControlador.pagamento}" title="Forma de pagamento:">
  			<f:selectItem id="si1" itemLabel="Dinheiro" itemValue="Dinheiro" />
  			<f:selectItem id="si2" itemLabel="Cheque" itemValue="Cheque" />
        </h:selectOneMenu>
   
        <br/>
   
		<h:commandButton id="enviarEndereco" value="Cadastrar Endereço"
			action="#{enderecoControlador.gravaEndereco}"/>
		<h:panelGroup/>
	</h:panelGrid>
	
</h:form>


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