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