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