5 [% USE AuthorisedValues %]
7 [% SET ENABLE_OPAC_PAYMENTS = payment_methods %]
8 [% USE AdditionalContents %]
9 [% SET DISPLAY_PAYMENT_BLOCK = 0 %]
10 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>Your charges › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 [% BLOCK cssinclude %]
15 [% Asset.css("css/datatables.css") | $raw %]
19 [% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
20 [% INCLUDE 'masthead.inc' %]
23 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
24 <ol class="breadcrumb">
25 <li class="breadcrumb-item">
26 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
28 <li class="breadcrumb-item">
29 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
31 <li class="breadcrumb-item active">
32 <a href="#" aria-current="page">Your charges</a>
35 </nav> <!-- /#breadcrumbs -->
37 <div class="container-fluid">
39 <div class="col col-lg-2 order-2 order-lg-1">
41 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
44 <div class="col-md-12 col-lg-10 order-1">
45 <div id="useraccount" class="maincontent">
49 <div class="alert alert-info">
50 [% IF message == 'valid_payment' %]
51 <p>Your payment of $[% message_value | html %] has been processed successfully!</p>
52 [% ELSIF message == 'duplicate_payment' %]
53 <p>A payment with the transaction id '[% message_value | html %]' has already been posted to an account.</p>
54 <p>Please contact a librarian for details.</p>
55 [% ELSIF message == 'invalid_payment' %]
56 <p>The transaction id '[% message_value | html %]' for this payment is invalid.</p>
57 <p>Please contact a librarian for details.</p>
62 [% IF payment_error %]
63 <div id="error" class="alert alert-warning">
64 <p><strong>Error:</strong> there was a problem processing your payment</p>
67 <div class="alert alert-info">
68 <p><strong>Payment applied:</strong> your payment of [% payment | html %] has been applied to your account</p>
72 [% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %]
74 </div> <!-- / #useraccount -->
75 </div> <!-- / .col-10 -->
76 </div> <!-- / .row -->
77 </div> <!-- / .container-fluid -->
78 </div> <!-- / .main -->
80 [% INCLUDE 'opac-bottom.inc' %]
82 [% INCLUDE 'datatables.inc' %]
84 $( document ).ready(function() {
86 var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s");
87 var txtActivefilter = _("Filter paid transactions");
88 var txtInactivefilter = _("Show all transactions");
90 var fines_table = $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
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" aria-hidden="true"></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" aria-hidden="true"></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" aria-hidden="true"></i> '+txtInactivefilter);
109 fines_table.fnFilter(filteredValue, -1, true, false);
110 $(this).toggleClass('filtered');
114 $('#filter_paid').click();
116 $(".pay-online").removeClass("hidden");
118 $("#amount-to-pay-label").hide();
120 $(".checkbox-pay, input[name='payment_method']").change( function() {
121 // Disable the pay button if no fees are selected
122 //$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
124 // Calculate the total amount to be paid based on selected fees
126 $(".checkbox-pay").each( function() {
127 if ( $(this).is(":checked") ) {
128 var id = this.id.split("checkbox-pay-")[1];
129 total += parseFloat( $("#amount-" + id).val() );
133 var p = Promise.resolve();
136 $('input[name="payment_method"]').map(function() {
138 return new Promise(function(resolve, reject) {
139 var threshold = $(self).data('threshold');
140 var help = $(self).parent().siblings('.help-block');
141 if(!threshold || threshold == '' || threshold <= total) {
142 $(self).prop('disabled', false);
143 help.addClass('hide');
145 $(self).prop('disabled', true);
146 help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide');
153 $("#amount-to-pay").html( total.toFixed(2) );
154 $("#amount-to-pay-label").show();
156 $('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide');
157 $("#amount-to-pay-label").hide();
160 $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length);