summaryrefslogtreecommitdiffstats
path: root/WebContent/pages/products.xhtml
blob: 8050c304d94bceb6e3317a84abdc0cac76300e05 (plain)
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
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<!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:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

	<ui:composition template="#{UserManager.loggedIn ? '/templates/loggedin.xhtml' : '/templates/common.xhtml'}">
	
		<ui:define name="pageTitle">JCatalog Application</ui:define>
	
		<ui:define name="pageHeader">List of Products</ui:define>
		
		<ui:define name="body">
			
			<h:form id="products">
			
			<h2>
				<f:verbatim>List of Products in Category </f:verbatim>
				<h:outputText value="#{CategoryManager.current.name}" />
			</h2>
			
			<h:dataTable style="border: 1px;" id="producttable" value="#{CategoryManager.current.products}"
				var="product">
			<h:column>
				<f:facet name="header">
					<h:outputText value="Id" />
				</f:facet>
				<h:outputText value="#{product.id}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Name" />
				</f:facet>
				<h:outputText value="#{product.name}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Price" />
				</f:facet>
				<h:outputText value="#{product.price}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="" />
				</f:facet>
				<h:commandLink value="View Details ..." immediate="true"
					actionListener="#{ProductManager.select}" action="select">
					<f:param name="selectedId" value="#{product.id}" />
				</h:commandLink>
			</h:column>
			<h:column rendered="#{UserManager.loggedIn}">
				<f:facet name="header">
					<h:outputText value="" />
				</f:facet>
				<h:commandLink  rendered="#{UserManager.loggedIn}" disabled="#{not UserManager.loggedIn}" 
				value="remove" immediate="true"	actionListener="#{ProductManager.deleteProduct}" action="deleteProduct">
					<f:param name="selectedId" value="#{product.id}" />
				</h:commandLink>
			</h:column>
			</h:dataTable>
			<h:commandLink rendered="#{UserManager.loggedIn}" value="New Product" immediate="true"
				actionListener="#{ProductManager.newProduct}" action="newProduct">
			</h:commandLink>
			<h:commandLink rendered="#{UserManager.loggedIn}" disabled="#{!UserManager.loggedIn}" value="Delete Category"  immediate="true"
				actionListener="#{CategoryManager.deleteCurrentCategory}" action="deleteCurrentCategory">
			</h:commandLink>
			</h:form>
		</ui:define>
		
		<ui:define name="pageFooter">JCatalog Footer</ui:define>
		
	</ui:composition>

</html>