Bug 25771: Allow the user to sort checkouts by the renew column in the OPAC
[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 [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
9 [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
10
11 [% SET borrower_club_enrollments =  logged_in_user.get_club_enrollments(1) %]
12 [% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1,1) %]
13
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home</title>
16 [% INCLUDE 'doc-head-close.inc' %]
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 aria-label="breadcrumb">
30         <ul 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" aria-current="page">
38                 <a href="#">Your summary</a>
39             </li>
40         </ul>
41     </nav>
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                     [% INCLUDE 'opac-note.inc' %]
54
55                     <h2>Hello, [% INCLUDE 'patron-title.inc' patron = logged_in_user %]
56                     </h2>
57
58                     <p><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>
59
60                     [% IF ( patronupdate ) %]<div class="alert alert-info"><h3>Thank you!</h3><p>Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.</p></div>[% END %]
61
62                     [% IF failed_holds %]
63                         <div class="alert alert-info">
64                             <h3>Notice:</h3>
65                             <p>One or more holds were not placed due to existing holds.</p>
66                         </div>
67                     [% END %]
68
69                     [% IF ( borrower.blockedonfines ) %]
70                         <div class="alert alert-warning" id="blockedonfines">
71                             <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>
72                         </div>
73                     [% END %]
74
75                     [% IF ( borrower.warndeparture ) %]
76                         <div class="alert alert-warning" id="warndeparture">
77                             <strong>Please note:</strong><span> Your card will expire on <span id="warndeparture_date">[% borrower.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
78                                 [% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your card expires.</span>[% END %]
79                         </div>
80                     [% END %]
81
82                     [% IF ( borrower.warnexpired ) %]
83                         <div class="alert alert-warning" id="warnexpired">
84                             <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>
85                         </div>
86                     [% END %]
87
88                     [% IF ( RENEW_ERROR ) %]
89                         <div class="alert alert-warning">
90                             <strong>Please note:</strong>
91                                 Your loan renewal failed because of the following reason(s):
92                                 <ul>
93                                     [% FOREACH error IN RENEW_ERROR.split('\|') %]
94                                         [% IF error == 'card_expired' %]
95                                             <li>Your account has expired. Please contact the library for more information.</li>
96                                         [% ELSIF error == 'too_many' %]
97                                             <li>You have renewed this item the maximum number of times allowed.</li>
98                                         [% ELSIF error == 'too_soon' %]
99                                             <li>It is too soon after the checkout date for this item to be renewed.</li>
100                                         [% ELSIF error == 'on_reserve' %]
101                                             <li>This item is on hold for another borrower.</li>
102                                         [% ELSIF error == 'item_denied_renewal' %]
103                                             <li>Item renewal is not allowed.</li>
104                                         [% END %]
105                                     [% END %]
106                                 </ul>
107                         </div>
108                     [% END %]
109
110                     [% IF ( patron_flagged ) %]
111                         <div class="alert alert-warning">
112                             <ul>
113                                 [% IF ( userdebarred ) %]
114                                     [% IF ( discharge_available ) %]
115                                         <li id="discharged">
116                                             <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>
117                                         </li>
118                                     [% ELSE %]
119                                         <li id="userdebarred"><strong>Please note:</strong> Your account has been frozen.
120                                         [% IF ( borrower.debarredcomment ) %]
121                                             Comment:
122                                             <span id="userdebarred_comment">
123                                                 <strong>
124                                                     [% IF borrower.debarredcomment.search('OVERDUES_PROCESS') %]
125                                                         Restriction added by overdues process [% borrower.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
126                                                     [% ELSE %]
127                                                         [% borrower.debarredcomment | html_line_break %]
128                                                     [% END %]
129                                                 </strong>
130                                             </span>
131                                         [% END %]
132                                         [% IF ( borrower.userdebarreddate && debarred_date != '9999-12-31' ) %]
133                                             End date:
134                                             <span id="userdebarred_date">[% borrower.userdebarreddate | $KohaDates %]</span>
135                                         [% END %]
136
137                                         <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>
138                                     [% END %]
139                                 [% END %]
140                                 [% IF ( borrower.gonenoaddress ) %]
141                                     <li id="gonenoaddress"><strong>Please note:</strong> According to our records, we don't have up-to-date contact information. Please contact the library.
142                                 <a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]Update your contact information[% ELSE %]Go to your contact information[% END %]</a>
143                                 [% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
144                                     </li>
145                                 [% END %]
146                                 [% IF ( borrower.lost ) %]
147                                     <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>
148                                 [% END %]
149                                 [% IF ( renewal_blocked_fines.defined ) && ( OpacRenewalAllowed ) %]
150                                     <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 %]
151                                 [% END %]
152                             </ul>
153                         </div>
154                     [% END # / IF patron_flagged %]
155
156                     <div class="alert alert-info" id="notesaved" style="display:none;"></div>
157
158                     [% IF Koha.Preference('OPACMySummaryNote') %]
159                         <div id="opac-my-summary-note">[% Koha.Preference('OPACMySummaryNote') | $raw %]</div>
160                     [% END %]
161
162                     [% IF Koha.Preference('AllowPatronToControlAutorenewal') %]
163                     <form id="autorenewal_option" action="/cgi-bin/koha/opac-user.pl" method="post">
164                             <label for="yes-autorenew_checkouts">
165                                 Allow auto-renewal:
166                             </label>
167                                 [% IF ( borrower.autorenew_checkouts ) %]
168                                     <label class="radio inline" for="yes-autorenew_checkouts">
169                                         Yes
170                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" checked="checked" />
171                                     </label>
172
173                                     <label class="radio inline" for="no-autorenew_checkouts">
174                                         No
175                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" />
176                                     </label>
177                                 [% ELSE %]
178                                     <label class="radio inline" for="yes-autorenew_checkouts">
179                                         Yes
180                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" />
181                                     </label>
182                                     <label class="radio inline" for="no-autorenew_checkouts">
183                                         No
184                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" checked="checked" />
185                                     </label>
186                                 [% END %]
187                         <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
188                         <input type="hidden" name="update_arc" value="1" />
189                         <input type="submit" value="Update auto-renewal preference" />
190                     </form>
191                     [% END %]
192
193                     <div id="opac-user-views" class="toptabs">
194                         <ul>
195                             <li><a href="#opac-user-checkouts">Checked out ([% issues_count | html %])</a></li>
196                             [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
197                             [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a></li>[% END %]
198                             [% IF ( OPACFinesTab ) %]
199                             [% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Charges ([% amountoutstanding | $Price %])</a></li>[% END %]
200                                 [% IF ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
201                                 [% IF relatives_with_fines %]<li><a href="#opac-user-relative-fines">Relatives' fines</a></li>[% END %]
202                             [% END %]
203
204                             [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
205                                 <li>
206                                     <a id="opac-user-clubs-tab-link" href="#opac-user-clubs">
207                                         Clubs ([% borrower_club_enrollments.count || 0 | html %]/[% borrower_enrollable_clubs.count || 0 | html %])
208                                     </a>
209                                 </li>
210                             [% END %]
211
212                             [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a></li>[% END %]
213                             [% IF Koha.Preference('ArticleRequests') && logged_in_user.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% logged_in_user.article_requests_current.count | html %])</a></li>[% END %]
214                             [% IF ( OverDriveCirculation ) %]
215                             <li><a href="#opac-user-overdrive">OverDrive Account</a></li>
216                             [% END %]
217                             [% IF ( RecordedBooksCirculation ) %]
218                             <li><a href="#opac-user-recordedbooks">RecordedBooks Account</a></li>
219                             [% END %]
220                         </ul>
221
222                         <div id="opac-user-overdrive">
223                         </div>
224                         <div id="opac-user-recordedbooks">
225                         </div>
226                         <div id="opac-user-checkouts">
227                             [% IF ( issues_count ) %]
228                                 <form id="renewselected" action="/cgi-bin/koha/opac-renew.pl" method="post">
229                                     <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]">
230                                     <input type="hidden" name="from" value="opac_user" />
231                                     <table id="checkoutst" class="table table-bordered table-striped">
232                                         <caption>[% issues_count | html %] Item(s) checked out</caption>
233                                         <thead>
234                                             <tr>
235                                                 [% IF ( JacketImages || AdlibrisEnabled ) %]<th class="nosort">&nbsp;</th>[% END %]
236                                                 <th class="anti-the">Title</th>
237                                                 <th>Author</th>
238                                                 <th class="title-string psort">Due</th>
239                                                 [% UNLESS ( item_level_itypes ) %]
240                                                     <th>Item type</th>
241                                                 [% END %]
242                                                 [% IF ( show_barcode ) %]
243                                                     <th>Barcode</th>
244                                                 [% END %]
245                                                     <th>Call no.</th>
246                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
247                                                     <th>Renew</th>
248                                                 [% END %]
249                                                 [% IF ( OPACFinesTab ) %]
250                                                     <th>Fines</th>
251                                                 [% END %]
252                                                 [% IF ( OPACMySummaryHTML ) %]
253                                                     <th class="nosort">Links</th>
254                                                 [% END %]
255                                                 [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
256                                                     <th class="nosort">Note</th>
257                                                 [% END %]
258                                             </tr>
259                                         </thead>
260                                         <tbody>
261                                             [% FOREACH ISSUE IN ISSUES %]
262                                                 [% IF ( ISSUE.overdue ) %]<tr class="overdue">[% ELSE %]<tr>[% END %]
263                                                 [% IF ( JacketImages || AdlibrisEnabled ) %]<td class="jacketcell">
264                                                     [% IF ( AdlibrisEnabled && ISSUE.normalized_isbn ) %]
265                                                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | uri %]"><img src="[% AdlibrisURL | url %]?isbn=[% ISSUE.normalized_isbn | uri %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
266                                                     [% END %]
267                                                     [% IF ( OPACAmazonCoverImages ) %]
268                                                         [% IF ( ISSUE.normalized_isbn ) %]
269                                                             <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>
270                                                         [% ELSE %]
271                                                             <a href="#"><span class="no-image">No cover image available</span></a>
272                                                         [% END %]
273                                                     [% END %]
274
275                                                     [% IF ( GoogleJackets ) %]
276                                                         [% IF ( ISSUE.normalized_isbn ) %]
277                                                             <div style="display:block;" title="Click to view in Google Books" class="[% ISSUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
278                                                         [% ELSE %]
279                                                             <a href="http://books.google.com/books?q=[% ISSUE.title |url %]"><span class="no-image">No cover image available</span></a>
280                                                         [% END %]
281                                                     [% END %]
282
283                                                     [% IF ( BakerTaylorEnabled ) %]
284                                                         [% bt_id = ( ISSUE.normalized_upc || ISSUE.normalized_isbn ) %]
285                                                         [% IF ( bt_id ) %]
286                                                             <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
287                                                         [% ELSE %]
288                                                             <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
289                                                         [% END %]
290                                                     [% END %]
291
292                                                     [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
293                                                         <a class="custom_cover_image" href="[% ISSUE.biblio_object.custom_cover_image_url | url %]"><img alt="Cover image" src="[% ISSUE.biblio_object.custom_cover_image_url | url %]" /></a>
294                                                     [% END %]
295
296                                                     [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
297                                                         <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" />
298                                                     [% END %]
299
300                                                 </td>[% END # / IF JacketImages %]
301
302                                                 <td class="title">
303                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=ISSUE %]</a>
304                                                     [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %]
305
306                                                     [% IF ( ISSUE.onsite_checkout ) %] <em class="onsite_checkout">(On-site checkout)</em>[% END %]
307
308                                                     [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
309                                                         [% INCLUDE 'user-star-ratings.inc' item=ISSUE %]
310                                                     [% END %]
311                                                 </td>
312
313                                                 <td class="author">[% ISSUE.author | html %]</td>
314                                                 [% IF ( ISSUE.overdue ) %]
315                                                     <td class="date_due overdue">
316                                                         <span title="[% ISSUE.date_due | html %]">
317                                                             <span class="tdlabel">Date due:</span>
318                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
319                                                         </span>
320                                                     </td>
321                                                 [% ELSE %]
322                                                     <td class="date_due">
323                                                         <span title="[% ISSUE.date_due | html %]">
324                                                             <span class="tdlabel">Date due:</span>
325                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
326                                                         </span>
327                                                     </td>
328                                                 [% END %]
329                                                 [% UNLESS ( item_level_itypes ) %]
330                                                     <td class="itype">
331                                                         <span class="tdlabel">Item type:</span>
332                                                         [% IF ( ISSUE.imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
333                                                             <img src="[% ISSUE.imageurl | html %]" title="[% ISSUE.description | html %]" alt="[% ISSUE.description | html %]" />
334                                                         [% END %] [% ISSUE.description | html %]
335                                                     </td>
336                                                 [% END %]
337                                                 [% IF ( show_barcode ) %]
338                                                     <td class="barcode">
339                                                         <span class="tdlabel">Barcode:</span>
340                                                         [% ISSUE.barcode | html %]
341                                                     </td>
342                                                 [% END %]
343                                                 <td class="call_no">
344                                                     <span class="tdlabel">Call no.:</span>
345                                                     [% ISSUE.itemcallnumber | html %]
346                                                 </td>
347                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
348                                                     [% IF ( ISSUE.status && canrenew ) %]
349                                                         <td class="renew" data-order="[% ISSUE.renewsleft | html %]">
350                                                     [% ELSE %]
351                                                         <td class="renew" data-order="0">
352                                                     [% END %]
353                                                         [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
354                                                         [% IF ( ISSUE.status ) %]
355                                                             [% IF ( canrenew ) %]
356                                                                 <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>
357                                                             [% END %]
358                                                             [% IF ISSUE.renewalfee > 0 %]
359                                                                 <span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span>
360                                                             [% END %]
361                                                             [% IF ISSUE.itemtype_object.rentalcharge_daily > 0 %]
362                                                                 <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_daily | $Price %] per day</span>
363                                                             [% END %]
364                                                             [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
365                                                                 <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
366                                                             [% END %]
367                                                             <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
368                                                         [% ELSIF ( ISSUE.on_reserve ) %]
369                                                             Not renewable <span class="renewals">(on hold)</span>
370                                                         [% ELSIF ( ISSUE.too_many ) %]
371                                                             Not renewable
372                                                         [% ELSIF ( ISSUE.norenew_overdue ) %]
373                                                             Not allowed <span class="renewals">(overdue)</span>
374                                                         [% ELSIF ( ISSUE.auto_too_late ) %]
375                                                             No longer renewable
376                                                         [% ELSIF ISSUE.auto_too_much_oweing %]
377                                                             Automatic renewal failed, you have unpaid fines.
378                                                             <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
379                                                         [% ELSIF ISSUE.auto_account_expired %]
380                                                             Automatic renewal failed, your account is expired.
381                                                             <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
382                                                         [% ELSIF ( ISSUE.too_soon ) %]
383                                                             No renewal before [% ISSUE.soonestrenewdate | html %]
384                                                             <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
385                                                         [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
386                                                             Automatic renewal
387                                                             <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
388                                                         [% ELSIF ( ISSUE.item_denied_renewal ) %]
389                                                             Renewal not allowed
390                                                         [% END %]
391                                                     </td>
392                                                 [% END %]
393                                                 [% IF ( OPACFinesTab ) %]
394                                                     <td class="fines">
395                                                         <span class="tdlabel">Fines:</span>
396                                                         [% IF ( ISSUE.charges ) %]
397                                                             Yes (Item overdue or lost)
398                                                         [% ELSIF ( ISSUE.rentalfines ) %]
399                                                             Yes (Rental fees)
400                                                         [% ELSE %]
401                                                             No
402                                                         [% END %]
403                                                     </td>
404                                                 [% END %]
405                                                 [% IF ( OPACMySummaryHTML ) %]
406                                                     <td class="links">[% ISSUE.MySummaryHTML | $raw %]</td>
407                                                 [% END %]
408                                                 [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
409                                                     <td class="note">
410                                                         <input type="text" name="note" data-issue_id="[% ISSUE.issue_id | html %]" data-origvalue="[% ISSUE.note | html %]" value="[% ISSUE.note | html %]" readonly>
411                                                         <button type="button" class="btn btn-primary btn-sm js_submitnote" id="save_[% ISSUE.issue_id | html %]" style="display:none;">Submit note</button>
412                                                         <button type="button" class="btn btn-primary btn-sm nonjs_submitnote" href="/cgi-bin/koha/opac-issue-note.pl?issue_id=[% ISSUE.issue_id | url %]">Edit / Create note</button>
413                                                     </td>
414                                                 [% END %]
415                                             </tr>
416                                         [% END # /FOREACH ISSUES %]
417                                     </tbody>
418                                 </table>
419                                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
420                                     <input type="submit" class="btn btn-primary" value="Renew selected" />
421                                 [% END %]
422                                 </form>
423
424                                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
425                                 <form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post">
426                                     <input type="hidden" name="from" value="opac_user" />
427                                     <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
428                                     [% FOREACH ISSUE IN ISSUES %]
429                                         [% IF ISSUE.status %]
430                                             <input type="hidden" name="item" value="[% ISSUE.itemnumber | html %]" />
431                                         [% END %]
432                                     [% END %]
433                                     <input type="submit" class="btn btn-primary" value="Renew all" />
434                                 </form>
435                                 [% END %]
436                                 <p><a href="opac-ics.pl">Download as iCal/.ics file</a></p>
437                             [% ELSE %]
438                                 <table class="table table-bordered table-striped">
439                                     <tr><td>You have nothing checked out</td></tr>
440                                 </table>
441                             [% END # IF issues_count %]
442                         </div> <!-- / .opac-user-checkouts -->
443
444                         [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
445                             <div id="opac-user-clubs">
446                                 Loading...
447                             </div>
448                         [% END %]
449
450                         [% IF ( OPACFinesTab ) %]
451                             <!-- FINES BOX -->
452                             [% IF ( amountoutstanding > 0 ) %]
453                                 <div id="opac-user-fines"> <h3>Charges</h3>
454                                     <table class="table table-bordered table-striped">
455                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
456                                         <tbody>
457                                             <tr>
458                                                 <td>You currently owe fines and charges amounting to:</td>
459                                                 <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
460                                             </tr>
461                                         </tbody>
462                                     </table>
463                                 </div>
464                             [% END %]
465
466                             [% IF ( amountoutstanding < 0 ) %]
467                                 <div id="opac-user-fines">  <h3>Credits</h3>
468                                     <table class="table table-bordered table-striped">
469                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
470                                         <tbody>
471                                             <tr>
472                                                 <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding * -1 | $Price %]</a></td>
473                                             </tr>
474                                         </tbody>
475                                     </table>
476                                 </div>
477                             [% END %]
478
479                             [% IF relatives_with_fines %]
480                                <div id="opac-user-relative-fines"> <h3>Fines and charges</h3>
481                                     <table class="table table-bordered table-striped">
482                                         <thead>
483                                             <tr>
484                                                 <th colspan="2">Amount</th>
485                                             </tr>
486                                         </thead>
487                                         <tbody>
488                                             [% FOREACH r IN relatives_with_fines %]
489                                             <tr>
490                                                 <td>[% r.firstname | html %] [% r.surname | html %] currently owes fines and charges amounting to:</td>
491                                                 <td><a href="/cgi-bin/koha/opac-account.pl#g[% r.id | uri %]">[% r.account.balance | $Price %]</a></td>
492                                             </tr>
493                                             [% END %]
494                                         </tbody>
495                                     </table>
496                                 </div>
497                             [% END %]
498                         [% END # / OPACFinesTab %]
499
500                         [% IF relatives %]
501                             <div id="opac-user-relative-issues">
502                                 <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
503                                     <thead>
504                                         <tr>
505                                             <th class="anti-the">Title</th>
506                                             <th>Due</th>
507                                             <th>Barcode</th>
508                                             <th>Call no.</th>
509                                             <th class="psort">Relative</th>
510                                         </tr>
511                                     </thead>
512
513                                     <tbody>
514                                         [% FOREACH r IN relatives %]
515                                             [% FOREACH c IN r.checkouts %]
516                                                 <tr>
517                                                     <td>
518                                                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% c.item.biblio.biblionumber | uri %]">
519                                                             [% c.item.biblio.title | html %][% IF ( c.item.enumchron ) %] [% c.item.enumchron | html %][% END %]
520                                                         </a>
521                                                     </td>
522
523                                                     <td>
524                                                         [% c.date_due | $KohaDates %]
525                                                     </td>
526
527                                                     <td>
528                                                         [% c.item.barcode | html %]
529                                                     </td>
530
531                                                     <td>
532                                                         [% c.item.itemcallnumber | html %]
533                                                     </td>
534
535                                                     <td>
536                                                         [% r.firstname | html %] [% r.surname | html %]
537                                                     </td>
538                                                 </tr>
539                                             [% END %]
540                                         [% END %]
541                                     </tbody>
542                                 </table>
543                             </div>
544                         [% END %]
545
546                         [% IF ( overdues_count ) %]
547                             <div id="opac-user-overdues">
548                                 <table id="overduest" class="table table-bordered table-striped">
549                                     <caption>Overdues <span class="count">([% overdues_count | html %] total)</span></caption>
550                                     <!-- OVERDUES TABLE ROWS -->
551                                     <thead>
552                                         <tr>
553                                             [% IF ( JacketImages || AdlibrisEnabled ) %]<th class="nosort">&nbsp;</th>[% END %]
554                                             <th class="anti-the">Title</th>
555                                             [% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
556                                             [% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
557                                             <th>Call no.</th>
558                                             <th class="title-string psort">Due</th>
559                                             [% IF ( OpacRenewalAllowed ) %]
560                                                 <th class="nosort">Renew</th>
561                                             [% END %]
562                                             [% IF ( OPACFinesTab ) %]
563                                                 <th>Fines</th>
564                                             [% END %]
565                                         </tr>
566                                     </thead>
567                                     <tbody>
568                                         [% FOREACH OVERDUE IN OVERDUES %]
569                                             <tr>
570                                                 [% IF ( JacketImages || AdlibrisEnabled ) %]
571                                                     <td class="jacketcell">
572                                                     [% IF ( AdlibrisEnabled && OVERDUE.normalized_isbn ) %]
573                                                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% OVERDUE.biblionumber | uri %]"><img src="[% AdlibrisURL | url %]?isbn=[% OVERDUE.normalized_isbn | uri %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
574                                                     [% END %]
575                                                     [% IF ( OPACAmazonCoverImages ) %]
576                                                         [% IF ( OVERDUE.normalized_isbn ) %]
577                                                             <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>
578                                                         [% ELSE %]
579                                                             <a href="#"><span class="no-image">No cover image available</span></a>
580                                                         [% END %]
581                                                     [% END %]
582
583                                                     [% IF ( GoogleJackets ) %]
584                                                         [% IF ( OVERDUE.normalized_isbn ) %]
585                                                             <div style="display:block;" title="Click to view in Google Books" class="[% OVERDUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
586                                                         [% ELSE %]
587                                                             <a href="http://books.google.com/books?q=[% OVERDUE.title |url %]"><span class="no-image">No cover image available</span></a>
588                                                         [% END %]
589                                                     [% END %]
590
591                                                     [% IF ( BakerTaylorEnabled ) %]
592                                                         [% bt_id = ( OVERDUE.normalized_upc || OVERDUE.normalized_isbn ) %]
593                                                         [% IF ( bt_id ) %]
594                                                             <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
595                                                         [% ELSE %]
596                                                             <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
597                                                         [% END %]
598                                                     [% END %]
599
600                                                     [% IF ( SyndeticsCoverImages ) %]
601                                                         <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" />
602                                                     [% END %]
603                                                     </td>
604                                                 [% END # /IF jacketcell %]
605
606                                                 <td>
607                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?bib=[% OVERDUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=OVERDUE %]</a>
608                                                     <span class="item-details">[% OVERDUE.author | html %]</span>
609                                                 </td>
610
611                                                 [% UNLESS ( item_level_itypes ) %]
612                                                     <td>
613                                                         [% IF ( OVERDUE.imageurl  && !Koha.Preference('OpacNoItemTypeImages') ) %]
614                                                             <img src="[% OVERDUE.imageurl | html %]" title="[% OVERDUE.description | html %]" alt="[% OVERDUE.description | html %]" />
615                                                         [% END %] [% OVERDUE.description | html %]
616                                                     </td>
617                                                 [% END %]
618                                                 [% IF ( show_barcode ) %]
619                                                     <td>
620                                                         <span class="tdlabel">Barcode:</span>
621                                                         [% OVERDUE.barcode | html %]
622                                                     </td>
623                                                 [% END %]
624                                                 <td>
625                                                     <span class="tdlabel">Call no.:</span>
626                                                     [% OVERDUE.itemcallnumber | html %]
627                                                 </td>
628                                                 <td>
629                                                     <span title="[% OVERDUE.date_due | html %]">
630                                                         <span class="tdlabel">Date due:</span>
631                                                         [% OVERDUE.date_due | $KohaDates  as_due_date => 1 %]
632                                                     </span>
633                                                 </td>
634                                                 [% IF ( OpacRenewalAllowed ) %]
635                                                     <td>
636                                                         [% IF ( OVERDUE.debarred ) %]
637                                                             Account frozen
638                                                         [% ELSIF ( OVERDUE.status ) %]
639                                                             [% IF ( canrenew ) %]
640                                                                 <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
641                                                             [% END %]
642                                                                 <span class="renewals">([% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining)</span>
643                                                         [% ELSIF ( OVERDUE.norenew_overdue ) %]
644                                                             Not allowed<span class="renewals">(overdue)</span>
645                                                         [% ELSIF ( OVERDUE.onreserve ) %]
646                                                             On hold
647                                                         [% ELSE %]
648                                                             No renewals left
649                                                         [% END %]
650                                                     </td>
651                                                 [% END %]
652                                                 [% IF ( OPACFinesTab ) %]
653                                                     <td>
654                                                         <span class="tdlabel">Fines:</span>
655                                                         [% IF ( OVERDUE.charges ) %]
656                                                             Yes
657                                                         [% ELSE %]
658                                                             No
659                                                         [% END %]
660                                                     </td>
661                                                 [% END %]
662                                             </tr>
663                                         [% END %]
664                                     </tbody>
665                                 </table>
666                             </div> <!-- / #opac-user-overdues -->
667                         [% END # /overdues_count %]
668
669                         [% PROCESS 'holds-table.inc' HOLDS = RESERVES, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds %]
670
671                         [% IF Koha.Preference('ArticleRequests') %]
672                             <div id="opac-user-article-requests">
673                                 [% IF logged_in_user.article_requests_current.count %]
674                                     <table id="article-requests-table" class="table table-bordered table-striped">
675                                         <caption>Article requests <span class="count">([% logged_in_user.article_requests_current.count | html %] total)</span></caption>
676                                         <thead>
677                                             <tr>
678                                                 <th class="anti-the article-request-record-title">Record title</th>
679                                                 <th class="psort article-request-created-on">Placed on</th>
680                                                 <th class="anti-the article-request-title">Title</th>
681                                                 <th class="article-request-author">Author</th>
682                                                 <th class="article-request-volume">Volume</th>
683                                                 <th class="article-request-issue">Issue</th>
684                                                 <th class="article-request-date">Date</th>
685                                                 <th class="article-request-pages">Pages</th>
686                                                 <th class="article-request-chapters">Chapters</th>
687                                                 <th class="article-request-patron-notes">Notes</th>
688                                                 <th class="article-request-status">Status</th>
689                                                 <th class="article-request-branchcode">Pickup library</th>
690                                                 <th class="nosort article-request-cancel">&nbsp;</th>
691                                             </tr>
692                                         </thead>
693
694                                         <tbody>
695                                         [% FOREACH ar IN logged_in_user.article_requests_current %]
696                                                 <td class="article-request-record-title">
697                                                     <a class="article-request-title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ar.biblionumber | html %]">
698                                                         [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
699                                                         [% ar.item.enumchron | html %]
700                                                     </a>
701                                                     [% ar.biblio.author | html %]
702                                                     [% IF ar.itemnumber %] <em>(only [% ar.item.barcode | html %])</em>[% END %]
703                                                 </td>
704
705                                                 <td class="article-request-created_on">
706                                                     [% ar.created_on | $KohaDates %]
707                                                 </td>
708
709                                                 <td class="article-request-title">
710                                                     [% ar.title | html %]
711                                                 </td>
712
713                                                 <td class="article-request-author">
714                                                     [% ar.author | html %]
715                                                 </td>
716
717                                                 <td class="article-request-volume">
718                                                     [% ar.volume | html %]
719                                                 </td>
720
721                                                 <td class="article-request-issue">
722                                                     [% ar.issue | html %]
723                                                 </td>
724
725                                                 <td class="article-request-date">
726                                                     [% ar.date | html %]
727                                                 </td>
728
729                                                 <td class="article-request-pages">
730                                                     [% ar.pages | html %]
731                                                 </td>
732
733                                                 <td class="article-request-chapters">
734                                                     [% ar.chapters | html %]
735                                                 </td>
736
737                                                 <td class="article-request-patron-notes">
738                                                     [% ar.patron_notes | html %]
739                                                 </td>
740
741                                                 <td class="article-request-status">
742                                                     [% IF ar.status == 'PENDING' %]
743                                                         Pending
744                                                     [% ELSIF ar.status == 'PROCESSING' %]
745                                                         Processing
746                                                     [% ELSIF ar.status == 'COMPLETED' %]
747                                                         Completed
748                                                     [% ELSIF ar.status == 'CANCELED' %]
749                                                         Canceled
750                                                     [% END %]
751                                                 </td>
752
753                                                 <td class="article-request-branchcode">
754                                                     [% ar.branch.branchname | html %]
755                                                 </td>
756
757                                                 <td class="article-request-cancel">
758                                                     <span class="tdlabel">Cancel:</span>
759                                                     <form action="/cgi-bin/koha/opac-article-request-cancel.pl" id="delete_article_request_[% ar.id | html %]">
760                                                         <input type="hidden" name="id" value="[% ar.id | html %]" />
761                                                         <button data-title="[% ar.biblio.title | html %] [% ar.item.enumchron | html %]" data-article-request_id="[% ar.id | html %]" type="submit" class="btn btn-sm btn-danger btn-delete-article-request"><i class="fa fa-remove" aria-hidden="true"></i> Cancel</button>
762                                                     </form>
763                                                 </td>
764                                             </tr>
765                                         [% END %]
766                                     </tbody>
767                                 </table>
768                             [% ELSE %]
769                                 <table class="table table-bordered table-striped">
770                                     <tr><td>You have no article requests currently.</td></tr>
771                                 </table>
772                             [% END # IF article_requests_current.count %]
773                         </div> <!-- / #opac-user-article-requests -->
774                     [% END %]
775
776                     </div> <!-- /#opac-user-views -->
777                 </div> <!-- /#userdetails -->
778             </div> <!-- /.col-10 -->
779         </div> <!-- /.row -->
780     </div> <!-- /.container-fluid -->
781 </div> <!-- /#main -->
782
783 [% IF ( OverDriveCirculation ) %]
784     [% INCLUDE 'overdrive-checkout.inc' %]
785     [% IF ( Koha.Preference('OverDrivePasswordRequired') ) %]
786         [% INCLUDE 'overdrive-login.inc' %]
787     [% END %]
788 [% END %]
789 [% IF ( RecordedBooksCirculation ) %]
790 [% INCLUDE 'recordedbooks-checkout.inc' %]
791 [% END %]
792
793 [% INCLUDE 'opac-bottom.inc' %]
794 [% BLOCK jsinclude %]
795     [% INCLUDE 'calendar.inc' %]
796     [% INCLUDE 'datatables.inc' %]
797     <script>
798
799         $(document).ready(function(){
800             $('#opac-user-views').tabs();
801             $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
802             $(".suspend-until").prop("readonly",1);
803
804             $(".btn-delete-hold").on("click", function(e){
805                 e.preventDefault();
806                 var hold_title = $(this).data("title");
807                 var reserve_id = $(this).data("reserve_id");
808                 confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){
809                         if( result ){
810                             $("#delete_hold_" + reserve_id ).submit();
811                         }
812                     }
813                 );
814             });
815
816             $(".btn-delete-article-request").on("click", function(e){
817                 e.preventDefault();
818                 var article_request = $(this).data("title");
819                 var article_request_id = $(this).data("article-request_id");
820                 confirmModal( article_request, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), function( result ){
821                         if( result ){
822                             $("#delete_article_request_" + article_request_id ).submit();
823                         }
824                     }
825                 );
826             });
827
828             $("#suspend_all_submit").on("click", function(e){
829                 e.preventDefault();
830                 var title = _("Are you sure you want to suspend all holds?");
831                 var body = _("All holds will be suspended.");
832                 confirmModal( body, title, _("Yes, suspend all holds"), "", function( result ){
833                         if( result ){
834                             $("#suspend_all_holds").submit();
835                         }
836                     }
837                 );
838             });
839
840             $("#resume_all_submit").on("click", function(e){
841                 e.preventDefault();
842                 var title = _("Are you sure you want to resume all suspended holds?");
843                 var body = _("All holds will resume.");
844                 confirmModal( body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function( result ){
845                         if( result ){
846                             $("#resume_all_holds").submit();
847                         }
848                     }
849                 );
850             });
851
852             var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
853             dTables.each(function(){
854                 var thIndex = $(this).find("th.psort").index();
855                 $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
856                     "sorting" : [[ thIndex, 'asc' ]],
857                     "columnDefs": [
858                         { "targets": [ "nosort" ],"sortable": false,"searchable": false },
859                         { "type": "anti-the", "targets" : [ "anti-the" ] },
860                         { "type": "title-string", "targets" : [ "title-string" ] }
861                     ]
862                 }));
863             });
864
865             [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
866             [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
867                 $("#renewselected").submit(function(){
868                     valid = false;
869                     $("input[type=checkbox]").each(function(){
870                         if($(this).is(':checked')){
871                             valid = true;
872                         }
873                     });
874                     if(!valid){
875                         alert(_("Nothing has been selected. Check the box for each item you want to renew"));
876                     }
877                     return valid;
878                 });
879                 $("body").on("click","#renewselected_link",function(e){
880                     e.preventDefault();
881                     $("#renewselected").submit();
882                 });
883                 $("body").on("click","#renewall_link",function(e){
884                     e.preventDefault();
885                     $("#renewall").submit();
886                 });
887                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
888                     $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" class=\"btn btn-link\" href=\"#\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> "+_("Renew selected")+"</a> <a id=\"renewall_link\" class=\"btn btn-link\" href=\"#\"><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")+"</a></div>");
889                 [% END %]
890             [% END %]
891
892             [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
893
894                 /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
895                 $(".nonjs_submitnote").hide();
896
897                 $("input[name='note']").prop('readonly', false);
898                 $("input[name='note']").keypress(function(e){
899                     /* prevent submitting of renewselected form */
900                     if(e.which == 13)
901                         e.preventDefault();
902                 });
903
904                 $("input[name='note']").keyup(function(e){
905                     var $btn_save = $('#save_'+$(this).data('issue_id'));
906                     var origvalue = $(this).data('origvalue');
907                     var value = $(this).val();
908
909                     if(origvalue != value) {
910                         if(origvalue != "")
911                             $btn_save.text(_("Submit changes"));
912                         else
913                             $btn_save.text(_("Submit note"));
914                         $btn_save.show();
915                     } else {
916                         $btn_save.hide();
917                     }
918                 });
919
920                 $(".js_submitnote").click(function(e){
921                     var $self = $(this);
922                     var title = $(this).parent().siblings('.title').html();
923                     var $noteinput = $(this).siblings('input[name="note"]').first();
924
925                     var ajaxData = {
926                         'action': 'issuenote',
927                         'issue_id': $noteinput.data('issue_id'),
928                         'note': $noteinput.val(),
929                     };
930
931                     $.ajax({
932                         url: '/cgi-bin/koha/svc/checkout_notes/',
933                         type: 'POST',
934                         dataType: 'json',
935                         data: ajaxData,
936                     })
937                     .done(function(data) {
938                         var message = "";
939                         if(data.status == 'saved') {
940                             $("#notesaved").removeClass("alert-error");
941                             $("#notesaved").addClass("alert-info");
942                             $noteinput.data('origvalue', data.note);
943                             $noteinput.val(data.note);
944                             message = "<p>" + _("Your note about %s has been saved and sent to the library.").format(title) + "</p>";
945                             message += "<p style=\"font-style:italic;\">" + data.note + "</p>";
946                             $self.hide();
947                         } else if(data.status == 'removed') {
948                             $("#notesaved").removeClass("alert-error");
949                             $("#notesaved").addClass("alert-info");
950                             $noteinput.data('origvalue', "");
951                             $noteinput.val("");
952                             message = "<p>" + _("Your note about %s was removed.").format(title) + "</p>";
953                             $self.hide();
954                         } else {
955                             $("#notesaved").removeClass("alert-info");
956                             $("#notesaved").addClass("alert-error");
957                             message =  "<p>" + _("Your note about %s could not be saved.").format(title) + "</p>";
958                             message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
959                         }
960                         $("#notesaved").html(message);
961                     })
962                     .fail(function(data) {
963                         $("#notesaved").removeClass("alert-info");
964                         $("#notesaved").addClass("alert-error");
965                         var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
966                         $("#notesaved").html(message);
967                     })
968                     .always(function() {
969                         $("#notesaved").show();
970                     });
971                 });
972             [% END %]
973
974             $(".suspend-until").datepicker({
975                 beforeShow: function(input, inst) {
976                     // https://stackoverflow.com/questions/662220/how-to-change-the-pop-up-position-of-the-jquery-datepicker-control#answer-10598178
977                     var calendar = inst.dpDiv;
978                     setTimeout(function() {
979                         calendar.position({
980                             my: 'left top',
981                             at: 'left bottom',
982                             collision: 'none',
983                             of: input
984                         });
985                     }, 1);
986                 },
987                 minDate: 1
988             });
989
990             if ( $('#opac-user-clubs').length ) {
991                 $('#opac-user-clubs-tab-link').on('click', function() {
992                     $('#opac-user-clubs').text(_("Loading..."));
993                     $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
994                 });
995             }
996         });
997
998         var borrowernumber = "[% borrowernumber | html %]";
999         var MSG_YOUR_RATING = _("Your rating: %s, ");
1000         var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)");
1001     </script>
1002     [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
1003         [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1004         [% Asset.js("js/ratings.js") | $raw %]
1005     [% END %]
1006     [% IF Koha.Preference('OverDriveCirculation') %]
1007     [% Asset.js("js/overdrive.js") | $raw %]
1008     <script>
1009     var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %];
1010     $(document).ready(function() {
1011         [% IF ( overdrive_error ) %]
1012             KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]");
1013         [% END %]
1014
1015         [% IF ( overdrive_tab ) %]
1016             $("#opac-user-views").tabs("select", "#opac-user-overdrive");
1017         [% END %]
1018
1019         $("#opac-user-overdrive").each( function() {
1020             KOHA.OverDriveCirculation.display_account_details(this);
1021         } );
1022     });
1023     </script>
1024     [% END %]
1025     [% IF RecordedBooksCirculation %]
1026         [% Asset.js("js/recordedbooks.js") | $raw %]
1027         <script>
1028             $(document).ready(function() {
1029                 [% IF ( recordedbooks_error ) %]
1030                     KOHA.RecordedBooks.display_error("#opac-user-recordedbooks", "[% recordedbooks_error.dquote | html %]");
1031                 [% END %]
1032                 [% IF ( recordedbooks_tab ) %]
1033                     $("#opac-user-views").tabs("select", "#opac-user-recordedbooks");
1034                 [% END %]
1035                 $("#opac-user-recordedbooks").each( function() {
1036                     KOHA.RecordedBooks.display_account_details(this);
1037                 } );
1038             });
1039         </script>
1040     [% END %]
1041 [% END %]