listOrders.xhtml 7.85 KB
<!DOCTYPE html 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:foodwave="http://java.sun.com/jsf/composite/cditools/foodwave" xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="#{sessionHandler.template}">
		<f:metadata>
			<f:viewParam name="foodwaveid" value="#{foodWaveView.foodWaveId}" />
			<f:event type="preRenderView" listener="#{foodWaveView.initFoodWaveOrderList}" />
			<!-- 		<f:event type="preRenderView" listener="#{foodWaveView.initFoodwaveAccountEventList}" /> -->
		</f:metadata>

		<ui:define name="title">
			<h1>#{foodWaveView.selectedFoodWave.name}</h1>
		</ui:define>
		<ui:define name="content">
			<h:form id="accountEventList">
				<p:dataTable styleClass="bordertable" value="#{foodWaveView.accountEventLines}" var="acc_line" sortBy="#{acc_line.user.nick}" rowStyleClass="#{acc_line.eventDelivered?'success':null}">
					<f:facet name="header">
						<h:outputLabel value="#{i18n['foodWave.accountevents']}" />
					</f:facet>
					<p:column sortBy="#{acc_line.eventTime.getTime()}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['acc_line.time']}" />
						</f:facet>
						<h:outputText style="text-align: center;" value="#{acc_line.eventTime.getTime()}">
							<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
						</h:outputText>
					</p:column>
					<p:column sortBy="#{acc_line.quantity}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['acc_line.quantity']}" />
						</f:facet>
						<h:outputText style="text-align: center;" value="#{acc_line.quantity}">
							<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
						</h:outputText>
					</p:column>
					<p:column sortBy="#{acc_line.product.name}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['acc_line.product']}" />
						</f:facet>
						<h:outputText value="#{acc_line.product.name}" />
					</p:column>
					<p:column sortBy="#{acc_line.user.wholeName}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['acc_line.eventuser']}" />
						</f:facet>
						<h:outputText outcome="/useradmin/edit" value="#{acc_line.user.wholeName}" />
					</p:column>
					<p:column sortBy="#{acc_line.user.nick}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['acc_line.nick']}" />
						</f:facet>
						<h:link outcome="/useradmin/edit" value="#{acc_line.user.nick}">
							<f:param name="userid"  value="#{acc_line.user.user.id}" />
						</h:link>
					</p:column>
					<p:column sortBy="#{acc_line.eventDelivered}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['accountEvent.delivered']}" />
						</f:facet>
						<h:outputText rendered="#{acc_line.eventDelivered}" value="#{i18n['accountEvent.delivered']}" />
						<p:commandButton rendered="#{not acc_line.eventDelivered}" value="#{i18n['accountEvent.deliver']}" actionListener="#{foodWaveView.deliverAccountEvent}" update=":billList :accountEventList" />
					</p:column>
				</p:dataTable>

			</h:form>
			<br></br>
			<br></br>

			<h:form id="billList">
				<p:dataTable styleClass="bordertable" value="#{foodWaveView.bills}" var="bill" sortBy="#{bill.user.nick}">
					<f:facet name="header">
						<h:outputLabel value="#{i18n['foodWave.billLines']}" />
					</f:facet>
					<p:column sortBy="#{bill.sentDate.getTime()}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['billLine.time']}" />
						</f:facet>
						<h:outputText value="#{bill.sentDate.getTime()}">
							<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" />
						</h:outputText>
					</p:column>
					<p:column sortBy="#{bill.totalQuantity}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['billLine.quantity']}" />
						</f:facet>
						<h:outputText style="text-align: center;" value="#{bill.totalQuantity}">
							<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
						</h:outputText>
					</p:column>
					<p:column sortBy="#{billLine.eventuser}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['bill.products']}" />
						</f:facet>
						<h:outputText value="#{bill.productSummary}" />
					</p:column>
					<p:column sortBy="#{bill.user.wholeName}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['billLine.eventuser']}" />
						</f:facet>
						<h:link outcome="/useradmin/edit" value="#{bill.user.wholeName}">
							<f:param name="userid" value="#{bill.user.user.id}" />
						</h:link>
					</p:column>
					<p:column sortBy="#{bill.user.user.id}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['billLine.nick']}" />
						</f:facet>
						<h:link outcome="/useradmin/edit" value="#{bill.user.nick}">
							<f:param name="userid" value="#{bill.user.user.id}" />
						</h:link>
					</p:column>
					<p:column sortBy="#{bill.totalPrice}">
						<f:facet name="header">
							<h:outputLabel value="#{i18n['bill.totalprice']}" />
						</f:facet>
						<h:outputText style="text-align: center;" value="#{bill.totalPrice}">
							<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
						</h:outputText>
					</p:column>

					<p:column>
						<p:commandButton value="#{i18n['bill.markPaid']}" actionListener="#{foodWaveView.markBillPaid}" update=":billList :accountEventList" />
					</p:column>
					<!-- 
				<p:column>
					<h:commandButton value="#{i18n['bill.remove']}" action="foodWaveView.markBillRemoved" />
				</p:column> -->

				</p:dataTable>
			</h:form>

<br /><br /><br />
			<h2>#{i18n['foodwave.summaryView']}</h2>
			<p:panelGrid columns="2">
				<h:outputLabel value="#{i18n['foodwave.price']}: " />
				<h:outputText value="#{foodWaveView.foodwavePrice}" style="font-weight: bold" >
					<f:convertNumber minFractionDigits="0"/>
				</h:outputText>
			
				<h:outputLabel value="#{i18n['foodwave.foodwaveBuyInPrice']}: " />
				<h:outputText value="#{foodWaveView.foodwaveBuyInPrice}" style="font-weight: bold" >
					<f:convertNumber minFractionDigits="0"/>
				</h:outputText>
				
			
				<h:outputLabel value="#{i18n['foodwave.ordersBefore']}: " />
				<h:outputText value="#{foodWaveView.selectedFoodWave.time}" style="font-weight: bold" >
					<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" />
				</h:outputText>
				
			
				<h:outputLabel value="#{i18n['foodwave.foodwaveLastBillPayTime']}: " />
				<h:outputText value="#{foodWaveView.selectedFoodWave.lastPaymentTime}" style="font-weight: bold" >
					<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" />
				</h:outputText>
				
			</p:panelGrid>
			
			<p:dataTable var="summ" value="#{foodWaveView.productSummaries}">
				<p:column>
					<f:facet name="header">
						<h:outputLabel value="#{i18n['product.name']}" />
					</f:facet>
					<h:outputText value="#{summ.product.name}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputLabel value="#{i18n['foodwave.totalCount']}" />
					</f:facet>
					<h:outputText value="#{summ.count}">
						<f:convertNumber minFractionDigits="0" />
					</h:outputText>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputLabel value="#{i18n['foodwave.totalPrice']}" />
					</f:facet>
					<h:outputText value="#{summ.summaryPrice}">
						<f:convertNumber minFractionDigits="0" />
					</h:outputText>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputLabel value="#{i18n['foodwave.buyInPrice']}" />
					</f:facet>
					<h:outputText value="#{summ.buyInPrice}">
						<f:convertNumber minFractionDigits="0" />
					</h:outputText>
				</p:column>
			</p:dataTable>


		</ui:define>


	</ui:composition>
</h:body>
</html>