]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - web/index.xhtml
updated jar(s)
[pizzaservice-war.git] / web / index.xhtml
index bf2e0c5ab3306516363aa6224c19ccb76691dbce..d769335f48debb3773660b9709d05be5e110ff34 100644 (file)
@@ -1,98 +1,97 @@
-<?xml version='1.0' encoding='UTF-8' ?>
+<?xml version="1.0" encoding="UTF-8" ?>
 <!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" xmlns:h="http://xmlns.jcp.org/jsf/html"
-         xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-         xmlns:f="http://xmlns.jcp.org/jsf/core">
-       <ui:param name="path" value="#{request.contextPath}" />
-       <h:head>
-               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-               <link rel="stylesheet" href="#{path}/style.css" type="text/css"/>
-               <title>Willkommen</title>
-       </h:head>
-       <h:body>
-               <div id="header"> 
-                       <div id="title">
-                               <h1>Willkommen</h1>
-                       </div>
-               </div>
+<html xmlns="http://www.w3.org/1999/xhtml"
+         xmlns:ui="http://java.sun.com/jsf/facelets"
+         xmlns:h="http://xmlns.jcp.org/jsf/html"
+         xmlns:f="http://xmlns.jcp.org/jsf/core"
+         >
+
+       <!--
+       TODO: Not used:
+       xmlns:basket="http://mxchange.org/jshop/tags/basket"
+       //-->
+
+       <ui:composition template="/WEB-INF/templates/guest/guest_base.tpl">
+               <ui:define name="guest_title">#{msg.PAGE_TITLE_INDEX_WELCOME}</ui:define>
 
-               <ui:include src="/static/guest/guest_menu.xhtml" id="menu" />
+               <ui:define name="content_header">
+                       #{msg.CONTENT_TITLE_INDEX_WELCOME}
+               </ui:define>
 
-               <div id="content_outer">
-                       <div id="content_title">
-                               <h2>Folgendes kann bestellt werden:</h2>
+               <ui:define name="content">
+                       <div class="table">
+                               <div class="table_header">
+                                       #{msg.FOLLOWING_PRODUCTS_ARE_AVAILABLE}
+                               </div>
                        </div>
 
-                       <div id="content">
-                               <h:panelGrid class="table" columns="4">
-                                       <h:column class="table_header_column">Bestellen?</h:column>
-                                       <h:column class="table_header_column">Anzahl:</h:column>
-                                       <h:column class="table_header_column">Produkt:</h:column>
-                                       <h:column class="table_header_column">Einzelpreis:</h:column>
-                               </h:panelGrid>
+                       <h:dataTable id="table_show_available_products" var="product" value="#{productController.availableProducts}" styleClass="table" summary="#{msg.TABLE_SUMMARY_INDEX_PRODUCTS}">
+                               <h:column>
+                                       <div id="main_item_container">
+                                               <div class="item_title">
+                                                       #{product.productTitle}
+                                               </div>
 
-                               <%
-                               // Get app instance
-                               PizzaApplication app = PizzaServiceApplication.getInstance(application);
+                                               <div class="item_content">
+                                                       <div class="table_left">
+                                                               <div class="item_actions">
+                                                                       <ui:fragment rendered="#{!basketController.isProductAdded(product)}">
+                                                                               <h:form id="add_item">
+                                                                                       <h:commandButton class="submit" id="add" value="#{msg.USER_ADD_ITEM_TO_BASKET}" action="#{basketController.addItem(product)}" title="#{msg.BUTTON_TITLE_ADD_ITEM_TO_BASKET}" />
 
-                               // Get Iterator
-                               Iterator<Product> iterator = app.getAvailableProducts();
+                                                                                       <h:inputText class="input" id="amount" size="3" maxlength="20" value="#{basketController.orderedAmount}" title="#{msg.INPUT_TITLE_ENTER_ITEM_AMOUNT}">
+                                                                                               <!--
+                                                                                               If the customer wants to order more, he need to call in.
+                                                                                               //-->
+                                                                                               <f:validator for="amount" validatorId="ItemAmountValidator" />
+                                                                                       </h:inputText>
+                                                                               </h:form>
+                                                                       </ui:fragment>
 
