<%@ page language="java" %>
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Customer Register</title>
</head>
<body bgcolor="#FFFFFF">
<form method=POST action="customerRegister.jsp">
<%@ page import="JavaBeans.*"%>
<%@ page import="java.util.*"%>

<jsp:useBean id='customer_interface' scope='session' class='JavaBeans.Customer_Interface'/>

<jsp:useBean id='customer_data' scope='session' class='JavaBeans.Customer_Data'/>
<jsp:setProperty name='customer_data' property="*"/>

<jsp:useBean id='creditcard_data' scope='session' class='JavaBeans.CreditCard_Data'/>
<jsp:setProperty name='creditcard_data' property="*"/>

<jsp:useBean id='address_data' scope='session' class='JavaBeans.Address_Data'/>
<jsp:setProperty name='address_data' property="*"/>

<jsp:useBean id='coffeepreference_data' scope='session' class='JavaBeans.CoffeePreference_Data'/>
<jsp:setProperty name='coffeepreference_data' property="*"/>

<% if(request.getParameter("action").equals("Register Now")){
customer_interface.processRequest(request.getParameter("action"), customer_data, creditcard_data, address_data, coffeepreference_data);
}
%>
<table align="center" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td><p align="center"><img src="CoffeeBanner.gif"></p>
		</td>
	</tr>
	<tr>
	<td bgcolor=#F0F8FF><br><font face="Geneva, Arial, Helvetica, sans-serif"><p align="center"><font size="-1" face="Geneva, Arial, Helvetica, sans-serif">
		<p align="center"><font  size = "-1"><i>Use this page to register a new user</i></font></p>
		<br>
		</td>
	</tr>
	<tr><td>
		<table align="center" border="0" cellpadding="0" cellspacing="0" width=100%>
			<td width="30%" bgcolor=#D3D3D3>					
  					
  					<p align="center"><font size = "+1"><font face="Verdana"> Customer Details</font></p>
  					<table align = "left">
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">First Name: </td>
	  						<td align="left" > <input align = "center" type="text" size="20" name="firstName" maxlength="255" value=<%= customer_data.getFirstName() != null ? "'"+customer_data.getFirstName()+"'" : "" %>></td>
  						
							<!--% if(request.getParameter("action").equals("Register Now")){
								customer_data.setFirstName(request.getParameter("firstName"));
							  	customer_data.setLastName(request.getParameter("lastName"));
							 }
							 %-->	
						</tr>	
						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Last Name: </td></font>
	  						<td align="left" > <input align = "center" type="text" size="20" name="lastName" maxlength="50" value=<%= customer_data.getLastName() != null ? "'"+customer_data.getLastName()+"'" : "" %>></td>
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Phone Number: </td></font>
	  						<td align="left" > <input align = "center" type="text" size="20" name="phoneNumber" maxlength="30" value=<%= address_data.getPhoneNumber() != null ? "'"+address_data.getPhoneNumber()+"'" : "" %>></td>
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Email Address: </td></font>
	  						<td align="left" > <input align = "center" type="text" size="20" name="email" maxlength="384" value=<%= address_data.getEmail() != null ? "'"+address_data.getEmail()+"'" : "" %>></td>
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Username: </td></font>
	  						<td align="left" > <input align = "center" type="text" size="20" name="userName" maxlength="8" value=<%= customer_data.getUserName() != null ? "'"+customer_data.getUserName()+"'" : "" %>></td>
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Password: </td></font>
	  						<td align="left" > <input align = "center" type="password" size="20" name="password" maxlength="30" value=<%= customer_data.getPassword() != null ? "'"+customer_data.getPassword()+"'" : "" %>></td>
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Re Enter Password: </td></font>
	  						<td align="left" > <input align = "center" type="password" size="20" name="verifier" maxlength="30" value=<%= customer_data.getVerifier() != null ? "'"+customer_data.getVerifier()+"'" : "" %>></td>
  						</tr>						
					</table>
			</td>
			<td width = "30%"  bgcolor=#D3D3D3>
				<p align="center"><font size = "+1"><font face="Verdana"> Delivery Details</font></p>
				<table>
					
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Office Number: </td></font>
	  						<td align="left" > <input type="text" size="20" maxlength="40" name="office" value=<%= address_data.getOffice() != null ? "'"+address_data.getOffice()+"'" : "" %>></td>
  						</tr>
  						<tr>
  						<td align ="right"><font face="Verdana" size="-1">Floor: </td></font>
  						<td align="left" > <input type="text" size="20" name="floor" maxlength="40" value=<%= address_data.getFloor() != null ? "'"+address_data.getFloor()+"'" : "" %>></td>
  						</tr>
  						<tr>
  						<td align ="right"><font face="Verdana" size="-1">Building: </td></font>
  						<td align="left" > <input type="text" size="20" name="building" maxlength="40" value=<%= address_data.getBuilding() != null ? "'"+address_data.getBuilding()+"'" : "" %>></td>
  						</tr>
  						<tr>
  						<td align ="right"><font face="Verdana" size="-1">Street: </td></font>
  						<td align="left" > <input type="text" size="20" name="street" maxlength="40" value=<%= address_data.getStreet() != null ? "'"+address_data.getStreet()+"'" : "" %>></td>
  						</tr>
  						<tr>
  						<td align ="right"><font face="Verdana" size="-1">City: </td></font>
  						<td align="left" > <input type="text" size="20" name="city" maxlength="40" value=<%= address_data.getCity() != null ? "'"+address_data.getCity()+"'" : "" %>></td>
  						
  						</tr>
  					
  					</table>
  					<br><br><br>  				
				</td>				
			</table>
			<table bgcolor=#D3D3D3 width=100%>
				<td>
					<p align="center"><font size = "+1"><font face="Verdana"> Credit Card Details</font></p>
					<table align = "right" width=100%>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Card Holder's Name: </td></font>
	  						<td align="left" > <input type="text" size="20" name="cardHolderName" maxlength="120" value=<%= creditcard_data.getCardHolderName() != null ? "'"+creditcard_data.getCardHolderName()+"'" : "" %>></td>
  						
							<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Company: </td>
	  						<td align="left" > <select size="1" name="cardType" maxlength="50">
									<option>{Select Card type}</option>
									<option <% if(creditcard_data.getCardType()!=null){if(creditcard_data.getCardType().equals("Master Card")) out.print("selected");}%>>Master Card</option>
									<option <% if(creditcard_data.getCardType()!=null){if(creditcard_data.getCardType().equals("Visa")) out.print("selected");}%>>Visa</option>
									<option <% if(creditcard_data.getCardType()!=null){if(creditcard_data.getCardType().equals("American Express")) out.print("selected");}%>>American Express</option>
									</select>
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Number: </td></font>
	  						<td align="left" > <input type="text" name="cardNumber" size=16 maxlength="16" value=<%= creditcard_data.getCardNumber() != null ? "'"+creditcard_data.getCardNumber()+"'" : "" %>></td>
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Expiry Date: M: </td></font>
	  						<td align="left" ><select size="1" name="month" maxlength="2">
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("01")) out.print("selected");}%>>01</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("02")) out.print("selected");}%>>02</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("03")) out.print("selected");}%>>03</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("04")) out.print("selected");}%>>04</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("05")) out.print("selected");}%>>05</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("06")) out.print("selected");}%>>06</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("07")) out.print("selected");}%>>07</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("08")) out.print("selected");}%>>08</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("09")) out.print("selected");}%>>09</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("10")) out.print("selected");}%>>10</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("11")) out.print("selected");}%>>11</option>
						  <option <% if(creditcard_data.getMonth()!=null){if(creditcard_data.getMonth().equals("12")) out.print("selected");}%>>12</option>
						</select>Y: <select size="1" name="year">
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("03")) out.print("selected");}%>>03</option>
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("04")) out.print("selected");}%>>04</option>
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("05")) out.print("selected");}%>>05</option>
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("06")) out.print("selected");}%>>06</option>
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("07")) out.print("selected");}%>>07</option>
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("08")) out.print("selected");}%>>08</option>
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("09")) out.print("selected");}%>>09</option>
						  <option <% if(creditcard_data.getYear()!=null){if(creditcard_data.getYear().equals("10")) out.print("selected");}%>>10</option>
						</select><!--% if(request.getParameter("action").equals("Register")){
							creditcard_data.setExpirydate(request.getParameter("date") 
							+ request.getParameter("month") 
							+ request.getParameter("year"));
							}
							%--></td>						
  						</tr>
  						<tr>
	  						<td align ="right"><font face="Verdana" size="-1">Pre Billing Amount: </td></font>
	  						<td align="left" ><b>$</b> <input type="text" maxlength="3" name="preBillingAmount" size=16 value=<%= customer_data.getPreBillingAmount() != null ? "'"+customer_data.getPreBillingAmount()+"'" : "" %>></td>
  						</tr>  						
  					
  					</table> 
  				</td>				
				</table></td></tr>
	<tr>
		<td> 
		<table align="center" border="0" cellpadding="0" cellspacing="0" width=100%>
			<td width = "50%" bgcolor=#ADD8E6>					
  					<p align="center"><font size = "+1"><font face="Verdana">Coffee Preference</p>
  					<p align  ="center">  
					Flavour:<select size="1" name="description">
					      <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Caffe Latte - small $2.80")) out.print("selected");}%>>Caffe Latte - small $2.80</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Caffe Latte - medium $3.30")) out.print("selected");}%>>Caffe Latte - medium $3.30</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Caffe Latte - large $3.60")) out.print("selected");}%>>Caffe Latte - large $3.60</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Cappuccino - small $2.50")) out.print("selected");}%>>Cappuccino - small $2.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Cappuccino - medium $3.50")) out.print("selected");}%>>Cappuccino - medium $3.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Cappuccino - large $4.50")) out.print("selected");}%>>Cappuccino - large $4.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Espresso - small $2.50")) out.print("selected");}%>>Espresso - small $2.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Espresso - medium $3.50")) out.print("selected");}%>>Espresso - medium $3.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Espresso - large $4.50")) out.print("selected");}%>>Espresso - large $4.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Iced Cafe Latte - small $2.50")) out.print("selected");}%>>Iced Cafe Latte - small $2.50</option>
					  	  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Iced Cafe Latte - medium $3.50")) out.print("selected");}%>>Iced Cafe Latte - medium $3.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Iced Cafe Latte - large $4.50")) out.print("selected");}%>>Iced Cafe Latte - large $4.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Mocha - small $2.50")) out.print("selected");}%>>Mocha - small $2.50</option>
					  	  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Mocha - medium $3.50")) out.print("selected");}%>>Mocha - medium $3.50</option>
						  <option <% if(coffeepreference_data.getDescription()!=null){if(coffeepreference_data.getDescription().equals("Mocha - large $4.50")) out.print("selected");}%>>Mocha - large $4.50</option>
					</select>
					<font face="Verdana" size="-1">Quantity:<select size="1" name="quantity">
					  <option <% if(coffeepreference_data.getQuantity()!=null){if(coffeepreference_data.getQuantity().equals("1")) out.print("selected");}%>>1</option>
					  <option <% if(coffeepreference_data.getQuantity()!=null){if(coffeepreference_data.getQuantity().equals("2")) out.print("selected");}%>>2</option>
					  <option <% if(coffeepreference_data.getQuantity()!=null){if(coffeepreference_data.getQuantity().equals("3")) out.print("selected");}%>>3</option>
					  <option <% if(coffeepreference_data.getQuantity()!=null){if(coffeepreference_data.getQuantity().equals("4")) out.print("selected");}%>>4</option>
					  <option <% if(coffeepreference_data.getQuantity()!=null){if(coffeepreference_data.getQuantity().equals("5")) out.print("selected");}%>>5</option>
					</select>					
					<font face="Verdana" size="-1">Time coffee required: <select size="1" name="deliveryHour">
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("07")) out.print("selected");}%>>07</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("08")) out.print("selected");}%>>08</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("09")) out.print("selected");}%>>09</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("10")) out.print("selected");}%>>10</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("11")) out.print("selected");}%>>11</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("12")) out.print("selected");}%>>12</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("13")) out.print("selected");}%>>13</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("14")) out.print("selected");}%>>14</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("15")) out.print("selected");}%>>15</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("16")) out.print("selected");}%>>16</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("17")) out.print("selected");}%>>17</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("18")) out.print("selected");}%>>18</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("19")) out.print("selected");}%>>19</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("20")) out.print("selected");}%>>20</option>
					  <option <% if(coffeepreference_data.getDeliveryHour()!=null){if((coffeepreference_data.getDeliveryHour()).equals("21")) out.print("selected");}%>>21</option>
					</select><select size="1" name="deliveryMinute">
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("00")) out.print("selected");}%>>00</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("05")) out.print("selected");}%>>05</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("10")) out.print("selected");}%>>10</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("15")) out.print("selected");}%>>15</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("20")) out.print("selected");}%>>20</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("25")) out.print("selected");}%>>25</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("30")) out.print("selected");}%>>30</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("35")) out.print("selected");}%>>35</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("40")) out.print("selected");}%>>40</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("45")) out.print("selected");}%>>45</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("50")) out.print("selected");}%>>50</option>
					  <option <% if(coffeepreference_data.getDeliveryMinute()!=null){if((coffeepreference_data.getDeliveryMinute()).equals("55")) out.print("selected");}%>>55</option>
					</select></p>
					<br/>
					
					
						
					<p align="center"><font size="-1" face="Geneva, Arial, Helvetica, sans-serif" color = "FF0000">
						<b><% if(request.getParameter("action").equals("Register Now")){
						out.println( customer_interface.getMessage());
						}
						%></b>
						</font></p>
						
					<br>
				<tr><td bgcolor=#F0F8FF align = "center" >
					
					<input type="submit" value="Register Now" name="action">
					</form>
				</td></tr>	
				
						
				</td></table> </td></tr>				
				</form>	
				
				
				<tr>
					<td bgcolor=#F0F8FF align = "center">
						
						<form method=post action="coffeelogin.jsp">
							<input type="submit" value="Go to Login" name="action">
						</form>
						
					</td>
				</tr>
			</table>
		
		
</body>
</html>