listOrders.xhtml
11 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!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="pizzaUpdater">
<p:remoteCommand name="pizzaUpdater" update=":accountEventList :billList :productSummaries :foodwaveSummary" actionListener="#{foodWaveView.updateFoodWaveOrderList}" />
</h:form>
<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 id="foodname" value="#{acc_line.product.name}" />
<p:tooltip rendered="#{acc_line.product.description != null}" for="foodname" value="#{acc_line.product.description}" showEffect="fade" hideEffect="fade" />
</p:column>
<p:column sortBy="#{acc_line.description}">
<f:facet name="header">
<h:outputLabel value="#{i18n['acc_line.description']}" />
</f:facet>
<h:outputText id="fooddescription" value="#{acc_line.description}" />
</p:column>
<p:column sortBy="#{acc_line.user.wholeName}">
<f:facet name="header">
<h:outputLabel value="#{i18n['acc_line.eventuser']} (#{i18n['acc_line.nick']})" />
</f:facet>
<h:link outcome="/useradmin/edit" value="#{acc_line.user.wholeName} (#{acc_line.user.nick})">
<f:param name="userid" value="#{acc_line.user.user.id}" />
</h:link>
</p:column>
<p:column style="width: 80px;">
<f:facet name="header">
<h:outputLabel value="#{i18n['acc_line.place']}" />
</f:facet>
<h:outputText value="#{acc_line.user.firstPlace.name}" />
</p:column>
<p:column sortBy="#{acc_line.productReady}" style="width: 80px;">
<f:facet name="header">
<h:outputLabel value="#{i18n['accountEvent.ready']}" />
</f:facet>
<h:outputText rendered="#{acc_line.productReady}" value="#{i18n['accountEvent.ready']}" />
<p:commandButton rendered="#{not acc_line.productReady}" value="#{i18n['accountEvent.markReady']}" actionListener="#{foodWaveView.markAccounteventProductReady}" update=":billList :accountEventList" />
</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">
<h:outputText rendered="#{foodWaveView.selectedFoodWave.paymentOver}" value="#{i18n['foodwave.closed']}" styleClass="notify" />
<p:dataTable styleClass="bordertable" value="#{foodWaveView.bills}" var="bill" sortBy="#{bill.user.nick}" rowStyleClass="#{bill.expired ? 'expired' : null}">
<f:facet name="header">
<h:outputLabel value="#{i18n['foodWave.billLines']}" />
</f:facet>
<p:column sortBy="#{bill.sentDate}">
<f:facet name="header">
<h:outputLabel value="#{i18n['billLine.time']}" />
</f:facet>
<h:outputText value="#{bill.sentDate}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</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:outputText outcome="/useradmin/edit" value="#{bill.user.wholeName}" />
</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:outputPanel rendered="#{bill.user.accountBalance ge bill.totalPrice}">
<p:commandButton rendered="#{not bill.expired and not foodWaveView.selectedFoodWave.paymentOver}" id="buyCreditsButton" onerror="location.reload(true);" value="#{i18n['bill.markPaid.credits']}" actionListener="#{foodWaveView.markBillPaidWithCredits}" update=":billList :accountEventList" />
<p:commandButton rendered="#{bill.expired or foodWaveView.selectedFoodWave.paymentOver}" value="#{i18n['bill.markPaid.credits']}" actionListener="#{foodWaveView.markBillPaidWithCredits}" update=":billList :accountEventList">
<p:confirm header="Confirmation" message="#{i18n['confirmation.message']}" icon="ui-icon-alert" />
</p:commandButton>
</p:outputPanel>
<p:commandButton rendered="#{not bill.expired and not foodWaveView.selectedFoodWave.paymentOver}" value="#{i18n['bill.markPaid.cash']}" actionListener="#{foodWaveView.markBillPaid}" update=":billList :accountEventList" />
<p:commandButton rendered="#{bill.expired or foodWaveView.selectedFoodWave.paymentOver}" value="#{i18n['bill.markPaid.cash']}" actionListener="#{foodWaveView.markBillPaid}" update=":billList :accountEventList">
<p:confirm header="Confirmation" message="#{i18n['confirmation.message']}" icon="ui-icon-alert" />
</p:commandButton>
</p:column>
<p:column>
<p:commandButton rendered="#{not bill.expired}" id="removeBill" value="#{i18n['foodwave.cancelOrder']}" actionListener="#{foodWaveView.markBillExpired}" update=":billList :accountEventList">
<p:confirm header="Confirmation" message="#{i18n['confirmation.message']}" icon="ui-icon-alert" />
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
<br />
<br />
<br />
<h2>#{i18n['foodwave.summaryView']}</h2>
<p:panelGrid columns="2" id="foodwaveSummary">
<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}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
<h:outputLabel value="#{i18n['foodwave.foodwaveLastBillPayTime']}: " />
<h:outputText value="#{foodWaveView.selectedFoodWave.lastPaymentTime}" style="font-weight: bold">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
</p:panelGrid>
<p:dataTable id="productSummaries" var="summ" value="#{foodWaveView.productSummaries}">
<p:column>
<f:facet name="header">
<h:outputLabel value="#{i18n['product.name']}" />
</f:facet>
<h:outputText id="productName" value="#{summ.product.name}" />
<p:tooltip rendered="#{summ.product.description != null}" for="productName" value="#{summ.product.description}" showEffect="fade" hideEffect="fade" />
</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>
<script type="text/javascript">
$(document)
.ready(
function() {
setInterval(function() {
pizzaUpdater();
}, 15000);
});
</script>
</ui:define>
</ui:composition>
</h:body>
</html>