Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 40a6e261
authored
Apr 12, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add possibility for admin to enter product count as number in shop
1 parent
48abfe98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
24 deletions
code/MoyaWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
code/MoyaWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
View file @
40a6e26
...
...
@@ -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>
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
40a6e26
...
...
@@ -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
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
View file @
40a6e26
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment