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";
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;
12 <h3> [% IF CGI.param("available");
13 l("Items Ready for Pickup");
15 l("Current Items on Hold");
22 <div class="col-4 text-left">
25 <button name="action" class="btn btn-action my-2" id="suspend" value="suspend" type="submit"><i class="fas fa-hand-paper" aria-hidden="true"></i> [% l("Suspend") %]</button>
26 <button name="action" class="btn btn-opac my-2" id="activate" value="activate" type="submit"><i class="fas fa-play" aria-hidden="true"></i> [% l("Activate") %] </button>
27 <button name="action" class="btn btn-danger my-2" id="cancel" value="cancel" type="submit" onclick="return confirm('[% l("Are you sure you wish to cancel the selected hold(s)?") %]');"><i class="fas fa-ban" aria-hidden="true"></i> [% l("Cancel") %]</button>
29 [% IF CGI.param("available") -%]
30 <a href="[% mkurl('holds', {}, ['limit','offset','available']) %]">[% l('Show all holds') %]</a> |
31 <strong>[% l("Show only available holds") %]</strong>
33 <strong>[% l("Show all holds") %]</strong> |
34 <a href="[% mkurl('holds',{available => 1},['limit','offset']) %]">[% l("Show only available holds") %]</a>
36 <span title="This option will show all items available for pickup." data-toggle="tooltip">
37 <i class="fas fa-question-circle" aria-hidden="true"></i>
44 [% IF offset != 0 %]<a href='[% mkurl('holds', {limit => limit,offset => (offset - limit)}) %]'
45 ><span class="np_nav_link classic_link btn btn-action">◄[% l('Previous') %]</span></a> [% END %]
47 [% IF offset > 0 || count > limit; curpage = 0; WHILE curpage * limit < count; IF curpage * limit == offset; %]
48 <span class="np_nav_link classic_link btn btn-action disabled">[% curpage + 1 %]</span>
51 <a href='[% mkurl('holds', {limit => limit, offset => (curpage * limit)}) %]' class="np_nav_link classic_link btn btn-action">[% curpage + 1 %]</a>
52 [%- END; curpage = curpage + 1; END; END %]
53 <span style="padding-left:5px;" class='error'>
54 [% IF ctx.hold_suspend_post_capture; l('One or more holds could not be suspended because the item is at (or en route to) the pickup library.'); END; %]
58 [% IF count > limit + offset %]<a href='[% mkurl('holds', {limit => limit, offset => (offset + limit)}) %]'
59 ><span class="np_nav_link classic_link btn btn-action">[% l('Next') %]►</span></a>[% END %]
67 [% IF ctx.holds.size && ctx.holds.size < 1 %]
68 <div class="warning_box">[% l('No holds found.') %]</div>
70 <div class="d-block d-md-none">
71 <input id="check_all_holds" 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 == 'hold_id' && !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
73 <label for="check_all_holds">[% l('Check/Uncheck All') %]</label>
75 <table title="[% l('Items on Hold') %]"
76 class="table table-hover table-bordered miniTable activeHoldstable w-100 my-3">
79 <td class="checkCell">
80 <input type="checkbox" aria-label="[% l('Select All Holds') %]"
81 onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'hold_id' && !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
83 <th>[% sort_head("sort_title", l('Title')) %]</th>
84 <th>[% sort_head("author", l('Author')) %]</th>
85 <th>[% sort_head("format", l('Format')) %]</th>
86 <th>[% l('Pickup Location') %]</th>
87 <th>[% l('Cancel if not filled by') %]</th>
88 <th>[% l('Status') %]</th>
89 <th>[% l('Notes') %]</th>
90 <th>[% l('Edit') %]</th>
93 <tbody id="holds_temp_parent">
95 [%# Copy the ctx.holds into a local array, then add a SORT field
96 that contains the value to sort on. Since we need the item attrs,
97 invoke it and save the result in ATTRS.
100 hold_items = ctx.holds;
102 sort_field = CGI.param('sort');
104 FOR hold IN hold_items;
105 hold.ATTRS = {marc_xml => hold.marc_xml};
106 PROCESS get_marc_attrs args=hold.ATTRS;
111 hold.SORTING = hold.ATTRS.sort_title;
114 hold.SORTING = hold.ATTRS.author;
117 hold.SORTING = hold.ATTRS.format_label;
124 IF (sort_field != "sort_title");
125 deemphasize_class = "";
127 deemphasize_class = " class=\"sort_deemphasize\"";
130 # Apply sorting to hold_items
131 IF (sort_field != "");
132 hold_items = hold_items.sort("SORTING");
133 IF (CGI.param("sort_type") == "desc");
134 hold_items = hold_items.reverse;
137 # Shorten the hold_items list per offset/limit/count
138 hi = offset + limit - 1;
139 hi = hi > hold_items.max ? hold_items.max : hi;
141 hold_items = hold_items.slice(offset, hi);
144 # hold_items list is now sorted. Traverse and dump the information.
146 FOR hold IN hold_items;
147 ahr = hold.hold.hold;
150 <tr class="[% ahr.frozen == 't' ? ' inactive-hold' : '' %]">
151 <td class="checkbox_column">
153 <span class="sr-only">Hold Number [% cnt; %]</span>
154 <input type="checkbox" name="hold_id" value="[% ahr.id %]"
155 [% html_text_attr('title', l('Select hold [_1]', attrs.title)) %]/>
158 <span class="sr-only">Title</span>
160 [% title = hold.ATTRS.title;
161 IF ahr.hold_type == 'P';
162 title = l('[_1] ([_2])', title, hold.hold.part.label);
165 <a href="[% mkurl(ctx.opac_root _ '/record/' _
166 hold.hold.bre_id, {}, 1) %]"><span[%- deemphasize_class -%]>
167 [%- title.substr(0,hold.ATTRS.nonfiling_characters) | html %]</span>
168 [%- title.substr(hold.ATTRS.nonfiling_characters) | html %]</a>
172 <span class="sr-only">Author</span>
174 <a href="[% mkurl(ctx.opac_root _ '/results',
175 {qtype => 'author', query => hold.ATTRS.author.replace('[,\.:;]', '')},
177 ) %]">[% hold.ATTRS.author | html %]</a>
181 <span class="sr-only">Format</span>
182 <div class="format_icon">
184 formats = hold.ATTRS.all_formats;
185 IF ahr.hold_type == 'M';
186 # only show selected formats for metarecords
188 FOR ccvm IN hold.metarecord_selected_filters.icons;
189 NEXT IF ccvm.opac_visible == 'f';
191 format.label = ccvm.search_label || ccvm.value;
192 format.icon = PROCESS get_ccvm_icon ccvm=ccvm;
193 formats.push(format);
196 FOR format IN formats
198 <span class="sr-only">[% format.label | html %]</span>
199 <img title="[% format.label | html %]"
200 alt="[% format.label | html %]" src="[% format.icon %][% ctx.cache_key %]" />
205 <span class="sr-only">Pickup Location</span>
206 [% ctx.get_aou(ahr.pickup_lib).name | html %]
209 <span class="sr-only">Cancel if not filled by</span>
210 [% IF ahr.expire_time;
211 date.format(ctx.parse_datetime(ahr.expire_time), DATE_FORMAT);
215 <span class="sr-only">Status</span>
217 [% PROCESS get_hold_status hold=hold; %]
220 <td class="hold_notes">
221 <span class="sr-only">Notes</span>
222 [%- FOREACH pubnote IN ahr.notes;
223 IF pubnote.pub == 't';
225 <div class="hold_note">
226 <span class="hold_note_title">[% pubnote.title | html %]</span>
228 <span class="hold_note_body">[% pubnote.body | html %]</span>
233 <a class="btn btn-confirm btn-sm" href="[% mkurl(ctx.opac_root _ '/myopac/holds/edit', {hid => ahr.id}) %]"
234 [% html_text_attr('title', l('Edit hold for item [_1]', attrs.title)) %]>
235 <i class="fas fa-edit" aria-hidden="true"></i>