LP1837656 Org proximity admin disable org filter
[working/Evergreen.git] / Open-ILS / src / templates / opac / myopac / holds.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     PROCESS "opac/parts/hold_status.tt2";
4     PROCESS "opac/parts/hold_notify.tt2";
5     PROCESS "opac/parts/myopac/column_sort_support.tt2";
6     WRAPPER "opac/parts/myopac/base.tt2";
7     myopac_page = "holds";
8     limit = (ctx.holds_limit.defined) ? ctx.holds_limit : 0;
9     offset = (ctx.holds_offset.defined) ? ctx.holds_offset : 0;
10     count = (ctx.holds_ids.size.defined) ? ctx.holds_ids.size : 0;
11 %]
12 <h3 class="sr-only">[% l('My Holds') %]</h3>
13 <div id='myopac_holds_div'>
14
15     <div id="acct_holds_tabs">
16         <div class="align selected">
17             <a href='#'>[% l("Items on Hold") %]</a>
18         </div>
19         [% IF ebook_api.enabled == 'true' %]
20         <div class="align">
21             <a href='[% mkurl('ebook_holds', {}, ['limit','offset','available','sort','sort_type']) %]'>[% l("E-Items on Hold") %]</a>
22         </div>
23         <div class="align">
24             <a href='[% mkurl('ebook_holds_ready', {}, ['limit','offset','available','sort','sort_type']) %]'>[% l("E-Items Ready for Checkout") %]</a>
25         </div>
26         [% END %]
27         <div class="align">
28             <a href='[% mkurl('hold_history', {}, ['limit','offset','available','sort','sort_type']) %]'>[% l("Holds History") %]</a>
29         </div>
30     </div>
31
32     <div class="header_middle">
33         <span id="acct_holds_header" style="float:left;">
34             [%  IF CGI.param("available");
35                     l("Items Ready for Pickup");
36                 ELSE;
37                     l("Current Items on Hold");
38                 END
39             %]
40         </span>
41         <span class='float-left' style='padding-left: 10px;'>
42             <a href='[% mkurl('holds', {limit => limit,offset => (offset - limit)}) %]'
43                 [% IF offset <= 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
44             [% IF offset > 0 || count > limit;
45                 curpage = 0;
46                 WHILE curpage * limit < count;
47                     IF curpage * limit == offset;
48             %]
49             [% curpage + 1 %]
50                     [%- ELSE %]
51             <a href='[% mkurl('holds', {limit => limit, offset => (curpage * limit)}) %]'>[% curpage + 1 %]</a>
52                     [%- END;
53                     curpage = curpage + 1;
54                 END;
55             END %]
56             <a href='[% mkurl('holds', {limit => limit, offset => (offset + limit)}) %]'
57                [% IF count <= limit + offset %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
58         </span>
59
60     </div>
61     <div class="clear-both"></div>
62     <div id='holds_main'>
63         <form method="post">
64         <table class="table_no_border_space table_no_cell_pad opac-auto-097"
65             title="[% l('Actions for Items on Hold') %]">
66             <tr>
67                 <td>
68                     <select name="action" id="acct_holds_actions" 
69                       title="[% l('Select your action for the selected holds') %]">
70                         <option id='myopac_holds_actions_none' value=''>
71                         -- [% l("Actions for selected holds") %] --
72                         </option>
73                         <option value='suspend'>[% l("Suspend") %]</option>
74                         <option value='activate'>[% l("Activate") %]</option>
75                         <!-- XXX maybe later <option value='thaw_date'>[% l("Set Active Date") %]</option> -->
76                         <option value='cancel'>[% l("Cancel") %]</option>
77                     </select>
78                 </td>
79                 <td style="padding-left:9px;">
80                     <input type="submit" value="[% l('Go') %]"
81                         title="[% l('Go') %]" class="opac-button" />
82                 </td>
83                 <td style="padding-left:5px;">
84                     <a href="#"><img
85                         alt="[% l('Holds Help') %]"
86                         title="[% l('Actions for selected holds') %]"
87                         src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
88                 </td>
89                 <td style="padding-left:5px;" class='error'>
90                     [%  IF ctx.hold_suspend_post_capture;
91                             l('One or more holds could not be suspended because the item is at (or en route to) the pickup library.');
92                         END;
93                     %]
94                 </td>
95                 <td align="right">
96                     [% IF CGI.param("available") -%]
97                     <a href="[% mkurl('holds', {}, ['limit','offset','available']) %]">[% l('Show all holds') %]</a> |
98                     <strong>[% l("Show only available holds") %]</strong>
99                     [% ELSE -%]
100                     <strong>[% l("Show all holds") %]</strong> |
101                     <a href="[% mkurl('holds',{available => 1},['limit','offset']) %]">[% l("Show only available holds") %]</a>
102                     [% END -%]
103                 </td>
104             </tr>
105         </table>
106         [% IF ctx.holds.size && ctx.holds.size < 1 %]
107         <div class="warning_box">[% l('No holds found.') %]</div>
108         [% ELSE %]
109         <table id="acct_holds_main_header" title="[% l('Items on Hold') %]"
110             class="table_no_border_space table_no_cell_pad">
111             <thead>
112             <tr>
113                 <th class="checkbox_column"> 
114                     <input type="checkbox" title="[% l('Select All Holds') %]"
115                       onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'hold_id' &amp;&amp; !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
116                 </th>
117                 <th>[% sort_head("sort_title", l('Title')) %]</th>
118                 <th>[% sort_head("author", l('Author')) %]</th>
119                 <th>[% sort_head("format", l('Format')) %]</th>
120                 <th>[% l('Pickup Location') %]</th>
121                 <th>[% l('Cancel if not filled by') %]</th>
122                 <th>[% l('Status') %]</th>
123                 <th>[% l('Notify Method') %]</th>
124                 <th>[% l('Notes') %]</th>
125             </tr>
126             </thead>
127             <tbody id="holds_temp_parent">
128
129                 [%# Copy the ctx.holds into a local array, then add a SORT field
130                     that contains the value to sort on.  Since we need the item attrs,
131                     invoke it and save the result in ATTRS.
132                 %]
133                 [% 
134                 hold_items = ctx.holds;
135
136                 sort_field = CGI.param('sort');
137
138                 FOR hold IN hold_items;
139                     hold.ATTRS = {marc_xml => hold.marc_xml};
140                     PROCESS get_marc_attrs args=hold.ATTRS;
141
142                     SWITCH sort_field;
143
144                        CASE "sort_title";
145                           hold.SORTING = hold.ATTRS.sort_title;
146
147                        CASE "author";
148                           hold.SORTING = hold.ATTRS.author;
149
150                        CASE "format";
151                           hold.SORTING = hold.ATTRS.format_label;
152                        
153                        CASE;
154                           sort_field = "";
155                     END; # SWITCH
156                 END; #FOR hold
157
158                 IF (sort_field != "sort_title");
159                    deemphasize_class = "";
160                 ELSE;
161                    deemphasize_class = " class=\"sort_deemphasize\"";
162                 END;
163
164                 # Apply sorting to hold_items
165                 IF (sort_field != "");
166                     hold_items = hold_items.sort("SORTING");
167                     IF (CGI.param("sort_type") == "desc");
168                         hold_items = hold_items.reverse;
169                     END;
170
171                     # Shorten the hold_items list per offset/limit/count 
172                     hi = offset + limit - 1;
173                     hi = hi > hold_items.max ? hold_items.max : hi;
174
175                     hold_items = hold_items.slice(offset, hi);
176                 END;
177
178                 # hold_items list is now sorted.  Traverse and dump the information.
179                
180                 FOR hold IN hold_items;
181                     ahr = hold.hold.hold %]
182                 <tr name="acct_holds_temp"
183                     class="acct_holds_temp[% ahr.frozen == 't' ? ' inactive-hold' : '' %]">
184                     <td class="checkbox_column">
185                         <input type="checkbox" name="hold_id" value="[% ahr.id %]" 
186                             [% html_text_attr('title', l('Select hold [_1]', attrs.title)) %]/>
187                     </td>
188                     <td>
189                         <div>
190                             [% title = hold.ATTRS.title;
191                             IF ahr.hold_type == 'P';
192                                 title = l('[_1] ([_2])', title, hold.hold.part.label);
193                             END; %]
194
195                             <a href="[% mkurl(ctx.opac_root _ '/record/' _ 
196                                 hold.hold.bre_id, {}, 1) %]"
197                                 name="[% l('Catalog record') %]"><span[%- deemphasize_class -%]>
198                                 [%- title.substr(0,hold.ATTRS.nonfiling_characters) | html %]</span>
199                                 [%- title.substr(hold.ATTRS.nonfiling_characters)   | html %]</a>
200                         </div>
201                     </td>
202                     <td>
203                         <div>
204                             <a href="[% mkurl(ctx.opac_root _ '/results',
205                                 {qtype => 'author', query => hold.ATTRS.author.replace('[,\.:;]', '')},
206                                 1
207                             ) %]">[% hold.ATTRS.author | html %]</a>
208                         </div>
209                     </td>
210                     <td>
211                         <div class="format_icon">
212                           [% 
213                             formats = hold.ATTRS.all_formats;
214                             IF ahr.hold_type == 'M';
215                               # only show selected formats for metarecords
216                               formats = [];
217                               FOR ccvm IN hold.metarecord_selected_filters.icons;
218                                 NEXT IF ccvm.opac_visible == 'f';
219                                 format = {};
220                                 format.label = ccvm.search_label || ccvm.value;
221                                 format.icon = PROCESS get_ccvm_icon ccvm=ccvm;
222                                 formats.push(format);
223                               END;
224                             END;
225                             FOR format IN formats 
226                           %]
227                             <img title="[% format.label | html %]" 
228                               alt="[% format.label | html %]" src="[% format.icon %][% ctx.cache_key %]" />
229                             [% END %]
230                         </div>
231                     </td>
232                     <td>
233                         [% ctx.get_aou(ahr.pickup_lib).name | html %]
234                     </td>
235                     <td>
236                         [% IF ahr.expire_time;
237                             date.format(ctx.parse_datetime(ahr.expire_time), DATE_FORMAT);
238                         END %]
239                     </td>
240                     <td>
241                         <div name="acct_holds_status">
242                             [% PROCESS get_hold_status hold=hold; %]
243                         </div>
244                     </td>
245                     <td>
246                         <div name="acct_holds_notify">
247                             [% PROCESS get_hold_notify h=ahr; %]
248                         </div>
249                     </td>
250                     <td class="hold_notes">
251                     [%- FOREACH pubnote IN ahr.notes;
252                         IF pubnote.pub == 't';
253                     %]
254                         <div class="hold_note">
255                             <span class="hold_note_title">[% pubnote.title | html %]</span>
256                             <br />
257                             <span class="hold_note_body">[% pubnote.body | html %]</span>
258                         </div>
259                     [%- END; END; %]
260                     </td>
261                     <td class="opac-auto-161">
262                         <a href="[% mkurl(ctx.opac_root _ '/myopac/holds/edit', {hid => ahr.id}) %]"
263                             [% html_text_attr('title', l('Edit hold for item [_1]', attrs.title)) %]>
264                             [% l('Edit') %]
265                         </a>
266                     </td>
267                 </tr>
268                 [% END %]
269             </tbody>
270         </table>
271         [% END %]
272         </form>
273     </div>
274 </div>
275 [% END %]