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