]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac-new/myopac/circs.tt2
LP#1778972: (follow-up) remove a NFPL-specific template
[Evergreen.git] / Open-ILS / src / templates / opac-new / myopac / circs.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     PROCESS "opac/parts/myopac/column_sort_support.tt2";
4     WRAPPER "opac/parts/myopac/base.tt2";
5     myopac_page = "circs";
6 %]
7 <h3 class="sr-only">[% l('Current Items Checked Out') %]</h3>
8 <div id='myopac_checked_div'>
9         <div>
10      <ul class="nav nav-pills nav-fill">
11         <li class="nav-item m-2">
12             <a class="nav-link active" href='#'>[% l("Current Items Checked Out") %]</a>
13         </li>
14         [%- IF ebook_api.enabled == 'true' %]
15         <li class="nav-item m-2">
16             <a class="nav-link not_active_pill" href="[% mkurl('ebook_circs',{},1) %]">[% l("E-Items Currently Checked Out") %]</a>
17         </li>
18         [%- END %]
19         <li class="nav-item active m-2">
20             <a class="nav-link not_active_pill" href="[% mkurl('circ_history',{},1) %]">[% l("Check Out History") %]</a>
21         </li>
22     </ul>
23         </div>
24     <div class="my-4">
25     <div class="header_middle">
26         <span class="float-left">[% l('Current Items Checked Out') %]</span>
27     </div>
28     <div class="clear-both"></div>
29     [% IF ctx.circs.size < 1 %]
30     <div class="warning_box">[% l('You have no items checked out.') %]</div>
31     [% ELSE %]
32     [% IF ctx.success_renewals %]
33     <div class="renew-summary">
34         [% l("Successfully renewed [_1] item(s)", ctx.success_renewals) %]
35     </div>
36     [% END %]
37     [% IF ctx.failed_renewals %]
38     <div class="renew-summary alert">
39         [% l("Failed to renew [_1] item(s)", ctx.failed_renewals) %]
40     </div>
41     [% END %]
42     <div id='checked_main'>
43         <form method="post" id="circ-form"
44             onsubmit="return confirm('[% l("Are you sure you wish to renew the selected item(s)?") %]');">
45          <div class="row">
46                 <span class="col-md-11 my-2">
47                 <select class="form-control" name="action" title="[% l('Select Action') %]">
48                     <option value="renew">[% l('Renew Selected Titles') %]</option>
49                 </select>
50             </span>
51             <span class="col-md-1 my-2">
52                 <input type="submit"
53                     value="[% l('Go') %]"
54                     title="[% l('Go') %]"
55                     class="btn btn-confirm" />
56             </span>
57            <!-- <span style="padding-left:5px;">
58                 <a href="#"><img 
59                     alt="[% l('Renewing Help') %]"
60                     title="[% l('Actions for checked out items') %]"
61                     src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
62             </span> -->
63         </div>
64
65         <table  id="acct_checked_main_header"  title="[% l('Items Checked Out') %]"
66             class="table table-hover miniTable circTable">
67             <thead>
68             <tr>
69                 <th class="checkbox_column">
70                     <input type="checkbox" id="check_all_checked"
71                         title="[% l('Select All Items') %]"
72                         onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'circ' &amp;&amp; !inputs[i].disabled) inputs[i].checked = this.checked;}"
73                     />
74                 </th>
75                 <th>[% sort_head("sort_title", l("Title")) %]</th>
76                 <th>[% sort_head("author", l("Author")) %]</th>
77                 <th>[% sort_head("renews", l("Renewals Left")) %]</th>
78                 <th>[% sort_head("due", l("Due Date")) %]</th>
79                 <th>[% sort_head("barcode", l("Barcode")) %]</th>
80                 <th>[% sort_head("callnum", l("Call Number")) %]</th>
81                  [% IF ctx.get_org_setting(ctx.user.home_ou, 'opac.show_owning_lib_column'); %]
82                    <th>[% sort_head("lib", l("Owning Library")) %]</th>
83                    [% column_count = 8;
84                 ELSE ;
85                    column_count = 7;
86                 END; %]
87             </tr>
88             </thead>
89             <tbody>
90                 [%# Copy the ctx.circs into a local array, then add a SORT field
91                     that contains the value to sort on.  Since we need the item attrs,
92                     invoke it and save the result in ATTRS.
93                 %]
94                 [% 
95                 circ_items = ctx.circs;  # Array assignment
96
97                 sort_field = CGI.param('sort');  # unless changed below...
98
99                 FOR circ IN circ_items;
100                     circ.ATTRS = {marc_xml => circ.marc_xml};
101                     PROCESS get_marc_attrs args=circ.ATTRS;
102                 
103                     SWITCH sort_field;
104
105                        CASE "sort_title";
106                           circ.SORTING = circ.ATTRS.sort_title;
107
108                        CASE "author";
109                           circ.SORTING = circ.ATTRS.author;
110
111                        CASE "renews";
112                           circ.SORTING = circ.circ.renewal_remaining;
113                        
114                        CASE "due";
115                           circ.SORTING = circ.circ.due_date;
116                        
117                        CASE "barcode";
118                           circ.SORTING = circ.circ.target_copy.barcode;
119
120                        CASE "callnum";
121                           circ.SORTING = circ.circ.target_copy.call_number.label;
122                         CASE "lib";
123                           circ.SORTING = circ.circ.target_copy.call_number.owning_lib.name;
124                        
125                        CASE;
126                           sort_field = "";
127                     END; # SWITCH
128                 END; #FOR circ
129
130                 IF (sort_field != "sort_title");
131                    deemphasize_class = "";
132                 ELSE;
133                    deemphasize_class = " class=\"sort_deemphasize\"";
134                 END;
135
136                 # Apply sorting to circ_items
137                 IF (sort_field);
138                     circ_items = circ_items.sort("SORTING");
139                     IF (CGI.param("sort_type") == "desc");
140                         circ_items = circ_items.reverse;
141                     END;
142                 END;
143
144                 # circ_items list is now sorted.  Traverse and dump the information.
145
146                 FOR circ IN circ_items; %]
147                     <tr>
148                         <td class="checkbox_column" valign="top">
149                             <input type="checkbox" name="circ"
150                                 title="[% l('Item Selected') %]"
151                                 [% IF circ.circ.renewal_remaining < 1 %] disabled="disabled" [% END %]
152                                 value="[% circ.circ.id %]" />
153                         </td>
154                         <td name="title">
155                             <span class="sr-only">Title</span>
156                             [% IF circ.circ.target_copy.call_number.id == -1 %]
157                                 [% circ.circ.target_copy.dummy_title | html %]
158                             [% ELSIF circ.ATTRS.title %]
159                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ 
160                                     circ.circ.target_copy.call_number.record.id, {}, 1) %]"
161                                     name="[% l('Catalog record') %]"><span[%- deemphasize_class -%]>
162                                     [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
163                                     [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
164                             [% END %]
165                         </td>
166                         <td name="author">
167                             [% IF circ.circ.target_copy.call_number.id == -1 %]
168                                 <span class="sr-only">Author</span>
169                                 [% circ.circ.target_copy.dummy_author | html %]
170                             [% ELSIF circ.ATTRS.author %]
171                                 <span class="sr-only">Author</span>
172                                 <a href="[% mkurl(ctx.opac_root _ '/results',
173                                     {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
174                                     1
175                                 ) %]">[% circ.ATTRS.author | html %]</a>
176                             [% ELSE %]
177
178                             [% END %]
179                         </td>
180                         <td name="renewals">
181                             <span class="sr-only">Renewals Remaining</span>
182                             [% circ.circ.renewal_remaining %]
183                         </td>
184                         [%
185                             due_date = ctx.parse_datetime(circ.circ.due_date, circ.circ.circ_lib);
186                             due_class = (date.now > date.format(due_date, '%s')) ? 'error' : '';
187                         %]
188                         <td name="due_date" class='[% due_class %]'>
189                             <span class="sr-only">Due Date</span>
190                             [% date.format(due_date, DATE_FORMAT) %]
191                         </td>
192                         <td name="barcode">
193                             <span class="sr-only">Barcode</span>
194                             <span class="speak:spell-out;">[% circ.circ.target_copy.barcode | html %]</span>
195                         </td>
196                         <td name="call_number">
197                             <span class="sr-only">Call Number</span>
198                             [% circ.circ.target_copy.call_number.label | html %]
199                         </td>
200                          [% IF ctx.get_org_setting(ctx.user.home_ou, 'opac.show_owning_lib_column'); %]
201                           <td name="lib">
202                                 [%- fleshed_ou = circ.circ.target_copy.call_number.owning_lib;
203                                                 INCLUDE "opac/parts/library_name_link_from_ou.tt2";
204                                 %]
205                           </td>
206                         [% END; %]
207                     </tr>
208                     [%  IF circ.renewal_response AND
209                             circ.renewal_response.textcode != 'SUCCESS' %]
210                     <tr>
211                         <td colspan="[% column_count %]">[%# XXX colspan="0" does not work in IE %]
212                             <span class="failure-text" title="[% circ.renewal_response.textcode | html %] / [% circ.renewal_response.fail_part | html %]">
213                                 [%
214                                     renew_fail_msg = '';
215                                     IF circ.renewal_response.textcode == 'TOTAL_HOLD_COPY_RATIO_EXCEEDED' OR
216                                         circ.renewal_response.textcode == 'AVAIL_HOLD_COPY_RATIO_EXCEEDED';
217                                         # the stock hold ratio message may not be patron friendly
218                                         renew_fail_msg = l('Item is needed for a hold');
219                                     ELSE;
220                                         renew_fail_msg = circ.renewal_response.desc || 
221                                             circ.renewal_response.fail_part || 
222                                             circ.renewal_response.textcode;
223                                     END;
224                                     renew_fail_msg | html;
225                                 %]
226                             </span>
227                         </td>
228                     </tr>
229                     [% END; %]
230
231                 [% END; %]
232                 </tbody>
233             </table>
234         </form>
235     </div>
236     [% END %]
237 </div></div>
238 [% END %]