Bug 11622 - Add ability to pay fees and fines from OPAC via PayPal
[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
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your fines and charges</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% BLOCK cssinclude %][% END %]
9 </head>
10 <body id="opac-account" class="scrollto">
11 [% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
12 [% INCLUDE 'masthead.inc' %]
13
14 <div class="main">
15     <ul class="breadcrumb">
16         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
17         <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>
18         <li><a href="#">Your fines and charges</a></li>
19     </ul>
20
21     <div class="container-fluid">
22         <div class="row-fluid">
23             <div class="span2">
24                 <div id="navigation">
25                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
26                 </div>
27             </div>
28             <div class="span10">
29                 <div id="useraccount" class="maincontent">
30
31                     [% IF message %]
32                         <div class="alert alert-info">
33                             [% IF message == 'valid_payment' %]
34                                 <p>Your payment of $[% message_value %] has been processed sucessfully!</p>
35                             [% ELSIF message == 'duplicate_payment' %]
36                                 <p>A payment with the transaction id <i>[% message_value %]</i> has already been posted to an account.</p>
37                                 <p>Please contact a librarian for details.</p>
38                             [% ELSIF message == 'invalid_payment' %]
39                                 <p>The transaction id <i>[% message_value %]</i> for this payment is invalid.</p>
40                                 <p>Please contact a librarian for details.</p>
41                             [% END %]
42                         </div>
43                     [% END %]
44
45                     <h3>Fines and charges</h3>
46
47                     [% IF ( ACCOUNT_LINES ) %]
48                         <form method="post" action="opac-account-pay.pl" class="form-horizontal">
49                         <table class="table table-bordered table-striped">
50                             <thead>
51                                 <tr>
52                                     [% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
53                                     <th>Date</th>
54                                     <th>Description</th>
55                                     <th>Fine amount</th>
56                                     <th>Amount outstanding</th>
57                                 </tr>
58                             </thead>
59
60                             <tfoot>
61                             <tr>
62                                 [%- IF ENABLE_OPAC_PAYMENTS -%]
63                                     [%- SET COLSPAN = 4 -%]
64                                 [%- ELSE -%]
65                                     [%- SET COLSPAN = 3 -%]
66                                 [%- END -%]
67                                 <th class="sum" colspan="[% COLSPAN %]">Total due</th>
68                                 <td class="sum">[% total %]</td>
69                             </tr>
70                             </tfoot>
71
72                             <tbody>
73                                 [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
74                                     [% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
75                                         [% IF ENABLE_OPAC_PAYMENTS %]
76                                             <td>
77                                                 [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
78                                                     <input name="accountline" type="checkbox" class="checkbox-pay" id="checkbox-pay-[% ACCOUNT_LINE.accountlines_id %]" value="[% ACCOUNT_LINE.accountlines_id %]">
79                                                 [% END %]
80                                             </td>
81                                         [% END %]
82                                         <td>[% ACCOUNT_LINE.date | $KohaDates %]</td>
83                                         <td>
84                                             [% SWITCH ACCOUNT_LINE.accounttype %]
85                                             [% CASE 'Pay' %]Payment, thanks
86                                             [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
87                                             [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
88                                             [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
89                                             [% CASE 'N' %]New card
90                                             [% CASE 'F' %]Fine
91                                             [% CASE 'A' %]Account management fee
92                                             [% CASE 'M' %]Sundry
93                                             [% CASE 'L' %]Lost item
94                                             [% CASE 'W' %]Writeoff
95                                             [% CASE 'FU' %]Accruing fine
96                                             [% CASE 'Rent' %]Rental fee
97                                             [% CASE 'FOR' %]Forgiven
98                                             [% CASE 'LR' %]Lost item fee refund
99                                             [% CASE 'PAY' %]Payment
100                                             [% CASE 'WO' %]Writeoff
101                                             [% CASE 'C' %]Credit
102                                             [% CASE 'CR' %]Credit
103                                             [% CASE %][% ACCOUNT_LINE.accounttype %]
104                                           [%- END -%]
105                                           [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description %][% END %]
106                                           [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title %])[% END %]
107                                         </td>
108                                         [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount %]</td>
109                                         [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding %]</td>
110                                     </tr>
111                                 [% END %]
112                             </tbody>
113
114                         </table>
115
116                             [% IF ENABLE_OPAC_PAYMENTS %]
117                                 <fieldset>
118                                     <legend>Pay selected fines and charges</legend>
119                                         <span class="help-block"><h3>Payment method</h3></span>
120                                         <div class="control-group">
121                                             <label class="radio">
122                                                 <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
123                                                 <!-- 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 -->
124                                             </label>
125                                         </div>
126                                         <!-- look to the future
127                                         <div class="control-group">
128                                             <label class="radio">
129                                                 <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
130                                                 PayPal
131                                             </label>
132                                         </div>
133                                         -->
134
135                                         <div class="control-group">
136                                             <input type="hidden" id="payment-amount" name="payment_amount" value="0" />
137                                             <button id="submit-pay" type="submit" class="btn" disabled="disabled">Make payment</button>
138                                         </div>
139                                 </fieldset>
140                             [% END %]
141                         </form>
142                     [% ELSE %]
143                         <h4>You have no fines or charges</h4>
144                     [% END %]
145                 </div> <!-- / #useraccount -->
146             </div> <!-- / .span10 -->
147         </div> <!-- / .row-fluid -->
148     </div> <!-- / .container-fluid -->
149 </div> <!-- / .main -->
150
151 [% INCLUDE 'opac-bottom.inc' %]
152 [% BLOCK jsinclude %]
153 <script type="text/javascript">
154 $( document ).ready(function() {
155     $('.checkbox-pay').change( function() {
156         $("#submit-pay").prop('disabled', ! $('.checkbox-pay:checked').length );
157     });
158 });
159 </script>
160 [% END %]