list.xhtml
6.34 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
<?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:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:outputText rendered="#{billListView.bills.rowCount le 0}"
value="#{i18n['bills.noBills']}" />
<h:form rendered="#{billListView.canWriteBill}">
<p:commandButton ajax="false"
action="#{billListView.showPayButtonsAction()}"
value="#{i18n['bill.showPayButtons']}" />
</h:form>
<h:form rendered="#{billListView.bills.rowCount gt 0}" id="billList" styleClass="moya_datatable3">
<p:dataTable styleClass="bordertable" id="billList"
value="#{billListView.bills}" var="bill"
rowStyleClass="#{bill.expired ? 'expired' : (bill.paidDate != null ? 'paid' : null)}"
expandedRow="true">
<p:column style="width:16px"
rendered="#{billListView.bills.rowCount lt 20}">
<p:rowToggler />
</p:column>
<p:column rendered="#{billListView.canWriteBill}">
<f:facet name="header">
<h:outputText value="#{i18n['bill.payer']}" />
</f:facet>
<h:link rendered="#{billListView.canWriteBill}" outcome="/useradmin/edit" value="#{bill.user.user.login} #{bill.addr1}">
<f:param name="userid" value="#{bill.user.user.id}" />
</h:link>
<h:outputText rendered="#{not billListView.canWriteBill}"
value="#{bill.addr1}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['bill.sentDate']}" />
</f:facet>
<h:outputText value="#{bill.sentDateTime}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}"
timeZone="#{sessionHandler.timezone}" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['bill.id']}" />
</f:facet>
<h:outputText value="#{bill.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['bill.billNumber']}" />
</f:facet>
<h:outputText value="#{bill.billNumber}" />
</p:column>
<p:column rendered="#{billListView.canWriteBill}">
<f:facet name="header">
<h:outputText value="${i18n['bill.referencenumber']}" />
</f:facet>
<h:outputText value="#{bill.referenceNumberBase}">
<f:converter binding="#{referenceNumberConverter}" />
</h:outputText>
</p:column>
<!--
<p:column headerText="#{i18n['bill.notes']}" rendered="#{productShopView.gatherBillInfo}">
<h:outputText value="#{bill.notes}" />
</p:column>
-->
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['bill.totalPrice']}" />
</f:facet>
<h:outputText value="#{bill.totalPrice()}">
<f:convertNumber currencyCode="EUR" maxFractionDigits="2"
minFractionDigits="2" type="currency"
locale="#{sessionHandler.locale}" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['bill.vat']}" />
</f:facet>
<h:outputText value="#{bill.totalVat()}">
<f:convertNumber currencyCode="EUR" maxFractionDigits="2"
minFractionDigits="2" type="currency"
locale="#{sessionHandler.locale}" />
</h:outputText>
</p:column>
<p:column
rendered="#{(!bill.expired and sessionHandler.isEventBoolProperty('ALLOW_BILLING')) or billListView.canWriteBill}">
<ui:fragment>
<a href="#{request.contextPath}/PrintBill?billid=#{bill.id}"
target="_blank">#{i18n['bill.printBill']}</a>
</ui:fragment>
</p:column>
<p:column>
<h:link outcome="/bill/showBill" value="#{i18n['bill.show']}">
<f:param name="billid" value="#{bill.id}" />
</h:link>
</p:column>
<p:column rendered="#{billListView.canWriteBill}">
<h:link outcome="/bill/edit" value="#{i18n['bill.edit']}">
<f:param name="billid" value="#{bill.id}" />
</h:link>
</p:column>
<p:column rendered="#{billListView.canWriteBill}">
<p:commandButton update="billList" onerror="location.reload(true)"
rendered="#{bill.paidDate == null and billListView.showPayButtons}"
action="#{billListView.markPaid()}"
value="#{i18n['bill.markPaid']}" />
<h:outputText rendered="#{bill.paidDate != null}"
value="#{i18n['bill.isPaid']}" />
<h:outputText
rendered="#{bill.paidDate == null and !billListView.showPayButtons}"
value="#{i18n['bill.isNotPaid']}" />
</p:column>
<p:column rendered="#{!billListView.canWriteBill}">
<h:outputText rendered="#{bill.paidDate != null}"
value="#{i18n['bill.isPaid']}" />
<h:outputText rendered="#{bill.paidDate == null}"
value="#{i18n['bill.isNotPaid']}" />
</p:column>
<p:column rendered="#{billListView.canWriteBill and not empty billListView.paytrailMerchantId}">
<button onclick="showPaymentstatus('#{bill.id}'); return false;"><h:outputText value="#{i18n['bill.checkPaytrail']}" /></button>
</p:column>
<p:rowExpansion rendered="#{billListView.bills.rowCount lt 20}">
<p:dataList value="#{bill.billLines}" var="line">
<h:outputText value="#{line.name}" />:
<h:outputText value="#{line.quantity}">
<f:convertNumber minFractionDigits="0" maxFractionDigits="0" />
</h:outputText>
</p:dataList>
</p:rowExpansion>
</p:dataTable>
</h:form>
<form id="paymentcheckform" target="_blank" action="https://payment.paytrail.com/check-payment" method="post">
<input name="MERCHANT_ID" type="hidden" value="#{billListView.paytrailMerchantId}" />
<input id="paymentordernr" name="ORDER_NUMBER" type="hidden" value="" />
<input id="paymentauthcode" name="AUTHCODE" type="hidden" value="" />
<input name="VERSION" type="hidden" value="2" />
</form>
<script type="text/javascript" >
function showPaymentstatus(id) {
$("#paymentordernr").val(id);
$("#paymentauthcode").val(authcodes[id]);
$("#paymentcheckform").submit();
return false;
}
var authcodes ={};
<ui:repeat var="ac" value="#{billListView.paytrailAuthcodes}">
<h:outputText value="authcodes['#{ac.key}'] ='#{ac.value}';" />
</ui:repeat>
</script>
</composite:implementation>
</html>