Koha-clms/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt

274 lines
14 KiB
Plaintext

[% USE raw %]
[% USE Koha %]
[% USE KohaDates %]
[% USE TablesSettings %]
[% USE AdditionalContents %]
[% USE Asset %]
[% USE Price %]
[% PROCESS 'i18n.inc' %]
[% PROCESS 'html_helpers.inc' %]
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% INCLUDE 'doc-head-open.inc' %]
<title
>[% FILTER collapse %]
[% t("Your checkout history") | html %]
&rsaquo; [% PROCESS 'library_name_title' %]
[% END %]</title
>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %]
[% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-readingrecord' %]
[% INCLUDE 'masthead.inc' %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
[% ELSE %]
[% AmazonAssocTag = '' %]
[% END %]
<main class="main">
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Your checkout history</span>
[% END %]
[% END #/ WRAPPER breadcrumbs %]
<div class="container-fluid">
<div class="row">
<div class="col col-lg-2 order-2 order-lg-1">
<div id="navigation"> [% INCLUDE 'navigation.inc' IsPatronPage=1 %] </div>
</div>
<div class="col-md-12 col-lg-10 order-1">
<div id="userreadingrecord" class="maincontent">
<h1>Checkout history</h1>
[% UNLESS checkouts %][% checkouts = [] %][% END %]
[% UNLESS old_checkouts %][% old_checkouts = [] %][% END %]
[% SET all_checkouts = checkouts.merge(old_checkouts) %]
[% IF all_checkouts.size == 0 %]
You have never borrowed anything from this library.
[% ELSE %]
<div id="opac-user-readingrec">
[% IF savings %]
<div class="alert alert-info" id="savings"> Congratulations, you have saved a total of [% savings | $Price with_symbol => 1 %] by using the library. </div>
[% END %]
<div class="resultscontrol resort js-hide">
<form id="sortform" action="/cgi-bin/koha/opac-readingrecord.pl" method="get">
[% UNLESS ( limit ) %]<input type="hidden" name="limit" value="full" />[% END %]
<select name="order" id="order">
[% IF ( orderbydate ) %]<option value="" selected="selected">Order by date</option>[% ELSE %]<option value="">Order by date</option>[% END %]
[% IF ( orderbytitle ) %]<option value="title" selected="selected">Order by title</option>[% ELSE %]<option value="title">Order by title</option>[% END %]
[% IF ( orderbyauthor ) %]<option value="author" selected="selected">Order by author</option>[% ELSE %]<option value="author">Order by author</option>[% END %]
</select>
<input type="submit" value="Go" id="sortsubmit" class="submit clearfix" />
</form>
</div>
[% IF limit %]
<p> Showing last 50 items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=full[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show all items</a> </p>
[% ELSE %]
<p> Showing all items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=50[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show last 50 items</a> </p>
[% END %]
[% IF Koha.Preference( 'OnSiteCheckouts' ) == 1 %]
[% WRAPPER tabs id= "tabs" %]
[% WRAPPER tabs_nav %]
[% WRAPPER tab_item tabid= "all_checkouts" tabname="tabs-container" bt_active= 1 %]
<span>All</span>
[% END %]
[% WRAPPER tab_item tabid= "checkout" tabname="tabs-container" %]
<span>Checkouts</span>
[% END %]
[% WRAPPER tab_item tabid= "onsite_checkout" tabname="tabs-container" %]
<span>On-site checkouts</span>
[% END %]
[% END # /WRAPPER tabs_nav %]
[% WRAPPER tab_panels %]
[% WRAPPER tab_panel tabname="tabs-container" bt_active= 1 %]
[% PROCESS checkout_history_table checkouts=all_checkouts %]
[% END # /tab_panel# %]
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
[% ELSE %]
[% PROCESS checkout_history_table checkouts=all_checkouts %]
[% END %]
</div>
<!-- / .opac-user-readingrec -->
[% END # / IF checkouts.size == 0 %]
</div>
<!-- / .userreadingrecord -->
</div>
<!-- / .col-lg-10 -->
</div>
<!-- / .row -->
</div>
<!-- / .container-fluid -->
</main>
<!-- / .main -->
[% BLOCK checkout_history_table %]
<table id="readingrec" class="table table-bordered table-striped">
<caption class="sr-only">Checkout history</caption>
<thead>
<tr>
<th style="display:none;" class="no-export">Type</th>
<th class="no-sort no-export"></th>
<th class="all anti-the">Title</th>
<th>Author</th>
<th>Item type</th>
<th>Call number</th>
<th>Vol info</th>
<th>Date</th>
[% IF Koha.Preference('OPACMySummaryHTML') %]
<th class="no-sort no-export">Links</th>
[% END %]
<th class="dtr-control-col"></th>
</tr>
</thead>
<tbody>
[% FOREACH checkout IN checkouts %]
[% SET item = checkout.item %]
[% SET biblio = item.biblio %]
<tr>
<td style="display:none;">
[% IF checkout.onsite_checkout %]
[% issuetype = 'onsite_checkout' %]
[% ELSE %]
[% issuetype = 'standard_checkout' %]
[% END %]
[% issuetype | html %]
</td>
<td>
[% SET normalized_isbn = biblio.normalized_isbn %]
[% IF Koha.Preference('OPACAmazonCoverImages') %]
[% IF normalized_isbn %]
<a href="http://www.amazon.com/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"
><img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | html %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail"
/></a>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF Koha.Preference( "GoogleJackets" ) %]
[% IF normalized_isbn %]
<div title="[% biblio.biblionumber |url %]" class="[% normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF Koha.Preference( "SyndeticsEnabled" ) && Koha.Preference( "SyndeticsCoverImages" ) %]
[% SET normalized_upc = biblio.normalized_upc %]
<img
src="https://secure.syndetics.com/index.aspx?isbn=[% normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% normalized_upc | html %]&amp;oclc=[% biblio.normalized_oclc | html %]"
alt=""
class="item-thumbnail"
/>
[% END %]
</td>
<td>
[% INCLUDE 'biblio-title.inc' biblio=biblio, link => 1 %]
[% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
[% SET ratings = {ratings => biblio.ratings, itemnumber => item.itemnumber, biblionumber => biblio.biblionumber, my_rating => biblio.ratings.search( borrowernumber => logged_in_user.borrowernumber ).next } %]
[% INCLUDE 'user-star-ratings.inc' item=ratings %]
[% END %]
</td>
<td>[% biblio.author | html %]</td>
<td>
[% SET item_type = item_types.${item.effective_itemtype} %]
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
[% SET image_location = item_type.image_location %]
[% IF image_location %]
<img src="[% image_location | html %]" alt="" />
[% END %]
[% END %]
<span class="itypetext"> [% item_type.translated_description | html %] </span>
</td>
<td> [% item.itemcallnumber | html %] </td>
<td>
[% IF item.enumchron %]
[% item.enumchron | html %]
[% END %]
</td>
[% IF checkout.returndate %]
<td data-order="[% checkout.returndate | html %]"> [% checkout.returndate | $KohaDates %] </td>
[% ELSE %]
<td data-order="Checked out">
<em>(Checked out)</em>
</td>
[% END %]
[% IF Koha.Preference('OPACMySummaryHTML') %]
<td>[% biblio.opac_summary_html | $raw %]</td>
[% END %]
<td></td>
</tr>
[% END # / FOREACH checkout %]
</tbody>
</table>
[% END %]
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script nonce="[% Koha.CSPNonce | $raw %]">
addPrefs({
GoogleJackets: [% Koha.Preference('GoogleJackets') ? 1 : 0 | html %],
OPACTableColExpandedByDefault: [% Koha.Preference('OPACTableColExpandedByDefault') ? 1 : 0 | html %],
});
</script>
<script nonce="[% Koha.CSPNonce | $raw %]">
$(document).ready(function () {
if (prefs.GoogleJackets) {
KOHA.Google.GetCoverFromIsbn();
}
$("#order").change(function () {
$("#sortform").submit();
});
var responsive_display = prefs.OPACTableColExpandedByDefault ? DataTable.Responsive.display.childRowImmediate : DataTable.Responsive.display.childRow;
var table = $("#readingrec").kohaTable({
dom: '<"top"<"table_entries"i><"table_controls"fB>>t',
language: {
search: "_INPUT_",
searchPlaceholder: _("Search"),
},
responsive: {
details: {
display: responsive_display,
type: "column",
target: -1,
},
},
columnDefs: [
{ className: "dtr-control", orderable: false, targets: [-1] },
{ visible: false, targets: [0] },
],
});
let table_dt = table.DataTable();
$("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) {
var id = e.target.id;
let pattern = "";
if (id == "checkout-tab") {
pattern = "standard_checkout";
} else if (id == "onsite_checkout-tab") {
pattern = "onsite_checkout";
}
table_dt.columns(0).search(pattern).draw();
});
});
</script>
[% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
[% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
[% Asset.js("js/ratings.js") | $raw %]
[% END %]
[% END %]