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 d32afa3f
authored
Oct 26, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shoppia.
1 parent
84f36402
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
178 deletions
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
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/user/UserView.java
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
View file @
d32afa3
...
...
@@ -2,13 +2,12 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:
products=
"http://java.sun.com/jsf/composite/cditools/products
"
xmlns:p=
"http://primefaces.org/ui"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:
shop=
"http://java.sun.com/jsf/composite/cditools/shop
"
xmlns:p=
"http://primefaces.org/ui"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{userView.initView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.initShopView}"
/>
</f:metadata>
...
...
@@ -17,141 +16,9 @@
<users:usertabs
tabId=
"shop"
/>
</ui:define>
<ui:define
name=
"content"
>
<h:form
id=
"shoppingcartform"
>
<h:panelGrid
columns=
"2"
>
<h:panelGroup>
<div
id=
"shopItems"
>
<ui:repeat
value=
"#{productShopView.shoppingcart}"
var=
"cart"
>
<h:commandLink
styleClass=
"shopItem"
action=
"#{productShopView.addOne}"
>
<f:ajax
render=
"@form"
/>
<div>
#{cart.product.name}
<br
/>
<h:outputText
value=
"#{cart.product.price}"
>
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
</h:outputText>
eur
</div>
</h:commandLink>
</ui:repeat>
</div>
</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}"
var=
"prods"
>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['shop.count']}"
/>
</f:facet>
<p:inplace>
<p:inputText
value=
"#{prods.count}"
size=
"4"
>
<f:ajax
event=
"valueChange"
render=
"@form"
/>
<f:convertNumber
minFractionDigits=
"0"
maxFractionDigits=
"2"
/>
</p:inputText>
</p:inplace>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['shop.product']}"
/>
</f:facet>
<h:outputText
value=
"#{prods.getProduct().name}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['shop.price']}"
/>
</f:facet>
<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>
<h:commandButton
action=
"#{productShopView.removeBought()}"
value=
"Poista"
/>
</p:column>
</p:dataTable>
<div
style=
"font-weight: bold;"
>
<h:outputText
value=
"#{i18n['shop.cartPrice']}"
/>
<h:outputText
id=
"shoptotal"
value=
"#{productShopView.cartPrice}"
>
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
</h:outputText>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.currentBalance']}"
/>
<h:outputText
id=
"currentbalance"
value=
"#{productShopView.accountCredits}"
>
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
</h:outputText>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.transactionTotal']}"
/>
<h:outputText
id=
"transactiontotal"
value=
"#{productShopView.transactionTotal}"
>
<f:convertNumber
maxFractionDigits=
"2"
minFractionDigits=
"2"
/>
</h:outputText>
</div>
<br
/>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.cash']}"
/>
<h:inputText
styleClass=
"inputval"
size=
"5"
value=
"#{productShopView.cash}"
>
<f:ajax
render=
"@form"
event=
"valueChange"
listener=
"#{productShopView.cashChanged}"
/>
</h:inputText>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.cashback']}"
/>
<input
id=
"returnval"
type=
"text"
size=
"5"
value=
"0"
disabled=
"disabled"
/>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.']}"
/>
<h:outputText
value=
" #{productShopView.balanceAfterTransaction}"
>
<f:convertNumber
/>
</h:outputText>
<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:panelGrid>
<h:outputScript
library=
"primefaces"
name=
"jquery/jquery.js"
/>
</h:form>
<script>
var
blipSnd
=
new
Audio
(
"#{request.contextPath}/resources/media/blip.mp3"
)
$
(
function
()
{
$
(
"#shoppingcartform\\:barcode"
).
focus
();
});
function
blip
()
{
blipSnd
.
play
();
}
function
calc
()
{
$
(
"#returnval"
).
val
(
$
(
"#inputval"
).
val
()
-
$
(
"#shoppingcartform\\:totaltransaction"
).
text
().
replace
(
","
,
"."
));
}
function
barcodeReadEvent
(
data
)
{
if
(
data
.
status
==
"success"
)
{
$
(
"#shoppingcartform\\:barcode"
).
focus
();
}
}
</script>
<shop:shoppingcart
/>
</ui:define>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n.properties
View file @
d32afa3
...
...
@@ -119,9 +119,9 @@ placegroupview.toptext = \
poll.edit
=
edit
product.providedRole
=
Tuote tarjoaa roolin
product.returnProductEdit
=
Palaa tuotteeseen:
product.saved
=
Tuote tallennettu
product.providedRole
=
Tuote tarjoaa roolin
product.returnProductEdit
=
Palaa tuotteeseen:
product.saved
=
Tuote tallennettu
productshop.minusOne
=
-1
productshop.minusTen
=
-10
...
...
@@ -136,4 +136,4 @@ resetMail.username = Username
resetmailSent.body
=
Email has been sent containing a link where you can change the password.
resetmailSent.header
=
Email sent
user.unauthenticated
=
Kirjautumaton
user.unauthenticated
=
Kirjautumaton
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
View file @
d32afa3
...
...
@@ -428,27 +428,27 @@ poll.end = Close poll
poll.name
=
Poll name
poll.save
=
Send answers
product.barcode
=
Barcode
product.billed
=
Billed
product.boughtTotal
=
Products billed
product.cart.count
=
To shoppingcart
product.cashed
=
Cashpaid
product.color
=
Color in UI
product.create
=
Create product
product.createDiscount
=
Add volumediscount
product.edit
=
edit
product.name
=
Name of product
product.paid
=
Paid
product.prepaid
=
Prepaid
product.prepaidInstant
=
Created when prepaid is paid
product.price
=
Price of product
product.providedRole
=
Product defines role
product.save
=
Save
product.shopInstant
=
Create automatic cashpayment
product.sort
=
Sort nr
product.totalPrice
=
Total
product.unitName
=
Unit name
product.vat
=
VAT
product.barcode
=
Barcode
product.billed
=
Billed
product.boughtTotal
=
Products billed
product.cart.count
=
To shoppingcart
product.cashed
=
Cashpaid
product.color
=
Color in UI
product.create
=
Create product
product.createDiscount
=
Add volumediscount
product.edit
=
edit
product.name
=
Name of product
product.paid
=
Paid
product.prepaid
=
Prepaid
product.prepaidInstant
=
Created when prepaid is paid
product.price
=
Price of product
product.providedRole
=
Product defines role
product.save
=
Save
product.shopInstant
=
Create automatic cashpayment
product.sort
=
Sort nr
product.totalPrice
=
Total
product.unitName
=
Unit name
product.vat
=
VAT
products.save
=
Save
...
...
@@ -522,6 +522,8 @@ shop.buyCash = Buy by Cash
shop.buyCredit
=
Buy Credit
shop.calcsubtotal
=
Calc Subtotal
shop.cash
=
Cash
shop.cashBack
=
Back
shop.cashGiven
=
Cash given
shop.cashback
=
Cashback
shop.confirmCreditBuy
=
Are You sure ?
shop.count
=
Q
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
d32afa3
...
...
@@ -439,7 +439,7 @@ product.vat = ALV
productShopView.readBarcode
=
Lue viivakoodi
products.save
=
Tallenna
products.save
=
Tallenna
productsShopView.readBarcode
=
Lue
...
...
@@ -508,12 +508,14 @@ shop.buyCash = K\u00E4teismaksu
shop.buyCredit
=
Credit
shop.calcsubtotal
=
Laske v
\u
00E4lisumma
shop.cash
=
K
\u
00E4teinen
shop.cashGiven
=
K
\u
00E4teist
\u
00E4 saatu
shop.cashback
=
Takaisin
shop.confirmCreditBuy
=
Varmastikko ?
shop.count
=
Lkm
shop.price
=
Hinta
shop.product
=
Tuote
shop.readBarcode
=
Lue
shop.toAccountValue
=
Tilille
shop.totalPrice
=
Yhteens
\u
00E4
shop.user
=
Myyd
\u
00E4
\u
00E4n
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
View file @
d32afa3
...
...
@@ -85,10 +85,10 @@ public class UserView extends GenericCDIView {
private
transient
EventBeanLocal
eventbean
;
@EJB
private
transient
CardPrintBeanLocal
cardPrintBean
;
private
File
file
;
private
StreamedContent
streamedFile
;
private
MassPrintResult
mpr
=
null
;
private
boolean
waitForAcceptance
=
false
;
...
...
@@ -114,6 +114,7 @@ public class UserView extends GenericCDIView {
}
else
{
user
=
getCurrentUser
();
}
canSave
=
getCurrentUser
().
equals
(
user
)
||
permbean
.
hasPermission
(
UserPermission
.
MODIFY
);
}
return
user
;
}
...
...
@@ -142,13 +143,13 @@ public class UserView extends GenericCDIView {
// user = userbean.getEventUser(img.getUser());
// croppedImage = null;
if
(
croppedImage
==
null
)
return
null
;
if
(
croppedImage
==
null
)
return
null
;
logger
.
info
(
"Cropped image {}x{}"
,
croppedImage
.
getLeft
(),
croppedImage
.
getTop
());
logger
.
info
(
"Cropped data bytesize {}, type {}"
,
croppedImage
.
getBytes
().
length
,
croppedImage
.
getOriginalFilename
());
try
{
try
{
UserImage
newImage
=
userbean
.
saveCroppedImage
(
user
.
getUser
().
getCurrentImage
(),
croppedImage
.
getLeft
(),
croppedImage
.
getTop
(),
...
...
@@ -160,29 +161,29 @@ public class UserView extends GenericCDIView {
}
return
null
;
}
public
void
prepareCardDownload
()
{
file
=
null
;
try
{
mpr
=
cardPrintBean
.
getUserCardAsPrintablePdf
(
this
.
user
.
getId
());
file
=
File
.
createTempFile
(
"cardprintout"
,
null
);
file
=
File
.
createTempFile
(
"cardprintout"
,
null
);
FileOutputStream
fostream
=
new
FileOutputStream
(
file
);
fostream
.
write
(
mpr
.
getPdf
());
fostream
.
close
();
setStreamedFile
(
new
DefaultStreamedContent
(
new
FileInputStream
(
this
.
file
)));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
e
.
getMessage
()));
}
}
public
String
acceptPrintedCard
()
{
if
(
mpr
!=
null
&&
mpr
.
getAffectedUsers
().
size
()
>
0
)
{
if
(
mpr
!=
null
&&
mpr
.
getAffectedUsers
().
size
()
>
0
)
{
cardPrintBean
.
acceptMassPrintResult
(
mpr
);
return
"accepted"
;
}
else
{
return
"failure"
;
}
}
...
...
@@ -357,7 +358,7 @@ public class UserView extends GenericCDIView {
public
void
raiseWaitForAcceptance
()
{
waitForAcceptance
=
true
;
}
public
boolean
isWaitForAcceptance
()
{
return
waitForAcceptance
;
}
...
...
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