]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - web/index.jsp
Added footer for admin area + error include file "direct_call.jsp"
[pizzaservice-war.git] / web / index.jsp
index 70bfa5e3e81689a615d4e16344a89526a78aa545..ae7eb48335071993245cf6b03504954a5971a87a 100644 (file)
@@ -4,33 +4,35 @@
        Author     : Roland Haeder
 --%>
 
-<%@page errorPage="errorHandler.jsp" %>
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page import="java.util.Map"%>
 <%@page import="java.util.Iterator"%>
-<%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaservice.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaservice.product.Product"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.product.Product"%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 
 <%
-       // Init service instance
-       PizzaApplication service = PizzaServiceApplication.getInstance(application);
+       // Init application instance
+       PizzaApplication app = PizzaServiceApplication.getInstance(application);
 %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Eingangsseite</title>
+               <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
+               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Willkommen</title>
        </head>
 
        <body>
-               <div id="title">
-                       <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Eingangsseite</h1>
+               <div id="header"> 
+                       <div id="title">
+                               <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Willkommen</h1>
+                       </div>
                </div>
 
-               <div id="menu">
-                       <jsp:include page="static/menu.jsp" flush="true" />
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
@@ -38,9 +40,8 @@
                        </div>
 
                        <div id="content">
-                               <form action="<%=request.getContextPath()%>/order.jsp" accept-charset="utf-8" id="form" method="post">
                                <table class="table">
-                                       <thead class="table_header">
+                                       <thead>
                                                <tr>
                                                        <th class="table_header_column">
                                                                Bestellen?
                                                        </th>
                                                </tr>
                                        </thead>
-                                       <tbody class="table_body">
+
+                                       <tbody>
                                                <%
-                                               // Get iterator from products
-                                               Iterator<Map.Entry<String, Product>> iterator = service.getProductsIterator();
+                                               // Get Iterator
+                                               Iterator<Product> iterator = app.getAvailableProducts();
 
-                                               // Iterate over all
+                                               // "Walk" through all products and unmark them as ordered
                                                while (iterator.hasNext()) {
-                                                       // Get entry
-                                                       Map.Entry<String, Product> entry = iterator.next();
+                                                       // Get product instance
+                                                       Product product = iterator.next();
 
-                                                       // Get product
-                                                       Product product = entry.getValue();
-                                                       service.unmarkProductAsOrdered(product, session);
+                                                       // Unmark as ordered
+                                                       app.unmarkProductAsOrdered(product, session);
                                                        %>
                                                        <tr>
+                                                               <form action="<%=request.getContextPath()%>/form_handler/add_item.jsp" accept-charset="utf-8" id="form" method="post">
                                                                <td>
-                                                                       <input type="checkbox" name="<%=String.format(PizzaApplication.HTTP_PARAM_MASK, PizzaApplication.HTTP_PARAM_CHOOSE, product.getName())%>" value="1" <%=service.getCheckedHtmlFromProduct(product, request, session)%> />
+                                                                       <input class="submit" type="submit" name="add" value="Hinzuf&uuml;gen" />
+                                                                       <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_ID%>" value="<%=product.getId()%>" />
+                                                                       <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_TYPE%>" value="<%=Product.class%>" />
                                                                </td>
                                                                <td>
-                                                                       <input type="text" name="<%=String.format(PizzaApplication.HTTP_PARAM_MASK, PizzaApplication.HTTP_PARAM_AMOUNT, product.getName())%>" value="<%=service.getAmountFromSession(product, session)%>" size="3" maxlength="20" />
+                                                                       <input class="input" type="text" name="<%=PizzaApplication.HTTP_PARAM_AMOUNT%>" size="3" maxlength="20" />
                                                                </td>
                                                                <td>
                                                                        <%=product.getTitle()%>
                                                                </td>
-                                                               <td>
-                                                                       <%=product.getPrice()%>
+                                                               <td align="right">
+                                                                       <fmt:formatNumber type="currency"><%=product.getPrice()%></fmt:formatNumber>
                                                                </td>
                                                        </tr>
+                                                       </form>
                                                        <%
                                                }
                                                %>
-                                               <tr>
-                                                       <td colspan="4" class="table_footer">
-                                                               <input type="reset" value="Formular zurücksetzen" />
-                                                               <input type="submit" name="send" value="Bestellung ansehen" />
-                                                       </td>
-                                               </tr>
                                        </tbody>
                                </table>
-                               </form>
                        </div>
                </div>
+
+               <jsp:include page="/static/footer.jsp" flush="true" />
        </body>
 </html>