-                               // "Walk" through all products and unmark them as ordered
-                               while (iterator.hasNext()) {
-                                       // Get product instance
-                                       Product product = iterator.next();
+                                                                       <ui:fragment rendered="#{basketController.isProductAdded(product)}">
+                                                                               <div class="item_amount">
+                                                                                       #{msg.ITEM_ORDER_AMOUNT}
+                                                                                       #{basketController.getItemAmount(product)}
+                                                                               </div>
 
-                                       // Get basket instance
-                                       Basket<AddableBasketItem> basket = ItemBasket.getInstance(session);
+                                                                               <div class="item_basket_link">
+                                                                                       <h:link outcome="basket" title="#{msg.LINK_TO_BASKET_TITLE}" value="#{msg.LINK_CHANGE_IN_BASKET}" />
+                                                                               </div>
 
-                                       // Create an item instance form this product
-                                       AddableBasketItem item = basket.getItem(product);
+                                                                               <div class="clear"></div>
+                                                                       </ui:fragment>
+                                                               </div>
+                                                       </div>
 
-                                       // Has it been already added to the basket?
-                                       if (item != null) {
-                                               // Some nice output ...
-                                               %>
-                               <h:panelGrid class="table" columns="4">
-                                       <h:column class="table_header_column"><a href="#{path}/basket.jsp" title="Zum Warenkorb">Warenkorb</a></h:column>
-                                       <h:column class="table_header_column"><%=item.getAmount()%></h:column>
-                                       <h:column class="table_header_column"><%=product.getTitle()%></h:column>
-                                       <h:column class="table_header_column"><f:convertNumber type="currency"><%=product.getPrice()%></f:convertNumber></h:column>
-                               </h:panelGrid>
-                                               <%
-                                               // Then skip this item
-                                               continue;
-                                       }
+                                                       <div class="table_right">
+                                                               <div class="item_price">
+                                                                       #{msg.SINGLE_PRODUCT_PRICE}
+                                                                       <h:outputText class="price" value="#{product.productPrice}">
+                                                                               <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
+                                                                       </h:outputText>
+                                                               </div>
 
-                                       // Unmark as ordered
-                                       app.unmarkProductAsOrdered(product, session);
-                                       %>
-                               <h:form>
-                               <h:panelGrid class="table" columns="4">
-                                       <h:column class="table_header_column">
-                                               <h:commandButton action="#{path}/form_handler/add_item.jsp" class="submit" 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" />
-                                       </h:column>
-                                       <h:column class="table_header_column">
-                                               <!--<h:inputText class="input" size="3" maxlength="20" />-->
-                                               <input class="input" type="text" name="<%=PizzaApplication.HTTP_PARAM_AMOUNT%>" size="3" maxlength="20" />
-                                       </h:column>
-                                       <h:column class="table_header_column">
-                                               <%=product.getTitle()%>
-                                       </h:column>
-                                       <h:column class="table_header_column right">
-                                               <f:convertNumber type="currency"><%=product.getPrice()%></f:convertNumber>
-                                       </h:column>
-                               </h:panelGrid>
-                               </h:form>
-                               <%
-                       }
-                       %>
-                       </div>
-               </div>
+                                                               <div class="item_total_price">
+                                                                       #{msg.TOTAL_ITEM_PRICE}
+                                                                       <h:outputText class="price" value="#{msg.ITEM_NOT_ORDERED}" rendered="#{!basketController.isProductAdded(product)}" />
+                                                                       <h:outputText class="price" value="#{basketController.calculateCurrentItemPrice()}" rendered="#{basketController.isProductAdded(product)}">
+                                                                               <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
+                                                                       </h:outputText>
+                                                               </div>
+                                                       </div>
 
-               <ui:include src="/static/guest/guest_footer.xhtml" id="footer" />
+                                                       <div class="clear"></div>
+                                               </div>
+                                       </div>
+                               </h:column>
+                       </h:dataTable>
 
-       </h:body>
+                       <div id="totals_container">
+                               #{msg.TOTAL_ORDER_PRICE}
+                               <h:outputText class="price" id="total_sum" value="#{basketController.calculateTotalPrice()}">
+                                       <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
+                               </h:outputText>
+                       </div>
+               </ui:define>
+       </ui:composition>
 </html>