]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/myopac/holds.tt2
LP1980275 Bootstrap - buttons on two lines in current hold screen
[Evergreen.git] / Open-ILS / src / templates-bootstrap / 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     parent="holds";
9     limit = (ctx.holds_limit.defined) ? ctx.holds_limit : 0;
10     offset = (ctx.holds_offset.defined) ? ctx.holds_offset : 0;
11     count = (ctx.holds_ids.size.defined) ? ctx.holds_ids.size : 0;
12 %]
13 <h3> [%  IF CGI.param("available");
14                     l("Items Ready for Pickup");
15                 ELSE;
16                     l("Items on Hold");
17                 END
18             %]</h3>
19 <div>
20     <div id='holds_main'>
21     <form method="post">
22           <div class="row">
23             <div class="col-12 text-left">
24
25                     <div>
26             <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>
27             <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>
28             <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                  <p class="my-2">
30                     [% IF CGI.param("available") -%]
31                     <a href="[% mkurl('holds', {}, ['limit','offset','available']) %]">[% l('Show all holds') %]</a> |
32                     <strong>[% l("Show only available holds") %]</strong>
33                     [% ELSE -%]
34                     <strong>[% l("Show all holds") %]</strong> |
35                     <a href="[% mkurl('holds',{available => 1},['limit','offset']) %]">[% l("Show only available holds") %]</a>
36                     [% END -%]
37                      <a href="#" title="This option will show all items available for pickup." data-toggle="tooltip">
38                         <i class="fas fa-question-circle" aria-hidden="true"></i>
39                     </a>
40                </p>
41
42           </div>
43             </div>
44             <div class="col-8">
45              [% IF offset != 0 %]<a href='[% mkurl('holds', {limit => limit,offset => (offset - limit)}) %]'
46               ><span class="np_nav_link classic_link btn btn-action">&#9668;[% l('Previous') %]</span></a> [% END %]
47
48              [% IF offset > 0 || count > limit; curpage = 0; WHILE curpage * limit < count; IF curpage * limit == offset; %]
49                   <span class="np_nav_link classic_link btn btn-action disabled">[% curpage + 1 %]</span>
50
51                     [%- ELSE %]
52                 <a href='[% mkurl('holds', {limit => limit, offset => (curpage * limit)}) %]' class="np_nav_link classic_link btn btn-action">[% curpage + 1 %]</a>
53                     [%- END; curpage = curpage + 1; END; END %]
54                 <span style="padding-left:5px;" class='error'>
55                     [%  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; %]
56                 </span>
57
58
59                 [% IF count > limit + offset %]<a href='[% mkurl('holds', {limit => limit, offset => (offset + limit)}) %]'
60                   ><span class="np_nav_link classic_link btn btn-action">[% l('Next') %]&#9658;</span></a>[% END %]
61
62
63             </div>
64
65
66           </div>
67
68         [% IF ctx.holds.size && ctx.holds.size < 1 %]
69         <div class="warning_box">[% l('No holds found.') %]</div>
70         [% ELSE %]
71         <div class="d-block d-md-none">
72             <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' &amp;&amp; !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
73
74             <label for="check_all_holds">[% l('Check/Uncheck All') %]</label>
75         </div>
76         <table title="[% l('Items on Hold') %]"
77         class="table table-hover table-bordered miniTable activeHoldstable w-100 my-3">
78             <thead>
79             <tr>
80                 <td class="checkCell">
81                     <input type="checkbox" aria-label="[% l('Select All Holds') %]"
82                       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;}"/>
83                 </td>
84                 <th>[% l("Cover") %]</th>
85                 <th>[% sort_head("sort_title", l('Title')) %]</th>
86                 <th>[% sort_head("author", l('Author')) %]</th>
87                 <th>[% sort_head("format", l('Format')) %]</th>
88                 <th>[% l('Pickup Location') %]</th>
89                 <th>[% l('Cancel if not filled by') %]</th>
90                 <th>[% l('Status') %]</th>
91                 <th>[% l('Notify Method') %]</th>
92                 <th>[% l('Notes') %]</th>
93                 <th>[% l('Edit') %]</th>
94             </tr>
95             </thead>
96             <tbody id="holds_temp_parent">
97
98                 [%# Copy the ctx.holds into a local array, then add a SORT field
99                     that contains the value to sort on.  Since we need the item attrs,
100                     invoke it and save the result in ATTRS.
101         %]
102         [%
103                 hold_items = ctx.holds;
104
105                 sort_field = CGI.param('sort');
106
107                 FOR hold IN hold_items;
108                     hold.ATTRS = {marc_xml => hold.marc_xml};
109                     PROCESS get_marc_attrs args=hold.ATTRS;
110
111                     SWITCH sort_field;
112
113                        CASE "sort_title";
114                           hold.SORTING = hold.ATTRS.sort_title;
115
116                        CASE "author";
117                           hold.SORTING = hold.ATTRS.author;
118
119                        CASE "format";
120                           hold.SORTING = hold.ATTRS.format_label;
121
122                        CASE;
123                           sort_field = "";
124                     END; # SWITCH
125                 END; #FOR hold
126
127                 IF (sort_field != "sort_title");
128                    deemphasize_class = "";
129                 ELSE;
130                    deemphasize_class = " class=\"sort_deemphasize\"";
131                 END;
132
133                 # Apply sorting to hold_items
134             IF (sort_field != "");
135             hold_items = hold_items.sort("SORTING");
136                     IF (CGI.param("sort_type") == "desc");
137                         hold_items = hold_items.reverse;
138                     END;
139
140                     # Shorten the hold_items list per offset/limit/count
141                     hi = offset + limit - 1;
142                     hi = hi > hold_items.max ? hold_items.max : hi;
143
144                     hold_items = hold_items.slice(offset, hi);
145                 END;
146
147         # hold_items list is now sorted.  Traverse and dump the information.
148                 cnt = 0;
149                 FOR hold IN hold_items;
150                     ahr = hold.hold.hold;
151                     cnt = cnt + 1;
152                      %]
153                 <tr class="[% ahr.frozen == 't' ? ' inactive-hold' : '' %]">
154                     <td class="checkbox_column">
155
156                     <span class="sr-only">Hold Number [%  cnt; %]</span>
157                         <input type="checkbox" name="hold_id" value="[% ahr.id %]"
158                             [% html_text_attr('title', l('Select hold [_1]', attrs.title)) %]/>
159                     </td>
160                     [%  IF hold.ATTRS.issns.0;
161                             row_isbnissn = hold.ATTRS.issns.0;
162                         ELSIF hold.ATTRS.isbns.0;
163                             row_isbnissn = hold.ATTRS.isbns.0;
164                         ELSE;
165                             row_isbnissn = '';
166                         END;
167                         row_rec_id = hold.hold.bre_id;
168                         row_title = hold.ATTRS.title;
169                         PROCESS show_cover;
170                     %]
171                     <td>
172                     <span class="sr-only">Title</span>
173                         <div>
174                             [% title = hold.ATTRS.title;
175                             IF ahr.hold_type == 'P';
176                                 title = l('[_1] ([_2])', title, hold.hold.part.label);
177                             END; %]
178
179                             <a href="[% mkurl(ctx.opac_root _ '/record/' _
180                                 hold.hold.bre_id, {}, 1) %]"><span[%- deemphasize_class -%]>
181                                 [%- title.substr(0,hold.ATTRS.nonfiling_characters) | html %]</span>
182                                 [%- title.substr(hold.ATTRS.nonfiling_characters)   | html %]</a>
183                         </div>
184                     </td>
185                     <td>
186                     <span class="sr-only">Author</span>
187                         <div>
188                             <a href="[% mkurl(ctx.opac_root _ '/results',
189                                 {qtype => 'author', query => hold.ATTRS.author.replace('[,\.:;]', '')},
190                                 1
191                             ) %]">[% hold.ATTRS.author | html %]</a>
192                         </div>
193                     </td>
194                     <td>
195                     <span class="sr-only">Format</span>
196                         <div class="format_icon">
197                           [%
198                             formats = hold.ATTRS.all_formats;
199                             IF ahr.hold_type == 'M';
200                               # only show selected formats for metarecords
201                               formats = [];
202                               FOR ccvm IN hold.metarecord_selected_filters.icons;
203                                 NEXT IF ccvm.opac_visible == 'f';
204                                 format = {};
205                                 format.label = ccvm.search_label || ccvm.value;
206                                 format.icon = PROCESS get_ccvm_icon ccvm=ccvm;
207                                 formats.push(format);
208                               END;
209                             END;
210                             FOR format IN formats
211                           %]
212                           <span class="sr-only">[% format.label | html %]</span>
213                             <img title="[% format.label | html %]"
214                               alt="[% format.label | html %]" src="[% format.icon %][% ctx.cache_key %]" />
215                             [% END %]
216                         </div>
217                     </td>
218                     <td>
219                     <span class="sr-only">Pickup Location</span>
220                         [% ctx.get_aou(ahr.pickup_lib).name | html %]
221                     </td>
222                     <td>
223                     <span class="sr-only">Cancel if not filled by</span>
224                         [% IF ahr.expire_time;
225                             date.format(ctx.parse_datetime(ahr.expire_time), DATE_FORMAT);
226                         END %]
227                     </td>
228                     <td>
229                     <span class="sr-only">Status</span>
230                         <div>
231                             [% PROCESS get_hold_status hold=hold; %]
232                         </div>
233                     </td>
234                     <td>
235                     <span class="sr-only">Notify Method</span>
236                         <div>
237                             [% PROCESS get_hold_notify h=ahr; %]
238                         </div>
239                     </td>
240                     <td class="hold_notes">
241                     <span class="sr-only">Notes</span>
242                     [%- FOREACH pubnote IN ahr.notes;
243                         IF pubnote.pub == 't';
244                     %]
245                         <div class="hold_note">
246                             <span class="hold_note_title">[% pubnote.title | html %]</span>
247                             <br />
248                             <span class="hold_note_body">[% pubnote.body | html %]</span>
249                         </div>
250                     [%- END; END; %]
251                     </td>
252                     <td class="fullRow">
253                         <a class="btn btn-confirm btn-sm" href="[% mkurl(ctx.opac_root _ '/myopac/holds/edit', {hid => ahr.id}) %]"
254                             [% html_text_attr('title', l('Edit hold for item [_1]', attrs.title)) %]>
255                             <i class="fas fa-edit" aria-hidden="true"></i>
256                             [% l('Edit') %]
257                         </a>
258                     </td>
259                 </tr>
260                 [% END %]
261             </tbody>
262         </table>
263         [% END %]
264         </form>
265     </div>
266 </div>
267 [% END %]