5 [% USE AuthorisedValues %]
7 [% SET ENABLE_OPAC_PAYMENTS = Koha.Preference('EnablePayPalOpacPayments') || plugins %]
8 [% SET DISPLAY_PAYMENT_BLOCK = 0 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Your fines and charges</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %]
13 [% Asset.css("css/datatables.css") | $raw %]
17 [% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
18 [% INCLUDE 'masthead.inc' %]
21 <ul class="breadcrumb">
22 <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li>
23 <li>[% IF logged_in_user %]<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>[% END %] <span class="divider">›</span></li>
24 <li><a href="#">Your fines and charges</a></li>
27 <div class="container-fluid">
28 <div class="row-fluid">
31 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
35 <div id="useraccount" class="maincontent">
38 <div class="alert alert-info">
39 [% IF message == 'valid_payment' %]
40 <p>Your payment of $[% message_value | html %] has been processed successfully!</p>
41 [% ELSIF message == 'duplicate_payment' %]
42 <p>A payment with the transaction id '[% message_value | html %]' has already been posted to an account.</p>
43 <p>Please contact a librarian for details.</p>
44 [% ELSIF message == 'invalid_payment' %]
45 <p>The transaction id '[% message_value | html %]' for this payment is invalid.</p>
46 <p>Please contact a librarian for details.</p>
51 [% IF payment_error %]
52 <div id="error" class="dialog alert">
53 <p><strong>Error:</strong> there was a problem processing your payment</p>
55 [% IF payment_error == "PAYPAL_UNABLE_TO_CONNECT" %]
56 <p>Unable to connect to PayPal.</p>
57 <p>Please contact a librarian to verify your payment.</p>
58 [% ELSIF payment_error == "PAYPAL_ERROR_PROCESSING" %]
59 <p>Unable to verify payment.</p>
60 <p>Please contact a librarian to verify your payment.</p>
64 <div class="alert alert-info">
65 <p><strong>Payment applied:</strong> your payment of [% payment | html %] has been applied to your account</p>
69 <h3>Fines and charges</h3>
71 [% IF ( ACCOUNT_LINES ) %]
72 <form method="post" action="opac-account-pay.pl" class="form-horizontal">
73 <table class="table table-bordered table-striped" id="finestable">
76 [% IF ENABLE_OPAC_PAYMENTS %]<th> </th>[% END %]
77 <th class="title-string">Date</th>
80 <th>Amount outstanding</th>
86 [%- IF ENABLE_OPAC_PAYMENTS -%]
87 [%- SET COLSPAN = 4 -%]
89 [%- SET COLSPAN = 3 -%]
91 <th class="sum" colspan="[% COLSPAN | html %]">Total due</th>
92 <td class="sum">[% total | $Price %]</td>
97 [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
98 [% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
99 [% IF ENABLE_OPAC_PAYMENTS %]
101 [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
102 [% SET DISPLAY_PAYMENT_BLOCK = 1 %]
103 <input class="checkbox-pay pay-online hidden" name="accountline" type="checkbox" id="checkbox-pay-[% ACCOUNT_LINE.accountlines_id | html %]" value="[% ACCOUNT_LINE.accountlines_id | html %]">
104 <input type="hidden" id="amount-[% ACCOUNT_LINE.accountlines_id | html %]" value="[% ACCOUNT_LINE.amountoutstanding | html %]" />
108 <td><span title="[% ACCOUNT_LINE.date | html %]">[% ACCOUNT_LINE.date | $KohaDates %]</span></td>
110 [% SWITCH ACCOUNT_LINE.accounttype %]
111 [% CASE 'Pay' %]Payment, thanks
112 [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
113 [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
114 [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
115 [% CASE 'N' %]New card
117 [% CASE 'A' %]Account management fee
119 [% CASE 'L' %]Lost item
120 [% CASE 'W' %]Writeoff
121 [% CASE 'FU' %]Accruing fine
122 [% CASE 'HE' %]Hold waiting too long
123 [% CASE 'Rent' %]Rental fee
124 [% CASE 'FOR' %]Forgiven
125 [% CASE 'LR' %]Lost item fee refund
126 [% CASE 'PF' %]Processing fee
127 [% CASE 'PAY' %]Payment
128 [% CASE 'WO' %]Writeoff
130 [% CASE 'CR' %]Credit
131 [% CASE %][% ACCOUNT_LINE.accounttype | html %]
133 [%- IF ACCOUNT_LINE.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
134 [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description | html %][% END %]
135 [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title | html %])[% END %]
137 [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount | $Price %]</td>
138 [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding | $Price %]</td>
145 [% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %]
146 <fieldset class="pay-online hidden">
147 <legend>Pay selected fines and charges</legend>
148 <span class="help-block"><h3>Payment method</h3></span>
150 [% IF Koha.Preference('EnablePayPalOpacPayments') %]
151 <div class="control-group">
152 <label class="radio">
153 <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
154 <!-- PayPal Logo --><a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="How PayPal Works" class="paypal"><img src="https://www.paypalobjects.com/webstatic/mktg/logo/AM_SbyPP_mc_vs_dc_ae.jpg" border="0" alt="PayPal Acceptance Mark"></a><!-- PayPal Logo -->
159 [% FOREACH p IN plugins %]
160 <div class="control-group">
161 <label class="radio">
162 <input type="radio" name="payment_method" id="payment_method-[% p.class | html %]" value="[% p.class | html %]" checked="checked">
163 [% p.get_metadata.name | html %]
168 <div class="control-group">
169 <input type="hidden" id="payment-amount" name="payment_amount" value="0" />
170 <button id="submit-pay" type="submit" class="btn" disabled="disabled">Make payment</button>
171 <span id="amount-to-pay-label">
172 Amount to pay: <span id="amount-to-pay">0.00</span>
179 <h4>You have no fines or charges</h4>
181 </div> <!-- / #useraccount -->
182 </div> <!-- / .span10 -->
183 </div> <!-- / .row-fluid -->
184 </div> <!-- / .container-fluid -->
185 </div> <!-- / .main -->
187 [% INCLUDE 'opac-bottom.inc' %]
188 [% BLOCK jsinclude %]
189 [% INCLUDE 'datatables.inc' %]
191 $( document ).ready(function() {
193 $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
195 { "type": "title-string", "targets" : [ "title-string" ] }
197 "order": [[ 0, "desc" ]]
200 $(".paypal").on("click", function() {
201 window.open('https://www.paypal.com/webapps/mpp/paypal-popup','WIPaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700');
205 $(".pay-online").removeClass("hidden");
207 $("#amount-to-pay-label").hide();
209 $(".checkbox-pay").change( function() {
210 // Disable the pay button if no fees are selected
211 $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
213 // Calculate the total amount to be paid based on selected fees
215 $(".checkbox-pay").each( function() {
216 if ( $(this).is(":checked") ) {
217 var id = this.id.split("checkbox-pay-")[1];
218 total += parseFloat( $("#amount-" + id).val() );
223 $("#amount-to-pay").html( total.toFixed(2) );
224 $("#amount-to-pay-label").show();
226 $("#amount-to-pay-label").hide();