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