Bug 32721: (QA follow up) - fix QA issues
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sco / sco-main.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE AudioAlerts %]
6 [% USE To %]
7 [% USE Price %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Self checkout &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %]</title>
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 <meta name="generator" content="Koha [% Version | html %]" /> <!-- leave this for stats -->
12 [% IF ( Koha.Preference('OpacFavicon') ) %]
13 <link rel="shortcut icon" href="[% Koha.Preference('OpacFavicon') | url %]" type="image/x-icon" />
14 [% ELSE %]
15 <link rel="shortcut icon" href="[% interface | html %]/[% theme | html %]/images/favicon.ico" type="image/x-icon" />
16 [% END %]
17 [% Asset.css("lib/fontawesome/css/fontawesome.min.css") | $raw %]
18 [% Asset.css("lib/fontawesome/css/brands.min.css") | $raw %]
19 [% Asset.css("lib/fontawesome/css/solid.min.css") | $raw %]
20 [% IF ( bidi ) %]
21     [% Asset.css("css/sco-rtl.css") | $raw %]
22 [% ELSE %]
23     [% Asset.css("css/sco.css") | $raw %]
24 [% END %]
25 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
26 [% IF Branches.GetBranchSpecificCSS( Branches.GetLoggedInBranchcode() || default_branch) %]
27     <style>
28         [% Branches.GetBranchSpecificCSS( Branches.GetLoggedInBranchcode() || default_branch) | $raw %]
29     </style>
30 [% END %]
31 [% IF ( Koha.Preference('SCOUserCSS') ) %]<style>[% Koha.Preference('SCOUserCSS') | $raw %]</style>[% END %]
32 <script>
33     var Koha = {};
34     function _(s) { return s } // dummy function for gettext
35 </script>
36 [% IF lang && lang != 'en' %]
37     [% Asset.js(lang _ '/js/locale_data.js') | $raw %]
38 [% END %]
39 [% Asset.js('js/Gettext.js') | $raw %]
40 [% Asset.js('js/i18n.js') | $raw %]
41 </head>
42 <body id="sco_main" class="sco" onload="dofocus();" onunload="mungeHistory();">
43     [% INCLUDE 'masthead-sco.inc' %]
44
45     <div class="main">
46         <div class="container-fluid">
47             <div class="row">
48                 [% IF ( display_patron_image ) %]
49                     <div class="col-10 order-first order-md-first order-lg-2">
50                 [% ELSE %]
51                     <div class="col order-first order-md-first order-lg-2">
52                 [% END %]
53
54                     <div id="masthead"><h1>[% LibraryName | html %] Self checkout system</h1></div>
55
56                     [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
57                         <div class="alert alert-warning">
58                             <span class="sco-alert-warning noissue"></span>
59                             <h2>Item cannot be checked out.</h2>
60                             <p>Sorry, this item cannot be checked out at this station.</p>
61                             [% IF ( title ) %]
62                                 <p>Title: <em>[% title | html %]</em> </p>
63                             [% END %]
64
65                             <p>
66                                 [% IF ( circ_error_UNKNOWN_BARCODE ) %]
67                                     <span id="ce_unknown_barcode">The system does not recognize this barcode.</span>
68                                 [% ELSIF ( circ_error_max_loans_allowed ) %]
69                                     <span id="ce_max_loans_allowed">You have reached the maximum limit of items checked out.</span>
70                                 [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
71                                     <span id="ce_issued_to_another">This item is checked out to someone else.</span>
72                                 [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
73                                     <span id="ce_no_more_renewals">You cannot renew this item again.</span>
74                                 [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
75                                     <span id="ce_not_for_loan">This item is not for loan.</span>
76                                 [% ELSIF ( circ_error_DEBT ) %]
77                                     <span id="ce_too_much_debt">You owe the library [% DEBT | $Price with_symbol => 1%] and cannot check out.</span>
78                                 [% ELSIF ( circ_error_WTHDRAWN ) %]
79                                     <span id="ce_wthdrawn">This item has been withdrawn from the collection.</span>
80                                 [% ELSIF ( circ_error_RESTRICTED ) %]
81                                     <span id="ce_restricted">This item is restricted.</span>
82                                 [% ELSIF ( circ_error_RESERVED ) %]
83                                     <span id="ce_reserved">This item is on hold for another patron.</span>
84                                 [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
85                                     <span id="ce_itemnotsamebranch">This item belongs to another library.</span>
86                                 [% ELSIF ( circ_error_EXPIRED ) %]
87                                     <span id="ce_expired">Your account has expired.</span>
88                                 [% ELSIF ( circ_error_DEBARRED ) %]
89                                     <span id="ce_debarred">Your account has been suspended.</span>
90                                 [% ELSIF ( circ_error_CARD_LOST ) %]
91                                     <span id="ce_card_lost">This library card has been declared lost.</span>
92                                 [% ELSIF ( circ_error_GNA ) %]
93                                     <span id="ce_gna">Your contact information seems to be incomplete.</span>
94                                 [% ELSIF ( circ_error_INVALID_DATE ) %]
95                                     <span id="ce_invalid_date">Due date is not valid.</span>
96                                 [% ELSIF ( circ_error_ADDITIONAL_MATERIALS ) %]
97                                     <span id="ce_addtional_materials">Item must be checked out at a circulation desk.</span>
98                                 [% END %]
99                                 <span id ="ce_see_staff">Please see a member of the library staff.</span>
100                             </p>
101
102                             [% IF ( returnitem && Koha.Preference('SCOAllowCheckin') ) %]
103                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
104                                     <legend class="sr-only">Return</legend>
105                                     <input type="hidden" name="op" value="returnbook" />
106                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
107                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
108                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
109                                     <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
110                                 </form>
111                             [% END %]
112
113                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
114                                 <legend class="sr-only">Error</legend>
115                                 <input type="hidden" name="op" value="" />
116                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
117                                 <input type="hidden" name="barcode" value="[% barcode | html %]" />
118                                 <input type="hidden" name="newissues" value="[% newissues | html %]" />
119                                 <input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
120                             </form>
121                         </div> <!-- / .alert -->
122                     [% END # / IF ( impossible %]
123
124                     [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
125                         <div class="alert alert-warning"><h2>Please confirm the checkout:</h2>
126                             <span class="sco-alert-warning confirm"></span>
127                             [% IF ( confirm_renew_issue ) %]
128                                 <p>This item is already checked out to you.</p>
129                             [% END %]
130
131                             [% IF ( renew && Koha.Preference('SCOAllowCheckin') ) %]
132                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
133                                     <legend class="sr-only">Return</legend>
134                                     <input type="hidden" name="op" value="returnbook" />
135                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
136                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
137                                     <input type="hidden" name="confirmed" value="" />
138                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
139                                     <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
140                                 </form>
141                             [% END %]
142
143                             [% UNLESS ( renew ) %]
144                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
145                                     <legend class="sr-only">Renew</legend>
146                                     <input type="hidden" name="op" value="renew" />
147                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
148                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
149                                     <input type="hidden" name="confirmed" value="1" />
150                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
151                                     <button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
152                                   </form>
153                             [% ELSE %]
154                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
155                                     <legend class="sr-only">Renew</legend>
156                                     <input type="hidden" name="op" value="renew" />
157                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
158                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
159                                     <input type="hidden" name="confirmed" value="1" />
160                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
161                                     <button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
162                                 </form>
163                             [% END %]
164
165                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
166                                 <legend class="sr-only">Cancel</legend>
167                                 <input type="hidden" name="op" value="" />
168                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
169                                 <input type="hidden" name="newissues" value="[% newissues | html %]" />
170                                 <button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
171                             </form>
172                         </div>
173                     [% END # / IF confirm %]
174
175                     [% IF ( nopermission ) %]
176                         <!-- This is what is displayed if user doesn't have permission -->
177                         <div class="alert alert-warning">
178                             <span class="sco-alert-warning nopermission"></span>
179                             <h2>Access denied</h2>
180                             <p>Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem.</p>
181                         </div>
182                     [% END %]
183
184                     [% IF ( different_ip ) %]
185                         <!-- This is what is displayed if user doesn't have permission -->
186                         <div class="alert alert-warning">
187                             <span class="sco-alert-warning sessionlost"></span>
188                             <h2>Session lost</h2>
189                             <p>You are accessing self-checkout from a different IP address! please log in again.</p>
190                         </div>
191                     [% END %]
192
193                     [% IF ( invalid_username_or_password ) %]
194                         <!-- This is what is displayed if user doesn't have permission -->
195                         <div class="alert alert-warning">
196                             <span class="sco-alert-warning notfound"></span>
197                             <h2>Record not found</h2>
198                             <p>Your userid was not found in the database.  Please try again.</p>
199                         </div>
200                     [% END %]
201
202                     [% IF ( issued ) %]
203                         <span class="sco-alert-success issue"></span>
204                         <div class="alert alert-info">
205                             <p>Item checked out</p>
206                         </div>
207                     [% ELSIF ( renewed ) %]
208                         <span class="sco-alert-success renew"></span>
209                         <div class="alert alert-info">
210                             <p>Item renewed</p>
211                         </div>
212                     [% ELSIF ( renewed == 0) %]
213                         <span class="sco-alert-warning renew"></span>
214                         <div class="alert alert-info">
215                             <p>Item not renewed</p>
216                         </div>
217                     [% ELSIF ( returned == 0 ) %]
218                         <span class="sco-alert-warning return"></span>
219                         <div class="alert alert-info">
220                             <p>Item not checked in: please see circulation staff for assistance</p>
221                         </div>
222                     [% ELSIF ( returned == 1 ) %]
223                         <span class="sco-alert-success return"></span>
224                         <div class="alert alert-info">
225                             <p>Item checked in</p>
226                         </div>
227                     [% END %]
228
229
230                     [% UNLESS ( hide_main ) %]
231
232                         [% IF ( patronid ) %]
233                             [% IF ( validuser ) %]
234                                 <div class="alert alert-info">You are logged in as [% borrowername | html %].</div>
235                                 [% INCLUDE 'opac-note.inc' %]
236                                 [% IF patron_has_hold_fee %]
237                                     <div class="alert alert-warning">A hold fee was charged to your account for collecting this item.</div>
238                                 [% END %]
239                             [% END %]
240
241                             [% IF ( nouser ) %]
242                                 <div class="alert alert-warning">
243                                     <h3>Sorry</h3>
244                                     <p>The userid <strong>[% patronid | html %]</strong> was not found in the database.  Please try again.</p>
245                                 </div>
246                             [% END %]
247                         [% END # / IF patronid %]
248
249                         [% IF ( validuser ) %]
250                             <div id="newcheckout" class="sco_entry">
251                                 <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid | html %]');">
252                                     <legend><h2>
253                                         [% IF ( Koha.Preference('SCOAllowCheckin') ) %]
254                                             <span>Check out, return, or renew an item:</span>
255                                         [% ELSE %]
256                                             <span>Check out or renew an item:</span>
257                                         [% END %]
258                                         </h2></legend>
259                                     <div class="row">
260                                         <div class="col">
261                                             <label for="barcode">Scan a new item or enter its barcode:</label>
262                                         </div>
263                                         <div class="col-3">
264                                             <input id="barcode" name="barcode" size="20" type="text" class="focus form-control" autocomplete="off" />
265                                         </div>
266                                         <div class="col-auto">
267                                             <button type="submit" class="btn btn-primary">Submit</button>
268                                         </div>
269                                         <div class="col ml-auto">
270                                             <button type="button" id="logout_form" class="btn btn-info"><i class="fa fa-check" aria-hidden="true"></i> Finish</button>
271                                             <input type="hidden" name="op" value="checkout" />
272                                             <input type="hidden" name="patronid" value="[% patronid | html %]" />
273                                             <input type="hidden" name="newissues" value="[% newissues | html %]" />
274                                         </div>
275                                     </div> <!-- /.row -->
276                                 </form> <!-- /#scan_form -->
277                             </div> <!-- / #newcheckout -->
278                 </div> <!-- / .span12/12 -->
279                 [% IF ( display_patron_image ) %]
280                     <div class="col-lg-2">
281                         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?borrowernumber=[% borrowernumber | uri %]&csrf_token=[% csrf_token | uri %]" alt="" />
282                     </div>
283                 [% END %]
284             </div> <!-- / .row -->
285         </div> <!-- / .container-fluid -->
286
287         <div class="container-fluid">
288             <div class="row">
289                 <div class="col order-first order-md-first order-lg-2">
290                     <ul class="nav nav-tabs" role="tablist">
291                         <li class="nav-item" role="presentation">
292                             <a class="nav-link active" href="#checkouts-tab" id="checkouts" aria-controls="home" aria-selected="true" data-toggle="tab">Checkouts ([% issues_count | html %])</a>
293                         </li>
294                         <li class="nav-item" role="presentation">
295                             <a class="nav-link" href="#holds-tab" id="holds" aria-controls="home" aria-selected="false" data-toggle="tab">
296                                 [% IF waiting_holds_count %]
297                                     <i class="fa fa-exclamation" aria-hidden="true"></i>
298                                 [% END %]
299                                 Holds ([% HOLDS.count | html %])
300                             </a>
301                         </li>
302                         <li class="nav-item" role="presentation">
303                             <a class="nav-link" href="#account-tab" id="account" aria-controls="home" aria-selected="false" data-toggle="tab">Charges ([% total | $Price %])</a>
304                         </li>
305                     </ul>
306                     <div class="tab-content">
307                         <div id="checkouts-tab" class="tab-pane show active" aria-labelledby="checkouts">
308                             <div id="borrowerdetails">
309                                 [% IF ( issues_count ) %]
310                                     <table id="loanTable" class="table table-bordered table-striped">
311                                         <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption>
312                                         <!-- ISSUES TABLE ROWS -->
313                                         <thead>
314                                             <tr>
315                                                 <th class="noshow">Checked out on</th>
316                                                 <th class="anti-the">Title</th>
317                                                 <th>Call number</th>
318                                                 <th>Due</th>
319                                                 <th class="nosort">Renew</th>
320                                                 [% UNLESS ( nofines ) %]
321                                                     <th>Fines</th>
322                                                 [% END %]
323                                             </tr>
324                                         </thead>
325                                         <tbody>
326                                             [% FOREACH ISSUE IN ISSUES %]
327                                                 <tr>
328                                                     <td>[% ISSUE.issuedate | html %]</td>
329                                                     <td>
330                                                         [% UNLESS ( noitemlinks ) %]
331                                                             <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.  biblionumber | uri %]">[% ISSUE.title | html %]</a>
332                                                         [% ELSE %]
333                                                             <strong>[% ISSUE.title | html %]</strong>
334                                                         [% END %]
335                                                         [% IF ( newissues.match(ISSUE.barcode)) %]
336                                                             <span class="label label-info">NEW</span>
337                                                         [% END %]
338                                                         <span class="item-details">[% ISSUE.author | html %]</span>
339                                                         ([% ISSUE.barcode | html %])
340                                                     </td>
341                                                     <td>[% ISSUE.itemcallnumber | html %]</td>
342                                                     [% IF ( ISSUE.overdue ) %]
343                                                         <td class="overdue" data-order="[% ISSUE.date_due | html %]">
344                                                             [% ISSUE.date_due | $KohaDates as_due_date => 1 %]
345                                                         </td>
346                                                     [% ELSE   %]
347                                                         <td data-order="[% ISSUE.date_due | html %]">
348                                                             [% ISSUE.date_due | $KohaDates as_due_date => 1 %]
349                                                         </td>
350                                                     [% END %]
351                                                     <td>
352                                                         <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
353                                                             <legend class="sr-only">Issue renews</legend>
354                                                             <input type="hidden" name="patronid" value="[% patronid | html %]" />
355                                                             <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
356                                                             <input type="hidden" name="newissues" value="[% newissues | html %]" />
357                                                             [% IF ISSUE.can_be_renewed %]
358                                                                 <input type="hidden" name="op" value="renew" />
359                                                                 <input type="hidden" name="confirmed" value="1" />
360                                                                 [% UNLESS ( ISSUE.renew ) %]
361                                                                     <input type="submit" value="Renew item"  name="confirm  " class="btn btn-primary btn-sm renew" />
362                                                                 [% ELSE %]
363                                                                     <input type="submit" value="Renew item" class="btn btn-primary btn-sm renew" />
364                                                                 [% END %]
365                                                             [% ELSE %]
366                                                                 [% IF ISSUE.renew_error == 'auto_renew' OR ISSUE.renew_error == 'auto_too_soon' %]
367                                                                     <span>This item has been scheduled for automatic renewal and cannot be renewed</span>
368                                                                 [% ELSIF ISSUE.renew_error == 'onsite_checkout' %]
369                                                                     <span>This is a on-site checkout, it cannot be renewed.</span>
370                                                                 [% ELSIF ISSUE.renew_error == 'too_unseen' %]
371                                                                     <span>You have renewed this item the maximum number of consecutive times without it being seen by the library.</span>
372                                                                 [% ELSIF ISSUE.renew_error == 'too_soon' %]
373                                                                     <span>This item cannot yet be renewed.</span>
374                                                                 [% ELSE %]
375                                                                     <span>No renewals allowed</span>
376                                                                 [% END %]
377                                                                 [% IF Koha.Preference('SCOAllowCheckin') %]
378                                                                     <input type="submit" value="Check in item" name="confirm" class="btn btn-info btn-sm return" />
379                                                                     <input type="hidden" name="op" value="returnbook" />
380                                                                     <input type="hidden" name="confirmed" value=""  />
381                                                                 [% END %]
382                                                             [% END %]
383                                                         </form>
384                                                     </td>
385                                                     [% UNLESS ( nofines ) %]
386                                                         <td>
387                                                             [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]
388                                                         </td>
389                                                     [% END %]
390                                                 </tr>
391                                             [% END # / FOREACH ISSUE %]
392                                         </tbody>
393                                     </table>
394                                 [% ELSE %]
395                                     <h3>You currently have nothing checked out.</h3>
396                                 [% END # / IF issues_count %]
397                             </div> <!-- / #borrowerdetails -->
398                         </div>
399                         <div id="holds-tab" class="tab-pane" role="tabpanel" aria-labelledby="holds">
400                             [% IF HOLDS.count > 0 %]
401                                 [% PROCESS 'holds-table.inc' HOLDS = HOLDS, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds, onlyinfo = 'true' %]
402                             [% ELSE %]
403                                 <h3>You currently have no pending holds.</h3>
404                             [% END %]
405                         </div>
406                         <div id="account-tab" class="tab-pane" role="tabpanel" aria-labelledby="account">
407                             [% PROCESS 'account-table.inc' %]
408                         </div>
409                     </div>
410                         [% ELSE # IF validuser %]
411                             <div class="sco_entry" >
412                                 <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
413                                     <fieldset>
414                                         [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
415                                             <legend>Log in to your account</legend>
416                                             <label for="patronlogin">Login:</label>
417                                             <input type="text" id="patronlogin" class="focus noEnterSubmit" size="20" name="patronlogin" autocomplete="off"/>
418                                             <label for="patronpw">Password:</label>
419                                             <input type="password" id="patronpw" size="20" name="patronpw" autocomplete="off"/>
420                                             <fieldset class="action">
421                                                 <button type="submit" class="btn btn-primary">Log in</button>
422                                             </fieldset>
423                                         [% ELSE %]
424                                             <div class="form-row">
425                                                 <div class="col-auto">
426                                                     <label for="patronid">Please enter your card number:</label>
427                                                 </div>
428                                                 <div class="col-3">
429                                                     <input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" />
430                                                 </div>
431                                                 <div class="col-auto">
432                                                     <button type="submit" class="btn btn-primary">Submit</button>
433                                                 </div>
434                                             </div> <!-- /.form-row -->
435                                         [% END %]
436
437                                         [% FOREACH INPUT IN INPUTS %]
438                                             <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]">
439                                         [% END %]
440                                         <input type="hidden" name="op" value="login" />
441                                     </fieldset>
442                                 </form>
443                             </div> <!-- / .sco_entry -->
444                         [% END # / IF validuser %]
445                     [% END # / UNLESS ( hide_main %]
446                     [% IF ( Koha.Preference('SCOMainUserBlock' ) ) %]<div id="scomainuserblock">[% Koha.Preference('SCOMainUserBlock' ) | $raw %]</div>[% END %]
447                 </div> <!-- / .span12 -->
448             </div> <!-- / .row -->
449         </div> <!-- / .container-fluid -->
450     </div> <!-- / .main -->
451     <span id="audio-alert"></span>
452
453 [% INCLUDE 'opac-bottom.inc' %]
454 [% BLOCK jsinclude %]
455     [% INCLUDE 'datatables.inc' %]
456     <script>
457         function mungeHistory() {
458             // prevent back button from allowing form resubmission
459             if (history && history.pushState) {
460                 history.replaceState(null, document.title, window.location.href);
461             }
462         }
463         var mainTimeout;
464         function sco_init() {
465             mainTimeout = setTimeout(function() {
466                 location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
467             }, [% SelfCheckTimeout | html %]);
468         }
469         function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
470             // alert("dofocus called");
471             $(".focus:last").select();
472         }
473         var slip_re = /slip/;
474         function printx_window(print_type) {
475           var handler = print_type.match(slip_re) ? "printslip" : "moremember";
476
477           return false;
478         }
479         function checkout_confirm(patronid) {
480             var   barcode = $("#barcode").val();
481             // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
482             if (! barcode) { dofocus(); return false; }    // no barcode
483             if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode
484                 window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
485                 return false;
486             }
487             return true;
488         }
489         [% IF Koha.Preference('AudioAlerts') %]
490             var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" );
491             $( document ).ready(function() {
492                 if ( AUDIO_ALERTS ) {
493                     for ( var k in AUDIO_ALERTS ) {
494                         var alert = AUDIO_ALERTS[k];
495                         if ( $( alert.selector ).length ) {
496                             playSound( alert.sound );
497                             break;
498                         }
499                     }
500                 }
501             });
502             function playSound( sound ) {
503                 if (  ( sound.indexOf('http://') == 0 || sound.indexOf('https://') == 0 )  ) {
504                     document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
505                 }
506             }
507         [% END %]
508
509
510         $(document).ready(function() {
511             dofocus();
512             [% IF ( patronid ) %]sco_init();[% END %]
513             $("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
514                 "dom": "t",
515                 "order": [ 0 ],
516                 "columnDefs": [
517                     { "targets": [ "nosort" ], "sortable": false, "searchable": false },
518                     { "targets": [ "noshow" ], "visible": false, "searchable": false },
519                     { "type": "anti-the", "targets" : [ "anti-the" ] }
520                 ]
521             }));
522
523             $("#logout_form").on("click", function(e){
524                 e.preventDefault(e);
525                 clearTimeout(mainTimeout);
526                 [% IF Koha.Preference('SelfCheckReceiptPrompt') %]
527                     var confirmStart = Date.now();
528                     confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) {
529                         if ( result && (Date.now() - confirmStart) < [% SelfCheckTimeout | html %] ) {
530                             var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip");
531                             location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
532                         } else {
533                             location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
534                         }
535                     })
536                 sco_init();
537                 [% ELSE %]
538                     location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
539                 [% END %]
540
541                 return true;
542             });
543     });
544
545     </script>
546
547     [% IF ( Koha.Preference('SCOUserJS') ) %]<script>[% Koha.Preference('SCOUserJS') | $raw %]</script>[% END %]
548 [% END %]