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 [%- IF ebook_api.enabled %]
19 <a href="[% mkurl('ebook_circs',{},1) %]">[% l("E-Items Currently Checked Out") %]</a>
22 <div class="align selected">
23 <a href="#">[% l("Check Out History") %]</a>
28 # In the sorting case, the size is the size of ALL the circ items. In the non-sorting case,
29 # the size is simply the size of the chunk passed in. See the TODO below for the still-lingering
31 sort_field = CGI.param('sort');
33 no_next = ctx.circs.size - offset <= limit;
35 no_next = ctx.circs.size < limit;
39 <div class="header_middle">
40 <span class="float-left">[% l('Previously Checked Out Items') %]</span>
41 <span class='float-left' style='padding-left: 10px;'>
42 <a href='[% mkurl('circ_history', {limit => limit, offset => (offset - limit)}) %]'
43 [% IF offset == 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">◄</span>[% l('Previous') %]</a>
44 [%# TODO: get total to prevent paging off then end of the list.. %]
45 <a href='[% mkurl('circ_history', {limit => limit, offset => (offset + limit)}) %]'
46 [% IF no_next %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">►</span></a>
48 <div class="float-left">
49 <form action="[% mkurl(ctx.opac_root _ '/myopac/circ_history/export') %]" method="post">
51 [%- INCLUDE "opac/parts/preserve_params.tt2" %]
52 [% IF ctx.circs.size > 0 %]
53 <input type="hidden" name="filename" value="[% l('circ_history.csv') %]"/>
54 <button type="submit">[% l('Download CSV') %]</button>
60 <div class="clear-both"></div>
62 [% IF ctx.circs.size < 1 %]
63 <div class="warning_box">[% l('There are no items in your circulation history.') %]</div>
66 <form method="post" id="circ-form"
67 onsubmit="return confirm('[% l("Are you sure you wish to delete the selected item(s)?") %]');">
68 <table cellpadding='0' cellspacing='0' class="item_list_padding">
71 <select name="action">
72 <option value="delete">[% l('Delete Selected Titles') %]</option>
75 <td style="padding-left:9px;">
78 alt="[% l('Go') %]" title="[% l('Go') %]"
79 class="opac-button" />
82 <td style="padding-left:5px;">
83 <a href="#"><img alt="[% l('Deleting Help') %]"
84 src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
89 <div id='checked_main'>
90 <table id="acct_checked_hist_header"
91 title="[% l('History of Items Checked Out') %]">
94 <th class="checkbox_column">
95 <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;}"/>
97 <th>[% sort_head("sort_title", l("Title")) %]</th>
98 <th>[% sort_head("author", l("Author")) %]</th>
99 <th>[% sort_head("checkout", l("Checkout Date")) %]</th>
100 <th>[% sort_head("due", l("Due Date")) %]</th>
101 <th>[% sort_head("returned", l("Date Returned")) %]</th>
102 <th>[% sort_head("barcode", l("Barcode")) %]</th>
103 <th>[% sort_head("callnum", l("Call Number")) %]</th>
107 [%# Copy the ctx.circs into a local array, then add a SORT field
108 that contains the value to sort on. Since we need the item attrs,
109 invoke it and save the result in ATTRS.
112 circ_items = ctx.circs; # Array assignment
114 FOR circ IN circ_items;
115 circ.ATTRS = {marc_xml => circ.marc_xml};
116 PROCESS get_marc_attrs args=circ.ATTRS;
121 circ.SORTING = circ.ATTRS.sort_title;
124 circ.SORTING = circ.ATTRS.author;
127 circ.SORTING = circ.circ.xact_start;
130 circ.SORTING = circ.circ.due_date;
133 circ.SORTING = circ.circ.checkin_time;
136 circ.SORTING = circ.circ.target_copy.barcode;
139 circ.SORTING = circ.circ.target_copy.call_number.label;
146 IF (sort_field != "sort_title");
147 deemphasize_class = "";
149 deemphasize_class = " class=\"sort_deemphasize\"";
152 # Apply sorting to circ_items
154 circ_items = circ_items.sort("SORTING");
155 IF (CGI.param("sort_type") == "desc");
156 circ_items = circ_items.reverse;
159 # Shorten the circ_items list per offset/limit/cout
160 hi = offset + limit - 1;
161 hi = hi > circ_items.max ? circ_items.max : hi;
163 circ_items = circ_items.slice(offset, hi);
166 # circ_items list is now sorted. Traverse and dump the information.
168 FOR circ IN circ_items; %]
170 <td class="checkbox_column">
171 <input type="checkbox" name="circ_id" value="[% circ.circ.id %]" />
174 <a href="[% mkurl(ctx.opac_root _ '/record/' _
175 circ.circ.target_copy.call_number.record.id, {}, 1) %]"
176 name="[% l('Catalog record') %]"><span[%- deemphasize_class -%]>
177 [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
178 [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
181 <a href="[% mkurl(ctx.opac_root _ '/results',
182 {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
184 ) %]">[% circ.ATTRS.author | html %]</a>
187 [% date.format(ctx.parse_datetime(circ.circ.xact_start),DATE_FORMAT); %]
190 [% date.format(ctx.parse_datetime(circ.circ.due_date, circ.circ.circ_lib),DATE_FORMAT); %]
193 [% IF circ.circ.checkin_time;
194 date.format(ctx.parse_datetime(circ.circ.checkin_time),DATE_FORMAT);
196 <span style='color:blue;'>*</span><!-- meh -->
199 <td>[% circ.circ.target_copy.barcode | html %]</td>
200 <td>[% circ.circ.target_copy.call_number.label | html %]</td>