From: Roland Haeder Date: Mon, 14 Sep 2015 08:42:30 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8ed95f6af6858cb7711cd55141a1abb7cfb11a69;p=pizzaservice-war.git Continued: - refactured index page as this was not working (why, JSF team?) - added very basic item basket (total amount to pay is missing + link to checkout page) - updated jars Signed-off-by:Roland Häder --- diff --git a/lib/jcore-ee-logger.jar b/lib/jcore-ee-logger.jar index 6d0e98ca..96315783 100644 Binary files a/lib/jcore-ee-logger.jar and b/lib/jcore-ee-logger.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 925c0588..20252ca0 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/lib/jshop-core.jar b/lib/jshop-core.jar index 7f20cac7..f7544741 100644 Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ diff --git a/lib/jshop-ee-lib.jar b/lib/jshop-ee-lib.jar index 4970b7f6..58fc16d3 100644 Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index ab603346..d9aecd41 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -33,3 +33,4 @@ BUTTON_TITLE_ADD_ITEM_TO_BASKET=F\u00fcgt das Produkt dem Warenkorb hinzu. INPUT_TITLE_ENTER_ITEM_AMOUNT=Geben Sie hier die Bestellmenge ein. NO_EMAIL_ADDRESS_ENTERED=Sie haben keine EMail-Adresse eingegeben. NO_PASSWORD_ENTERED=Sie haben kein Passwort eingegeben. +ERROR_AMOUNT_IS_NOT_LONG=Die eingegebene Menge ist keine Zahl. diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index b465711a..2080f6a7 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -31,3 +31,4 @@ BUTTON_TITLE_ADD_ITEM_TO_BASKET=Adds the product to the basket. INPUT_TITLE_ENTER_ITEM_AMOUNT=Enter order amount here. NO_EMAIL_ADDRESS_ENTERED=You have entered no email address. NO_PASSWORD_ENTERED=You have entered no password. +ERROR_AMOUNT_IS_NOT_LONG=The entered amount is not a number. diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java index 89177ad3..9adcfea5 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java @@ -16,7 +16,7 @@ */ package org.mxchange.pizzaapplication.beans.basket; -import java.util.Map; +import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.faces.FacesException; @@ -115,7 +115,13 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl } @Override - public Float calculateItemPrice () { + public List allItems () { + // Deligate to basket instance + return this.basket.getAll(); + } + + @Override + public Float calculateCurrentItemPrice () { // Is the current item/amount set? if (this.getCurrentItem() == null) { // Current item is null @@ -135,6 +141,15 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl return totalPrice; } + @Override + public Float calculateItemPrice (final AddableBasketItem item) { + // Caculate item's price + Float totalPrice = (item.getProduct().getPrice() * item.getAmount()); + + // Return it + return totalPrice; + } + @Override public Long getAmount () { return this.amount; @@ -243,13 +258,10 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl AddableBasketItem fake = new BasketItem(product); // Get all items - Map map = this.basket.getAll(); + List list = this.basket.getAll(); // Check all entries - for (Map.Entry entrySet : map.entrySet()) { - // Get item - AddableBasketItem item = entrySet.getValue(); - + for (final AddableBasketItem item : list) { // item must not be null if (null == item) { // Abort here diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java index ad81ef88..2f6c212e 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java @@ -17,6 +17,7 @@ package org.mxchange.pizzaapplication.beans.basket; import java.io.Serializable; +import java.util.List; import org.mxchange.jshopcore.model.basket.AddableBasketItem; import org.mxchange.jshopcore.model.product.Product; @@ -93,7 +94,15 @@ public interface BasketWebController extends Serializable { * * @return Current item's total price */ - public Float calculateItemPrice (); + public Float calculateCurrentItemPrice (); + + /** + * Calculates total price (no tax added) for given item. + * + * @param item Item instance to calculate total price for + * @return Total price + */ + public Float calculateItemPrice (final AddableBasketItem item); /** * Getter for last entry @@ -108,4 +117,11 @@ public interface BasketWebController extends Serializable { * @return Last num rows */ public int getLastNumRows (); + + /** + * Gets for all added items + * + * @return A list of all added items + */ + public List allItems (); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java index c37417d8..335ed468 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java @@ -26,9 +26,9 @@ import javax.naming.NamingException; import org.mxchange.jcoreee.beans.BaseFrameworkBean; import org.mxchange.jshopcore.exceptions.CannotAddProductException; import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException; +import org.mxchange.jshopcore.model.product.AdminProductSessionBeanRemote; import org.mxchange.jshopcore.model.product.GenericProduct; import org.mxchange.jshopcore.model.product.Product; -import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote; import org.mxchange.pizzaapplication.beans.controller.ShopWebController; /** @@ -44,7 +44,6 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu * Serial number */ private static final long serialVersionUID = 5_819_375_183_472_871L; - /** * Property available @@ -64,7 +63,7 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu /** * Remote bean for products */ - private final ProductSessionBeanRemote productBean; + private final AdminProductSessionBeanRemote productBean; /** * Shop bean @@ -87,7 +86,7 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu InitialContext context = new InitialContext(); // Try to lookup the bean - this.productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N + this.productBean = (AdminProductSessionBeanRemote) context.lookup("ejb/stateless-admin-product"); //NOI18N } @Override @@ -136,7 +135,7 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu } @Override - public void setId (Long id) { + public void setId (final Long id) { this.id = id; } diff --git a/web/admin/admin_logout.xhtml b/web/admin/admin_logout.xhtml new file mode 100644 index 00000000..708bd900 --- /dev/null +++ b/web/admin/admin_logout.xhtml @@ -0,0 +1,27 @@ + + + + + Ausloggen + + + + + + + Aus dem Adminbereich ausloggen + + + + Offenes TODO. + + + + + + + diff --git a/web/basket.xhtml b/web/basket.xhtml index 184cf2d1..ffe36a04 100644 --- a/web/basket.xhtml +++ b/web/basket.xhtml @@ -6,18 +6,61 @@ > - Warenkorb + Warenkorb anzeigen - Warenkorb + Alle im Warenkorb befindlichen Artikel: - Hier wird der Warenkorb angezeigt. + + + Artikel: + + + #{item.product.title} + + + + + Einzelpreis: + + + + + + + + + + Anzahl ändern: + + + + + + + + + + + + + Zwischensumme: + + + + + + + + diff --git a/web/index.xhtml b/web/index.xhtml index bd72baff..4c3d08db 100644 --- a/web/index.xhtml +++ b/web/index.xhtml @@ -22,51 +22,65 @@ - -
-
- Folgendes kann bestellt werden: -
+
+
+ Folgendes kann bestellt werden:
+
+ + + +
+
+ #{product.title} +
+ +
+
+ + + - - - - - - + + + + + + - - - - - - - + +
+ #{basketController.amount} +
- - - - - - + - - - - - - +
+
+
- - - - - - - +
+ Einzelpreis: + + + +
+ +
+ Zwischensumme: + + + + +
+
+
+
+
diff --git a/web/resources/css/cssLayout.css b/web/resources/css/cssLayout.css index 57d90016..ed37fb5a 100644 --- a/web/resources/css/cssLayout.css +++ b/web/resources/css/cssLayout.css @@ -1,5 +1,5 @@ /** -div { +div, table { border: 1px solid #ff0000; } /**/ @@ -115,7 +115,7 @@ table, .table { ul.footer_nav { text-align: center; - width : 100%; + /*width : 95%;*/ list-style: none; margin: 0px; }