]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/myopac/main.tt2
99ed0ea7fa40f1ce55222d75d1c9a6a6d522d790
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / myopac / main.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     WRAPPER "opac/parts/myopac/main_base.tt2";
4     myopac_page = "main";
5     myopac_main_page = "main";
6     myopac_cc_allowed = 0;
7     IF (ctx.fines.grocery.size OR ctx.fines.circulation.size) AND ctx.get_org_setting(ctx.user.home_ou, 'credit.payments.allow') == 1;
8         myopac_cc_allowed = 1;
9     END
10 %]
11 <h3 class="sr-only">[% l('My Account Summary') %]</h3>
12 [%  IF myopac_cc_allowed;
13     # http://www.w3.org/TR/WCAG20-TECHS/H32.html
14     # avoid forms w/ no submit action %]
15 <form action="[% ctx.opac_root %]/myopac/main_payment_form#payment" method="get" id="selected_fines" class="my-3">
16 [% END %]
17
18     [% IF ctx.fines.circulation.size > 0 %]
19     <div id='myopac_circ_trans_div'>
20       <!--moved tables heading to outside of the table itself - took internal styling -->
21         <div class="header_middle">
22            <span class="acct_fines_header">
23            <!-- Different heading when not able to pay -->
24              [% IF myopac_cc_allowed %]
25                 [% l("Pay Selected Circulation Charges") %]
26             [% ELSE %] 
27                 [% l("Circulation Charges") %]
28              [% END %]
29            </span>
30            
31         </div>
32     
33         <table id="acct_fines_main_header" class="table table-hover miniTable chargesMainTable" title="[% l('Items Checked Out') %]">
34             <thead>
35                
36                 <tr>
37
38                    [% IF myopac_cc_allowed %]
39                     <th nowrap="nowrap" style="white-space:nowrap;">
40                         <input id="pay_fines_box1" checked="checked"
41                             type="checkbox" onclick="select_all_checkboxes('xact', this.checked)"
42                             title="[% l('Click to (un)select all charges') %]" />
43                     </th>
44                     [% END %]
45                     <th>[% l("Owed") %]</th>
46                     <th class="mobile_hide">[% l("Billing Type") %]</th>
47                     <th>[% l("Title") %]</th>
48                     <th class='mobile_hide'>[% l("Checkout") %]</th> 
49                     <th>[% l(" Due ") %]</th> 
50                     <th>
51                        <span class="mobile_hide">[% l(" Returned/Renewed") %]</span>
52                        <span class="mobile_view">[% l(" Returned&#42;") %]</span>
53                     </th>
54                     
55                 </tr>
56             </thead>
57             <tbody id='myopac_circ_trans_tbody'>
58                 [% FOR f IN ctx.fines.circulation;
59                     attrs = {marc_xml => f.marc_xml};
60                     IF f.marc_xml;
61                         PROCESS get_marc_attrs args=attrs;
62                     ELSIF f.xact.reservation;
63                         attrs.title = f.xact.reservation.target_resource_type.name;
64                     END %]
65                 <tr id='myopac_circ_trans_row'>
66                     [% IF myopac_cc_allowed %]
67                     <td>
68                         <input type="checkbox" checked="checked" 
69                             title="[% l('Pay this fine') %]" name="xact"
70                             value="[% f.xact.id %]" class="fineCheck"/>
71                     </td>
72                     [% END %]
73                     
74                     <td>
75                         <strong class="fineAmount" value="[% f.xact.balance_owed %]">
76                             [% money(f.xact.balance_owed) %]
77                         </strong>
78                     </td>
79                     
80                     <td class="mobile_hide">
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' class='mobile_hide'>
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="alert">[% 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         <h2 class="acct_fines_header text-center">
134                 [% l("Charges On Your Account") %]
135         </h2>
136         
137         
138          <table id="acct_fees_main_header" class="table table-hover miniTable chargesTable my-3" title="[% l('Other Fines and Fees') %]">
139             <thead>
140                 <tr>
141                 
142                      [% IF myopac_cc_allowed %]
143                     <th  nowrap="nowrap" style="white-space:nowrap;">
144                         <input id="pay_fines_box2" checked="checked"
145                             type="checkbox" onclick="select_all_checkboxes('xact_misc', this.checked)"
146                             title="[% l('Click to (un)select all fines') %]" />
147                     </th>
148                     [% END %]
149                     <th >[% l("Owed") %]</th>
150                     <th >[% l("Billing Type") %]</th>
151                     <th >[% l("Note") %]</th>
152                     <th >[% l("Date") %]</th>
153                     
154
155                 </tr>
156             </thead>
157             <tbody id='myopac_trans_tbody'>
158                 [% c = 0; %]
159                 [% FOR f IN ctx.fines.grocery %]
160                 <tr id='myopac_trans_row'>
161                 [% c = c + 1; %]
162                     [% IF myopac_cc_allowed %]
163                     <td>
164                         <span class="sr-only">Billing Number [% c %]</span>
165                         <input class="fineCheck" type="checkbox" title='[% l("Pay this fine") %]' name="xact_misc" value="[% f.xact.id %]" checked="checked" />
166                     </td>
167                     [% END %]
168                     
169                     <td class="red">
170                         <span class="sr-only">Amount Owed</span>
171                         <strong class="fineAmount" value="[% f.xact.balance_owed %]">
172                             [% money(f.xact.balance_owed) %]
173                         </strong>
174                     </td>
175                     
176                     <td>
177                         <span class="sr-only">Billing For</span>
178                         [% f.xact.last_billing_type %]
179                     </td>
180                     
181                     <td>
182                         [% IF f.xact.last_billing_note; %]
183                             <span class="sr-only">Note</span>
184                             [% f.xact.last_billing_note %]
185                         [% END %]
186                     </td>
187                     
188                     <td>
189                         <span class="sr-only">Date of Billing</span>
190                         [% date.format(ctx.parse_datetime(f.xact.xact_start),DATE_FORMAT) %]
191                     </td>
192
193                 </tr>
194                 [% END %]
195             </tbody>
196         </table>
197    
198     </div>
199     [% END %]
200     [% UNLESS ctx.fines.grocery.size OR ctx.fines.circulation.size %]
201     <div>[% l('You have no current fines.') %]</div>
202     [% ELSIF myopac_cc_allowed %]
203    
204     <div class="my-3">
205         <input type="submit"
206             value="[% l('Pay selected charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]"
207             title="[% l('Pay selected charges') %]"
208             class="btn btn-confirm my-1"
209             id="selectPay"/>
210     <form action="[% ctx.opac_root %]/myopac/main_payment_form" method="get"><input
211             type="submit" title="[% l('Pay All Charges') %] "
212             value="[% l('Pay All Charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]" class="btn btn-confirm my-1" /></form>
213     </div>
214     [% END %]
215 [% IF myopac_cc_allowed %]
216 </form>
217 [% END %]
218 [% END %]
219
220 <!--Table functions ~ Running total of selected items for use in a Paypal module or where running total is needed-->
221 <script>
222 jQuery("input[type=checkbox]").click(function () {
223         var amount = 0;
224     jQuery("td input:checked").each(function () {
225                 var item = jQuery( this ).parent().parent().children("td").children(".fineAmount").attr("value");
226         item = parseFloat(item);
227         amount += item;
228     });
229     jQuery("#total").val(amount);
230     jQuery("#selectPay").val('Pay selected charges - $' + amount.toFixed(2));
231 });
232 </script>