Bug 16473: Fix typo "an problem" vs "a problem"
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-account.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% SET ENABLE_OPAC_PAYMENTS = Koha.Preference('EnablePayPalOpacPayments') %]
4 [% SET DISPLAY_PAYMENT_BLOCK = 0 %]
5
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your fines and charges</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% BLOCK cssinclude %][% END %]
10 </head>
11 <body id="opac-account" class="scrollto">
12 [% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
13 [% INCLUDE 'masthead.inc' %]
14
15 <div class="main">
16     <ul class="breadcrumb">
17         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
18         <li>[% IF BORROWER_INFO %]<a href="/cgi-bin/koha/opac-user.pl">[% BORROWER_INFO.firstname %] [% BORROWER_INFO.surname %]</a>[% END %] <span class="divider">&rsaquo;</span></li>
19         <li><a href="#">Your fines and charges</a></li>
20     </ul>
21
22     <div class="container-fluid">
23         <div class="row-fluid">
24             <div class="span2">
25                 <div id="navigation">
26                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
27                 </div>
28             </div>
29             <div class="span10">
30                 <div id="useraccount" class="maincontent">
31
32                     [% IF message %]
33                         <div class="alert alert-info">
34                             [% IF message == 'valid_payment' %]
35                                 <p>Your payment of $[% message_value %] has been processed successfully!</p>
36                             [% ELSIF message == 'duplicate_payment' %]
37                                 <p>A payment with the transaction id <i>[% message_value %]</i> has already been posted to an account.</p>
38                                 <p>Please contact a librarian for details.</p>
39                             [% ELSIF message == 'invalid_payment' %]
40                                 <p>The transaction id <i>[% message_value %]</i> for this payment is invalid.</p>
41                                 <p>Please contact a librarian for details.</p>
42                             [% END %]
43                         </div>
44                     [% END %]
45
46                     [% IF payment_error %]
47                         <div id="error" class="dialog alert">
48                             <p><strong>Error:</strong> there was a problem processing your payment</p>
49
50                             [% IF payment_error == "PAYPAL_UNABLE_TO_CONNECT" %]
51                                 <p>Unable to connect to PayPal.</p>
52                                 <p>Please contact a librarian to verify your payment.</p>
53                             [% ELSIF payment_error == "PAYPAL_ERROR_PROCESSING" %]
54                                 <p>Unable to verify payment.</p>
55                                 <p>Please contact a librarian to verify your payment.</p>
56                             [% END %]
57                         </div>
58                     [% ELSIF payment %]
59                         <div class="alert alert-info">
60                             <p><strong>Payment applied:</strong> your payment of [% payment %] has been applied to your account</p>
61                         </div>
62                     [% END %]
63
64                     <h3>Fines and charges</h3>
65
66                     [% IF ( ACCOUNT_LINES ) %]
67                         <form method="post" action="opac-account-pay.pl" class="form-horizontal">
68                         <table class="table table-bordered table-striped">
69                             <thead>
70                                 <tr>
71                                     [% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
72                                     <th>Date</th>
73                                     <th>Description</th>
74                                     <th>Fine amount</th>
75                                     <th>Amount outstanding</th>
76                                 </tr>
77                             </thead>
78
79                             <tfoot>
80                             <tr>
81                                 [%- IF ENABLE_OPAC_PAYMENTS -%]
82                                     [%- SET COLSPAN = 4 -%]
83                                 [%- ELSE -%]
84                                     [%- SET COLSPAN = 3 -%]
85                                 [%- END -%]
86                                 <th class="sum" colspan="[% COLSPAN %]">Total due</th>
87                                 <td class="sum">[% total %]</td>
88                             </tr>
89                             </tfoot>
90
91                             <tbody>
92                                 [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
93                                     [% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
94                                         [% IF ENABLE_OPAC_PAYMENTS %]
95                                             <td>
96                                                 [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
97                                                     [% SET DISPLAY_PAYMENT_BLOCK = 1 %]
98                                                     <input class="checkbox-pay pay-online hidden" name="accountline" type="checkbox" id="checkbox-pay-[% ACCOUNT_LINE.accountlines_id %]" value="[% ACCOUNT_LINE.accountlines_id %]">
99                                                     <input type="hidden" id="amount-[% ACCOUNT_LINE.accountlines_id %]" value="[% ACCOUNT_LINE.amountoutstanding %]" />
100                                                 [% END %]
101                                             </td>
102                                         [% END %]
103                                         <td>[% ACCOUNT_LINE.date | $KohaDates %]</td>
104                                         <td>
105                                             [% SWITCH ACCOUNT_LINE.accounttype %]
106                                             [% CASE 'Pay' %]Payment, thanks
107                                             [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
108                                             [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
109                                             [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
110                                             [% CASE 'N' %]New card
111                                             [% CASE 'F' %]Fine
112                                             [% CASE 'A' %]Account management fee
113                                             [% CASE 'M' %]Sundry
114                                             [% CASE 'L' %]Lost item
115                                             [% CASE 'W' %]Writeoff
116                                             [% CASE 'FU' %]Accruing fine
117                                             [% CASE 'Rent' %]Rental fee
118                                             [% CASE 'FOR' %]Forgiven
119                                             [% CASE 'LR' %]Lost item fee refund
120                                             [% CASE 'PAY' %]Payment
121                                             [% CASE 'WO' %]Writeoff
122                                             [% CASE 'C' %]Credit
123                                             [% CASE 'CR' %]Credit
124                                             [% CASE %][% ACCOUNT_LINE.accounttype %]
125                                           [%- END -%]
126                                           [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description %][% END %]
127                                           [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title %])[% END %]
128                                         </td>
129                                         [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount %]</td>
130                                         [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding %]</td>
131                                     </tr>
132                                 [% END %]
133                             </tbody>
134
135                         </table>
136
137                             [% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %]
138                                 <fieldset class="pay-online hidden">
139                                     <legend>Pay selected fines and charges</legend>
140                                         <span class="help-block"><h3>Payment method</h3></span>
141                                         <div class="control-group">
142                                             <label class="radio">
143                                                 <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
144                                                 <!-- PayPal Logo --><a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="How PayPal Works" onclick="javascript: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'); return false;"><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 -->
145                                             </label>
146                                         </div>
147                                         <!-- look to the future
148                                         <div class="control-group">
149                                             <label class="radio">
150                                                 <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
151                                                 PayPal
152                                             </label>
153                                         </div>
154                                         -->
155
156                                         <div class="control-group">
157                                             <input type="hidden" id="payment-amount" name="payment_amount" value="0" />
158                                             <button id="submit-pay" type="submit" class="btn" disabled="disabled">Make payment</button>
159                                             <span id="amount-to-pay-label">
160                                                 Amount to pay: <span id="amount-to-pay">0.00</span>
161                                             </span>
162                                         </div>
163                                 </fieldset>
164                             [% END %]
165                         </form>
166                     [% ELSE %]
167                         <h4>You have no fines or charges</h4>
168                     [% END %]
169                 </div> <!-- / #useraccount -->
170             </div> <!-- / .span10 -->
171         </div> <!-- / .row-fluid -->
172     </div> <!-- / .container-fluid -->
173 </div> <!-- / .main -->
174
175 [% INCLUDE 'opac-bottom.inc' %]
176 [% BLOCK jsinclude %]
177 <script type="text/javascript">
178 $( document ).ready(function() {
179     $(".pay-online").removeClass("hidden");
180
181     $("#amount-to-pay-label").hide();
182
183     $(".checkbox-pay").change( function() {
184         // Disable the pay button if no fees are selected
185         $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
186
187         // Calculate the total amount to be paid based on selected fees
188         var total = 0;
189         $(".checkbox-pay").each( function() {
190             if ( $(this).is(":checked") ) {
191                 var id = this.id.split("checkbox-pay-")[1];
192                 total += parseFloat( $("#amount-" + id).val() );
193             }
194         });
195
196         if ( total ) {
197             $("#amount-to-pay").html( total.toFixed(2) );
198             $("#amount-to-pay-label").show();
199         } else {
200             $("#amount-to-pay-label").hide();
201         }
202     });
203 });
204 </script>
205 [% END %]