shop.xhtml 3.49 KB
<?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>