Bug 24224: Convert OpacNavBottom system preference to additional content
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-user.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% USE ItemTypes %]
7 [% USE Price %]
8 [% USE AuthorisedValues %]
9 [% USE AdditionalContents %]
10 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
11 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
12
13 [% SET borrower_club_enrollments =  logged_in_user.get_club_enrollments(1) %]
14 [% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1,1) %]
15
16 [% INCLUDE 'doc-head-open.inc' %]
17 <title>Your library home &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
18 [% INCLUDE 'doc-head-close.inc' %]
19 [% Asset.css("css/overdrive.css") | $raw %]
20 [% BLOCK cssinclude %][% END %]
21 </head>
22 [% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %]
23 [% INCLUDE 'masthead.inc' %]
24
25 [% IF Koha.Preference('AmazonAssocTag') %]
26     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
27 [% ELSE %]
28     [% AmazonAssocTag = '' %]
29 [% END %]
30
31 <div class="main">
32     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
33         <ol class="breadcrumb">
34             <li class="breadcrumb-item">
35                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
36             </li>
37             <li class="breadcrumb-item">
38                 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
39             </li>
40             <li class="breadcrumb-item active">
41                 <a href="#" aria-current="page">Your summary</a>
42             </li>
43         </ol>
44     </nav> <!-- /#breadcrumbs -->
45
46     <div class="container-fluid">
47         <div class="row">
48             <div class="col col-lg-2 order-2 order-lg-1">
49                 <div id="navigation">
50                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
51                 </div>
52             </div>
53             <div class="col-md-12 col-lg-10 order-1 order-lg-2">
54                 <div id="userdetails" class="maincontent">
55
56                     <h1>Your summary</h1>
57
58                     [% INCLUDE 'opac-note.inc' %]
59
60                     <p>Hello, [% INCLUDE 'patron-title.inc' patron = logged_in_user %]
61                     <br />
62                     <a href="/cgi-bin/koha/opac-main.pl?logout.x=1">Click here if you're not [% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a></p>
63
64                     [% IF ( patronupdate ) %]<div class="alert alert-info"><h2>Thank you!</h2><p>Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.</p></div>[% END %]
65
66                     [% IF failed_holds %]
67                         <div class="alert alert-info">
68                             <h2>Notice:</h2>
69                             <p>One or more holds were not placed due to existing holds.</p>
70                         </div>
71                     [% END %]
72
73                     [% IF ( borrower.blockedonfines ) %]
74                         <div class="alert alert-warning" id="blockedonfines">
75                             <strong>Please note:</strong><span> Your account has outstanding fees & charges of [% amountoutstanding | $Price %]. Holds are blocked because your fine balance is over the limit.</span>
76                         </div>
77                     [% END %]
78
79                     [% IF ( borrower.warndeparture ) %]
80                         <div class="alert alert-warning" id="warndeparture">
81                             <strong>Please note:</strong><span> Your library card will expire on <span id="warndeparture_date">[% borrower.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
82                                 [% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your library card expires.</span>[% END %]
83                         </div>
84                     [% END %]
85
86                     [% IF ( borrower.warnexpired ) %]
87                         <div class="alert alert-warning" id="warnexpired">
88                             <strong>Please note: </strong><span>Your account has expired as of [% borrower.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
89                         </div>
90                     [% END %]
91
92                     [% IF ( RENEW_ERROR ) %]
93                         <div class="alert alert-warning">
94                             <strong>Please note:</strong>
95                                 Your loan renewal failed because of the following reason(s):
96                                 <ul>
97                                     [% FOREACH error IN RENEW_ERROR.split('\|') %]
98                                         [% IF error == 'card_expired' %]
99                                             <li>Your account has expired. Please contact the library for more information.</li>
100                                         [% ELSIF error == 'too_many' %]
101                                             <li>You have renewed this item the maximum number of times allowed.</li>
102                                         [% ELSIF error == 'too_unseen' %]
103                                             <li>You have renewed this item the maximum number of consecutive times without it being seen by the library.</li>
104                                         [% ELSIF error == 'too_soon' %]
105                                             <li>It is too soon after the checkout date for this item to be renewed.</li>
106                                         [% ELSIF error == 'on_reserve' %]
107                                             <li>This item is on hold for another borrower.</li>
108                                         [% ELSIF error == 'item_denied_renewal' %]
109                                             <li>Item renewal is not allowed.</li>
110                                         [% ELSIF error == 'auto_too_soon' %]
111                                             <li>This item is scheduled for auto renewal.</li>
112                                         [% END %]
113                                     [% END %]
114                                 </ul>
115                         </div>
116                     [% END %]
117
118                     [% IF ( patron_flagged ) %]
119                         <div class="alert alert-warning">
120                             <ul>
121                                 [% IF ( userdebarred ) %]
122                                     [% IF ( discharge_available ) %]
123                                         <li id="discharged">
124                                             <strong>Please note:</strong> Your account is frozen because it has been discharged. <a href="/cgi-bin/koha/opac-discharge.pl?op=get">Get your discharge</a>
125                                         </li>
126                                     [% ELSE %]
127                                         <li id="userdebarred"><strong>Please note:</strong> Your account has been frozen.
128                                         [% IF ( borrower.debarredcomment ) %]
129                                             Comment:
130                                             <span id="userdebarred_comment">
131                                                 <strong>
132                                                     [% IF borrower.debarredcomment.search('OVERDUES_PROCESS') %]
133                                                         Restriction added by overdues process [% borrower.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
134                                                     [% ELSE %]
135                                                         [% borrower.debarredcomment | html_line_break %]
136                                                     [% END %]
137                                                 </strong>
138                                             </span>
139                                         [% END %]
140                                         [% IF ( borrower.userdebarreddate && debarred_date != '9999-12-31' ) %]
141                                             End date:
142                                             <span id="userdebarred_date">[% borrower.userdebarreddate | $KohaDates %]</span>
143                                         [% END %]
144
145                                         <em>Usually the reason for freezing an account is old overdues or damage fees. If your account shows to be clear, please contact the library.</em> <a href="/cgi-bin/koha/opac-account.pl">Go to your account page</a></li>
146                                     [% END %]
147                                 [% END %]
148                                 [% IF ( borrower.gonenoaddress ) %]
149                                     <li id="gonenoaddress"><strong>Please note:</strong> According to our records, we don't have up-to-date contact information. Please contact the library.
150                                 <a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]Update your contact information[% ELSE %]Go to your contact information[% END %]</a>
151                                 [% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
152                                     </li>
153                                 [% END %]
154                                 [% IF ( borrower.lost ) %]
155                                     <li id="lost"><strong>Please note: </strong> Your library card has been marked as lost or stolen. <em>If this is an error, please contact the library.</em></li>
156                                 [% END %]
157                                 [% IF ( renewal_blocked_fines.defined ) && ( OpacRenewalAllowed ) %]
158                                     <li id="renewal_blocked_fines"><strong>Please note: </strong>You cannot renew your books online. Reason: [% IF ( renewal_blocked_fines ) > 0  %]Your fines exceed <span id="renewal_blocked_fines_amount">[% renewal_blocked_fines | $Price %]</span>.[% ELSE %]You have fines.[% END %]
159                                 [% END %]
160                             </ul>
161                         </div>
162                     [% END # / IF patron_flagged %]
163
164                     <div class="alert alert-info" id="notesaved" style="display:none;"></div>
165
166                     [% IF Koha.Preference('OPACMySummaryNote') %]
167                         <div id="opac-my-summary-note">[% Koha.Preference('OPACMySummaryNote') | $raw %]</div>
168                     [% END %]
169
170                     [% IF Koha.Preference('AllowPatronToControlAutorenewal') %]
171                     <form id="autorenewal_option" action="/cgi-bin/koha/opac-user.pl" method="post">
172                         <legend class="sr-only">Auto-renewal</legend>
173                             <label for="yes-autorenew_checkouts">
174                                 Allow auto-renewal:
175                             </label>
176                                 [% IF ( borrower.autorenew_checkouts ) %]
177                                     <label class="radio inline" for="yes-autorenew_checkouts">
178                                         Yes
179                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" checked="checked" />
180                                     </label>
181
182                                     <label class="radio inline" for="no-autorenew_checkouts">
183                                         No
184                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" />
185                                     </label>
186                                 [% ELSE %]
187                                     <label class="radio inline" for="yes-autorenew_checkouts">
188                                         Yes
189                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" />
190                                     </label>
191                                     <label class="radio inline" for="no-autorenew_checkouts">
192                                         No
193                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" checked="checked" />
194                                     </label>
195                                 [% END %]
196                         <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
197                         <input type="hidden" name="update_arc" value="1" />
198                         <input type="submit" value="Update auto-renewal preference" />
199                     </form>
200                     [% END %]
201
202                     <div id="opac-user-views" class="toptabs">
203                         <ul>
204                             <li><a href="#opac-user-checkouts">Checked out ([% issues_count | html %])</a></li>
205                             [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
206                             [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a></li>[% END %]
207                             [% IF ( OPACFinesTab ) %]
208                             [% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Charges ([% amountoutstanding | $Price %])</a></li>[% END %]
209                                 [% IF ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
210                                 [% IF relatives_with_fines %]<li><a href="#opac-user-relative-fines">Relatives' charges</a></li>[% END %]
211                             [% END %]
212
213                             [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
214                                 <li>
215                                     <a id="opac-user-clubs-tab-link" href="#opac-user-clubs">
216                                         Clubs ([% borrower_club_enrollments.count || 0 | html %]/[% borrower_enrollable_clubs.count || 0 | html %])
217                                     </a>
218                                 </li>
219                             [% END %]
220
221                             [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a></li>[% END %]
222                             [% IF Koha.Preference('ArticleRequests') %]<li><a href="#opac-user-article-requests">Article requests ([% current_article_requests.size || 0 | html %])</a></li>[% END %]
223                             [% IF ( OverDriveCirculation ) %]
224                             <li><a href="#opac-user-overdrive">OverDrive account</a></li>
225                             [% END %]
226                             [% IF ( RecordedBooksCirculation ) %]
227                             <li><a href="#opac-user-recordedbooks">RecordedBooks account</a></li>
228                             [% END %]
229                         </ul>
230
231                         <div id="opac-user-overdrive">
232                         </div>
233                         <div id="opac-user-recordedbooks">
234                         </div>
235                         <div id="opac-user-checkouts">
236                             [% IF ( issues_count ) %]
237                                 <form id="renewselected" action="/cgi-bin/koha/opac-renew.pl" method="post">
238                                     <legend class="sr-only">Renew selected</legend>
239                                     <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]">
240                                     <input type="hidden" name="from" value="opac_user" />
241                                     <table id="checkoutst" class="table table-bordered table-striped">
242                                         <caption>[% issues_count | html %] Item(s) checked out</caption>
243                                         <thead>
244                                             <tr>
245                                                 [% IF ( JacketImages ) %]<th class="nosort">&nbsp;</th>[% END %]
246                                                 <th class="anti-the">Title</th>
247                                                 <th>Author</th>
248                                                 <th class="psort">Due</th>
249                                                 [% UNLESS ( item_level_itypes ) %]
250                                                     <th>Item type</th>
251                                                 [% END %]
252                                                 [% IF ( show_barcode ) %]
253                                                     <th>Barcode</th>
254                                                 [% END %]
255                                                     <th>Call number</th>
256                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
257                                                     <th>Renew</th>
258                                                 [% END %]
259                                                 [% IF ( OPACFinesTab ) %]
260                                                     <th>Fines</th>
261                                                 [% END %]
262                                                 [% IF ( OPACMySummaryHTML ) %]
263                                                     <th class="nosort">Links</th>
264                                                 [% END %]
265                                                 [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
266                                                     <th class="hidden">Checkout note</th>
267                                                     <th id="checkout-notes" class="nosort noExport" title="Use this to report any problems with your currently checked out items">Report a problem</th>
268                                                 [% END %]
269                                             </tr>
270                                         </thead>
271                                         <tbody>
272                                             [% FOREACH ISSUE IN ISSUES %]
273                                                 [% IF ( ISSUE.overdue ) %]<tr class="overdue">[% ELSE %]<tr>[% END %]
274                                                 [% IF ( JacketImages ) %]<td class="jacketcell">
275                                                     [% IF ( OPACAmazonCoverImages ) %]
276                                                         [% IF ( ISSUE.normalized_isbn ) %]
277                                                             <a href="http://www.amazon.com/gp/reader/[% ISSUE.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% ISSUE.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail"/></a>
278                                                         [% ELSE %]
279                                                             <a href="#"><span class="no-image">No cover image available</span></a>
280                                                         [% END %]
281                                                     [% END %]
282
283                                                     [% IF ( GoogleJackets ) %]
284                                                         [% IF ( ISSUE.normalized_isbn ) %]
285                                                             <div style="display:block;" title="Click to view in Google Books" class="[% ISSUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
286                                                         [% ELSE %]
287                                                             <a href="http://books.google.com/books?q=[% ISSUE.title |url %]"><span class="no-image">No cover image available</span></a>
288                                                         [% END %]
289                                                     [% END %]
290
291                                                     [% IF ( BakerTaylorEnabled ) %]
292                                                         [% bt_id = ( ISSUE.normalized_upc || ISSUE.normalized_isbn ) %]
293                                                         [% IF ( bt_id ) %]
294                                                             <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
295                                                         [% ELSE %]
296                                                             <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
297                                                         [% END %]
298                                                     [% END %]
299
300                                                     [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
301                                                         [% SET custom_cover_image_url = ISSUE.biblio_object.custom_cover_image_url %]
302                                                         [% IF custom_cover_image_url %]
303                                                             <a class="custom_cover_image" href="[% custom_cover_image_url | url %]"><img alt="Cover image" src="[% custom_cover_image_url | url %]" /></a>
304                                                         [% END %]
305                                                     [% END %]
306
307                                                     [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
308                                                         <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" />
309                                                     [% END %]
310
311                                                 </td>[% END # / IF JacketImages %]
312
313                                                 <td class="title">
314                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=ISSUE %]</a>
315                                                     [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %]
316
317                                                     [% IF ( ISSUE.onsite_checkout ) %] <em class="onsite_checkout">(On-site checkout)</em>[% END %]
318
319                                                     [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
320                                                         [% INCLUDE 'user-star-ratings.inc' item=ISSUE %]
321                                                     [% END %]
322                                                 </td>
323
324                                                 <td class="author">[% ISSUE.author | html %]</td>
325                                                 [% IF ( ISSUE.overdue ) %]
326                                                     <td class="date_due overdue" data-order="[% ISSUE.date_due | html %]">
327                                                         <span class="tdlabel">Date due:</span>
328                                                         [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
329                                                     </td>
330                                                 [% ELSE %]
331                                                     <td class="date_due" data-order="[% ISSUE.date_due | html %]">
332                                                         <span class="tdlabel">Date due:</span>
333                                                         [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
334                                                     </td>
335                                                 [% END %]
336                                                 [% UNLESS ( item_level_itypes ) %]
337                                                     <td class="itype">
338                                                         <span class="tdlabel">Item type:</span>
339                                                         [% IF ( ISSUE.imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
340                                                             <img src="[% ISSUE.imageurl | html %]" title="[% ISSUE.description | html %]" alt="[% ISSUE.description | html %]" />
341                                                         [% END %] [% ISSUE.description | html %]
342                                                     </td>
343                                                 [% END %]
344                                                 [% IF ( show_barcode ) %]
345                                                     <td class="barcode">
346                                                         <span class="tdlabel">Barcode:</span>
347                                                         [% ISSUE.barcode | html %]
348                                                     </td>
349                                                 [% END %]
350                                                 <td class="call_no">
351                                                     <span class="tdlabel">Call number:</span>
352                                                     [% ISSUE.itemcallnumber | html %]
353                                                 </td>
354                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
355                                                     [% IF ( ISSUE.status && canrenew ) %]
356                                                         <td class="renew" data-order="[% ISSUE.renewsleft | html %]">
357                                                     [% ELSE %]
358                                                         <td class="renew" data-order="0">
359                                                     [% END %]
360                                                         [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
361                                                         [% IF ( ISSUE.status ) %]
362                                                             [% IF ( canrenew ) %]
363                                                                 <input type="checkbox" name="item" value="[% ISSUE.itemnumber | uri %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber | uri %]&amp;borrowernumber=[% ISSUE.borrowernumber | uri %]">Renew</a>
364                                                             [% END %]
365                                                             [% IF ISSUE.renewalfee > 0 %]
366                                                                 <span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span>
367                                                             [% END %]
368                                                             [% IF ISSUE.itemtype_object.rentalcharge_daily > 0 %]
369                                                                 <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_daily | $Price %] per day</span>
370                                                             [% END %]
371                                                             [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
372                                                                 <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
373                                                             [% END %]
374                                                             <span class="renewals">(
375                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
376                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
377                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
378                                                                 [% END %]
379                                                             )</span>
380                                                         [% ELSIF ( ISSUE.on_reserve ) %]
381                                                             Not renewable <span class="renewals">(on hold)</span>
382                                                         [% ELSIF ( ISSUE.too_many ) %]
383                                                             Not renewable
384                                                         [% ELSIF ( ISSUE.too_unseen ) %]
385                                                             Item must be renewed at the library. [% ISSUE.renewsleft | html %] renewals remaining
386                                                         [% ELSIF ( ISSUE.norenew_overdue ) %]
387                                                             Not allowed <span class="renewals">(overdue)</span>
388                                                         [% ELSIF ( ISSUE.auto_too_late ) %]
389                                                             No longer renewable
390                                                         [% ELSIF ISSUE.auto_too_much_oweing %]
391                                                             Automatic renewal failed, you have unpaid fines.
392                                                             <span class="renewals">(
393                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
394                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
395                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
396                                                                 [% END %]
397                                                             )</span>
398                                                         [% ELSIF ISSUE.auto_account_expired %]
399                                                             Automatic renewal failed, your account is expired.
400                                                             <span class="renewals">(
401                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
402                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
403                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
404                                                                 [% END %]
405                                                             )</span>
406                                                         [% ELSIF ( ISSUE.too_soon ) %]
407                                                             No renewal before [% ISSUE.soonestrenewdate | html %]
408                                                             <span class="renewals">(
409                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
410                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
411                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
412                                                                 [% END %]
413                                                             )</span>
414                                                         [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
415                                                             Automatic renewal
416                                                             <span class="renewals">(
417                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
418                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
419                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
420                                                                 [% END %]
421                                                             )</span>
422                                                         [% ELSIF ( ISSUE.item_denied_renewal ) %]
423                                                             Renewal not allowed
424                                                         [% END %]
425                                                     </td>
426                                                 [% END %]
427                                                 [% IF ( OPACFinesTab ) %]
428                                                     <td class="fines">
429                                                         <span class="tdlabel">Fines:</span>
430                                                         [% IF ( ISSUE.charges ) %]
431                                                             Yes (Item overdue or lost)
432                                                         [% ELSIF ( ISSUE.rentalfines ) %]
433                                                             Yes (Rental fees)
434                                                         [% ELSE %]
435                                                             No
436                                                         [% END %]
437                                                     </td>
438                                                 [% END %]
439                                                 [% IF ( OPACMySummaryHTML ) %]
440                                                     <td class="links">[% ISSUE.MySummaryHTML | $raw %]</td>
441                                                 [% END %]
442                                                 [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
443                                                     <td>
444                                                         [% ISSUE.note | html %]
445                                                     </td>
446                                                     <td class="note">
447                                                         <div id="viewnote_[% ISSUE.issue_id | html %]">
448                                                             [% ISSUE.note | html %]
449                                                         </div>
450                                                         <a id="save_[% ISSUE.issue_id | html %]" href="/cgi-bin/koha/opac-issue-note.pl?issue_id=[% ISSUE.issue_id | html %]" class="btn btn-primary btn-sm btn-add-note noprint" data-title="[% ISSUE.title | html %] [% FOREACH subtitle IN ISSUE.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %][% subtitle | html %][% END %]" data-issueid="[% ISSUE.issue_id | html %]" id="save_[% ISSUE.issue_id | html %]">
451                                                             [% IF ( ISSUE.note ) -%]
452                                                                 <span>Edit note</span>
453                                                             [% ELSE -%]
454                                                                 <span>Add note</span>
455                                                             [% END %]
456                                                         </a>
457                                                         <input type="hidden" id="note_[% ISSUE.issue_id | html %]" name="note" value="[% ISSUE.note | html %]" data-origvalue="[% ISSUE.note | html %]" />
458                                                     </td>
459                                                 [% END %]
460                                             </tr>
461                                         [% END # /FOREACH ISSUES %]
462                                     </tbody>
463                                 </table>
464                                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
465                                     <input type="submit" class="btn btn-primary" value="Renew selected" />
466                                     <button type="button" id="renewall_js" class="btn btn-primary">Renew all</button>
467                                 [% END %]
468                                 </form>
469
470                                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
471                                     <form id="renewall" class="js-hide" action="/cgi-bin/koha/opac-renew.pl" method="post">
472                                         <legend class="sr-only">Renew</legend>
473                                         <input type="hidden" name="from" value="opac_user" />
474                                         <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
475                                         [% FOREACH ISSUE IN ISSUES %]
476                                             [% IF ISSUE.status %]
477                                                 <input type="hidden" name="item" value="[% ISSUE.itemnumber | html %]" />
478                                             [% END %]
479                                         [% END %]
480                                         <input type="submit" class="btn btn-primary" value="Renew all" />
481                                     </form>
482                                 [% END %]
483                             [% ELSE %]
484                                 <table class="table table-bordered table-striped">
485                                     <caption class="sr-only">Checked out</caption>
486                                     <tr><td>You have nothing checked out</td></tr>
487                                 </table>
488                             [% END # IF issues_count %]
489
490                             <!-- Add note modal -->
491                             <div class="modal" id="addNoteModal" tabindex="-1" aria-labelledby="addNoteLabel" aria-hidden="true">
492                                 <div class="modal-dialog">
493                                     <form action="#" id="addNoteForm">
494                                         <div class="modal-content">
495                                             <div class="modal-header">
496                                                 <h5 class="modal-title" id="addNoteLabel">Report a problem</h5>
497                                                 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
498                                                     <span aria-hidden="true">&times;</span>
499                                                 </button>
500                                             </div>
501                                             <div class="modal-body" id="addNoteBody">
502                                                 <h6 id="addNoteTitle"></h6>
503                                                 <input type="hidden" id="addNoteIssueId" name="issue_id" value="" />
504                                                 <textarea name="note" id="addNote" rows="4"></textarea>
505                                                 <div class="hint">Your note will be shown to the librarian when the item is checked in.</div>
506                                             </div>
507                                             <div class="modal-footer">
508                                                 <button type="submit" class="btn btn-primary">Submit note</button>
509                                                 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
510                                             </div>
511                                         </div>
512                                     </form>
513                                 </div>
514                             </div>
515
516                         </div> <!-- / .opac-user-checkouts -->
517
518                         [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
519                             <div id="opac-user-clubs">
520                                 Loading...
521                             </div>
522                         [% END %]
523
524                         [% IF ( OPACFinesTab ) %]
525                             <!-- FINES BOX -->
526                             [% IF ( amountoutstanding > 0 ) %]
527                                 <div id="opac-user-fines">
528                                     <table class="table table-bordered table-striped">
529                                         <caption>Charges</caption>
530                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
531                                         <tbody>
532                                             <tr>
533                                                 <td>You currently owe fines and charges amounting to:</td>
534                                                 <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
535                                             </tr>
536                                         </tbody>
537                                     </table>
538                                 </div>
539                             [% END %]
540
541                             [% IF ( amountoutstanding < 0 ) %]
542                                 <div id="opac-user-fines">
543                                     <table class="table table-bordered table-striped">
544                                         <caption>Credits</caption>
545                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
546                                         <tbody>
547                                             <tr>
548                                                 <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding * -1 | $Price %]</a></td>
549                                             </tr>
550                                         </tbody>
551                                     </table>
552                                 </div>
553                             [% END %]
554
555                             [% IF relatives_with_fines %]
556                                <div id="opac-user-relative-fines">
557                                     <table class="table table-bordered table-striped">
558                                    <caption>Fines and charges</caption>
559                                         <thead>
560                                             <tr>
561                                                 <th colspan="2">Amount</th>
562                                             </tr>
563                                         </thead>
564                                         <tbody>
565                                             [% FOREACH r IN relatives_with_fines %]
566                                             <tr>
567                                                 <td>[% r.firstname | html %] [% r.surname | html %] currently owes fines and charges amounting to:</td>
568                                                 <td><a href="/cgi-bin/koha/opac-account.pl#g[% r.id | uri %]">[% r.account.balance | $Price %]</a></td>
569                                             </tr>
570                                             [% END %]
571                                         </tbody>
572                                     </table>
573                                 </div>
574                             [% END %]
575                         [% END # / OPACFinesTab %]
576
577                         [% IF relatives %]
578                             <div id="opac-user-relative-issues">
579                                 <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
580                                     <caption class="sr-only">Relative issues</caption>
581                                     <thead>
582                                         <tr>
583                                             <th class="anti-the">Title</th>
584                                             <th>Due</th>
585                                             <th>Barcode</th>
586                                             <th>Call number</th>
587                                             <th class="psort">Relative</th>
588                                         </tr>
589                                     </thead>
590
591                                     <tbody>
592                                         [% FOREACH r IN relatives %]
593                                             [% FOREACH c IN r.checkouts %]
594                                                 <tr>
595                                                     <td>
596                                                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% c.item.biblio.biblionumber | uri %]">
597                                                             [% c.item.biblio.title | html %][% IF ( c.item.enumchron ) %] [% c.item.enumchron | html %][% END %]
598                                                         </a>
599                                                     </td>
600
601                                                     <td>
602                                                         [% c.date_due | $KohaDates %]
603                                                     </td>
604
605                                                     <td>
606                                                         [% c.item.barcode | html %]
607                                                     </td>
608
609                                                     <td>
610                                                         [% c.item.itemcallnumber | html %]
611                                                     </td>
612
613                                                     <td>
614                                                         [% r.firstname | html %] [% r.surname | html %]
615                                                     </td>
616                                                 </tr>
617                                             [% END %]
618                                         [% END %]
619                                     </tbody>
620                                 </table>
621                             </div>
622                         [% END %]
623
624                         [% IF ( overdues_count ) %]
625                             <div id="opac-user-overdues">
626                                 <table id="overduest" class="table table-bordered table-striped">
627                                     <caption>Overdues <span class="count">([% overdues_count | html %] total)</span></caption>
628                                     <!-- OVERDUES TABLE ROWS -->
629                                     <thead>
630                                         <tr>
631                                             [% IF ( JacketImages ) %]<th class="nosort">&nbsp;</th>[% END %]
632                                             <th class="anti-the">Title</th>
633                                             [% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
634                                             [% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
635                                             <th>Call number</th>
636                                             <th class="psort">Due</th>
637                                             [% IF ( OpacRenewalAllowed ) %]
638                                                 <th class="nosort">Renew</th>
639                                             [% END %]
640                                             [% IF ( OPACFinesTab ) %]
641                                                 <th>Fines</th>
642                                             [% END %]
643                                         </tr>
644                                     </thead>
645                                     <tbody>
646                                         [% FOREACH OVERDUE IN OVERDUES %]
647                                             <tr>
648                                                 [% IF ( JacketImages ) %]
649                                                     <td class="jacketcell">
650                                                     [% IF ( OPACAmazonCoverImages ) %]
651                                                         [% IF ( OVERDUE.normalized_isbn ) %]
652                                                             <a href="http://www.amazon.com/gp/reader/[% OVERDUE.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% OVERDUE.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail" /></a>
653                                                         [% ELSE %]
654                                                             <a href="#"><span class="no-image">No cover image available</span></a>
655                                                         [% END %]
656                                                     [% END %]
657
658                                                     [% IF ( GoogleJackets ) %]
659                                                         [% IF ( OVERDUE.normalized_isbn ) %]
660                                                             <div style="display:block;" title="Click to view in Google Books" class="[% OVERDUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
661                                                         [% ELSE %]
662                                                             <a href="http://books.google.com/books?q=[% OVERDUE.title |url %]"><span class="no-image">No cover image available</span></a>
663                                                         [% END %]
664                                                     [% END %]
665
666                                                     [% IF ( BakerTaylorEnabled ) %]
667                                                         [% bt_id = ( OVERDUE.normalized_upc || OVERDUE.normalized_isbn ) %]
668                                                         [% IF ( bt_id ) %]
669                                                             <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
670                                                         [% ELSE %]
671                                                             <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
672                                                         [% END %]
673                                                     [% END %]
674
675                                                     [% IF ( SyndeticsCoverImages ) %]
676                                                         <img src="https://secure.syndetics.com/index.aspx?isbn=[% OVERDUE.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;upc=[% OVERDUE.normalized_upc | html %]&amp;oclc=[% OVERDUE.normalized_oclc | html %]&amp;type=xw10" alt="" class="item-thumbnail" />
677                                                     [% END %]
678                                                     </td>
679                                                 [% END # /IF jacketcell %]
680
681                                                 <td>
682                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?bib=[% OVERDUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=OVERDUE %]</a>
683                                                     <span class="item-details">[% OVERDUE.author | html %]</span>
684                                                 </td>
685
686                                                 [% UNLESS ( item_level_itypes ) %]
687                                                     <td>
688                                                         [% IF ( OVERDUE.imageurl  && !Koha.Preference('OpacNoItemTypeImages') ) %]
689                                                             <img src="[% OVERDUE.imageurl | html %]" title="[% OVERDUE.description | html %]" alt="[% OVERDUE.description | html %]" />
690                                                         [% END %] [% OVERDUE.description | html %]
691                                                     </td>
692                                                 [% END %]
693                                                 [% IF ( show_barcode ) %]
694                                                     <td>
695                                                         <span class="tdlabel">Barcode:</span>
696                                                         [% OVERDUE.barcode | html %]
697                                                     </td>
698                                                 [% END %]
699                                                 <td>
700                                                     <span class="tdlabel">Call number:</span>
701                                                     [% OVERDUE.itemcallnumber | html %]
702                                                 </td>
703                                                 <td data-order="[% OVERDUE.date_due | html %]">
704                                                     <span class="tdlabel">Date due:</span>
705                                                     [% OVERDUE.date_due | $KohaDates  as_due_date => 1 %]
706                                                 </td>
707                                                 [% IF ( OpacRenewalAllowed ) %]
708                                                     <td>
709                                                         [% IF ( OVERDUE.debarred ) %]
710                                                             Account frozen
711                                                         [% ELSIF ( OVERDUE.status ) %]
712                                                             [% IF ( canrenew ) %]
713                                                                 <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
714                                                             [% END %]
715                                                                 <span class="renewals">(
716                                                                     [% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining
717                                                                     [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
718                                                                         / [% OVERDUE.unseenleft | html %] of [% OVERDUE.unseenallowed | html %] renewals left before the item must be seen by the library
719                                                                     [% END %]
720                                                                 )</span>
721                                                         [% ELSIF ( OVERDUE.norenew_overdue ) %]
722                                                             Not allowed<span class="renewals">(overdue)</span>
723                                                         [% ELSIF ( OVERDUE.onreserve ) %]
724                                                             On hold
725                                                         [% ELSE %]
726                                                             No renewals left
727                                                         [% END %]
728                                                     </td>
729                                                 [% END %]
730                                                 [% IF ( OPACFinesTab ) %]
731                                                     <td>
732                                                         <span class="tdlabel">Fines:</span>
733                                                         [% IF ( OVERDUE.charges ) %]
734                                                             Yes
735                                                         [% ELSE %]
736                                                             No
737                                                         [% END %]
738                                                     </td>
739                                                 [% END %]
740                                             </tr>
741                                         [% END %]
742                                     </tbody>
743                                 </table>
744                             </div> <!-- / #opac-user-overdues -->
745                         [% END # /overdues_count %]
746
747                         [% PROCESS 'holds-table.inc' HOLDS = RESERVES, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds %]
748
749                         [% IF Koha.Preference('ArticleRequests') %]
750                             <div id="opac-user-article-requests">
751                                 [% IF current_article_requests.size %]
752                                     <table id="article-requests-table" class="table table-bordered table-striped">
753                                         <caption>Article requests <span class="count"></span></caption>
754                                         <thead>
755                                             <tr>
756                                                 <th class="anti-the article-request-record-title">Record title</th>
757                                                 <th class="psort article-request-created-on">Placed on</th>
758                                                 <th class="anti-the article-request-title">Title</th>
759                                                 <th class="article-request-author">Author</th>
760                                                 <th class="article-request-volume">Volume</th>
761                                                 <th class="article-request-issue">Issue</th>
762                                                 <th class="article-request-date">Date</th>
763                                                 <th class="article-request-toc" title="Table of contents">TOC</th>
764                                                 <th class="article-request-pages">Pages</th>
765                                                 <th class="article-request-chapters">Chapters</th>
766                                                 <th class="article-request-patron-notes">Notes</th>
767                                                 <th class="article-request-format">Format</th>
768                                                 <th class="article-request-status">Status</th>
769                                                 <th class="article-request-branchcode">Pickup library</th>
770                                                 <th class="nosort article-request-cancel">&nbsp;</th>
771                                             </tr>
772                                         </thead>
773
774                                         <tbody>
775                                         [% FOREACH ar IN current_article_requests %]
776                                                 <td class="article-request-record-title">
777                                                     <a class="article-request-title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ar.biblionumber | html %]">
778                                                         [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
779                                                         [% ar.item.enumchron | html %]
780                                                     </a>
781                                                     [% ar.biblio.author | html %]
782                                                     [% IF ar.itemnumber %] <em>(only [% ar.item.barcode | html %])</em>[% END %]
783                                                 </td>
784
785                                                 <td class="article-request-created_on">
786                                                     [% ar.created_on | $KohaDates %]
787                                                 </td>
788
789                                                 <td class="article-request-title">
790                                                     [% ar.title | html %]
791                                                 </td>
792
793                                                 <td class="article-request-author">
794                                                     [% ar.author | html %]
795                                                 </td>
796
797                                                 <td class="article-request-volume">
798                                                     [% ar.volume | html %]
799                                                 </td>
800
801                                                 <td class="article-request-issue">
802                                                     [% ar.issue | html %]
803                                                 </td>
804
805                                                 <td class="article-request-date">
806                                                     [% ar.date | html %]
807                                                 </td>
808
809                                                 <td class="article-request-toc">
810                                                     [% IF ar.toc_request %]Yes[% END %]
811                                                 </td>
812
813                                                 <td class="article-request-pages">
814                                                     [% ar.pages | html %]
815                                                 </td>
816
817                                                 <td class="article-request-chapters">
818                                                     [% ar.chapters | html %]
819                                                 </td>
820
821                                                 <td class="article-request-patron-notes">
822                                                     [% ar.patron_notes | html %]
823                                                 </td>
824
825                                                 <td class="article-request-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
826
827                                                 <td class="article-request-status">
828                                                     [% IF ar.status == 'PENDING' %]
829                                                         Pending
830                                                     [% ELSIF ar.status == 'PROCESSING' %]
831                                                         Processing
832                                                     [% ELSIF ar.status == 'REQUESTED' %]
833                                                         New
834                                                     [% ELSIF ar.status == 'COMPLETED' %]
835                                                         Completed
836                                                     [% ELSIF ar.status == 'CANCELED' %]
837                                                         Canceled
838                                                     [% END %]
839                                                 </td>
840
841                                                 <td class="article-request-branchcode">
842                                                     [% ar.branch.branchname | html %]
843                                                 </td>
844
845                                                 <td class="article-request-cancel">
846                                                     <button data-title="[% ar.biblio.title | html %] [% ar.item.enumchron | html %]" data-article-request_id="[% ar.id | html %]" class="btn btn-sm btn-danger btn-delete-article-request"><i class="fa fa-remove" aria-hidden="true"></i> Cancel</button>
847                                                 </td>
848                                             </tr>
849                                         [% END %]
850                                     </tbody>
851                                 </table>
852                             [% ELSE %]
853                                 <table class="table table-bordered table-striped">
854                                     <caption class="sr-only">Article requests</caption>
855                                     <tr><td>You have no article requests currently.</td></tr>
856                                 </table>
857                             [% END # IF current_article_requests.size %]
858                         </div> <!-- / #opac-user-article-requests -->
859                     [% END %]
860
861                     </div> <!-- /#opac-user-views -->
862                 </div> <!-- /#userdetails -->
863             </div> <!-- /.col-10 -->
864         </div> <!-- /.row -->
865     </div> <!-- /.container-fluid -->
866 </div> <!-- /#main -->
867
868 [% IF ( OverDriveCirculation ) %]
869     [% INCLUDE 'overdrive-checkout.inc' %]
870     [% IF ( Koha.Preference('OverDrivePasswordRequired') ) %]
871         [% INCLUDE 'overdrive-login.inc' %]
872     [% END %]
873 [% END %]
874 [% IF ( RecordedBooksCirculation ) %]
875 [% INCLUDE 'recordedbooks-checkout.inc' %]
876 [% END %]
877
878 [% INCLUDE 'opac-bottom.inc' %]
879 [% BLOCK jsinclude %]
880     [% INCLUDE 'calendar.inc' %]
881     [% INCLUDE 'datatables.inc' %]
882     <script>
883         var AR_CAPTION_COUNT = _("(%s total)");
884
885
886         function tableInit( tableId ){
887             if( tableId == "checkoutst" ){
888                 $(".dt-buttons").append("<button type=\"button\" class=\"dt-button buttons-ical\" id=\"buttons-ics\">iCal</button> ");
889                 [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
890                     $(".dt-buttons").append("<button id=\"renewselected_link\" class=\"dt-button buttons-renew\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> "+_("Renew selected")+"</button> <button id=\"renewall_link\" class=\"dt-button buttons-renewall\"><span class=\"fa-stack\"><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i></span> "+_("Renew all")+"</button>");
891                 [% END %]
892             }
893         }
894         $(document).ready(function(){
895             $('#opac-user-article-requests caption .count').html(AR_CAPTION_COUNT.format('[% current_article_requests_count | html %]'));
896             $('#opac-user-views').tabs();
897             $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
898             $(".suspend-until").prop("readonly",1);
899
900             $(".btn-delete-hold").on("click", function(e){
901                 e.preventDefault();
902                 var hold_title = $(this).data("title");
903                 var reserve_id = $(this).data("reserve_id");
904                 confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){
905                         $("#bootstrap-confirm-box-modal").remove()
906                         if( result ){
907                             $("#delete_hold_" + reserve_id ).submit();
908                         }
909                     }
910                 );
911             });
912
913             $(".btn-delete-article-request").on("click", function(e){
914                 e.preventDefault();
915                 var article_request = $(this).data("title");
916                 var article_request_id = $(this).data("article-request_id");
917                 (function(row){
918                     var doCancel = function( result ){
919                         $("#bootstrap-confirm-box-modal").remove();
920                         if( result ){
921                             $.ajax({
922                                 type: "DELETE",
923                                 url: '/api/v1/public/patrons/'+borrowernumber+'/article_requests/'+article_request_id+'?cancellation_reason=OPAC',
924                                 success: function( data ) {
925                                     row.parents('tr').hide({
926                                         duration: 'slow',
927                                         complete: function() {
928                                             var ar_tab = $('a[href="#opac-user-article-requests"');
929                                             var ar_table = $('#article-requests-table');
930                                             var ar_length = $('tbody tr:visible', ar_table).length;
931                                             var ar_count = $('caption .count', ar_table);
932
933                                             ar_tab.html(ar_tab.html().replace(/\(\d+\)/, '('+ar_length+')'));
934                                             ar_count.html(AR_CAPTION_COUNT.format(ar_length));
935                                         }
936                                     });
937                                 }
938                             });
939                         }
940                     };
941                     confirmModal( article_request, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), doCancel);
942                 })($(this))
943             });
944
945             $("#suspend_all_submit").on("click", function(e){
946                 e.preventDefault();
947                 var title = _("Are you sure you want to suspend all holds?");
948                 var body = _("All holds will be suspended.");
949                 confirmModal( body, title, _("Yes, suspend all holds"), "", function( result ){
950                         $("#bootstrap-confirm-box-modal").remove()
951                         if( result ){
952                             $("#suspend_all_holds").submit();
953                         }
954                     }
955                 );
956             });
957
958             $("#resume_all_submit").on("click", function(e){
959                 e.preventDefault();
960                 var title = _("Are you sure you want to resume all suspended holds?");
961                 var body = _("All holds will resume.");
962                 confirmModal( body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function( result ){
963                         $("#bootstrap-confirm-box-modal").remove()
964                         if( result ){
965                             $("#resume_all_holds").submit();
966                         }
967                     }
968                 );
969             });
970
971             var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
972             dTables.each(function(){
973                 var thIndex = $(this).find("th.psort").index();
974                 $(this).on("init.dt", function() {
975                         tableInit( $(this).attr("id") );
976                     })
977                     .dataTable($.extend(true, {}, dataTablesDefaults, {
978                     "sorting" : [[ thIndex, 'asc' ]],
979                     "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
980                     "columnDefs": [
981                         { "targets": [ "nosort" ],"sortable": false,"searchable": false },
982                         { "type": "anti-the", "targets" : [ "anti-the" ] },
983                         { "visible": false, "targets" : [ "hidden" ] }
984                     ],
985                     "language": {
986                         "search": "_INPUT_",
987                         "searchPlaceholder": _("Search")
988                     },
989                     "autoWidth": false,
990                     buttons: [
991                         /* Override default button set so that we can extend the options of print and csv */
992                         'clearFilter', 'copy',
993                         {
994                             extend: "print",
995                             exportOptions: {
996                                 /* Print view should show all columns (even invisible ones) unless they are .noExport */
997                                 columns: ":not(.noExport)"
998                             }
999                         },
1000                         {
1001                             extend: "csv",
1002                             exportOptions: {
1003                                 /* CSV export should include all columns (even invisible ones) unless they are .noExport */
1004                                 columns: ":not(.noExport)"
1005                             }
1006                         }
1007                     ]
1008                 }));
1009             });
1010
1011             $("body").on("click", "#buttons-ics", function(){
1012                 location.href="/cgi-bin/koha/opac-ics.pl";
1013             });
1014
1015             [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
1016             [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1017                 $("#renewselected").submit(function(){
1018                     valid = false;
1019                     $("input[type=checkbox]").each(function(){
1020                         if($(this).is(':checked')){
1021                             valid = true;
1022                         }
1023                     });
1024                     if(!valid){
1025                         alert(_("Nothing has been selected. Check the box for each item you want to renew"));
1026                     }
1027                     return valid;
1028                 });
1029                 $("body").on("click","#renewselected_link",function(e){
1030                     e.preventDefault();
1031                     $("#renewselected").submit();
1032                 });
1033                 $("body").on("click","#renewall_link, #renewall_js",function(e){
1034                     e.preventDefault();
1035                     $("#renewall").submit();
1036                 });
1037             [% END # /IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1038
1039             [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
1040
1041                 /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
1042                 $(".nonjs_submitnote").hide();
1043
1044                 $("input[name='note']").prop('readonly', false);
1045                 $("input[name='note']").keypress(function(e){
1046                     /* prevent submitting of renewselected form */
1047                     if(e.which == 13)
1048                         e.preventDefault();
1049                 });
1050
1051                 $("input[name='note']").keyup(function(e){
1052                     var $btn_save = $('#save_'+$(this).data('issue_id'));
1053                     var origvalue = $(this).data('origvalue');
1054                     var value = $(this).val();
1055
1056                     if(origvalue != value) {
1057                         if(origvalue != "")
1058                             $btn_save.text(_("Submit changes"));
1059                         else
1060                             $btn_save.text(_("Submit note"));
1061                         $btn_save.show();
1062                     } else {
1063                         $btn_save.hide();
1064                     }
1065                 });
1066
1067             [% END %]
1068
1069             $(".suspend-until").datepicker({
1070                 beforeShow: function(input, inst) {
1071                     // https://stackoverflow.com/questions/662220/how-to-change-the-pop-up-position-of-the-jquery-datepicker-control#answer-10598178
1072                     var calendar = inst.dpDiv;
1073                     setTimeout(function() {
1074                         calendar.position({
1075                             my: 'left top',
1076                             at: 'left bottom',
1077                             collision: 'none',
1078                             of: input
1079                         });
1080                     }, 1);
1081                 },
1082                 minDate: 1
1083             });
1084
1085             if ( $('#opac-user-clubs').length ) {
1086                 $('#opac-user-clubs-tab-link').on('click', function() {
1087                     $('#opac-user-clubs').text(_("Loading..."));
1088                     $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
1089                 });
1090             }
1091
1092             $("body").on("click", ".btn-add-note", function(e){
1093                 e.preventDefault();
1094                 var title = $(this).data("title");
1095                 var issue_id = $(this).data("issueid");
1096                 var note = $("#note_" + issue_id ).val();
1097                 var origvalue = $("#note_" + issue_id ).data("origvalue");
1098                 $("#addNote").val( note );
1099                 $("#addNoteIssueId").val( issue_id );
1100                 $("#addNoteTitle").text( title );
1101                 $("#addNoteModal").modal("show");
1102             });
1103
1104             $("#addNoteForm").on("submit", function(e){
1105                 e.preventDefault();
1106                 var title = $("#addNoteTitle").text();
1107                 var issue_id = $("#addNoteIssueId").val();
1108                 var note = $("#addNote").val();
1109                 submitNote( title, issue_id, note );
1110             });
1111
1112             $("#addNoteModal").on("hidden.bs.modal", function(){
1113                 $("#addNoteTitle").text("");
1114                 $("#addNote").val("");
1115             });
1116         });
1117
1118         function submitNote( title, issue_id, note ){
1119             var self = $("#addNoteModal");
1120             var notebutton = $("#save_" + issue_id );
1121             var noteinput = $("#note_" + issue_id );
1122
1123             var ajaxData = {
1124                 'action': 'issuenote',
1125                 'issue_id': issue_id,
1126                 'note': note
1127             };
1128
1129             $.ajax({
1130                 url: '/cgi-bin/koha/svc/checkout_notes/',
1131                 type: 'POST',
1132                 dataType: 'json',
1133                 data: ajaxData,
1134             })
1135             .done(function(data) {
1136                 var message = "";
1137                 if(data.status == 'saved') {
1138                     $("#notesaved").removeClass("alert-error");
1139                     $("#notesaved").addClass("alert-info");
1140                     noteinput.data('origvalue', data.note)
1141                         .val(data.note);
1142                     notebutton.text( _("Edit note" ) );
1143                     $("#viewnote_" + issue_id ).text( data.note );
1144                     message = "<p>" + _("Your note about %s has been saved and sent to the library.").format( em(title) ) + "</p>";
1145                     message += "<p class=\"checkout_note\">" + data.note;
1146                     message += "<a href=\"/cgi-bin/koha/opac-issue-note.pl?issue_id=" + issue_id + "\" class=\"btn btn-link btn-sm btn-add-note\" data-title=\"" + title + "\" data-issueid=\"" + issue_id + "\"><i class=\"fa fa-pencil\" aria-hidden=\"true\"></i> " + _("Edit note") + "</a>";
1147                     message += "</p>";
1148                 } else if(data.status == 'removed') {
1149                     $("#notesaved").removeClass("alert-error");
1150                     $("#notesaved").addClass("alert-info");
1151                     noteinput.data('origvalue', "")
1152                         .val("")
1153                     notebutton.text( _("Add note") );
1154                     $("#viewnote_" + issue_id ).text( data.note );
1155                     message = "<p>" + _("Your note about %s was removed.").format( em(title) ) + "</p>";
1156                 } else {
1157                     $("#notesaved").removeClass("alert-info");
1158                     $("#notesaved").addClass("alert-error");
1159                     message =  "<p>" + _("Your note about %s could not be saved.").format( em(title) ) + "</p>";
1160                     notebutton.text( _("Add note") );
1161                     $("#viewnote_" + issue_id ).text( data.note );
1162                     message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
1163                 }
1164                 $("#notesaved").html(message);
1165             })
1166             .fail(function(data) {
1167                 $("#notesaved").removeClass("alert-info");
1168                 $("#notesaved").addClass("alert-error");
1169                 var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
1170                 $("#notesaved").html(message);
1171             })
1172             .always(function() {
1173                 self.modal("hide");
1174                 $("#notesaved").show();
1175             });
1176         }
1177
1178         function em( title ){
1179             return "<em>" + title + "</em>";
1180         }
1181
1182         var borrowernumber = "[% borrowernumber | html %]";
1183         var MSG_YOUR_RATING = _("Your rating: %s, ");
1184         var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)");
1185     </script>
1186     [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
1187         [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1188         [% Asset.js("js/ratings.js") | $raw %]
1189     [% END %]
1190     [% IF Koha.Preference('OverDriveCirculation') %]
1191     [% Asset.js("js/overdrive.js") | $raw %]
1192     <script>
1193     var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %];
1194     $(document).ready(function() {
1195         [% IF ( overdrive_error ) %]
1196             KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]");
1197         [% END %]
1198
1199         [% IF ( overdrive_tab ) %]
1200             $("#opac-user-views").tabs("select", "#opac-user-overdrive");
1201         [% END %]
1202
1203         $("#opac-user-overdrive").each( function() {
1204             KOHA.OverDriveCirculation.display_account_details(this);
1205         } );
1206     });
1207     </script>
1208     [% END %]
1209     [% IF RecordedBooksCirculation %]
1210         [% Asset.js("js/recordedbooks.js") | $raw %]
1211         <script>
1212             $(document).ready(function() {
1213                 [% IF ( recordedbooks_error ) %]
1214                     KOHA.RecordedBooks.display_error("#opac-user-recordedbooks", "[% recordedbooks_error.dquote | html %]");
1215                 [% END %]
1216                 [% IF ( recordedbooks_tab ) %]
1217                     $("#opac-user-views").tabs("select", "#opac-user-recordedbooks");
1218                 [% END %]
1219                 $("#opac-user-recordedbooks").each( function() {
1220                     KOHA.RecordedBooks.display_account_details(this);
1221                 } );
1222             });
1223         </script>
1224     [% END %]
1225 [% END %]