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