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