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