]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Thu, 10 Sep 2015 20:15:37 +0000 (22:15 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 10 Sep 2015 20:15:37 +0000 (22:15 +0200)
- 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>

26 files changed:
install/install.sql [deleted file]
lib/jcore-ee-logger.jar
lib/jcore.jar
lib/jcoreee.jar
lib/jshop-core.jar
lib/jshop-ee-lib.jar
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java
src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java
src/java/org/mxchange/pizzaapplication/beans/controller/ShopWebBean.java
src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java
src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java
web/WEB-INF/faces-config.xml
web/WEB-INF/templates/admin/admin_category_selection_box.tpl
web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl
web/WEB-INF/templates/guest/guest_footer.tpl
web/admin/category.xhtml
web/admin/product.xhtml
web/basket.xhtml [new file with mode: 0644]
web/bye.xhtml
web/index.xhtml
web/item_added.xhtml [new file with mode: 0644]
web/resources/css/cssLayout.css

diff --git a/install/install.sql b/install/install.sql
deleted file mode 100644 (file)
index d4bce3b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-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';
index c65212243809f11f3ffb24a9b60a199155e03c07..6160458d2a2ce3da276e245a39698c4b05cd18cb 100644 (file)
Binary files a/lib/jcore-ee-logger.jar and b/lib/jcore-ee-logger.jar differ
index de27ca6829fa35a86410f5f03fb9631bbd5a801f..00e90e137a26c3f568dd22c4d0d25b25b2c1c88a 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index 935a2c95c4a2c3876bdb5fbc0aa3c28141edb024..3186bb61c16482959c3c7ad77a27adedc3b145e0 100644 (file)
Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ
index 4b07e19ee3c21d6130ea27bfdeeeb563eda320bc..1b9d6e37990a5324cfd9db04abb269ec9d6e85da 100644 (file)
Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ
index f077244855e9b65095a8c2e9c89ad0c0e558305f..268d3525255df6f4dad377467c20025a80c7685f 100644 (file)
Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ
index 4d740b5e6ac6ce7414b3b2d41fbedb49021068e4..ef91ec23931fad60b51572f9cb83f60e1fca0584 100644 (file)
 #
 # 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&uuml;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.
index 99889ee9a5cb74e4b6b20edfb12f080fb005d323..9554539c45a9540761117a192df62e1493c156e7 100644 (file)
@@ -1,26 +1,29 @@
 # 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.
index f2b30cb783745a5a969d5683dd560b3691447642..58697239fb1cfdd032ecaf8db70988ba6f1e0d54 100644 (file)
@@ -16,7 +16,6 @@
  */
 package org.mxchange.pizzaapplication.beans.basket;
 
-import java.rmi.RemoteException;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.faces.FacesException;
@@ -24,10 +23,9 @@ import javax.inject.Named;
 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;
 
@@ -51,9 +49,14 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl
        private final BasketSessionBeanRemote basketBean;
 
        /**
-        * Item basket ("cache")
+        * Ordered amount
         */
-       private final Basket<AddableBasketItem> basket;
+       private Long amount;
+
+       /**
+        * Current item
+        */
+       private AddableBasketItem currentItem;
 
        /**
         * Default constructor
@@ -66,9 +69,16 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl
 
                // 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
@@ -76,16 +86,16 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl
                // 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;
                        }
@@ -95,18 +105,13 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl
                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
@@ -129,4 +134,46 @@ public class BasketWebBean extends BaseFrameworkBean implements BasketWebControl
        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;
+       }
 }
index f014025f6a208a6f1df7c6e0013cfc21353dfceb..72bf7db8a05e5bade570eb03906a160a1470eacc 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.pizzaapplication.beans.basket;
 
 import java.io.Serializable;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
 import org.mxchange.jshopcore.model.product.Product;
 
 /**
@@ -46,4 +47,40 @@ public interface BasketWebController extends Serializable {
         * @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);
 }
index 81e7d0faebd3c9ae19e0cea5cd51a3a4c50a082f..2be39da7f0bf2e84d98aca26305ab009bcf8abb3 100644 (file)
@@ -16,7 +16,7 @@
  */
 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;
@@ -33,7 +33,7 @@ import org.mxchange.jshopcore.model.category.ProductCategory;
  * @author Roland Haeder<roland@mxchange.org>
  */
 @Named("admin_category")
-@SessionScoped
+@RequestScoped
 public class AdminCategoryWebBean extends BaseFrameworkBean implements AdminCategoryWebController {
        /**
         * Serial id
@@ -100,7 +100,7 @@ public class AdminCategoryWebBean extends BaseFrameworkBean implements AdminCate
        }
 
        @Override
-       public void setTitle (final Long parentId) {
+       public void setParentId (final Long parentId) {
                this.parentId = parentId;
        }
 }
index 10e8b5f4b051eb5041caa56c4c38363b99ec5cf1..545550ad2c1fcb2feb5143c5e9411f8fa1777c8d 100644 (file)
@@ -58,5 +58,5 @@ public interface AdminCategoryWebController {
         *
         * @param parentId Parent id to set
         */
-       public void setTitle (final Long parentId);
+       public void setParentId (final Long parentId);
 }
index d2b33be97fc26381e2093a566528f42f07be4238..32eb722f3d496be3e15d924262608c389b7de87d 100644 (file)
@@ -40,6 +40,7 @@ import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
 @Named("controller")
 @SessionScoped
 public class ShopWebBean extends BaseFrameworkBean implements ShopWebController {
+
        /**
         * Serial id
         */
@@ -57,7 +58,7 @@ public class ShopWebBean extends BaseFrameworkBean implements ShopWebController
 
        /**
         * Default constructor
-        * 
+        *
         * @throws javax.naming.NamingException Something happened here?
         */
        public ShopWebBean () throws NamingException {
@@ -86,7 +87,7 @@ public class ShopWebBean extends BaseFrameworkBean implements ShopWebController
                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);
@@ -97,9 +98,13 @@ public class ShopWebBean extends BaseFrameworkBean implements ShopWebController
 
        @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
index c3de01c0b37798beff12eaeea82d9654e818a97c..1e098fd382bdb69a1e5427e01e37463055e2c6d0 100644 (file)
@@ -17,7 +17,7 @@
 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;
@@ -34,7 +34,7 @@ import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
  * @author Roland Haeder<roland@mxchange.org>
  */
 @Named ("admin_product")
-@ApplicationScoped
+@RequestScoped
 public class AdminProductWebBean extends BaseFrameworkBean implements AdminProductWebController {
 
        /**
@@ -51,7 +51,7 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu
        /**
         * Category id
         */
-       private Long categoryId;
+       private Long id;
 
        /**
         * Property price
@@ -89,7 +89,7 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu
 
                        // Add all
                        product.setAvailable(this.getAvailable());
-                       product.setCategoryId(this.getCategoryId());
+                       product.setId(this.getId());
                        product.setPrice(this.getPrice());
                        product.setTitle(this.getTitle());
 
@@ -98,7 +98,7 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu
 
                        // Set all to null
                        this.setAvailable(Boolean.FALSE);
-                       this.setCategoryId(null);
+                       this.setId(null);
                        this.setPrice(null);
                        this.setTitle(null);
                } catch (final ProductTitleAlreadyUsedException ex) {
@@ -119,13 +119,13 @@ public class AdminProductWebBean extends BaseFrameworkBean implements AdminProdu
        }
 
        @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
index 23fc5c65f16594bda30e1769e48361d6b0564a9d..a2ab41677126ecd1e884400f8fab01dd849c7dad 100644 (file)
@@ -89,12 +89,12 @@ public interface AdminProductWebController {
         *
         * @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);
 }
index 24e7d72bbdd33226e4584879c4951025b173e0b1..4a8b5573aa48e399a1ad1a41431b512b58abb194 100644 (file)
                        <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>
index 2ae8997486b2a6063744d1787e9c49447c0d27cf..040e4e7f6fc9770e27b8ca4ebf0e65e4c4a3d1c6 100644 (file)
@@ -4,7 +4,8 @@
        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>
index c3251221fa8dbbc387f3550e4506e3e5f146b29b..7faf2c46730a874b16c76c89e8fee4b023216874 100644 (file)
@@ -4,7 +4,7 @@
        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>
index 6462748197961bfb9a971c76284f488815317842..b2853eac9e7dd95037f916177bdb5befae21a969 100644 (file)
@@ -5,10 +5,11 @@
        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>
 
index 53d8925199c3cd95d0a11dac1be70d395ae2513c..b965c8102ed81171f3f87eadf5cab771d0e975b1 100644 (file)
@@ -22,7 +22,7 @@
                                        <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>
 
@@ -62,7 +62,7 @@
                                                        </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>
index 2d8f6df0875ba81029623f9f291bce61e05e35c3..9e482ad3339d9d14c6c7128746847c0e01cf9491 100644 (file)
                </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>
 
diff --git a/web/basket.xhtml b/web/basket.xhtml
new file mode 100644 (file)
index 0000000..184cf2d
--- /dev/null
@@ -0,0 +1,27 @@
+<?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>
index c8ba5d948db8863d1242c07bf3ba753dc1f03193..b293326beee901dfc283aca5fd8dd776948ebc6a 100644 (file)
@@ -1,49 +1,27 @@
-<%-- 
-       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>
index 05ae23e341c0747852bdf5903e6b7295205f956c..3e50f8c6588e2d9f8740963f9efd2a58a6ef592b 100644 (file)
                                                </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">
diff --git a/web/item_added.xhtml b/web/item_added.xhtml
new file mode 100644 (file)
index 0000000..a80b682
--- /dev/null
@@ -0,0 +1,27 @@
+<?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>
index 27d10449ddcde0f88019fffc7aabd82cfd906ef2..608c94021c93071d33ad5edc7d3e034addc9883d 100644 (file)
@@ -1,3 +1,9 @@
+/**
+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;
@@ -115,16 +115,22 @@ table, .table {
 
 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;