Bug 19458: (follow-up) Self-check module highlighting
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sco / sco-main.tt
blobe004afd2b6eae1b2607e6c1742fc2b3c3255df00
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE AudioAlerts %]
6 [% USE Price %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10 <meta name="generator" content="Koha [% Version | html %]" /> <!-- leave this for stats -->
11 <link rel="shortcut icon" href="[% IF ( Koha.Preference('OpacFavicon') ) %][% Koha.Preference('OpacFavicon') | url %][% ELSE %][% interface | html %]/[% theme | html %]/images/favicon.ico[% END %]" type="image/x-icon" />
12 [% Asset.css("lib/bootstrap/css/bootstrap.min.css") | $raw %]
13 [% Asset.css("lib/jquery/jquery-ui.css") | $raw %]
14 [% Asset.css("css/sco.css") | $raw %]
15 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
16 [% IF ( Koha.Preference('SCOUserCSS') ) %]<style>[% Koha.Preference('SCOUserCSS') | $raw %]</style>[% END %]
17 <!--[if lt IE 9]>
18     <script src="[% interface | html %]/[% theme | html %]/lib/respond.min.js"></script>
19 <![endif]-->
20 <script>
21     function _(s) { return s } // dummy function for gettext
22 </script>
23 [% Asset.js("lib/modernizr.min.js") | $raw %]
24 </head>
25 <body id="sco_main" class="sco" onload="dofocus();" onunload="mungeHistory();">
26 [% INCLUDE 'masthead-sco.inc' %]
28     <div class="main">
29         <div class="container-fluid">
30             <div class="row-fluid">
31                 [% IF ( display_patron_image ) %]
32                     <div class="span10">
33                 [% ELSE %]
34                     <div class="span12">
35                 [% END %]
37                     <div id="masthead"><h1>[% LibraryName | html %] Self checkout system</h1></div>
39                     [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
40                         <div class="alert">
41                             <h3>Item cannot be checked out.</h3>
42                             <p>Sorry, this item cannot be checked out at this station.</p>
43                             [% IF ( title ) %]
44                                 <p>Title: <em>[% title | html %]</em> </p>
45                             [% END %]
47                             <p>
48                                 [% IF ( circ_error_UNKNOWN_BARCODE ) %]
49                                     The system does not recognize this barcode.
50                                 [% ELSIF ( circ_error_max_loans_allowed ) %]
51                                     You have checked out too many items and can't check out any more.
52                                 [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
53                                     This item is checked out to someone else.
54                                 [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
55                                     You cannot renew this item again.
56                                 [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
57                                     This item is not for loan.
58                                 [% ELSIF ( circ_error_DEBT ) %]
59                                     You owe the library [% DEBT | $Price %] and cannot check out.
60                                 [% ELSIF ( circ_error_WTHDRAWN ) %]
61                                     This item has been withdrawn from the collection.
62                                 [% ELSIF ( circ_error_RESTRICTED ) %]
63                                     This item is restricted.
64                                 [% ELSIF ( circ_error_RESERVED ) %]
65                                     This item is on hold for another patron.
66                                 [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
67                                     This item belongs to another branch.
68                                 [% ELSIF ( circ_error_EXPIRED ) %]
69                                     Your account has expired.
70                                 [% ELSIF ( circ_error_DEBARRED ) %]
71                                     Your account has been suspended.
72                                 [% ELSIF ( circ_error_CARD_LOST ) %]
73                                     This card has been declared lost.
74                                 [% ELSIF ( circ_error_GNA ) %]
75                                     Your contact information seems to be incomplete.
76                                 [% ELSIF ( circ_error_INVALID_DATE ) %]
77                                     Due date is not valid.
78                                 [% END %]
79                                 Please see a member of the library staff.
80                             </p>
82                             [% IF ( returnitem && Koha.Preference('AllowSelfCheckReturns') ) %]
83                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
84                                     <input type="hidden" name="op" value="returnbook" />
85                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
86                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
87                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
88                                     <button type="submit" name="returnbook" class="btn"><i class="return"></i> Return this item</button>
89                                 </form>
90                             [% END %]
92                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
93                                 <input type="hidden" name="op" value="" />
94                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
95                                 <input type="hidden" name="barcode" value="[% barcode | html %]" />
96                                 <input type="hidden" name="newissues" value="[% newissues | html %]" />
97                                 <input type="submit" name= "confirm" value="Return to account summary" class="btn back focus" />
98                             </form>
99                         </div> <!-- / .alert -->
100                     [% END # / IF ( impossible %]
102                     [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
103                         <div class="alert"><h3>Please confirm the checkout:</h3>
104                             [% IF ( confirm_renew_issue ) %]
105                                 <p>This item is already checked out to you.</p>
106                             [% END %]
108                             [% IF ( renew && Koha.Preference('AllowSelfCheckReturns') ) %]
109                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
110                                     <input type="hidden" name="op" value="returnbook" />
111                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
112                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
113                                     <input type="hidden" name="confirmed" value="" />
114                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
115                                     <button type="submit" name="returnbook" class="btn"><i class="icon return"></i> Return this item</button>
116                                 </form>
117                             [% END %]
119                             [% UNLESS ( renew ) %]
120                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
121                                     <input type="hidden" name="op" value="checkout" />
122                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
123                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
124                                     <input type="hidden" name="confirmed" value="1" />
125                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
126                                     <button type="submit" name="confirm" class="btn"><i class="icon renew"></i> Renew item</button>
127                                   </form>
128                             [% ELSE %]
129                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
130                                     <input type="hidden" name="op" value="checkout" />
131                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
132                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
133                                     <input type="hidden" name="confirmed" value="1" />
134                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
135                                     <button type="submit" class="btn"><i class="icon renew"></i> Renew item</button>
136                                 </form>
137                             [% END %]
139                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
140                                 <input type="hidden" name="op" value="" />
141                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
142                                 <input type="hidden" name="newissues" value="[% newissues | html %]" />
143                                 <button type="submit" class="btn"><i class="icon cancel"></i> Cancel</button>
144                             </form>
145                         </div>
146                     [% END # / IF confirm %]
148                     [% IF ( nopermission ) %]
149                         <!-- This is what is displayed if user doesn't have permission -->
150                         <div class="alert">
151                             <h3>Access denied</h3>
152                             <p>Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem.</p>
153                         </div>
154                     [% END %]
156                     [% IF ( different_ip ) %]
157                         <!-- This is what is displayed if user doesn't have permission -->
158                         <div class="alert">
159                             <h3>Session lost</h3>
160                             <p>You are accessing self-checkout from a different IP address! please log in again.</p>
161                         </div>
162                     [% END %]
164                     [% IF ( invalid_username_or_password ) %]
165                         <!-- This is what is displayed if user doesn't have permission -->
166                         <div class="alert">
167                             <h3>Record not found</h3>
168                             <p>Your userid was not found in the database.  Please try again.</p>
169                         </div>
170                     [% END %]
173                     [% UNLESS ( hide_main ) %]
175                         [% IF ( patronid ) %]
176                             [% IF ( validuser ) %]
177                                 <div class="alert alert-info">You are logged in as [% borrowername | html %].</div>
178                                 [% INCLUDE 'opac-note.inc' %]
179                                 [% IF patron_has_hold_fee %]
180                                     <div class="alert">A hold fee was charged to your account for collecting this item.</div>
181                                 [% END %]
182                             [% END %]
184                             [% IF ( nouser ) %]
185                                 <div class="alert">
186                                     <h4>Sorry</h4>
187                                     <p>The userid <strong>[% patronid | html %]</strong> was not found in the database.  Please try again.</p>
188                                 </div>
189                             [% END %]
190                         [% END # / IF patronid %]
192                         [% IF ( validuser ) %]
193                             <div id="newcheckout" class="sco_entry">
194                                 <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid | html %]');">
195                                     <fieldset>
196                                         <legend>Check out[% IF ( Koha.Preference('AllowSelfCheckReturns') ) %], return[% END %] or renew an item: </legend>
197                                         <div class="input-append">
198                                             <label for="barcode">Scan a new item or enter its barcode:</label>
199                                             <input id="barcode" name="barcode" size="20" type="text" class="focus" autocomplete="off" />
200                                             <button type="submit" class="btn">Submit</button>
201                                         </div>
202                                         <input type="hidden" name="op" value="checkout" />
203                                         <input type="hidden" name="patronid" value="[% patronid | html %]" />
204                                         <input type="hidden" name="newissues" value="[% newissues | html %]" />
205                                     </fieldset>
206                                 </form>
208                                 <div>
209                                     <form method="post" action="#" id="logout_form">
210                                         <button type="submit" class="btn"><i class="icon finish"></i> Finish</button>
211                                     </form>
212                                 </div>
213                             </div> <!-- / #newcheckout -->
214                 </div> <!-- / .span12/12 -->
215                 [% IF ( display_patron_image ) %]
216                     <div class="span2">
217                         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?borrowernumber=[% borrowernumber | html %]&csrf_token=[% csrf_token | html %]" alt="" />
218                     </div>
219                 [% END %]
220             </div> <!-- / .row-fluid -->
221         </div> <!-- / .container-fluid -->
223         <div class="container-fluid">
224             <div class="row-fluid">
225                     <div class="span12">
226                         <div id="borrowerdetails">
227                             [% IF ( issues_count ) %]
228                                 <table id="loanTable" class="table table-bordered table-striped">
229                                     <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption>
230                                     <!-- ISSUES TABLE ROWS -->
231                                     <thead>
232                                         <tr>
233                                             <th class="noshow">Checked out on</th>
234                                             <th class="anti-the">Title</th>
235                                             <th>Call no.</th>
236                                             <th class="title-string">Due</th>
237                                             <th class="nosort">Renew</th>
238                                             [% UNLESS ( nofines ) %]
239                                                 <th>Fines</th>
240                                             [% END %]
241                                         </tr>
242                                     </thead>
243                                     <tbody>
244                                         [% FOREACH ISSUE IN ISSUES %]
245                                             <tr>
246                                                 <td>[% ISSUE.issuedate | html %]</td>
247                                                 <td>
248                                                     [% UNLESS ( noitemlinks ) %]
249                                                         <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.  biblionumber | uri %]">[% ISSUE.title | html %]</a>
250                                                     [% ELSE %]
251                                                         <strong>[% ISSUE.title | html %]</strong>
252                                                     [% END %]
253                                                     [% IF ( newissues.match(ISSUE.barcode)) %]
254                                                         <span class="label label-info">NEW</span>
255                                                     [% END %]
256                                                     <span class="item-details">[% ISSUE.author | html %]</span>
257                                                     ([% ISSUE.barcode | html %])
258                                                 </td>
259                                                 <td>[% ISSUE.itemcallnumber | html %]</td>
260                                                 [% IF ( ISSUE.overdue ) %]
261                                                     <td class="overdue"><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates  as_due_date => 1 %]</span></td>
262                                                 [% ELSE   %]
263                                                     <td><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates  as_due_date => 1 %]</span></td>
264                                                 [% END %]
265                                                 <td>
266                                                     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
267                                                         <input type="hidden" name="patronid" value="[% patronid | html %]" />
268                                                         <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
269                                                         <input type="hidden" name="newissues" value="[% newissues | html %]" />
270                                                         [% IF ISSUE.can_be_renewed %]
271                                                             <input type="hidden" name="op" value="checkout" />
272                                                             <input type="hidden" name="confirmed" value="1" />
273                                                             [% UNLESS ( ISSUE.renew ) %]
274                                                                 <input type="submit" value="Renew item"  name="confirm  " class="btn renew" />
275                                                             [% ELSE %]
276                                                                 <input type="submit" value="Renew item" class="btn renew" />
277                                                             [% END %]
278                                                         [% ELSE %]
279                                                             [% IF ISSUE.renew_error == 'auto_renew' OR ISSUE.renew_error == 'auto_too_soon' %]
280                                                                 <span>This item has been scheduled for automatic renewal and cannot be renewed</span>
281                                                             [% ELSIF ISSUE.renew_error == 'onsite_checkout' %]
282                                                                 <span>This is a on-site checkout, it cannot be renewed.</span>
283                                                             [% ELSE %]
284                                                                 <span>No renewals allowed</span>
285                                                             [% END %]
286                                                             [% IF Koha.Preference('AllowSelfCheckReturns') %]
287                                                                 <input type="submit" value="Check in item" name="confirm" class="btn return" />
288                                                                 <input type="hidden" name="op" value="returnbook" />
289                                                                 <input type="hidden" name="confirmed" value=""  />
290                                                             [% END %]
291                                                         [% END %]
292                                                     </form>
293                                                 </td>
294                                                 [% UNLESS ( nofines ) %]
295                                                     <td>
296                                                         [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]
297                                                     </td>
298                                                 [% END %]
299                                             </tr>
300                                         [% END # / FOREACH ISSUE %]
301                                     </tbody>
302                                 </table>
303                             [% ELSE %]
304                                 <h3>You currently have nothing checked out.</h3>
305                             [% END # / IF issues_count %]
306                         </div> <!-- / #borrowerdetails -->
307                         [% ELSE # IF validuser %]
308                             <div class="sco_entry" >
309                                 <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
310                                     <fieldset class="checkout brief">
311                                         [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
312                                             <legend>Log in to your account</legend>
313                                             <label for="patronlogin">Login:</label>
314                                             <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
315                                             <label for="patronpw">Password:</label>
316                                             <input type="password" id="patronpw" size="20" name="patronpw" />
317                                             <fieldset class="action">
318                                                 <button type="submit" class="btn">Log in</button>
319                                             </fieldset>
320                                         [% ELSE %]
321                                             <div class="input-append">
322                                                 <label for="patronid">Please enter your card number:</label>
323                                                 <input type="text" id="patronid" class="focus" size="20" name="patronid" autocomplete="off" />
324                                                 <button type="submit" class="btn">Submit</button>
325                                             </div>
326                                         [% END %]
328                                         [% FOREACH INPUT IN INPUTS %]
329                                             <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]">
330                                         [% END %]
331                                         <input type="hidden" name="op" value="login" />
332                                     </fieldset>
333                                 </form>
334                             </div> <!-- / .sco_entry -->
335                         [% END # / IF validuser %]
336                     [% END # / UNLESS ( hide_main %]
337                     [% IF ( Koha.Preference('SCOMainUserBlock' ) ) %]<div id="scomainuserblock">[% Koha.Preference('SCOMainUserBlock' ) | $raw %]</div>[% END %]
338                 </div> <!-- / .span12 -->
339             </div> <!-- / .row-fluid -->
340         </div> <!-- / .container-fluid -->
341     </div> <!-- / .main -->
342     <span id="audio-alert"></span>
344 [% INCLUDE 'opac-bottom.inc' %]
345 [% BLOCK jsinclude %]
346     [% INCLUDE 'datatables.inc' %]
347     <script>
348         //<![CDATA[
349         function mungeHistory() {
350             // prevent back button from allowing form resubmission
351             if (history && history.pushState) {
352                 history.replaceState(null, document.title, window.location.href);
353             }
354         }
355         var mainTimeout;
356         function sco_init() {
357             mainTimeout = setTimeout(function() {
358                 location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
359             }, [% SelfCheckTimeout | html %]);
360         }
361         function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
362             // alert("dofocus called");
363             $(".focus:last").select();
364         }
365         var slip_re = /slip/;
366         function printx_window(print_type) {
367           var handler = print_type.match(slip_re) ? "printslip" : "moremember";
369           return false;
370         }
371         function checkout_confirm(patronid) {
372             var   barcode = $("#barcode").val();
373             // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
374             if (! barcode) { dofocus(); return false; }    // no barcode
375             if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode
376                 window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
377                 return false;
378             }
379             return true;
380         }
381         [% IF Koha.Preference('AudioAlerts') %]
382             var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) | replace( '"', '\\"' ) | html %]' );
383             $( document ).ready(function() {
384                 if ( AUDIO_ALERTS ) {
385                     for ( var k in AUDIO_ALERTS ) {
386                         var alert = AUDIO_ALERTS[k];
387                         if ( $( alert.selector ).length ) {
388                             playSound( alert.sound );
389                             break;
390                         }
391                     }
392                 }
393             });
394             function playSound( sound ) {
395                 if (  ( sound.indexOf('http://') == 0 || sound.indexOf('https://') == 0 )  ) {
396                     document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
397                 }
398             }
399         [% END %]
402         $(document).ready(function() {
403             dofocus();
404             [% IF ( patronid ) %]sco_init();[% END %]
405             $("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
406                 "order": [ 0 ],
407                 "columnDefs": [
408                     { "targets": [ "nosort" ], "sortable": false, "searchable": false },
409                     { "targets": [ "noshow" ], "visible": false, "searchable": false },
410                     { "type": "anti-the", "targets" : [ "anti-the" ] },
411                     { "type": "title-string", "targets" : [ "title-string" ] }
412                 ]
413             }));
415             $("#logout_form").submit(function(){
416                 clearTimeout(mainTimeout);
417                 [% IF Koha.Preference('SelfCheckReceiptPrompt') %]
418                     var confirmStart = Date.now();
419                     if(confirm(_("Would you like to print a receipt?"))){
420                         if ( (Date.now() - confirmStart) < [% SelfCheckTimeout | html %] ) {
421                             window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber | html %]&amp;print=qslip");
422                         } else {
423                             alert(_("Timeout while waiting for print confirmation"));
424                         }
425                     }
426                 [% END %]
428                 return true;
429             });
430     });
431     //]]>
432     </script>
434     [% IF ( Koha.Preference('SCOUserJS') ) %]<script>[% Koha.Preference('SCOUserJS') | $raw %]</script>[% END %]
435 [% END %]