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