Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
- <%
- Collection<?> addresses = (Collection<?>) request.getAttribute("addresses");
- Address address = (Address) request.getAttribute("address");
- %>
- <!DOCTYPE html>
- <html>
- <%@ page contentType="text/html; charset=UTF-8" import="java.util.*,com.GenerateShop.Model.Customer,com.GenerateShop.Control.AddressControl,com.GenerateShop.Model.Address"%>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Personal Area</title>
- <%@ include file="fragments/head.html" %>
- <script>
- var pathname = window.location.pathname;
- if(pathname=="/GenerateShop/PersonalArea.jsp")
- {
- window.location.href = "personalArea"
- }
- </script>
- </head>
- <body>
- <%@ include file="fragments/header.jsp"%>
- <div class="container">
- <%
- Customer sessione = (Customer) request.getSession().getAttribute("customer");
- if(sessione!=null)
- {
- if(sessione.getEmail()!=null)
- { %>
- <font color="green"> <h3> Benvenuto, <%=sessione.getFirstName()%> <%=sessione.getLastName()%>, nella tua Area Riservata. </h3> </font>
- <a href="catalog">Clicca qui per visualizzare il catalogo</a> <br>
- <div class="container">
- <h2>My Personal Area</h2>
- <div class="panel-group" id="accordion">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse1">My personal Information</a>
- </h4>
- </div>
- <div id="collapse1" class="panel-collapse collapse">
- <div class="panel-body">
- <div class="form-group">
- <label>Email:</label>
- <input type="text" value="<%=sessione.getEmail()%>" class="form-control" disabled>
- </div>
- <div class="form-group">
- <label>First Name</label>
- <input type="text" value="<%=sessione.getFirstName()%>" class="form-control" disabled>
- </div>
- <div class="form-group">
- <label>Last Name:</label>
- <input type="text" value="<%=sessione.getLastName()%>" class="form-control" disabled>
- </div>
- <div class="form-group">
- <label>Birthdate:</label>
- <input type="text" value="<%=sessione.getBirthdate()%>" class="form-control" disabled>
- </div>
- <div class="form-group">
- <label>Phone Number:</label>
- <input type="text" value="<%=sessione.getPhoneNumber()%>" class="form-control" disabled>
- </div>
- </div>
- </div>
- </div>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">View Address</a>
- </h4>
- </div>
- <div id="collapse2" class="panel-collapse collapse in">
- <div class="panel-body">
- <%
- if (addresses != null && addresses.size() != 0) {
- Iterator<?> it = addresses.iterator();
- while (it.hasNext()) {
- Address adr = (Address) it.next();
- %>
- <%=adr.getStreet()%>,
- <%=adr.getPostalCode()%>
- <%=adr.getCity()%>
- (<%=adr.getProvince()%>)
- <%=adr.getCountry()%>
- <a href="personalArea?action=read&id=<%=adr.getId()%>"> <span class="glyphicon glyphicon-edit"></span> </a>
- <a href="personalArea?action=delete&id=<%=adr.getId()%>"> <span class="glyphicon glyphicon-trash"></span> </a> <br>
- <%
- }
- } else {
- %>
- No addresses available
- <%
- }
- %>
- <%
- if (address != null) {
- %>
- <h2>Modify</h2>
- <form name='all_forms' action="personalArea" onSubmit="return formValidation()" method="post" class="form-inline">
- <input type="hidden" name="action" value="modify">
- <input name="id" type="hidden" value="<%=address.getId()%>">
- <div class="form-group">
- <label>Street:</label> <span id="error1_1"> </span>
- <input name="street" type="text" maxlength="128" value="<%=address.getStreet()%>" class="form-control">
- </div>
- <div class="form-group">
- <label>City:</label> <span id="error1_2"> </span>
- <input name="city" type="text" maxlength="64" value="<%=address.getCity()%>" class="form-control">
- </div>
- <div class="form-group">
- <label>Postal Code:</label> <span id="error1_3"> </span>
- <input name="postalCode" type="text" maxlength="16" value="<%=address.getPostalCode()%>" class="form-control">
- </div>
- <div class="form-group">
- <label>Province:</label> <span id="error1_4"> </span>
- <input name="province" type="text" maxlength="16" value="<%=address.getProvince()%>" class="form-control">
- </div>
- <div class="form-group">
- <label>Country:</label> <span id="error1_5"> </span>
- <input name="country" type="text" maxlength="32" value="<%=address.getCountry()%>" class="form-control">
- </div>
- <button type="submit" class="btn btn-danger" >Modify</button>
- </form>
- <%
- }
- %>
- </div>
- </div>
- </div>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">Insert Address</a>
- </h4>
- </div>
- <div id="collapse3" class="panel-collapse collapse in">
- <div class="panel-body">
- <form name='all_forms' action="personalArea" onSubmit="return formValidation()" method="post">
- <input type="hidden" name="action" value="insert_address">
- <div class="form-group">
- <label for="street">Street:</label> <span id="error1"> </span>
- <input name="street" type="text" maxlength="128" placeholder="enter street" class="form-control">
- </div>
- <div class="form-group">
- <label for="city">City:</label> <span id="error2"> </span>
- <input name="city" type="text" maxlength="64" placeholder="enter city" class="form-control">
- </div>
- <div class="form-group">
- <label for="postalCode">Postal Code:</label> <span id="error3"> </span>
- <input name="postalCode" type="text" maxlength="16" placeholder="enter Postal Code" class="form-control">
- </div>
- <div class="form-group">
- <label for="province">Province:</label> <span id="error4"> </span>
- <input name="province" type="text" maxlength="16" placeholder="enter province" class="form-control">
- </div>
- <div class="form-group">
- <label for="country">Country:</label> <span id="error5"> </span>
- <input name="country" type="text" maxlength="32" placeholder="enter country" class="form-control">
- </div>
- <button type="submit" class="btn btn-success" >Insert</button>
- </form>
- </div>
- </div>
- </div>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">My order</a>
- </h4>
- </div>
- <div id="collapse4" class="panel-collapse collapse">
- <div class="panel-body">
- No orders.
- </div>
- </div>
- </div>
- </div>
- </div>
- <% }
- }
- else
- {
- %>
- <font color="red"> <h3> Accesso all'area riservata negato. Se sei registrato effettua il login altrimenti registrati. <br>
- Redirect fra <span id="secondi"> </span> secondi. </h3> </font>
- <script>
- // Redirect dopo 3 secondi
- setTimeout(function() {
- window.location.href = "index.jsp";
- }, 3000);
- </script>
- <script language="JavaScript" type="text/JavaScript" src="js/countdown.js"></script>
- <%
- }
- %>
- </div>
- <%@ include file="fragments/footer.jsp" %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement