Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e999a1c9
authored
Oct 24, 2013
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Random fixes..
1 parent
22894aca
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
40 deletions
code/MoyaWeb/WebContent/resources/cditools/reader/readerevents.xhtml
code/MoyaWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/FoodWaveFoodView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
code/MoyaWeb/src/fi/codecrew/moya/web/helper/LayoutView.java
code/MoyaWeb/WebContent/resources/cditools/reader/readerevents.xhtml
View file @
e999a1c
...
...
@@ -58,16 +58,15 @@
<f:param
name=
"eventid"
value=
"#{event.id}"
/>
</h:link>
<!--
<h: link rendered="#{!empty event.printedCard} AND !empty cc.attrs.linkoutcome
" outcome="/shop/shopToUser" value="#{i18n['readerevent.shopToUser']}">
<h:link
rendered=
"#{!empty event.printedCard }
"
outcome=
"/shop/shopToUser"
value=
"#{i18n['readerevent.shopToUser']}"
>
<f:param
name=
"userid"
value=
"#{event.printedCard.user.user.id}"
/>
</h:link>
<h:commandButton action="#{cc.attrs.commitaction}" id="commitbutton-botton" value="#{cc.attrs.commitValue}" />
<h:link
rendered=
"#{empty event.printedCard}"
outcome=
"/shop/assocToUser"
value=
"#{i18n['readerevent.associateToUser']}"
>
<f:param
name=
"eventid"
value=
"#{event.id}"
/>
</h:link>
-->
</h:link>
</h:column>
</h:dataTable>
...
...
code/MoyaWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
View file @
e999a1c
<?xml version='1.0' encoding='UTF-8' ?>
<!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"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:composite=
"http://java.sun.com/jsf/composite"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:reader=
"http://java.sun.com/jsf/composite/cditools/reader"
xmlns:p=
"http://primefaces.org/ui"
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:composite=
"http://java.sun.com/jsf/composite"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:reader=
"http://java.sun.com/jsf/composite/cditools/reader"
xmlns:p=
"http://primefaces.org/ui"
>
>
<composite:interface>
</composite:interface>
<composite:interface>
</composite:interface>
<composite:implementation>
<composite:implementation>
<h:form
id=
"shoppingcartform"
>
<h:form
id=
"shoppingcartform"
>
<h:panelGrid
columns=
"2"
style=
"width:100%;"
columnClasses=
"shopProductbuttons,topalign"
>
<h:panelGroup>
...
...
@@ -97,24 +92,24 @@
</div>
<h:panelGrid
columns=
"2"
>
<h:panelGrid
columns=
"2"
>
<h:outputLabel
value=
"#{i18n['shop.toAccountValue']}"
/>
<h:inputText
styleClass=
"inputval"
size=
"5"
value=
"#{productShopView.cash}"
>
<f:ajax
render=
"@form"
event=
"valueChange"
listener=
"#{productShopView.cashChanged}"
/>
</h:inputText>
</h:panelGrid>
<h:outputLabel
value=
"#{i18n['shop.cashGiven']}"
/>
<input
id=
"returnval"
type=
"text"
size=
"5"
value=
"0"
disabled=
"disabled"
/>
<h:outputLabel
value=
"#{i18n['shop.cashBack']}"
/>
<input
id=
"returnval"
type=
"text"
size=
"5"
value=
"0"
disabled=
"disabled"
/>
<p:commandButton
update=
"@form"
action=
"#{productShopView.buyByCredit()}"
value=
"#{i18n['shop.buyByCredit']}"
/>
<h:panelGrid
columns=
"2"
style=
"background-color: #{productShopView.balanceAfterTransaction lt 0?'lightcoral':'lightgreen'}"
>
<h:outputLabel
value=
"#{i18n['shop.afterBalance']}"
/>
<h:outputText
value=
"
#{productShopView.balanceAfterTransaction}"
>
<f:convertNumber
/>
<h:outputText
value=
"
#{productShopView.balanceAfterTransaction}"
>
<f:convertNumber
minFractionDigits=
"2"
maxFractionDigits=
"2"
/>
</h:outputText>
</h:panelGrid>
<h:commandButton
action=
"#{productShopView.commitShoppingCart()}"
value=
"#{i18n['shop.buy']}"
/>
<p:commandButton
ajax=
"false"
action=
"#{productShopView.commitShoppingCart()}"
value=
"#{i18n['shop.buy']}"
/>
</h:panelGroup>
</h:panelGrid>
...
...
@@ -136,11 +131,11 @@
}
function
calc
()
{
$
(
"#returnval"
).
val
(
$
(
"#inputval"
).
val
()
-
$
(
".inputval"
).
text
().
replace
(
","
,
"."
));
$
(
"#returnval"
).
val
(
$
(
"#inputval"
).
val
()
-
$
(
".inputval"
).
text
().
replace
(
","
,
"."
));
}
function
barcodeReadEvent
(
data
)
{
if
(
data
.
status
==
"success"
)
{
$
(
"[id$=shoppingcartform\\:barcode]"
).
focus
();
...
...
@@ -149,6 +144,6 @@
</script>
</composite:implementation>
</composite:implementation>
</html>
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
e999a1c
...
...
@@ -827,6 +827,7 @@ shop.actions = Actions
shop.afterBalance
=
Balance after action
shop.barcode
=
Barcode
shop.buy
=
Buy
shop.buyByCredit
=
Buy by credit
shop.buyCash
=
Buy by Cash
shop.buyCredit
=
Buy Credit
shop.calcsubtotal
=
Calc Subtotal
...
...
@@ -842,6 +843,7 @@ shop.price = price
shop.product
=
Product
shop.readBarcode
=
Read
shop.shop
=
Shop
shop.shoppingcartCommitted
=
Products bought
shop.totalPrice
=
Total
shop.transactionTotal
=
Transaction total
shop.user
=
Selling to
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
e999a1c
...
...
@@ -810,6 +810,7 @@ shop.actions = Hallinta
shop.afterBalance
=
Saldo tapahtuman j
\u
00E4lkeen
shop.barcode
=
Viivakoodi
shop.buy
=
Osta
shop.buyByCredit
=
Maksa krediiteill
\u
00E4.
shop.buyCash
=
K
\u
00E4teismaksu
shop.buyCredit
=
Credit
shop.calcsubtotal
=
Laske v
\u
00E4lisumma
...
...
@@ -824,6 +825,7 @@ shop.currentBalance = T\u00E4m\u00E4nhetkinen saldo
shop.price
=
Hinta
shop.product
=
Tuote
shop.readBarcode
=
Lue
shop.shoppingcartCommitted
=
Tuotteet ostettu
shop.toAccountValue
=
Tilille
shop.totalPrice
=
Yhteens
\u
00E4
shop.transactionTotal
=
Tapahtuma yhteens
\u
00E4
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/FoodWaveFoodView.java
View file @
e999a1c
...
...
@@ -132,7 +132,6 @@ public class FoodWaveFoodView extends GenericCDIView {
* @return
*/
public
Bill
createBillFromShoppingcart
()
{
logger
.
warn
(
"Committing shoppingcart for user {}, userid {}"
,
userview
.
getSelectedUser
().
getWholeName
());
Bill
bill
=
new
Bill
(
eventBean
.
getCurrentEvent
(),
userview
.
getSelectedUser
());
bill
.
setOurReference
(
eventBean
.
getCurrentEvent
().
getName
());
...
...
@@ -141,11 +140,11 @@ public class FoodWaveFoodView extends GenericCDIView {
bill
.
addProduct
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
getFoodWave
());
}
}
logger
.
warn
(
"Committing shoppingcart for user {}. Cart prize: {}"
,
userview
.
getSelectedUser
().
getWholeName
(),
bill
.
getTotalPrice
());
billBean
.
createBill
(
bill
);
// TODO: do this right way
// TODO: do this the right way
eventBean
.
flushCache
();
return
bill
;
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
View file @
e999a1c
...
...
@@ -84,6 +84,13 @@ public class ProductShopView extends GenericCDIView {
private
boolean
allowStatistics
=
true
;
private
String
otherInfo
;
public
String
buyByCredit
()
{
cash
=
BigDecimal
.
ZERO
;
payInstant
=
false
;
return
null
;
}
public
void
initBillView
()
{
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
)
&&
shoppingcart
==
null
)
{
...
...
@@ -136,8 +143,7 @@ public class ProductShopView extends GenericCDIView {
updateCartLimits
(
null
);
LanEventProperty
cashdefault
=
eventbean
.
getProperty
(
LanEventPropertyKey
.
SHOP_DEFAULT_CASH
);
if
(
cashdefault
==
null
||
cashdefault
.
isBooleanValue
())
{
if
(
cashdefault
==
null
||
cashdefault
.
isBooleanValue
())
{
payInstant
=
true
;
}
...
...
@@ -292,7 +298,7 @@ public class ProductShopView extends GenericCDIView {
addFaceMessage
(
"productshop.billCreated"
);
cash
=
BigDecimal
.
ZERO
;
shoppingcart
=
null
;
b
illEditView
.
setBill
(
bill
)
;
b
oughtItems
=
null
;
return
"showCreatedBill"
;
...
...
@@ -314,21 +320,21 @@ public class ProductShopView extends GenericCDIView {
EventUser
retuser
=
null
;
for
(
ProductShopItem
shopitem
:
shoppingcart
)
{
if
(
shopitem
.
getCount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
retuser
=
productBean
.
createAccountEvent
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
user
).
getUser
();
retuser
=
productBean
.
createAccountEvent
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
user
).
getUser
();
}
}
if
(
cash
!=
null
&&
cash
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
Product
credProd
=
productBean
.
findCreditProduct
();
retuser
=
productBean
.
createAccountEvent
(
credProd
,
cash
,
user
)
.
getUser
();
retuser
=
productBean
.
createAccountEvent
(
credProd
,
cash
,
user
).
getUser
();
}
if
(
retuser
!=
null
)
{
user
=
retuser
;
}
shoppingcart
=
null
;
boughtItems
=
null
;
cash
=
BigDecimal
.
ZERO
;
super
.
addFaceMessage
(
"shop.shoppingcartCommitted"
);
return
null
;
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/helper/LayoutView.java
View file @
e999a1c
...
...
@@ -94,7 +94,12 @@ public class LayoutView {
}
public
String
getPagepath
()
{
if
(
pagename
==
null
)
{
if
(
pagename
==
null
&&
context
!=
null
&&
context
.
getExternalContext
()
!=
null
&&
context
.
getExternalContext
().
getRequest
()
!=
null
&&
context
.
getExternalContext
().
getRequest
()
instanceof
HttpServletRequest
)
{
HttpServletRequest
req
=
(
HttpServletRequest
)
context
.
getExternalContext
().
getRequest
();
String
[]
splitted
=
req
.
getServletPath
().
split
(
"\\."
);
if
(
splitted
.
length
>
0
)
{
...
...
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