265136d71522e60ea556a6b6c24fa753e34145c4
[koha-equinox.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-account.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE AuthorisedValues %]
6 [% USE Price %]
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 &rsaquo; Your fines and charges</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %]
13     [% Asset.css("css/datatables.css") | $raw %]
14 [% END %]
15 </head>
16
17 [% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
18 [% INCLUDE 'masthead.inc' %]
19
20 <div class="main">
21     <ul class="breadcrumb">
22         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</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">&rsaquo;</span></li>
24         <li><a href="#">Your fines and charges</a></li>
25     </ul>
26
27     <div class="container-fluid">
28         <div class="row-fluid">
29             <div class="span2">
30                 <div id="navigation">
31                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
32                 </div>
33             </div>
34             <div class="span10">
35                 <div id="useraccount" class="maincontent">
36
37                     [% IF message %]
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>
47                             [% END %]
48                         </div>
49                     [% END %]
50
51                     [% IF payment_error %]
52                         <div id="error" class="dialog alert">
53                             <p><strong>Error:</strong> there was a problem processing your payment</p>
54
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>
61                             [% END %]
62                         </div>
63                     [% ELSIF payment %]
64                         <div class="alert alert-info">
65                             <p><strong>Payment applied:</strong> your payment of [% payment | html %] has been applied to your account</p>
66                         </div>
67                     [% END %]
68
69                     [% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %]
70
71                 </div> <!-- / #useraccount -->
72             </div> <!-- / .span10 -->
73         </div> <!-- / .row-fluid -->
74     </div> <!-- / .container-fluid -->
75 </div> <!-- / .main -->
76
77 [% INCLUDE 'opac-bottom.inc' %]
78 [% BLOCK jsinclude %]
79 [% INCLUDE 'datatables.inc' %]
80 <script>
81 $( document ).ready(function() {
82
83     $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
84         "columnDefs": [
85              { "type": "title-string", "targets" : [ "title-string" ] }
86          ],
87          "order": [[ 0, "desc" ]]
88     } ));
89
90     $(".paypal").on("click", function() {
91         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');
92         return false;
93     });
94
95     $(".pay-online").removeClass("hidden");
96
97     $("#amount-to-pay-label").hide();
98
99     $(".checkbox-pay").change( function() {
100         // Disable the pay button if no fees are selected
101         $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
102
103         // Calculate the total amount to be paid based on selected fees
104         var total = 0;
105         $(".checkbox-pay").each( function() {
106             if ( $(this).is(":checked") ) {
107                 var id = this.id.split("checkbox-pay-")[1];
108                 total += parseFloat( $("#amount-" + id).val() );
109             }
110         });
111
112         if ( total ) {
113             $("#amount-to-pay").html( total.toFixed(2) );
114             $("#amount-to-pay-label").show();
115         } else {
116             $("#amount-to-pay-label").hide();
117         }
118     });
119 });
120 </script>
121 [% END %]