]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - web/finished.jsp
Added footer for admin area + error include file "direct_call.jsp"
[pizzaservice-war.git] / web / finished.jsp
index 2325e0d2171ad9ce29d4ce8192983223033213e8..26d3b050d7dc558882aa46e51c7421ef4a45aea7 100644 (file)
@@ -4,38 +4,40 @@
        Author     : Roland Haeder
 --%>
 
-<%@page errorPage="errorHandler.jsp" %>
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+
+<%@page import="java.lang.reflect.Field"%>
 <%@page import="java.util.Map"%>
 <%@page import="java.util.Iterator"%>
-<%@page import="org.mxchange.pizzaservice.product.Product"%>
-<%@page import="org.mxchange.pizzaservice.service.PizzaService"%>
-<%@page import="org.mxchange.pizzaservice.service.Service"%>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page import="org.mxchange.pizzaapplication.product.Product"%>
+
+<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
+<jsp:setProperty name="customer" property="*" />
 
 <%
-       // Init service instance
-       Service service = PizzaService.getInstance(application);
+       // Init application instance
+       PizzaApplication app = PizzaServiceApplication.getInstance(application);
 %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-               <title><%=PizzaService.MAIN_TITLE%> - Vielen Dank!</title>
+               <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
+               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</title>
        </head>
 
        <body>
-               <div id="title">
-                       <h1><%=PizzaService.MAIN_TITLE%> - Vielen Dank!</h1>
+               <div id="header"> 
+                       <div id="title">
+                               <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</h1>
+                       </div>
                </div>
 
-               <div id="menu">
-                       <ul>
-                               <li><a href="index.jsp" title="Eingangsseite">Home</a></li>
-                               <li><a href="order.jsp" title="Bestellseite">Bestellung</a></li>
-                               <li><a href="finished.jsp" title="Bestellung abgeschlossen">Vielen Dank</a></li>
-                               <li><a href="bye.jsp" title="Sitzung beennden">Sitzung beenden</a></li>
-                       </ul>
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
@@ -44,7 +46,7 @@
 
                        <div id="content">
                                <table class="table">
-                                       <thead class="table_header">
+                                       <thead>
                                                <tr>
                                                        <th class="table_header_column">
                                                                Bestellen?
                                                        </th>
                                                </tr>
                                        </thead>
-                                       <tbody class="table_body">
+                                       <tbody>
                                                <%
-                                               // Get iterator from products
-                                               Iterator<Map.Entry<String, Product>> iterator = service.getProductsIterator();
+                                               // Get Iterator
+                                               Iterator<Product> iterator = app.getAvailableProducts();
 
-                                               // Iterate over all
+                                               // "Walk" through all products and unmark them as ordered
                                                while (iterator.hasNext()) {
-                                                       // Get entry
-                                                       Map.Entry<String, Product> entry = iterator.next();
-
-                                                       // Get product
-                                                       Product product = entry.getValue();
-
-                                                       // Mark product as ordered
-                                                       service.markProductAsOrdered(product, session);
+                                                       // Get product instance
+                                                       Product product = iterator.next();
                                                        %>
                                                        <tr>
                                                                <td>
-                                                                       <%=service.getPrintableChoosenFromRequestSession(product, request, session)%>
+                                                                       <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
                                                                </td>
                                                                <td>
-                                                                       <%=service.handleAmountFromRequestSession(product, request, session)%>
+                                                                       <%=app.handleAmountFromRequestSession(product, request, session)%>
                                                                </td>
                                                                <td>
                                                                        <%=product.getTitle()%>
                                                                <td>
                                                                        <%=product.getPrice()%>
                                                                </td>
-                                                               <td>
-                                                                       <%=service.getTotalPositionPriceFromRequestSession(product, request, session)%>
+                                                               <td align="right">
+                                                                       <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
                                                                </td>
                                                        </tr>
                                                        <%
                                                }
-                                               float totalPrice = service.calculateTotalPrice(request, session);
                                                %>
                                                <tr>
                                                        <td id="table_total_amount_left">
                                                                Menge:
                                                        </td>
                                                        <td id="table_total_amount_right">
-                                                               <%=service.calculateTotalAmount(request, session)%>
+                                                               <%=app.calculateTotalAmount(request, session)%>
                                                        </td>
-                                                       <td class="spacer">
+                                                       <td>
                                                                &nbsp;
                                                        </td>
                                                        <td id="table_total_sum_left">
                                                                Gesamtpreis:
                                                        </td>
-                                                       <td id="table_total_sum_right">
-                                                               <%=totalPrice%>
+                                                       <td id="table_total_sum_right" align="right">
+                                                               <%=app.calculateTotalPrice(request, session)%>
+                                                       </td>
+                                               </tr>
+
+                                               <tr>
+                                                       <td colspan="5" class="table_header">
+                                                               Ihre Daten:
+                                                       </td>
+                                               </tr>
+
+                                               <tr>
+                                                       <td colspan="5" class="table_row">
+                                                               <%
+                                                               // Debug message
+                                                               app.getLogger().debug("customer=" + customer);
+
+                                                               // Get iterator on all fields/attributes
+                                                               Iterator<Map.Entry<Field, Object>> fieldIterator = customer.iterator();
+                                                               %>
+                                                               <ul>
+                                                               <%
+                                                               while (fieldIterator.hasNext()) {
+                                                                       Map.Entry<Field, Object> entry = fieldIterator.next();
+                                                                       %>
+                                                                       <li><%=entry.getKey().getName()%> set to: <%=entry.getValue()%></li>
+                                                                       <%
+                                                               }
+                                                               %>
+                                                               </ul>
                                                        </td>
                                                </tr>
 
                                                <tr>
                                                        <td colspan="5" class="table_footer">
                                                                <%
-                                                               if (("POST".equals(request.getMethod())) && (service.calculateTotalAmount(request, session) > 0)) {
+                                                               if (("POST".equals(request.getMethod())) && (app.calculateTotalAmount(request, session) > 0)) {
                                                                        out.print("Ihre Bestellung ist eingegangen.");
                                                                        synchronized(session) {
-                                                                               session.invalidate();
+                                                                               //session.invalidate();
+                                                                               out.print("<div>Zu Demo-Zwecken wird die Sitzung nicht gekillt. Bitte 'Bestellung' aufrufen, um zu gucken, dass die Daten da sind.</div>");
                                                                        }
                                                                } else {
                                                                        // Nothing ordered
                                </table>
                        </div>
                </div>
+
+               <jsp:include page="/static/footer.jsp" flush="true" />
        </body>
 </html>