shop.xhtml
3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?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">
<composite:interface>
<composite:attribute name="items" required="true" />
<composite:attribute name="commitValue" required="true" />
<composite:attribute name="commitaction" method-signature="java.lang.String action()" required="true" />
</composite:interface>
<composite:implementation>
<!-- <h:outputScript target="head" library="script" name="jquery.min.js" /> -->
<!-- <h:outputScript target="head" library="script" name="shopscript.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>
<h:dataTable styleClass="bordertable" id="billcart" value="#{cc.attrs.items}" var="cart">
<h:column>
<f:facet name="header">
<h:outputText id="name" value="${i18n['product.name']}" />
</f:facet>
<h:outputText value="#{cart.product.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.price']}" />
</f:facet>
<h:outputText id="price" value="#{cart.product.price.abs()}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.totalPrice']}" />
</f:facet>
<h:outputText id="total" value="#{cart.price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText id="count" value="${i18n['product.cart.count']}" />
</f:facet>
<h:commandButton action="#{foodShopView.addMinusTen}" value="#{i18n['productshop.minusTen']}">
<f:ajax render="@form" />
</h:commandButton>
<h:commandButton action="#{foodShopView.addMinusOne}" value="#{i18n['productshop.minusOne']}">
<f:ajax render="@form" />
</h:commandButton>
<h:inputText size="4" id="cartcount" value="#{cart.count}">
<f:ajax render="@form" event="valueChange" />
</h:inputText>
<h:commandButton action="#{foodShopView.addOne}" value="#{i18n['productshop.plusOne']}">
<f:ajax render="@form" />
</h:commandButton>
<h:commandButton action="#{foodShopView.addTen}" value="#{i18n['productshop.plusTen']}">
<f:ajax render="@form" />
</h:commandButton>
</h:column>
<h:column>
<h:dataTable border="0" var="disc" value="#{cart.discounts}">
<h:column>
<h:outputText value="#{disc.shortdesc}" />
</h:column>
<h:column>
<h:outputText value="#{cart.getDiscount(disc.id)}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
<div>
<h:outputText value="#{i18n['productshop.total']} " />
<h:outputText value="#{foodShopView.totalPrice}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</div>
<h:commandButton action="#{cc.attrs.commitaction}" id="commitbutton-botton" value="#{cc.attrs.commitValue}" />
</composite:implementation>
</html>