import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
import org.mxchange.jfinancials.beans.BaseFinancialsBean;
import org.mxchange.jproduct.events.product.AddedProductEvent;
import org.mxchange.jproduct.events.product.ProductAddedEvent;
*/
private Float productGrossPrice;
+ /**
+ * Product's manufacturing/producing company
+ */
+ private BasicData productManufacturer;
+
/**
* Product's net price
*/
@EJB (lookup = "java:global/jfinancials-ejb/adminProduct!org.mxchange.jproduct.model.product.AdminProductSessionBeanRemote")
private AdminProductSessionBeanRemote adminProductBean;
+ /**
+ * General product controller
+ */
+ @Inject
+ private FinancialProductWebRequestController productController;
+
/**
* Product's tax rate
*/
* @throws FaceletException If something unexpected happened
*/
public void addProduct () throws FaceletException {
+ // Is product i18n key already used?
+ if (this.productController.isProductI18nKeyAdded(this.getProductI18nKey())) {
+ // Then throw exception
+ throw new FaceletException("Product i18n key " + this.getProductI18nKey() + " already added.");
+ }
+
// Create product instance
final Product product = this.createProductInstance();
this.productGrossPrice = productGrossPrice;
}
+ /**
+ * Getter for product's manufacturing/producing company
+ * <p>
+ * @return Product's manufacturing/producing company
+ */
+ public BasicData getProductManufacturer () {
+ return this.productManufacturer;
+ }
+
+ /**
+ * Setter for product's manufacturing/producing company
+ * <p>
+ * @param productManufacturer Product's manufacturing/producing company
+ */
+ public void setProductManufacturer (final BasicData productManufacturer) {
+ this.productManufacturer = productManufacturer;
+ }
+
/**
* Getter for product's net price
* <p>
private void clear () {
this.setProductAvailability(Boolean.FALSE);
this.setProductCategory(null);
- this.setProductNetPrice(null);
- this.setProductTaxRate(null);
this.setProductGrossPrice(null);
this.setProductI18nKey(null);
+ this.setProductNetPrice(null);
+ this.setProductManufacturer(null);
+ this.setProductTaxRate(null);
this.setProductUnitAmount(null);
this.setProductUnitType(null);
}
// Set all optional fields
product.setProductNetPrice(this.getProductNetPrice());
+ product.setProductManufacturer(this.getProductManufacturer());
product.setProductTaxRate(this.getProductTaxRate());
product.setProductUnitAmount(this.getProductUnitAmount());
product.setProductUnitType(this.getProductUnitType());
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;
/**
* List for all products
*/
- private List<Product> allProducts;
+ private final List<Product> allProducts;
/**
* List for filtered products
* <p>
* @todo Move this to own controller
*/
- public void afterProductAdded (@Observes final AddedProductEvent event) {
+ public void afterProductAddedEvent (@Observes final AddedProductEvent event) {
// Is all valid?
if (null == event) {
// Throw NPE
throw new IllegalArgumentException(MessageFormat.format("event.addedProduct.productId={0} is not valid.", event.getAddedProduct().getProductId())); //NOI18N
}
- // Is the product available?
- if (event.getAddedProduct().getProductAvailability()) {
- // Add it
- this.allProducts.add(event.getAddedProduct());
- }
+ // Add it
+ this.productCache.put(event.getAddedProduct().getProductId(), event.getAddedProduct());
+ this.allProducts.add(event.getAddedProduct());
}
@Override
throw new NullPointerException("productId is null"); //NOI18N
} else if (productId < 1) {
// Throw IAE
- throw new IllegalArgumentException("productId=" + productId + " is invalid"); //NOI18N
+ throw new IllegalArgumentException("productId=" + productId + " is invalid"); //NOI18N //NOI18N
} else if (!this.productCache.containsKey(productId)) {
// Not found
throw new ProductNotFoundException(productId);
}
}
+ @Override
+ public boolean isProductI18nKeyAdded (final String productI18nKey) {
+ // Validate parameter
+ if (null == productI18nKey) {
+ // Throw NPE
+ throw new NullPointerException("productI18nKey is null"); //NOI18N
+ } else if (productI18nKey.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("productI18nKey is empty"); //NOI18N
+ }
+
+ // Default is not the same
+ boolean isFound = false;
+
+ // Check all added,products
+ for (final Product product : this.allProducts()) {
+ // Is i18n key the same?
+ if (Objects.equals(product.getProductI18nKey(), productI18nKey)) {
+ // Found it
+ isFound = true;
+ break;
+ }
+ }
+
+ // Return flag
+ return isFound;
+ }
+
}
@Local
public interface FinancialProductWebRequestController extends Serializable {
+ /**
+ * Checks whether the given product i18n key has already used.
+ * <p>
+ * @param productI18nKey Product i18n key
+ * <p>
+ * @return Whether the i18n key has been used
+ */
+ boolean isProductI18nKeyAdded (final String productI18nKey);
+
/**
* Some "getter" for a linked list of only available products
* <p>
@EJB (lookup = "java:global/jfinancials-ejb/adminCategory!org.mxchange.jproduct.model.category.AdminCategorySessionBeanRemote")
private AdminCategorySessionBeanRemote categoryBean;
+ /**
+ * General category controller
+ */
+ @Inject
+ private FinancialCategoryWebRequestController categoryController;
+
/**
* Whether this category is shown in statistics
*/
/**
* Adds given category data from request to database
* <p>
- * @throws javax.faces.view.facelets.FaceletException If something
- * unexpected happened
+ * @throws FaceletException If something unexpected happened
*/
public void addCategory () throws FaceletException {
+ // Is i18n key already used?
+ if (this.categoryController.isCategoryI18nKeyAdded(this.getCategoryI18nKey())) {
+ // Throw exception
+ throw new FaceletException("Category i18n key " + this.getCategoryI18nKey() + " is already used.");
+ }
+
// Create category
final Category category = this.createCategoryInstance();
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;
* <p>
* @param event Event to be observed
*/
- public void afterShopCategoryAdded (@Observes final AddedCategoryEvent event) {
+ public void afterCategoryAddedEvent (@Observes final AddedCategoryEvent event) {
// Is all valid?
if (null == event) {
// Throw NPE
}
// Add the category
+ this.categoryCache.put(event.getAddedCategory().getCategoryId(), event.getAddedCategory());
this.allCategories.add(event.getAddedCategory());
}
}
}
+ @Override
+ public boolean isCategoryI18nKeyAdded (final String categoryI18nKey) {
+ // Validate parameter
+ if (null == categoryI18nKey) {
+ // Throw NPE
+ throw new NullPointerException("categoryI18nKey is null"); //NOI18N
+ } else if (categoryI18nKey.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("categoryI18nKey is empty"); //NOI18N
+ }
+
+ // Default is not the same
+ boolean isFound = false;
+
+ // Check all added,products
+ for (final Category category : this.allCategories()) {
+ // Is i18n key the same?
+ if (Objects.equals(category.getCategoryI18nKey(), categoryI18nKey)) {
+ // Found it
+ isFound = true;
+ break;
+ }
+ }
+
+ // Return flag
+ return isFound;
+ }
+
}
*/
Category findCategoryById (final Long categoryId) throws CategoryNotFoundException;
+ /**
+ * Checks whether given category i18n key has already been used.
+ * <p>
+ * @param categoryI18nKey Category i18n key
+ * <p>
+ * @return Whether i18n key is already added
+ * <p>
+ */
+ boolean isCategoryI18nKeyAdded (final String categoryI18nKey);
+
}
@Override
public Product getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (PRODUCT_CONTROLLER == null) {
+ if (null == PRODUCT_CONTROLLER) {
// Get bean from CDI directly
PRODUCT_CONTROLLER = CDI.current().select(FinancialProductWebRequestBean.class).get();
}
@Override
public Category getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
// Is the instance there?
- if (CATEGORY_CONTROLLER == null) {
+ if (null == CATEGORY_CONTROLLER) {
// Get bean from CDI directly
CATEGORY_CONTROLLER = CDI.current().select(FinancialCategoryWebRequestBean.class).get();
}
--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * 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.validator.generic_product;
+
+import java.text.MessageFormat;
+import javax.enterprise.inject.spi.CDI;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.FacesValidator;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jfinancials.beans.generic_product.FinancialProductWebRequestBean;
+import org.mxchange.jfinancials.beans.generic_product.FinancialProductWebRequestController;
+
+/**
+ * A validator for generic products, will fail when product i18n key is already
+ * used.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesValidator (value = "GenericProductValidator")
+public class FinancialsGenericProductValidator extends BaseStringValidator {
+
+ /**
+ * Backing bean for product categories
+ */
+ private static FinancialProductWebRequestController PRODUCT_CONTROLLER;
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 1_086_256_763_716_450L;
+
+ @Override
+ public void validate (final FacesContext context, final UIComponent component, final Object productI18nKey) throws ValidatorException {
+ // The required field
+ final String[] requiredFields = {"categoryI18nKey"}; //NOI18N
+
+ // Pre-validate it
+ super.preValidate(context, component, productI18nKey, requiredFields, Boolean.FALSE);
+
+ // Is the instance there?
+ if (null == PRODUCT_CONTROLLER) {
+ // Then get it from CDI
+ PRODUCT_CONTROLLER = CDI.current().select(FinancialProductWebRequestBean.class).get();
+ }
+
+ // Check, if the name has already been used
+ if (PRODUCT_CONTROLLER.isProductI18nKeyAdded((String) productI18nKey)) {
+ // Create message
+ final String message = MessageFormat.format("I18n key {0} is already used. Please type an other.", productI18nKey);
+
+ // Throw exception
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message));
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * 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.validator.product_category;
+
+import java.text.MessageFormat;
+import javax.enterprise.inject.spi.CDI;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.FacesValidator;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jfinancials.beans.product_category.FinancialCategoryWebRequestBean;
+import org.mxchange.jfinancials.beans.product_category.FinancialCategoryWebRequestController;
+
+/**
+ * A validator for product categories, will fail when category i18n key is
+ * already used.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesValidator(value = "ProductCategoryValidator")
+public class FinancialsProductCategoryValidator extends BaseStringValidator {
+
+ /**
+ * Backing bean for product categories
+ */
+ private static FinancialCategoryWebRequestController CATEGORY_CONTROLLER;
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 1_086_256_763_716_450L;
+
+ @Override
+ public void validate (final FacesContext context, final UIComponent component, final Object categoryI18nKey) throws ValidatorException {
+ // The required field
+ final String[] requiredFields = {"categoryI18nKey"}; //NOI18N
+
+ // Pre-validate it
+ super.preValidate(context, component, categoryI18nKey, requiredFields, Boolean.FALSE);
+
+ // Is the instance there?
+ if (null == CATEGORY_CONTROLLER) {
+ // Then get it from CDI
+ CATEGORY_CONTROLLER = CDI.current().select(FinancialCategoryWebRequestBean.class).get();
+ }
+
+ // Check, if the name has already been used
+ if (CATEGORY_CONTROLLER.isCategoryI18nKeyAdded((String) categoryI18nKey)) {
+ // Create message
+ final String message = MessageFormat.format("I18n key {0} is already used. Please type an other.", categoryI18nKey);
+
+ // Throw exception
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message));
+ }
+ }
+
+}
<from-outcome>admin_delete_generic_product</from-outcome>
<to-view-id>/admin/generic_product/admin_generic_product_delete.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>admin_show_product_category</from-outcome>
+ <to-view-id>/admin/product_category/admin_product_category_show.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
<!--
<factory>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
- xmlns:p="http://primefaces.org/ui">
-
- <ui:fragment rendered="#{empty rendered or rendered}">
- <ul class="navbar-mini">
- <ui:fragment rendered="#{empty renderShowLink or renderShowLink}">
- <li class="navlink-mini">
- <p:link outcome="admin_show_product_category" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_PRODUCT_CATEGORY_TITLE}">
- <f:param name="categoryId" value="#{category.categoryId}" />
- </p:link>
- </li>
- </ui:fragment>
-
- <li class="navlink-mini">
- <p:link outcome="admin_edit_product_category" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_PRODUCT_CATEGORY_TITLE}">
- <f:param name="categoryId" value="#{category.categoryId}" />
- </p:link>
- </li>
-
- <li class="navlink-mini">
- <p:link outcome="admin_delete_product_category">
- <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_PRODUCT_CATEGORY_TITLE}" />
- <f:param name="categoryId" value="#{category.categoryId}" />
- </p:link>
- </li>
- </ul>
- </ui:fragment>
-</ui:composition>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+ xmlns:p="http://primefaces.org/ui">
+
+ <ui:fragment rendered="#{empty rendered or rendered}">
+ <ul class="navbar-mini">
+ <ui:fragment rendered="#{empty renderShowLink or renderShowLink}">
+ <li class="navlink-mini">
+ <p:link outcome="admin_show_generic_product" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_GENERIC_PRODUCT_TITLE}">
+ <f:param name="productId" value="#{product.productId}" />
+ </p:link>
+ </li>
+ </ui:fragment>
+
+ <li class="navlink-mini">
+ <p:link outcome="admin_edit_generic_product" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_GENERIC_PRODUCT_TITLE}">
+ <f:param name="productId" value="#{product.productId}" />
+ </p:link>
+ </li>
+
+ <li class="navlink-mini">
+ <p:link outcome="admin_delete_generic_product">
+ <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_GENERIC_PRODUCT_TITLE}" />
+ <f:param name="productId" value="#{product.productId}" />
+ </p:link>
+ </li>
+ </ul>
+ </ui:fragment>
+</ui:composition>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
- xmlns:p="http://primefaces.org/ui">
-
- <ui:fragment rendered="#{empty rendered or rendered}">
- <ul class="navbar-mini">
- <ui:fragment rendered="#{empty renderShowLink or renderShowLink}">
- <li class="navlink-mini">
- <p:link outcome="admin_show_product" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_GENERIC_PRODUCT_TITLE}">
- <f:param name="productId" value="#{product.productId}" />
- </p:link>
- </li>
- </ui:fragment>
-
- <li class="navlink-mini">
- <p:link outcome="admin_edit_product" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_GENERIC_PRODUCT_TITLE}">
- <f:param name="productId" value="#{product.productId}" />
- </p:link>
- </li>
-
- <li class="navlink-mini">
- <p:link outcome="admin_delete_product">
- <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_GENERIC_PRODUCT_TITLE}" />
- <f:param name="productId" value="#{product.productId}" />
- </p:link>
- </li>
- </ul>
- </ui:fragment>
-</ui:composition>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+ xmlns:p="http://primefaces.org/ui">
+
+ <ui:fragment rendered="#{empty rendered or rendered}">
+ <ul class="navbar-mini">
+ <ui:fragment rendered="#{empty renderShowLink or renderShowLink}">
+ <li class="navlink-mini">
+ <p:link outcome="admin_show_product_category" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_PRODUCT_CATEGORY_TITLE}">
+ <f:param name="categoryId" value="#{category.categoryId}" />
+ </p:link>
+ </li>
+ </ui:fragment>
+
+ <li class="navlink-mini">
+ <p:link outcome="admin_edit_product_category" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_PRODUCT_CATEGORY_TITLE}">
+ <f:param name="categoryId" value="#{category.categoryId}" />
+ </p:link>
+ </li>
+
+ <li class="navlink-mini">
+ <p:link outcome="admin_delete_product_category">
+ <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_PRODUCT_CATEGORY_TITLE}" />
+ <f:param name="categoryId" value="#{category.categoryId}" />
+ </p:link>
+ </li>
+ </ul>
+ </ui:fragment>
+</ui:composition>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- @TODO Hard-coded values below -->
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+ xmlns:p="http://primefaces.org/ui">
+
+ <p:panelGrid layout="grid" columns="3" columnClasses="ui-grid-col-5,ui-grid-col-2,ui-grid-col-5" styleClass="table table-full ui-noborder" rendered="#{empty rendered or rendered == true}">
+ <p:outputLabel for="productNetPrice" value="#{project.ENTER_NET_PRICE}" />
+
+ <p:outputLabel for="productTaxRate" value="#{project.ENTER_TAX_RATE}" />
+
+ <p:outputLabel for="productGrossPrice" value="#{project.ENTER_GROSS_PRICE}" />
+
+ <p:inputNumber
+ id="productNetPrice"
+ title="#{project.ENTER_PRODUCT_NET_PRICE_TITLE}"
+ value="#{targetController.productNetPrice}"
+ symbol=" EUR"
+ symbolPosition="s"
+ decimalSeparator=","
+ thousandSeparator="."
+ >
+ </p:inputNumber>
+
+ <p:inputNumber
+ id="productTaxRate"
+ title="#{project.ENTER_PRODUCT_TAX_RATE_TITLE}"
+ value="#{targetController.productTaxRate}"
+ symbol="%"
+ symbolPosition="s"
+ thousandSeparator="."
+ decimalSeparator=","
+ emptyValue="sign"
+ >
+ <f:validateDoubleRange minimum="0" maximum="100" />
+ </p:inputNumber>
+
+ <p:inputNumber
+ id="productGrossPrice"
+ title="#{project.ENTER_PRODUCT_GROSS_PRICE_TITLE}"
+ value="#{targetController.productGrossPrice}"
+ symbol=" EUR"
+ symbolPosition="s"
+ decimalSeparator=","
+ thousandSeparator="."
+ required="true"
+ requiredMessage="#{project.PRODUCT_GROSS_PRICE_REQUIRED}"
+ >
+ </p:inputNumber>
+ </p:panelGrid>
+</ui:composition>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!-- @TODO Hard-coded values below -->
-<ui:composition
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
- xmlns:p="http://primefaces.org/ui">
-
- <p:panelGrid layout="grid" columns="3" columnClasses="ui-grid-col-5,ui-grid-col-2,ui-grid-col-5" styleClass="table table-full ui-noborder" rendered="#{empty rendered or rendered == true}">
- <p:outputLabel for="productNetPrice" value="#{project.ENTER_NET_PRICE}" />
-
- <p:outputLabel for="productTaxRate" value="#{project.ENTER_TAX_RATE}" />
-
- <p:outputLabel for="productGrossPrice" value="#{project.ENTER_GROSS_PRICE}" />
-
- <p:inputNumber
- id="productNetPrice"
- title="#{project.ENTER_PRODUCT_NET_PRICE_TITLE}"
- value="#{targetController.productNetPrice}"
- symbol=" EUR"
- symbolPosition="s"
- decimalSeparator=","
- thousandSeparator="."
- >
- </p:inputNumber>
-
- <p:inputNumber
- id="productTaxRate"
- title="#{project.ENTER_PRODUCT_TAX_RATE_TITLE}"
- value="#{targetController.productTaxRate}"
- symbol="%"
- symbolPosition="s"
- thousandSeparator="."
- decimalSeparator=","
- emptyValue="sign"
- >
- <f:validateDoubleRange minimum="0" maximum="100" />
- </p:inputNumber>
-
- <p:inputNumber
- id="productGrossPrice"
- title="#{project.ENTER_PRODUCT_GROSS_PRICE_TITLE}"
- value="#{targetController.productGrossPrice}"
- symbol=" EUR"
- symbolPosition="s"
- decimalSeparator=","
- thousandSeparator="."
- required="true"
- requiredMessage="#{project.PRODUCT_GROSS_PRICE_REQUIRED}"
- >
- </p:inputNumber>
- </p:panelGrid>
-</ui:composition>
required="true"
requiredMessage="#{project.ADMIN_PRODUCT_I18N_KEY_REQUIRED}"
title="#{project.ADMIN_ENTER_PRODUCT_I18N_KEY_TITLE}"
- />
+ validatorMessage="#{project.ADMIN_ENTERED_PRODUCT_I18N_KEY_ALREADY_ADDED}"
+ >
+ <f:validator validatorId="GenericProductValidator" />
+ </p:inputText>
+
+ <p:outputLabel for="productManufacturer" value="#{project.ADMIN_ASSIGN_PRODUCT_MANUFACTURER}" />
+ <p:selectOneMenu
+ id="productManufacturer"
+ value="#{adminProductController.productManufacturer}"
+ filter="true"
+ filterMatchMode="contains"
+ title="#{project.ADMIN_ASSIGN_PRODUCT_MANUFACTURER_TITLE}"
+ >
+ <f:converter converterId="BasicCompanyDataConverter" />
+ <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
+ <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ </p:selectOneMenu>
<p:outputLabel for="productAvailability" value="#{project.ADMIN_ENABLE_PRODUCT_AVAILABILITY}" />
<p:selectBooleanCheckbox
required="true"
requiredMessage="#{project.ADMIN_CATEGORY_I18N_KEY_REQUIRED}"
title="#{project.ADMIN_ENTER_CATEGORY_I18N_KEY_TITLE}"
- />
+ validatorMessage="#{project.ADMIN_ENTERED_CATEGORY_I18N_KEY_ALREADY_ADDED}"
+ >
+ <f:validator validatorId="ProductCategoryValidator" />
+ </p:inputText>
<p:outputLabel for="categoryShownInStatistics" value="#{project.ADMIN_ENABLE_CATEGORY_IN_STATISTICS}" />
<p:selectBooleanCheckbox