]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 6 Apr 2018 21:35:58 +0000 (23:35 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Apr 2018 21:35:58 +0000 (23:35 +0200)
- added list and user bean for receipt items, need to have this for having
  "working" (at least partly) paginator+filter+sorting on a p:dataTable tag
- also prepared listing of receipt items for clicking on a row to have a
  p:dialog shown up with all details, yet still unfinished
- removed no longer used i18n key

Signed-off-by: Roland Häder <roland@mxchange.org>
15 files changed:
src/java/org/mxchange/jfinancials/beans/financial/model/income/FinancialsIncomeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt/FinancialAdminReceiptWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt/FinancialsReceiptWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/FinancialAdminReceiptItemWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/FinancialsReceiptItemWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/FinancialsReceiptItemWebRequestController.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionController.java [new file with mode: 0644]
src/java/org/mxchange/localization/project_de_DE.properties
src/java/org/mxchange/localization/project_en_US.properties
web/WEB-INF/templates/admin/financial/receipt_item/admin_form_financial_receipt_item.tpl
web/admin/financial/receipt/admin_receipt_list.xhtml
web/admin/financial/receipt_item/admin_receipt_item_list.xhtml

index c02bcf3b842ad19d23c0c15948004be9ec19d5d5..a0a4629a4adcfc7b32cd384d44f2a4a03dc43bd8 100644 (file)
@@ -82,10 +82,8 @@ public class FinancialsIncomeWebRequestBean extends BaseFinancialsBean implement
 
        /**
         * Adds income data by calling proper business method of the EJB.
-        * <p>
-        * @return Redirect outcome
         */
-       public String addIncome () {
+       public void addIncome () {
                // Is all data valid?
                if (!this.userLoginController.isUserLoggedIn()) {
                        // Not logged-in
@@ -113,9 +111,6 @@ public class FinancialsIncomeWebRequestBean extends BaseFinancialsBean implement
                // Handle it over to the EJB
                // @TODO Use updated income instance, e.g. fire event
                final BillableIncome updatedIncome = this.financialBean.addIncome(income);
-
-               // All fine
-               return "add_user_fiancial_income"; //NOI18N
        }
 
        /**
index 150cc03bae5dd68a808b19bb8198dd595d745fc5..30621c301ccad528b49c491ce4d82e0fdaf9a65a 100644 (file)
@@ -134,9 +134,8 @@ public class FinancialAdminReceiptWebRequestBean extends BaseFinancialsBean impl
         * Adds the completed receipt to database by calling an EJB business method.
         * If not all required fields are set, a proper exception is being thrown.
         * <p>
-        * @return Link outcome
         */
-       public String addReceipt () {
+       public void addReceipt () {
                // Are all required fields set?
                if (this.getReceiptBranchOffice() == null) {
                        // Is not set
@@ -181,9 +180,6 @@ public class FinancialAdminReceiptWebRequestBean extends BaseFinancialsBean impl
 
                // Clear bean
                this.clear();
-
-               // Return redirect outcome
-               return ""; //NOI18N
        }
 
        /**
index f829942b675c4c909baf60440b725d6cd279a69f..15b4ad5448aeb9c70fa9c3d0bf5cdf3899cf01d4 100644 (file)
@@ -125,9 +125,8 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsBean implemen
         * Adds the completed receipt to database by calling an EJB business method.
         * If not all required fields are set, a proper exception is being thrown.
         * <p>
-        * @return Link outcome
         */
-       public String addReceipt () {
+       public void addReceipt () {
                // Are all required fields set?
                if (!this.userLoginController.isUserLoggedIn()) {
                        // Not logged-in
@@ -175,9 +174,6 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsBean implemen
 
                // Clear bean
                this.clear();
-
-               // Return redirect outcome
-               return "admin_list_receipts?faces-redirect=true"; //NOI18N
        }
 
        /**
index b114fafca34d59adf7cc497de1959b2155f76f56..79c9607f28294f0cda9514a71afe969b712f949c 100644 (file)
@@ -27,6 +27,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.financial.model.receipt_item.list.FinancialsReceiptItemListWebViewController;
 import org.mxchange.jfinancials.events.receipt_item.added.ObservableReceiptItemAddedEvent;
 import org.mxchange.jfinancials.events.receipt_item.added.ReceiptItemAddedEvent;
 import org.mxchange.jfinancials.exceptions.receipt_item.ReceiptItemAlreadyAddedException;
@@ -129,10 +130,10 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
        private BigDecimal productTaxRate;
 
        /**
-        * General receipt item controller
+        * Receipt item list controller
         */
        @Inject
-       private FinancialsReceiptItemWebRequestController receiptItemController;
+       private FinancialsReceiptItemListWebViewController receiptItemListController;
 
        /**
         * Default constructor
@@ -147,16 +148,15 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
         * method. If not all required fields are set, a proper exception is being
         * thrown.
         * <p>
-        * @return Link outcome
         */
-       public String addReceiptItem () {
+       public void addReceiptItem () {
                // Are all required fields set?
 
                // Prepare receipt item instance
                final BillableReceiptItem receiptItem = this.createReceiptItemInstance();
 
                // Is the receipt already there?
-               if (this.receiptItemController.isReceiptItemAdded(receiptItem)) {
+               if (this.receiptItemListController.isReceiptItemAdded(receiptItem)) {
                        // Receipt has already been added
                        throw new FaceletException(MessageFormat.format("Receipt for itemReceipt.receiptId={0},itemProduct.productId={1},itemProductQuantity={2} has already been added.", receiptItem.getItemReceipt().getReceiptId(), receiptItem.getItemProduct().getProductId(), receiptItem.getItemProductQuantity())); //NOI18N
                }
@@ -178,9 +178,6 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
 
                // Clear bean
                this.clear();
-
-               // Return redirect outcome
-               return ""; //NOI18N
        }
 
        /**
index 8bdb93a027e39f6a7d910344d61174916984ea6a..0321e87ee9588b47512948767a561075b15bce5b 100644 (file)
  */
 package org.mxchange.jfinancials.beans.financial.model.receipt_item;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
-import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.financial.model.receipt_item.list.FinancialsReceiptItemListWebViewController;
 import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
 import org.mxchange.jfinancials.events.receipt_item.added.ObservableReceiptItemAddedEvent;
 import org.mxchange.jfinancials.events.receipt_item.added.ReceiptItemAddedEvent;
@@ -41,7 +33,6 @@ import org.mxchange.jfinancials.exceptions.receipt_item.ReceiptItemAlreadyAddedE
 import org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem;
 import org.mxchange.jfinancials.model.receipt_item.FinancialReceiptItem;
 import org.mxchange.jfinancials.model.receipt_item.FinancialReceiptItemSessionBeanRemote;
-import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
 
 /**
  * A general financial receipt item bean (controller)
@@ -64,16 +55,6 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
        @Any
        private Event<ObservableReceiptItemAddedEvent> addedReceiptItemEvent;
 
-       /**
-        * All receipt items list
-        */
-       private final List<BillableReceiptItem> allReceiptItems;
-
-       /**
-        * Filtered receipt items list
-        */
-       private List<BillableReceiptItem> filteredReceiptItems;
-
        /**
         * EJB for general financial receipt purposes
         */
@@ -81,11 +62,10 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
        private FinancialReceiptItemSessionBeanRemote receiptItemBean;
 
        /**
-        * A list of all branch offices (globally)
+        * Receipt item list controller
         */
        @Inject
-       @NamedCache (cacheName = "receiptItemCache")
-       private Cache<Long, BillableReceiptItem> receiptItemCache;
+       private FinancialsReceiptItemListWebViewController receiptItemListController;
 
        /**
         * User instance
@@ -93,11 +73,6 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
        @Inject
        private FinancialsUserLoginWebSessionController userLoginController;
 
-       /**
-        * User's receipt items
-        */
-       private final List<BillableReceiptItem> userReceiptItems;
-
        /**
         * Constructor
         */
@@ -105,19 +80,15 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
        public FinancialsReceiptItemWebRequestBean () {
                // Call super constructor
                super();
-
-               // Init lists
-               this.allReceiptItems = new LinkedList<>();
-               this.userReceiptItems = new LinkedList<>();
        }
 
        /**
-        * Adds the completed receipt item to database by calling an EJB business method.
-        * If not all required fields are set, a proper exception is being thrown.
+        * Adds the completed receipt item to database by calling an EJB business
+        * method. If not all required fields are set, a proper exception is being
+        * thrown.
         * <p>
-        * @return Link outcome
         */
-       public String addReceiptItem () {
+       public void addReceiptItem () {
                // Are all required fields set?
                if (!this.userLoginController.isUserLoggedIn()) {
                        // Not logged-in
@@ -128,7 +99,7 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
                final BillableReceiptItem receiptItem = this.createReceiptInstance();
 
                // Is the receipt already there?
-               if (this.isReceiptItemAdded(receiptItem)) {
+               if (this.receiptItemListController.isReceiptItemAdded(receiptItem)) {
                        // Receipt has already been added
                        throw new FaceletException(MessageFormat.format("Receipt for itemReceipt.receiptId={0},itemProduct.productId={1},itemProductQuantity={2} has already been added.", receiptItem.getItemReceipt().getReceiptId(), receiptItem.getItemProduct().getProductId(), receiptItem.getItemProductQuantity())); //NOI18N
                }
@@ -150,138 +121,6 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
 
                // Clear bean
                this.clear();
-
-               // Return redirect outcome
-               return "admin_list_receipt_items?faces-redirect=true"; //NOI18N
-       }
-
-       /**
-        * Observes events being fired when a new receipt item has been added
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAddedReceiptItemEvent (@Observes final ObservableReceiptItemAddedEvent event) {
-               // Validate parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               }
-
-               // Add to cache and general list
-               this.receiptItemCache.put(event.getReceiptItem().getItemId(), event.getReceiptItem());
-               this.allReceiptItems.add(event.getReceiptItem());
-
-               // Is same user?
-               if (this.userLoginController.isUserLoggedIn() && Objects.equals(event.getReceiptItem().getItemReceipt().getReceiptUser(), this.userLoginController.getLoggedInUser())) {
-                       // Same user, then add it
-                       this.userReceiptItems.add(event.getReceiptItem());
-               }
-       }
-
-       /**
-        * Event observer for logged-in user
-        * <p>
-        * @param event Event instance
-        */
-       public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getLoggedInUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.loggedInUser is null"); //NOI18N
-               } else if (event.getLoggedInUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.loggedInUser.userId is null"); //NOI18N
-               } else if (event.getLoggedInUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
-               }
-
-               // Fill cache with all found user's receipts
-               for (final BillableReceiptItem receiptItem : this.allReceiptItems) {
-                       // Is same user?
-                       if (Objects.equals(receiptItem.getItemReceipt().getReceiptUser(), event.getLoggedInUser())) {
-                               // Yes, then add it
-                               this.userReceiptItems.add(receiptItem);
-                       }
-               }
-       }
-
-       /**
-        * Returns all receipt items
-        * <p>
-        * @return All receipt items
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BillableReceiptItem> allReceiptItems () {
-               return this.allReceiptItems;
-       }
-
-       /**
-        * Getter for filtered receipt items
-        * <p>
-        * @return Filtered receipts
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BillableReceiptItem> getFilteredReceiptItems () {
-               return this.filteredReceiptItems;
-       }
-
-       /**
-        * Setter for filtered receipt items
-        * <p>
-        * @param filteredReceiptItems Filtered receipt items
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredReceiptItems (final List<BillableReceiptItem> filteredReceiptItems) {
-               this.filteredReceiptItems = filteredReceiptItems;
-       }
-
-       @PostConstruct
-       public void initCache () {
-               // Is cache there?
-               if (!this.receiptItemCache.iterator().hasNext()) {
-                       // Get whole list
-                       final List<BillableReceiptItem> receiptItems = this.receiptItemBean.allReceiptItems();
-
-                       // Add all
-                       for (final BillableReceiptItem receiptItem : receiptItems) {
-                               // Add it to cache
-                               this.receiptItemCache.put(receiptItem.getItemId(), receiptItem);
-                       }
-               }
-
-               // Is the list empty, but filled cache?
-               if (this.allReceiptItems.isEmpty() && this.receiptItemCache.iterator().hasNext()) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, BillableReceiptItem>> iterator = this.receiptItemCache.iterator();
-
-                       // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, BillableReceiptItem> next = iterator.next();
-
-                               // Add to list
-                               this.allReceiptItems.add(next.getValue());
-                       }
-
-                       // Sort list
-                       this.allReceiptItems.sort(new Comparator<BillableReceiptItem>() {
-                               @Override
-                               public int compare (final BillableReceiptItem o1, final BillableReceiptItem o2) {
-                                       return o1.getItemId() > o2.getItemId() ? 1 : o1.getItemId() < o2.getItemId() ? -1 : 0;
-                               }
-                       }
-                       );
-               }
-       }
-
-       @Override
-       public boolean isReceiptItemAdded (final BillableReceiptItem receiptItem) {
-               // Always trust the cache
-               return this.allReceiptItems.contains(receiptItem);
        }
 
        /**
@@ -292,7 +131,8 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
        }
 
        /**
-        * Returns a fully created receipt item instance (except primary key, of course)
+        * Returns a fully created receipt item instance (except primary key, of
+        * course)
         * <p>
         * @return Receipt item instance
         */
@@ -302,8 +142,8 @@ public class FinancialsReceiptItemWebRequestBean extends BaseFinancialsBean impl
                final BillableReceiptItem receiptItem = new FinancialReceiptItem();
 
                // Set optional fields
-
                // Return it
                return receiptItem;
        }
+
 }
index aaa3bb033ee2e2cf7a6079c6f2ff6e48469fd08c..d988bece82f8f1f5414dc8b9543af2ca2b56bfa4 100644 (file)
@@ -17,7 +17,6 @@
 package org.mxchange.jfinancials.beans.financial.model.receipt_item;
 
 import java.io.Serializable;
-import org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem;
 
 /**
  * An administrative interface for financial receipt item beans
@@ -26,13 +25,4 @@ import org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem;
  */
 public interface FinancialsReceiptItemWebRequestController extends Serializable {
 
-       /**
-        * Checks if receipt item has already been added to database
-        * <p>
-        * @param receiptItem Prepared receipt item instance
-        * <p>
-        * @return Whether the receipt item has already been added
-        */
-       boolean isReceiptItemAdded (final BillableReceiptItem receiptItem);
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewBean.java
new file mode 100644 (file)
index 0000000..caf9b54
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2016 - 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.financial.model.receipt_item.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
+import org.mxchange.jfinancials.events.receipt_item.added.ObservableReceiptItemAddedEvent;
+import org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem;
+import org.mxchange.jfinancials.model.receipt_item.FinancialReceiptItemSessionBeanRemote;
+import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
+
+/**
+ * A list financial receipt item bean (controller)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("receiptItemListController")
+@ViewScoped
+public class FinancialsReceiptItemListWebViewBean extends BaseFinancialsBean implements FinancialsReceiptItemListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 56_189_028_928_472L;
+
+       /**
+        * All receipt items list
+        */
+       private final List<BillableReceiptItem> allReceiptItems;
+
+       /**
+        * Filtered receipt items list
+        */
+       private List<BillableReceiptItem> filteredReceiptItems;
+
+       /**
+        * EJB for general financial receipt purposes
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/financialReceiptItem!org.mxchange.jfinancials.model.receipt_item.FinancialReceiptItemSessionBeanRemote")
+       private FinancialReceiptItemSessionBeanRemote receiptItemBean;
+
+       /**
+        * A list of all branch offices (globally)
+        */
+       @Inject
+       @NamedCache (cacheName = "receiptItemCache")
+       private transient Cache<Long, BillableReceiptItem> receiptItemCache;
+
+       /**
+        * Selected receipt item
+        */
+       private BillableReceiptItem selectedReceiptItem;
+
+       /**
+        * User instance
+        */
+       @Inject
+       private FinancialsUserLoginWebSessionController userLoginController;
+
+       /**
+        * User's receipt items
+        */
+       private final List<BillableReceiptItem> userReceiptItems;
+
+       /**
+        * Constructor
+        */
+       @SuppressWarnings ("CollectionWithoutInitialCapacity")
+       public FinancialsReceiptItemListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init lists
+               this.allReceiptItems = new LinkedList<>();
+               this.userReceiptItems = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when a new receipt item has been added
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAddedReceiptItemEvent (@Observes final ObservableReceiptItemAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               }
+
+               // Add to cache and general list
+               this.receiptItemCache.put(event.getReceiptItem().getItemId(), event.getReceiptItem());
+               this.getAllReceiptItems().add(event.getReceiptItem());
+
+               // Is same user?
+               if (this.userLoginController.isUserLoggedIn() && Objects.equals(event.getReceiptItem().getItemReceipt().getReceiptUser(), this.userLoginController.getLoggedInUser())) {
+                       // Same user, then add it
+                       this.userReceiptItems.add(event.getReceiptItem());
+               }
+       }
+
+       /**
+        * Event observer for logged-in user
+        * <p>
+        * @param event Event instance
+        */
+       public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
+               // event should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getLoggedInUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.loggedInUser is null"); //NOI18N
+               } else if (event.getLoggedInUser().getUserId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.loggedInUser.userId is null"); //NOI18N
+               } else if (event.getLoggedInUser().getUserId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
+               }
+
+               // Fill cache with all found user's receipts
+               for (final BillableReceiptItem receiptItem : this.allReceiptItems) {
+                       // Is same user?
+                       if (Objects.equals(receiptItem.getItemReceipt().getReceiptUser(), event.getLoggedInUser())) {
+                               // Yes, then add it
+                               this.userReceiptItems.add(receiptItem);
+                       }
+               }
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<BillableReceiptItem> getAllReceiptItems () {
+               return this.allReceiptItems;
+       }
+
+       /**
+        * Getter for filtered receipt items
+        * <p>
+        * @return Filtered receipts
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<BillableReceiptItem> getFilteredReceiptItems () {
+               return this.filteredReceiptItems;
+       }
+
+       /**
+        * Setter for filtered receipt items
+        * <p>
+        * @param filteredReceiptItems Filtered receipt items
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredReceiptItems (final List<BillableReceiptItem> filteredReceiptItems) {
+               this.filteredReceiptItems = filteredReceiptItems;
+       }
+
+       /**
+        * Getter for selected receipt item
+        * <p>
+        * @return Selected receipt item
+        */
+       public BillableReceiptItem getSelectedReceiptItem () {
+               return this.selectedReceiptItem;
+       }
+
+       /**
+        * Setter for selected receipt item
+        * <p>
+        * @param selectedReceiptItem Selected receipt item
+        */
+       public void setSelectedReceiptItem (final BillableReceiptItem selectedReceiptItem) {
+               this.selectedReceiptItem = selectedReceiptItem;
+       }
+
+       @PostConstruct
+       public void initCache () {
+               // Is cache there?
+               if (!this.receiptItemCache.iterator().hasNext()) {
+                       // Get whole list
+                       final List<BillableReceiptItem> receiptItems = this.receiptItemBean.allReceiptItems();
+
+                       // Add all
+                       for (final BillableReceiptItem receiptItem : receiptItems) {
+                               // Add it to cache
+                               this.receiptItemCache.put(receiptItem.getItemId(), receiptItem);
+                       }
+               }
+
+               // Is the list empty, but filled cache?
+               if (this.getAllReceiptItems().isEmpty() && this.receiptItemCache.iterator().hasNext()) {
+                       // Get iterator
+                       final Iterator<Cache.Entry<Long, BillableReceiptItem>> iterator = this.receiptItemCache.iterator();
+
+                       // Build up list
+                       while (iterator.hasNext()) {
+                               // GEt next element
+                               final Cache.Entry<Long, BillableReceiptItem> next = iterator.next();
+
+                               // Add to list
+                               this.getAllReceiptItems().add(next.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllReceiptItems().sort(new Comparator<BillableReceiptItem>() {
+                               @Override
+                               public int compare (final BillableReceiptItem o1, final BillableReceiptItem o2) {
+                                       return o1.getItemId() > o2.getItemId() ? 1 : o1.getItemId() < o2.getItemId() ? -1 : 0;
+                               }
+                       }
+                       );
+               }
+       }
+
+       @Override
+       public boolean isReceiptItemAdded (final BillableReceiptItem receiptItem) {
+               // Always trust the cache
+               return this.getAllReceiptItems().contains(receiptItem);
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewController.java
new file mode 100644 (file)
index 0000000..e94c69a
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 - 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.financial.model.receipt_item.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem;
+
+/**
+ * An administrative interface for financial receipt item list beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsReceiptItemListWebViewController extends Serializable {
+
+       /**
+        * Checks if receipt item has already been added to database
+        * <p>
+        * @param receiptItem Prepared receipt item instance
+        * <p>
+        * @return Whether the receipt item has already been added
+        */
+       boolean isReceiptItemAdded (final BillableReceiptItem receiptItem);
+
+       /**
+        * Returns all receipt items
+        * <p>
+        * @return All receipt items
+        */
+       List<BillableReceiptItem> getAllReceiptItems ();
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionBean.java
new file mode 100644 (file)
index 0000000..3b4f025
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2016 - 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.financial.model.receipt_item.user;
+
+import java.text.MessageFormat;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.financial.model.receipt_item.list.FinancialsReceiptItemListWebViewController;
+import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
+import org.mxchange.jfinancials.events.receipt_item.added.ObservableReceiptItemAddedEvent;
+import org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem;
+import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
+
+/**
+ * A list financial receipt item bean (controller)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("receiptItemUserController")
+@ViewScoped
+public class FinancialsReceiptItemUserWebSessionBean extends BaseFinancialsBean implements FinancialsReceiptItemUserWebSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 56_189_028_928_572L;
+
+       /**
+        * Receipt item list controller
+        */
+       @Inject
+       private FinancialsReceiptItemListWebViewController receiptItemListController;
+
+       /**
+        * User instance
+        */
+       @Inject
+       private FinancialsUserLoginWebSessionController userLoginController;
+
+       /**
+        * User's receipt items
+        */
+       private final List<BillableReceiptItem> userReceiptItems;
+
+       /**
+        * Constructor
+        */
+       @SuppressWarnings ("CollectionWithoutInitialCapacity")
+       public FinancialsReceiptItemUserWebSessionBean () {
+               // Call super constructor
+               super();
+
+               // Init lists
+               this.userReceiptItems = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when a new receipt item has been added
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAddedReceiptItemEvent (@Observes final ObservableReceiptItemAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               }
+
+               // Is same user?
+               if (this.userLoginController.isUserLoggedIn() && Objects.equals(event.getReceiptItem().getItemReceipt().getReceiptUser(), this.userLoginController.getLoggedInUser())) {
+                       // Same user, then add it
+                       this.userReceiptItems.add(event.getReceiptItem());
+               }
+       }
+
+       /**
+        * Event observer for logged-in user
+        * <p>
+        * @param event Event instance
+        */
+       public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
+               // event should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getLoggedInUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.loggedInUser is null"); //NOI18N
+               } else if (event.getLoggedInUser().getUserId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.loggedInUser.userId is null"); //NOI18N
+               } else if (event.getLoggedInUser().getUserId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
+               }
+
+               // Fill cache with all found user's receipts
+               for (final BillableReceiptItem receiptItem : this.receiptItemListController.getAllReceiptItems()) {
+                       // Is same user?
+                       if (Objects.equals(receiptItem.getItemReceipt().getReceiptUser(), event.getLoggedInUser())) {
+                               // Yes, then add it
+                               this.userReceiptItems.add(receiptItem);
+                       }
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionController.java
new file mode 100644 (file)
index 0000000..4726924
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 - 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.financial.model.receipt_item.user;
+
+import java.io.Serializable;
+
+/**
+ * An administrative interface for financial receipt item user beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsReceiptItemUserWebSessionController extends Serializable {
+
+}
index c74c277b8abda6b2a57dde2e6718e8c3c1cbb25d..adaec546ffee18dc248a2ea7273d896ef650b32d 100644 (file)
@@ -93,7 +93,6 @@ CONTENT_TITLE_ADMIN_FINANCIALS_RECEIPT_ITEM_LIST=Artikel auflisten:
 TABLE_SUMMARY_ADMIN_LIST_RECEIPT_ITEMS=Diese Tabelle listet alle eingetragenen Artikel auf.
 #@TODO Please fix German umlauts!
 ADMIN_EMPTY_LIST_RECEIPT_ITEM=Es befinden sich keine Artikel in der Datenbank. Oder Ihre Suche ergab keine Uebereinstimmungen.
-ADMIN_LIST_RECEIPT_ITEMS_HEADER=Alle Artikel auflisten
 ADMIN_ASSIGNED_ITEM_RECEIPT=Zugewiesener Kassenbon:
 ADMIN_ASSIGNED_ITEM_PRODUCT=Zugewiesenes Produkt:
 #@TODO Please fix German umlauts!
@@ -325,3 +324,14 @@ RECEIPT_BARCODE_TITLE=Streifencode des Kassenbons.
 RECEIPT_SEQUENCE_NUMBER_HEADER=Durchlaufende Nummer:
 RECEIPT_SEQUENCE_NUMBER_TITLE=Durchlaufende Nummer des Kassenbons.
 RECEIPT_PAYMENT_TYPE_TITLE=Bezahlungsart des Kassenbons.
+PAGE_TITLE_ADMIN_SHOW_GENERIC_PRODUCT=Produkt anzeigen
+CONTENT_TITLE_ADMIN_SHOW_GENERIC_PRODUCT=Produkt anzeigen:
+PAGE_TITLE_ADMIN_GENERIC_PRODUCT_EDIT=Produkt editieren
+CONTENT_TITLE_ADMIN_GENERIC_PRODUCT_EDIT=Produkt editieren:
+#@TODO Please fix German umlauts!
+PAGE_TITLE_ADMIN_GENERIC_PRODUCT_DELETE=Produkt loeschen
+#@TODO Please fix German umlauts!
+CONTENT_TITLE_ADMIN_GENERIC_PRODUCT_DELETE=Produkt loeschen:
+ERROR_PARAMETER_PRODUCT_ID_NOT_SET=Fehler: Produkt-Id nicht gesetzt (Parameter: productId).
+#@TODO Please fix German umlauts!
+PARAMETER_PRODUCT_ID_INVALID=Parameter "productId" ist ungueltig.
index 964894def99b5b1b0708f916702a50b1332d9059..1f7e04de222e7d191e9305cbf42f8df48a428987 100644 (file)
@@ -68,7 +68,6 @@ PAGE_TITLE_ADMIN_FINANCIALS_RECEIPT_ITEM_LIST=List receipt items
 CONTENT_TITLE_ADMIN_FINANCIALS_RECEIPT_ITEM_LIST=List receipt items:
 TABLE_SUMMARY_ADMIN_LIST_RECEIPT_ITEMS=This table lists all registered receipt items.
 ADMIN_EMPTY_LIST_RECEIPT_ITEM=There are no receipt items in database. Or your search criteria doesn't match anything.
-ADMIN_LIST_RECEIPT_ITEMS_HEADER=List all receipt items
 ADMIN_ASSIGNED_ITEM_RECEIPT=Assigned item's receipt:
 ADMIN_ASSIGNED_ITEM_PRODUCT=Assigned product:
 ADMIN_ADD_RECEIPT_ITEM_TITLE=Add new receipt item
@@ -239,3 +238,11 @@ RECEIPT_BARCODE_TITLE=Barcode of receipt.
 RECEIPT_SEQUENCE_NUMBER_HEADER=Sequence number:
 RECEIPT_SEQUENCE_NUMBER_TITLE=Sequence number of receipt.
 RECEIPT_PAYMENT_TYPE_TITLE=Payment type of receipt.
+PAGE_TITLE_ADMIN_SHOW_GENERIC_PRODUCT=Show product
+CONTENT_TITLE_ADMIN_SHOW_GENERIC_PRODUCT=Show product:
+PAGE_TITLE_ADMIN_GENERIC_PRODUCT_EDIT=Edit product
+CONTENT_TITLE_ADMIN_GENERIC_PRODUCT_EDIT=Edit product:
+PAGE_TITLE_ADMIN_GENERIC_PRODUCT_DELETE=Delete product
+CONTENT_TITLE_ADMIN_GENERIC_PRODUCT_DELETE=Delete product:
+ERROR_PARAMETER_PRODUCT_ID_NOT_SET=Error: Product Id is not set (parameter: productId).
+PARAMETER_PRODUCT_ID_INVALID=Parameter "productId" is invalid.
index 598c637e7495b037fbd0b78a52016b0f7726bba0..8cbb7ab98065abd15f478bf28eccb463f050ce86 100644 (file)
@@ -41,7 +41,7 @@
                                >
                                <f:converter converterId="GenericProductConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
-                               <f:selectItems value="#{productListController.allProducts}" var="product" itemValue="#{product}" itemLabel="#{beanHelper.renderGenericProduct(product)}" />
+                               <f:selectItems value="#{productListController.allProducts}" var="product" itemValue="#{product}" itemLabel="#{productBeanHelper.renderGenericProduct(product)}" />
                        </p:selectOneMenu>
 
                        <p:outputLabel for="itemManufacturer" value="#{project.SELECT_RECEIPT_ITEM_MANUFACTURER}" />
index f3ba86d726838d3154e0f69f6744d161ca065c0f..b3be305213f6b447f17955689664c76b5690cc7e 100644 (file)
                        </p:dialog>
                </h:form>
 
-               <h:form>
+               <h:form id="form-add-receipt">
                        <p:panelGrid layout="grid" columns="1" styleClass="table table-full">
                                <h:panelGroup styleClass="table-header" layout="block">
                                        <h4>
index 1f94db7ff237ae0b27ab2f78fb7fcff5189edc0f..16967d3328d6b69439d847e2a5ca57013dd68ac4 100644 (file)
        </ui:define>
 
        <ui:define name="content">
-               <h:form id="form-list-financial-receipt-item">
+               <h:form id="form-list-financial-receipt-items">
                        <p:dataTable
                                id="receiptItemList"
                                var="receiptItem"
-                               value="#{receiptItemController.allReceiptItems()}"
-                               filteredValue="#{receiptItemController.filteredReceiptItems}"
+                               value="#{receiptItemListController.allReceiptItems}"
                                tableStyleClass="table table-full"
-                               rows="10"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
+                               filteredValue="#{receiptItemListController.filteredReceiptItems}"
+                               rows="10"
+                               rowKey="#{receiptItem.itemId}"
                                reflow="true"
                                resizableColumns="true"
                                rowsPerPageTemplate="5,10,20,50,100"
                                summary="#{project.TABLE_SUMMARY_ADMIN_LIST_RECEIPT_ITEMS}"
                                emptyMessage="#{project.ADMIN_EMPTY_LIST_RECEIPT_ITEM}"
                                widgetVar="receiptItemList"
+                               selectionMode="single"
+                               selection="#{receiptItemListController.selectedReceiptItem}"
+                               skipChildren="true"
                                >
 
                                <f:facet name="header">
-                                       <p:panelGrid columns="2" columnClasses="ui-grid-col-10,ui-grid-col-2" layout="grid" styleClass="ui-noborder ui-transparent-widget">
-                                               <h:outputText value="#{project.ADMIN_LIST_RECEIPT_ITEMS_HEADER}" />
+                                       <p:panelGrid columns="3" layout="grid" columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2">
+                                               <p:spacer />
 
-                                               <h:panelGroup>
+                                               <p:panelGrid columns="2" columnClasses="ui-grid-4,ui-grid-8" layout="grid" styleClass="table table-full ui-noborder">
+                                                       <p:outputLabel for="globalFilter" value="#{msg.SEARCH_ALL_FIELDS}" style="float: right" />
+                                                       <p:inputText id="globalFilter" onkeyup="PF('receiptItemList').filter()" placeholder="#{msg.ENTER_KEYWORD}"/>
+                                               </p:panelGrid>
+
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
                                                        <p:commandButton id="toggler" type="button" value="#{msg.SELECT_SHOWN_COLUMNS}" styleClass="column-selector" />
                                                        <p:columnToggler datasource="receiptItemList" trigger="toggler" />
-                                               </h:panelGroup>
-                                       </p:panelGrid >
+                                               </p:outputPanel>
+                                       </p:panelGrid>
                                </f:facet>
 
+                               <p:ajax
+                                       event="rowSelect"
+                                       update=":master:form-list-financial-receipt-items:receipt-item-details"
+                                       oncomplete="PF('receiptItemDialog').show()"
+                                       />
+
                                <p:column headerText="#{msg.ID_NUMBER_HEADER}" sortBy="#{receiptItem.itemId}" filterBy="#{receiptItem.itemId}">
                                        <p:link outcome="admin_show_receipt_item" title="#{project.ADMIN_LINK_SHOW_RECEIPT_ITEM_TITLE}" value="#{receiptItem.itemId}">
                                                <f:param name="receiptId" value="#{receiptItem.itemId}" />
                                                        title="#{project.FILTER_BY_MULTIPLE_ITEM_PRODUCTS_TITLE}"
                                                        >
                                                        <f:converter converterId="GenericProductConverter" />
-                                                       <f:selectItems value="#{productListController.allProducts}" var="product" itemValue="#{product}" itemLabel="#{beanHelper.renderGenericProduct(product)}" />
+                                                       <f:selectItems value="#{productListController.allProducts}" var="product" itemValue="#{product}" itemLabel="#{productBeanHelper.renderGenericProduct(product)}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
-                                       <p:link outcome="admin_show_generic_product" title="#{project.ADMIN_LINK_SHOW_RECEIPT_ITEM_PRODUCT_TITLE}" value="#{beanHelper.renderGenericProduct(receiptItem.itemProduct)}">
+                                       <p:link outcome="admin_show_generic_product" title="#{project.ADMIN_LINK_SHOW_RECEIPT_ITEM_PRODUCT_TITLE}" value="#{productBeanHelper.renderGenericProduct(receiptItem.itemProduct)}">
                                                <f:param name="productId" value="#{receiptItem.itemProduct.productId}" />
                                        </p:link>
                                </p:column>
                                                        filter="true"
                                                        filterMatchMode="contains"
                                                        label="#{msg.LABEL_COMPANIES}"
-                                                       onchange="PF('itemList').filter()"
+                                                       onchange="PF('receiptItemList').filter()"
                                                        updateLabel="true"
                                                        title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
                                                        >
                                        <pl:outputReceiptItemAdminMiniLinks receiptItem="#{receiptItem}" />
                                </p:column>
                        </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{project.ADMIN_SINGLE_RECEIPT_ITEM_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="receiptItemDialog"
+                               position="center,center"
+                               responsive="true"
+                               >
+                               <p:outputPanel id="receipt-item-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty receiptItemListController.selectedReceiptItem}" columnClasses="label,value">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{project.ADMIN_RECEIPT_DETAILS_HEADER}">
+                                                               <f:param value="#{receiptItemListController.selectedReceiptItem.itemId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_NUMBER_HEADER}" title="#{project.RECEIPT_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{receiptItemListController.selectedReceiptItem.itemId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
                </h:form>
 
-               <h:form>
+               <h:form id="form-add-receipt-item">
                        <p:panelGrid layout="grid" columns="1" styleClass="table table-full">
                                <h:panelGroup styleClass="table-header" layout="block">
                                        <h4>
                                                type="submit"
                                                value="#{project.BUTTON_ADMIN_ADD_RECEIPT_TEM}"
                                                action="#{adminReceiptItemController.addReceiptItem()}"
-                                               update=":master:form-list-financial-receipt-item:receiptItemList"
+                                               update=":master:form-list-financial-receipt-items:receiptItemList"
                                                />
                                </p:panelGrid>
                        </p:panelGrid>