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