Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
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 0ffb1686
authored
Oct 25, 2012
by
Petri Jarvisalo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uusi kauppanäkymä valmis
1 parent
bbdc6a79
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
173 additions
and
74 deletions
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/general.css
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/handler/SessionHandler.java
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n.properties
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/general.css
View file @
0ffb168
/* General css, use for non-layout purposes for general elements */
/* General css, use for non-layout purposes for general elements */
/* userlistview popup */
/* userlistview popup */
.userdata_popup
{
.userdata_popup
{
position
:
absolute
;
position
:
absolute
;
border
:
1px
solid
black
;
border
:
1px
solid
black
;
background
:
white
;
background
:
white
;
border-radius
:
3px
;
border-radius
:
3px
;
display
:
none
;
display
:
none
;
width
:
300px
;
height
:
150px
;
}
}
/* general class for hoverable usage */
/* general class for hoverable usage */
.hoverable
{
.hoverable
{
}
}
.hidden
{
display
:
none
;
}
#webcamcontainer
{
}
#shopItems
{
}
.ui-panel-title
{
text-overflow
:
clip
;
}
.shopItem
{
float
:
left
;
width
:
72px
;
height
:
72px
;
background
:
burlywood
;
border
:
1px
solid
black
;
margin
:
2px
;
}
a
.shopItem
{
color
:
black
!important
;
}
a
.shopItem
div
{
position
:
absolute
;
height
:
72px
;
width
:
72px
;
text-align
:
center
;
/* Firefox */
display
:
-moz-box
;
-moz-box-orient
:
horizontal
;
-moz-box-pack
:
center
;
-moz-box-align
:
center
;
/* Safari and Chrome */
display
:
-webkit-box
;
-webkit-box-orient
:
horizontal
;
-webkit-box-pack
:
center
;
-webkit-box-align
:
center
;
/* W3C */
display
:
box
;
box-orient
:
horizontal
;
box-pack
:
center
;
box-align
:
center
;
clip
:
rect
(
0
,
72px
,
72px
,
0
);
}
}
a
.shopItem
:hover
{
background
:
darkgoldenrod
;
}
a
.shopItem
:active
{
background
:
red
;
}
\ No newline at end of file
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
View file @
0ffb168
...
@@ -36,7 +36,10 @@
...
@@ -36,7 +36,10 @@
<f:ajax
render=
"@form"
/>
<f:ajax
render=
"@form"
/>
<div>
<div>
#{cart.product.name}
<br
/>
#{cart.product.price}
#{cart.product.name}
<br
/>
<h:outputText
value=
"#{cart.product.price}"
>
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
</h:outputText>
eur
</div>
</div>
</h:commandLink>
</h:commandLink>
</ui:repeat>
</ui:repeat>
...
@@ -45,99 +48,81 @@
...
@@ -45,99 +48,81 @@
</h:panelGroup>
</h:panelGroup>
<h:panelGroup>
<h:panelGroup>
<h:outputLabel
value=
"#{i18n['shop.barcode']}"
/>
<h:inputText
id=
"barcode"
value=
"#{productShopView.barcode}"
/>
<h:commandButton
action=
"#{productShopView.readBarcode}"
onclick=
"blip(); return true;"
value=
"#{i18n['shop.readBarcode']}"
>
<f:ajax
render=
"@form"
onevent=
"barcodeReadEvent"
execute=
"@form"
/>
</h:commandButton>
<br
/>
<p:dataTable
id=
"prods"
value=
"#{productShopView.boughtItems}"
<p:dataTable
id=
"prods"
value=
"#{productShopView.boughtItems}"
var=
"prods"
>
var=
"prods"
>
<p:column>
<p:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:link
value=
"#{i18n['user.nick']}"
includeViewParams=
"true"
>
<h:outputText
value=
"#{i18n['shop.count']}"
/>
</h:link>
</f:facet>
</f:facet>
<h:outputText
value=
"#{prods.count}"
/>
<h:outputText
value=
"#{prods.count}"
/>
</p:column>
</p:column>
<p:column>
<p:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:link
value=
"#{i18n['user.nick']}"
includeViewParams=
"true"
>
<h:outputText
value=
"#{i18n['shop.product']}"
/>
</h:link>
</f:facet>
</f:facet>
<h:outputText
value=
"#{prods.getProduct().name}"
/>
<h:outputText
value=
"#{prods.getProduct().name}"
/>
</p:column>
</p:column>
<p:column>
<p:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:link
value=
"#{i18n['user.nick']}"
includeViewParams=
"true"
>
<h:outputText
value=
"#{i18n['shop.price']}"
/>
</h:link>
</f:facet>
</f:facet>
<h:outputText
value=
"#{prods.getProduct().price}"
/>
<h:outputText
value=
"#{prods.getProduct().price}"
>
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
</h:outputText>
</p:column>
</p:column>
<p:column>
<p:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:link
value=
"#{i18n['user.nick']}"
includeViewParams=
"true"
>
<h:outputText
value=
"#{i18n['shop.actions']}"
/>
</h:link>
</f:facet>
</f:facet>
<h:commandButton
action=
"#{productShopView.removeBought()}"
value=
"Poista"
/>
<h:commandButton
action=
"#{productShopView.removeBought()}"
value=
"Poista"
/>
</p:column>
</p:column>
</p:dataTable>
</p:dataTable>
<h:outputLabel
value=
"#{i18n['shop.readBarcode']}"
/>
<div
style=
"font-weight: bold;"
>
<h:inputText
id=
"barcode"
value=
"#{productShopView.barcode}"
/>
<h:outputText
value=
"#{i18n['shop.totalPrice']}"
/>
<h:commandButton
action=
"#{productShopView.readBarcode}"
<span
class=
"shoptotal"
>
<h:outputText
value=
"#{productShopView.totalPrice}"
>
onclick=
"blip(); return true;"
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
value=
"#{i18n['productShopView.readBarcode']}"
>
</h:outputText></span>
<f:ajax
render=
"@form"
onevent=
"barcodeReadEvent"
execute=
"@form"
/>
</div>
</h:commandButton>
<h:outputLabel
value=
"#{i18n['shop.accountBalance']}"
/>
<br
/>
<h:outputText
value=
"#{productShopView.accountBalance}"
>
<br
/>
<f:convertNumber
/>
<h:outputLabel
value=
"#{i18n['shop.cash']}"
/>
</h:outputText>
<!-- <h:inputText styleClass="inputval" size="5" onblur="calc()" value="#{productShopView.cash}">
<f:ajax render="@form" event="valueChange" />
</h:inputText> -->
<input
type=
"text"
class=
"inputval"
value=
""
size=
"5"
onblur=
"calc()"
/>
<h:outputLabel
value=
"#{i18n['shop.totalPrice']}"
/>
<br
/>
<h:outputText
value=
"#{productShopView.totalPrice}"
>
<h:outputLabel
value=
"#{i18n['shop.cashback']}"
/><input
id=
"returnval"
type=
"text"
size=
"5"
value=
"0"
/>
<input
type=
"button"
value=
"#{i18n['shop.calcsubtotal']}"
onclick=
"calc()"
/>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.accountBalance']}"
/>
<h:outputText
value=
" #{productShopView.accountCredits}"
>
<f:convertNumber
/>
<f:convertNumber
/>
</h:outputText>
</h:outputText>
<br/>
<h:commandButton
action=
"#{productShopView.buyCash()}"
value=
"#{i18n['shop.buyCash']}"
/>
<h:commandButton
action=
"#{productShopView.buyCredit()}"
onclick=
"return confirm('#{i18n['shop.confirmCreditBuy']}');"
value=
"#{i18n['shop.buyCredit']}"
/>
<h:outputLabel
value=
"#{i18n['shop.cash']}"
/>
<h:inputText
value=
"#{productShopView.cash}"
>
<f:ajax
render=
"@form"
event=
"valueChange"
/>
<f:convertNumber
/>
</h:inputText>
</h:panelGroup>
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
<h:outputText
value=
"#{i18n['product.shopInstant']}"
/>
<h:selectBooleanCheckbox
value=
"#{productShopView.payInstant}"
>
<f:ajax
render=
"@form"
execute=
"@form"
/>
</h:selectBooleanCheckbox>
<h:outputScript
library=
"primefaces"
name=
"jquery/jquery.js"
/>
<h:outputScript
library=
"primefaces"
name=
"jquery/jquery.js"
/>
<div
style=
"margin-top: 5px;"
>
<h:commandButton
action=
"#{cc.attrs.commitaction}"
id=
"commitbutton-top"
value=
"#{cc.attrs.commitValue}"
/>
</div>
<div>
<h:outputText
value=
"#{i18n['productshop.total']} "
/>
<h:outputText
value=
"#{productShopView.totalPrice}"
>
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
</h:outputText>
</div>
<h:commandButton
action=
"#{cc.attrs.commitaction}"
id=
"commitbutton-botton"
value=
"#{cc.attrs.commitValue}"
/>
</h:form>
</h:form>
<script>
<script>
...
@@ -153,6 +138,10 @@
...
@@ -153,6 +138,10 @@
blipSnd
.
play
();
blipSnd
.
play
();
}
}
function
calc
()
{
$
(
"#returnval"
).
val
(
$
(
".inputval"
).
val
()
-
$
(
".shoptotal"
).
text
().
replace
(
","
,
"."
));
}
function
barcodeReadEvent
(
data
)
{
function
barcodeReadEvent
(
data
)
{
if
(
data
.
status
==
"success"
)
{
if
(
data
.
status
==
"success"
)
{
$
(
"#shoppingcartform\\:barcode"
).
focus
();
$
(
"#shoppingcartform\\:barcode"
).
focus
();
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/handler/SessionHandler.java
View file @
0ffb168
...
@@ -64,7 +64,7 @@ public class SessionHandler {
...
@@ -64,7 +64,7 @@ public class SessionHandler {
public
String
getLayout
()
{
public
String
getLayout
()
{
// TODO: layout selection code missing!!
// TODO: layout selection code missing!!
template
=
"
template1
"
;
template
=
"
insomnia2
"
;
return
template
;
return
template
;
/*
/*
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n.properties
View file @
0ffb168
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
View file @
0ffb168
...
@@ -415,6 +415,8 @@ product.vat = VAT
...
@@ -415,6 +415,8 @@ product.vat = VAT
products.save
=
Save
products.save
=
Save
productsShopView.readBarcode
=
Read
productshop.billCreated
=
Bill created
productshop.billCreated
=
Bill created
productshop.commit
=
Buy
productshop.commit
=
Buy
productshop.limits
=
Available
productshop.limits
=
Available
...
@@ -459,9 +461,20 @@ role.write = (W)
...
@@ -459,9 +461,20 @@ role.write = (W)
sendPicture.header
=
S
sendPicture.header
=
S
shop.accountBalance
=
Account balance
shop.accountBalance
=
Credits
shop.cash
=
Cash deposit
shop.actions
=
Actions
shop.totalPrice
=
Price of products
shop.barcode
=
Barcode
shop.buyCash
=
Buy by Cash
shop.buyCredit
=
Buy Credit
shop.calcsubtotal
=
Calc Subtotal
shop.cash
=
Cash
shop.cashback
=
Cashback
shop.confirmCreditBuy
=
Are You sure ?
shop.count
=
Q
shop.price
=
price
shop.product
=
Product
shop.readBarcode
=
Read
shop.totalPrice
=
Total
shop.user
=
Selling to
shop.user
=
Selling to
sidebar.bill.list
=
My bills
sidebar.bill.list
=
My bills
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
0ffb168
...
@@ -404,6 +404,8 @@ product.vat = ALV
...
@@ -404,6 +404,8 @@ product.vat = ALV
products.save
=
Tallenna
products.save
=
Tallenna
productsShopView.readBarcode
=
Lue
productshop.billCreated
=
Lasku luotu
productshop.billCreated
=
Lasku luotu
productshop.commit
=
Osta
productshop.commit
=
Osta
productshop.limits
=
Vapaana
productshop.limits
=
Vapaana
...
@@ -445,9 +447,20 @@ role.savePermissions = Tallenna oikeudet
...
@@ -445,9 +447,20 @@ role.savePermissions = Tallenna oikeudet
sendPicture.header
=
L
\u
00E4het
\u
00E4 kuva
sendPicture.header
=
L
\u
00E4het
\u
00E4 kuva
shop.accountBalance
=
Tilin saldo
shop.accountBalance
=
Credits
shop.cash
=
K
\u
00E4teispano
shop.actions
=
Hallinta
shop.totalPrice
=
Tuotteiden hinta
shop.barcode
=
Viivakoodi
shop.buyCash
=
K
\u
00E4teismaksu
shop.buyCredit
=
Credit
shop.calcsubtotal
=
Laske v
\u
00E4lisumma
shop.cash
=
K
\u
00E4teinen
shop.cashback
=
Takaisin
shop.confirmCreditBuy
=
Varmastikko ?
shop.count
=
Lkm
shop.price
=
Hinta
shop.product
=
Tuote
shop.readBarcode
=
Lue
shop.totalPrice
=
Yhteens
\u
00E4
shop.user
=
Myyd
\u
00E4
\u
00E4n
shop.user
=
Myyd
\u
00E4
\u
00E4n
sidebar.bill.list
=
Omat laskut
sidebar.bill.list
=
Omat laskut
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
View file @
0ffb168
...
@@ -190,6 +190,15 @@ public class ProductShopView extends GenericCDIView {
...
@@ -190,6 +190,15 @@ public class ProductShopView extends GenericCDIView {
return
ret
;
return
ret
;
}
}
public
BigDecimal
getAccountCredits
()
{
BigDecimal
ret
=
user
.
getAccountBalance
();
ret
=
ret
.
add
(
getCash
());
logger
.
info
(
"User accountbalance {}, cash{}, total {}. retBalance {}"
,
new
Object
[]
{
user
.
getAccountBalance
(),
getCash
(),
getTotalPrice
(),
ret
});
return
ret
;
}
public
BigDecimal
getTotalPrice
()
{
public
BigDecimal
getTotalPrice
()
{
BigDecimal
ret
=
BigDecimal
.
ZERO
;
BigDecimal
ret
=
BigDecimal
.
ZERO
;
for
(
ProductShopItem
cart
:
shoppingcart
)
{
for
(
ProductShopItem
cart
:
shoppingcart
)
{
...
@@ -225,6 +234,21 @@ public class ProductShopView extends GenericCDIView {
...
@@ -225,6 +234,21 @@ public class ProductShopView extends GenericCDIView {
}
}
public
String
buyCash
()
{
cash
=
getTotalPrice
();
logger
.
info
(
"buying cash {}"
,
cash
);
commitShoppingCart
();
return
null
;
}
public
String
buyCredit
()
{
setCash
(
BigDecimal
.
ZERO
);
commitShoppingCart
();
return
null
;
}
public
String
commitShoppingCart
()
{
public
String
commitShoppingCart
()
{
EventUser
retuser
=
null
;
EventUser
retuser
=
null
;
for
(
ProductShopItem
shopitem
:
shoppingcart
)
{
for
(
ProductShopItem
shopitem
:
shoppingcart
)
{
...
...
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