Bug 27005: Adding a filter in the datatable of opac-readingrecord page
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-readingrecord.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your checkout history</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% BLOCK cssinclude %]
8     <style>ul.ui-tabs-nav li a, ul.ui-tabs-nav li span.a  { padding:0.6em 1em; }</style>
9 [% END %]
10 </head>
11 [% INCLUDE 'bodytag.inc' bodyid='opac-readingrecord' %]
12 [% INCLUDE 'masthead.inc' %]
13 [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
14 [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
15
16 [% IF Koha.Preference('AmazonAssocTag') %]
17     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
18 [% ELSE %]
19     [% AmazonAssocTag = '' %]
20 [% END %]
21
22 <div class="main">
23     <nav aria-label="breadcrumb">
24         <ul class="breadcrumb">
25             <li class="breadcrumb-item">
26                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
27             </li>
28             <li class="breadcrumb-item">
29                 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
30             </li>
31             <li class="breadcrumb-item" aria-current="page">
32                 <a href="#">Your checkout history</a>
33             </li>
34         </ul>
35     </nav>
36
37     <div class="container-fluid">
38         <div class="row">
39             <div class="col col-lg-2 order-2 order-lg-1">
40                 <div id="navigation">
41                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
42                 </div>
43             </div>
44             <div class="col-md-12 col-lg-10 order-1">
45
46                 <div id="userreadingrecord" class="maincontent">
47                     <h3>Checkout history</h3>
48
49                     [% IF READING_RECORD.size == 0 %]
50                         You have never borrowed anything from this library.
51                     [% ELSE %]
52                         <div id="opac-user-readingrec">
53
54                             <div class="resultscontrol resort js-hide">
55                                 <form id="sortform" action="/cgi-bin/koha/opac-readingrecord.pl" method="get">
56                                     [% UNLESS ( limit ) %]<input type="hidden" name="limit" value="full" />[% END %]
57                                     <select name="order" id="order">
58                                         [% IF ( orderbydate ) %]<option value="" selected="selected">Order by date</option>[% ELSE %]<option value="">Order by date</option>[% END %]
59                                         [% IF ( orderbytitle ) %]<option value="title" selected="selected">Order by title</option>[% ELSE %]<option value="title">Order by title</option>[% END %]
60                                         [% IF ( orderbyauthor ) %]<option value="author" selected="selected">Order by author</option>[% ELSE %]<option value="author">Order by author</option>[% END %]
61                                     </select>
62                                     <input type="submit" value="Go" id="sortsubmit" class="submit clearfix" />
63                                 </form>
64                             </div>
65
66                             [% IF limit %]
67                                 <p>
68                                     Showing last 50 items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=full[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show all items</a>
69                                 </p>
70                             [% ELSE %]
71                                 <p>
72                                     Showing all items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=50[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show last 50 items</a>
73                                 </p>
74                             [% END %]
75
76                             [% IF Koha.Preference( 'OnSiteCheckouts' ) == 1 %]
77                             <div id="tabs" class="toptabs">
78                                 <ul class="js-show">
79                                     <li id="tab_all"><a href="#tabs-container">All</a></li>
80                                     <li id="tab_checkout"><a href="#tabs-container">Checkouts</a></li>
81                                     <li id="tab_onsite_checkout"><a href="#tabs-container">On-site checkouts</a></li>
82                                 </ul>
83                             [% END %]
84                                 <div id="tabs-container" style="overflow:hidden">
85                                     <table id="readingrec" class="table table-bordered table-striped">
86                                         <thead>
87                                             <tr>
88                                                 <th style="display:none;">Type</th>
89                                                 <th class="nosort"></th>
90                                                 <th class="anti-the">Title</th>
91                                                 <th>Item type</th>
92                                                 <th>Call no.</th>
93                                                 <th class="title-string">Date</th>
94                                                 [% IF ( OPACMySummaryHTML ) %]
95                                                     <th>Links</th>
96                                                 [% END %]
97                                             </tr>
98                                         </thead>
99                                         <tbody>
100                                             [% FOREACH issue IN READING_RECORD %]
101                                                 <tr>
102                                                     <td style="display:none;">
103                                                       [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %]
104                                                       [% ELSE %][% issuetype = 'standard_checkout' %]
105                                                       [% END %]
106                                                       [% issuetype | html %]
107                                                     </td>
108                                                 <td>
109                                                     [% IF ( AdlibrisEnabled && issue.normalized_isbn ) %]
110                                                         [% IF issue.BiblioDefaultViewmarc %]
111                                                             <a href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% issue.biblionumber |url %]">
112                                                         [% ELSIF issue.BiblioDefaultViewisbd %]
113                                                             <a href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% issue.biblionumber |url %]">
114                                                         [% ELSE %]
115                                                             <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% issue.biblionumber |url %]">
116                                                         [% END %]
117                                                         <img src="[% AdlibrisURL | html %]?isbn=[% issue.normalized_isbn | html %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
118                                                     [% END %]
119                                                     [% IF  OPACAmazonCoverImages %]
120                                                         [% IF  issue.normalized_isbn %]
121                                                             <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>
122                                                         [% ELSE %]
123                                                              <span class="no-image">No cover image available</span>
124                                                         [% END %]
125                                                     [% END %]
126
127                                                 [% IF GoogleJackets %]
128                                                     [% IF  issue.normalized_isbn %]
129                                                         <div title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
130                                                     [% ELSE %]
131                                                        <span class="no-image">No cover image available</span>
132                                                     [% END %]
133                                                 [% END %]
134
135                                                 [% IF BakerTaylorEnabled %]
136                                                     [% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %]
137                                                     [% IF ( bt_id ) %]
138                                                        <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
139                                                     [% ELSE %]
140                                                        <span class="no-image">No cover image available</span>
141                                                     [% END %]
142                                                 [% END %]
143
144                                                 [% IF SyndeticsEnabled && SyndeticsCoverImages %]
145                                                     <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" />
146                                                 [% END %]
147                                                 </td>
148                                                 <td>
149                                                 [% IF  issue.BiblioDefaultViewmarc %]
150                                                      <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% INCLUDE 'biblio-title.inc' biblio=issue %]</a>
151                                                 [% ELSIF issue.BiblioDefaultViewisbd %]
152                                                      <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% INCLUDE 'biblio-title.inc' biblio=issue %]</a>
153                                                 [% ELSE %]
154                                                      <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% issue.biblionumber |url %]">[% INCLUDE 'biblio-title.inc' biblio=issue %]</a>
155                                                 [% END %]
156                                                 <p class="results-summary item-details">[% issue.author | html %]</p>
157
158                                                     [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
159                                                         [% INCLUDE 'user-star-ratings.inc' item=issue %]
160                                                     [% END %]
161
162                                                 </td>
163                                                 <td>
164                                                 [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
165                                                     [% IF ( issue.imageurl ) %]
166                                                         <img src="[% issue.imageurl | html %]" alt="" />
167                                                     [% END %]
168                                                 [% END %]
169                                                 <span class="tdlabel">Item type:</span>
170                                                 [% issue.translated_description | html %]</td>
171                                                 <td>
172                                                 <span class="tdlabel">Call number:</span>
173                                                 [% issue.itemcallnumber | html %]
174                                                 </td>
175                                                 <td>
176                                                     [% IF issue.returndate %]
177                                                         <span class="tdlabel">Check-in date:</span>
178                                                         <span title="[% issue.returndate | html %]">[% issue.returndate | $KohaDates %]</span>
179                                                     [% ELSE %]
180                                                         <span title="Checked out"><em>(Checked out)</em></span>
181                                                     [% END %]
182                                                 </td>
183                                                 [% IF OPACMySummaryHTML %]
184                                                     <td>[% issue.MySummaryHTML | $raw %]</td>
185                                                 [% END %]
186                                                 </tr>
187                                             [% END # / FOREACH issue %]
188                                         </tbody>
189                                     </table>
190                                 </div> <!-- / .tabs-container -->
191                             [% IF ( Koha.Preference( 'OnSiteCheckouts' ) == 1 ) %]
192                                 </div> <!-- /#tabs -->
193                             [% END %]
194                         </div> <!-- / .opac-user-readingrec -->
195                     [% END # / IF READING_RECORD.size %]
196                 </div> <!-- / .userreadingrecord -->
197             </div> <!-- / .col-lg-10 -->
198         </div> <!-- / .row -->
199     </div> <!-- / .container-fluid -->
200 </div> <!-- / .main -->
201
202 [% INCLUDE 'opac-bottom.inc' %]
203 [% BLOCK jsinclude %]
204 [% INCLUDE 'datatables.inc' %]
205 <script>
206     $(document).ready(function(){
207         [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
208         $('#order').change(function() {
209             $('#sortform').submit();
210         });
211
212         var table = $("#readingrec").dataTable($.extend(true, {}, dataTablesDefaults, {
213             "dom": '<"top"<"table_entries"i><"table_controls"fB>>t',
214             "sorting": [[ 1, "asc" ]],
215             "autoWidth": false,
216
217             "columnDefs": [
218                 { "targets": [ "nosort" ],"sortable": false,"searchable": false },
219                 { "type": "anti-the", "targets" : [ "anti-the" ] },
220                 { "type": "title-string", "targets" : [ "title-string" ] }
221             ],
222             "language": {
223                 "search": "_INPUT_",
224                 "searchPlaceholder": _("Search")
225             }
226         }));
227
228         var tabs = $("#tabs").tabs({
229             activate: function(e, ui) {
230                 var id = $(ui.newTab).attr("id");
231                 if ( id == "tab_checkout" ) {
232                     table.fnFilter("standard_checkout", 0);
233                 } else if ( id == "tab_onsite_checkout" ) {
234                     table.fnFilter("onsite_checkout", 0);
235                 } else { // all
236                     table.fnFilter('', 0);
237                 }
238             }
239         });
240     });
241     var borrowernumber = "[% borrowernumber | html %]";
242     var MSG_YOUR_RATING = _("Your rating: %s, ");
243     var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)");
244 </script>
245     [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
246         [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
247         [% Asset.js("js/ratings.js") | $raw %]
248     [% END %]
249 [% END %]