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 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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
227 additions
and
128 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>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.accountBalance']}"
/>
<br
/>
<h:outputText
value=
"#{productShopView.accountBalance}"
>
<f:convertNumber
/>
</h:outputText>
<h:outputLabel
value=
"#{i18n['shop.totalPrice']}"
/>
<h:outputText
value=
"#{productShopView.totalPrice}"
>
<f:convertNumber
/>
</h:outputText>
<h:outputLabel
value=
"#{i18n['shop.cash']}"
/>
<h:outputLabel
value=
"#{i18n['shop.cash']}"
/>
<h:inputText
value=
"#{productShopView.cash}"
>
<!-- <h:inputText styleClass="inputval" size="5" onblur="calc()" value="#{productShopView.cash}">
<f:ajax
render=
"@form"
event=
"valueChange"
/>
<f:ajax render="@form" event="valueChange" />
<f:convertNumber
/>
</h:inputText> -->
</h:inputText>
<input
type=
"text"
class=
"inputval"
value=
""
size=
"5"
onblur=
"calc()"
/>
<br
/>
<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
/>
</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: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>
...
@@ -148,11 +133,15 @@
...
@@ -148,11 +133,15 @@
$
(
"#shoppingcartform\\:barcode"
).
focus
();
$
(
"#shoppingcartform\\:barcode"
).
focus
();
});
});
function
blip
()
{
function
blip
()
{
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
...
@@ -75,9 +75,9 @@ placegroupview.toptext = \
...
@@ -75,9 +75,9 @@ placegroupview.toptext = \
poll.edit
=
edit
poll.edit
=
edit
product.providedRole
=
Tuote tarjoaa roolin
product.providedRole
=
Tuote tarjoaa roolin
product.returnProductEdit
=
Palaa tuotteeseen:
product.returnProductEdit
=
Palaa tuotteeseen:
product.saved
=
Tuote tallennettu
product.saved
=
Tuote tallennettu
productshop.minusOne
=
-1
productshop.minusOne
=
-1
productshop.minusTen
=
-10
productshop.minusTen
=
-10
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
View file @
0ffb168
...
@@ -392,28 +392,30 @@ poll.end = Close poll
...
@@ -392,28 +392,30 @@ poll.end = Close poll
poll.name
=
Poll name
poll.name
=
Poll name
poll.save
=
Send answers
poll.save
=
Send answers
product.barcode
=
Barcode
product.barcode
=
Barcode
product.billed
=
Billed
product.billed
=
Billed
product.boughtTotal
=
Products billed
product.boughtTotal
=
Products billed
product.cart.count
=
To shoppingcart
product.cart.count
=
To shoppingcart
product.cashed
=
Cashpaid
product.cashed
=
Cashpaid
product.color
=
Color in UI
product.color
=
Color in UI
product.create
=
Create product
product.create
=
Create product
product.createDiscount
=
Add volumediscount
product.createDiscount
=
Add volumediscount
product.edit
=
edit
product.edit
=
edit
product.name
=
Name of product
product.name
=
Name of product
product.paid
=
Paid
product.paid
=
Paid
product.prepaid
=
Prepaid
product.prepaid
=
Prepaid
product.prepaidInstant
=
Created when prepaid is paid
product.prepaidInstant
=
Created when prepaid is paid
product.price
=
Price of product
product.price
=
Price of product
product.save
=
Save
product.save
=
Save
product.shopInstant
=
Create automatic cashpayment
product.shopInstant
=
Create automatic cashpayment
product.sort
=
Sort nr
product.sort
=
Sort nr
product.totalPrice
=
Total
product.totalPrice
=
Total
product.unitName
=
Unit name
product.unitName
=
Unit name
product.vat
=
VAT
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
...
@@ -459,10 +461,21 @@ role.write = (W)
...
@@ -459,10 +461,21 @@ 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.user
=
Selling to
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
sidebar.bill.list
=
My bills
sidebar.bill.list
=
My bills
sidebar.bill.listAll
=
All bills
sidebar.bill.listAll
=
All bills
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
0ffb168
...
@@ -381,28 +381,30 @@ poll.end = Sulje kysely
...
@@ -381,28 +381,30 @@ poll.end = Sulje kysely
poll.name
=
Kyselyn nimi
poll.name
=
Kyselyn nimi
poll.save
=
L
\u
00E4het
\u
00E4 vastauksesi
poll.save
=
L
\u
00E4het
\u
00E4 vastauksesi
product.barcode
=
Viivakoodi
product.barcode
=
Viivakoodi
product.billed
=
Laskutettu
product.billed
=
Laskutettu
product.boughtTotal
=
Tuotteita laskutettu
product.boughtTotal
=
Tuotteita laskutettu
product.cart.count
=
Ostoskoriin
product.cart.count
=
Ostoskoriin
product.cashed
=
Ostettu k
\u
00E4teisell
\u
00E4
product.cashed
=
Ostettu k
\u
00E4teisell
\u
00E4
product.color
=
V
\u
00E4ri k
\u
00E4ytt
\u
00F6liittym
\u
00E4ss
\u
00E4
product.color
=
V
\u
00E4ri k
\u
00E4ytt
\u
00F6liittym
\u
00E4ss
\u
00E4
product.create
=
Luo tuote
product.create
=
Luo tuote
product.createDiscount
=
Lis
\u
00E4
\u
00E4 m
\u
00E4
\u
00E4r
\u
00E4alennus
product.createDiscount
=
Lis
\u
00E4
\u
00E4 m
\u
00E4
\u
00E4r
\u
00E4alennus
product.edit
=
Muokkaa
product.edit
=
Muokkaa
product.name
=
Tuotteen nimi
product.name
=
Tuotteen nimi
product.paid
=
Maksettu
product.paid
=
Maksettu
product.prepaid
=
Prepaid
product.prepaid
=
Prepaid
product.prepaidInstant
=
Luodaan kun prepaid maksetaan
product.prepaidInstant
=
Luodaan kun prepaid maksetaan
product.price
=
Tuotteen hinta
product.price
=
Tuotteen hinta
product.save
=
Tallenna
product.save
=
Tallenna
product.shopInstant
=
Luo k
\u
00E4teismaksu tuotteille
product.shopInstant
=
Luo k
\u
00E4teismaksu tuotteille
product.sort
=
J
\u
00E4rjestys luku
product.sort
=
J
\u
00E4rjestys luku
product.totalPrice
=
Summa
product.totalPrice
=
Summa
product.unitName
=
Tuoteyksikk
\u
00F6
product.unitName
=
Tuoteyksikk
\u
00F6
product.vat
=
ALV
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
...
@@ -445,10 +447,21 @@ role.savePermissions = Tallenna oikeudet
...
@@ -445,10 +447,21 @@ 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.user
=
Myyd
\u
00E4
\u
00E4n
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
sidebar.bill.list
=
Omat laskut
sidebar.bill.list
=
Omat laskut
sidebar.bill.listAll
=
Kaikki laskut
sidebar.bill.listAll
=
Kaikki laskut
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
View file @
0ffb168
...
@@ -189,6 +189,15 @@ public class ProductShopView extends GenericCDIView {
...
@@ -189,6 +189,15 @@ public class ProductShopView extends GenericCDIView {
getTotalPrice
(),
ret
});
getTotalPrice
(),
ret
});
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
;
...
@@ -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