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";
6 limit = ctx.circ_history_limit;
7 offset = ctx.circ_history_offset;
10 <h3 class="sr-only">[% l('History of Checked Out Items') %]</h3>
11 <div style="padding:0px;">
13 <ul class="nav nav-pills nav-fill">
14 <li class="nav-item m-2">
15 <a class="nav-link not_active_pill" href='[% mkurl('circs',{},1) %]'>[% l("Current Items Checked Out") %]</a>
17 [%- IF ebook_api.enabled == 'true' %]
18 <li class="nav-item m-2">
19 <a class="nav-link not_active_pill" href="[% mkurl('ebook_circs',{},1) %]">[% l("E-Items Currently Checked Out") %]</a>
22 <li class="nav-item m-2">
23 <a class="nav-link active" href="#">[% l("Check Out History") %]</a>
29 # In the sorting case, the size is the size of ALL the circ items. In the non-sorting case,
30 # the size is simply the size of the chunk passed in. See the TODO below for the still-lingering
32 sort_field = CGI.param('sort');
34 no_next = ctx.circs.size - offset <= limit;
36 no_next = ctx.circs.size < limit;
40 <div class="header_middle">
41 <span class="float-left">[% l('Previously Checked Out Items') %]</span>
42 <span class='float-left' style='padding-left: 10px;'>
43 <a href='[% mkurl('circ_history', {limit => limit, offset => (offset - limit)}) %]'
44 [% IF offset == 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">◄</span>[% l('Previous') %]</a>
45 [%# TODO: get total to prevent paging off then end of the list.. %]
46 <a href='[% mkurl('circ_history', {limit => limit, offset => (offset + limit)}) %]'
47 [% IF no_next %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">►</span></a>
50 <div class="clear-both"></div>
52 [% IF ctx.circs.size < 1 %]
53 <div class="warning_box">[% l('There are no items in your circulation history.') %]</div>
56 <form method="post" id="circ-form"
57 onsubmit="return confirm('[% l("Are you sure you wish to delete the selected item(s)?") %]');">
58 <table cellpadding='0' cellspacing='0' class="item_list_padding">
60 <td style="width:90%;">
61 <select name="action" class="form-control">
62 <option value="delete">[% l('Delete Selected Titles') %]</option>
66 <td style="padding-left:9px;">
69 alt="[% l('Go') %]" title="[% l('Go') %]"
70 class="btn btn-sm btn-confirm" />
73 <td style="padding-left:5px;">
74 <a href="#"><img alt="[% l('Deleting Help') %]"
75 src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
80 <div id='checked_main'>
81 <table title="[% l('History of Items Checked Out') %]" id="acct_checked_hist_header" class="table table-hover miniTable circHistTable my-3">
84 <th class="checkbox_column">
85 <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;}"/>
87 <th>[% sort_head("sort_title", l("Title")) %]</th>
88 <th>[% sort_head("author", l("Author")) %]</th>
89 <th>[% sort_head("callnum", l("Call Number")) %]</th>
90 <th>[% sort_head("checkout", l("Checkout Date")) %]</th>
91 <th>[% sort_head("due", l("Due Date")) %]</th>
92 <th>[% sort_head("returned", l("Date Returned")) %]</th>
93 <th>[% sort_head("barcode", l("Barcode")) %]</th>
97 [%# Copy the ctx.circs into a local array, then add a SORT field
98 that contains the value to sort on. Since we need the item attrs,
99 invoke it and save the result in ATTRS.
102 circ_items = ctx.circs; # Array assignment
104 FOR circ IN circ_items;
105 circ.ATTRS = {marc_xml => circ.marc_xml};
106 PROCESS get_marc_attrs args=circ.ATTRS;
111 circ.SORTING = circ.ATTRS.sort_title;
114 circ.SORTING = circ.ATTRS.author;
117 circ.SORTING = circ.circ.xact_start;
120 circ.SORTING = circ.circ.due_date;
123 circ.SORTING = circ.circ.checkin_time;
126 circ.SORTING = circ.circ.target_copy.barcode;
129 circ.SORTING = circ.circ.target_copy.call_number.label;
136 IF (sort_field != "sort_title");
137 deemphasize_class = "";
139 deemphasize_class = " class=\"sort_deemphasize\"";
142 # Apply sorting to circ_items
144 circ_items = circ_items.sort("SORTING");
145 IF (CGI.param("sort_type") == "desc");
146 circ_items = circ_items.reverse;
149 # Shorten the circ_items list per offset/limit/cout
150 hi = offset + limit - 1;
151 hi = hi > circ_items.max ? circ_items.max : hi;
153 circ_items = circ_items.slice(offset, hi);
156 # circ_items list is now sorted. Traverse and dump the information.
158 FOR circ IN circ_items; %]
160 <td class="checkbox_column">
161 <input type="checkbox" name="circ_id" value="[% circ.circ.id %]" />
164 <a href="[% mkurl(ctx.opac_root _ '/record/' _
165 circ.circ.target_copy.call_number.record.id, {}, 1) %]"
166 name="[% l('Catalog record') %]"><span[%- deemphasize_class -%]>
167 [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
168 [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
171 <a href="[% mkurl(ctx.opac_root _ '/results',
172 {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
174 ) %]">[% circ.ATTRS.author | html %]</a>
176 <td>[% circ.circ.target_copy.call_number.label | html %]</td>
178 [% date.format(ctx.parse_datetime(circ.circ.xact_start),DATE_FORMAT); %]
181 [% IF circ.circ.source_circ;
182 date.format(ctx.parse_datetime(circ.circ.due_date, circ.circ.source_circ.circ_lib),DATE_FORMAT);
184 date.format(ctx.parse_datetime(circ.circ.due_date, ctx.user.home_ou),DATE_FORMAT);
189 [% IF circ.circ.checkin_time;
190 date.format(ctx.parse_datetime(circ.circ.checkin_time),DATE_FORMAT);
192 <span style='color:blue;'>*</span><!-- meh -->
195 <td>[% circ.circ.target_copy.barcode | html %]</td>
203 <form action="[% mkurl(ctx.opac_root _ '/myopac/circ_history/export') %]" method="post">
205 [%- INCLUDE "opac/parts/preserve_params.tt2" %]
206 [% IF ctx.circs.size > 0 %]
207 <input type="hidden" name="filename" value="[% l('circ_history.csv') %]"/>
208 <button type="submit" class="btn btn-sm btn-primary">[% l('Download CSV') %]</button>