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