]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/main.tt2
TPac: Hide CC Payment info when not enabled
[Evergreen.git] / Open-ILS / src / templates / 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 <form action="[% ctx.opac_root %]/myopac/main_payment_form" method="GET">
12     [% IF ctx.fines.circulation.size > 0 %]
13     <div id='myopac_circ_trans_div'>
14         <table width='100%' class='data_grid'>
15             <thead>
16                 <tr>
17                     <td colspan='10' style='padding: 6px'>
18                         <strong>[% l("Fines") %]</strong>
19                     </td>
20                 </tr>
21                 <tr>
22                     <td>[% l("Title") %]</td>
23                     <td>[% l("Author") %]</td>
24                     <td>[% l("Checkout Date") %]</td>
25                     <td>[% l("Due Date") %]</td>
26                     <td>[% l("Date Returned") %]</td>
27                     <td>[% l("Balance Owed") %]</td>
28                     [% IF myopac_cc_allowed %]
29                     <td nowrap="nowrap" style="white-space:nowrap;">
30                         <input id="pay_fines_box1" checked="checked"
31                             type="checkbox" onclick="select_all_checkboxes('xact', this.checked)"
32                             title="[% l('Click to (un)select all fines') %]" />
33                         <label for="pay_fines_box1">[% l('Pay Fines') %]</label>
34                     </td>
35                     [% END %]
36                 </tr>
37             </thead>
38             <tbody id='myopac_circ_trans_tbody'>
39                 [% FOR f IN ctx.fines.circulation;
40                     attrs = {marc_xml => f.marc_xml};
41                     IF f.marc_xml;
42                         PROCESS get_marc_attrs args=attrs;
43                     ELSIF f.xact.reservation;
44                         attrs.title = f.xact.reservation.target_resource_type.name;
45                     END %]
46                 <tr id='myopac_circ_trans_row'>
47                     <td>
48                         [% recid = f.xact.circulation.target_copy.call_number.record.id || f.xact.reservation.target_resource_type.record.id;
49                         IF recid; %]
50                         <a href="[% ctx.opac_root %]/record/[% recid %]">[% attrs.title | html %]</a>
51                         [% ELSE %]
52                         [% attrs.title | html %]
53                         [% END %]
54                     </td>
55                     <td>
56                         <a href="[% ctx.opac_root %]/results?qtype=author&amp;query=[% attrs.author | replace('[,\.:;]', '') | url %]">[% attrs.author | html %]</a>
57                     </td>
58                     <td name='myopac_circ_trans_start'>
59                         [% ts = f.xact.circulation.xact_start || f.xact.reservation.start_time || 0;
60                         IF ts;
61                             date.format(ctx.parse_datetime(ts), DATE_FORMAT);
62                         END %]
63                     </td>
64                     <td name='myopac_circ_trans_due'>
65                         [% ts = f.xact.circulation.due_date || f.xact.reservation.end_time || 0;
66                         IF ts;
67                             date.format(ctx.parse_datetime(ts), DATE_FORMAT);
68                         END %]
69                     </td>
70                     <td name='myopac_circ_trans_finished'>
71                         [%  ts = f.xact.circulation.checkin_time || f.xact.reservation.return_time || 0;
72                             IF ts;
73                                 date.format(ctx.parse_datetime(ts), DATE_FORMAT);
74                             ELSE %]
75                             <!-- XXX TODO fines aren't really accruing
76                                 if circ has hit maxfines. more clarity
77                                 here? -->
78                             <span class="red">[% l('(fines accruing)') %]</span>
79                         [%  END %]
80                     </td>
81                     <td>
82                         <strong class="red">
83                             [% money(f.xact.balance_owed) %]
84                         </strong>
85                     </td>
86                     [% IF myopac_cc_allowed %]
87                     <td>
88                         <input type="checkbox" checked="checked" 
89                             title="[% l('Pay this fine') %]" name="xact"
90                             value="[% f.xact.id %]" />
91                     </td>
92                     [% END %]
93                 </tr>
94                 [% END %]
95             </tbody>
96         </table>
97     </div>
98     [% END %]
99
100     [% IF ctx.fines.grocery.size > 0 %]
101     <!-- Table for all non-circulation transactions -->
102     <div id='myopac_trans_div'>
103         <br/>
104         <hr class='opac-auto-013'  color="#dcdbdb" />
105         <br/>
106         <table width='100%' class='data_grid data_grid_center'
107             id='myopac_trans_table'>
108             <thead>
109                 <tr>
110                     <td colspan='8' style='padding: 6px'>
111                         <b>[% l("Other Fees") %]</b>
112                     </td>
113                 </tr>
114                 <tr>
115                     <td width='16%'>[% l("Transaction Start Time") %]</td>
116                     <td width='16%'>[% l("Last Payment Time") %]</td>
117                     <td width='16%'>[% l("Initial Amount Owed") %]</td>
118                     <td width='16%'>[% l("Total Amount Paid") %]</td>
119                     <td width='16%'>[% l("Balance Owed") %]</td>
120                     <td width='16%'>[% l("Billing Type") %]</td>
121                     [% IF myopac_cc_allowed %]
122                     <td width='4%' align="center" nowrap="nowrap"
123                         style="white-space:nowrap;">
124                         <input id="pay_fines_box2" checked="checked"
125                             type="checkbox" onclick="select_all_checkboxes('xact_misc', this.checked)"
126                             title="[% l('Click to (un)select all fines') %]" />
127                         <label for="pay_fines_box2">[% l("Pay Fines") %]</label>
128                     </td>
129                     [% END %]
130                 </tr>
131             </thead>
132             <tbody id='myopac_trans_tbody'>
133                 [% FOR f IN ctx.fines.grocery %]
134                 <tr id='myopac_trans_row'>
135                     <td>[% date.format(
136                             ctx.parse_datetime(f.xact.xact_start),
137                             DATE_FORMAT
138                     ) %]</td>
139                     <td>
140                         [%  IF f.xact.last_payment_ts;
141                                 date.format(
142                                     ctx.parse_datetime(
143                                         f.xact.last_payment_ts
144                                     ), DATE_FORMAT
145                                 );
146                             END %]
147                     </td>
148                     <td>[% money(f.xact.total_owed) %]</td>
149                     <td>[% money(f.xact.total_paid) %]</td>
150                     <td class="red">
151                         <strong>
152                             [% money(f.xact.balance_owed) %]
153                         </strong>
154                     </td>
155                     <td>[% f.xact.last_billing_type %]</td>
156                     [% IF myopac_cc_allowed %]
157                     <td>
158                         <input type="checkbox" title='[% l("Pay this fine") %]'
159                             name="xact_misc" value="[% f.xact.id %]"
160                             checked="checked" />
161                     </td>
162                     [% END %]
163                 </tr>
164                 [% END %]
165             </tbody>
166         </table>
167     </div>
168     [% END %]
169     [% UNLESS ctx.fines.grocery.size OR ctx.fines.circulation.size %]
170     <div>[% l('You have no current fines.') %]</div>
171     [% ELSIF myopac_cc_allowed %]
172     <div class="text-right pad-top-ten">
173         <input type="submit"
174             value="[% l('Pay selected fines') %]"
175             alt="[% l('Pay selected fines') %]"
176             title="[% l('Pay selected fines') %]"
177             class="opac-button" />
178     </div>
179     [% END %]
180 </form>
181 [% END %]