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