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 22f695bb
authored
Oct 26, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shoppingcart unohtui
1 parent
c8f187d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
154 additions
and
0 deletions
code/LanBortalWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
code/LanBortalWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
0 → 100644
View file @
22f695b
<?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:p=
"http://primefaces.org/ui"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<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.toAccountValue']}"
/>
<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.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"
/>
<br
/>
<h:outputLabel
value=
"#{i18n['shop.']}"
/>
<h:outputText
value=
" #{productShopView.balanceAfterTransaction}"
>
<f:convertNumber
/>
</h:outputText>
<h:commandButton
action=
"#{productShopView.commitShoppingcart()}"
value=
"#{i18n['shop.buy']}"
/>
</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
()
-
$
(
".inputval"
).
text
().
replace
(
","
,
"."
));
}
function
barcodeReadEvent
(
data
)
{
if
(
data
.
status
==
"success"
)
{
$
(
"#shoppingcartform\\:barcode"
).
focus
();
}
}
</script>
</composite:implementation>
</html>
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