Bug 35356: Show SMS labels only when data exists
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / readingrec.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Koha %]
5 [% USE AuthorisedValues %]
6 [% USE Branches %]
7 [% USE TablesSettings %]
8 [% PROCESS 'i18n.inc' %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>[% FILTER collapse %]
12     [% t("Circulation history for") | html %] [% INCLUDE 'patron-title.inc' no_html = 1 %]
13     [% t("Patrons") | html %] &rsaquo;
14     [% t("Koha") | html %]
15 [% END %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 </head>
18
19 <body id="pat_readingrec" class="pat">
20 [% WRAPPER 'header.inc' %]
21     [% INCLUDE 'patron-search-header.inc' %]
22 [% END %]
23
24 [% WRAPPER 'sub-header.inc' %]
25     [% WRAPPER breadcrumbs %]
26         [% WRAPPER breadcrumb_item %]
27             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
28         [% END %]
29         [% WRAPPER breadcrumb_item %]
30             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
31         [% END %]
32         [% WRAPPER breadcrumb_item bc_active= 1 %]
33             <span>Circulation history</span>
34         [% END %]
35     [% END #/ WRAPPER breadcrumbs %]
36 [% END #/ WRAPPER sub-header.inc %]
37
38 <div class="main container-fluid">
39     <div class="row">
40         <div class="col-sm-10 col-sm-push-2">
41             <main>
42
43 [% INCLUDE 'members-toolbar.inc' %]
44 <h1>Circulation history</h1>
45
46 [% UNLESS checkouts %][% checkouts = [] %][% END %]
47 [% UNLESS old_checkouts %][% old_checkouts = [] %][% END %]
48 [% SET all_checkouts = checkouts.merge(old_checkouts) %]
49 [% UNLESS Koha.Preference('intranetreadinghistory') %]
50     <div class="dialog alert">Staff members are not allowed to access patron's checkout history</div>
51 [% ELSIF is_anonymous %]
52     <div class="dialog alert">This is the anonymous patron, so no circulation history is displayed. To get a list of anonymized loans, please run a report.</div>
53 [% ELSIF ( patron.privacy == 2)  %]
54     <div class="dialog message">This patron has set the privacy rules to never keeping a circulation history.</div>
55 [% ELSIF ( !all_checkouts.size ) %]
56     <div class="dialog message">This patron has no circulation history.</div>
57 [% ELSE %]
58     <form action="/cgi-bin/koha/members/readingrec.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
59
60         [% BLOCK table_readingrec %]
61             <table id="table_readingrec">
62                 <thead>
63                     <tr>
64                         <th style="display:none;">Type</th>
65                         <th>Date</th>
66                         <th class="anti-the">Title</th>
67                         <th>Author</th>
68                         <th>Call number</th>
69                         <th>Vol info</th>
70                         <th>Barcode</th>
71                         <th>Number of renewals</th>
72                         <th>Checked out on</th>
73                         <th>Checked out from</th>
74                         [% IF Koha.Preference('RecordStaffUserOnCheckout') %]
75                             <th>Checked out by</th>
76                         [% END %]
77                         <th>Date due</th>
78                         <th>Return date</th>
79                     </tr>
80                 </thead>
81                 <tbody>
82                     [% FOREACH checkout IN all_checkouts %]
83                         [% SET item = checkout.item %]
84                         [% SET biblio = item.biblio %]
85                         [% IF checkout.returndate %]<tr>[% ELSE %]<tr class="onissue">[% END %]
86                             <td style="display:none;">
87                                 [% IF checkout.onsite_checkout %][% issuetype = 'onsite_checkout' | html %]
88                                 [% ELSE %][% issuetype = 'standard_checkout' | html %]
89                                 [% END %]
90                                 [% issuetype | html %]
91                             </td>
92                             <td data-order="[% checkout.timestamp | html %]">
93                                 [% checkout.timestamp | $KohaDates with_hours => 1 %]
94                             </td>
95                             <td>
96                                 [% INCLUDE 'biblio-title.inc' biblio=biblio link = 1 %]
97                             </td>
98
99                             <td>[% biblio.author | html %]</td>
100
101                             <td>
102                                 [% item.itemcallnumber | html %]
103                             </td>
104
105                             <td>
106                                 [% IF item.enumchron %]
107                                     [% item.enumchron | html %]
108                                 [% END %]
109                             </td>
110
111                             <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber | uri %]&amp;biblionumber=[% biblio.biblionumber | uri %]&amp;bi=[% item.biblioitemnumber | uri %]#item[% item.itemnumber | uri %]">[% item.barcode | html %]</a></td>
112                             <td>
113                                 [% checkout.renewals_count | html %]
114                                 [% IF checkout.renewals_count > 0 %]
115                                     [ <a class="checkout_renewals_view" data-renewals="[% checkout.renewals_count | html %]" data-issueid="[% checkout.issue_id | html %]" href="#">View</a> ]
116                                 [% END %]
117                             </td>
118                             <td data-order="[% checkout.issuedate | html %]">
119                                 [% checkout.issuedate | $KohaDates with_hours => 1 %]
120                             </td>
121                             <td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
122                             [% IF Koha.Preference('RecordStaffUserOnCheckout') %]
123                                 [% SET issuer = checkout.issuer %]
124                                 <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issuer.borrowernumber | uri %]">[% issuer.firstname | html %] [% issuer.surname | html %]</a></td>
125                             [% END %]
126                             <td data-order="[% checkout.date_due | html %]">
127                                 [% checkout.date_due | $KohaDates as_due_date => 1 %]
128                             </td>
129                             [% IF checkout.returndate %]
130                                 <td data-order="[% checkout.returndate | html %]">
131                                 [% checkout.returndate | $KohaDates with_hours => 1 %]
132                             [% ELSE %]
133                                 <td data-order="checked out">
134                                 <small>Checked out</small>
135                             [% END %]
136                             </td>
137                         </tr>
138                     [% END %]
139                 </tbody>
140             </table>
141         [% END %]
142
143         [% IF Koha.Preference('OnSiteCheckouts') %]
144             [% WRAPPER tabs id= "tabs" %]
145                 [% WRAPPER tabs_nav %]
146                     [% WRAPPER tab_item tabname= "tab_all" bt_active= 1 %] <span>All</span> [% END %]
147                     [% WRAPPER tab_item tabname= "tab_checkout" %] <span>Checkouts</span> [% END %]
148                     [% WRAPPER tab_item tabname= "tab_onsite_checkout" %] <span>On-site checkouts</span> [% END %]
149                 [% END # /WRAPPER tabs_nav %]
150                 [% WRAPPER tab_panels %]
151                     [% WRAPPER tab_panel tabname="readingrec" bt_active= 1 %]
152                         [% INCLUDE table_readingrec %]
153                     [% END # /tab_panel# %]
154                 [% END # /WRAPPER tab_panels %]
155             [% END # /WRAPPER tabs %]
156         [% ELSE %]
157             <div class="page-section">
158                 [% INCLUDE table_readingrec %]
159             </div> <!-- /.page-section -->
160         [% END # /IF Koha.Preference('OnSiteCheckouts') %]
161 [% END %]
162
163             </main>
164         </div> <!-- /.col-sm-10.col-sm-push-2 -->
165
166         <div class="col-sm-2 col-sm-pull-10">
167             <aside>
168                 [% INCLUDE 'circ-menu.inc' %]
169             </aside>
170         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
171      </div> <!-- /.row -->
172
173 [% MACRO jsinclude BLOCK %]
174     [% INCLUDE 'str/members-menu.inc' %]
175     [% Asset.js("js/members-menu.js") | $raw %]
176     [% INCLUDE 'datatables.inc' %]
177     [% INCLUDE 'columns_settings.inc' %]
178     [% INCLUDE 'modals/checkout_renewals.inc' %]
179     [% INCLUDE 'js-date-format.inc' %]
180     [% INCLUDE 'js-patron-format.inc' %]
181     [% Asset.js("js/checkout_renewals_modal.js") | $raw %]
182     <script id="js">
183         $(document).ready(function() {
184             [% IF Koha.Preference('RecordStaffUserOnCheckout') %]
185                 var column_sort = 11;
186             [% ELSE %]
187                 var column_sort = 10;
188             [% END %]
189             var table_settings = [% TablesSettings.GetTableSettings('members', 'checkouthistory', 'checkouthistory-table', 'json') | $raw %];
190             var table = KohaTable("table_readingrec", {
191                 "sPaginationType": "full",
192                 "aaSorting": [[column_sort, 'desc']]
193             }, table_settings);
194
195             $("#tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
196                 active_tab = $(this).attr("href");
197                 if( active_tab == "#tab_checkout_panel" ){
198                     table.fnFilter("standard_checkout", 0);
199                 } else if( active_tab == "#tab_onsite_checkout_panel" ){
200                     table.fnFilter("onsite_checkout", 0);
201                 } else {
202                     table.fnFilter('', 0);
203                 }
204             });
205         });
206     </script>
207 [% END %]
208
209 [% INCLUDE 'intranet-bottom.inc' %]