]> 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>
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>
67                                                 <%
68                                                 // Get Iterator
69                                                 Iterator<Product> iterator = app.getAvailableProducts();
70
71                                                 // "Walk" through all products and unmark them as ordered
72                                                 while (iterator.hasNext()) {
73                                                         // Get product instance
74                                                         Product product = iterator.next();
75                                                         %>
76                                                         <tr>
77                                                                 <td>
78                                                                         <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
79                                                                 </td>
80                                                                 <td>
81                                                                         <%=app.handleAmountFromRequestSession(product, request, session)%>
82                                                                 </td>
83                                                                 <td>
84                                                                         <%=product.getTitle()%>
85                                                                 </td>
86                                                                 <td>
87                                                                         <%=product.getPrice()%>
88                                                                 </td>
89                                                                 <td align="right">
90                                                                         <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
91                                                                 </td>
92                                                         </tr>
93                                                         <%
94                                                 }
95                                                 %>
96                                                 <tr>
97                                                         <td id="table_total_amount_left">
98                                                                 Menge:
99                                                         </td>
100                                                         <td id="table_total_amount_right">
101                                                                 <%=app.calculateTotalAmount(request, session)%>
102                                                         </td>
103                                                         <td>
104                                                                 &nbsp;
105                                                         </td>
106                                                         <td id="table_total_sum_left">
107                                                                 Gesamtpreis:
108                                                         </td>
109                                                         <td id="table_total_sum_right" align="right">
110                                                                 <%=app.calculateTotalPrice(request, session)%>
111                                                         </td>
112                                                 </tr>
113
114                                                 <tr>
115                                                         <td colspan="5" class="table_header">
116                                                                 Ihre Daten:
117                                                         </td>
118                                                 </tr>
119
120                                                 <tr>
121                                                         <td colspan="5" class="table_row">
122                                                                 <%
123                                                                 // Debug message
124                                                                 app.getLogger().debug("customer=" + customer);
125
126                                                                 // Get iterator on all fields/attributes
127                                                                 Iterator<Map.Entry<Field, Object>> fieldIterator = customer.iterator();
128                                                                 %>
129                                                                 <ul>
130                                                                 <%
131                                                                 while (fieldIterator.hasNext()) {
132                                                                         Map.Entry<Field, Object> entry = fieldIterator.next();
133                                                                         %>
134                                                                         <li><%=entry.getKey().getName()%> set to: <%=entry.getValue()%></li>
135                                                                         <%
136                                                                 }
137                                                                 %>
138                                                                 </ul>
139                                                         </td>
140                                                 </tr>
141
142                                                 <tr>
143                                                         <td colspan="5" class="table_footer">
144                                                                 <%
145                                                                 if (("POST".equals(request.getMethod())) && (app.calculateTotalAmount(request, session) > 0)) {
146                                                                         out.print("Ihre Bestellung ist eingegangen.");
147                                                                         synchronized(session) {
148                                                                                 //session.invalidate();
149                                                                                 out.print("<div>Zu Demo-Zwecken wird die Sitzung nicht gekillt. Bitte 'Bestellung' aufrufen, um zu gucken, dass die Daten da sind.</div>");
150                                                                         }
151                                                                 } else {
152                                                                         // Nothing ordered
153                                                                         out.print("Keine Bestellung aufgegeben.");
154                                                                 }
155                                                                 %>
156                                                         </td>
157                                                 </tr>
158                                         </tbody>
159                                 </table>
160                         </div>
161                 </div>
162
163                 <jsp:include page="/static/footer.jsp" flush="true" />
164         </body>
165 </html>