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