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 = "circ_history"
7 limit = ctx.circ_history_limit;
8 offset = ctx.circ_history_offset;
10 <h3>[% l('History of Checked Out Items') %]</h3>
11 <div style="padding:0px;">
13 # In the sorting case, the size is the size of ALL the circ items. In the non-sorting case,
14 # the size is simply the size of the chunk passed in. See the TODO below for the still-lingering
16 sort_field = CGI.param('sort');
18 no_next = ctx.circs.size - offset <= limit;
20 no_next = ctx.circs.size < limit;
26 [% IF ctx.circs.size < 1 %]
27 <div class="warning_box">[% l('There are no items in your circulation history.') %]</div>
30 <form method="post" id="circ-form">
33 <div class="col-3 text-left">[% IF offset != 0 %]<a href='[% mkurl('circ_history', {limit => limit, offset => (offset - limit)}) %]'
34 class="btn btn-action mr-3" ><span class="nav_arrow_fix">◄</span>[% l('Previous') %]</a>[% END %]
35 <button name="action" class="btn btn-deny my-2" id="delete" value="delete" type="submit" onclick="return confirm('[% l("Are you sure you wish to delete the selected item(s)?") %]');">
36 <i class="fas fa-trash-alt" aria-hidden="true"></i> Delete Selected</button>
38 <div class="col-6 text-center"></div>
39 <div class="col-3 text-right">[% IF !no_next %]<a href='[% mkurl('circ_history', {limit => limit, offset => (offset + limit)}) %]'
40 class="btn btn-action" >[% l('Next') %]<span class="nav_arrow_fix">►</span></a>[% END %] </div>
42 <div id='checked_main'>
43 <div class="d-block d-md-none">
46 <input id="check_all_circ_hist" checked="checked" type="checkbox" onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'circ_id' && !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
48 <label for="check_all_circ_hist">[% l('Check/Uncheck All') %]</label>
50 <table title="[% l('History of Items Checked Out') %]" id="acct_checked_hist_header" class="table table-hover table-bordered miniTable circHistTable my-3">
53 <td class="checkCell">
54 <input type="checkbox" onclick="var inputs=document.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'circ_id' && !inputs[i].disabled) inputs[i].checked = this.checked;}" aria-label="[% l('Click to (un)select all items') %]"/>
56 <th>[% l("Cover") %]</th>
57 <th>[% sort_head("sort_title", l("Title")) %]</th>
58 <th>[% sort_head("author", l("Author")) %]</th>
59 <th>[% sort_head("callnum", l("Call Number")) %]</th>
60 <th>[% sort_head("checkout", l("Checkout Date")) %]</th>
61 <th>[% sort_head("due", l("Due Date")) %]</th>
62 <th>[% sort_head("returned", l("Date Returned")) %]</th>
63 <th>[% sort_head("barcode", l("Barcode")) %]</th>
67 [%# Copy the ctx.circs into a local array, then add a SORT field
68 that contains the value to sort on. Since we need the item attrs,
69 invoke it and save the result in ATTRS.
72 circ_items = ctx.circs; # Array assignment
74 FOR circ IN circ_items;
75 circ.ATTRS = {marc_xml => circ.marc_xml};
76 PROCESS get_marc_attrs args=circ.ATTRS;
81 circ.SORTING = circ.ATTRS.sort_title;
84 circ.SORTING = circ.ATTRS.author;
87 circ.SORTING = circ.circ.xact_start;
90 circ.SORTING = circ.circ.due_date;
93 circ.SORTING = circ.circ.checkin_time;
96 circ.SORTING = circ.circ.target_copy.barcode;
101 FOREACH element IN [circ.circ.target_copy.call_number.prefix.label_sortkey
102 circ.circ.target_copy.call_number.label_sortkey
103 circ.circ.target_copy.call_number.suffix.label_sortkey
104 circ.circ.target_copy.parts.0.label_sortkey];
106 sortlist.push(element);
109 circ.SORTING = sortlist.join("");
116 IF (sort_field != "sort_title");
117 deemphasize_class = "";
119 deemphasize_class = " class=\"sort_deemphasize\"";
122 # Apply sorting to circ_items
124 circ_items = circ_items.sort("SORTING");
125 IF (CGI.param("sort_type") == "desc");
126 circ_items = circ_items.reverse;
129 # Shorten the circ_items list per offset/limit/cout
130 hi = offset + limit - 1;
131 hi = hi > circ_items.max ? circ_items.max : hi;
133 circ_items = circ_items.slice(offset, hi);
136 # circ_items list is now sorted. Traverse and dump the information.
138 FOR circ IN circ_items; %]
140 <td class="checkbox_column">
141 <input type="checkbox" name="circ_id" value="[% circ.circ.id %]" aria-label="Select Item"/>
143 [% IF circ.ATTRS.issns.0;
144 row_isbnissn = circ.ATTRS.issns.0;
145 ELSIF circ.ATTRS.isbns.0;
146 row_isbnissn = circ.ATTRS.isbns.0;
150 row_rec_id = circ.circ.target_copy.call_number.record.id;
151 row_title = circ.ATTRS.title;
155 [% IF circ.circ.target_copy.call_number.id == -1 %]
156 [% circ.circ.target_copy.dummy_title | html %]
157 [% ELSIF circ.ATTRS.title %]
158 <a href="[% mkurl(ctx.opac_root _ '/record/' _
159 circ.circ.target_copy.call_number.record.id, {}, 1) %]">
160 <span[%- deemphasize_class -%]>
161 [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
162 [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
166 [% IF circ.circ.target_copy.call_number.id == -1 %]
167 [% circ.circ.target_copy.dummy_author | html %]
168 [% ELSIF circ.ATTRS.author %]
169 <a href="[% mkurl(ctx.opac_root _ '/results',
170 {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
172 ) %]">[% circ.ATTRS.author | html %]</a>
178 FOREACH element IN [circ.circ.target_copy.call_number.prefix.label
179 circ.circ.target_copy.call_number.label
180 circ.circ.target_copy.call_number.suffix.label];
182 cnlist.push(element);
185 cn = cnlist.join(' ');
188 [%- IF circ.circ.target_copy.parts.0.label %]
189 </BR>[% circ.circ.target_copy.parts.0.label | html -%]
193 [% date.format(ctx.parse_datetime(circ.circ.xact_start),DATE_FORMAT); %]
196 [% IF circ.circ.source_circ;
197 date.format(ctx.parse_datetime(circ.circ.due_date, circ.circ.source_circ.circ_lib),DATE_FORMAT);
199 date.format(ctx.parse_datetime(circ.circ.due_date, ctx.user.home_ou),DATE_FORMAT);
204 [% IF circ.circ.checkin_time;
205 date.format(ctx.parse_datetime(circ.circ.checkin_time),DATE_FORMAT);
207 <span style='color:blue;'>Not Returned</span><!-- meh -->
210 <td>[% circ.circ.target_copy.barcode | html %]</td>
218 <form action="[% mkurl(ctx.opac_root _ '/myopac/circ_history/export') %]" method="post">
220 [%- INCLUDE "opac/parts/preserve_params.tt2" %]
221 [% IF ctx.circs.size > 0 %]
222 <input type="hidden" name="filename" value="[% l('circ_history.csv') %]"/>
223 <button type="submit" class="btn btn-action"><i class="fas fa-file-download" aria-hidden="true"></i> [% l('Download CSV') %]</button>