]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/myopac/charges.tt2
LP#1778972: add a couple more aria-hidden
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / myopac / charges.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     WRAPPER "opac/parts/myopac/base.tt2";
4     myopac_page = "charges";
5     myopac_main_page = "main";
6     parent = "charges";
7     myopac_cc_allowed = 0;
8     IF (ctx.fines.grocery.size OR ctx.fines.circulation.size) AND ctx.get_org_setting(ctx.user.home_ou, 'credit.payments.allow') == 1;
9         myopac_cc_allowed = 1;
10     END
11 %]
12 [%  IF myopac_cc_allowed; %]
13 <form action="[% ctx.opac_root %]/myopac/main_payment_form#payment" method="get" id="selected_fines">
14 [% END %]
15
16     [% IF ctx.fines.circulation.size > 0 %]
17     <div id='myopac_circ_trans_div'>
18         <div class="header_middle">
19            <span class="acct_fines_header">
20            <!-- Different heading when not able to pay -->
21              [% IF myopac_cc_allowed %]
22                 [% l("Pay Selected Circulation Charges") %]
23             [% ELSE %] 
24                 [% l("Circulation Charges") %]
25              [% END %]
26            </span>
27            
28         </div>
29
30      
31     
32         <table id="acct_fines_main_header" class="table table-hover table-responsive table-bordered miniTable chargesMainTable" title="[% l('Items Checked Out') %]">
33             <thead>
34                
35                 <tr>
36
37                    [% IF myopac_cc_allowed %]
38                     <th style="white-space:nowrap;">
39                         <input id="pay_fines_box1" checked="checked"
40                             type="checkbox" onclick="select_all_checkboxes('xact', this.checked)"
41                             title="[% l('Click to (un)select all charges') %]" />
42                     </th> 
43                     [% END %]
44                     <th>[% l("Owed") %]</th>
45                     <th>[% l("Billing Type") %]</th>
46                     <th>[% l("Title") %]</th>
47                     <th>[% l("Checkout") %]</th> 
48                     <th>[% l(" Due ") %]</th> 
49                     <th>
50                        <span>[% l(" Returned/Renewed") %]</span>
51                        <span>[% l(" Returned&#42;") %]</span>
52                     </th>
53                     
54                 </tr>
55             </thead>
56             <tbody id='myopac_circ_trans_tbody'>
57                 [% FOR f IN ctx.fines.circulation;
58                     attrs = {marc_xml => f.marc_xml};
59                     IF f.marc_xml;
60                         PROCESS get_marc_attrs args=attrs;
61                     ELSIF f.xact.reservation;
62                         attrs.title = f.xact.reservation.target_resource_type.name;
63                     END %]
64                 <tr id='myopac_circ_trans_row'>
65                     [% IF myopac_cc_allowed %]
66                     <td class="checkCell">
67                         <input type="checkbox" checked="checked" 
68                             title="[% l('Pay this fine') %]" name="xact"
69                             value="[% f.xact.id %]" class="fineCheck"/>
70                     </td>
71                     [% END %]
72                     
73                     <td>
74                         <strong>
75                             [% money(f.xact.balance_owed) %]
76                         </strong>
77                         <input class="fineAmount" value="[% f.xact.balance_owed %]" hidden />
78                     </td>
79                     
80                     <td>
81                        [% f.xact.last_billing_type %]
82                     </td>
83                                   
84                     <td>
85                         [% recid = f.xact.circulation.target_copy.call_number.record.id || f.xact.reservation.target_resource_type.record.id;
86                         IF recid; %]
87                         <a href="[% mkurl(ctx.opac_root _ '/record/' _ recid,
88                             {loc => ctx.search_ou}) %]">[% attrs.title | html %]</a>
89                         [% ELSE %]
90                         [% attrs.title | html %]
91                         [% END %]
92                     </td>
93                     
94                    <td name='myopac_circ_trans_start'>
95                         [% ts = f.xact.circulation.xact_start || f.xact.reservation.start_time || 0;
96                         IF ts;
97                             date.format(ctx.parse_datetime(ts), DATE_FORMAT);
98                         END %]
99                     </td>
100                     
101                     <td name='myopac_circ_trans_due' >
102                         [% ts = f.xact.circulation.due_date || f.xact.reservation.end_time || 0;
103                            due_org = f.xact.circulation.circ_lib || f.xact.reservation.pickup_lib;
104                         IF ts;
105                             date.format(ctx.parse_datetime(ts, due_org), DATE_FORMAT);
106                         END %]
107                     </td>
108                     
109                     <td name='myopac_circ_trans_finished' >
110                         [%  ts = f.xact.circulation.checkin_time || f.xact.reservation.return_time || 0;
111                             IF ts;
112                                 date.format(ctx.parse_datetime(ts), DATE_FORMAT);
113                             ELSE %]
114                             <!-- XXX TODO fines aren't really accruing
115                                 if circ has hit maxfines. more clarity
116                                 here? --> 
117                             <span class="danger">[% l('(fines accruing)') %]</span>
118                         [%  END %]
119                     </td>
120                    
121                 </tr>
122                 [% END %]
123             </tbody>
124         </table>
125         <!-- Disclaimer for mobile -->
126         <span class="mobile_view cc_disclaimer"> <strong>&#42;</strong>Items may have been renewed. </span>
127     </div>
128     [% END %]
129
130     [% IF ctx.fines.grocery.size > 0 %]
131     <!-- Table for all non-circulation transactions -->
132     <div id='myopac_trans_div'>
133         <h3>
134                 [% l("Charges On Your Account") %]
135         </h3>
136
137         [% IF myopac_cc_allowed %]
138         <div class="d-block d-md-none">
139             <input id="pay_fines_check" checked="checked"
140             type="checkbox" onclick="select_all_checkboxes('xact_misc', this.checked)"
141             aria-label="[% l('Check/Uncheck All') %]" />    
142             <label for="pay_fines_check">[% l('Check/Uncheck All') %]</label>  
143         </div>             
144         [% END %]
145         
146          <table id="acct_fees_main_header" class="table table-hover table-bordered miniTable chargesTable my-3" title="[% l('Other Fines and Fees') %]">
147             <thead>
148                 <tr>
149                 
150                      [% IF myopac_cc_allowed %]
151                     <th style="white-space:nowrap;">
152                         <input id="pay_fines_box2" checked="checked"
153                             type="checkbox" onclick="select_all_checkboxes('xact_misc', this.checked)"
154                             aria-label="[% l('Check/Uncheck All') %]" />
155                     </th>
156                     [% END %]
157                     <th >[% l("Owed") %]</th>
158                     <th >[% l("Billing Type") %]</th>
159                     <th >[% l("Note") %]</th>
160                     <th >[% l("Date") %]</th>
161                     
162
163                 </tr>
164             </thead>
165             <tbody id='myopac_trans_tbody'>
166                 [% c = 0; %]
167                 [% FOR f IN ctx.fines.grocery %]
168                 <tr class ='myopac_trans_row'>
169                 [% c = c + 1; %]
170                     [% IF myopac_cc_allowed %]
171                     <td class="checkCell">
172                         <label class="sr-only">Billing Number [% c %]</label>
173                         <input aria-label="Pay This Bill" class="fineCheck" type="checkbox" name="xact_misc" value="[% f.xact.id %]" checked="checked" />
174                     </td>
175                     [% END %]
176                     
177                     <td class="danger">
178                         <span class="sr-only">Amount Owed</span>
179                         <strong>
180                             [% money(f.xact.balance_owed) %]
181                         </strong>
182                          <input type="hidden" class="fineAmount" value="[% f.xact.balance_owed %]" hidden />
183                     </td>
184                     
185                     <td>
186                         <span class="sr-only">Billing For</span>
187                         [% f.xact.last_billing_type %]
188                     </td>
189                     
190                     <td>
191                         [% IF f.xact.last_billing_note; %]
192                             <span class="sr-only">Note</span>
193                             [% f.xact.last_billing_note %]
194                         [% END %]
195                     </td>
196                     
197                     <td>
198                         <span class="sr-only">Date of Billing</span>
199                         [% date.format(ctx.parse_datetime(f.xact.xact_start),DATE_FORMAT) %]
200                     </td>
201
202                 </tr>
203                 [% END %]
204             </tbody>
205         </table>
206    
207     </div>
208     [% END %]
209     [% UNLESS ctx.fines.grocery.size OR ctx.fines.circulation.size %]
210     <div>[% l('You have no current fines.') %]</div>
211     [% ELSIF myopac_cc_allowed %]
212    
213     <div class="my-3">
214         <button type="submit" value="[% l('Pay selected charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]" title="[% l('Pay selected charges') %]" class="btn btn-confirm my-1"
215             id="selectPay"> <i class='fas fa-money-bill-wave' aria-hidden="true"></i> [% l('Pay Selected Charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]</button>
216     <button type="submit" class="btn btn-confirm my-1"><i class="fas fa-cash-register" aria-hidden="true"></i> [% l('Pay All Charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]</button>
217     </div>
218     [% END %]
219 [% IF myopac_cc_allowed %]
220 </form>
221 [% END %]
222 <script >
223 $( document ).ready(function() {
224    $("input[type=checkbox]").click(function () {
225         var amount = 0;
226     $("td input:checked").each(function () {
227                 var item = jQuery( this ).parent().parent().children("td").children(".fineAmount").attr("value");
228         item = parseFloat(item);
229         amount += item;
230     });
231     $("#total").val(amount);
232     $("#selectPay").html('<i class="fas fa-money-bill-wave" aria-hidden="true"></i> Pay Selected Charges - $' + amount.toFixed(2));
233 });
234 });
235
236 </script>
237 [% END %]
238
239 <!--Table functions ~ Running total of selected items for use in a Paypal module or where running total is needed-->