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