]> git.mxchange.org Git - pizzaservice-war.git/blob - web/finished.jsp
Continued with project:
[pizzaservice-war.git] / web / finished.jsp
1 <%-- 
2         Document   : finished
3         Created on : 04.08.2015, 10:55:47
4         Author     : Roland Haeder
5 --%>
6
7 <%--<%@page errorPage="errorHandler.jsp" %>--%>
8 <%@page contentType="text/html" pageEncoding="UTF-8"%>
9
10 <%@page import="java.lang.reflect.Field"%>
11 <%@page import="java.util.Map"%>
12 <%@page import="java.util.Iterator"%>
13 <%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
14 <%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
15 <%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
16 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
17
18 <jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
19 <jsp:setProperty name="customer" property="*" />
20
21 <%
22         // Init application instance
23         PizzaApplication app = PizzaServiceApplication.getInstance(application);
24 %>
25 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
26 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
27         <head>
28                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
29                 <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
30                 <title><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</title>
31         </head>
32
33         <body>
34                 <div id="title">
35                         <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</h1>
36                 </div>
37
38                 <jsp:include page="/static/menu.jsp" flush="true" />
39
40                 <div id="content_outer">
41                         <div id="content_title">
42                                 <h2>Folgendes haben Sie bestellt:</h2>
43                         </div>
44
45                         <div id="content">
46                                 <table class="table">
47                                         <thead class="table_header">
48                                                 <tr>
49                                                         <th class="table_header_column">
50                                                                 Bestellen?
51                                                         </th>
52                                                         <th class="table_header_column">
53                                                                 Anzahl:
54                                                         </th>
55                                                         <th class="table_header_column">
56                                                                 Produkt:
57                                                         </th>
58                                                         <th class="table_header_column">
59                                                                 Einzelpreis:
60                                                         </th>
61                                                         <th class="table_header_column">
62                                                                 Zwischensumme:
63                                                         </th>
64                                                 </tr>
65                                         </thead>
66                                         <tbody class="table_body">
67                                                 <%
68                                                 // "Walk" over all products
69                                                 for (final Product product : app.getProducts()) {
70                                                         %>
71                                                         <tr>
72                                                                 <td>
73                                                                         <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
74                                                                 </td>
75                                                                 <td>
76                                                                         <%=app.handleAmountFromRequestSession(product, request, session)%>
77                                                                 </td>
78                                                                 <td>
79                                                                         <%=product.getTitle()%>
80                                                                 </td>
81                                                                 <td>
82                                                                         <%=product.getPrice()%>
83                                                                 </td>
84                                                                 <td>
85                                                                         <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
86                                                                 </td>
87                                                         </tr>
88                                                         <%
89                                                 }
90                                                 float totalPrice = app.calculateTotalPrice(request, session);
91                                                 %>
92                                                 <tr>
93                                                         <td id="table_total_amount_left">
94                                                                 Menge:
95                                                         </td>
96                                                         <td id="table_total_amount_right">
97                                                                 <%=app.calculateTotalAmount(request, session)%>
98                                                         </td>
99                                                         <td class="spacer">
100                                                                 &nbsp;
101                                                         </td>
102                                                         <td id="table_total_sum_left">
103                                                                 Gesamtpreis:
104                                                         </td>
105                                                         <td id="table_total_sum_right">
106                                                                 <%=totalPrice%>
107                                                         </td>
108                                                 </tr>
109
110                                                 <tr>
111                                                         <td colspan="5" class="table_header">
112                                                                 Ihre Daten:
113                                                         </td>
114                                                 </tr>
115
116                                                 <tr>
117                                                         <td colspan="5" class="table_row">
118                                                                 <%
119                                                                 // Debug message
120                                                                 app.getLogger().debug("customer=" + customer);
121
122                                                                 // Get iterator on all fields/attributes
123                                                                 Iterator<Map.Entry<Field, Object>> fieldIterator = customer.iterator();
124                                                                 %>
125                                                                 <ul>
126                                                                 <%
127                                                                 while (fieldIterator.hasNext()) {
128                                                                         Map.Entry<Field, Object> entry = fieldIterator.next();
129                                                                         %>
130                                                                         <li><%=entry.getKey().getName()%> set to: <%=entry.getValue()%></li>
131                                                                         <%
132                                                                 }
133                                                                 %>
134                                                                 </ul>
135                                                         </td>
136                                                 </tr>
137
138                                                 <tr>
139                                                         <td colspan="5" class="table_footer">
140                                                                 <%
141                                                                 if (("POST".equals(request.getMethod())) && (app.calculateTotalAmount(request, session) > 0)) {
142                                                                         out.print("Ihre Bestellung ist eingegangen.");
143                                                                         synchronized(session) {
144                                                                                 //session.invalidate();
145                                                                                 out.print("<div>Zu Demo-Zwecken wird die Sitzung nicht gekillt. Bitte 'Bestellung' aufrufen, um zu gucken, dass die Daten da sind.</div>");
146                                                                         }
147                                                                 } else {
148                                                                         // Nothing ordered
149                                                                         out.print("Keine Bestellung aufgegeben.");
150                                                                 }
151                                                                 %>
152                                                         </td>
153                                                 </tr>
154                                         </tbody>
155                                 </table>
156                         </div>
157                 </div>
158         </body>
159 </html>