Bug 28313: Add street type to alternate address in OPAC
[koha.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 = payment_methods %]
8 [% SET DISPLAY_PAYMENT_BLOCK = 0 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Your charges &rsaquo; [% 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 %]
14 [% END %]
15 </head>
16
17 [% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
18 [% INCLUDE 'masthead.inc' %]
19
20 <div class="main">
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>
25             </li>
26             <li class="breadcrumb-item">
27                 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
28             </li>
29             <li class="breadcrumb-item active" aria-current="page">
30                 <a href="#">Your charges</a>
31             </li>
32         </ul>
33     </nav>
34
35     <div class="container-fluid">
36         <div class="row">
37             <div class="col col-lg-2 order-2 order-lg-1">
38                 <div id="navigation">
39                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
40                 </div>
41             </div>
42             <div class="col-md-12 col-lg-10 order-1">
43                 <div id="useraccount" class="maincontent">
44
45                     <h1>Charges</h1>
46                     [% IF message %]
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>
56                             [% END %]
57                         </div>
58                     [% END %]
59
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>
63                         </div>
64                     [% ELSIF payment %]
65                         <div class="alert alert-info">
66                             <p><strong>Payment applied:</strong> your payment of [% payment | html %] has been applied to your account</p>
67                         </div>
68                     [% END %]
69
70                     [% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %]
71
72                 </div> <!-- / #useraccount -->
73             </div> <!-- / .col-10 -->
74         </div> <!-- / .row -->
75     </div> <!-- / .container-fluid -->
76 </div> <!-- / .main -->
77
78 [% INCLUDE 'opac-bottom.inc' %]
79 [% BLOCK jsinclude %]
80 [% INCLUDE 'datatables.inc' %]
81 <script>
82 $( document ).ready(function() {
83
84     var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s");
85     var txtActivefilter = _("Filter paid transactions");
86     var txtInactivefilter = _("Show all transactions");
87
88     var fines_table = $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
89          [% IF ENABLE_OPAC_PAYMENTS %]
90          "order": [[ 1, "desc" ]],
91          [% ELSE %]
92          "order": [[ 0, "desc" ]],
93          [% END %]
94          "dom": '<"#filter_p">',
95     } ));
96
97     $("#filter_p").html('<p><a href="#" id="filter_paid"><i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter+'</a>');
98     $('#filter_paid').click(function(e) {
99         e.preventDefault();
100         if ($(this).hasClass('filtered')) {
101             var filteredValue = '';
102             $(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter);
103         } else { //Not filtered. Let's do it!
104             var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
105             $(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtInactivefilter);
106         }
107         fines_table.fnFilter(filteredValue, -1, true, false);
108         $(this).toggleClass('filtered');
109     });
110
111     //Start filtered
112     $('#filter_paid').click();
113
114     $(".pay-online").removeClass("hidden");
115
116     $("#amount-to-pay-label").hide();
117
118     $(".checkbox-pay, input[name='payment_method']").change( function() {
119         // Disable the pay button if no fees are selected
120         //$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
121
122         // Calculate the total amount to be paid based on selected fees
123         var total = 0;
124         $(".checkbox-pay").each( function() {
125             if ( $(this).is(":checked") ) {
126                 var id = this.id.split("checkbox-pay-")[1];
127                 total += parseFloat( $("#amount-" + id).val() );
128             }
129         });
130
131         var p = Promise.resolve();
132         if ( total ) {
133             p = Promise.all(
134                 $('input[name="payment_method"]').map(function() {
135                     var self = this;
136                     return new Promise(function(resolve, reject) {
137                         var threshold = $(self).data('threshold');
138                         var help = $(self).parent().siblings('.help-block');
139                         if(!threshold || threshold == '' || threshold <= total) {
140                             $(self).prop('disabled', false);
141                             help.addClass('hide');
142                         } else {
143                             $(self).prop('disabled', true);
144                             help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide');
145                         }
146                         resolve();
147                     })
148                 }).toArray()
149             );
150
151             $("#amount-to-pay").html( total.toFixed(2) );
152             $("#amount-to-pay-label").show();
153         } else {
154             $('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide');
155             $("#amount-to-pay-label").hide();
156         }
157         p.then(function() {
158             $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length);
159         })
160     });
161 });
162 </script>
163 [% END %]