- fixed handling of categories and products in admin area (a lot stuff needed to be fixed)
- added stub page basket.xhtml + bye.xhtml
- added add_item.xhtml for later confirmation of added item
- added navigation rules
- updated translation keys
- updated jars
- added copyright notice :-) (and CSS improved)
- many more I forgot ...
Signed-off-by:Roland Häder <roland@mxchange.org>
+++ /dev/null
-DROP TABLE IF EXISTS `category`;
-CREATE TABLE IF NOT EXISTS `category` (
-`id` bigint(20) unsigned NOT NULL COMMENT 'Primary key',
- `title` varchar(255) NOT NULL COMMENT 'Category title',
- `parent` bigint(20) unsigned DEFAULT NULL COMMENT 'Parent category',
- PRIMARY KEY (`id`),
- INDEX `parent` (`parent`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Categories' ;
-
-DROP TABLE IF EXISTS `contacts`;
-CREATE TABLE IF NOT EXISTS `contacts` (
-`id` bigint(20) unsigned NOT NULL COMMENT 'Primary key',
- `own_contact` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Whether own contact',
- `gender` varchar(10) NOT NULL DEFAULT 'UNKNOWN' COMMENT 'Gender',
- `first_name` varchar(100) NOT NULL COMMENT 'First name',
- `family_name` varchar(100) NOT NULL COMMENT 'Family name',
- `company_name` varchar(255) DEFAULT NULL COMMENT 'Company name',
- `street` varchar(255) DEFAULT NULL COMMENT 'Street name',
- `house_number` smallint(5) unsigned DEFAULT NULL COMMENT 'House number',
- `city` varchar(100) DEFAULT NULL COMMENT 'City name',
- `zip_code` smallint(5) unsigned DEFAULT NULL COMMENT 'ZIP code',
- `country_code` char(2) DEFAULT NULL COMMENT 'Country code',
- `phone_number` varchar(100) DEFAULT NULL COMMENT 'Phone number',
- `cellphone_number` varchar(100) DEFAULT NULL COMMENT 'Cellphone number',
- `fax_number` varchar(100) DEFAULT NULL COMMENT 'Fax number',
- `email_address` varchar(100) DEFAULT NULL COMMENT 'Email addres',
- `birthday` date DEFAULT NULL COMMENT 'Birth day',
- `comment` tinytext NOT NULL COMMENT 'Comment',
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Entry created',
- `updated` timestamp NULL DEFAULT NULL COMMENT 'Entry updated',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Contacts data' ;
-
-DROP TABLE IF EXISTS `products`;
-CREATE TABLE IF NOT EXISTS `products` (
-`id` bigint(20) unsigned NOT NULL COMMENT 'Primary key',
- `category` bigint(20) unsigned DEFAULT NULL COMMENT 'Category id',
- `title` varchar(255) NOT NULL COMMENT 'Title of product',
- `price` decimal(20,2) unsigned NOT NULL COMMENT 'Product price',
- `available` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Whether product is available',
- PRIMARY KEY (`id`),
- INDEX `category` (`category`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Products' ;
-
-ALTER TABLE `category`
-MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key';
-
-ALTER TABLE `contacts`
-MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key';
-
-ALTER TABLE `products`
-MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key';
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-BaseContact.gender.unknown.text=Unbekannt
-BaseContact.gender.male.text=Herr
-BaseContact.gender.female.text=Frau
-BaseContact.gender.company.text=Firma
+
+# Unknown gender
+GENDER_UNKNOWN=Unbekannt
+GENDER_MALE=Herr
+GENDER_FEMALE=Frau
+GENDER_COMPANY=Firma
MiniBasketTag.basket_is_empty=Der Warenkorb ist leer.
-MiniBasketTag.last_item=Zuletzt hinzugefügt: {0}
+MiniBasketTag.last_item=Zuletzt hinzugefuegt: {0}
MiniBasketTag.additional_items=Es befinden sich noch {0} weitere Produkte im Warenkorb.
MiniBasketTag.to_basket=Zum Warenkorb
MiniBasketTag.header=Warenkorb
-Category.has_no_parent_category=Keine Elternkategorie
-Generic_YES=Ja
-Generic_NO=Nein
+CATEGORY_HAS_NO_PARENT=Keine Elternkategorie
+YES=Ja
+NO=Nein
+PARENT_CATEGORY_CANNOT_BE_NULL=Elternkategorie darf nicht leer sein.
+CATEGORY_MUST_BE_SELECTED=Es muss eine Kategorie ausgewaehlt werden.
+ITEM_AMOUNT_IS_REQUIRED=Bestellmenge wird benoetigt.
# Copyright (C) 2015 Roland Haeder
-#
+
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-BaseContact.gender.unknown.text=Unknown
-BaseContact.gender.male.text=Mr.
-BaseContact.gender.female.text=Mrs.
-BaseContact.gender.company.text=Company
+GENDER_UNKNOWN=Unknown
+GENDER_MALE=Mr.
+GENDER_FEMALE=Mrs.
+GENDER_COMPANY=Company
MiniBasketTag.basket_is_empty=The basket is empty.
MiniBasketTag.last_item=Last added item: {0}
MiniBasketTag.additional_items=There are {0} items in the basket.
MiniBasketTag.to_basket=To basket
MiniBasketTag.header=Basket
-Category.has_no_parent_category=No parent category
-Generic_YES=Yes
-Generic_NO=No
+CATEGORY_HAS_NO_PARENT=No parent category
+YES=Yes
+NO=No
+PARENT_CATEGORY_CANNOT_BE_NULL=Parent category cannot be empty.
+CATEGORY_MUST_BE_SELECTED=You have to select a category.
+ITEM_AMOUNT_IS_REQUIRED=Order amount is required.
*/
package org.mxchange.pizzaapplication.beans.basket;
-import java.rmi.RemoteException;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.FacesException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-import org.mxchange.jshopcore.model.basket.Basket;
import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote;
-import org.mxchange.jshopcore.model.basket.ShopBasket;
import org.mxchange.jshopcore.model.item.BasketItem;
import org.mxchange.jshopcore.model.product.Product;
private final BasketSessionBeanRemote basketBean;
/**
- * Item basket ("cache")
+ * Ordered amount
*/
- private final Basket<AddableBasketItem> basket;
+ private Long amount;
+
+ /**
+ * Current item
+ */
+ private AddableBasketItem currentItem;
/**
* Default constructor
// Try to lookup
this.basketBean = (BasketSessionBeanRemote) context.lookup("ejb/stateless-basket"); //NOI18N
+ }
- // Init basket "cache"
- this.basket = new ShopBasket();
+ @Override
+ public Long getAmount () {
+ return this.amount;
+ }
+
+ @Override
+ public void setAmount (final Long amount) {
+ this.amount = amount;
}
@Override
// Must not be null
if (null == product) {
// Abort here
- throw new NullPointerException("product is null");
+ throw new NullPointerException("product is null"); //NOI18N
}
// Has the "cache" some entries?
- if (!this.basket.isEmpty()) {
+ if (!this.getBasketBean().isEmpty()) {
// Generate fake instance
AddableBasketItem item = new BasketItem(product);
// Then ask it about it
- if (this.basket.isAdded(item)) {
+ if (this.getBasketBean().isAdded(item)) {
// Found it
return true;
}
AddableBasketItem item = new BasketItem(product);
// Ask bean about it
- return this.basketBean.isAdded(item);
+ return this.getBasketBean().isAdded(item);
}
@Override
public boolean isEmpty () {
- try {
- // Call remote bean
- return this.getBasketBean().isEmpty();
- } catch (final RemoteException ex) {
- // Continued to throw
- throw new FacesException(ex);
- }
+ // Check local "cache"
+ return this.getBasketBean().isEmpty();
}
@Override
private BasketSessionBeanRemote getBasketBean () {
return this.basketBean;
}
+
+ @Override
+ public String addItem (final Product product) {
+ // Generate item instance
+ AddableBasketItem item = new BasketItem(product);
+
+ // Is amount set?
+ if (this.getAmount() == null) {
+ // No amount specified?!
+ return null;
+ }
+
+ // Set amount
+ item.setAmount(this.getAmount());
+
+ try {
+ // Handle it to bean
+ this.getBasketBean().addItem(item);
+
+ // Add item to local basket, too
+ //this.basket.addItem(item);
+
+ // Remove amount
+ this.setAmount(null);
+
+ // Added
+ return "item_added"; //NOI18N
+ } catch (final BasketItemAlreadyAddedException ex) {
+ // Throw unchecked exception
+ throw new FacesException(ex);
+ }
+ }
+
+ @Override
+ public AddableBasketItem getCurrentItem () {
+ return this.currentItem;
+ }
+
+ @Override
+ public void setCurrentItem (final AddableBasketItem currentItem) {
+ this.currentItem = currentItem;
+ }
}
package org.mxchange.pizzaapplication.beans.basket;
import java.io.Serializable;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
import org.mxchange.jshopcore.model.product.Product;
/**
* @return Whether the product is added
*/
public boolean isProductAdded (final Product product);
+
+ /**
+ * Adds given product instance to basket by adding amount from form data to it.
+ *
+ * @param product Product instance to add
+ * @return Redirect target or null
+ */
+ public String addItem (final Product product);
+
+ /**
+ * Getter for item amount property
+ *
+ * @return Item amount property
+ */
+ public Long getAmount ();
+
+ /**
+ * Setter for item amount property
+ *
+ * @param amount Item amount property
+ */
+ public void setAmount (final Long amount);
+
+ /**
+ * Getter for current item
+ *
+ * @return Current item
+ */
+ public AddableBasketItem getCurrentItem ();
+
+ /**
+ * Setter for current item
+ *
+ * @param currentItem Current item
+ */
+ public void setCurrentItem (final AddableBasketItem currentItem);
}
*/
package org.mxchange.pizzaapplication.beans.category;
-import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.RequestScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
import javax.naming.InitialContext;
* @author Roland Haeder<roland@mxchange.org>
*/
@Named("admin_category")
-@SessionScoped
+@RequestScoped
public class AdminCategoryWebBean extends BaseFrameworkBean implements AdminCategoryWebController {
/**
* Serial id
}
@Override
- public void setTitle (final Long parentId) {
+ public void setParentId (final Long parentId) {
this.parentId = parentId;
}
}
*
* @param parentId Parent id to set
*/
- public void setTitle (final Long parentId);
+ public void setParentId (final Long parentId);
}
@Named("controller")
@SessionScoped
public class ShopWebBean extends BaseFrameworkBean implements ShopWebController {
+
/**
* Serial id
*/
/**
* Default constructor
- *
+ *
* @throws javax.naming.NamingException Something happened here?
*/
public ShopWebBean () throws NamingException {
Deque<Category> deque = this.getAllCategories();
// Create fake entry
- Category fake = new ProductCategory(0L, this.getMessage("Category.has_no_parent_category"), 0L); //NOI18N
+ Category fake = new ProductCategory(0L, this.getMessage("CATEGORY_HAS_NO_PARENT"), 0L); //NOI18N
// Add it
deque.addFirst(fake);
@Override
public Queue<Product> getAvailableProducts () throws FacesException {
- return this.getProductBean().getAvailableProducts();
+ // Get queue from bean
+ Queue<Product> queue = this.getProductBean().getAvailableProducts();
+
+ // Return it
+ return queue;
}
-
+
@PostConstruct
public void init () {
// Call super init for getting resource bundle
package org.mxchange.pizzaapplication.beans.product;
import java.util.Deque;
-import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
import javax.naming.InitialContext;
* @author Roland Haeder<roland@mxchange.org>
*/
@Named ("admin_product")
-@ApplicationScoped
+@RequestScoped
public class AdminProductWebBean extends BaseFrameworkBean implements AdminProductWebController {
/**
/**
* Category id
*/
- private Long categoryId;
+ private Long id;
/**
* Property price
// Add all
product.setAvailable(this.getAvailable());
- product.setCategoryId(this.getCategoryId());
+ product.setId(this.getId());
product.setPrice(this.getPrice());
product.setTitle(this.getTitle());
// Set all to null
this.setAvailable(Boolean.FALSE);
- this.setCategoryId(null);
+ this.setId(null);
this.setPrice(null);
this.setTitle(null);
} catch (final ProductTitleAlreadyUsedException ex) {
}
@Override
- public Long getCategoryId () {
- return categoryId;
+ public Long getId () {
+ return id;
}
@Override
- public void setCategoryId (Long categoryId) {
- this.categoryId = categoryId;
+ public void setId (Long id) {
+ this.id = id;
}
@Override
*
* @return Product's category id
*/
- public Long getCategoryId ();
+ public Long getId ();
/**
* Setter for product's category id
*
- * @param categoryId Product's category id
+ * @param id Product's category id
*/
- public void setCategoryId (final Long categoryId);
+ public void setId (final Long id);
}
<from-outcome>admin_index</from-outcome>
<to-view-id>/admin/index.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>basket</from-outcome>
+ <to-view-id>/basket.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/index.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>item_added</from-outcome>
+ <to-view-id>/item_added.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
- <h:selectOneMenu class="select" id="categoryId" value="#{admin_product.categoryId}">
- <f:selectItems value="#{controller.allCategories}" var="cat" itemValue="#{cat.categoryId}" itemLabel="#{cat.title}" />
+ <h:selectOneMenu class="select" id="parentId" value="#{admin_product.id}" required="true" requiredMessage="#{msg.CATEGORY_MUST_BE_SELECTED}">
+ <f:selectItems value="#{controller.allCategories}" var="cat" itemValue="#{cat.id}" itemLabel="#{cat.title}" />
+ <f:validateLongRange for="parentId" minimum="0" maximum="1000" />
</h:selectOneMenu>
</ui:composition>
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
- <h:selectOneMenu class="select" id="parentId" value="#{admin_category.parentId}">
- <f:selectItems value="#{controller.allCategoriesParent}" var="parent_category" itemValue="#{parent_category.categoryId}" itemLabel="#{parent_category.title}" />
+ <h:selectOneMenu class="select" id="parentId" value="#{admin_category.parentId}" required="true" requiredMessage="#{msg.PARENT_CATEGORY_CANNOT_BE_NULL}">
+ <f:selectItems value="#{controller.allCategoriesParent}" var="parent_category" itemValue="#{parent_category.id}" itemLabel="#{parent_category.title}" />
</h:selectOneMenu>
</ui:composition>
xmlns:ui="http://java.sun.com/jsf/facelets">
<div class="footer">
<ul class="footer_nav">
- <li><h:link outcome="index" value="Home" /></li>
- <li><h:link outcome="imprint" value="Impressum" /></li>
- <li><h:link outcome="terms" value="AGBs" /></li>
- <li><h:link outcome="privacy" value="Datenschutz" /></li>
+ <li class="footer_link"><h:link outcome="index" value="Home" /></li>
+ <li class="footer_link"><h:link outcome="imprint" value="Impressum" /></li>
+ <li class="footer_link"><h:link outcome="terms" value="AGBs" /></li>
+ <li class="footer_link"><h:link outcome="privacy" value="Datenschutz" /></li>
+ <li class="footer_copyright">Copyright (c) 2015 by Roland Haeder</li>
</ul>
</div>
<h:dataTable headerClass="table_header_column" rowClasses="table_row" styleClass="table" id="categories" value="#{controller.allCategories}" var="cat">
<h:column>
<f:facet name="header">Auswählen:</f:facet>
- #{cat.categoryId}:
+ #{cat.id}:
<h:selectBooleanCheckbox class="input" value="true" />
</h:column>
</div>
<div class="table_right">
- <input class="input" type="text" name="title" size="10" maxlength="255" />
+ <h:inputText class="input" id="title" value="#{admin_category.title}" size="10" maxlength="255" required="true" />
</div>
<div class="clear"></div>
</ui:define>
<ui:define name="content_header">
- Diese Produkte wurden eingestellt
+ Diese Produkte sind erstellt worden:
</ui:define>
<ui:define name="content">
<div class="para">
<h:form acceptcharset="utf-8" id="form">
- <h:dataTable headerClass="table_header_column" id="product_table" var="pro" value="#{admin_product.allProducts}">
+ <h:dataTable headerClass="table_header_column" id="product_table" var="product" value="#{admin_product.allProducts}">
<h:column>
<f:facet name="header">Produktnummer:</f:facet>
- #{pro.id}:<h:selectBooleanCheckbox class="input" value="true" />
+ #{product.id}:<h:selectBooleanCheckbox class="input" value="true" />
</h:column>
<h:column>
<f:facet name="header">Produktbezeichnung:</f:facet>
- #{pro.title}
+ #{product.title}
</h:column>
+
<h:column>
<f:facet name="header">Einzelpreis:</f:facet>
- #{pro.price}
+ #{product.price}
</h:column>
+
<h:column>
<f:facet name="header">Kategorie:</f:facet>
- #{pro.categoryId}
+ #{product.categoryId}
</h:column>
+
<h:column>
<f:facet name="header">Verfügbar:</f:facet>
- #{pro.available}
+ #{product.available}
</h:column>
</h:dataTable>
<div class="table_right">
<h:selectOneListbox required="true" id="available" value="#{admin_product.available}" size="1" class="select">
- <f:selectItem itemValue="true" itemLabel="#{msg.Generic_YES}" />
- <f:selectItem itemValue="false" itemLabel="#{msg.Generic_NO}" />
+ <f:selectItem itemValue="true" itemLabel="#{msg.YES}" />
+ <f:selectItem itemValue="false" itemLabel="#{msg.NO}" />
</h:selectOneListbox>
</div>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<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"
+ >
+
+ <ui:composition template="/WEB-INF/templates/guest/guest_base.tpl">
+ <ui:define name="guest_title">Warenkorb</ui:define>
+
+ <ui:define name="menu">
+ <ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+ </ui:define>
+
+ <ui:define name="content_header">
+ Warenkorb
+ </ui:define>
+
+ <ui:define name="content">
+ Hier wird der Warenkorb angezeigt.
+ </ui:define>
+
+ <ui:define name="footer">
+ <ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+ </ui:define>
+ </ui:composition>
+</html>
-<%--
- Document : bye
- Created on : 05.08.2015, 10:51:14
- Author : Roland Haeder
---%>
+<?xml version="1.0" encoding="UTF-8" ?>
+<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"
+ >
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
+ <ui:composition template="/WEB-INF/templates/guest/guest_base.tpl">
+ <ui:define name="guest_title">Sitzung beenden</ui:define>
-<!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" />
- <link rel="stylesheet" href="${basePath}/style.css" type="text/css" />
- <title>Pizza-Service - Sitzung beenden</title>
- </head>
+ <ui:define name="menu">
+ <ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+ </ui:define>
- <body>
- <div id="header">
- <div id="title">
- <h1>Pizza-Service - Sitzung beenden</h1>
- </div>
- </div>
+ <ui:define name="content_header">
+ Sitzung beenden
+ </ui:define>
- <jsp:include page="/WEB-INF/templates/guest/guest_menu.jsp" flush="false" />
+ <ui:define name="content">
+ Offenes TODO!
+ </ui:define>
- <div id="content_outer">
- <div id="content_title">
- <h2>Situng beenden:</h2>
- </div>
-
- <div id="content">
- <%
- synchronized (session) {
- if (!session.isNew()) {
- // Not new session
- session.invalidate();
- out.println("Sitzung beendet.");
- } else {
- // New session
- out.println("Sitzung bereits beendet.");
- }
- }
- %>
- </div>
- </div>
-
- <jsp:include page="/WEB-INF/templates/guest/guest_footer.jsp" flush="false" />
- </body>
+ <ui:define name="footer">
+ <ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+ </ui:define>
+ </ui:composition>
</html>
</th>
</tr>
</thead>
+ </table>
- <tbody>
- <ui:repeat var="product" value="#{controller.availableProducts}">
- <h:form acceptcharset="utf-8" id="add_item">
- <ui:fragment rendered="#{basket.isProductAdded(product) == true}">
- <tr>
- <td class="table_data_column">
- <h:link outcome="basket" title="Zum Warenkorb" value="Warenkorb" />
- </td>
-
- <td class="table_data_column">
- #{basket.currentItem.amount}
- </td>
-
- <td class="table_data_column">
- #{product.title}
- </td>
-
- <td class="table_data_column" align="right">
- <h:outputText class="price" value="#{product.price}">
- <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" />
- </h:outputText>
- </td>
-
- <td class="table_data_column" align="right">
- <h:outputText class="price" value="#{controller.calculateTotalPrice(basket.currentItem)}">
- <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" />
- </h:outputText>
- </td>
- </tr>
- </ui:fragment>
-
- <ui:fragment rendered="#{basket.isProductAdded(product) == false}">
+ <ui:repeat var="product" value="#{controller.availableProducts}">
+ <ui:fragment rendered="#{basket.isProductAdded(product) == true}">
+ <table class="basket_item_table">
+ <tbody>
+ <tr>
+ <td class="table_data_column">
+ <h:link outcome="basket" title="Zum Warenkorb" value="Warenkorb" />
+ </td>
+
+ <td class="table_data_column">
+ #{basket.currentItem.amount}
+ </td>
+
+ <td class="table_data_column">
+ #{product.title}
+ </td>
+
+ <td class="table_data_column" align="right">
+ <h:outputText class="price" value="#{product.price}">
+ <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" />
+ </h:outputText>
+ </td>
+
+ <td class="table_data_column" align="right">
+ <h:outputText class="price" value="#{basket.calculateItemPrice()}">
+ <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" />
+ </h:outputText>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </ui:fragment>
+
+ <ui:fragment rendered="#{basket.isProductAdded(product) == false}">
+ <h:form acceptcharset="utf-8" id="add_item">
+ <table class="basket_item_table">
+ <tbody>
<tr>
<td class="table_data_column">
- <h:commandButton class="submit" id="add" value="Hinzufügen" action="#{basket.addItem(product)}" />
- <h:inputHidden id="itemId" value="#{product.id}" />
- <h:inputHidden id="itemType" value="Product" />
+ <h:commandButton class="submit" id="add" value="Hinzufügen" action="#{basket.addItem(product)}" title="Fuegt das Produkt dem Warenkorb hinzu" />
</td>
<td class="table_data_column">
- <h:inputText class="input" id="amount" size="3" maxlength="20">
+ <h:inputText class="input" id="amount" size="3" maxlength="20" value="#{basket.amount}" required="true" requiredMessage="#{msg.ITEM_AMOUNT_IS_REQUIRED}" title="Geben Sie hier die Bestellmenge ein.">
<!--
If the customer wants to order more, he need to call in.
//-->
- <f:validateLongRange minimum="1" maximum="10" />
+ <f:validateLongRange for="amount" minimum="1" maximum="10" />
</h:inputText>
</td>
<td class="table_data_column" align="right">
<h:outputText class="price" value="#{product.price}">
- <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" />
+ <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
</h:outputText>
</td>
-
</td>
</tr>
- </ui:fragment>
- </h:form>
- </ui:repeat>
- </tbody>
- </table>
+ </tbody>
+ </table>
+ </h:form>
+ </ui:fragment>
+ </ui:repeat>
</ui:define>
<ui:define name="footer">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<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"
+ >
+
+ <ui:composition template="/WEB-INF/templates/guest/guest_base.tpl">
+ <ui:define name="guest_title">Produkt zum Warenkorb hinzugefuegt</ui:define>
+
+ <ui:define name="menu">
+ <ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+ </ui:define>
+
+ <ui:define name="content_header">
+ Produkt zum Warenkorb hinzugefuegt
+ </ui:define>
+
+ <ui:define name="content">
+ Das Produkt wurde zum Warenkorb hinzugefuegt.
+ </ui:define>
+
+ <ui:define name="footer">
+ <ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+ </ui:define>
+ </ui:composition>
+</html>
+/**
+div {
+ border: 1px solid #ff0000;
+}
+/**/
+
#top {
position: relative;
background-color: #036fab;
text-decoration : underline;
}
-/**
-div {
- border: 1px solid #ff0000;
-}
-/**/
-
table, .table {
margin: 0px;
padding: 0px;
ul.footer_nav {
text-align: center;
- width : 500px;
+ width : 100%;
list-style: none;
margin: 0px;
}
-ul.footer_nav li {
+ul.footer_nav li.footer_link {
float: left;
width: 100px;
}
+ul.footer_nav li.footer_copyright {
+ float: right;
+ width: 300px;
+ margin-right: 10px;
+}
+
.menu ul {
list-style: none;
padding-left: 5px;