]> 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="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                 <div id="menu">
39                         <jsp:include page="/static/menu.jsp" flush="true" />
40                 </div>
41
42                 <div id="content_outer">
43                         <div id="content_title">
44                                 <h2>Folgendes haben Sie bestellt:</h2>
45                         </div>
46
47                         <div id="content">
48                                 <table class="table">
49                                         <thead class="table_header">
50                                                 <tr>
51                                                         <th class="table_header_column">
52                                                                 Bestellen?
53                                                         </th>
54                                                         <th class="table_header_column">
55                                                                 Anzahl:
56                                                         </th>
57                                                         <th class="table_header_column">
58                                                                 Produkt:
59                                                         </th>
60                                                         <th class="table_header_column">
61                                                                 Einzelpreis:
62                                                         </th>
63                                                         <th class="table_header_column">
64                                                                 Zwischensumme:
65                                                         </th>
66                                                 </tr>
67                                         </thead>
68                                         <tbody class="table_body">
69                                                 <%
70                                                 // Get iterator from products
71                                                 Iterator<Map.Entry<String, Product>> iterator = app.getProductsIterator();
72
73                                                 // Iterate over all
74                                                 while (iterator.hasNext()) {
75                                                         // Get entry
76                                                         Map.Entry<String, Product> entry = iterator.next();
77
78                                                         // Get product
79                                                         Product product = entry.getValue();
80
81                                                         // Mark product as ordered
82                                                         app.markProductAsOrdered(product, session);
83                                                         %>
84                                                         <tr>
85                                                                 <td>
86                                                                         <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
87                                                                 </td>
88                                                                 <td>
89                                                                         <%=app.handleAmountFromRequestSession(product, request, session)%>
90                                                                 </td>
91                                                                 <td>
92                                                                         <%=product.getTitle()%>
93                                                                 </td>
94                                                                 <td>
95                                                                         <%=product.getPrice()%>
96                                                                 </td>
97                                                                 <td>
98                                                                         <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
99                                                                 </td>
100                                                         </tr>
101                                                         <%
102                                                 }
103                                                 float totalPrice = app.calculateTotalPrice(request, session);
104                                                 %>
105                                                 <tr>
106                                                         <td id="table_total_amount_left">
107                                                                 Menge:
108                                                         </td>
109                                                         <td id="table_total_amount_right">
110                                                                 <%=app.calculateTotalAmount(request, session)%>
111                                                         </td>
112                                                         <td class="spacer">
113                                                                 &nbsp;
114                                                         </td>
115                                                         <td id="table_total_sum_left">
116                                                                 Gesamtpreis:
117                                                         </td>
118                                                         <td id="table_total_sum_right">
119                                                                 <%=totalPrice%>
120                                                         </td>
121                                                 </tr>
122
123                                                 <tr>
124                                                         <td colspan="5" class="table_header">
125                                                                 Ihre Daten:
126                                                         </td>
127                                                 </tr>
128
129                                                 <tr>
130                                                         <td colspan="5" class="table_row">
131                                                                 <%
132                                                                 // Debug message
133                                                                 app.getLogger().debug("customer=" + customer);
134
135                                                                 // Get iterator on all fields/attributes
136                                                                 Iterator<Map.Entry<Field, Object>> fieldIterator = customer.iterator();
137                                                                 %>
138                                                                 <ul>
139                                                                 <%
140                                                                 while (fieldIterator.hasNext()) {
141                                                                         Map.Entry<Field, Object> entry = fieldIterator.next();
142                                                                         %>
143                                                                         <li><%=entry.getKey().getName()%> set to: <%=entry.getValue()%></li>
144                                                                         <%
145                                                                 }
146                                                                 %>
147                                                                 </ul>
148                                                         </td>
149                                                 </tr>
150
151                                                 <tr>
152                                                         <td colspan="5" class="table_footer">
153                                                                 <%
154                                                                 if (("POST".equals(request.getMethod())) && (app.calculateTotalAmount(request, session) > 0)) {
155                                                                         out.print("Ihre Bestellung ist eingegangen.");
156                                                                         synchronized(session) {
157                                                                                 //session.invalidate();
158                                                                                 out.print("<div>Zu Demo-Zwecken wird die Sitzung nicht gekillt. Bitte 'Bestellung' aufrufen, um zu gucken, dass die Daten da sind.</div>");
159                                                                         }
160                                                                 } else {
161                                                                         // Nothing ordered
162                                                                         out.print("Keine Bestellung aufgegeben.");
163                                                                 }
164                                                                 %>
165                                                         </td>
166                                                 </tr>
167                                         </tbody>
168                                 </table>
169                         </div>
170                 </div>
171         </body>
172 </html>