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>[% sort_head("sort_title", l("Title")) %]</th>
57 <th>[% sort_head("author", l("Author")) %]</th>
58 <th>[% sort_head("callnum", l("Call Number")) %]</th>
59 <th>[% sort_head("checkout", l("Checkout Date")) %]</th>
60 <th>[% sort_head("due", l("Due Date")) %]</th>
61 <th>[% sort_head("returned", l("Date Returned")) %]</th>
62 <th>[% sort_head("barcode", l("Barcode")) %]</th>
66 [%# Copy the ctx.circs into a local array, then add a SORT field
67 that contains the value to sort on. Since we need the item attrs,
68 invoke it and save the result in ATTRS.
71 circ_items = ctx.circs; # Array assignment
73 FOR circ IN circ_items;
74 circ.ATTRS = {marc_xml => circ.marc_xml};
75 PROCESS get_marc_attrs args=circ.ATTRS;
80 circ.SORTING = circ.ATTRS.sort_title;
83 circ.SORTING = circ.ATTRS.author;
86 circ.SORTING = circ.circ.xact_start;
89 circ.SORTING = circ.circ.due_date;
92 circ.SORTING = circ.circ.checkin_time;
95 circ.SORTING = circ.circ.target_copy.barcode;
98 circ.SORTING = circ.circ.target_copy.call_number.label;
105 IF (sort_field != "sort_title");
106 deemphasize_class = "";
108 deemphasize_class = " class=\"sort_deemphasize\"";
111 # Apply sorting to circ_items
113 circ_items = circ_items.sort("SORTING");
114 IF (CGI.param("sort_type") == "desc");
115 circ_items = circ_items.reverse;
118 # Shorten the circ_items list per offset/limit/cout
119 hi = offset + limit - 1;
120 hi = hi > circ_items.max ? circ_items.max : hi;
122 circ_items = circ_items.slice(offset, hi);
125 # circ_items list is now sorted. Traverse and dump the information.
127 FOR circ IN circ_items; %]
129 <td class="checkbox_column">
130 <input type="checkbox" name="circ_id" value="[% circ.circ.id %]" aria-label="Select Item"/>
133 [% IF circ.circ.target_copy.call_number.id == -1 %]
134 [% circ.circ.target_copy.dummy_title | html %]
135 [% ELSIF circ.ATTRS.title %]
136 <a href="[% mkurl(ctx.opac_root _ '/record/' _
137 circ.circ.target_copy.call_number.record.id, {}, 1) %]">
138 <span[%- deemphasize_class -%]>
139 [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %]</span>
140 [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %]</a>
144 [% IF circ.circ.target_copy.call_number.id == -1 %]
145 [% circ.circ.target_copy.dummy_author | html %]
146 [% ELSIF circ.ATTRS.author %]
147 <a href="[% mkurl(ctx.opac_root _ '/results',
148 {qtype => 'author', query => circ.ATTRS.author.replace('[,\.:;]', '')},
150 ) %]">[% circ.ATTRS.author | html %]</a>
153 <td>[% circ.circ.target_copy.call_number.label | html %]</td>
155 [% date.format(ctx.parse_datetime(circ.circ.xact_start),DATE_FORMAT); %]
158 [% IF circ.circ.source_circ;
159 date.format(ctx.parse_datetime(circ.circ.due_date, circ.circ.source_circ.circ_lib),DATE_FORMAT);
161 date.format(ctx.parse_datetime(circ.circ.due_date, ctx.user.home_ou),DATE_FORMAT);
166 [% IF circ.circ.checkin_time;
167 date.format(ctx.parse_datetime(circ.circ.checkin_time),DATE_FORMAT);
169 <span style='color:blue;'>Not Returned</span><!-- meh -->
172 <td>[% circ.circ.target_copy.barcode | html %]</td>
180 <form action="[% mkurl(ctx.opac_root _ '/myopac/circ_history/export') %]" method="post">
182 [%- INCLUDE "opac/parts/preserve_params.tt2" %]
183 [% IF ctx.circs.size > 0 %]
184 <input type="hidden" name="filename" value="[% l('circ_history.csv') %]"/>
185 <button type="submit" class="btn btn-action"><i class="fas fa-file-download" aria-hidden="true"></i> [% l('Download CSV') %]</button>