Commit 40a6e261 by Tuomas Riihimäki

Add possibility for admin to enter product count as number in shop

1 parent 48abfe98
......@@ -40,35 +40,27 @@
<br />
<p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.count']}" />
</f:facet>
<p:inplace>
<h:outputText value="#{prods.count}" size="4">
<f:convertNumber minFractionDigits="0" maxFractionDigits="2" />
</h:outputText>
</p:inplace>
<p:column headerText="#{i18n['shop.count']}">
<p:inputText value="#{prods.count}" size="2">
<f:ajax render="@form" listener="#{productShopView.countBoughtChangeListener}" />
<f:convertNumber minFractionDigits="0" maxFractionDigits="2" />
</p:inputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.product']}" />
</f:facet>
<p:column headerText="#{i18n['shop.product']}">
<h:outputText value="#{prods.getProduct().name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.price']}" />
</f:facet>
<p:column headerText="#{i18n['shop.price']}">
<h:outputText value="#{prods.getProduct().price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.actions']}" />
</f:facet>
<p:column headerText="#{i18n['shop.totalPrice']}">
<h:outputText value="#{prods.price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</p:column>
<p:column headerText="#{i18n['shop.actions']}">
<p:commandButton action="#{productShopView.removeBought()}" update="@form" onerror="location.reload(true);" value="Poista" />
</p:column>
</p:dataTable>
......
......@@ -860,6 +860,7 @@ shop.product = Product
shop.readBarcode = Read
shop.shop = Shop
shop.shoppingcartCommitted = Products bought
shop.toAccountValue = To account
shop.totalPrice = Total
shop.transactionTotal = Transaction total
shop.user = Selling to
......
......@@ -9,7 +9,6 @@ import java.util.Map;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.model.ListDataModel;
import javax.inject.Inject;
import javax.inject.Named;
......@@ -163,10 +162,16 @@ public class ProductShopView extends GenericCDIView {
}
}
public void countChangeListener(AjaxBehaviorEvent e)
public void countBoughtChangeListener()
{
ProductShopItem item = boughtItems.getRowData();
psiHelper.setProductShopItemCount(item, item.getCount());
updateCartLimits(item);
}
public void countChangeListener()
{
ProductShopItem item = shoppingcart.getRowData();
logger.info("Count change from event {}, src {}, from item {}", e, e.getSource(), item.getCount());
psiHelper.setProductShopItemCount(item, item.getCount());
updateCartLimits(item);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!