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