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>Your charges › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</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 <nav aria-label="breadcrumb">
22 <ul class="breadcrumb">
23 <li class="breadcrumb-item">
24 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
26 <li class="breadcrumb-item">
27 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
29 <li class="breadcrumb-item active" aria-current="page">
30 <a href="#">Your charges</a>
35 <div class="container-fluid">
37 <div class="col col-lg-2 order-2 order-lg-1">
39 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
42 <div class="col-md-12 col-lg-10 order-1">
43 <div id="useraccount" class="maincontent">
47 <div class="alert alert-info">
48 [% IF message == 'valid_payment' %]
49 <p>Your payment of $[% message_value | html %] has been processed successfully!</p>
50 [% ELSIF message == 'duplicate_payment' %]
51 <p>A payment with the transaction id '[% message_value | html %]' has already been posted to an account.</p>
52 <p>Please contact a librarian for details.</p>
53 [% ELSIF message == 'invalid_payment' %]
54 <p>The transaction id '[% message_value | html %]' for this payment is invalid.</p>
55 <p>Please contact a librarian for details.</p>
60 [% IF payment_error %]
61 <div id="error" class="alert alert-warning">
62 <p><strong>Error:</strong> there was a problem processing your payment</p>
64 [% IF payment_error == "PAYPAL_UNABLE_TO_CONNECT" %]
65 <p>Unable to connect to PayPal.</p>
66 <p>Please contact a librarian to verify your payment.</p>
67 [% ELSIF payment_error == "PAYPAL_ERROR_PROCESSING" %]
68 <p>Unable to verify payment.</p>
69 <p>Please contact a librarian to verify your payment.</p>
73 <div class="alert alert-info">
74 <p><strong>Payment applied:</strong> your payment of [% payment | html %] has been applied to your account</p>
78 [% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %]
80 </div> <!-- / #useraccount -->
81 </div> <!-- / .col-10 -->
82 </div> <!-- / .row -->
83 </div> <!-- / .container-fluid -->
84 </div> <!-- / .main -->
86 [% INCLUDE 'opac-bottom.inc' %]
88 [% INCLUDE 'datatables.inc' %]
90 $( document ).ready(function() {
92 var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s");
93 var txtActivefilter = _("Filter paid transactions");
94 var txtInactivefilter = _("Show all transactions");
96 var fines_table = $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
98 { "type": "title-string", "targets" : [ "title-string" ] }
100 [% IF ENABLE_OPAC_PAYMENTS %]
101 "order": [[ 1, "desc" ]],
103 "order": [[ 0, "desc" ]],
105 "dom": '<"#filter_p">',
108 $("#filter_p").html('<p><a href="#" id="filter_paid"><i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter+'</a>');
109 $('#filter_paid').click(function(e) {
111 if ($(this).hasClass('filtered')) {
112 var filteredValue = '';
113 $(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter);
114 } else { //Not filtered. Let's do it!
115 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
116 $(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtInactivefilter);
118 fines_table.fnFilter(filteredValue, -1, true, false);
119 $(this).toggleClass('filtered');
123 $('#filter_paid').click();
125 $(".paypal").on("click", function() {
126 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');
130 $(".pay-online").removeClass("hidden");
132 $("#amount-to-pay-label").hide();
134 $(".checkbox-pay, input[name='payment_method']").change( function() {
135 // Disable the pay button if no fees are selected
136 //$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
138 // Calculate the total amount to be paid based on selected fees
140 $(".checkbox-pay").each( function() {
141 if ( $(this).is(":checked") ) {
142 var id = this.id.split("checkbox-pay-")[1];
143 total += parseFloat( $("#amount-" + id).val() );
147 var p = Promise.resolve();
150 $('input[name="payment_method"]').map(function() {
152 return new Promise(function(resolve, reject) {
153 var threshold = $(self).data('threshold');
154 var help = $(self).parent().siblings('.help-block');
155 if(!threshold || threshold == '' || threshold <= total) {
156 $(self).prop('disabled', false);
157 help.addClass('hide');
159 $(self).prop('disabled', true);
160 help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide');
167 $("#amount-to-pay").html( total.toFixed(2) );
168 $("#amount-to-pay-label").show();
170 $('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide');
171 $("#amount-to-pay-label").hide();
174 $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length);