]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/myopac/circs.tt2
LP1778972 A slew of updates
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / myopac / circs.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     PROCESS "opac/parts/myopac/column_sort_support.tt2";
4     WRAPPER "opac/parts/myopac/base.tt2";
5     myopac_page = "circs";
6     parent="circs";
7 %]
8 <h3>[% l('Current Items Checked Out') %]</h3>
9 <div id='myopac_checked_div'>
10         
11     <div>
12    
13     [% IF ctx.circs.size < 1 %]
14     <div class="warning_box">[% l('You have no items checked out.') %]</div>
15     [% ELSE %]
16     [% IF ctx.success_renewals %]
17     <div class="renew-summary">
18         [% l("Successfully renewed [_1] item(s)", ctx.success_renewals) %]
19     </div>
20     [% END %]
21     [% IF ctx.failed_renewals %]
22     <div class="renew-summary alert">
23         [% l("Failed to renew [_1] item(s)", ctx.failed_renewals) %]
24     </div>
25     [% END %]
26     <div id='checked_main'>
27         <form method="post" id="circ-form"
28             onsubmit="return confirm('[% l("Are you sure you wish to renew the selected item(s)?") %]');">
29          <div class="my-3">
30                 <button name="action" class="btn btn-confirm" id="renew" value="renew" type="submit"><i class="fas fa-redo-alt"></i> Renew Selected</button>
31         </div>
32         <div class="d-block d-md-none">
33             <input id="check_all_checked_alt" aria-label="[% l('Select All Items') %]" checked="checked" type="checkbox" onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'circ' &amp;&amp; !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
34
35             <label for="check_all_checked">[% l('Check/Uncheck All') %]</label>  
36         </div>       
37         <table  id="acct_checked_main_header"  title="[% l('Items Checked Out') %]"
38             class="table table-hover table-bordered miniTable circTable">
39             <thead>
40             <tr>
41                 <td class="checkbox_column">
42                     <input type="checkbox" id="check_all_checked"
43                         aria-label="[% l('Select All Items') %]" 
44                         onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'circ' &amp;&amp; !inputs[i].disabled) inputs[i].checked = this.checked;}"
45                     />
46                 </td>
47                 <th>[% sort_head("sort_title", l("Title")) %]</th>
48                 <th>[% sort_head("author", l("Author")) %]</th>
49                 <th>[% sort_head("renews", l("Renewals Left")) %]</th>
50                 <th>[% sort_head("due", l("Due Date")) %]</th>
51                 <th>[% sort_head("barcode", l("Barcode")) %]</th>
52                 <th>[% sort_head("callnum", l("Call Number")) %]</th>
53                  [% IF ctx.get_org_setting(ctx.user.home_ou, 'opac.show_owning_lib_column'); %]
54                    <th>[% sort_head("lib", l("Owning Library")) %]</th>
55                    [% column_count = 8;
56                 ELSE ;
57                    column_count = 7;
58                 END; %]
59             </tr>
60             </thead>
61             <tbody>
62                 [%# Copy the ctx.circs into a local array, then add a SORT field
63                     that contains the value to sort on.  Since we need the item attrs,
64                     invoke it and save the result in ATTRS.
65                 %]
66                 [% 
67                 circ_items = ctx.circs;  # Array assignment
68
69                 sort_field = CGI.param('sort');  # unless changed below...
70
71                 FOR circ IN circ_items;
72                     circ.ATTRS = {marc_xml => circ.marc_xml};
73                     PROCESS get_marc_attrs args=circ.ATTRS;
74                 
75                     SWITCH sort_field;
76
77                        CASE "sort_title";
78                           circ.SORTING = circ.ATTRS.sort_title;
79
80                        CASE "author";
81                           circ.SORTING = circ.ATTRS.author;
82
83                        CASE "renews";
84                           circ.SORTING = circ.circ.renewal_remaining;
85                        
86                        CASE "due";
87                           circ.SORTING = circ.circ.due_date;
88                        
89                        CASE "barcode";
90                           circ.SORTING = circ.circ.target_copy.barcode;
91
92                        CASE "callnum";
93                           circ.SORTING = circ.circ.target_copy.call_number.label;
94                         CASE "lib";
95                           circ.SORTING = circ.circ.target_copy.call_number.owning_lib.name;
96                        
97                        CASE;
98                           sort_field = "";
99                     END; # SWITCH
100                 END; #FOR circ
101
102                 IF (sort_field != "sort_title");
103                    deemphasize_class = "";
104                 ELSE;
105                    deemphasize_class = " class=\"sort_deemphasize\"";
106                 END;
107
108                 # Apply sorting to circ_items
109                 IF (sort_field);
110                     circ_items = circ_items.sort("SORTING");
111                     IF (CGI.param("sort_type") == "desc");
112                         circ_items = circ_items.reverse;
113                     END;
114                 END;
115
116                 # circ_items list is now sorted.  Traverse and dump the information.
117
118                 FOR circ IN circ_items; %]
119                     <tr>
120                         <td class="checkCell">
121                             <input type="checkbox" name="circ"
122                                 aria-label="[% l('Select Item') %]"
123                                 [% IF circ.circ.renewal_remaining < 1 %] disabled="disabled" [% END %]
124                                 value="[% circ.circ.id %]" />
125                         </td>
126                         <td>
127                             <span class="sr-only">Title</span>
128                             [% IF circ.circ.target_copy.call_number.id == -1 %]
129                                 [% circ.circ.target_copy.dummy_title | html %]
130                             [% ELSIF circ.ATTRS.title %]
131                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ 
132                                     circ.circ.target_copy.call_number.record.id, {}, 1) %]"><span[%- deemphasize_class -%]>
133                                     [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
134                                     [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
135                             [% END %]
136                         </td>
137                         <td>
138                             [% IF circ.circ.target_copy.call_number.id == -1 %]
139                                 <span class="sr-only">Author</span>
140                                 [% circ.circ.target_copy.dummy_author | html %]
141                             [% ELSIF circ.ATTRS.author %]
142                                 <span class="sr-only">Author</span>
143                                 <a href="[% mkurl(ctx.opac_root _ '/results',
144                                     {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
145                                     1
146                                 ) %]">[% circ.ATTRS.author | html %]</a>
147                             [% ELSE %]
148
149                             [% END %]
150                         </td>
151                         <td>
152                             <span class="sr-only">Renewals Remaining</span>
153                             [% circ.circ.renewal_remaining %]
154                         </td>
155                         [%
156                             due_date = ctx.parse_datetime(circ.circ.due_date, circ.circ.circ_lib);
157                             due_class = (date.now > date.format(due_date, '%s')) ? 'error' : '';
158                         %]
159                         <td class='[% due_class %]'>
160                             <span class="sr-only">Due Date</span>
161                             [% date.format(due_date, DATE_FORMAT) %]
162                         </td>
163                         <td>
164                             <span class="sr-only">Barcode</span>
165                             <span class="speak:spell-out;">[% circ.circ.target_copy.barcode | html %]</span>
166                         </td>
167                         <td>
168                             <span class="sr-only">Call Number</span>
169                             [% circ.circ.target_copy.call_number.label | html %]
170                         </td>
171                          [% IF ctx.get_org_setting(ctx.user.home_ou, 'opac.show_owning_lib_column'); %]
172                           <td>
173                                 [%- fleshed_ou = circ.circ.target_copy.call_number.owning_lib;
174                                                 INCLUDE "opac/parts/library_name_link_from_ou.tt2";
175                                 %]
176                           </td>
177                         [% END; %]
178                     </tr>
179                     [%  IF circ.renewal_response AND
180                             circ.renewal_response.textcode != 'SUCCESS' %]
181                     <tr>
182                         <td colspan="[% column_count %]">[%# XXX colspan="0" does not work in IE %]
183                             <span class="failure-text" title="[% circ.renewal_response.textcode | html %] / [% circ.renewal_response.fail_part | html %]">
184                                 [%
185                                     renew_fail_msg = '';
186                                     IF circ.renewal_response.textcode == 'TOTAL_HOLD_COPY_RATIO_EXCEEDED' OR
187                                         circ.renewal_response.textcode == 'AVAIL_HOLD_COPY_RATIO_EXCEEDED';
188                                         # the stock hold ratio message may not be patron friendly
189                                         renew_fail_msg = l('Item is needed for a hold');
190                                     ELSE;
191                                         renew_fail_msg = circ.renewal_response.desc || 
192                                             circ.renewal_response.fail_part || 
193                                             circ.renewal_response.textcode;
194                                     END;
195                                     renew_fail_msg | html;
196                                 %]
197                             </span>
198                         </td>
199                     </tr>
200                     [% END; %]
201
202                 [% END; %]
203                 </tbody>
204             </table>
205         </form>
206     </div>
207     [% END %]
208 </div></div>
209 [% END %]