Bug 29939: Use the REST API for ratings
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-readingrecord.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE TablesSettings %]
5 [% USE AdditionalContents %]
6 [% USE Asset %]
7 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
8 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Your checkout history &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %]
13     <style>ul.ui-tabs-nav li a, ul.ui-tabs-nav li span.a  { padding:0.6em 1em; }</style>
14 [% END %]
15 </head>
16 [% INCLUDE 'bodytag.inc' bodyid='opac-readingrecord' %]
17 [% INCLUDE 'masthead.inc' %]
18
19 [% IF Koha.Preference('AmazonAssocTag') %]
20     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
21 [% ELSE %]
22     [% AmazonAssocTag = '' %]
23 [% END %]
24
25 <div class="main">
26     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
27         <ol class="breadcrumb">
28             <li class="breadcrumb-item">
29                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
30             </li>
31             <li class="breadcrumb-item">
32                 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
33             </li>
34             <li class="breadcrumb-item active">
35                 <a href="#" aria-current="page">Your checkout history</a>
36             </li>
37         </ol>
38     </nav> <!-- /#breadcrumbs -->
39
40     <div class="container-fluid">
41         <div class="row">
42             <div class="col col-lg-2 order-2 order-lg-1">
43                 <div id="navigation">
44                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
45                 </div>
46             </div>
47             <div class="col-md-12 col-lg-10 order-1">
48
49                 <div id="userreadingrecord" class="maincontent">
50                     <h1>Checkout history</h1>
51
52                     [% IF READING_RECORD.size == 0 %]
53                         You have never borrowed anything from this library.
54                     [% ELSE %]
55                         <div id="opac-user-readingrec">
56
57                             <div class="resultscontrol resort js-hide">
58                                 <form id="sortform" action="/cgi-bin/koha/opac-readingrecord.pl" method="get">
59                                     [% UNLESS ( limit ) %]<input type="hidden" name="limit" value="full" />[% END %]
60                                     <select name="order" id="order">
61                                         [% IF ( orderbydate ) %]<option value="" selected="selected">Order by date</option>[% ELSE %]<option value="">Order by date</option>[% END %]
62                                         [% IF ( orderbytitle ) %]<option value="title" selected="selected">Order by title</option>[% ELSE %]<option value="title">Order by title</option>[% END %]
63                                         [% IF ( orderbyauthor ) %]<option value="author" selected="selected">Order by author</option>[% ELSE %]<option value="author">Order by author</option>[% END %]
64                                     </select>
65                                     <input type="submit" value="Go" id="sortsubmit" class="submit clearfix" />
66                                 </form>
67                             </div>
68
69                             [% IF limit %]
70                                 <p>
71                                     Showing last 50 items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=full[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show all items</a>
72                                 </p>
73                             [% ELSE %]
74                                 <p>
75                                     Showing all items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=50[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show last 50 items</a>
76                                 </p>
77                             [% END %]
78
79                             [% IF Koha.Preference( 'OnSiteCheckouts' ) == 1 %]
80                                 <div id="tabs" class="toptabs">
81                                     <ul class="nav nav-tabs" role="tablist">
82                                         <li class="nav-item" role="presentation">
83                                             <a id="tab_all" class="nav-link active" data-toggle="tab" role="tab" aria-controls="tabs-container" aria-selected="true"  href="#tabs-container">All</a>
84                                         </li>
85                                         <li class="nav-item" role="presentation">
86                                             <a id="tab_checkout" class="nav-link" data-toggle="tab" role="tab" aria-controls="tabs-container" aria-selected="false"  href="#tabs-container">Checkouts</a>
87                                         </li>
88                                         <li class="nav-item" role="presentation">
89                                             <a id="tab_onsite_checkout" class="nav-link" data-toggle="tab" role="tab" aria-controls="tabs-container" aria-selected="false"  href="#tabs-container">On-site checkouts</a>
90                                         </li>
91                                     </ul>
92                                     <div class="tab-content">
93                             [% END %]
94                                 <div class="tab-pane active" role="tabpanel" id="tabs-container">
95                                     <table id="readingrec" class="table table-bordered table-striped">
96                                         <caption class="sr-only">Checkout history</caption>
97                                         <thead>
98                                             <tr>
99                                                 <th style="display:none;" class="noExport">Type</th>
100                                                 <th class="NoSort noExport"></th>
101                                                 <th class="anti-the">Title</th>
102                                                 <th>Item type</th>
103                                                 <th>Call number</th>
104                                                 <th>Date</th>
105                                                 [% IF ( OPACMySummaryHTML ) %]
106                                                     <th class="NoSort noExport">Links</th>
107                                                 [% END %]
108                                             </tr>
109                                         </thead>
110                                         <tbody>
111                                             [% FOREACH issue IN READING_RECORD %]
112                                                 <tr>
113                                                     <td style="display:none;">
114                                                       [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %]
115                                                       [% ELSE %][% issuetype = 'standard_checkout' %]
116                                                       [% END %]
117                                                       [% issuetype | html %]
118                                                     </td>
119                                                 <td>
120                                                     [% IF  OPACAmazonCoverImages %]
121                                                         [% IF  issue.normalized_isbn %]
122                                                             <a href="http://www.amazon.com/gp/reader/[% issue.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% issue.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail" /></a>
123                                                         [% ELSE %]
124                                                              <span class="no-image">No cover image available</span>
125                                                         [% END %]
126                                                     [% END %]
127
128                                                 [% IF GoogleJackets %]
129                                                     [% IF  issue.normalized_isbn %]
130                                                         <div title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
131                                                     [% ELSE %]
132                                                        <span class="no-image">No cover image available</span>
133                                                     [% END %]
134                                                 [% END %]
135
136                                                 [% IF BakerTaylorEnabled %]
137                                                     [% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %]
138                                                     [% IF ( bt_id ) %]
139                                                        <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
140                                                     [% ELSE %]
141                                                        <span class="no-image">No cover image available</span>
142                                                     [% END %]
143                                                 [% END %]
144
145                                                 [% IF SyndeticsEnabled && SyndeticsCoverImages %]
146                                                     <img src="https://secure.syndetics.com/index.aspx?isbn=[% issue.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% issue.normalized_upc | html %]&amp;oclc=[% issue.normalized_oclc | html %]" alt="" class="item-thumbnail" />
147                                                 [% END %]
148                                                 </td>
149                                                 <td>
150                                                 [% INCLUDE 'biblio-title.inc' biblio=issue, link => 1 %]
151                                                 <p class="results-summary item-details">[% issue.author | html %]</p>
152
153                                                     [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
154                                                         [% INCLUDE 'user-star-ratings.inc' item=issue %]
155                                                     [% END %]
156
157                                                 </td>
158                                                 <td>
159                                                 [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
160                                                     [% IF ( issue.imageurl ) %]
161                                                         <img src="[% issue.imageurl | html %]" alt="" />
162                                                     [% END %]
163                                                 [% END %]
164                                                 <span class="tdlabel">Item type:</span>
165                                                 [% issue.translated_description | html %]</td>
166                                                 <td>
167                                                 <span class="tdlabel">Call number:</span>
168                                                 [% issue.itemcallnumber | html %]
169                                                 </td>
170                                                 [% IF issue.returndate %]
171                                                     <td data-order="[% issue.returndate | html %]">
172                                                         <span class="tdlabel">Check-in date:</span>
173                                                         [% issue.returndate | $KohaDates %]
174                                                 [% ELSE %]
175                                                     <td data-order="Checked out">
176                                                         <em>(Checked out)</em>
177                                                 [% END %]
178                                                 </td>
179                                                 [% IF OPACMySummaryHTML %]
180                                                     <td>[% issue.MySummaryHTML | $raw %]</td>
181                                                 [% END %]
182                                                 </tr>
183                                             [% END # / FOREACH issue %]
184                                         </tbody>
185                                     </table>
186                                 </div> <!-- / .tabs-container -->
187                             [% IF ( Koha.Preference( 'OnSiteCheckouts' ) == 1 ) %]
188                                     </div> <!-- /.tab-content -->
189                                 </div> <!-- /#tabs -->
190                             [% END %]
191                         </div> <!-- / .opac-user-readingrec -->
192                     [% END # / IF READING_RECORD.size %]
193                 </div> <!-- / .userreadingrecord -->
194             </div> <!-- / .col-lg-10 -->
195         </div> <!-- / .row -->
196     </div> <!-- / .container-fluid -->
197 </div> <!-- / .main -->
198
199 [% INCLUDE 'opac-bottom.inc' %]
200 [% BLOCK jsinclude %]
201 [% INCLUDE 'datatables.inc' %]
202 [% INCLUDE 'columns_settings.inc' %]
203 <script>
204     $(document).ready(function(){
205         [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
206         $('#order').change(function() {
207             $('#sortform').submit();
208         });
209
210         var columns_settings = []; // Empty because there are no columns we want to be configurable
211         var table = KohaTable("#readingrec", {
212             "dom": '<"top"<"table_entries"i><"table_controls"fB>>t',
213             "autoWidth": false,
214             "language": {
215                 "search": "_INPUT_",
216                 "searchPlaceholder": _("Search")
217             }
218         }, columns_settings);
219
220         $("#tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
221             var id = e.target.id;
222             if ( id == "tab_checkout" ) {
223                 table.fnFilter("standard_checkout", 0);
224             } else if ( id == "tab_onsite_checkout" ) {
225                 table.fnFilter("onsite_checkout", 0);
226             } else { // all
227                 table.fnFilter('', 0);
228             }
229         });
230     });
231 </script>
232     [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
233         [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
234         [% Asset.js("js/ratings.js") | $raw %]
235     [% END %]
236 [% END %]