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 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 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 [% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %]
71 </div> <!-- / #useraccount -->
72 </div> <!-- / .span10 -->
73 </div> <!-- / .row-fluid -->
74 </div> <!-- / .container-fluid -->
75 </div> <!-- / .main -->
77 [% INCLUDE 'opac-bottom.inc' %]
79 [% INCLUDE 'datatables.inc' %]
81 $( document ).ready(function() {
83 var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s");
84 var txtActivefilter = _("Filter paid transactions");
85 var txtInactivefilter = _("Show all transactions");
87 var fines_table = $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
89 { "type": "title-string", "targets" : [ "title-string" ] }
91 [% IF ENABLE_OPAC_PAYMENTS %]
92 "order": [[ 1, "desc" ]],
94 "order": [[ 0, "desc" ]],
96 "dom": '<"#filter_p">',
99 $("#filter_p").html('<p><a href="#" id="filter_paid"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
100 $('#filter_paid').click(function(e) {
102 if ($(this).hasClass('filtered')) {
103 var filteredValue = '';
104 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
105 } else { //Not filtered. Let's do it!
106 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
107 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
109 fines_table.fnFilter(filteredValue, -1, true, false);
110 $(this).toggleClass('filtered');
114 $('#filter_paid').click();
116 $(".paypal").on("click", function() {
117 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');
121 $(".pay-online").removeClass("hidden");
123 $("#amount-to-pay-label").hide();
125 $(".checkbox-pay, input[name='payment_method']").change( function() {
126 // Disable the pay button if no fees are selected
127 //$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
129 // Calculate the total amount to be paid based on selected fees
131 $(".checkbox-pay").each( function() {
132 if ( $(this).is(":checked") ) {
133 var id = this.id.split("checkbox-pay-")[1];
134 total += parseFloat( $("#amount-" + id).val() );
138 var p = Promise.resolve();
141 $('input[name="payment_method"]').map(function() {
143 return new Promise(function(resolve, reject) {
144 var threshold = $(self).data('threshold');
145 var help = $(self).parent().siblings('.help-block');
146 if(threshold == '' || threshold <= total) {
147 $(self).prop('disabled', false);
148 help.addClass('hide');
150 $(self).prop('disabled', true);
151 help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide');
158 $("#amount-to-pay").html( total.toFixed(2) );
159 $("#amount-to-pay-label").show();
161 $('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide');
162 $("#amount-to-pay-label").hide();
165 $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length);