]> git.mxchange.org Git - pizzaservice-war.git/blob - web/finished.jsp
Introduced static/menu.jsp
[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 import="org.mxchange.pizzaservice.application.PizzaApplication"%>
8 <%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%>
9 <%@page errorPage="errorHandler.jsp" %>
10 <%@page import="java.util.Map"%>
11 <%@page import="java.util.Iterator"%>
12 <%@page import="org.mxchange.pizzaservice.product.Product"%>
13 <%@page contentType="text/html" pageEncoding="UTF-8"%>
14
15 <%
16         // Init service instance
17         PizzaApplication service = PizzaServiceApplication.getInstance(application);
18 %>
19 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
20 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
21         <head>
22                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
23                 <title><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</title>
24         </head>
25
26         <body>
27                 <div id="title">
28                         <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</h1>
29                 </div>
30
31                 <div id="menu">
32                         <jsp:include page="static/menu.jsp" flush="true" />
33                 </div>
34
35                 <div id="content_outer">
36                         <div id="content_title">
37                                 <h2>Folgendes haben Sie bestellt:</h2>
38                         </div>
39
40                         <div id="content">
41                                 <table class="table">
42                                         <thead class="table_header">
43                                                 <tr>
44                                                         <th class="table_header_column">
45                                                                 Bestellen?
46                                                         </th>
47                                                         <th class="table_header_column">
48                                                                 Anzahl:
49                                                         </th>
50                                                         <th class="table_header_column">
51                                                                 Produkt:
52                                                         </th>
53                                                         <th class="table_header_column">
54                                                                 Einzelpreis:
55                                                         </th>
56                                                         <th class="table_header_column">
57                                                                 Zwischensumme:
58                                                         </th>
59                                                 </tr>
60                                         </thead>
61                                         <tbody class="table_body">
62                                                 <%
63                                                 // Get iterator from products
64                                                 Iterator<Map.Entry<String, Product>> iterator = service.getProductsIterator();
65
66                                                 // Iterate over all
67                                                 while (iterator.hasNext()) {
68                                                         // Get entry
69                                                         Map.Entry<String, Product> entry = iterator.next();
70
71                                                         // Get product
72                                                         Product product = entry.getValue();
73
74                                                         // Mark product as ordered
75                                                         service.markProductAsOrdered(product, session);
76                                                         %>
77                                                         <tr>
78                                                                 <td>
79                                                                         <%=service.getPrintableChoosenFromRequestSession(product, request, session)%>
80                                                                 </td>
81                                                                 <td>
82                                                                         <%=service.handleAmountFromRequestSession(product, request, session)%>
83                                                                 </td>
84                                                                 <td>
85                                                                         <%=product.getTitle()%>
86                                                                 </td>
87                                                                 <td>
88                                                                         <%=product.getPrice()%>
89                                                                 </td>
90                                                                 <td>
91                                                                         <%=service.getTotalPositionPriceFromRequestSession(product, request, session)%>
92                                                                 </td>
93                                                         </tr>
94                                                         <%
95                                                 }
96                                                 float totalPrice = service.calculateTotalPrice(request, session);
97                                                 %>
98                                                 <tr>
99                                                         <td id="table_total_amount_left">
100                                                                 Menge:
101                                                         </td>
102                                                         <td id="table_total_amount_right">
103                                                                 <%=service.calculateTotalAmount(request, session)%>
104                                                         </td>
105                                                         <td class="spacer">
106                                                                 &nbsp;
107                                                         </td>
108                                                         <td id="table_total_sum_left">
109                                                                 Gesamtpreis:
110                                                         </td>
111                                                         <td id="table_total_sum_right">
112                                                                 <%=totalPrice%>
113                                                         </td>
114                                                 </tr>
115
116                                                 <tr>
117                                                         <td colspan="5" class="table_footer">
118                                                                 <%
119                                                                 if (("POST".equals(request.getMethod())) && (service.calculateTotalAmount(request, session) > 0)) {
120                                                                         out.print("Ihre Bestellung ist eingegangen.");
121                                                                         synchronized(session) {
122                                                                                 session.invalidate();
123                                                                         }
124                                                                 } else {
125                                                                         // Nothing ordered
126                                                                         out.print("Keine Bestellung aufgegeben.");
127                                                                 }
128                                                                 %>
129                                                         </td>
130                                                 </tr>
131                                         </tbody>
132                                 </table>
133                         </div>
134                 </div>
135         </body>
136 </html>