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