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 <div id="acct_checked_tabs">
15 <a href='[% mkurl('circs',{},1) %]'>[% l("Current Items Checked Out") %]</a>
17 <div class="align selected">
18 <a href="#">[% l("Check Out History") %]</a>
23 # In the sorting case, the size is the size of ALL the circ items. In the non-sorting case,
24 # the size is simply the size of the chunk passed in. See the TODO below for the still-lingering
26 sort_field = CGI.param('sort');
28 no_next = ctx.circs.size - offset <= limit;
30 no_next = ctx.circs.size < limit;
34 <div class="header_middle">
35 <span class="float-left">[% l('Previously Checked Out Items') %]</span>
36 <span class='float-left' style='padding-left: 10px;'>
37 <a href='[% mkurl('circ_history', {limit => limit, offset => (offset - limit)}) %]'
38 [% IF offset == 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">◄</span>[% l('Previous') %]</a>
39 [%# TODO: get total to prevent paging off then end of the list.. %]
40 <a href='[% mkurl('circ_history', {limit => limit, offset => (offset + limit)}) %]'
41 [% IF no_next %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">►</span></a>
43 <div class="float-left">
44 <form action="[% mkurl(ctx.opac_root _ '/myopac/circ_history/export') %]" method="post">
46 [%- INCLUDE "opac/parts/preserve_params.tt2" %]
47 [% IF ctx.circs.size > 0 %]
48 <input type="hidden" name="filename" value="[% l('circ_history.csv') %]"/>
49 <button type="submit">[% l('Download CSV') %]</button>
55 <div class="clear-both"></div>
57 [% IF ctx.circs.size < 1 %]
58 <div class="warning_box">[% l('There are no items in your circulation history.') %]</div>
61 <div id='checked_main'>
62 <table id="acct_checked_main_header"
63 title="[% l('History of Items Checked Out') %]">
66 <th>[% sort_head("sort_title", l("Title")) %]</th>
67 <th>[% sort_head("author", l("Author")) %]</th>
68 <th>[% sort_head("checkout", l("Checkout Date")) %]</th>
69 <th>[% sort_head("due", l("Due Date")) %]</th>
70 <th>[% sort_head("returned", l("Date Returned")) %]</th>
71 <th>[% sort_head("barcode", l("Barcode")) %]</th>
72 <th>[% sort_head("callnum", l("Call Number")) %]</th>
76 [%# Copy the ctx.circs into a local array, then add a SORT field
77 that contains the value to sort on. Since we need the item attrs,
78 invoke it and save the result in ATTRS.
81 circ_items = ctx.circs; # Array assignment
83 FOR circ IN circ_items;
84 circ.ATTRS = {marc_xml => circ.marc_xml};
85 PROCESS get_marc_attrs args=circ.ATTRS;
90 circ.SORTING = circ.ATTRS.sort_title;
93 circ.SORTING = circ.ATTRS.author;
96 circ.SORTING = circ.circ.xact_start;
99 circ.SORTING = circ.circ.due_date;
102 circ.SORTING = circ.circ.checkin_time;
105 circ.SORTING = circ.circ.target_copy.barcode;
108 circ.SORTING = circ.circ.target_copy.call_number.label;
115 IF (sort_field != "sort_title");
116 deemphasize_class = "";
118 deemphasize_class = " class=\"sort_deemphasize\"";
121 # Apply sorting to circ_items
123 circ_items = circ_items.sort("SORTING");
124 IF (CGI.param("sort_type") == "desc");
125 circ_items = circ_items.reverse;
128 # Shorten the circ_items list per offset/limit/cout
129 hi = offset + limit - 1;
130 hi = hi > circ_items.max ? circ_items.max : hi;
132 circ_items = circ_items.slice(offset, hi);
135 # circ_items list is now sorted. Traverse and dump the information.
137 FOR circ IN circ_items; %]
140 <a href="[% mkurl(ctx.opac_root _ '/record/' _
141 circ.circ.target_copy.call_number.record.id, {}, 1) %]"
142 name="[% l('Catalog record') %]"><span[%- deemphasize_class -%]>
143 [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
144 [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
147 <a href="[% mkurl(ctx.opac_root _ '/results',
148 {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
150 ) %]">[% circ.ATTRS.author | html %]</a>
153 [% date.format(ctx.parse_datetime(circ.circ.xact_start),DATE_FORMAT); %]
156 [% date.format(ctx.parse_datetime(circ.circ.due_date),DATE_FORMAT); %]
159 [% IF circ.circ.checkin_time;
160 date.format(ctx.parse_datetime(circ.circ.checkin_time),DATE_FORMAT);
162 <span style='color:blue;'>*</span><!-- meh -->
165 <td>[% circ.circ.target_copy.barcode | html %]</td>
166 <td>[% circ.circ.target_copy.call_number.label | html %]</td>